AlicizaX/Client/Assets/Scripts/Hotfix/GameLogic/HotfixEntry.cs
2025-12-26 14:23:01 +08:00

64 lines
1.9 KiB
C#

using UnityEngine;
using System;
using System.IO;
using System.Collections;
using System.Collections.Generic;
using System.Reflection;
using System.Threading.Tasks;
using AlicizaX;
using AlicizaX.Localization;
using YooAsset;
using Cysharp.Threading.Tasks;
using Luban;
using UnityEngine.SceneManagement;
namespace GameLogic
{
public class UXLocalizationHelper : IUXLocalizationHelper
{
public string GetString(string key)
{
return GameApp.Localization.GetString(key);
}
}
public static class HotfixEntry
{
private static List<Assembly> _hotfixAssembly;
public static List<Assembly> HotfixAssembly => _hotfixAssembly;
public static void Entrance(object[] objects)
{
Log.Info("HotFix Logic Entry!");
_hotfixAssembly = (List<Assembly>)objects[0];
UXComponentExtensionsHelper.SetLocalizationHelper(new UXLocalizationHelper());
Initlized().Forget();
}
public static async UniTaskVoid Initlized()
{
GameLocaizationTable table = await GameApp.Resource.LoadAssetAsync<GameLocaizationTable>("LocalizationTable");
GameApp.Localization.IncreAddLocalizationConfig(table);
Log.Info("加载多语言配置表完毕");
GameApp.UI.ShowUISync<UILoadUpdate>();
Log.Info("sdadasdas");
// GameApp.UI.CloseUI<UILoadUpdate>();
}
/// <summary>
/// 加载二进制配置表
/// </summary>
/// <param name="file"></param>
/// <returns></returns>
private static async Task<ByteBuf> ConfigBufferLoader(string file)
{
var textAsset = await GameApp.Resource.LoadAssetAsync<TextAsset>(file);
byte[] bytes = textAsset.bytes;
GameApp.Resource.UnloadAsset(textAsset);
return ByteBuf.Wrap(bytes);
}
}
}