Beispiel #1
0
    /// Handles the response of the QueryCollection call to ChilliConnect. Loads the returned
    /// objects in to a list of Team definitions and notifies listeners.
    ///
    /// @param response
    ///         The response of the QueryCollection method
    ///
    private void OnTeamsFetched(QueryCollectionResponse response)
    {
        Teams.Clear();
        foreach (CollectionDataObject teamObject in response.Objects)
        {
            var teamProperties = teamObject.Value.AsDictionary();

            var team = new Team();
            team.ID          = teamObject.ObjectId;
            team.Name        = teamProperties.GetString("Name");
            team.PlayerCount = teamProperties.GetList("Players").Count;
            Teams.Add(team);
        }

        OnTeamsRefreshed(Teams);
    }
Beispiel #2
0
    private void StartMatchmakingCallback(QueryCollectionResponse response)
    {
        if (response.Total > 0)
        {
            var matchObject = response.Objects [0];

            SaveMatchId(matchObject.ObjectId);

            CurrentMatch.MatchId = matchObject.ObjectId;
            CurrentMatch.Update(matchObject.Value.AsDictionary());
            CurrentMatch.OccupyEmptyPlayerPosition(m_chilliConnectId);

            SaveMatchOnServer();
            OnMatchMakingSuceeded(CurrentMatch);
        }
        else
        {
            OnMatchMakingFailed();
        }
    }