private string alternateTiming() { UpdateTimeFormat(); var timingMethod = State.CurrentTimingMethod; if (timingMethod == TimingMethod.GameTime) { timingMethod = TimingMethod.RealTime; } else if (timingMethod == TimingMethod.RealTime) { timingMethod = TimingMethod.GameTime; } var methodString = timingMethod == TimingMethod.GameTime ? "Game Time" : "Real Time"; var timeValue = State.CurrentTime[timingMethod]; var timeString = ShortFormatter.Format(timeValue, AlternateTimeFormat); int dotIndex = timeString.IndexOf("."); var time = timeString.Substring(0, dotIndex); var fraction = String.Empty; if (AlternateAccuracy == TimeAccuracy.Hundredths) { fraction = timeString.Substring(dotIndex); } else if (AlternateAccuracy == TimeAccuracy.Tenths) { fraction = timeString.Substring(dotIndex, 2); } return(formatInfoText(methodString, String.Join("", time, fraction)) + "\n"); }
private string timerComponent() { UpdateTimeFormat(); var timingMethod = State.CurrentTimingMethod; if (Settings.TimingMethod == "Real Time") { timingMethod = TimingMethod.RealTime; } else if (Settings.TimingMethod == "Game Time") { timingMethod = TimingMethod.GameTime; } var comparison = State.CurrentComparison; var method = State.CurrentTimingMethod; var TimerColor = Color.Transparent; if (State.CurrentPhase == TimerPhase.NotRunning || State.CurrentTime[method] < TimeSpan.Zero) { TimerColor = State.LayoutSettings.NotRunningColor; } else if (State.CurrentPhase == TimerPhase.Paused) { TimerColor = State.LayoutSettings.PausedColor; } else if (State.CurrentPhase == TimerPhase.Ended) { if (State.Run.Last().Comparisons[State.CurrentComparison][method] == null || State.CurrentTime[method] < State.Run.Last().Comparisons[State.CurrentComparison][method]) { TimerColor = State.LayoutSettings.PersonalBestColor; } else { TimerColor = State.LayoutSettings.BehindLosingTimeColor; } } else if (State.CurrentPhase == TimerPhase.Running) { if (State.CurrentSplit.Comparisons[State.CurrentComparison][method] != null) { TimerColor = LiveSplitStateHelper.GetSplitColor(State, State.CurrentTime[method] - State.CurrentSplit.Comparisons[State.CurrentComparison][method], State.CurrentSplitIndex, true, false, State.CurrentComparison, method) ?? State.LayoutSettings.AheadGainingTimeColor; } else { TimerColor = State.LayoutSettings.AheadGainingTimeColor; } } var timeValue = State.CurrentTime[timingMethod]; var timeString = ShortFormatter.Format(timeValue, CurrentTimeFormat); int dotIndex = timeString.IndexOf("."); var time = timeString.Substring(0, dotIndex); var fraction = String.Empty; if (CurrentAccuracy == TimeAccuracy.Hundredths) { fraction = timeString.Substring(dotIndex); } else if (CurrentAccuracy == TimeAccuracy.Tenths) { fraction = timeString.Substring(dotIndex, 2); } return(String.Format("{0}{1, " + Settings.CharacterWidth + "}<C>\n", getColor(TimerColor), String.Join("", time, fraction))); }