FiberInit_Main.cs 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940
  1. using System.Collections.Generic;
  2. using MemoryPack;
  3. namespace ET
  4. {
  5. [Invoke(SceneType.Main)]
  6. public class FiberInit_Main: AInvokeHandler<FiberInit, ETTask>
  7. {
  8. public override async ETTask Handle(FiberInit fiberInit)
  9. {
  10. Scene root = fiberInit.Fiber.Root;
  11. await EventSystem.Instance.PublishAsync(root, new EntryEvent1());
  12. await EventSystem.Instance.PublishAsync(root, new EntryEvent2());
  13. await EventSystem.Instance.PublishAsync(root, new EntryEvent3());
  14. /* 测试Entity自定义序列化反序列化
  15. AA aa = root.AddComponent<AA>();
  16. BB bb = aa.AddComponent<BB>();
  17. CC cc = aa.AddComponent<CC>();
  18. bb.B = 1;
  19. cc.C = 2;
  20. cc.IsSerilizeWithParent = true;
  21. byte[] bytes = MemoryPackSerializer.Serialize(aa);
  22. AA aa2 = MemoryPackSerializer.Deserialize<AA>(bytes);
  23. Log.Debug($"11111111111111111111111111: {aa2}");
  24. byte[] bytes2 = MongoHelper.Serialize(aa);
  25. AA aa3 = MongoHelper.Deserialize<AA>(bytes2);
  26. Log.Debug($"11111111111111111111111111: {aa3}");
  27. */
  28. }
  29. }
  30. }