AlicizaX/Client/Assets/Scripts/Hotfix/GameLogic/HotfixEntry.cs
2025-11-11 16:02:45 +08:00

57 lines
1.6 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());
GameLocaizationTable table = GameApp.Resource.LoadAsset<GameLocaizationTable>("LocalizationTable");
GameApp.Localization.IncreAddLocalizationConfig(table);
}
/// <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);
}
}
}