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

64 lines
1.9 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-03-04 18:40:14 +08:00
_hotfixAssembly = (List<Assembly>)objects[0];
2025-10-14 15:42:34 +08:00
UXComponentExtensionsHelper.SetLocalizationHelper(new UXLocalizationHelper());
2025-11-12 15:06:22 +08:00
Initlized().Forget();
2025-01-23 19:06:48 +08:00
}
2025-11-12 15:06:22 +08:00
public static async UniTaskVoid Initlized()
{
GameLocaizationTable table = await GameApp.Resource.LoadAssetAsync<GameLocaizationTable>("LocalizationTable");
GameApp.Localization.IncreAddLocalizationConfig(table);
Log.Info("加载多语言配置表完毕");
2025-11-13 17:46:33 +08:00
GameApp.UI.ShowUISync<UILoadUpdate>();
Log.Info("sdadasdas");
2025-12-26 14:23:01 +08:00
// GameApp.UI.CloseUI<UILoadUpdate>();
2025-11-12 15:06:22 +08:00
}
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
}