using System; using Model; using UnityEngine; namespace Hotfix { public static class ConfigHelper { public static string GetText(string key) { try { GameObject config = Model.Game.Scene.GetComponent().GetAsset("config.unity3d", "Config"); string configStr = config.Get(key).text; return configStr; } catch (Exception e) { throw new Exception($"load config file fail, key: {key}", e); } } public static string GetGlobal() { try { GameObject config = (GameObject)Resources.Load("KV"); string configStr = config.Get("GlobalProto").text; return configStr; } catch (Exception e) { throw new Exception($"load global config file fail", e); } } public static T ToObject(string str) { return JsonHelper.FromJson(str); } } }