Initial commit
This commit is contained in:
commit
360a2bd89f
5 changed files with 489 additions and 0 deletions
44
Plugin.cs
Normal file
44
Plugin.cs
Normal file
|
|
@ -0,0 +1,44 @@
|
|||
using BepInEx;
|
||||
using HarmonyLib;
|
||||
using MyBox;
|
||||
using System;
|
||||
using UnityEngine;
|
||||
using UnityEngine.SceneManagement;
|
||||
|
||||
namespace _24HourTime
|
||||
{
|
||||
[BepInPlugin(PluginInfo.PLUGIN_GUID, PluginInfo.PLUGIN_NAME, PluginInfo.PLUGIN_VERSION)]
|
||||
public class Plugin : BaseUnityPlugin
|
||||
{
|
||||
private void Awake()
|
||||
{
|
||||
Logger.LogInfo($"Plugin {PluginInfo.PLUGIN_GUID} is loaded! Applying patch...");
|
||||
Harmony harmony = new Harmony(PluginInfo.PLUGIN_GUID);
|
||||
harmony.PatchAll();
|
||||
|
||||
SceneManager.sceneLoaded += (a, b) =>
|
||||
{
|
||||
var go = GameObject.Find("Time BG");
|
||||
if(go != null)
|
||||
{
|
||||
Logger.LogInfo("Moving Time BG");
|
||||
go.transform.localPosition = new Vector3(1005f, go.transform.localPosition.y, go.transform.localPosition.z);
|
||||
}
|
||||
};
|
||||
}
|
||||
}
|
||||
[HarmonyPatch(typeof(TimeText), "UpdateTimeText")]
|
||||
public static class TimeText_UpdateTimeText_Patch
|
||||
{
|
||||
public static void Postfix(TimeText __instance)
|
||||
{
|
||||
string text = string.Concat(new string[]
|
||||
{
|
||||
(__instance.m_DayCycle.CurrentHour + (__instance.m_DayCycle.AM ^ __instance.m_DayCycle.CurrentHour == 12 ? 0 : 12)).ToString("00"),
|
||||
":",
|
||||
__instance.m_DayCycle.CurrentMinute.ToString("00")
|
||||
});
|
||||
__instance.m_TimeText.text = text;
|
||||
}
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue