Esempio n. 1
0
	// --------------------------------------
	// Native Events
	// --------------------------------------
	
	public void OnLoadMatchesResult(string data) {
		Debug.Log("TBM::OnLoadMatchesResult: " + data);

		GK_TBM_LoadMatchesResult result = new GK_TBM_LoadMatchesResult(true);

		_Matches =  new Dictionary<string, GK_TBM_Match>();

		if(data.Length == 0) {
			ActionMatchesInfoLoaded(result);
			return;
		}



		string[] DataArray = data.Split(new string[] { IOSNative.DATA_SPLITTER2 }, StringSplitOptions.None);
		if (DataArray.Length > 0) {
			result.LoadedMatches = new Dictionary<string, GK_TBM_Match>();

			for (int i = 0; i < DataArray.Length; i++) {
				if (DataArray[i] == IOSNative.DATA_EOF) {
					break;
				}
				
				GK_TBM_Match match = ParceMatchInfo(DataArray[i]);
				UpdateMatchInfo(match);
				result.LoadedMatches.Add(match.Id, match);
			}
		}
		
		ActionMatchesInfoLoaded(result);
	}
    public void ActionMatchesResultLoaded(GK_TBM_LoadMatchesResult res)
    {
        GameCenter_TBM.ActionMatchesInfoLoaded -= ActionMatchesResultLoaded;
        ISN_Logger.Log("ActionMatchesResultLoaded: " + res.IsSucceeded);

        if (res.IsFailed)
        {
            return;
        }

        if (res.LoadedMatches.Count == 0)
        {
            return;
        }


        foreach (KeyValuePair <string, GK_TBM_Match> pair in res.LoadedMatches)
        {
            GK_TBM_Match m = pair.Value;
            GameCenter_TBM.PrintMatchInfo(m);
        }
    }
Esempio n. 3
0
    void HandleActionMatchesInfoLoaded(GK_TBM_LoadMatchesResult res)
    {
        UM_TBM_MatchesLoadResult result = new UM_TBM_MatchesLoadResult(res);

        if (res.IsSucceeded)
        {
            _Matches.Clear();
            _Invitations.Clear();

            foreach (KeyValuePair <string, GK_TBM_Match> pair  in res.LoadedMatches)
            {
                GK_TBM_Match match = pair.Value;

                if (match.LocalParticipant == null)
                {
                    continue;
                }

                if (match.LocalParticipant.Status == GK_TurnBasedParticipantStatus.Invited)
                {
                    UM_TBM_Invite invite = new UM_TBM_Invite(match);
                    _Invitations.Add(invite);
                }
                else
                {
                    UM_TBM_Match m = new UM_TBM_Match(match);
                    _Matches.Add(m);
                }

                result.SetMatches(_Matches);
                result.SetInvitations(_Invitations);
            }
        }

        MatchesListUpdated();
        MatchesListLoadedEvent(result);
    }
Esempio n. 4
0
    private void OnLoadMatchesResultFailed(string errorData)
    {
        GK_TBM_LoadMatchesResult result = new GK_TBM_LoadMatchesResult(errorData);

        ActionMatchesInfoLoaded(result);
    }
	public void ActionMatchesResultLoaded (GK_TBM_LoadMatchesResult res) {
		GameCenter_TBM.ActionMatchesInfoLoaded -= ActionMatchesResultLoaded;
		Debug.Log("ActionMatchesResultLoaded: " + res.IsSucceeded);

		if(res.IsFailed) {
			return;
		}

		if(res.LoadedMatches.Count == 0) {
			return;
		}


		foreach(KeyValuePair<string, GK_TBM_Match> pair in res.LoadedMatches) {
			GK_TBM_Match m = pair.Value;
			GameCenter_TBM.PrintMatchInfo(m);
		}
	}