Skip to content

Commit

Permalink
Merge pull request #6 from A9G-Data-Droid/master
Browse files Browse the repository at this point in the history
Version 0.5.0 Compatible with OWML 2.1.0
  • Loading branch information
clubby789 authored Oct 24, 2021
2 parents 220cdf3 + 7dca739 commit f37b49c
Show file tree
Hide file tree
Showing 7 changed files with 65 additions and 229 deletions.
248 changes: 40 additions & 208 deletions ClockLib/ClockLib.csproj

Large diffs are not rendered by default.

1 change: 0 additions & 1 deletion ClockLib/EventFile.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
using System;
using System.Collections.Generic;
using System.Runtime.CompilerServices;

namespace Clock
{
Expand Down
25 changes: 14 additions & 11 deletions ClockLib/OWClock.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,14 @@ namespace Clock
public class OWClock : ModBehaviour
{
private static EventFile _save;
private List<string> _eventListStr = new List<string>();
private List<KeyValuePair<float, string>> _eventList = new List<KeyValuePair<float, string>>();
private readonly List<string> _eventListStr = new List<string>();
private readonly List<KeyValuePair<float, string>> _eventList = new List<KeyValuePair<float, string>>();
private Font _hudFont;
private float _xPos;
private float _yPos;
private float _width;

public static IModHelper Helper;
internal static IModHelper Helper;
public static bool CountUp { get; private set; }
public static bool Milliseconds { get; private set; }
public static int EventCount { get; private set; }
Expand Down Expand Up @@ -74,11 +74,14 @@ private void OnGUI()
return;
}

var style = new GUIStyle();
style.font = _hudFont;
style.fontSize = 30;
var style = new GUIStyle
{
font = _hudFont,
fontSize = 30,
wordWrap = true
};

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, _width, 60f), timestamp, style);
Expand All @@ -95,10 +98,12 @@ private void OnGUI()
{
continue;
}

if (EnabledTypes.IndexOf((int)timeEvent.type) == -1)
{
continue;
}

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);
Expand All @@ -107,7 +112,6 @@ private void OnGUI()
yOff += labelSize;
GUI.Label(new Rect(_xPos, _yPos - yOff, _width, labelSize), $"{timeString} - {timeEvent.Name}", style);
shown++;

}
}

Expand All @@ -122,7 +126,7 @@ private void AddEvent(string text)
Save.AddEvent(TimeLoop.GetSecondsElapsed(), text);
}

string ParseTime(float timestamp)
static string ParseTime(float timestamp)
{
var minutes = Mathf.Floor(timestamp / 60f).ToString().PadLeft(2, '0');
var seconds = Math.Truncate(timestamp % 60f).ToString().PadLeft(2, '0');
Expand All @@ -149,8 +153,7 @@ public override void Configure(IModConfig config)
{
EnabledTypes.Add(i);
}
}

}
}
}
}
10 changes: 5 additions & 5 deletions ClockLib/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,11 @@
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("ClockLib")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyDescription("Adds a clock overlay and eventlist")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("ClockLib")]
[assembly: AssemblyCopyright("Copyright © 2020")]
[assembly: AssemblyProduct("clubby789.OWClock")]
[assembly: AssemblyCopyright("Copyright © clubby789 2020")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]

Expand All @@ -31,5 +31,5 @@
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyVersion("0.5.0.0")]
[assembly: AssemblyFileVersion("0.5.0.0")]
1 change: 1 addition & 0 deletions ClockLib/TimeEvent.cs
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ public enum Type
Chert,
Misc
}

public float Timestamp;
public string Name;
public Type type = Type.Misc;
Expand Down
4 changes: 2 additions & 2 deletions ClockLib/manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,6 @@
"name": "Clock",
"uniqueName": "clubby789.OWClock",
"description": "Adds a clock overlay and eventlist",
"version": "0.4.0",
"owmlVersion": "0.7.3"
"version": "0.5.0",
"owmlVersion": "2.1.0"
}
5 changes: 3 additions & 2 deletions ClockLib/packages.config
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="Json.Net.Unity3D" version="9.0.1" targetFramework="net35" />
<package id="Lib.Harmony" version="1.2.0.1" targetFramework="net35" />
<package id="OWML" version="0.7.3" targetFramework="net35" />
<package id="Lib.Harmony" version="2.1.1" targetFramework="net48" />
<package id="Microsoft.CodeAnalysis.NetAnalyzers" version="5.0.3" targetFramework="net48" developmentDependency="true" />
<package id="OWML" version="2.1.0" targetFramework="net48" />
</packages>

0 comments on commit f37b49c

Please sign in to comment.