// private bool _CreateMsgExecFun(UInt16 type, UInt16 id, ref CSLib.Framework.DMsgExecFunc msgExecut) { Message.EMsgType msgType = (Message.EMsgType)type; switch (msgType) { case Message.EMsgType.EMT_SAMPLE: { return(_SampleMsgExecFun(id, ref msgExecut)); } } Console.WriteLine("无法解析的消息类型{0}", type); return(false); }
private bool _SampleMsgExecFun(ushort id, ref CSLib.Framework.DMsgExecFunc msgExecut) { Message.EMsgID msgID = (Message.EMsgID)id; switch (msgID) { case Message.EMsgID.EMID_SAMPLE_NTF_OK: { msgExecut = _OnMsgTestNtfOk; return(true); } case Message.EMsgID.EMID_SAMPLE_REQ_SAY: { msgExecut = _OnMsgTestReqSay; return(true); } } Console.WriteLine("无法解析的消息ID{0}", id); return(false); }
/// <summary> /// 添加消息处理函数(逻辑层主要使用) /// </summary> /// <param name="server">消息的目标服务器类型,客户端是EServerType.ESERVER_GAMECLIENT</param> /// <param name="func">消息的系统类型。例如EFuncType.EFUNC_LOGINSYSTEM</param> /// <param name="id">消息的枚举ID,定义在各系统消息的。例如EMsgIDLoginSYstem.EMID_XX2XX_MSG</param> /// <param name="msgExecObj">处理函数委托</param> /// <returns></returns> public bool AddMsgExecFunc(byte server, byte func, UInt16 id, CSLib.Framework.DMsgExecFunc msgExecObj) { return(m_msgExecute.AddMsgExecFunc(server, func, id, msgExecObj)); }
/// <summary> /// 添加消息处理函数 /// </summary> /// <param name="type">消息类型</param> /// <param name="id">消息ID</param> /// <param name="msgExecObj">处理函数委托</param> /// <returns></returns> public bool AddMsgExecFunc(UInt16 type, UInt16 id, CSLib.Framework.DMsgExecFunc msgExecObj) { return(m_msgExecute.AddMsgExecFunc(type, id, msgExecObj)); }