TH1/Unity/Assets/Scripts/HotfixView/Client/Demo/EntryEvent3_InitClient.cs
2025-07-17 18:26:28 +08:00

26 lines
966 B
C#

using System;
using System.Collections.Generic;
using System.IO;
namespace ET.Client
{
[Event(SceneType.Main)]
public class EntryEvent3_InitClient: AEvent<Scene, EntryEvent3>
{
protected override async ETTask Run(Scene root, EntryEvent3 args)
{
GlobalComponent globalComponent = root.AddComponent<GlobalComponent>();
root.AddComponent<UIGlobalComponent>();
root.AddComponent<UIComponent>();
root.AddComponent<ResourcesLoaderComponent>();
root.AddComponent<PlayerComponent>();
root.AddComponent<CurrentScenesComponent>();
// 根据配置修改掉Main Fiber的SceneType
SceneType sceneType = EnumHelper.FromString<SceneType>(globalComponent.GlobalConfig.AppType.ToString());
root.SceneType = sceneType;
await EventSystem.Instance.PublishAsync(root, new AppStartInitFinish());
}
}
}