//-------------------------------------- // EVENTS //-------------------------------------- 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); dispatcher.dispatch(GAME_CENTER_LEADER_BOARD_SCORE_LOADED, score); }
public GCScore GetScore(int rank, GCBoardTimeSpan scope, GCCollectionType collection) { ScoreCollection col = GlobalCollection; switch(collection) { case GCCollectionType.GLOBAL: col = GlobalCollection; break; case GCCollectionType.FRIENDS: col = SocsialCollection; break; } Dictionary<int, GCScore> scoreDict = col.AllTimeScores; switch(scope) { case GCBoardTimeSpan.ALL_TIME: scoreDict = col.AllTimeScores; break; case GCBoardTimeSpan.TODAY: scoreDict = col.TodayScores; break; case GCBoardTimeSpan.WEEK: scoreDict = col.WeekScores; break; } if(scoreDict.ContainsKey(rank)) { return scoreDict[rank]; } else { return null; } }
public void UpdateCurrentPlayerRank(int rank, GCBoardTimeSpan timeSpan, GCCollectionType collection) { string key = timeSpan.ToString() + "_" + collection.ToString(); if(currentPlayerRank.ContainsKey(key)) { currentPlayerRank[key] = rank; } else { currentPlayerRank.Add(key, rank); } }
public GCScore GetCurrentPlayerScore(GCBoardTimeSpan timeSpan, GCCollectionType collection) { string key = timeSpan.ToString() + "_" + collection.ToString(); if(currentPlayerRank.ContainsKey(key)) { int rank = currentPlayerRank[key]; return GetScore(rank, timeSpan, collection); } else { return null; } }
public GCScore(string vScore, int vRank, GCBoardTimeSpan vTimeSpan, GCCollectionType sCollection, string lid, string pid) { _score = vScore; _rank = vRank; _playerId = pid; _leaderboardId = lid; _timeSpan = vTimeSpan; _collection = sCollection; }
public void UpdateCurrentPlayerRank(int rank, GCBoardTimeSpan timeSpan, GCCollectionType collection) { string key = timeSpan.ToString() + "_" + collection.ToString(); if (currentPlayerRank.ContainsKey(key)) { currentPlayerRank[key] = rank; } else { currentPlayerRank.Add(key, rank); } }
public GCScore GetCurrentPlayerScore(GCBoardTimeSpan timeSpan, GCCollectionType collection) { string key = timeSpan.ToString() + "_" + collection.ToString(); if (currentPlayerRank.ContainsKey(key)) { int rank = currentPlayerRank[key]; return(GetScore(rank, timeSpan, collection)); } else { return(null); } }
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_LEADER_BOARD_SCORE_LIST_LOADED, result); }
public GCScore GetScore(int rank, GCBoardTimeSpan scope, GCCollectionType collection) { ScoreCollection col = GlobalCollection; switch (collection) { case GCCollectionType.GLOBAL: col = GlobalCollection; break; case GCCollectionType.FRIENDS: col = SocsialCollection; break; } Dictionary <int, GCScore> scoreDict = col.AllTimeScores; switch (scope) { case GCBoardTimeSpan.ALL_TIME: scoreDict = col.AllTimeScores; break; case GCBoardTimeSpan.TODAY: scoreDict = col.TodayScores; break; case GCBoardTimeSpan.WEEK: scoreDict = col.WeekScores; break; } if (scoreDict.ContainsKey(rank)) { return(scoreDict[rank]); } else { return(null); } }
public static void loadScore(string leaderBoradrId, int from, int to, GCBoardTimeSpan timeSpan = GCBoardTimeSpan.ALL_TIME, GCCollectionType collection = GCCollectionType.GLOBAL) { #if (UNITY_IPHONE && !UNITY_EDITOR) || SA_DEBUG_MODE _loadLeadrBoardScore(leaderBoradrId, (int)timeSpan, (int)collection, from, to); #endif }
public static void getScore(string leaderBoradrId, GCBoardTimeSpan timeSpan = GCBoardTimeSpan.ALL_TIME, GCCollectionType collection = GCCollectionType.GLOBAL) { loadCurrentPlayerScore(leaderBoradrId, timeSpan, collection); }
private IEnumerator loadCurrentPlayerScoreLocal(string leaderBoradrId, GCBoardTimeSpan timeSpan = GCBoardTimeSpan.ALL_TIME, GCCollectionType collection = GCCollectionType.GLOBAL) { yield return(new WaitForSeconds(2f)); loadCurrentPlayerScore(leaderBoradrId, timeSpan, collection); }
public static void loadCurrentPlayerScore(string leaderBoradrId, GCBoardTimeSpan timeSpan = GCBoardTimeSpan.ALL_TIME, GCCollectionType collection = GCCollectionType.GLOBAL) { #if (UNITY_IPHONE && !UNITY_EDITOR) || SA_DEBUG_MODE _getLeadrBoardScore(leaderBoradrId, (int)timeSpan, (int)collection); #endif }
public static void showLeaderBoard(string leaderBoradrId, GCBoardTimeSpan timeSpan) { #if (UNITY_IPHONE && !UNITY_EDITOR) || SA_DEBUG_MODE _showLeaderBoard(leaderBoradrId, (int)timeSpan); #endif }
public static void getScore(string leaderBoradrId, GCBoardTimeSpan timeSpan = GCBoardTimeSpan.ALL_TIME, GCCollectionType collection = GCCollectionType.FRIENDS) { Debug.LogWarning("getScore is deprecated, use loadCurrentPlayerScore instead"); loadCurrentPlayerScore(leaderBoradrId, timeSpan, collection); }
private IEnumerator LoadCurrentPlayerScoreLocal(string leaderboardId, GCBoardTimeSpan timeSpan = GCBoardTimeSpan.ALL_TIME, GCCollectionType collection = GCCollectionType.GLOBAL ) { yield return new WaitForSeconds(4f); LoadCurrentPlayerScoreLocal(leaderboardId, timeSpan, collection); }
public static void ShowLeaderboard(string leaderboardId, GCBoardTimeSpan timeSpan) { #if (UNITY_IPHONE && !UNITY_EDITOR) || SA_DEBUG_MODE _showLeaderboard(leaderboardId, (int) timeSpan); #endif }
public static void LoadCurrentPlayerScore(string leaderboardId, GCBoardTimeSpan timeSpan = GCBoardTimeSpan.ALL_TIME, GCCollectionType collection = GCCollectionType.GLOBAL) { #if (UNITY_IPHONE && !UNITY_EDITOR) || SA_DEBUG_MODE _getLeaderboardScore(leaderboardId, (int) timeSpan, (int) collection); #endif }
public static void LoadScore(string leaderboardId, int from, int to, GCBoardTimeSpan timeSpan = GCBoardTimeSpan.ALL_TIME, GCCollectionType collection = GCCollectionType.GLOBAL) { #if (UNITY_IPHONE && !UNITY_EDITOR) || SA_DEBUG_MODE _loadLeaderboardScore(leaderboardId, (int) timeSpan, (int) collection, from, to); #endif }
public static void getScore(string leaderBoradrId, GCBoardTimeSpan timeSpan = GCBoardTimeSpan.ALL_TIME, GCCollectionType collection = GCCollectionType.FRIENDS) { #if (UNITY_IPHONE && !UNITY_EDITOR) || SA_DEBUG_MODE _getLeadrBoardScore(leaderBoradrId, (int) timeSpan, (int) collection); #endif }