AppStart_Init.cs 1.4 KB

123456789101112131415161718192021222324252627282930313233343536
  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. ResourcesComponent.Instance.LoadBundle("config.unity3d");
  12. Game.Scene.AddComponent<ConfigComponent>();
  13. ConfigComponent.GetAllConfigBytes = LoadConfigHelper.LoadAllConfigBytes;
  14. await ConfigComponent.Instance.LoadAsync();
  15. ResourcesComponent.Instance.UnloadBundle("config.unity3d");
  16. Game.Scene.AddComponent<OpcodeTypeComponent>();
  17. Game.Scene.AddComponent<MessageDispatcherComponent>();
  18. Game.Scene.AddComponent<NetThreadComponent>();
  19. Game.Scene.AddComponent<ZoneSceneManagerComponent>();
  20. Game.Scene.AddComponent<GlobalComponent>();
  21. Game.Scene.AddComponent<AIDispatcherComponent>();
  22. ResourcesComponent.Instance.LoadBundle("unit.unity3d");
  23. Scene zoneScene = await SceneFactory.CreateZoneScene(1, "Process");
  24. await Game.EventSystem.Publish(new EventType.AppStartInitFinish() { ZoneScene = zoneScene });
  25. }
  26. }
  27. }