Entry.cs 1.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970
  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 Test1()
  27. {
  28. using (await CoroutineLockComponent.Instance.Wait(CoroutineLockType.DB, 1, 2000))
  29. {
  30. await TimerComponent.Instance.WaitAsync(100000);
  31. }
  32. }
  33. private static async ETTask Test2()
  34. {
  35. using (await CoroutineLockComponent.Instance.Wait(CoroutineLockType.DB, 1, 10000))
  36. {
  37. await TimerComponent.Instance.WaitAsync(100000);
  38. }
  39. }
  40. private static async ETTask StartAsync()
  41. {
  42. WinPeriod.Init();
  43. MongoHelper.RegisterStruct<LSInput>();
  44. MongoHelper.Register();
  45. Game.AddSingleton<EntitySystemSingleton>();
  46. Game.AddSingleton<LSEntitySystemSington>();
  47. Game.AddSingleton<NetServices>();
  48. Game.AddSingleton<Root>();
  49. await Game.AddSingleton<ConfigComponent>().LoadAsync();
  50. await EventSystem.Instance.PublishAsync(Root.Instance.Scene, new EventType.EntryEvent1());
  51. await EventSystem.Instance.PublishAsync(Root.Instance.Scene, new EventType.EntryEvent2());
  52. await EventSystem.Instance.PublishAsync(Root.Instance.Scene, new EventType.EntryEvent3());
  53. }
  54. }
  55. }