Example #1
0
        /// <summary>
        /// Report a score to game server, using unified id.
        /// </summary>
        /// <param name="_leaderboardGID">An unified string internally used to identify the leaderboard across all the supported platforms.</param>
        /// <param name="_score">The score earned by the local user.</param>
        /// <param name="_onCompletion">Callback that will be called after operation is completed.</param>
        /// <remarks>
        /// \note Works only if, leaderboard metadata was configured in NPSettings or else explicitely set using <see cref="SetLeaderboardMetadataCollection"/>.
        /// </remarks>
        public void ReportScoreWithGlobalID(string _leaderboardGID, long _score, Score.ReportScoreCompletion _onCompletion)
        {
            string _leaderboardID = GameServicesUtils.GetLeaderboardID(_leaderboardGID);

            // Invoke handler
            ReportScore(_leaderboardGID, _leaderboardID, _score, _onCompletion);
        }
Example #2
0
    // 점수 저장
    public void SaveScore(long score, Score.ReportScoreCompletion onCallback)
    {
        if (false == this.available)
        {
            if (null != onCallback)
            {
                onCallback(false, "error");
            }
            return;
        }

        NPBinding.GameServices.ReportScoreWithGlobalID(LEADER_BOARD_GID, score, onCallback);
    }
Example #3
0
 public void ReportScore(string _leaderboardID, long _score, Score.ReportScoreCompletion _onCompletion)
 {
     ReportScoreWithID(_leaderboardID, _score, _onCompletion);
 }
Example #4
0
        private void ReportScore(string _leaderboardGID, string _leaderboardID, long _score, Score.ReportScoreCompletion _onCompletion)
        {
            Score _newScore = CreateScoreForLocalUser(_leaderboardGID, _leaderboardID);

            if (_newScore == null)
            {
                DebugUtility.Logger.LogError(Constants.kDebugTag, "[GameServices] Failed to report score.");

                if (_onCompletion != null)
                {
                    _onCompletion(false, "The requested operation could not be completed because Game Service failed to create Score object.");
                }

                return;
            }

            // Set the new score value
            _newScore.Value = _score;

            // Report
            _newScore.ReportScore(_onCompletion);
        }
Example #5
0
        public override void ReportScore(Score.ReportScoreCompletion _onCompletion)
        {
            base.ReportScore(_onCompletion);

            GameServicesAndroid.Plugin.Call(GameServicesAndroid.Native.Methods.REPORT_SCORE, GetInstanceID(), LeaderboardID, Value, _onCompletion != null);
        }