AppStart_Init.cs 1.4 KB

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