using AlicizaX.Runtime; using UnityEngine; using System; using System.IO; using System.Collections; using System.Threading.Tasks; using YooAsset; using Cysharp.Threading.Tasks; using Game.Config; using Game.Config.Tables; using Luban; namespace GameLogic { public static class HotfixEntry { private static TablesComponent tablesComponent; public static void Entrance(object[] objects) { Log.Info("HotFix Logic Entry!"); LoadConfig(); TestLog().Forget(); } static async UniTaskVoid TestLog() { await UniTask.Delay(2000); tablesComponent.SetTranslateText(TranslateText); Log.Debug(GameApp.Config.GetConfig().FirstOrDefault); } static async void LoadConfig() { tablesComponent = new TablesComponent(); tablesComponent.Init(GameApp.Config); await tablesComponent.LoadAsync(ConfigBufferLoader); } private static string TranslateText(string key, string content) { var localization = GameApp.Config.GetConfig().Get(key); if (localization == null) { Debug.Log(key + "--" + content); return key; } return localization.ChineseSimplified; } /// /// 加载二进制配置表 /// /// /// private static async Task ConfigBufferLoader(string file) { var textAsset = await GameApp.Resource.LoadAssetAsync(file); byte[] bytes = textAsset.bytes; GameApp.Resource.UnloadAsset(textAsset); return ByteBuf.Wrap(bytes); } } }