using System;
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using BepInEx;
using BepInEx.Logging;
using Eremite.Characters;
using Eremite.Characters.UI;
using Eremite.Characters.Villagers;
using Eremite.Controller;
using HarmonyLib;
using Microsoft.CodeAnalysis;
using TMPro;
using UnityEngine;
[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: TargetFramework(".NETFramework,Version=v4.7.2", FrameworkDisplayName = ".NET Framework 4.7.2")]
[assembly: AssemblyCompany("BreakTimer")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0+405f0e81657eca840d9ba53398387629718ef2d8")]
[assembly: AssemblyProduct("BreakTimer")]
[assembly: AssemblyTitle("BreakTimer")]
[assembly: AssemblyVersion("1.0.0.0")]
[module: RefSafetyRules(11)]
namespace Microsoft.CodeAnalysis
{
[CompilerGenerated]
[Embedded]
internal sealed class EmbeddedAttribute : Attribute
{
}
}
namespace System.Runtime.CompilerServices
{
[CompilerGenerated]
[Embedded]
[AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)]
internal sealed class RefSafetyRulesAttribute : Attribute
{
public readonly int Version;
public RefSafetyRulesAttribute(int P_0)
{
Version = P_0;
}
}
}
namespace BreakTimer
{
[BepInPlugin("com.sneakertack.breaktimer", "Break Timer", "1.0.0")]
public class Plugin : BaseUnityPlugin
{
internal static ManualLogSource Log;
private void Awake()
{
//IL_0010: Unknown result type (might be due to invalid IL or missing references)
Log = ((BaseUnityPlugin)this).Logger;
new Harmony("com.sneakertack.breaktimer").PatchAll();
Log.LogInfo((object)"Break Timer loaded.");
}
}
[HarmonyPatch(typeof(ActorStatusPanel), "Update")]
internal static class StatusCountdownPatch
{
private const string OpenTag = "<size=75%>";
private const string CloseTag = "</size>";
private const string ColorTag = "<color=#B2A88F>";
private const string EndColorTag = "</color>";
private const float StatusDownShift = 12f;
private static RectTransform shiftedRect;
private static float baselineY;
private static void Postfix(Actor ___actor, TMP_Text ___desc)
{
if (!((Object)(object)___desc == (Object)null))
{
Villager val = (Villager)(object)((___actor is Villager) ? ___actor : null);
if (val != null)
{
string minSecTimer = MainController.Instance.AppServices.RichTextService.GetMinSecTimer(TimeToNextBreak(val));
___desc.richText = true;
___desc.text = ___desc.text + "<size=75%>\n<color=#B2A88F>Next break: " + minSecTimer + "</color></size>";
ShiftBoxDown(___desc.rectTransform);
}
}
}
private static void ShiftBoxDown(RectTransform rect)
{
//IL_0024: Unknown result type (might be due to invalid IL or missing references)
//IL_0029: Unknown result type (might be due to invalid IL or missing references)
//IL_002b: Unknown result type (might be due to invalid IL or missing references)
//IL_003c: Unknown result type (might be due to invalid IL or missing references)
//IL_0014: Unknown result type (might be due to invalid IL or missing references)
if ((Object)(object)shiftedRect != (Object)(object)rect)
{
shiftedRect = rect;
baselineY = rect.anchoredPosition.y;
}
Vector2 anchoredPosition = rect.anchoredPosition;
rect.anchoredPosition = new Vector2(anchoredPosition.x, baselineY - 12f);
}
private static float TimeToNextBreak(Villager villager)
{
float time = GameController.Instance.GameServices.GameTimeService.Time;
return villager.state.lastNeedsFulfillment + villager.GetNeedsInterval() - time;
}
}
}