Entry.cs 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  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. VProcess vProcess = VProcess.Instance;
  32. vProcess.AddSingleton<MainThreadSynchronizationContext>();
  33. vProcess.AddSingleton<TimeInfo>();
  34. vProcess.AddSingleton<IdGenerater>();
  35. vProcess.AddSingleton<TimerComponent>();
  36. vProcess.AddSingleton<CoroutineLockComponent>();
  37. vProcess.AddSingleton<EntitySystemSingleton>();
  38. vProcess.AddSingleton<LSEntitySystemSington>();
  39. vProcess.AddSingleton<NetServices>();
  40. RootEntity root = vProcess.AddSingleton<RootEntity>();
  41. await World.Instance.AddSingleton<ConfigComponent>().LoadAsync();
  42. await EventSystem.Instance.PublishAsync(root, new EventType.EntryEvent1());
  43. await EventSystem.Instance.PublishAsync(root, new EventType.EntryEvent2());
  44. await EventSystem.Instance.PublishAsync(root, new EventType.EntryEvent3());
  45. }
  46. }
  47. }