This commit is contained in:
azw 2024-05-22 08:51:14 +08:00
parent 1235fada93
commit e05bd5bded
3 changed files with 6 additions and 6 deletions

View File

@ -9,8 +9,8 @@ using pbr = global::Google.Protobuf.Reflection;
namespace F6
{
public delegate Google.Protobuf.IMessage CreateMsg();
public delegate void HandlerMsg(Google.Protobuf.IMessage msg);
internal delegate Google.Protobuf.IMessage CreateMsg();
internal delegate void HandlerMsg(Google.Protobuf.IMessage msg);
internal class HandlerRec
{
internal CreateMsg createMsg;
@ -19,8 +19,7 @@ namespace F6
class MsgHandler
{
public delegate void HandlerDelegate(int msgId, byte[] msg);
public delegate void HandlerDelegateEx<in T>(T msg);
public delegate void HandlerDelegate<in T>(T msg);
private Type cmMsgType;
private Type smMsgType;
@ -60,7 +59,7 @@ namespace F6
return 0;
}
protected void RegisterHandler<T>(HandlerDelegateEx<T> handler) where T : IMessage<T> ,new()
protected void RegisterHandler<T>(HandlerDelegate<T> handler) where T : IMessage<T> ,new()
{
int msgId = this.GetSMMsgId(typeof(T).Name);
HandlerRec handler1;

View File

@ -8,7 +8,7 @@ namespace Net
{
class BattleHandler : F6.MsgHandler
{
public HandlerDelegateEx<battle.cs.SMKcpHandshake> SMKcpHandshakeHandler;
public HandlerDelegate<battle.cs.SMKcpHandshake> SMKcpHandshakeHandler;
public BattleHandler(): base(typeof(battle.cs.CMMessageId_e), typeof(battle.cs.SMMessageId_e))
{

View File

@ -96,6 +96,7 @@ namespace Net
data[9] = (byte)((magicCode & 0xFFFF) >> 8);
data[10] = 0;
data[11] = 0;
msg.ToByteArray().CopyTo(data, 12);
this.ws.Send(data);
}catch(Exception e)