void OnScoreSubmitted(GK_LeaderboardResult result) { if (result.IsSucceeded) { GK_Score score = result.Leaderboard.GetCurrentPlayerScore(GK_TimeSpan.ALL_TIME, GK_CollectionType.GLOBAL); IOSNativePopUpManager.showMessage("Leaderboard " + score.LeaderboardId, "Score: " + score.LongScore + "\n" + "Rank:" + score.Rank); } }
//-------------------------------------- // Internal //-------------------------------------- public static void DispatchLeaderboardUpdateEvent(GK_LeaderboardResult result, bool isInternal) { if (isInternal) { OnScoreSubmitted(result); } else { OnLeadrboardInfoLoaded(result); } }
private void OnLeadrboardInfoLoaded(GK_LeaderboardResult result) { if (result.IsSucceeded) { GK_Score score = result.Leaderboard.GetCurrentPlayerScore(GK_TimeSpan.ALL_TIME, GK_CollectionType.GLOBAL); //IOSNativePopUpManager.showMessage("Leaderboard " + score.LeaderboardId, "Score: " + score.LongScore + "\n" + "Rank:" + score.Rank); Debug.Log("double score representation: " + score.DecimalFloat_2); Debug.Log("long score representation: " + score.LongScore); } }
void IOS_LeaderboardsDataLoaded(GK_LeaderboardResult res) { if (_WaitingForLeaderboardsData) { _CurrentLeaderboardsEventsCount++; if (_CurrentLeaderboardsEventsCount >= _LeaderboardsDataEventsCount) { UM_Result result = new UM_Result(); OnLeaderboardsDataLoaded(result); } } }
void IOS_HandleOnScoresListLoaded(GK_LeaderboardResult res) { UM_Leaderboard leaderboard = UltimateMobileSettings.Instance.GetLeaderboardByIOSId(res.Leaderboard.Id); if (leaderboard != null) { leaderboard.Setup(res.Leaderboard); UM_LeaderboardResult result = new UM_LeaderboardResult(leaderboard, res); ActionScoresListLoaded(result); } }
public void onScoreSubmittedFailed(string data) { string[] DataArray = data.Split(new string[] { SA.Common.Data.Converter.DATA_SPLITTER2 }, StringSplitOptions.None); string leaderboardId = DataArray[0]; // long submittedScore = System.Convert.ToInt64(DataArray[1]); string errorData = DataArray[2]; GK_Leaderboard board = GetLeaderboard(leaderboardId); GK_LeaderboardResult result = new GK_LeaderboardResult(board, new SA.Common.Models.Error(errorData)); OnScoreSubmitted(result); }
private void OnGameCenterServiceLeaderDataLoaded(GK_LeaderboardResult res) { if (res.IsSucceeded && res.Leaderboard != null) { UM_Leaderboard leaderboard = UltimateMobileSettings.Instance.GetLeaderboardByIOSId(res.Leaderboard.Id); if (leaderboard != null) { leaderboard.Setup(res.Leaderboard); } } OnGameCenterServiceDataLoaded(res); }
private void OnLeaderboardScoreListLoadFailed(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]); string errorData = DataArray[3]; GK_Leaderboard board = GetLeaderboard(leaderboardId); GK_LeaderboardResult result = new GK_LeaderboardResult(board, new SA.Common.Models.Error(errorData)); OnScoresListLoaded(result); }
private void OnLeadrboardInfoLoaded(GK_LeaderboardResult result) { if (result.IsSucceeded) { GK_Score score = result.Leaderboard.GetCurrentPlayerScore(GK_TimeSpan.ALL_TIME, GK_CollectionType.GLOBAL); IOSNativePopUpManager.showMessage("Leaderboard " + score.LeaderboardId, "Score: " + score.LongScore + "\n" + "Rank:" + score.Rank); ISN_Logger.Log("double score representation: " + score.DecimalFloat_2); ISN_Logger.Log("long score representation: " + score.LongScore); if (score.LeaderboardId.Equals(TEST_LEADERBOARD_2)) { ISN_Logger.Log("Updating leaderboard 2 score"); LB2BestScores = score.LongScore; } } }
//-------------------------------------- // 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); } }
//-------------------------------------- // 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); } }
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); }
private void OnLeaderboardScoreListLoadFailed(string data) { string[] DataArray = data.Split(new string[] { IOSNative.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]); string errorData = DataArray[3]; GK_Leaderboard board = GetLeaderboard(leaderboardId); GK_LeaderboardResult result = new GK_LeaderboardResult (board, errorData); OnScoresListLoaded (result); }
private void OnLeaderboardScoreListLoaded(string data) { string[] DataArray = data.Split(new string[] { IOSNative.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+=3) { string playerId = DataArray[i]; long scoreVal = System.Convert.ToInt64 (DataArray[i + 1]); int rank = System.Convert.ToInt32(DataArray[i + 2]); GK_Score score = new GK_Score(scoreVal, rank, 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); }
public void onScoreSubmittedFailed(string data) { string[] DataArray = data.Split(new string[] { IOSNative.DATA_SPLITTER2 }, StringSplitOptions.None); string leaderboardId = DataArray[0]; // long submittedScore = System.Convert.ToInt64(DataArray[1]); string errorData = DataArray[2]; GK_Leaderboard board = GetLeaderboard(leaderboardId); GK_LeaderboardResult result = new GK_LeaderboardResult(board, errorData); OnScoreSubmitted(result); }
//-------------------------------------- // Internal //-------------------------------------- public static void DispatchLeaderboardUpdateEvent(GK_LeaderboardResult result, bool isInternal) { if(isInternal) { OnScoreSubmitted(result); } else { OnLeadrboardInfoLoaded(result); } }
void OnScoreSubmitted (GK_LeaderboardResult result) { if(result.IsSucceeded) { GK_Score score = result.Leaderboard.GetCurrentPlayerScore(GK_TimeSpan.ALL_TIME, GK_CollectionType.GLOBAL); IOSNativePopUpManager.showMessage("Leaderboard " + score.LeaderboardId, "Score: " + score.LongScore + "\n" + "Rank:" + score.Rank); } }
private void OnLeadrboardInfoLoaded (GK_LeaderboardResult result) { if(result.IsSucceeded) { GK_Score score = result.Leaderboard.GetCurrentPlayerScore(GK_TimeSpan.ALL_TIME, GK_CollectionType.GLOBAL); IOSNativePopUpManager.showMessage("Leaderboard " + score.LeaderboardId, "Score: " + score.LongScore + "\n" + "Rank:" + score.Rank); Debug.Log("double score representation: " + score.DecimalFloat_2); Debug.Log("long score representation: " + score.LongScore); if(score.LeaderboardId.Equals(TEST_LEADERBOARD_2)) { Debug.Log("Updating leaderboard 2 score"); LB2BestScores = score.LongScore; } } }