private void GameEnteredOnGameServer(OperationResponse operationResponse)
{
if (operationResponse.ReturnCode != 0)
{
switch (operationResponse.OperationCode)
{
case OperationCode.CreateGame:
if (PhotonNetwork.logLevel >= PhotonLogLevel.Informational)
{
Debug.Log("Create failed on GameServer. Changing back to MasterServer. Msg: " + operationResponse.DebugMessage);
}
SendMonoMessage(PhotonNetworkingMessage.OnPhotonCreateRoomFailed, operationResponse.ReturnCode, operationResponse.DebugMessage);
break;
case OperationCode.JoinGame:
if (PhotonNetwork.logLevel >= PhotonLogLevel.Informational)
{
Debug.Log("Join failed on GameServer. Changing back to MasterServer. Msg: " + operationResponse.DebugMessage);
if (operationResponse.ReturnCode == ErrorCode.GameDoesNotExist)
{
Debug.Log("Most likely the game became empty during the switch to GameServer.");
}
}
SendMonoMessage(PhotonNetworkingMessage.OnPhotonJoinRoomFailed, operationResponse.ReturnCode, operationResponse.DebugMessage);
break;
case OperationCode.JoinRandomGame:
if (PhotonNetwork.logLevel >= PhotonLogLevel.Informational)
{
Debug.Log("Join failed on GameServer. Changing back to MasterServer. Msg: " + operationResponse.DebugMessage);
if (operationResponse.ReturnCode == ErrorCode.GameDoesNotExist)
{
Debug.Log("Most likely the game became empty during the switch to GameServer.");
}
}
SendMonoMessage(PhotonNetworkingMessage.OnPhotonRandomJoinFailed, operationResponse.ReturnCode, operationResponse.DebugMessage);
break;
}
this.DisconnectToReconnect();
return;
}
Room current = new Room(enterRoomParamsCache.RoomName, null);
current.isLocalClientInside = true;
this.CurrentGame = current;
this.State = global::PeerState.Joined;
if (operationResponse.Parameters.ContainsKey(ParameterCode.ActorList))
{
int[] actorsInRoom = (int[])operationResponse.Parameters[ParameterCode.ActorList];
this.UpdatedActorList(actorsInRoom);
}
// the local player's actor-properties are not returned in join-result. add this player to the list
int localActorNr = (int)operationResponse[ParameterCode.ActorNr];
this.ChangeLocalID(localActorNr);
Hashtable actorProperties = (Hashtable)operationResponse[ParameterCode.PlayerProperties];
Hashtable gameProperties = (Hashtable)operationResponse[ParameterCode.GameProperties];
this.ReadoutProperties(gameProperties, actorProperties, 0);
if (!this.CurrentGame.serverSideMasterClient) this.CheckMasterClient(-1);
if (this.mPlayernameHasToBeUpdated)
{
this.SendPlayerName();
}
switch (operationResponse.OperationCode)
{
case OperationCode.CreateGame:
SendMonoMessage(PhotonNetworkingMessage.OnCreatedRoom);
break;
case OperationCode.JoinGame:
case OperationCode.JoinRandomGame:
// the mono message for this is sent at another place
break;
}
}