private void ShowPersonalRecord(LayoutMode mode) { var centeredText = Settings.CenteredText && !Settings.Display2Rows && mode == LayoutMode.Vertical; if (PersonalRecord != null) { var time = PersonalRecord.Times.Primary; var timingMethod = State.CurrentTimingMethod; var game = State.Run.Metadata.Game; if (game != null) { timingMethod = game.Ruleset.DefaultTimingMethod.ToLiveSplitTimingMethod(); LocalTimeFormatter.Accuracy = game.Ruleset.ShowMilliseconds ? TimeAccuracy.Hundredths : TimeAccuracy.Seconds; } var formatted = TimeFormatter.Format(time); var isLoggedIn = SpeedrunCom.Client.IsAccessTokenValid; var userName = string.Empty; if (isLoggedIn) { userName = SpeedrunCom.Client.Profile.Name; } var runners = string.Join(", ", PersonalRecord.Players.Select(p => p.Name)); var finalTime = GetPBTime(timingMethod); if (IsPBTimeLower(finalTime, time, game != null ? game.Ruleset.ShowMilliseconds : false)) { formatted = LocalTimeFormatter.Format(finalTime); runners = State.Run.Metadata.Category.Players.Value > 1 ? "us" : "me"; } if (centeredText) { var textList = new List <string>(); textList.Add(string.Format("Personal Record is {0} by {1}", formatted, runners)); textList.Add(string.Format("Personal Record: {0} by {1}", formatted, runners)); textList.Add(string.Format("PR: {0} by {1}", formatted, runners)); textList.Add(string.Format("PR is {0} by {1}", formatted, runners)); InternalComponent.InformationName = textList.First(); InternalComponent.AlternateNameText = textList; } else { InternalComponent.InformationValue = string.Format("{0} by {1}", formatted, runners); } } else if (IsLoading) { if (centeredText) { InternalComponent.InformationName = "Loading Personal Record..."; InternalComponent.AlternateNameText = new[] { "Loading PR..." }; } else { InternalComponent.InformationValue = "Loading..."; } } else { if (centeredText) { InternalComponent.InformationName = "Unknown Personal Record"; InternalComponent.AlternateNameText = new[] { "Unknown PR" }; } else { InternalComponent.InformationValue = TimeFormatConstants.DASH; } } }
private void ShowWorldRecord() { if (WorldRecord != null) { var time = WorldRecord.Times.Primary; var timingMethod = State.CurrentTimingMethod; var game = State.Run.Metadata.Game; if (game != null) { timingMethod = game.Ruleset.DefaultTimingMethod.ToLiveSplitTimingMethod(); LocalTimeFormatter.Accuracy = game.Ruleset.ShowMilliseconds ? TimeAccuracy.Hundredths : TimeAccuracy.Seconds; } var formatted = TimeFormatter.Format(time); var isLoggedIn = SpeedrunCom.Client.IsAccessTokenValid; var userName = string.Empty; if (isLoggedIn) { userName = SpeedrunCom.Client.Profile.Name; } var runners = string.Join(", ", AllTies.Select(t => string.Join(" & ", t.Players.Select(p => isLoggedIn && p.Name == userName ? "me" : p.Name)))); var tieCount = AllTies.Count; var finalTime = GetPBTime(timingMethod); if (finalTime < time) { formatted = LocalTimeFormatter.Format(finalTime); runners = State.Run.Metadata.Category.Players.Value > 1 ? "us" : "me"; tieCount = 1; } if (Settings.CenteredText && !Settings.Display2Rows) { var textList = new List <string>(); textList.Add(string.Format("World Record is {0} by {1}", formatted, runners)); textList.Add(string.Format("World Record: {0} by {1}", formatted, runners)); textList.Add(string.Format("WR: {0} by {1}", formatted, runners)); textList.Add(string.Format("WR is {0} by {1}", formatted, runners)); if (tieCount > 1) { textList.Add(string.Format("World Record is {0} ({1}-way tie)", formatted, tieCount)); textList.Add(string.Format("World Record: {0} ({1}-way tie)", formatted, tieCount)); textList.Add(string.Format("WR: {0} ({1}-way tie)", formatted, tieCount)); textList.Add(string.Format("WR is {0} ({1}-way tie)", formatted, tieCount)); } InternalComponent.InformationName = textList.First(); InternalComponent.AlternateNameText = textList; } else { if (tieCount > 1) { InternalComponent.InformationValue = string.Format("{0} ({1}-way tie)", formatted, tieCount); } else { InternalComponent.InformationValue = string.Format("{0} by {1}", formatted, runners); } } } else if (IsLoading) { if (Settings.CenteredText && !Settings.Display2Rows) { InternalComponent.InformationName = "Loading World Record..."; InternalComponent.AlternateNameText = new[] { "Loading WR..." }; } else { InternalComponent.InformationValue = "Loading..."; } } else { if (Settings.CenteredText && !Settings.Display2Rows) { InternalComponent.InformationName = "Unknown World Record"; InternalComponent.AlternateNameText = new[] { "Unknown WR" }; } else { InternalComponent.InformationValue = "-"; } } }