EntryEvent3_InitClient.cs 946 B

12345678910111213141516171819202122232425
  1. using System;
  2. using System.Collections.Generic;
  3. using System.IO;
  4. namespace ET.Client
  5. {
  6. [Event(SceneType.Main)]
  7. public class EntryEvent3_InitClient: AEvent<Scene, EntryEvent3>
  8. {
  9. protected override async ETTask Run(Scene root, EntryEvent3 args)
  10. {
  11. GlobalComponent globalComponent = root.AddComponent<GlobalComponent>();
  12. root.AddComponent<UIGlobalComponent>();
  13. root.AddComponent<UIComponent>();
  14. root.AddComponent<ResourcesLoaderComponent>();
  15. root.AddComponent<PlayerComponent>();
  16. root.AddComponent<CurrentScenesComponent>();
  17. // 根据配置修改掉Main Fiber的SceneType
  18. int sceneType = SceneTypeSingleton.Instance.GetSceneType(globalComponent.GlobalConfig.SceneName);
  19. root.SceneType = sceneType;
  20. await EventSystem.Instance.PublishAsync(root, new AppStartInitFinish());
  21. }
  22. }
  23. }