Framework_YooAsset_HybridCLR/Assets/DemoGame/GameScript/Hotfix/Config/ConfigManager.cs

51 lines
1.4 KiB
C#
Raw Normal View History

2024-07-19 14:52:57 +08:00
using System;
using cfg;
using UnityEngine;
using Luban;
using SimpleJSON;
namespace ZC
{
internal class ConfigManager : ManagerBase<ConfigManager>
{
Tables tables;
public override void OnInit()
{
base.OnInit();
string gameConfDir = "<outputDataDir>"; // 替换为gen.bat中outputDataDir指向的目录
2024-07-19 16:19:55 +08:00
2024-07-19 14:52:57 +08:00
tables = new cfg.Tables(this.JX);
var item = tables.TbItem.Get(10001);
UnityEngine.Debug.Log($"tb id : {item.Id}, name: {item.Name}, desc: {item.Desc}");
var playerData = this.tables.TBPlayer.Get(10001);
UnityEngine.Debug.Log($"playerData id : {playerData.Id}, name: {playerData.Name}, desc: {playerData.Desc}");
}
private JSONNode JX(string arg)
{
string path = String.Empty;
switch (arg)
{
case "item_tbitem":
path = AssetConst.Assets_DemoGame_GameRes_Config_JSON_item_tbitem_json;
break;
case "tbplayer":
path = AssetConst.Assets_DemoGame_GameRes_Config_JSON_tbplayer_json;
break;
default:
break;
}
var textAsset = ResourcesLocalComponent.Instance.LoadAssetSync<TextAsset>(path);
return JSON.Parse(textAsset.text);
}
}
public class AA
{
void A()
{
}
}
}