Entry.cs 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  1. using System.IO;
  2. using MemoryPack;
  3. namespace ET
  4. {
  5. namespace EventType
  6. {
  7. public struct EntryEvent1
  8. {
  9. }
  10. public struct EntryEvent2
  11. {
  12. }
  13. public struct EntryEvent3
  14. {
  15. }
  16. }
  17. public static class Entry
  18. {
  19. public static void Init()
  20. {
  21. }
  22. public static void Start()
  23. {
  24. StartAsync().Coroutine();
  25. }
  26. private static async ETTask StartAsync()
  27. {
  28. WinPeriod.Init();
  29. MongoHelper.RegisterStruct<LSInput>();
  30. MongoHelper.Register();
  31. World.Instance.AddSingleton<EntitySystemSingleton>();
  32. World.Instance.AddSingleton<LSEntitySystemSingleton>();
  33. VProcess vProcess = VProcess.Instance;
  34. vProcess.AddSingleton<MainThreadSynchronizationContext>();
  35. vProcess.AddSingleton<TimeInfo>();
  36. vProcess.AddSingleton<IdGenerater>();
  37. vProcess.AddSingleton<TimerComponent>();
  38. vProcess.AddSingleton<CoroutineLockComponent>();
  39. vProcess.AddSingleton<NetServices>();
  40. Root root = vProcess.AddSingleton<Root>();
  41. await World.Instance.AddSingleton<ConfigComponent>().LoadAsync();
  42. await EventSystem.Instance.PublishAsync(root.Scene, new EventType.EntryEvent1());
  43. await EventSystem.Instance.PublishAsync(root.Scene, new EventType.EntryEvent2());
  44. await EventSystem.Instance.PublishAsync(root.Scene, new EventType.EntryEvent3());
  45. }
  46. }
  47. }