diff --git a/ClockLib/OWClock.cs b/ClockLib/OWClock.cs index 859e86f..2730723 100644 --- a/ClockLib/OWClock.cs +++ b/ClockLib/OWClock.cs @@ -15,6 +15,7 @@ public class OWClock : ModBehaviour private Font _hudFont; private float _xPos; private float _yPos; + private float _width; public static IModHelper Helper; public static bool CountUp { get; private set; } @@ -55,6 +56,7 @@ private void RecalculatePosition(GraphicSettings settings) { _yPos = settings.displayResHeight - 60f; _xPos = Milliseconds ? settings.displayResWidth * 4 / 5 - 80f : settings.displayResWidth * 4 / 5 - 20f; + _width = settings.displayResWidth * 1 / 5; } private void OnGUI() @@ -74,14 +76,17 @@ private void OnGUI() style.font = _hudFont; style.fontSize = 30; style.normal.textColor = Color.white; + style.wordWrap = true; var timestamp = CountUp ? "Time Elapsed: " + ParseTime(elapsed) : "Time Remaining: " + ParseTime(TimeLoop.GetSecondsRemaining()); - GUI.Label(new Rect(_xPos, _yPos, 200f, 60f), timestamp, style); + // GUI.Label(new Rect(_xPos, _yPos, 200f, 60f), timestamp, style); + GUI.Label(new Rect(_xPos, _yPos, _width, 60f), timestamp, style); style.fontSize = 20; int shown = 0; // Loop until desired number of events are shown // OR we reach end of list + float yOff = 0; for (int i = 0; (i < Save.eventList.Count) && (shown < EventCount); i++) { var timeEvent = Save.eventList[i]; @@ -92,8 +97,12 @@ private void OnGUI() var scaleFactor = (timeEvent.Timestamp - elapsed) / 20; style.normal.textColor = Color.Lerp(Color.red, Color.white, scaleFactor); var timeString = CountUp ? ParseTime(timeEvent.Timestamp) : ParseTime(timeEvent.Timestamp - elapsed); - GUI.Label(new Rect(_xPos, _yPos - (shown * 20) - 20f, 200f, 20f), $"{timeString} - {timeEvent.Name}", style); + GUIContent guiText = new GUIContent($"{timeString} - {timeEvent.Name}"); + float labelSize = style.CalcHeight(guiText, _width); + yOff += labelSize; + GUI.Label(new Rect(_xPos, _yPos - yOff, _width, labelSize), $"{timeString} - {timeEvent.Name}", style); shown++; + } } diff --git a/ClockLib/manifest.json b/ClockLib/manifest.json index 9d68a22..0695ef4 100644 --- a/ClockLib/manifest.json +++ b/ClockLib/manifest.json @@ -4,6 +4,6 @@ "name": "Clock", "uniqueName": "clubby789.OWClock", "description": "Adds a clock overlay and eventlist", - "version": "0.2.9", + "version": "0.3.0", "owmlVersion": "0.7.3" } \ No newline at end of file