AppStart_Init.cs 1.4 KB

12345678910111213141516171819202122232425262728293031323334
  1. namespace ET
  2. {
  3. public class AppStart_Init: AEvent<EventType.AppStart>
  4. {
  5. protected override async ETTask Run(EventType.AppStart args)
  6. {
  7. Game.Scene.AddComponent<TimerComponent>();
  8. Game.Scene.AddComponent<CoroutineLockComponent>();
  9. // 加载配置
  10. Game.Scene.AddComponent<ResourcesComponent>();
  11. await ResourcesComponent.Instance.LoadBundleAsync("config.unity3d");
  12. Game.Scene.AddComponent<ConfigComponent>();
  13. ConfigComponent.Instance.Load();
  14. ResourcesComponent.Instance.UnloadBundle("config.unity3d");
  15. Game.Scene.AddComponent<OpcodeTypeComponent>();
  16. Game.Scene.AddComponent<MessageDispatcherComponent>();
  17. Game.Scene.AddComponent<NetThreadComponent>();
  18. Game.Scene.AddComponent<SessionStreamDispatcher>();
  19. Game.Scene.AddComponent<ZoneSceneManagerComponent>();
  20. Game.Scene.AddComponent<GlobalComponent>();
  21. Game.Scene.AddComponent<AIDispatcherComponent>();
  22. await ResourcesComponent.Instance.LoadBundleAsync("unit.unity3d");
  23. Scene zoneScene = SceneFactory.CreateZoneScene(1, "Game", Game.Scene);
  24. await Game.EventSystem.PublishAsync(new EventType.AppStartInitFinish() { ZoneScene = zoneScene });
  25. }
  26. }
  27. }