AppStart_Init.cs 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. using System.Net;
  2. namespace ET
  3. {
  4. public class AppStart_Init: AEvent<EventType.AppStart>
  5. {
  6. public override async ETTask Run(EventType.AppStart args)
  7. {
  8. FunctionCallback.GetAllConfigBytes = LoadConfigHelper.LoadAllConfigBytes;
  9. Game.Scene.AddComponent<ConfigComponent>();
  10. await ConfigComponent.Instance.LoadAsync();
  11. StartProcessConfig processConfig = StartProcessConfigCategory.Instance.Get(Game.Options.Process);
  12. Game.Scene.AddComponent<TimerComponent>();
  13. Game.Scene.AddComponent<OpcodeTypeComponent>();
  14. Game.Scene.AddComponent<MessageDispatcherComponent>();
  15. Game.Scene.AddComponent<CoroutineLockComponent>();
  16. // 发送普通actor消息
  17. Game.Scene.AddComponent<ActorMessageSenderComponent>();
  18. // 发送location actor消息
  19. Game.Scene.AddComponent<ActorLocationSenderComponent>();
  20. // 访问location server的组件
  21. Game.Scene.AddComponent<LocationProxyComponent>();
  22. Game.Scene.AddComponent<ActorMessageDispatcherComponent>();
  23. // 数值订阅组件
  24. Game.Scene.AddComponent<NumericWatcherComponent>();
  25. Game.Scene.AddComponent<NetInnerComponent, IPEndPoint>(processConfig.InnerIPPort);
  26. var processScenes = StartSceneConfigCategory.Instance.GetByProcess(Game.Options.Process);
  27. foreach (StartSceneConfig startConfig in processScenes)
  28. {
  29. await SceneFactory.Create(Game.Scene, startConfig.SceneId, startConfig.Zone, startConfig.Name, startConfig.Type, startConfig);
  30. }
  31. }
  32. }
  33. }