public void SendPlayerMsg <T>(Player player, Pbmsg.ServerCmdDef cmd, T pbMsgData) where T : pb::IMessage, new() { GateRouteMsgToSessionReq msgToSession = new GateRouteMsgToSessionReq() { Cmd = (Int16)cmd, Body = Util.Pb2String(pbMsgData) }; msgToSession.Session_id.Add(player.nSessionID); m_ffrpc.Call(m_strDefaultGate, msgToSession); }
public void SessionSendMsg <T>(Int64 nSessionID, Int16 nCmd, T pbMsgData) where T : pb::IMessage, new() { GateRouteMsgToSessionReq msgToSession = new GateRouteMsgToSessionReq() { Cmd = nCmd, Body = Util.Pb2Byte(pbMsgData) }; msgToSession.SessionId.Add(nSessionID); m_ffrpc.Call(m_strDefaultGate, msgToSession); }
public void SessionMulticastMsg <T>(Int64[] listSessionID, Int16 nCmd, T pbMsgData) where T : pb::IMessage, new() { GateRouteMsgToSessionReq msgToSession = new GateRouteMsgToSessionReq() { Cmd = nCmd, Body = Util.Pb2Byte(pbMsgData) }; foreach (var nSessionID in listSessionID) { msgToSession.SessionId.Add(nSessionID); } m_ffrpc.Call(m_strDefaultGate, msgToSession); }
//! 转发消息给client public EmptyMsgRet RouteMsgToSession(GateRouteMsgToSessionReq reqMsg) { byte[] dataBody = reqMsg.Body;// Util.String2Byte(reqMsg.Body); foreach (var sessionID in reqMsg.SessionId) { if (m_dictClients.ContainsKey(sessionID) == false) { continue; } ClientInfo cinfo = m_dictClients[sessionID]; FFNet.SendMsg(cinfo.sockObj, (UInt16)reqMsg.Cmd, dataBody); } return(m_msgEmpty); }
public void SendPlayerMsg <T>(Player player, Pbmsg.ServerCmdDef cmd, T pbMsgData) where T : pb::IMessage, new() { Int64 nSessionID = player.nSessionID; Int16 nCmd = (Int16)cmd; if (player.idZhuTi != 0) { nSessionID = player.idZhuTi; //nCmd |= 0x4000; } GateRouteMsgToSessionReq msgToSession = new GateRouteMsgToSessionReq() { Cmd = nCmd, Body = Util.Pb2Byte(pbMsgData) }; msgToSession.SessionId.Add(nSessionID); m_ffrpc.Call(m_strDefaultGate, msgToSession); }