private void OnWebRpcResponse(WebRpcResponse response) { if (response.ReturnCode != 0) { Debug.Log(response.ToStringFull()); // in an error case, it's often helpful to see the full response return; } if (response.Name.Equals("GetGameList")) { this.SavedGames.Clear(); if (response.Parameters == null) { Debug.Log("WebRpcResponse for GetGameList contains no rooms: " + response.ToStringFull()); return; } // the response for GetGameList contains a Room's name as Key and another Dictionary<string,object> with the values the web service sends foreach (KeyValuePair <string, object> pair in response.Parameters) { // per key (room name), we send // "ActorNr" which is the PlayerId/ActorNumber this user had in the room // "Properties" which is another Dictionary<string,object> with the properties that the lobby sees Dictionary <string, object> roomValues = pair.Value as Dictionary <string, object>; int savedActorNumber = (int)roomValues["ActorNr"]; Dictionary <string, object> savedRoomProps = roomValues["Properties"] as Dictionary <string, object>; // we are not yet using these in this demo this.SavedGames.Add(pair.Key, savedActorNumber); Debug.Log(pair.Key + " actorNr: " + savedActorNumber + " props: " + SupportClass.DictionaryToString(savedRoomProps)); } } }
private void OnWebRpcResponse(WebRpcResponse response) { if (response.ReturnCode != 0) { Debug.Log(response.ToStringFull()); // in an error case, it's often helpful to see the full response return; } }
private void OnWebRpcResponse(WebRpcResponse response) { Debug.Log("[DemoGame] OnWebRpcResponse: " + response.ToStringFull()); if (response.ReturnCode != 0) { Debug.Log(response.ToStringFull()); // in an error case, it's often helpful to see the full response return; } if (response.Name.Equals("GetGameList")) { this.SavedGames.Clear(); if (response.Parameters == null) { Debug.Log("WebRpcResponse for GetGameList contains no rooms: " + response.ToStringFull()); return; } // the response for GetGameList contains a Room's name as Key and another Dictionary<string,object> with the values the web service sends foreach (KeyValuePair<string, object> pair in response.Parameters) { // per key (room name), we send // "ActorNr" which is the PlayerId/ActorNumber this user had in the room // "Properties" which is another Dictionary<string,object> with the properties that the lobby sees Dictionary<string, object> roomValues = pair.Value as Dictionary<string, object>; int savedActorNumber = (int)roomValues["ActorNr"]; Dictionary<string, object> savedRoomProps = roomValues["Properties"] as Dictionary<string, object>; // we are not yet using these in this demo this.SavedGames.Add(pair.Key, savedActorNumber); Debug.Log(pair.Key + " actorNr: " + savedActorNumber + " props: " + SupportClass.DictionaryToString(savedRoomProps)); } } }