Decompiled source of InventoryHUDInfo v0.4.1

InventoryHUD.dll

Decompiled a year ago
using System.Diagnostics;
using System.IO;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.Versioning;
using BepInEx;
using BepInEx.Configuration;
using HarmonyLib;
using TMPro;
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("InventoryHUD")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("InventoryHUD")]
[assembly: AssemblyCopyright("Copyright ©  2021")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("2a3431ae-002d-4b07-b681-21942166995c")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: TargetFramework(".NETFramework,Version=v4.8", FrameworkDisplayName = ".NET Framework 4.8")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyVersion("1.0.0.0")]
public class AedenthornUtils
{
	public static bool IgnoreKeyPresses(bool extra = false)
	{
		if (!extra)
		{
			int result;
			if (!((Object)(object)ZNetScene.instance == (Object)null) && !((Object)(object)Player.m_localPlayer == (Object)null) && !Minimap.IsOpen() && !Console.IsVisible() && !TextInput.IsVisible() && !ZNet.instance.InPasswordDialog())
			{
				Chat instance = Chat.instance;
				result = ((instance != null && instance.HasFocus()) ? 1 : 0);
			}
			else
			{
				result = 1;
			}
			return (byte)result != 0;
		}
		int result2;
		if (!((Object)(object)ZNetScene.instance == (Object)null) && !((Object)(object)Player.m_localPlayer == (Object)null) && !Minimap.IsOpen() && !Console.IsVisible() && !TextInput.IsVisible() && !ZNet.instance.InPasswordDialog())
		{
			Chat instance2 = Chat.instance;
			if ((instance2 == null || !instance2.HasFocus()) && !StoreGui.IsVisible() && !InventoryGui.IsVisible() && !Menu.IsVisible())
			{
				TextViewer instance3 = TextViewer.instance;
				result2 = ((instance3 != null && instance3.IsVisible()) ? 1 : 0);
				goto IL_00d2;
			}
		}
		result2 = 1;
		goto IL_00d2;
		IL_00d2:
		return (byte)result2 != 0;
	}

	public static bool CheckKeyDown(string value)
	{
		try
		{
			return Input.GetKeyDown(value.ToLower());
		}
		catch
		{
			return false;
		}
	}

	public static bool CheckKeyHeld(string value, bool req = true)
	{
		try
		{
			return Input.GetKey(value.ToLower());
		}
		catch
		{
			return !req;
		}
	}
}
namespace InventoryHUD;

[BepInPlugin("aedenthorn.InventoryHUD", "InventoryHUD", "0.4.1")]
public class BepInExPlugin : BaseUnityPlugin
{
	[HarmonyPatch(typeof(Hud), "Awake")]
	private static class Hud_Awake_Patch
	{
		private static void Postfix(Hud __instance)
		{
			if (modEnabled.Value)
			{
				if (weightFile.Value.Length > 0)
				{
					AddWeightObject(__instance);
				}
				if (infoString.Value.Length > 0)
				{
					AddInfoString(__instance);
				}
			}
		}
	}

	[HarmonyPatch(typeof(Hud), "Update")]
	private static class Hud_Update_Patch
	{
		public static Vector3 lastPosition = Vector3.zero;

