IndieGame/client/Assets/Scripts/Config/Table/TableProvider.cs

42 lines
952 B
C#
Raw Normal View History

2024-10-11 10:12:15 +08:00
using TableConfig;
using SimpleJSON;
using System.Collections;
using System.Collections.Generic;
using System.IO;
using UnityEngine;
namespace Ether
{
public static class TableProvider
{
private static string tableDir = Application.streamingAssetsPath + "/Tables";
private static Tables tables;
public static Tables Tables
{
get
{
if (tables == null)
{
tables = new Tables(file => JSON.Parse(File.ReadAllText($"{tableDir}/{file}.json")));
}
return tables;
}
}
public static void Init()
{
tables = new Tables(file => JSON.Parse(File.ReadAllText($"{tableDir}/{file}.json")));
}
/// <summary>
/// 重置数据
/// </summary>
public static void ResetCounter()
{
tables = null;
}
2024-10-11 10:12:15 +08:00
}
}