MessageDispatcherComponent.cs 767 B

12345678910111213141516171819202122232425262728293031
  1. using System.Collections.Generic;
  2. namespace ET
  3. {
  4. public class MessageDispatcherInfo
  5. {
  6. public SceneType SceneType { get; }
  7. public IMHandler IMHandler { get; }
  8. public MessageDispatcherInfo(SceneType sceneType, IMHandler imHandler)
  9. {
  10. this.SceneType = sceneType;
  11. this.IMHandler = imHandler;
  12. }
  13. }
  14. /// <summary>
  15. /// 消息分发组件
  16. /// </summary>
  17. [ComponentOf(typeof(Scene))]
  18. public class MessageDispatcherComponent: Entity, IAwake, IDestroy, ILoad
  19. {
  20. public static MessageDispatcherComponent Instance
  21. {
  22. get;
  23. set;
  24. }
  25. public readonly Dictionary<ushort, List<MessageDispatcherInfo>> Handlers = new();
  26. }
  27. }