mirror of
https://github.com/Alex-Rachel/TEngine.git
synced 2025-08-14 16:51:28 +00:00
[+] 接入ET8服务端
[+] 接入ET8服务端
This commit is contained in:
@@ -0,0 +1,37 @@
|
||||
using System;
|
||||
|
||||
namespace ET
|
||||
{
|
||||
public abstract class MessageHandler<Message>: IMHandler where Message : class
|
||||
{
|
||||
protected abstract ETTask Run(Session session, Message message);
|
||||
|
||||
public void Handle(Session session, object msg)
|
||||
{
|
||||
Message message = msg as Message;
|
||||
if (message == null)
|
||||
{
|
||||
Log.Error($"消息类型转换错误: {msg.GetType().FullName} to {typeof (Message).Name}");
|
||||
return;
|
||||
}
|
||||
|
||||
if (session.IsDisposed)
|
||||
{
|
||||
Log.Error($"session disconnect {msg}");
|
||||
return;
|
||||
}
|
||||
|
||||
this.Run(session, message).Coroutine();
|
||||
}
|
||||
|
||||
public Type GetMessageType()
|
||||
{
|
||||
return typeof (Message);
|
||||
}
|
||||
|
||||
public Type GetResponseType()
|
||||
{
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user