MessageProxy.cs 574 B

1234567891011121314151617181920212223242526
  1. using System;
  2. namespace KYFramework.Network
  3. {
  4. public class MessageProxy : IMHandler
  5. {
  6. private readonly Type type;
  7. private readonly Action<Session, object> action;
  8. public MessageProxy(Type type, Action<Session, object> action)
  9. {
  10. this.type = type;
  11. this.action = action;
  12. }
  13. public void Handle(Session session, object message)
  14. {
  15. this.action.Invoke(session, message);
  16. }
  17. public Type GetMessageType()
  18. {
  19. return this.type;
  20. }
  21. }
  22. }