//private void Update() //{ // If you aren't attaching brainCloud as a Component to a gameObject, // you must manually update it with this call. // _bc.Update(); // // Given we are using a game Object. Leave _bc.Update commented out. //} //Callback used for "Play Again?" scenario public void RTTEventCallback(string json) { var jsonData = JsonReader.Deserialize <Dictionary <string, object> >(json); var data = jsonData["data"] as Dictionary <string, object>; if (data.ContainsKey("eventData")) { var eventData = data["eventData"] as Dictionary <string, object>; if (eventData.ContainsKey("isReady")) { AskedToRematch = (bool)eventData["isReady"]; //Enable play again screen to the asked user if (!IsAskingToRematch && AskedToRematch) { if (eventData.Count > 1) { //Set Up opponent reference that wants to rematch OpponentInfo = new PlayerInfo { ProfileId = (string)eventData["opponentProfileID"], PlayerName = (string)eventData["opponentName"], }; MatchId = (string)eventData["matchID"]; OwnerId = (string)eventData["ownerID"]; } if (_localTicTacToe) { _localTicTacToe.AskToRematchScreen.SetActive(true); } else if (_localMatchSelect) { _localMatchSelect.AskToRematchScreen.SetActive(true); } } else if (AskedToRematch) { if (_localTicTacToe) { GotoMatchSelectScene(_localTicTacToe.gameObject); } } } else if (eventData.ContainsKey("gameConcluded")) { CurrentMatch.scoreSubmitted = true; } string eventID = (string)data["evId"]; Bc.EventService.DeleteIncomingEvent(eventID); } }
private void IncrementStat(string responseData, object cbPostObject) { Debug.Log($"STATS: {responseData}"); var jsonData = JsonReader.Deserialize <Dictionary <string, object> >(responseData); var data = jsonData["data"] as Dictionary <string, object>; var statistics = data["statistics"] as Dictionary <string, object>; var numberOfWins = (int)statistics["WON_RANKED_MATCH"]; numberOfWins++; var dataToSend = new Dictionary <string, object>(); dataToSend["WON_RANKED_MATCH"] = numberOfWins.ToString(); Bc.PlayerStatisticsService.IncrementUserStats(dataToSend, IncrementStatSuccess); }