public static LevelStatistics GetLevelStatistics(string LevelName) { string str = PlayerPrefs.GetString("level_stat_" + LevelName, null); LevelStatistics result = JsonUtility.FromJson <LevelStatistics>(str); return(result); }
public Level(string levelName, int[] someArrayData, string version, int deaths, int clears) { this.levelName = levelName; this.someArrayData = someArrayData; this.version = version; statistics = new LevelStatistics(deaths, clears); }
public void Init(int id, LevelDescription levelDescription, LevelStatistics levelStatistics) { _id = id; _levelStatistics = levelStatistics; _levelDescription = levelDescription; UpdateView(); }
void Awake() { levelStatistics = GameStats.GetLevelStatistics(level.ToString()); if (levelStatistics == null) { levelStatistics = new LevelStatistics(); } }
public bool TryGetStatistics(int id, out LevelStatistics outLevelStatistics) { if (id < stats.Length) { outLevelStatistics = stats[id]; return(true); } outLevelStatistics = null; return(false); }
public void UpdateUserScore(int levelId, UserScore userScore) { LevelStatistics levelStatistics = stats[levelId]; for (var i = 0; i < stats[levelId].leaderboard.Count; i++) { if (levelStatistics.leaderboard[i].id == userScore.id) { levelStatistics.leaderboard[i] = userScore; return; } } levelStatistics.leaderboard.Add(userScore); }
public void AddLevelStatistics(LevelStatistics stats) { //.. }
public static void SetLevelData(string LevelName, LevelStatistics stat) { string str = JsonUtility.ToJson(stat); PlayerPrefs.SetString("level_stat_" + LevelName, str); }