FiberInit_Main.cs 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738
  1. using System.Collections.Generic;
  2. using MemoryPack;
  3. namespace ET
  4. {
  5. [Invoke((long)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. AA aa = root.AddComponent<AA>();
  15. BB bb = aa.AddComponent<BB>();
  16. CC cc = aa.AddComponent<CC>();
  17. bb.B = 1;
  18. cc.C = 2;
  19. byte[] bytes = MemoryPackSerializer.Serialize(aa);
  20. AA aa2 = MemoryPackSerializer.Deserialize<AA>(bytes);
  21. Log.Debug($"11111111111111111111111111: {aa2}");
  22. byte[] bytes2 = MongoHelper.Serialize(aa);
  23. AA aa3 = MongoHelper.Deserialize<AA>(bytes2);
  24. Log.Debug($"11111111111111111111111111: {aa3}");
  25. }
  26. }
  27. }