		private static void Prefix(Hud __instance)
		{
			//IL_002a: 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_005f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0117: Unknown result type (might be due to invalid IL or missing references)
			//IL_011d: Unknown result type (might be due to invalid IL or missing references)
			//IL_012c: Unknown result type (might be due to invalid IL or missing references)
			//IL_013b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0140: Unknown result type (might be due to invalid IL or missing references)
			//IL_0145: Unknown result type (might be due to invalid IL or missing references)
			//IL_03d5: Unknown result type (might be due to invalid IL or missing references)
			//IL_03db: Unknown result type (might be due to invalid IL or missing references)
			//IL_03ea: Unknown result type (might be due to invalid IL or missing references)
			//IL_03f9: Unknown result type (might be due to invalid IL or missing references)
			//IL_03fe: Unknown result type (might be due to invalid IL or missing references)
			//IL_0487: Unknown result type (might be due to invalid IL or missing references)
			//IL_0499: Unknown result type (might be due to invalid IL or missing references)
			//IL_01e0: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ed: 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_01fb: Unknown result type (might be due to invalid IL or missing references)
			//IL_0241: Unknown result type (might be due to invalid IL or missing references)
			//IL_0246: Unknown result type (might be due to invalid IL or missing references)
			//IL_028b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0290: Unknown result type (might be due to invalid IL or missing references)
			//IL_02ba: Unknown result type (might be due to invalid IL or missing references)
			//IL_02bf: Unknown result type (might be due to invalid IL or missing references)
			//IL_032e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0333: Unknown result type (might be due to invalid IL or missing references)
			//IL_0347: Unknown result type (might be due to invalid IL or missing references)
			//IL_0361: Unknown result type (might be due to invalid IL or missing references)
			//IL_0376: Unknown result type (might be due to invalid IL or missing references)
			//IL_0383: Unknown result type (might be due to invalid IL or missing references)
			//IL_0388: Unknown result type (might be due to invalid IL or missing references)
			//IL_039d: Unknown result type (might be due to invalid IL or missing references)
			//IL_03ae: Unknown result type (might be due to invalid IL or missing references)
			//IL_02fb: Unknown result type (might be due to invalid IL or missing references)
			//IL_02fc: Unknown result type (might be due to invalid IL or missing references)
			//IL_0301: Unknown result type (might be due to invalid IL or missing references)
			//IL_0306: Unknown result type (might be due to invalid IL or missing references)
			//IL_030b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0310: Unknown result type (might be due to invalid IL or missing references)
			//IL_0316: Unknown result type (might be due to invalid IL or missing references)
			//IL_031c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0322: Unknown result type (might be due to invalid IL or missing references)
			if (!modEnabled.Value || Player.m_localPlayer == null)
			{
				return;
			}
			Vector3 val = default(Vector3);
			((Vector3)(ref val))..ctor(hudPosition.Value.x, hudPosition.Value.y, 0f);
			GameObject rootObject = __instance.m_rootObject;
			if (rootObject != null && rootObject.transform.localPosition.x > 1000f)
			{
				GameObject maskObject = BepInExPlugin.maskObject;
				if (maskObject != null)
				{
					maskObject.SetActive(false);
				}
				GameObject partialObject = BepInExPlugin.partialObject;
				if (partialObject != null)
				{
					partialObject.SetActive(false);
				}
				GameObject fullObject = BepInExPlugin.fullObject;
				if (fullObject != null)
				{
					fullObject.SetActive(false);
				}
				GameObject infoObject = BepInExPlugin.infoObject;
				if (infoObject != null)
				{
					infoObject.SetActive(false);
				}
				return;
			}
			GameObject maskObject2 = BepInExPlugin.maskObject;
			if (maskObject2 != null)
			{
				maskObject2.SetActive(true);
			}
			GameObject partialObject2 = BepInExPlugin.partialObject;
			if (partialObject2 != null)
			{
				partialObject2.SetActive(true);
			}
			GameObject fullObject2 = BepInExPlugin.fullObject;
			if (fullObject2 != null)
			{
				fullObject2.SetActive(true);
			}
			GameObject infoObject2 = BepInExPlugin.infoObject;
			if (infoObject2 != null)
			{
				infoObject2.SetActive(true);
			}
			Inventory inventory = ((Humanoid)Player.m_localPlayer).GetInventory();
			Vector3 val2 = val + new Vector3(weightOffset.Value.x, weightOffset.Value.y, 0f);
			float totalWeight = inventory.GetTotalWeight();
			float maxCarryWeight = Player.m_localPlayer.GetMaxCarryWeight();
			if ((Object)(object)BepInExPlugin.fullObject != (Object)null)
			{
				float scaleFactor = GameObject.Find("LoadingGUI").GetComponent<CanvasScaler>().scaleFactor;
				float num = (1f - totalWeight / maxCarryWeight) * (float)((Texture)weightTexture).height * weightScale.Value * scaleFactor;
				if (AedenthornUtils.CheckKeyHeld(modKey.Value) && Input.GetKeyDown((KeyCode)323))
				{
					Dbgl($"{lastPosition} {val} {Vector3.Distance(lastPosition, val)} {(float)(((Texture)weightTexture).height + ((Texture)weightTexture).width) / 4f} {num}");
					if (Vector3.Distance(Input.mousePosition, val) < (float)(((Texture)weightTexture).height + ((Texture)weightTexture).width) / 4f * weightScale.Value * scaleFactor)
					{
						Dbgl("dragging start");
						lastPosition = Input.mousePosition;
					}
				}
				else if (AedenthornUtils.CheckKeyHeld(modKey.Value) && Input.GetKey((KeyCode)323) && Vector3.Distance(lastPosition, val2) < (float)(((Texture)weightTexture).height + ((Texture)weightTexture).width) / 4f * weightScale.Value * scaleFactor)
				{
					val += Input.mousePosition - lastPosition;
					hudPosition.Value = new Vector2(val.x, val.y);
				}
				lastPosition = Input.mousePosition;
				((Graphic)BepInExPlugin.partialObject.GetComponent<Image>()).color = fillColor.Value;
				((Graphic)BepInExPlugin.fullObject.GetComponent<Image>()).color = weightColor.Value;
				BepInExPlugin.maskObject.transform.position = val2 - new Vector3(0f, num, 0f);
				BepInExPlugin.partialObject.transform.position = val2;
				BepInExPlugin.fullObject.transform.position = val2;
			}
			if ((Object)(object)BepInExPlugin.infoObject != (Object)null)
			{
				BepInExPlugin.infoObject.transform.position = val + new Vector3(infoStringOffset.Value.x, infoStringOffset.Value.y, 0f);
				int count = inventory.GetAllItems().Count;
				int num2 = inventory.GetWidth() * inventory.GetHeight() + extraSlots.Value;
				TextMeshProUGUI component = BepInExPlugin.infoObject.GetComponent<TextMeshProUGUI>();
				((TMP_Text)component).text = string.Format(infoString.Value, count, num2, totalWeight, maxCarryWeight);
				((Graphic)component).color = infoStringColor.Value;
				((TMP_Text)component).alignment = infoStringAlignment.Value;
				((TMP_Text)component).fontSize = infoStringSize.Value;
			}
		}
	}

