/* Returns gameResult of given map if it exists. Otherwise returns default empty result. */ public GameResult GetGameResult(String mapName) { GameResult result = new GameResult(); if (LoginManager.Instance.GetLoginStatus() == LoginManager.LOGGED_IN) { HighScore hs; hs = Mongo.Instance.GetPlayersMapScore(mapName); result.MapName = hs.MapId; result.HighestCombo = hs.HighestCombo; result.MaxCombo = hs.MaxCombo; result.Score = hs.Score; result.perfects = hs.Perfects; result.normals = hs.Normals; result.poors = hs.Poors; result.misses = hs.Misses; } else { string gameResult = PlayerPrefs.GetString(mapName); if (string.IsNullOrEmpty(gameResult)) { result.MapName = mapName; PlayerPrefs.SetString(mapName, GameResult.GetEmptyResultSerialization()); PlayerPrefs.Save(); gameResult = PlayerPrefs.GetString(mapName); } result = GameResult.Deserialize(gameResult); } if (result.Score > 0) { result.CalculateResult(); } return(result); }