From d2c9f15b58b48c9bc4d81dd9d5f18b4b1ed66a0d Mon Sep 17 00:00:00 2001 From: clubby789 Date: Sun, 20 Sep 2020 09:57:58 +0100 Subject: [PATCH] Reduce repeated label code --- ClockLib/OWClock.cs | 19 ++----------------- 1 file changed, 2 insertions(+), 17 deletions(-) diff --git a/ClockLib/OWClock.cs b/ClockLib/OWClock.cs index 8960c9f..f65ed6f 100644 --- a/ClockLib/OWClock.cs +++ b/ClockLib/OWClock.cs @@ -69,23 +69,8 @@ private void OnGUI() style.normal.textColor = Color.white; style.font = hudFont; style.fontSize = 30; - if (CountUp) - { - GUI.Label(new Rect(xPos, yPos, 200f, 60f), string.Concat(new object[] - { - "Time Elapsed: ", - ParseTime(elapsed) - }), style) ; - } - else - { - float remaining = TimeLoop.GetSecondsRemaining(); - GUI.Label(new Rect(xPos, yPos, 200f, 60f), string.Concat(new object[] - { - "Time Remaining: ", - ParseTime(remaining) - }), style) ; - } + string timestamp = CountUp ? "Time Elapsed: " + ParseTime(elapsed) : "Time Remaining: " + ParseTime(TimeLoop.GetSecondsRemaining()); + GUI.Label(new Rect(xPos, yPos, 200f, 60f), timestamp, style) ; int count = 0; style.fontSize = 20; foreach (TimeEvent timeEvent in Save.eventList)