using System;
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security.Permissions;
using BepInEx;
using BepInEx.Configuration;
using HarmonyLib;
using Microsoft.CodeAnalysis;
using RoR2.UI;
using RoR2.UI.LogBook;
using RoR2.UI.MainMenu;
using UnityEngine;
[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: TargetFramework(".NETStandard,Version=v2.0", FrameworkDisplayName = ".NET Standard 2.0")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("0.1.1.0")]
[module: RefSafetyRules(11)]
namespace Microsoft.CodeAnalysis
{
[CompilerGenerated]
[Microsoft.CodeAnalysis.Embedded]
internal sealed class EmbeddedAttribute : Attribute
{
}
}
namespace System.Runtime.CompilerServices
{
[CompilerGenerated]
[Microsoft.CodeAnalysis.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 Prototype
{
[BepInPlugin("ui.scale", "UIScale", "0.1.1")]
public class UIScale : BaseUnityPlugin
{
public const string version = "0.1.1";
public const string identifier = "ui.scale";
private static ConfigEntry<float> percentage;
private static Transform instance;
public void Awake()
{
//IL_002e: Unknown result type (might be due to invalid IL or missing references)
//IL_0038: Expected O, but got Unknown
percentage = ((BaseUnityPlugin)this).Config.Bind<float>("Width", "Percentage", 84.375f, new ConfigDescription("", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0f, 100f), Array.Empty<object>()));
Harmony.CreateAndPatchAll(((object)this).GetType(), (string)null);
}
private static void Resize(Transform transform)
{
//IL_0013: Unknown result type (might be due to invalid IL or missing references)
//IL_004a: Unknown result type (might be due to invalid IL or missing references)
//IL_0051: Unknown result type (might be due to invalid IL or missing references)
//IL_005d: Unknown result type (might be due to invalid IL or missing references)
//IL_0064: Unknown result type (might be due to invalid IL or missing references)
RectTransform val = (RectTransform)(object)((transform is RectTransform) ? transform : null);
float pivot;
if (Object.op_Implicit((Object)(object)val))
{
pivot = val.pivot.x;
if (pivot <= 0f || pivot >= 1f)
{
pivot = 0.5f;
}
val.anchorMin = resize(val.anchorMin);
val.anchorMax = resize(val.anchorMax);
}
Vector2 resize(Vector2 anchor)
{
//IL_0016: Unknown result type (might be due to invalid IL or missing references)
//IL_0025: 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)
return new Vector2(pivot + percentage.Value / 100f * (anchor.x - pivot), anchor.y);
}
}
private static void Resize(Component parent, string path)
{
Resize(parent.transform.Find(path));
}
[HarmonyPatch(typeof(MainMenuController), "Awake")]
[HarmonyPostfix]
private static void Hook(MainMenuController __instance)
{
Resize((Component)(object)__instance, "MENU: Title/TitleMenu/SafeZone");
Resize((Component)(object)__instance, "MENU: Multiplayer/MultiplayerMenu2/Inner90");
Resize((Component)(object)__instance, "MENU: Extra Game Mode/ExtraGameModeMenu/Main Panel");
Resize((Component)(object)__instance, "MENU: More/MoreMenu/Main Panel");
}
[HarmonyPatch(typeof(EclipseRunScreenController), "Awake")]
[HarmonyPatch(typeof(InfiniteTowerMenuController), "Awake")]
[HarmonyPatch(typeof(WeeklyRunScreenController), "OnEnable")]
[HarmonyPostfix]
private static void Hook(Component __instance)
{
Resize(__instance, "Main Panel");
}
[HarmonyPatch(typeof(CharacterSelectController), "Awake")]
[HarmonyPostfix]
private static void Hook(CharacterSelectController __instance)
{
Resize((Component)(object)__instance, "SafeArea");
}
[HarmonyPatch(typeof(SettingsPanelController), "Start")]
[HarmonyPostfix]
private static void Hook(SettingsPanelController __instance)
{
Resize(Object.op_Implicit((Object)(object)instance) ? null : (instance = ((Component)__instance).transform.parent.parent));
}
[HarmonyPatch(typeof(HUD), "Awake")]
[HarmonyPostfix]
private static void Hook(HUD __instance)
{
Resize((Component)(object)__instance, "MainContainer/MainUIArea/SpringCanvas");
}
[HarmonyPatch(typeof(GameEndReportPanelController), "Awake")]
[HarmonyPostfix]
private static void Hook(GameEndReportPanelController __instance)
{
Resize((Component)(object)__instance, "SafeArea (JUICED)");
}
[HarmonyPatch(typeof(LogBookController), "Awake")]
[HarmonyPostfix]
private static void Hook(LogBookController __instance)
{
Resize((Component)(object)__instance, "LogbookPanel");
}
}
}