/// <summary> /// 使用一定的格式构造一个字符串 /// </summary> /// <param name="format"></param> /// <param name="formatProvider"></param> /// <returns></returns> public string ToString(string format, IFormatProvider formatProvider) { var b = new StringBuilder(format); b.Replace("username", UserName); b.Replace("userid", UserId.ToString()); b.Replace("mode", _mode.ToString()); b.Replace("pp", Pp.ToString(CultureInfo.InvariantCulture)); b.Replace("globalrank", GlobalRank.ToString()); b.Replace("countryrank", CountryRank.ToString()); b.Replace("cssh", SshCount.ToString()); b.Replace("csh", ShCount.ToString()); b.Replace("css", SsCount.ToString()); b.Replace("cs", SCount.ToString()); b.Replace("ca", ACount.ToString()); b.Replace("acc", $"{Accuracy:f2}%"); b.Replace("rankedscore", RankedScore.ToString(CultureInfo.InvariantCulture)); b.Replace("totalscore", TotalScore.ToString(CultureInfo.InvariantCulture)); b.Replace("playcount", PlayCount.ToString()); b.Replace("level", Level.ToString(CultureInfo.InvariantCulture)); b.Replace("countrycn", GetCountryInCn(Country)); b.Replace("country", Country); b.Replace("joindate", JoinDate.ToString("yyyy/MM/dd HH:mm:ss")); return(b.ToString()); }
public static void loadRankedScore() { BinaryFormatter bf = new BinaryFormatter(); FileStream file = File.Open(Application.persistentDataPath + "/ranked.dat", FileMode.Open); RankedScore rankedScore = (RankedScore)bf.Deserialize(file); bestRankedExperience = rankedScore.best; rankedExperience = rankedScore.experience; rankedTitle = rankedScore.rank; file.Close(); }
public static void saveRankedScore() { BinaryFormatter bf = new BinaryFormatter(); FileStream file = File.Create(Application.persistentDataPath + "/ranked.dat"); RankedScore rankedScore = new RankedScore(); rankedScore.experience = rankedExperience; rankedScore.rank = rankedTitle; if (rankedExperience > bestRankedExperience) { rankedScore.best = rankedExperience; } else { rankedScore.best = bestRankedExperience; } bf.Serialize(file, rankedScore); file.Close(); // Achievements & Leaderboards if (rankedExperience >= 1000) { Achievements.ApprenticeRank.Unlock(); } if (rankedExperience >= 1500) { Achievements.AdeptRank.Unlock(); } if (rankedExperience >= 2000) { Achievements.VeteranRank.Unlock(); } if (rankedExperience >= 2500) { Achievements.ExpertRank.Unlock(); } if (rankedExperience >= 3000) { Achievements.EliteRank.Unlock(); } if (rankedExperience >= 3500) { Achievements.AceRank.Unlock(); } if (rankedExperience >= 4000) { Achievements.LegendRank.Unlock(); } if (rankedExperience >= 4500) { Achievements.MythicRank.Unlock(); } if (rankedExperience >= 5000) { Achievements.TranscendentRank.Unlock(); } Leaderboards.RankedLeaderboard.SubmitScore(rankedExperience); }