コード例 #1
0
    //--------------------------------------
    // Private Methods
    //--------------------------------------

    private void DispatchUpdate()
    {
        if (Scores.Count == 6)
        {
            GK_Leaderboard       board = GameCenterManager.GetLeaderboard(_leaderboardId);
            GK_LeaderboardResult result;


            if (_ErrorData != null)
            {
                result = new GK_LeaderboardResult(board, _ErrorData);
            }
            else
            {
                board.UpdateCurrentPlayerScore(Scores);
                result = new GK_LeaderboardResult(board);
            }

            GameCenterManager.DispatchLeaderboardUpdateEvent(result, _IsInternal);
        }
    }
コード例 #2
0
    private void OnLeaderboardScoreListLoaded(string data)
    {
        string[] DataArray = data.Split(new string[] { SA.Common.Data.Converter.DATA_SPLITTER2 }, StringSplitOptions.None);



        string            leaderboardId = DataArray[0];
        GK_TimeSpan       timeSpan      = (GK_TimeSpan)System.Convert.ToInt32(DataArray[1]);
        GK_CollectionType collection    = (GK_CollectionType)System.Convert.ToInt32(DataArray[2]);

        GK_Leaderboard board = GetLeaderboard(leaderboardId);



        for (int i = 3; i < DataArray.Length; i += 4)
        {
            string   playerId = DataArray[i];
            long     scoreVal = System.Convert.ToInt64(DataArray[i + 1]);
            int      rank     = System.Convert.ToInt32(DataArray[i + 2]);
            int      context  = System.Convert.ToInt32(DataArray[i + 3]);
            GK_Score score    = new GK_Score(scoreVal, rank, context, timeSpan, collection, leaderboardId, playerId);
            board.UpdateScore(score);


            if (Player != null)
            {
                if (Player.Id.Equals(playerId))
                {
                    board.UpdateCurrentPlayerScore(score);
                }
            }
        }



        GK_LeaderboardResult result = new GK_LeaderboardResult(board);

        OnScoresListLoaded(result);
    }