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

69 lines
1.9 KiB
C#
Raw Normal View History

2025-01-23 19:06:48 +08:00
using AlicizaX.Runtime;
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;
using YooAsset;
using Cysharp.Threading.Tasks;
using Game.Config;
using Game.Config.Tables;
using Luban;
2025-03-04 18:40:14 +08:00
using UnityEngine.SceneManagement;
2025-01-23 19:06:48 +08:00
namespace GameLogic
{
2025-03-04 18:40:14 +08:00
public interface ITestEvent : IEvent
{
}
2025-01-23 19:06:48 +08:00
public static class HotfixEntry
{
private static TablesComponent tablesComponent;
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
public static void Entrance(object[] objects)
{
Log.Info("HotFix Logic Entry!");
LoadConfig();
2025-03-04 18:40:14 +08:00
_hotfixAssembly = (List<Assembly>)objects[0];
new GameObject().AddComponent<TestMono>();
GameApp.Scene.LoadScene("Map1000", LoadSceneMode.Additive, false, 100, CallBack, false, ProgressCallBack);
2025-01-23 19:06:48 +08:00
}
2025-03-04 18:40:14 +08:00
private static void ProgressCallBack(float obj)
{
Log.Info(obj);
}
2025-01-23 19:06:48 +08:00
2025-03-04 18:40:14 +08:00
private static void CallBack(SceneHandle obj)
2025-01-23 19:06:48 +08:00
{
2025-03-04 18:40:14 +08:00
2025-01-23 19:06:48 +08:00
}
2025-03-04 18:40:14 +08:00
2025-01-23 19:06:48 +08:00
static async void LoadConfig()
{
tablesComponent = new TablesComponent();
tablesComponent.Init(GameApp.Config);
await tablesComponent.LoadAsync(ConfigBufferLoader);
}
/// <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
}