using System;
using UnityEngine;
using ZSocket;
///
/// 监听消息, MsgType监听消息类型
///
[MessageHandler(MsgType = "DEMO_MSG_REQ")]
public class DemoMessageHandler : AMessageHandler
{
protected override void Handle(string msg)
{
Debug.Log($"Demo Handle Msg: {msg}");
}
}
///
/// 监听RPC消息,RecvMsgType为监听的消息类型,ReplyMsgType为回复的消息类型
///
[RpcHandler(RecvMsgType = "DEMO_RPC_REQ", ReplyMsgType = "DEMO_RPC_RESP")]
public class DemoRpcHandler : ARpcHandler
{
protected override void Handle(string inMsg, Action reply)
{
Debug.Log($"Demo Handle Rpc: {inMsg}");
reply.Invoke(inMsg);
}
}