Decompiled source of TextUpgradesUIScale v1.0.0

TextUpgradesUIScale.dll

Decompiled 2 weeks ago
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.Versioning;
using BepInEx;
using BepInEx.Logging;
using HarmonyLib;
using TMPro;
using TextUpgradesUIScale.Patches;
using UnityEngine;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: AssemblyTitle("TextUpgradesUIScale")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("TextUpgradesUIScale")]
[assembly: AssemblyCopyright("Copyright ©  2025")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("a27adabc-310b-43d6-8584-f2e1ec7a34cb")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: TargetFramework(".NETFramework,Version=v4.8", FrameworkDisplayName = ".NET Framework 4.8")]
[assembly: AssemblyVersion("1.0.0.0")]
namespace TextUpgradesUIScale.Patches
{
	[HarmonyPatch(typeof(StatsUI), "Fetch")]
	public static class StatsUIPatchMod
	{
		private static float _defaultFontSize;

		private static bool _defaultFontSizeInitialized;

		public static void Postfix(StatsUI __instance)
		{
			//IL_001b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0021: Expected O, but got Unknown
			//IL_003b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0041: Expected O, but got Unknown
			TextMeshProUGUI val = (TextMeshProUGUI)AccessTools.Field(typeof(StatsUI), "Text").GetValue(__instance);
			TextMeshProUGUI val2 = (TextMeshProUGUI)AccessTools.Field(typeof(StatsUI), "textNumbers").GetValue(__instance);
			Dictionary<string, int> source = (Dictionary<string, int>)AccessTools.Field(typeof(StatsUI), "playerUpgrades").GetValue(__instance);
			int num = source.Count((KeyValuePair<string, int> kvp) => kvp.Value > 0);
			if (!_defaultFontSizeInitialized)
			{
				_defaultFontSize = ((TMP_Text)val).fontSize;
				_defaultFontSizeInitialized = true;
			}
			if (num >= 20)
			{
				((TMP_Text)val).fontSize = _defaultFontSize * 0.5f;
				((TMP_Text)val2).fontSize = _defaultFontSize * 0.5f;
			}
			else if (num >= 18)
			{
				((TMP_Text)val).fontSize = _defaultFontSize * 0.6f;
				((TMP_Text)val2).fontSize = _defaultFontSize * 0.6f;
			}
			else if (num >= 16)
			{
				((TMP_Text)val).fontSize = _defaultFontSize * 0.7f;
				((TMP_Text)val2).fontSize = _defaultFontSize * 0.7f;
			}
			else if (num >= 14)
			{
				((TMP_Text)val).fontSize = _defaultFontSize * 0.8f;
				((TMP_Text)val2).fontSize = _defaultFontSize * 0.8f;
			}
			else if (num >= 12)
			{
				((TMP_Text)val).fontSize = _defaultFontSize * 0.9f;
				((TMP_Text)val2).fontSize = _defaultFontSize * 0.9f;
			}
			else
			{
				((TMP_Text)val).fontSize = _defaultFontSize;
				((TMP_Text)val2).fontSize = _defaultFontSize;
			}
		}
	}
}
namespace DSStatsUIFontMod
{
	[BepInPlugin("DSModUI.StatsUIFontMod", "DarkSpiderStatsUIFontMod", "1.0.0")]
	public class StatsUIFontMod : BaseUnityPlugin
	{
		private const string modGUID = "DSModUI.StatsUIFontMod";

		private const string modName = "DarkSpiderStatsUIFontMod";

		private const string modVersion = "1.0.0";

		private readonly Harmony harmony = new Harmony("DSModUI.StatsUIFontMod");

		private static StatsUIFontMod Instance;

		internal ManualLogSource mls;

		private void Awake()
		{
			if ((Object)(object)Instance == (Object)null)
			{
				Instance = this;
			}
			mls = Logger.CreateLogSource("DSModUI.StatsUIFontMod");
			mls.LogInfo((object)"HE IS ALIVEEEEEEEEEE");
			harmony.PatchAll(typeof(StatsUIFontMod));
			harmony.PatchAll(typeof(StatsUIPatchMod));
		}
	}
}