public void submitScoreFailed(string json) { Debug.Log("GameCircleManager - submitScoreFailed"); AGSLeaderboardsClient. SubmitScoreFailed(json); }
public void SubmitScoreToLeaderboard(string leaderboardId, long scoreValue) { // Subscribe to the events to receive the score submission status. SubscribeToScoreSubmissionEvents(); // Submit the score update to GameCircle plugin. AGSLeaderboardsClient.SubmitScore(leaderboardId, scoreValue); }
/// <summary> /// Shows the native achievement user interface, allowing the player to browse achievements. /// </summary> /// <param name="id">Current platform's ID for the leaderboard.</param> /// <param name="internalID">Internal CloudOnce ID, if available.</param> public void ShowOverlay(string id = "", string internalID = "") { if (!AGSPlayerClient.IsSignedIn()) { #if CLOUDONCE_DEBUG Debug.LogWarning("ShowOverlay can only be called after authentication."); #endif return; } if (string.IsNullOrEmpty(id)) { #if CLOUDONCE_DEBUG Debug.Log("Showing leaderboards overlay."); #endif AGSLeaderboardsClient.ShowLeaderboardsOverlay(); } else { #if CLOUDONCE_DEBUG Debug.Log(string.IsNullOrEmpty(internalID) ? string.Format("Showing {0} leaderboard overlay.", id) : string.Format("Showing {0} ({1}) leaderboard overlay.", internalID, id)); #endif AGSLeaderboardsClient.ShowLeaderboardsOverlay(id); } }
/// <summary> /// Requests the percentile ranks for the leaderboard. /// </summary> /// <param name='leaderboardId'> /// Leaderboard to request the score for. /// </param> void RequestPercentileRanks(string leaderboardId) { // Subscribe to the events to receive percentile ranks. SubscribeToPercentileRanksRequestEvents(); // Request the percentile ranks from the GameCircle plugin. AGSLeaderboardsClient.RequestPercentileRanks(leaderboardId, leaderboardScoreScope); }
/// <summary> /// Reports a score to a leaderboard. /// </summary> /// <param name="id">Current platform's ID for the leaderboard.</param> /// <param name="score">The score to submit.</param> /// <param name="onComplete"> /// Callback that will be called to report the result of the operation. /// If unsuccessful, an error message will be included in the callback. /// </param> /// <param name="internalID">Internal CloudOnce ID, if available.</param> public void SubmitScore( string id, long score, Action <CloudRequestResult <bool> > onComplete, string internalID = "") { if (string.IsNullOrEmpty(id)) { var errorMessage = string.Format( "Can't submit score to {0} leaderboard. Platform ID is null or empty!", internalID); ReportError(errorMessage, onComplete); return; } if (!AGSPlayerClient.IsSignedIn()) { const string errorMessage = "Can't submit score to leaderboard {0} ({1})." + " SubmitScore can only be called after authentication."; ReportError(string.Format(errorMessage, internalID, id), onComplete); return; } Action <AGSSubmitScoreResponse> callback = null; callback = response => { OnSubmitScoreCompleted(response, score, onComplete, id, internalID); AGSLeaderboardsClient.SubmitScoreCompleted -= callback; }; AGSLeaderboardsClient.SubmitScoreCompleted += callback; AGSLeaderboardsClient.SubmitScore(id, score); }
/// <summary> /// Requests the local player's score. /// </summary> /// <param name='leaderboardId'> /// Leaderboard to request the score for. /// </param> void RequestLocalPlayerScore(string leaderboardId) { // Subscribe to the events to receive the local player's score. SubscribeToLocalPlayerScoreRequestEvents(); // Request the local player's score from the GameCircle plugin. AGSLeaderboardsClient.RequestLocalPlayerScore(leaderboardId, leaderboardScoreScope); }
/// <summary> /// Loads the scores. /// </summary> /// <param name='leaderboardID'> /// Leaderboard I. /// </param> /// <param name='callback'> /// Callback. /// </param> public void LoadScores(string leaderboardID, System.Action <IScore[]> callback) { // Forward the AGSClient callbacks to the passed in callback. if (null != callback) { AGSLeaderboardsClient.RequestLeaderboardsSucceededEvent += (leaderboards) => { // If the leaderboard could not be found, call the callback with a null list. IScore [] scores = null; // Look through the retrieved leaderboards for the passed in leaderboard ID foreach (AGSLeaderboard leaderboard in leaderboards) { if (leaderboard.id == leaderboardID) { AGSSocialLeaderboard socialLeaderboard = new AGSSocialLeaderboard(leaderboard); scores = socialLeaderboard.scores; break; } } callback(scores); }; // If retrieving leaderboards failed, call the callback with a null list. AGSLeaderboardsClient.RequestLeaderboardsFailedEvent += (error) => { callback(null); }; } // Request the leaderboard list so the requested leaderboard ID can be searched for. AGSLeaderboardsClient.RequestLeaderboards(); }
/// <summary> /// Draws the menu. Note that this must be called from an OnGUI function. /// </summary> public override void DrawMenu() { // this button will open the leaderboard overlay. if (GUILayout.Button(DisplayLeaderboardOverlayButtonLabel)) { AGSLeaderboardsClient.ShowLeaderboardsOverlay(); } // If the leaderboard list has not been requested yet, display // a button that requests the leaderboard list. if (string.IsNullOrEmpty(requestLeaderboardsStatus)) { if (GUILayout.Button(requestLeaderboardsButtonLabel)) { RequestLeaderboards(); } } else { // once a request has been made for the list of leaderboards, // display the status message of that process. AmazonGUIHelpers.CenteredLabel(requestLeaderboardsStatus); if (!string.IsNullOrEmpty(requestLeaderboardsStatusMessage)) { AmazonGUIHelpers.CenteredLabel(requestLeaderboardsStatusMessage); } // If the leaderboards are not ready, display how long it has been since the request was put in. if (!leaderboardsReady) { AmazonGUIHelpers.CenteredLabel(string.Format(leaderboardRequestTimeLabel, (System.DateTime.Now - leaderboardsRequestTime).TotalSeconds)); } else { // Once the leaderboard list request callback has been received, // display the leaderboards if available. if (null != leaderboardList && leaderboardList.Count > 0) { foreach (AGSLeaderboard leaderboard in leaderboardList) { DisplayLeaderboard(leaderboard); } } // If the leaderboards are not available, display a message explaining that. else { AmazonGUIHelpers.CenteredLabel(noLeaderboardsAvailableLabel); } // display the invalid leaderboard (used to make sure GameCircle handles invalid data gracefully) if (null != invalidLeaderboard) { DisplayLeaderboard(invalidLeaderboard); } } } }
/// <summary> /// Reports the score. /// </summary> /// <param name='callback'> /// Callback. /// </param> public void ReportScore(System.Action <bool> callback) { // Forward the AGSClient callbacks to the passed in callback. if (null != callback) { AGSLeaderboardsClient.SubmitScoreSucceededEvent += (a) => { callback(true); }; AGSLeaderboardsClient.SubmitScoreFailedEvent += (a, e) => { callback(false); }; } AGSLeaderboardsClient.SubmitScore(leaderboardID, value); }
public void ShowLeaderBoardPage() { if (AGSClient.IsServiceReady()) { AGSLeaderboardsClient.ShowLeaderboardsOverlay(); } else { Debug.Log("Show sigin page Service NOOOOOOT Ready"); } }
/// <summary> /// Requests the list of leaderboards from the GameCircle plugin. /// </summary> void RequestLeaderboards() { // Start the clock, to track the progress of this async operation. leaderboardsRequestTime = System.DateTime.Now; // Subscribe to the events to receive the leaderboard list. SubscribeToLeaderboardRequestEvents(); // Request the leaderboard list from the GameCircle plugin. AGSLeaderboardsClient.RequestLeaderboards(); // Set the status message to show this process has begun. requestLeaderboardsStatus = requestingLeaderboardsLabel; }
public void ShowLeaderBoard() { #if AMAZON AGSLeaderboardsClient.ShowLeaderboardsOverlay(); #else if (Social.localUser.authenticated) { #if UNITY_ANDROID ((PlayGamesPlatform)Social.Active).ShowLeaderboardUI(Constants.LEADER_BOARD_ID); #elif UNITY_IOS Social.ShowLeaderboardUI(); #endif } else { // Debug.Log("Not signed so login"); SignIn(); } #endif }
public void PostScoreToLeaderBoard() { #if AMAZON if (AGSClient.IsServiceReady()) { AGSLeaderboardsClient.SubmitScoreSucceededEvent += Instance.submitScoreSucceeded; AGSLeaderboardsClient.SubmitScoreFailedEvent += Instance.submitScoreFailed; AGSLeaderboardsClient.SubmitScore(Constants.LEADER_BOARD_ID, Instance.puzzleSolved); } #else if (Social.localUser.authenticated) { #if UNITY_ANDROID Social.ReportScore(Instance.puzzleSolved, Constants.LEADER_BOARD_ID, (bool success) => { if (success) { } else { // Debug.Log ("Add Score Fail"); } }); #elif UNITY_IOS Social.ReportScore(Instance.puzzleSolved, Constants.LEADER_BOARD_ID, (bool success) => { if (success) { } else { // Debug.Log ("Add Score Fail"); } }); #endif } #endif }
public void requestPercentileRanksForPlayerSucceeded(string json) { AGSClient.Log("AGSLeaderboardsClient - RequestPercentileRanksForPlayerComplete"); AGSLeaderboardsClient.RequestPercentileRanksForPlayerComplete(json); }
public void requestPercentileRanksFailed(string json) { AGSClient.Log("AGSLeaderboardsClient - RequestPercentileRanksFailed"); AGSLeaderboardsClient.RequestPercentileRanksFailed(json); }
public void requestScoresFailed(string json) { AGSClient.Log("AGSLeaderboardsClient - RequestScoresFailed"); AGSLeaderboardsClient.RequestScoresFailed(json); }
public void requestPlayerScoreCompleted(string json) { AGSClient.Log("AGSLeaderboardsClient - RequestScoreForPlayerComplete"); AGSLeaderboardsClient.RequestScoreForPlayerComplete(json); }
/// <summary> /// Loads the scores. /// </summary> /// <param name='leaderboardID'> /// Leaderboard I. /// </param> /// <param name='callback'> /// Callback. /// </param> public void LoadScores(string leaderboardID, Action <IScore[]> callback) { loadScoresCallbacks.Add(requestID, callback); AGSLeaderboardsClient.RequestLeaderboards(requestID++); }
public void submitScoreSucceeded(string json) { AGSClient.Log("GameCircleManager - submitScoreSucceeded"); AGSLeaderboardsClient. SubmitScoreSucceeded(json); }
public void RequestLocalUserScore(AGSSocialLeaderboard leaderboard) { leaderboardForRequest.Add(requestID, leaderboard); AGSLeaderboardsClient.RequestScores(leaderboard.id, fromTimeScope(leaderboard.timeScope), requestID++); }
public void RequestScores(AGSSocialLeaderboard leaderboard, Action <bool> callback) { leaderboardForRequest.Add(requestID, leaderboard); simpleCallbacks.Add(requestID, callback); AGSLeaderboardsClient.RequestScores(leaderboard.id, fromTimeScope(leaderboard.timeScope), requestID++); }
/// <summary> /// Shows the leaderboard UI. /// </summary> public void ShowLeaderboardUI() { AGSLeaderboardsClient.ShowLeaderboardsOverlay(); }
/// <summary> /// Load a default set of scores from the given leaderboard. /// </summary> /// <param name="leaderboardID">Current platform's ID for the leaderboard.</param> /// <param name="callback">Callback with scores.</param> public void LoadScores(string leaderboardID, Action <IScore[]> callback) { loadScoresCallbacks.Add(RequestID, callback); AGSLeaderboardsClient.RequestScores(leaderboardID, LeaderboardScope.GlobalAllTime, RequestID++); }
public void requestLocalPlayerScoreSucceeded(string json) { Debug.Log("GameCircleManager - requestLocalPlayerScoreFailed"); AGSLeaderboardsClient. RequestLocalPlayerScoreSucceeded(json); }
public void requestLeaderboardsFailed(string json) { AGSClient.Log("GameCircleManager - requestLeaderboardsFailed"); AGSLeaderboardsClient. RequestLeaderboardsFailed(json); }
public void submitScoreSucceeded(string json) { AGSClient.Log("AGSLeaderboardsClient - SubmitScoreSucceeded"); AGSLeaderboardsClient.SubmitScoreSucceeded(json); }
/// <summary> /// Reports the score. /// </summary> /// <param name='callback'> /// Callback. /// </param> public void ReportScore(System.Action <bool> callback) { GameCircleSocial.Instance.ReportScore(value, leaderboardID, callback); AGSLeaderboardsClient.SubmitScore(leaderboardID, value); }
public void requestLocalPlayerScoreSucceeded(string json) { AGSClient.Log("AGSLeaderboardsClient - RequestLocalPlayerScoreSucceeded"); AGSLeaderboardsClient.RequestLocalPlayerScoreSucceeded(json); }
public void requestLeaderboardsSucceeded(string json) { Debug.Log("GameCircleManager - requestLeaderboardsSucceeded"); AGSLeaderboardsClient. RequestLeaderboardsSucceeded(json); }
/// <summary> /// Reports the score. /// </summary> /// <param name='score'> /// Score. /// </param> /// <param name='board'> /// Board. /// </param> /// <param name='callback'> /// Callback. /// </param> public void ReportScore(long score, string board, System.Action <bool> callback) { simpleCallbacks.Add(requestID, callback); AGSLeaderboardsClient.SubmitScore(board, score, requestID++); }