	[HarmonyPatch(typeof(Terminal), "InputText")]
	private static class InputText_Patch
	{
		private static bool Prefix(Terminal __instance)
		{
			if (!modEnabled.Value)
			{
				return true;
			}
			string text = ((TMP_InputField)__instance.m_input).text;
			if (text.ToLower().Equals(typeof(BepInExPlugin).Namespace.ToLower() + " reset"))
			{
				((BaseUnityPlugin)context).Config.Reload();
				((BaseUnityPlugin)context).Config.Save();
				Object.Destroy((Object)(object)partialObject);
				Object.Destroy((Object)(object)fullObject);
				Object.Destroy((Object)(object)maskObject);
				Object.Destroy((Object)(object)infoObject);
				if (modEnabled.Value && Object.op_Implicit((Object)(object)Hud.instance))
				{
					if (weightFile.Value.Length > 0)
					{
						AddWeightObject(Hud.instance);
					}
					if (infoString.Value.Length > 0)
					{
						AddInfoString(Hud.instance);
					}
				}
				Traverse.Create((object)__instance).Method("AddString", new object[1] { text }).GetValue();
				Traverse.Create((object)__instance).Method("AddString", new object[1] { ((BaseUnityPlugin)context).Info.Metadata.Name + " config reloaded" }).GetValue();
				return false;
			}
			return true;
		}
	}

	private static readonly bool isDebug = true;

	private static BepInExPlugin context;

	private Harmony harmony;

	public static ConfigEntry<bool> modEnabled;

	public static ConfigEntry<int> nexusID;

	public static ConfigEntry<string> modKey;

	public static ConfigEntry<Vector2> hudPosition;

	public static ConfigEntry<Vector2> infoStringOffset;

