Decompiled source of DSPMiniFogWatch v0.0.1

DSPMiniFogWatch.dll

Decompiled 4 months ago
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using BepInEx;
using BepInEx.Logging;
using HarmonyLib;
using UnityEngine;
using UnityEngine.UI;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: AssemblyTitle("DspFontPatcher")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("DspFontPatcher")]
[assembly: AssemblyCopyright("Copyright ©  2021")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("81DF3045-8007-4F6A-AAF6-903139D85B6C")]
[assembly: AssemblyFileVersion("0.1.0.0")]
[assembly: TargetFramework(".NETFramework,Version=v4.7.2", FrameworkDisplayName = ".NET Framework 4.7.2")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("0.1.0.0")]
[module: UnverifiableCode]
namespace DSPMiniFogWatch;

[BepInPlugin("Appun.DSP.plugin.MiniFogWatch", "DSPMiniFogWatch", "0.0.1")]
[HarmonyPatch]
public class DSPMiniFogWatch : BaseUnityPlugin
{
	public class LogManager
	{
		public static ManualLogSource Logger;
	}

	public static float magnificationRate = 0.8f;

	public void Awake()
	{
		LogManager.Logger = ((BaseUnityPlugin)this).Logger;
		Harmony.CreateAndPatchAll(Assembly.GetExecutingAssembly(), (string)null);
	}

	[HarmonyPostfix]
	[HarmonyPatch(typeof(UIMechaLab), "_OnCreate")]
	public static void UIMechaLab_OnCreate_Postfix(UIMechaLab __instance)
	{
		//IL_001b: Unknown result type (might be due to invalid IL or missing references)
		//IL_0037: Unknown result type (might be due to invalid IL or missing references)
		//IL_0041: Unknown result type (might be due to invalid IL or missing references)
		//IL_0075: Unknown result type (might be due to invalid IL or missing references)
		//IL_00a9: Unknown result type (might be due to invalid IL or missing references)
		//IL_00fd: Unknown result type (might be due to invalid IL or missing references)
		//IL_0131: Unknown result type (might be due to invalid IL or missing references)
		//IL_0165: Unknown result type (might be due to invalid IL or missing references)
		((Component)__instance.miniLabGroup).transform.localScale = new Vector3(magnificationRate, magnificationRate, magnificationRate);
		__instance.miniLabGroup.sizeDelta = new Vector2(100f, __instance.miniLabGroup.sizeDelta.y);
		((Component)((Component)__instance.miniLabBg).transform.Find("label")).transform.localScale = new Vector3(0.8f, 1f, 1f);
		((Component)((Component)__instance.miniLabBg).transform.Find("label")).transform.localPosition = new Vector3(-35f, 0f, 0f);
		Object.Destroy((Object)(object)((Component)((Component)__instance.miniLabBg).transform.Find("supply-button/button-text")).GetComponent<Localizer>());
		((Component)((Component)__instance.miniLabBg).transform.Find("supply-button/check-icon")).transform.localScale = new Vector3(0.7f, 0.7f, 0.7f);
		((Component)((Component)__instance.miniLabBg).transform.Find("supply-button/check-icon")).transform.localPosition = new Vector3(-28f, 16f, 0f);
		((Component)((Component)__instance.miniLabBg).transform.Find("supply-button/button-text")).transform.localScale = new Vector3(0.7f, 0.7f, 0.7f);
		((Component)((Component)__instance.miniLabBg).transform.Find("supply-button/button-text")).GetComponent<Text>().fontSize = 18;
		((Component)((Component)__instance.miniLabBg).transform.Find("supply-button/button-text")).GetComponent<Text>().lineSpacing = 0.8f;
		((Component)((Component)__instance.miniLabBg).transform.Find("supply-button/button-text")).GetComponent<Text>().text = Localization.Translate("Inventory\r\nItems");
	}

	[HarmonyPostfix]
	[HarmonyPatch(typeof(UIMechaLabItem), "Awake")]
	public static void UIMechaLabItem_Awake_Postfix(UIMechaLabItem __instance)
	{
		//IL_0031: Unknown result type (might be due to invalid IL or missing references)
		//IL_0056: Unknown result type (might be due to invalid IL or missing references)
		//IL_0076: Unknown result type (might be due to invalid IL or missing references)
		__instance.countText.lineSpacing = 0.7f;
		((Component)__instance.countText).gameObject.transform.localPosition = new Vector3(-30f, -25f, 0f);
		((Component)__instance.countText).gameObject.GetComponent<RectTransform>().sizeDelta = new Vector2(132f, 50f);
		((Transform)__instance.trans).localPosition = new Vector3(-10f, -50f, 0f);
	}

	[HarmonyPostfix]
	[HarmonyPatch(typeof(UIMechaLabItem), "Refresh")]
	public static void UIMechaLabItem_Refresh_Postfix(UIMechaLabItem __instance)
	{
		__instance.countText.text = __instance.countText.text.Replace(" / ", "\r\n");
	}

