public static int LoadBestRecord(GameSystem.Mode mode, GameSystem.ModeType modeType) { string finalKey = string.Format(KeyBestScore, (int)mode, (int)modeType); int defaultValue = (modeType == GameSystem.ModeType.PassLevel ? 1 : 0); return(LoadIntValue(finalKey, defaultValue)); }
public static void RequestGameLeaderboard(GameSystem.Mode mode, GameSystem.ModeType modeType, MonoBehaviour target, KTPlayLeaderboard.Callback callback, int startIndex = 0) { if (Application.platform == RuntimePlatform.IPhonePlayer || Application.platform == RuntimePlatform.Android) { string leaderboardId = LeaderboardIDs[(int)mode][(int)modeType]; Debug.Log("request leaderboard ID of game:" + leaderboardId); KTPlayLeaderboard.GlobalLeaderboard(leaderboardId, startIndex, Constant.TOP_RANK_COUNT, target, callback); } }
/** * (ATAN((POWER(A2;1.4)- I2/2) / (I2/4)) + 1.57) / 3.14 * 110 - 10 */ public static int computePercentByScore(GameSystem.Mode mode, GameSystem.ModeType modeType, int score) { Debug.Log("HighScore:" + HighScores.ToString()); float param = (float)HighScores[(int)mode][(int)modeType]; Debug.Log("Param:" + param.ToString()); int percent = (int)((Mathf.Atan((Mathf.Pow((float)score, 1.1f) - (param / 2.0f)) / (param / 4.0f)) + Mathf.PI / 2.0f) / Mathf.PI * 110.0f - 10.0f); return(percent); }
public static void ReportScore(GameSystem.Mode mode, GameSystem.ModeType modeType, int score) { if (Application.platform == RuntimePlatform.IPhonePlayer || Application.platform == RuntimePlatform.Android) { if (KTAccountManager.IsLoggedIn()) { string leaderboardId = LeaderboardIDs[(int)mode][(int)modeType]; KTPlayLeaderboard.ReportScore(score, leaderboardId, LeaderboardTarget, LeaderboardCallback); } } }
public static void SaveBestRecord(GameSystem.Mode mode, GameSystem.ModeType modeType, int record) { string finalKey = string.Format(KeyBestScore, (int)mode, (int)modeType); SaveIntValue(finalKey, record); }