	public static ConfigEntry<Vector2> weightOffset;

	public static ConfigEntry<int> extraSlots;

	public static ConfigEntry<string> infoString;

	public static ConfigEntry<int> infoStringSize;

	public static ConfigEntry<string> infoStringFont;

	public static ConfigEntry<TextAlignmentOptions> infoStringAlignment;

	public static ConfigEntry<Color> infoStringColor;

	public static ConfigEntry<string> weightFile;

	public static ConfigEntry<Color> weightColor;

	public static ConfigEntry<Color> fillColor;

	public static ConfigEntry<float> weightScale;

	public static GameObject partialObject;

	public static GameObject fullObject;

	public static GameObject maskObject;

	public static GameObject infoObject;

	public static Texture2D weightTexture;

	public static void Dbgl(string str = "", bool pref = true)
	{
		if (isDebug)
		{
			Debug.Log((object)((pref ? (typeof(BepInExPlugin).Namespace + " ") : "") + str));
		}
	}

	private void Awake()
	{
		//IL_0090: Unknown result type (might be due to invalid IL or missing references)
		//IL_00de: Unknown result type (might be due to invalid IL or missing references)
		//IL_01a3: Unknown result type (might be due to invalid IL or missing references)
		//IL_01d1: Unknown result type (might be due to invalid IL or missing references)
		//IL_0251: Unknown result type (might be due to invalid IL or missing references)
		//IL_0289: Unknown result type (might be due to invalid IL or missing references)
		//IL_02ae: Unknown result type (might be due to invalid IL or missing references)
		//IL_02b8: Expected O, but got Unknown
		context = this;
		modEnabled = ((BaseUnityPlugin)this).Config.Bind<bool>("General", "Enabled", true, "Enable this mod");
		nexusID = ((BaseUnityPlugin)this).Config.Bind<int>("General", "NexusID", 1089, "Nexus mod ID for updates");
		modKey = ((BaseUnityPlugin)this).Config.Bind<string>("General", "ModKey", "left alt", "Modifier key to allow moving with the mouse.");
		hudPosition = ((BaseUnityPlugin)this).Config.Bind<Vector2>("General", "HudPosition", new Vector2((float)(Screen.width - 40), (float)(Screen.height / 2)), "Weight icon file to use in InventoryHUD folder");
		extraSlots = ((BaseUnityPlugin)this).Config.Bind<int>("General", "ExtraSlots", 0, "Extra slots added by mods outside of the actual player inventory. Use this for mods that add extra inventories or other hacky things. E.g. Equipment and Quick Slots mods adds eight extra slots outside of the actual player inventory. Set this to 8 if you use that mod.");
		infoStringOffset = ((BaseUnityPlugin)this).Config.Bind<Vector2>("Info", "InfoStringOffset", new Vector2(-64f, 0f), "Inventory info string offset");
		infoString = ((BaseUnityPlugin)this).Config.Bind<string>("Info", "InfoString", "{0}/{1}\r\n{2}/{3}", "Inventory info string to show. {0} is replaced by current number of items. {1} is replaced by number of slots total. {2} is replaced by current weight. {3} is replaced by total weight. See string.Format API for advanced usage.");
		infoStringSize = ((BaseUnityPlugin)this).Config.Bind<int>("Info", "InfoStringSize", 12, "Inventory info string size.");
		infoStringFont = ((BaseUnityPlugin)this).Config.Bind<string>("Info", "InfoStringFont", "AveriaSerifLibre-Bold", "Inventory info string font.");
		infoStringAlignment = ((BaseUnityPlugin)this).Config.Bind<TextAlignmentOptions>("Info", "InfoStringAlignment", (TextAlignmentOptions)514, "Info string alignment");
		infoStringColor = ((BaseUnityPlugin)this).Config.Bind<Color>("Info", "InfoStringColor", new Color(1f, 1f, 1f, 0.5f), "Info string color");
		weightOffset = ((BaseUnityPlugin)this).Config.Bind<Vector2>("Weight", "WeightOffset", new Vector2(0f, 0f), "Weight icon offset");
		weightFile = ((BaseUnityPlugin)this).Config.Bind<string>("Weight", "WeightFile", "bag.png", "Weight icon file to use in InventoryHUD folder");
		weightScale = ((BaseUnityPlugin)this).Config.Bind<float>("Weight", "WeightScale", 1f, "Weight icon scale");
		weightColor = ((BaseUnityPlugin)this).Config.Bind<Color>("Weight", "WeightColor", new Color(1f, 1f, 1f, 0.5f), "Weight icon color");
		fillColor = ((BaseUnityPlugin)this).Config.Bind<Color>("Weight", "WeightFillColor", new Color(1f, 1f, 0.5f, 1f), "Weight icon fill color");
		harmony = new Harmony(((BaseUnityPlugin)this).Info.Metadata.GUID);
		harmony.PatchAll();
	}

