AlicizaX/Client/Assets/Scripts/Hotfix/GameLogic/HotfixEntry.cs

57 lines
1.6 KiB
C#
Raw Normal View History

2025-01-23 19:06:48 +08:00
using UnityEngine;
using System;
using System.IO;
using System.Collections;
2025-03-04 18:40:14 +08:00
using System.Collections.Generic;
using System.Reflection;
2025-01-23 19:06:48 +08:00
using System.Threading.Tasks;
2025-04-28 19:45:45 +08:00
using AlicizaX;
2025-10-14 15:42:34 +08:00
using AlicizaX.Localization;
2025-01-23 19:06:48 +08:00
using YooAsset;
using Cysharp.Threading.Tasks;
using Luban;
2025-03-04 18:40:14 +08:00
using UnityEngine.SceneManagement;
2025-01-23 19:06:48 +08:00
namespace GameLogic
{
2025-10-14 15:42:34 +08:00
public class UXLocalizationHelper : IUXLocalizationHelper
{
public string GetString(string key)
{
return GameApp.Localization.GetString(key);
}
}
2025-01-23 19:06:48 +08:00
public static class HotfixEntry
{
2025-03-04 18:40:14 +08:00
private static List<Assembly> _hotfixAssembly;
public static List<Assembly> HotfixAssembly => _hotfixAssembly;
2025-01-23 19:06:48 +08:00
2025-09-02 16:30:55 +08:00
2025-01-23 19:06:48 +08:00
public static void Entrance(object[] objects)
{
Log.Info("HotFix Logic Entry!");
2025-04-28 19:45:45 +08:00
2025-03-04 18:40:14 +08:00
_hotfixAssembly = (List<Assembly>)objects[0];
2025-10-14 15:42:34 +08:00
UXComponentExtensionsHelper.SetLocalizationHelper(new UXLocalizationHelper());
GameLocaizationTable table = GameApp.Resource.LoadAsset<GameLocaizationTable>("LocalizationTable");
GameApp.Localization.IncreAddLocalizationConfig(table);
2025-01-23 19:06:48 +08:00
}
/// <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);
}
}
2025-01-24 16:21:00 +08:00
}