/// <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("Artist", Artist); b.Replace("artist", Artist); b.Replace("bpm", Bpm.ToString(CultureInfo.CurrentCulture)); b.Replace("stars", Stars.ToString(CultureInfo.CurrentCulture)); b.Replace("mode", Mode.ToString()); b.Replace("cs", CircleSize.ToString(CultureInfo.CurrentCulture)); b.Replace("ar", ApproachRate.ToString(CultureInfo.CurrentCulture)); b.Replace("hp", HpDrain.ToString(CultureInfo.CurrentCulture)); b.Replace("od", OverallDifficulty.ToString(CultureInfo.CurrentCulture)); b.Replace("circles", HitCircle.ToString()); b.Replace("sliders", Slider.ToString()); b.Replace("spiners", Spinner.ToString()); b.Replace("creator", Creator); b.Replace("Title", Title); b.Replace("title", Title); b.Replace("Tags", Tags); b.Replace("tags", Tags); b.Replace("setid", BeatmapSetId.ToString()); b.Replace("maxcombo", MaxCombo.ToString()); b.Replace("approved", Approved.ToString()); var total = TimeSpan.FromSeconds(TotalTime); var hit = TimeSpan.FromSeconds(DrainTime); b.Replace("length", $"{total.TotalMinutes}:{total.Seconds}"); b.Replace("hitlength", $"{hit.TotalMinutes}:{hit.Seconds}"); b.Replace("version", Version); b.Replace("md5", Md5); b.Replace("id", BeatmapId.ToString()); return(b.ToString()); }
void GameOver() { isGameOver = true; isPaused = true; gameover.SetActive(true); Time.timeScale = 0; BgaManager.Instance.Destroy(); StepManager.Instance.ToggleSteps(false); Destroy(GameObject.Find("Character")); Destroy(GameObject.Find("Life")); Destroy(GameObject.Find("Judge Line")); Destroy(GameObject.Find("Judge")); Destroy(GameObject.Find("Score")); Destroy(GameObject.Find("Pause")); /* * GameResult result = new GameResult(); * result.score = -Score; * result.name = TitleManager.userName; * result.season = Launcher.season; * RankManager.Instance.RegisterGameResult(Launcher.season, result); */ GameObject.Find("Final Score").GetComponent <Text>().text = Score.ToString(); GameObject.Find("Final Combo").GetComponent <Text>().text = MaxCombo.ToString() + " combo"; /* * int rank = RankManager.Instance.GetRank(Launcher.season, Score); * Debug.Log(rank); * GameObject.Find("Rank").GetComponent<Text>().text = rank.ToString(); * string th; * switch(rank % 10) * { * case 1: * th = "st"; * break; * case 2: * th = "nd"; * break; * case 3: * th = "nd"; * break; * default: * th = "st"; * break; * } * GameObject.Find("Th").GetComponent<Text>().text = th; */ }
/// <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("perfect", Perfect.ToString()); b.Replace("Count300g", CountGeki.ToString()); b.Replace("c300", Count300.ToString()); b.Replace("Count200", CountKatu.ToString()); b.Replace("Count100", Count100.ToString()); b.Replace("Count50", Count50.ToString()); b.Replace("CountMiss", CountMiss.ToString()); b.Replace("maxcombo", MaxCombo.ToString()); b.Replace("userid", UserId.ToString()); b.Replace("rank", Rank); b.Replace("playtime", _d.ToString("yyyy/MM/dd HH:mm:ss")); b.Replace("score", Score.ToString()); b.Replace("beatmapid", BeatmapId.ToString()); b.Replace("acc", Accuracy.ToString("p2")); return(b.ToString()); }