public int GetCurrentPlayerRank(UM_Leaderboard leaderboard) { switch (Application.platform) { case RuntimePlatform.IPhonePlayer: GCLeaderboard board = GameCenterManager.GetLeaderboard(leaderboard.IOSId); if (board != null) { return(board.GetCurrentPlayerScore(GCBoardTimeSpan.ALL_TIME, GCCollectionType.GLOBAL).rank); } else { return(0); } case RuntimePlatform.Android: GPLeaderBoard gBoard = GooglePlayManager.instance.GetLeaderBoard(leaderboard.AndroidId); if (gBoard != null) { return(gBoard.GetCurrentPlayerScore(GPBoardTimeSpan.ALL_TIME, GPCollectionType.GLOBAL).rank); } else { return(0); } } return(0); }
public long GetCurrentPlayerScore(UM_Leaderboard leaderboard) { switch (Application.platform) { case RuntimePlatform.IPhonePlayer: GCLeaderboard board = GameCenterManager.GetLeaderboard(leaderboard.IOSId); if (board != null) { GCScore score = board.GetCurrentPlayerScore(GCBoardTimeSpan.ALL_TIME, GCCollectionType.GLOBAL); if (score != null) { return(score.GetLongScore()); } } break; case RuntimePlatform.Android: GPLeaderBoard gBoard = GooglePlayManager.instance.GetLeaderBoard(leaderboard.AndroidId); if (gBoard != null) { GPScore score = gBoard.GetCurrentPlayerScore(GPBoardTimeSpan.ALL_TIME, GPCollectionType.GLOBAL); if (score != null) { return(score.score); } } break; } return(0); }
private void OnScoresListLoaded(ISN_Result res) { if (res.IsSucceeded) { Debug.Log("Scores loaded"); loadedLeaderboard = GameCenterManager.GetLeaderboard(leaderboardId); } else { Debug.Log("Failed to load scores"); } }
private void onLeaderboardScoreListLoaded(string array) { string[] data; data = array.Split("," [0]); string lbId = data[0]; GCBoardTimeSpan timeSpan = (GCBoardTimeSpan)System.Convert.ToInt32(data[1]); GCCollectionType collection = (GCCollectionType)System.Convert.ToInt32(data[2]); GCLeaderboard board; if (_leaderboards.ContainsKey(lbId)) { board = _leaderboards[lbId]; } else { board = new GCLeaderboard(lbId); _leaderboards.Add(lbId, board); } for (int i = 3; i < data.Length; i += 3) { string playerId = data[i]; string scoreVal = data[i + 1]; int rank = System.Convert.ToInt32(data[i + 2]); GCScore score = new GCScore(scoreVal, rank, timeSpan, collection, lbId, playerId); board.UpdateScore(score); if (Player != null) { if (Player.PlayerId.Equals(playerId)) { board.UpdateCurrentPlayerRank(rank, timeSpan, collection); } } } ISN_Result result = new ISN_Result(true); OnScoresListLoaded(result); Dispatcher.dispatch(GAME_CENTER_LEADERBOARD_SCORE_LIST_LOADED, result); }
private void OnLeaderboardMaxRangeUpdate(string array) { string[] data = array.Split("|" [0]); string identifier = data[0]; int MaxRange = System.Convert.ToInt32(data[1]); GCLeaderboard board; if (_leaderboards.ContainsKey(identifier)) { board = _leaderboards[identifier]; } else { board = new GCLeaderboard(identifier); } board.UpdateMaxRange(MaxRange); }
private void onLeaderboardScore(string array) { string[] data; data = array.Split("," [0]); string lbId = data[0]; string scoreVal = data[1]; int rank = System.Convert.ToInt32(data[2]); GCBoardTimeSpan timeSpan = (GCBoardTimeSpan)System.Convert.ToInt32(data[3]); GCCollectionType collection = (GCCollectionType)System.Convert.ToInt32(data[4]); GCLeaderboard board; if (_leaderboards.ContainsKey(lbId)) { board = _leaderboards[lbId]; } else { board = new GCLeaderboard(lbId); _leaderboards.Add(lbId, board); } GCScore score = new GCScore(scoreVal, rank, timeSpan, collection, lbId, Player.PlayerId); board.UpdateScore(score); board.UpdateCurrentPlayerRank(rank, timeSpan, collection); ISN_PlayerScoreLoadedResult result = new ISN_PlayerScoreLoadedResult(score); OnPlayerScoreLoaded(result); Dispatcher.dispatch(GAME_CENTER_LEADERBOARD_SCORE_LOADED, result); }
private void OnLeaderboardMaxRangeUpdate(string array) { string[] data = array.Split("|" [0]); string identifier = data[0]; int MaxRange = System.Convert.ToInt32(data[1]); GCLeaderboard board; if(_leaderboards.ContainsKey(identifier)) { board = _leaderboards[identifier]; } else { board = new GCLeaderboard(identifier); } board.UpdateMaxRange(MaxRange); }
private void onLeaderboardScoreListLoaded(string array) { string[] data; data = array.Split("," [0]); string lbId = data[0]; GCBoardTimeSpan timeSpan = (GCBoardTimeSpan) System.Convert.ToInt32(data[1]); GCCollectionType collection = (GCCollectionType) System.Convert.ToInt32(data[2]); GCLeaderboard board; if(_leaderboards.ContainsKey(lbId)) { board = _leaderboards[lbId]; } else { board = new GCLeaderboard(lbId); _leaderboards.Add(lbId, board); } for(int i = 3; i < data.Length; i+=3) { string playerId = data[i]; string scoreVal = data[i + 1]; int rank = System.Convert.ToInt32(data[i + 2]); GCScore score = new GCScore(scoreVal, rank, timeSpan, collection, lbId, playerId); board.UpdateScore(score); if(Player != null) { if(Player.PlayerId.Equals(playerId)) { board.UpdateCurrentPlayerRank(rank, timeSpan, collection); } } } ISN_Result result = new ISN_Result (true); OnScoresListLoaded (result); Dispatcher.dispatch (GAME_CENTER_LEADERBOARD_SCORE_LIST_LOADED, result); }
private void onLeaderboardScore(string array) { string[] data; data = array.Split("," [0]); string lbId = data[0]; string scoreVal = data[1]; int rank = System.Convert.ToInt32(data[2]); GCBoardTimeSpan timeSpan = (GCBoardTimeSpan) System.Convert.ToInt32(data[3]); GCCollectionType collection = (GCCollectionType) System.Convert.ToInt32(data[4]); GCLeaderboard board; if(_leaderboards.ContainsKey(lbId)) { board = _leaderboards[lbId]; } else { board = new GCLeaderboard(lbId); _leaderboards.Add(lbId, board); } GCScore score = new GCScore(scoreVal, rank, timeSpan, collection, lbId, Player.PlayerId); board.UpdateScore(score); board.UpdateCurrentPlayerRank(rank, timeSpan, collection); ISN_PlayerScoreLoadedResult result = new ISN_PlayerScoreLoadedResult (score); OnPlayerScoreLoaded (result); Dispatcher.dispatch (GAME_CENTER_LEADERBOARD_SCORE_LOADED, result); }
private void OnScoresListLoaded (ISN_Result res) { if(res.IsSucceeded) { Debug.Log("Scores loaded"); loadedLeaderboard = GameCenterManager.GetLeaderboard(leaderboardId); } else { Debug.Log("Failed to load scores"); } }