37 lines
740 B
C#
37 lines
740 B
C#
using System.Collections;
|
|
using System.Collections.Generic;
|
|
using System.IO;
|
|
using cfg;
|
|
using SimpleJSON;
|
|
using UnityEngine;
|
|
|
|
public class JsonTab
|
|
{
|
|
private static JsonTab instance;
|
|
|
|
public static JsonTab Instance
|
|
{
|
|
get { return instance; }
|
|
}
|
|
|
|
public Tables tables;
|
|
|
|
public JsonTab() // 这是构造函数
|
|
{
|
|
if (instance == null)
|
|
instance = this;
|
|
}
|
|
|
|
public void InitData(){
|
|
tables = new Tables(Loader);
|
|
}
|
|
|
|
private JSONNode Loader(string fileName)
|
|
{
|
|
string data = Resources.Load<TextAsset>("Data/"+fileName).text;
|
|
// File.ReadAllText(Application.streamingAssetsPath + "/" + fileName + ".json");
|
|
return JSON.Parse(data);
|
|
}
|
|
}
|
|
|