	[HarmonyPrefix]
	[HarmonyPatch(typeof(UIDarkFogMonitor), "SetPosition")]
	public static bool UIDarkFogMonitor(UIDarkFogMonitor __instance)
	{
		//IL_008e: Unknown result type (might be due to invalid IL or missing references)
		//IL_0116: Unknown result type (might be due to invalid IL or missing references)
		//IL_0132: Unknown result type (might be due to invalid IL or missing references)
		//IL_015e: Unknown result type (might be due to invalid IL or missing references)
		bool flag = __instance.player.isAlive && !__instance.player.respawning;
		bool active = ((ManualBehaviour)UIRoot.instance.uiGame.mechaLab).active;
		bool active2 = ((ManualBehaviour)UIRoot.instance.uiGame.techTree).active;
		bool active3 = ((ManualBehaviour)UIRoot.instance.uiGame.dysonEditor).active;
		bool dfMonitorConflict = UIRoot.instance.uiGame.shieldDetail.dfMonitorConflict;
		Transform transform = ((Component)UIRoot.instance.uiGame.mechaLab).transform;
		float num = ((RectTransform)((transform is RectTransform) ? transform : null)).anchoredPosition.x;
		if (!active)
		{
			num = -220f;
		}
		int num2 = ((!flag) ? (-800) : (active3 ? 310 : Mathf.RoundToInt(Mathf.Lerp(20f, 100f, Mathf.InverseLerp(-220f, 0f, num)))));
		int num3 = (active2 ? (-175) : (-100));
		if (dfMonitorConflict)
		{
			num2 = 240;
		}
		Transform transform2 = ((Component)__instance).transform;
		RectTransform val = (RectTransform)(object)((transform2 is RectTransform) ? transform2 : null);
		if (Mathf.Abs(val.anchoredPosition.x - (float)num2) > 0.5f || Mathf.Abs(val.anchoredPosition.y - (float)num3) > 0.5f)
		{
			val.anchoredPosition = new Vector2((float)num2, (float)num3);
		}
		return false;
	}

	[HarmonyPostfix]
	[HarmonyPatch(typeof(UIDarkFogMonitorEntry), "_OnCreate")]
	public static void UIDarkFogMonitorEntry_OnCreate_Postfix(UIDarkFogMonitorEntry __instance)
	{
		//IL_0016: Unknown result type (might be due to invalid IL or missing references)
		//IL_0036: Unknown result type (might be due to invalid IL or missing references)
		//IL_0056: Unknown result type (might be due to invalid IL or missing references)
		//IL_008a: Unknown result type (might be due to invalid IL or missing references)
		//IL_00be: Unknown result type (might be due to invalid IL or missing references)
		//IL_00f2: Unknown result type (might be due to invalid IL or missing references)
		//IL_0126: Unknown result type (might be due to invalid IL or missing references)
		//IL_015a: Unknown result type (might be due to invalid IL or missing references)
		//IL_018e: Unknown result type (might be due to invalid IL or missing references)
		//IL_01c2: Unknown result type (might be due to invalid IL or missing references)
		//IL_01f6: Unknown result type (might be due to invalid IL or missing references)
		//IL_022a: Unknown result type (might be due to invalid IL or missing references)
		((Transform)__instance.rectTrans).localScale = new Vector3(0.5f, 1f, 1f);
		((Transform)__instance.rectTrans).localPosition = new Vector3(60f, -22f, 0f);
		((Transform)__instance.rectTrans).localScale = new Vector3(0.5f, 1f, 1f);
		((Component)((Component)__instance.rectTrans).transform.Find("id")).transform.localScale = new Vector3(2f, 1f, 1f);
		((Component)((Component)__instance.rectTrans).transform.Find("id")).transform.localPosition = new Vector3(-105f, 0f, 0f);
		((Component)((Component)__instance.rectTrans).transform.Find("level")).transform.localScale = new Vector3(1.5f, 1f, 1f);
		((Component)((Component)__instance.rectTrans).transform.Find("icon")).transform.localScale = new Vector3(2f, 1f, 1f);
		((Component)((Component)__instance.rectTrans).transform.Find("icon")).transform.localPosition = new Vector3(-105f, -10.5f, 0f);
		((Component)((Component)__instance.rectTrans).transform.Find("icon-frame")).transform.localScale = new Vector3(2f, 1f, 1f);
		((Component)((Component)__instance.rectTrans).transform.Find("icon-frame")).transform.localPosition = new Vector3(-107f, 1f, 0f);
		((Component)((Component)__instance.rectTrans).transform.Find("location")).transform.localScale = new Vector3(2f, 1f, 1f);
		((Component)((Component)__instance.rectTrans).transform.Find("thrt-mask/thrt-value")).transform.localScale = new Vector3(1.5f, 1f, 1f);
	}

	[HarmonyPrefix]
	[HarmonyPatch(typeof(UIDarkFogMonitorEntry), "RefreshValuesComplete")]
	public static bool UIDarkFogMonitorEntry_RefreshValuesComplete_Prefix(UIDarkFogMonitorEntry __instance)
	{
		//IL_002a: Unknown result type (might be due to invalid IL or missing references)
		((Component)((Component)__instance.rectTrans).transform.Find("thrt-mask/thrt-value")).transform.localScale = new Vector3(1.2f, 1f, 1f);
		return true;
	}
}