/// <summary> /// 广播消息:通过gate转发给client /// </summary> public void BroadcastProxyMsg(PackBaseS2C packet) { foreach (var obj in m_app_servers) { if (obj.Value.srv_info.srv_type == eServerType.GATE) { ProxyS2CMsg msg = PacketPools.Get((ushort)ss2gs.msg.PROXY_SS_MSG) as ProxyS2CMsg; msg.is_broadcast = true; msg.Set(packet.client_uid, packet); obj.Value.Send(msg); } } PacketPools.Recover(packet);//回收消息本身 }
/// <summary> /// 通过gate转发给client /// </summary> public int SendProxy(ClientUID client_uid, PackBaseS2C packet, bool is_broadcast = false) { int size = 0; ConnAppProc app_server; if (m_srv_servers.TryGetValue(client_uid.srv_uid, out app_server)) { ProxyS2CMsg msg = PacketPools.Get((ushort)ss2gs.msg.PROXY_SS_MSG) as ProxyS2CMsg; msg.is_broadcast = is_broadcast; msg.Set(client_uid, packet); size = Send(app_server.conn_idx, msg); } PacketPools.Recover(packet);//回收消息本身 return(size); }
/// <summary> /// 发给客户端 /// </summary> public int SendProxy(ClientUID client_uid, PackBaseS2C packet) { int size = 0; ConnAppProc app_server; if (m_srv_servers.TryGetValue(client_uid.srv_uid, out app_server)) { ProxyS2CMsg msg = PacketPools.Get((ushort)ws2gs.msg.PROXY_WS_MSG) as ProxyS2CMsg; msg.Set(client_uid, packet); size = Send(app_server.conn_idx, msg); } else { Log.Debug("未找到服务器id:" + client_uid.srv_uid); } PacketPools.Recover(packet);//回收消息本身 return(size); }