using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using BepInEx;
using BepInEx.Bootstrap;
using BepInEx.Logging;
using HarmonyLib;
using HyperModded.Utils;
using Microsoft.CodeAnalysis;
using TMPro;
using UnityEngine;
using UnityEngine.UI;
[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")]
[assembly: AssemblyCompany("HypermoddedTeam.HyperModded")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("HyperModded")]
[assembly: AssemblyTitle("HypermoddedTeam.HyperModded")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.0.0")]
[module: UnverifiableCode]
[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.Class | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Event | AttributeTargets.Parameter | AttributeTargets.ReturnValue | AttributeTargets.GenericParameter, AllowMultiple = false, Inherited = false)]
internal sealed class NullableAttribute : Attribute
{
public readonly byte[] NullableFlags;
public NullableAttribute(byte P_0)
{
NullableFlags = new byte[1] { P_0 };
}
public NullableAttribute(byte[] P_0)
{
NullableFlags = P_0;
}
}
[CompilerGenerated]
[Microsoft.CodeAnalysis.Embedded]
[AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Method | AttributeTargets.Interface | AttributeTargets.Delegate, AllowMultiple = false, Inherited = false)]
internal sealed class NullableContextAttribute : Attribute
{
public readonly byte Flag;
public NullableContextAttribute(byte P_0)
{
Flag = P_0;
}
}
[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 HyperModded
{
[BepInPlugin("HypermoddedTeam.HyperModded", "HyperModded", "1.0.0")]
public class HyperModded : BaseUnityPlugin
{
public static HyperModded Instance { get; private set; }
internal static ManualLogSource Logger { get; private set; }
internal static Harmony? Harmony { get; set; }
private void Awake()
{
Logger = ((BaseUnityPlugin)this).Logger;
Instance = this;
Patch();
Logger.LogInfo((object)"HypermoddedTeam.HyperModded v1.0.0 has loaded!");
}
internal static void Patch()
{
//IL_000c: Unknown result type (might be due to invalid IL or missing references)
//IL_0011: Unknown result type (might be due to invalid IL or missing references)
//IL_0017: Expected O, but got Unknown
if (Harmony == null)
{
Harmony = new Harmony("HypermoddedTeam.HyperModded");
}
Logger.LogDebug((object)"Patching...");
Harmony.PatchAll();
Logger.LogDebug((object)"Finished patching!");
}
internal static void Unpatch()
{
Logger.LogDebug((object)"Unpatching...");
Harmony? harmony = Harmony;
if (harmony != null)
{
harmony.UnpatchSelf();
}
Logger.LogDebug((object)"Finished unpatching!");
}
}
public static class MyPluginInfo
{
public const string PLUGIN_GUID = "HypermoddedTeam.HyperModded";
public const string PLUGIN_NAME = "HyperModded";
public const string PLUGIN_VERSION = "1.0.0";
}
}
namespace HyperModded.Utils
{
internal static class MenusUtils
{
internal static void InjectMenu(MenuManager __instance)
{
Transform transform = __instance.menuButtons.transform;
if (!Object.op_Implicit((Object)(object)transform))
{
return;
}
Transform val = transform.Find("VersionNumberText");
if (!((Object)(object)val == (Object)null))
{
TextMeshProUGUI component = ((Component)val).GetComponent<TextMeshProUGUI>();
if (!((Object)(object)component == (Object)null))
{
((TMP_Text)component).text = "";
((Behaviour)component).enabled = false;
((TMP_Text)component).fontSize = 0f;
Debug.Log((object)"InjectMenu: Successfully modified VersionNumberText!");
}
}
}
}
}
namespace HyperModded.Patches
{
[HarmonyPatch(typeof(MenuManager))]
internal class MenuManagerPatches
{
[HarmonyPatch("Start")]
[HarmonyPostfix]
public static void StartPostFix(MenuManager __instance)
{
((MonoBehaviour)__instance).StartCoroutine(DelayedMainMenuInjection(__instance));
}
private static IEnumerator DelayedMainMenuInjection(MenuManager __instance)
{
yield return (object)new WaitForSeconds(0.01f);
InjectToMainMenu(__instance);
}
private static void InjectToMainMenu(MenuManager __instance)
{
//IL_000b: Unknown result type (might be due to invalid IL or missing references)
//IL_0011: Expected O, but got Unknown
//IL_00a3: Unknown result type (might be due to invalid IL or missing references)
//IL_00b8: Unknown result type (might be due to invalid IL or missing references)
//IL_00cd: Unknown result type (might be due to invalid IL or missing references)
//IL_00e2: Unknown result type (might be due to invalid IL or missing references)
//IL_0101: Unknown result type (might be due to invalid IL or missing references)
MenusUtils.InjectMenu(__instance);
GameObject val = new GameObject("ModCountText");
val.transform.SetParent(__instance.menuButtons.transform.parent, false);
TextMeshProUGUI val2 = val.AddComponent<TextMeshProUGUI>();
((TMP_Text)val2).fontSize = 10f;
((TMP_Text)val2).enableWordWrapping = false;
((TMP_Text)val2).overflowMode = (TextOverflowModes)0;
((TMP_Text)val2).alignment = (TextAlignmentOptions)257;
TMP_FontAsset val3 = ((IEnumerable<TMP_FontAsset>)Resources.FindObjectsOfTypeAll<TMP_FontAsset>()).FirstOrDefault((Func<TMP_FontAsset, bool>)((TMP_FontAsset f) => ((Object)f).name.Contains("3270-Regular")));
if (Object.op_Implicit((Object)(object)val3))
{
((TMP_Text)val2).font = val3;
}
RectTransform component = val.GetComponent<RectTransform>();
component.anchorMin = new Vector2(0f, 1f);
component.anchorMax = new Vector2(0f, 1f);
component.pivot = new Vector2(0f, 1f);
component.anchoredPosition = new Vector2(10f, -10f);
((Graphic)val2).color = new Color(1f, 0f, 0.1f, 0.8f);
((TMP_Text)val2).text = $"Mods: {Chainloader.PluginInfos.Count}";
}
}
}