public override void Connect(PhotonServerPeer serverPeer) { if ((serverPeer.ServerType & (int)ServerType.Region) != 0) { Dictionary <byte, object> parameters = new Dictionary <byte, object>(); Dictionary <string, string> serverList = Servers.Where( incomingSubServerPeer => incomingSubServerPeer.Value.ServerId.HasValue && !incomingSubServerPeer.Value.ServerId.Equals(serverPeer.ServerId) && (incomingSubServerPeer.Value.ServerType & (int)ServerType.Region) != 0) .ToDictionary( incomingSubServerPeer => incomingSubServerPeer.Value.ApplicationName, incomingSubServerPeer => incomingSubServerPeer.Value.TcpAddress); if (serverList.Count > 0) { if (Log.IsDebugEnabled) { Log.DebugFormat("Sending list of {0} connected sub servers", serverList.Count); } parameters.Add((byte)ServerParameterCode.SubServerDictionary, serverList); serverPeer.SendEvent(new EventData((byte)ServerEventCode.SubServerList, parameters), new SendParameters()); } } }
protected override bool OnHandleMessage(IMessage message, PhotonServerPeer serverPeer) { var para = new Dictionary <byte, object>() { { (byte)ClientParameterCode.PeerId, message.Parameters[(byte)ClientParameterCode.PeerId] }, { (byte)ClientParameterCode.SubOperationCode, message.Parameters[(byte)ClientParameterCode.SubOperationCode] }, { (byte)ClientParameterCode.Object, SerializeUtil.Serialize(_fightManager.GetAllQueues()) }, }; serverPeer.SendEvent(new EventData(message.Code) { Parameters = para }, new SendParameters()); return(true); }
public override void Connect(PhotonServerPeer serverPeer) { if ((serverPeer.ServerType & (int) ServerType.Region) != 0) { var parameters = new Dictionary<byte, object>(); var serverList = Servers.Where( incomingSubServerPeer => incomingSubServerPeer.Value.ServerId.HasValue && !incomingSubServerPeer.Value.ServerId.Equals(serverPeer.ServerId) && (incomingSubServerPeer.Value.ServerType & (int) ServerType.Region) != 0) .ToDictionary(incomingSubServerPeer => incomingSubServerPeer.Value.ApplicationName, incomingSubServerPeer => incomingSubServerPeer.Value.TcpAddress); if (serverList.Count > 0) { if (Log.IsDebugEnabled) { Log.DebugFormat("Sending list of {0} connected sub servers ", serverList.Count); } parameters.Add((byte) ServerParameterCode.SubServerDictionary, serverList); serverPeer.SendEvent(new EventData((byte) ServerEventCode.SubServerList, parameters), new SendParameters()); } } }