AppStart_Init.cs 1.3 KB

12345678910111213141516171819202122232425262728293031323334
  1. namespace ET
  2. {
  3. public class AppStart_Init: AEvent<EventType.AppStart>
  4. {
  5. public override async ETTask Run(EventType.AppStart args)
  6. {
  7. Game.Scene.AddComponent<TimerComponent>();
  8. Game.Scene.AddComponent<CoroutineLockComponent>();
  9. // 下载ab包
  10. //await BundleHelper.DownloadBundle("1111");
  11. // 加载配置
  12. Game.Scene.AddComponent<ResourcesComponent>();
  13. ResourcesComponent.Instance.LoadBundle("config.unity3d");
  14. Game.Scene.AddComponent<ConfigComponent>();
  15. ConfigComponent.GetAllConfigBytes = LoadConfigHelper.LoadAllConfigBytes;
  16. await ConfigComponent.Instance.LoadAsync();
  17. ResourcesComponent.Instance.UnloadBundle("config.unity3d");
  18. Game.Scene.AddComponent<OpcodeTypeComponent>();
  19. Game.Scene.AddComponent<MessageDispatcherComponent>();
  20. Game.Scene.AddComponent<UIEventComponent>();
  21. Game.Scene.AddComponent<NetThreadComponent>();
  22. ResourcesComponent.Instance.LoadBundle("unit.unity3d");
  23. Scene zoneScene = await SceneFactory.CreateZoneScene(1, 1, "Game");
  24. await Game.EventSystem.Publish(new EventType.AppStartInitFinish() { ZoneScene = zoneScene });
  25. }
  26. }
  27. }