Exemplo n.º 1
0
    public void SubmitTurn()
    {
        UnityEngine.Debug.Log("Submitting turn");

        var submitTurnRequest = new SubmitTurnRequestDesc(CurrentGame.MatchId);

        submitTurnRequest.StateData = CurrentGame.AsMultiTypeDictionary();
        if (CurrentGame.MatchState == GameState.MATCHSTATE_COMPLETE)
        {
            var outcomeDataBuilder = new SdkCore.MultiTypeDictionaryBuilder();
            outcomeDataBuilder.Add("Winner", m_chilliConnectId);
            submitTurnRequest.OutcomeData = outcomeDataBuilder.Build();
            submitTurnRequest.Completed   = true;

            SkillLevel++;
            var setPlayerDataRequest = new SetPlayerDataRequestDesc("SkillLevel", SkillLevel);
            m_chilliConnect.CloudData.SetPlayerData(setPlayerDataRequest,
                                                    (request, response) => Debug.Log("Player Data Updated"),
                                                    (request, error) => Debug.Log(error.ErrorDescription));
        }

        m_chilliConnect.AsyncMultiplayer.SubmitTurn(submitTurnRequest,
                                                    (request, response) => SubmitTurnCallBack(response),
                                                    (request, error) => Debug.Log(error.ErrorDescription));
    }
Exemplo n.º 2
0
    private void StartMatch(String matchId)
    {
        var startMatchDesc = new StartMatchRequestDesc(matchId);

        startMatchDesc.StateData = CurrentGame.AsMultiTypeDictionary();

        m_chilliConnect.AsyncMultiplayer.StartMatch(startMatchDesc,
                                                    (request, response) => StartMatchCallBack(response),
                                                    (request, error) => Debug.Log(error.ErrorDescription));
    }
Exemplo n.º 3
0
    public void CreateNewGame(string selectedSide)
    {
        CurrentGame.SetNewGame(selectedSide, m_chilliConnectId);

        var maxPlayers         = 2;
        var createMatchRequest = new CreateMatchRequestDesc(MATCH_TYPE, TURN_TYPE_SEQUENTIAL, maxPlayers);

        createMatchRequest.StateData                 = CurrentGame.AsMultiTypeDictionary();
        createMatchRequest.TurnOrderType             = "RANDOM";
        createMatchRequest.AutoStart                 = false;
        createMatchRequest.Properties                = new Dictionary <string, SdkCore.MultiTypeValue> ();
        createMatchRequest.Properties ["SkillLevel"] = SkillLevel;

        m_chilliConnect.AsyncMultiplayer.CreateMatch(createMatchRequest,
                                                     (request, response) => CreateMatchCallBack(response),
                                                     (request, error) => Debug.Log(error.ErrorDescription));
    }