Decompiled source of HiddenStats v1.0.3

HiddenStats.dll

Decompiled a month ago
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Security;
using System.Security.Permissions;
using BepInEx;
using Dungeonator;
using Microsoft.CodeAnalysis;
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("Mod")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("Mod")]
[assembly: AssemblyCopyright("Copyright ©  2020")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("57445610-0892-47c3-be16-453172104123")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[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.Module, AllowMultiple = false, Inherited = false)]
	internal sealed class RefSafetyRulesAttribute : Attribute
	{
		public readonly int Version;

		public RefSafetyRulesAttribute(int P_0)
		{
			Version = P_0;
		}
	}
}
namespace HiddenStats
{
	public static class GUI
	{
		public static Font font;

		public static Transform GUIRoot;

		public static Transform GUIController;

		private static Canvas m_canvas;

		public static readonly Dictionary<TextAnchor, Vector2> AnchorMap = new Dictionary<TextAnchor, Vector2>
		{
			{
				(TextAnchor)6,
				new Vector2(0f, 0f)
			},
			{
				(TextAnchor)7,
				new Vector2(0.5f, 0f)
			},
			{
				(TextAnchor)8,
				new Vector2(1f, 0f)
			},
			{
				(TextAnchor)3,
				new Vector2(0f, 0.5f)
			},
			{
				(TextAnchor)4,
				new Vector2(0.5f, 0.5f)
			},
			{
				(TextAnchor)5,
				new Vector2(1f, 0.5f)
			},
			{
				(TextAnchor)0,
				new Vector2(0f, 1f)
			},
			{
				(TextAnchor)1,
				new Vector2(0.5f, 1f)
			},
			{
				(TextAnchor)2,
				new Vector2(1f, 1f)
			}
		};

		private static Color defaultTextColor = new Color(1f, 1f, 1f, 0.5f);

		public static bool Toggle()
		{
			bool flag = !((Component)GUIRoot).gameObject.activeSelf;
			((Component)GUIRoot).gameObject.SetActive(flag);
			return flag;
		}

		public static void SetVisible(bool visible)
		{
			((Component)GUIRoot).gameObject.SetActive(visible);
		}

		public static void Init()
		{
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			GUIController = new GameObject("GUIController").transform;
			Object.DontDestroyOnLoad((Object)(object)((Component)GUIController).gameObject);
			CreateCanvas();
			GUIRoot = ((Component)m_canvas).transform;
			GUIRoot.SetParent(GUIController);
		}

		public static void CreateCanvas()
		{
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			//IL_000c: Expected O, but got Unknown
			GameObject val = new GameObject("Canvas");
			Object.DontDestroyOnLoad((Object)(object)val);
			m_canvas = val.AddComponent<Canvas>();
			m_canvas.renderMode = (RenderMode)0;
			m_canvas.sortingOrder = 100000;
			val.AddComponent<CanvasScaler>();
			val.AddComponent<GraphicRaycaster>();
		}

		public static Text CreateText(Transform parent, Vector2 offset, string text, TextAnchor anchor = 4, int font_size = 20)
		{
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			//IL_000c: Expected O, but got Unknown
			//IL_0031: Unknown result type (might be due to invalid IL or missing references)
			//IL_0039: Unknown result type (might be due to invalid IL or missing references)
			//IL_0058: Unknown result type (might be due to invalid IL or missing references)
			//IL_008c: Unknown result type (might be due to invalid IL or missing references)
			GameObject val = new GameObject("Text");
			val.transform.SetParent(((Object)(object)parent != (Object)null) ? parent : GUIRoot);
			RectTransform val2 = val.AddComponent<RectTransform>();
			val2.SetTextAnchor(anchor);
			val2.anchoredPosition = offset;
			Text val3 = val.AddComponent<Text>();
			val3.horizontalOverflow = (HorizontalWrapMode)1;
			val3.verticalOverflow = (VerticalWrapMode)1;
			val3.alignment = anchor;
			val3.text = text;
			val3.font = ResourceManager.LoadAssetBundle("shared_auto_001").LoadAsset<Font>("04B_03__");
			val3.fontSize = font_size;
			((Graphic)val3).color = Color.grey;
			return val3;
		}