	private void OnDestroy()
	{
		Dbgl("Destroying plugin");
		Harmony obj = harmony;
		if (obj != null)
		{
			obj.UnpatchAll((string)null);
		}
	}

	private static TMP_FontAsset GetFont(string fontName, int fontSize)
	{
		TMP_FontAsset[] array = Resources.FindObjectsOfTypeAll<TMP_FontAsset>();
		TMP_FontAsset[] array2 = array;
		foreach (TMP_FontAsset val in array2)
		{
			if (((Object)val).name == fontName)
			{
				return val;
			}
		}
		return null;
	}

	private static void AddWeightObject(Hud hud)
	{
		//IL_0038: Unknown result type (might be due to invalid IL or missing references)
		//IL_0042: Expected O, but got Unknown
		//IL_0086: Unknown result type (might be due to invalid IL or missing references)
		//IL_008c: Expected O, but got Unknown
		//IL_010a: Unknown result type (might be due to invalid IL or missing references)
		//IL_010f: Unknown result type (might be due to invalid IL or missing references)
		//IL_013f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0144: Unknown result type (might be due to invalid IL or missing references)
		//IL_0171: Unknown result type (might be due to invalid IL or missing references)
		//IL_0176: Unknown result type (might be due to invalid IL or missing references)
		//IL_0182: Unknown result type (might be due to invalid IL or missing references)
		//IL_0187: Unknown result type (might be due to invalid IL or missing references)
		//IL_0198: Expected O, but got Unknown
		//IL_01b9: Unknown result type (might be due to invalid IL or missing references)
		//IL_01c8: Unknown result type (might be due to invalid IL or missing references)
		//IL_01d5: Unknown result type (might be due to invalid IL or missing references)
		//IL_01f8: Unknown result type (might be due to invalid IL or missing references)
		//IL_0220: Unknown result type (might be due to invalid IL or missing references)
		//IL_0234: Unknown result type (might be due to invalid IL or missing references)
		//IL_023e: Expected O, but got Unknown
		//IL_026f: Unknown result type (might be due to invalid IL or missing references)
		//IL_027e: Unknown result type (might be due to invalid IL or missing references)
		//IL_028b: Unknown result type (might be due to invalid IL or missing references)
		//IL_02ae: Unknown result type (might be due to invalid IL or missing references)
		//IL_02ed: Unknown result type (might be due to invalid IL or missing references)
		//IL_02f2: Unknown result type (might be due to invalid IL or missing references)
		//IL_0303: Expected O, but got Unknown
		//IL_0323: Unknown result type (might be due to invalid IL or missing references)
		//IL_0332: Unknown result type (might be due to invalid IL or missing references)
		//IL_033f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0362: Unknown result type (might be due to invalid IL or missing references)
		//IL_0389: Unknown result type (might be due to invalid IL or missing references)
		//IL_009d: Unknown result type (might be due to invalid IL or missing references)
		if (!modEnabled.Value)
		{
			return;
		}
		string path = Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), "InventoryHUD");
		weightTexture = new Texture2D(2, 2, (TextureFormat)4, false, true);
		byte[] array = File.ReadAllBytes(Path.Combine(path, weightFile.Value));
		ImageConversion.LoadImage(weightTexture, array);
		((Texture)weightTexture).filterMode = (FilterMode)0;
		Texture2D val = new Texture2D(((Texture)weightTexture).width, ((Texture)weightTexture).height, (TextureFormat)4, false);
		for (int i = 0; i < ((Texture)weightTexture).width; i++)
		{
			for (int j = 0; j < ((Texture)weightTexture).height; j++)
			{
				val.SetPixel(i, j, Color.white);
			}
		}
		val.Apply();
		Sprite sprite = Sprite.Create(weightTexture, new Rect(0f, 0f, (float)((Texture)weightTexture).width, (float)((Texture)weightTexture).height), Vector2.zero);
		Sprite sprite2 = Sprite.Create(weightTexture, new Rect(0f, 0f, (float)((Texture)weightTexture).width, (float)((Texture)weightTexture).height), Vector2.zero);
		Sprite sprite3 = Sprite.Create(val, new Rect(0f, 0f, (float)((Texture)weightTexture).width, (float)((Texture)weightTexture).height), Vector2.zero);
		fullObject = new GameObject
		{
			name = "InventoryHUDFullImage"
		};
		RectTransform val2 = fullObject.AddComponent<RectTransform>();
		((Transform)val2).SetParent(hud.m_rootObject.transform);
		((Transform)val2).localScale = Vector3.one * weightScale.Value;
		val2.anchoredPosition = Vector2.zero;
		val2.sizeDelta = new Vector2((float)((Texture)weightTexture).width, (float)((Texture)weightTexture).height);
		Image val3 = fullObject.AddComponent<Image>();
		val3.sprite = sprite2;
		((Graphic)val3).color = weightColor.Value;
		val3.preserveAspect = true;
		maskObject = new GameObject();
		((Object)maskObject).name = "InventoryHUDMaskImage";
		RectTransform val4 = maskObject.AddComponent<RectTransform>();
		((Transform)val4).SetParent(hud.m_rootObject.transform);
		((Transform)val4).localScale = Vector3.one * weightScale.Value;
		val4.anchoredPosition = Vector2.zero;
		val4.sizeDelta = new Vector2((float)((Texture)weightTexture).width, (float)((Texture)weightTexture).height);
		Image val5 = maskObject.AddComponent<Image>();
		val5.sprite = sprite3;
		val5.preserveAspect = true;
		Mask val6 = maskObject.AddComponent<Mask>();
		val6.showMaskGraphic = false;
		partialObject = new GameObject
		{
			name = "Image"
		};
		RectTransform val7 = partialObject.AddComponent<RectTransform>();
		((Transform)val7).SetParent(maskObject.transform);
		((Transform)val7).localScale = Vector3.one * weightScale.Value;
		val7.anchoredPosition = Vector2.zero;
		val7.sizeDelta = new Vector2((float)((Texture)weightTexture).width, (float)((Texture)weightTexture).height);
		Image val8 = partialObject.AddComponent<Image>();
		val8.sprite = sprite;
		((Graphic)val8).color = fillColor.Value;
		val8.preserveAspect = true;
		Dbgl("Added weight object to hud");
	}

	private static void AddInfoString(Hud hud)
	{
		//IL_0001: Unknown result type (might be due to invalid IL or missing references)
		//IL_0006: Unknown result type (might be due to invalid IL or missing references)
		//IL_0017: Expected O, but got Unknown
		//IL_0035: 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)
		infoObject = new GameObject
		{
			name = "InventoryHUDInfo"
		};
		RectTransform val = infoObject.AddComponent<RectTransform>();
		((Transform)val).SetParent(hud.m_rootObject.transform);
		((Transform)val).localScale = Vector3.one;
		val.anchoredPosition = Vector2.zero;
		TextMeshProUGUI val2 = infoObject.AddComponent<TextMeshProUGUI>();
		Dbgl($"text: {((object)val2)?.GetType()}");
		Dbgl(((TMP_Text)val2).text ?? "");
		TMP_FontAsset font = GetFont(infoStringFont.Value, infoStringSize.Value);
		if ((Object)(object)font != (Object)null)
		{
			((TMP_Text)val2).font = font;
		}
	}
}