using GFGGame; using SimpleJSON; using UnityEngine; using YooAsset; public class CommonDataManager2 : Singleton { public static cfg.Tables Tables; protected override void Awake() { base.Awake(); DontDestroyOnLoad(gameObject); } public void Init() { Tables = new cfg.Tables(LoadByteBuf); } private JSONNode LoadByteBuf(string file) { var str = ReadStringSync(file); if (string.IsNullOrEmpty(str)) { Debug.LogError("load luban json failed:" + file); return null; } return JSON.Parse(str); } public string ReadStringSync(string loc) { var handler = YooAssets.LoadAssetSync(loc); if (handler == null) { return null; } var data = handler.AssetObject as TextAsset; return data != null ? data.text : null; } }