Entry.cs 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. using System;
  2. namespace ET
  3. {
  4. public struct EntryEvent1
  5. {
  6. }
  7. public struct EntryEvent2
  8. {
  9. }
  10. public struct EntryEvent3
  11. {
  12. }
  13. public static class Entry
  14. {
  15. public static void Init()
  16. {
  17. }
  18. public static void Start()
  19. {
  20. StartAsync().Coroutine();
  21. }
  22. private static async ETTask StartAsync()
  23. {
  24. WinPeriod.Init();
  25. // 注册Mongo type
  26. MongoRegister.Init();
  27. MemoryPackRegister.Init();
  28. // 注册Entity序列化器
  29. EntitySerializeRegister.Init();
  30. World.Instance.AddSingleton<SceneTypeSingleton, Type>(typeof(SceneType));
  31. World.Instance.AddSingleton<ObjectPool>();
  32. World.Instance.AddSingleton<IdGenerater>();
  33. World.Instance.AddSingleton<OpcodeType>();
  34. World.Instance.AddSingleton<MessageQueue>();
  35. World.Instance.AddSingleton<NetServices>();
  36. World.Instance.AddSingleton<LogMsg>();
  37. // 创建需要reload的code singleton
  38. CodeTypes.Instance.CreateCode();
  39. await World.Instance.AddSingleton<ConfigLoader>().LoadAsync();
  40. await FiberManager.Instance.Create(SchedulerType.Main, SceneType.Main, 0, SceneType.Main, "");
  41. }
  42. }
  43. }