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

42 lines
952 B
C#

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;
}
}
}