		public static void SetTextAnchor(this RectTransform r, TextAnchor anchor)
		{
			//IL_0007: Unknown result type (might be due to invalid IL or missing references)
			//IL_0008: Unknown result type (might be due to invalid IL or missing references)
			//IL_0019: Unknown result type (might be due to invalid IL or missing references)
			//IL_001a: 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_002c: Unknown result type (might be due to invalid IL or missing references)
			r.anchorMin = AnchorMap[anchor];
			r.anchorMax = AnchorMap[anchor];
			r.pivot = AnchorMap[anchor];
		}
	}
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[BepInPlugin("exploration.etg.hiddenstats", "Hidden Stats", "1.0.0")]
	public class HiddenStats : BaseUnityPlugin
	{
		public const string GUID = "exploration.etg.hiddenstats";

		public const string NAME = "Hidden Stats";

		public const string VERSION = "1.0.0";

		public const string TEXT_COLOR = "#00FFFF";

		public static Text floorMagnificence;

		public static Text generatedMagnificence;

		public static Text Magnificence;

		public static Text TotalMagnificence;

		public static Text HeartMagnificence;

		public static Text SynergyFactor;

		public static int FontSize = 34;

		public void Start()
		{
			//IL_0034: Unknown result type (might be due to invalid IL or missing references)
			//IL_006a: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a0: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d6: Unknown result type (might be due to invalid IL or missing references)
			//IL_010c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0142: Unknown result type (might be due to invalid IL or missing references)
			GUI.Init();
			ETGModMainBehaviour.WaitForGameManagerStart((Action<GameManager>)GMStart);
			((Component)ETGModMainBehaviour.Instance).gameObject.AddComponent<UpdateGUI>();
			floorMagnificence = GUI.CreateText(null, new Vector2(15f, 200f), "", (TextAnchor)3, FontSize);
			((Component)floorMagnificence).gameObject.SetActive(true);
			generatedMagnificence = GUI.CreateText(null, new Vector2(15f, 160f), "", (TextAnchor)3, FontSize);
			((Component)generatedMagnificence).gameObject.SetActive(true);
			Magnificence = GUI.CreateText(null, new Vector2(15f, 120f), "", (TextAnchor)3, FontSize);
			((Component)Magnificence).gameObject.SetActive(true);
			TotalMagnificence = GUI.CreateText(null, new Vector2(15f, 80f), "", (TextAnchor)3, FontSize);
			((Component)TotalMagnificence).gameObject.SetActive(true);
			HeartMagnificence = GUI.CreateText(null, new Vector2(15f, 40f), "", (TextAnchor)3, FontSize);
			((Component)HeartMagnificence).gameObject.SetActive(true);
			SynergyFactor = GUI.CreateText(null, new Vector2(15f, 0f), "", (TextAnchor)3, FontSize);
			((Component)SynergyFactor).gameObject.SetActive(true);
		}

		public void GMStart(GameManager g)
		{
			Log("Hidden Stats v1.0.0 started successfully.", "#00FFFF");
		}

		public static void Log(string text, string color = "FFFFFF")
		{
			ETGModConsole.Log((object)("<color=" + color + ">" + text + "</color>"), false);
		}
	}
	internal class UpdateGUI : MonoBehaviour
	{
		public PlayerStats p;

		public Dungeon d;

		private void Update()
		{
			try
			{
				p = Object.FindObjectOfType<PlayerStats>();
				d = Object.FindObjectOfType<Dungeon>();
				if ((Object)(object)p != (Object)null)
				{
					HiddenStats.floorMagnificence.text = "Floor Magnificence: " + p.m_floorMagnificence;
					HiddenStats.Magnificence.text = "Magnificence: " + p.m_magnificence;
				}
				HiddenStats.HeartMagnificence.text = "Heart Magnificence: " + RewardManager.AdditionalHeartTierMagnificence;
				HiddenStats.SynergyFactor.text = "Synergy Factor: " + SynergyFactorConstants.GetSynergyFactor();
				if ((Object)(object)d != (Object)null)
				{
					HiddenStats.generatedMagnificence.text = "Chest Magnificence: " + d.GeneratedMagnificence;
					HiddenStats.TotalMagnificence.text = "Total Magnificence: " + (d.GeneratedMagnificence + p.Magnificence);
				}
			}
			catch (Exception)
			{
			}
		}
	}
}