Decompiled source of CharacterStockIcons v1.0.0

CharacterStockIcons.dll

Decompiled a month ago
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Security;
using System.Security.Permissions;
using BepInEx;
using BepInEx.Configuration;
using BepInEx.Logging;
using HarmonyLib;
using LLBML.Players;
using LLBML.Settings;
using LLBML.Utils;
using LLGUI;
using Microsoft.CodeAnalysis;
using ModMenu;
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: AssemblyCompany("CharacterStockIcons")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0+d836922768e91289b1d687390d2b818aab3dab8d")]
[assembly: AssemblyProduct("CharacterStockIcons")]
[assembly: AssemblyTitle("CharacterStockIcons")]
[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 CharacterStockIcons
{
	internal static class Configs
	{
		internal static ConfigEntry<string> SelectedIconPackId { get; private set; }

		internal static void BindConfigs()
		{
			ConfigFile config = ((BaseUnityPlugin)Plugin.Instance).Config;
			SelectedIconPackId = config.Bind<string>("Settings", "SelectedIconPackId", "stadium", "Selected icon pack (default or custom) specified by the id, which is based on the name of the icon pack subdirectory");
		}
	}
	internal static class HarmonyPatches
	{
		private static class StockDisplayPatch
		{
			[HarmonyPatch(typeof(GameHudPlayerInfo), "Awake")]
			[HarmonyPostfix]
			private static void Awake_Postfix(GameHudPlayerInfo __instance)
			{
				if (Plugin.Instance.selectedIconPack == null)
				{
					Plugin.LogGlobal.LogError((object)"No valid icon pack selected! Check that the id is set correctly in the config");
				}
				else if (__instance.showScore && !GameSettings.current.UsePoints)
				{
					((Component)__instance.imStocksBackdrop).gameObject.SetActive(false);
					((Component)__instance.imStocks).gameObject.SetActive(false);
					StockIconContainer stockIconContainer = StockIconContainer.CreateStockIconContainer(((Component)__instance).gameObject.transform, "stockIconContainer", GameSettings.current.stocks);
				}
			}

			[HarmonyPatch(typeof(GameHudPlayerInfo), "SetPlayer")]
			[HarmonyPostfix]
			private static void SetPlayer_Postfix(GameHudPlayerInfo __instance)
			{
				//IL_004f: Unknown result type (might be due to invalid IL or missing references)
				if (Plugin.Instance.selectedIconPack != null && __instance.showScore && !GameSettings.current.UsePoints)
				{
					Player val = Player.op_Implicit(__instance.shownPlayer);
					StockIconContainer componentInChildren = ((Component)((Component)__instance).transform).GetComponentInChildren<StockIconContainer>();
					componentInChildren.SetCharacter(val.Character);
				}
			}

			[HarmonyPatch(typeof(GameHudPlayerInfo), "ShowStocks")]
			[HarmonyPostfix]
			private static void ShowStocks_Postfix(GameHudPlayerInfo __instance, int stocks)
			{
				if (Plugin.Instance.selectedIconPack != null)
				{
					StockIconContainer componentInChildren = ((Component)((Component)__instance).transform).GetComponentInChildren<StockIconContainer>();
					componentInChildren.ShowStocks(stocks);
				}
			}
		}

		internal static class IconPreviewPatch
		{
			internal static bool isInModMenu;

			[HarmonyPatch(typeof(ModMenu), "HandleModSubSettingsClick")]
			[HarmonyPrefix]
			private static void HandleModSubSettingsClick_Prefix(PluginInfo plugin)
			{
				isInModMenu = plugin.Metadata.GUID == "avgduck.plugins.llb.characterstockicons";
			}

			[HarmonyPatch(typeof(ModMenu), "HandleQuitClick")]
			[HarmonyPrefix]
			private static void HandleQuitClick()
			{
				isInModMenu = false;
			}

			[HarmonyPatch(typeof(ScreenMenu), "OnOpen")]
			[HarmonyPostfix]
			private static void OnOpen_Postfix(ScreenMenu __instance)
			{
				IconPreviewWindow.Create(((Component)__instance).gameObject.transform);
			}
		}

		internal static void PatchAll()
		{
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			//IL_000c: Expected O, but got Unknown
			Harmony val = new Harmony("avgduck.plugins.llb.characterstockicons");
			val.PatchAll(typeof(StockDisplayPatch));
			Plugin.LogGlobal.LogInfo((object)"Stock display patch applied");
			if (!ModDependenciesUtils.IsModLoaded("no.mrgentle.plugins.llb.modmenu"))
			{
				Plugin.LogGlobal.LogWarning((object)"ModMenu is not loaded. Skipping preview patch...");
				return;
			}
			val.PatchAll(typeof(IconPreviewPatch));
			Plugin.LogGlobal.LogInfo((object)"Icon preview patch applied");
		}
	}
	internal class IconPack
	{
		internal static readonly Dictionary<string, Character> CharacterFromName = new Dictionary<string, Character>
		{
			{
				"Candyman",
				(Character)2
			},
			{
				"Dice",
				(Character)5
			},
			{
				"Doombox",
				(Character)6
			},
			{
				"DustAshes",
				(Character)11
			},
			{
				"Grid",
				(Character)8
			},
			{
				"Jet",
				(Character)9
			},
			{
				"Latch",
				(Character)4
			},
			{
				"Nitro",
				(Character)7
			},
			{
				"Raptor",
				(Character)0
			},
			{
				"Sonata",
				(Character)3
			},
			{
				"Switch",
				(Character)1
			},
			{
				"Toxic",
				(Character)10
			},
			{
				"Empty",
				(Character)101
			}
		};

		internal string id;

		internal Dictionary<Character, Sprite> icons;

		internal bool isValid;

		internal IconPack(DirectoryInfo directory)
		{
			//IL_017c: Unknown result type (might be due to invalid IL or missing references)
			//IL_018b: 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_01ec: Unknown result type (might be due to invalid IL or missing references)
			id = directory.Name;
			icons = new Dictionary<Character, Sprite>();
			isValid = false;
			Plugin.LogGlobal.LogInfo((object)("Attempting to load icon pack: '" + id + "'"));
			foreach (FileInfo item in from f in directory.GetFiles()
				orderby f.Name
				select f)
			{
				string text;
				if (item.Name.Contains(".png"))
				{
					text = item.Name.Replace(".png", "");
				}
				else
				{
					if (!item.Name.Contains(".jpg"))
					{
						Plugin.LogGlobal.LogWarning((object)("Icon file '" + item.Name + "' invalid: extension must be .png or .jpg"));
						continue;
					}
					text = item.Name.Replace(".jpg", "");
				}
				if (!CharacterFromName.ContainsKey(text))
				{
					Plugin.LogGlobal.LogWarning((object)("Icon file '" + item.Name + "' invalid: '" + text + "' is not a valid character"));
				}
				else
				{
					Texture2D val = LoadImageFile(item);
					Sprite value = Sprite.Create(val, new Rect(0f, 0f, (float)((Texture)val).width, (float)((Texture)val).height), new Vector2(0.5f, 0.5f));
					icons.Add(CharacterFromName[text], value);
				}
			}
			bool flag = false;
			foreach (KeyValuePair<string, Character> item2 in CharacterFromName)
			{
				if (!icons.ContainsKey(item2.Value))
				{
					Plugin.LogGlobal.LogWarning((object)("Icon pack '" + id + "' is missing an icon for character '" + item2.Key + "'"));
					flag = true;
				}
			}
			if (!flag)
			{
				isValid = true;
			}
		}

		private static void CopyStream(Stream input, Stream output)
		{
			byte[] array = new byte[8192];
			int count;
			while ((count = input.Read(array, 0, array.Length)) > 0)
			{
				output.Write(array, 0, count);
			}
		}

		private static Texture2D LoadImageFile(FileInfo file)
		{
			//IL_0018: Unknown result type (might be due to invalid IL or missing references)
			//IL_001e: Expected O, but got Unknown
			using FileStream input = file.OpenRead();
			using MemoryStream memoryStream = new MemoryStream();
			CopyStream(input, memoryStream);
			Texture2D val = new Texture2D(1, 1);
			ImageConversion.LoadImage(val, memoryStream.ToArray());
			return val;
		}
	}
	internal class IconPreviewWindow : MonoBehaviour
	{
		private class IconPreview
		{
			private RectTransform rectTransform;

			private TextMeshProUGUI lbCharacter;

			private string characterName;

			private StockIconContainer.StockIcon icon;

			internal IconPreview(Transform tfParent, string characterName, float x, float y)
			{
				//IL_006a: Unknown result type (might be due to invalid IL or missing references)
				//IL_00c5: Unknown result type (might be due to invalid IL or missing references)
				//IL_00ca: Unknown result type (might be due to invalid IL or missing references)
				rectTransform = LLControl.CreatePanel(tfParent, "stockPreview_" + characterName, x, y);
				this.characterName = characterName;
				lbCharacter = ((Component)LLControl.CreatePanel((Transform)(object)rectTransform, "lbCharacter", -100f, 0f)).gameObject.AddComponent<TextMeshProUGUI>();
				((TMP_Text)lbCharacter).fontSize = 12f;
				((Graphic)lbCharacter).color = Color.white;
				((TMP_Text)lbCharacter).alignment = (TextAlignmentOptions)516;
				((TMP_Text)lbCharacter).SetText(characterName);
				icon = StockIconContainer.StockIcon.CreateStockIcon((Transform)(object)rectTransform, "stockIcon_" + characterName, 0);
				((Transform)icon.rectTransform).localPosition = Vector2.op_Implicit(new Vector2(16f, 0f));
				icon.SetDisplay(characterName != "Empty");
			}

			internal void UpdatePack()
			{
				//IL_004a: Unknown result type (might be due to invalid IL or missing references)
				if (Plugin.Instance.selectedIconPack == null)
				{
					((Component)icon).gameObject.SetActive(false);
					return;
				}
				((Component)icon).gameObject.SetActive(true);
				icon.SetCharacter(IconPack.CharacterFromName[characterName]);
			}
		}

		private static readonly Vector2 POSITION = new Vector2(540f, 100f);

		private const float FONT_SIZE = 12f;

		private RectTransform rectTransform;

		private RectTransform tfContainer;

		private TextMeshProUGUI lbSelected;

		private TextMeshProUGUI lbPack;

		private Image imgBg;

		private List<IconPreview> iconPreviews;

		internal static void Create(Transform tfParent)
		{
			RectTransform val = LLControl.CreatePanel(tfParent, "iconPreviewUI", POSITION.x, POSITION.y);
			IconPreviewWindow iconPreviewWindow = ((Component)val).gameObject.AddComponent<IconPreviewWindow>();
			iconPreviewWindow.rectTransform = val;
			iconPreviewWindow.Init();
		}

		private void Init()
		{
			//IL_0041: Unknown result type (might be due to invalid IL or missing references)
			//IL_0050: 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_00d8: Unknown result type (might be due to invalid IL or missing references)
			//IL_00dd: Unknown result type (might be due to invalid IL or missing references)
			//IL_0102: Unknown result type (might be due to invalid IL or missing references)
			//IL_016c: Unknown result type (might be due to invalid IL or missing references)
			//IL_01e7: Unknown result type (might be due to invalid IL or missing references)
			tfContainer = LLControl.CreatePanel((Transform)(object)rectTransform, "container", 0f, 0f);
			imgBg = LLControl.CreateImage((Transform)(object)tfContainer, Sprite.Create(Texture2D.whiteTexture, new Rect(0f, 0f, 1f, 1f), new Vector2(0.5f, 0.5f)));
			((Graphic)imgBg).rectTransform.SetSizeWithCurrentAnchors((Axis)0, 160f);
			((Graphic)imgBg).rectTransform.SetSizeWithCurrentAnchors((Axis)1, 340f);
			((Graphic)imgBg).rectTransform.ForceUpdateRectTransforms();
			((Graphic)imgBg).rectTransform.pivot = new Vector2(0.55f, 1f);
			((Transform)((Graphic)imgBg).rectTransform).localPosition = Vector2.op_Implicit(new Vector2(0f, 10f));
			((Graphic)imgBg).color = new Color(0f, 0f, 0f, 0.5f);
			lbSelected = ((Component)LLControl.CreatePanel((Transform)(object)tfContainer, "lbSelected", -100f, 0f)).gameObject.AddComponent<TextMeshProUGUI>();
			((TMP_Text)lbSelected).fontSize = 12f;
			((TMP_Text)lbSelected).enableWordWrapping = false;
			((TMP_Text)lbSelected).alignment = (TextAlignmentOptions)516;
			((Graphic)lbSelected).color = Color.white;
			((TMP_Text)lbSelected).SetText("Stock icons:");
			lbPack = ((Component)LLControl.CreatePanel((Transform)(object)tfContainer, "lbPack", 106f, 0f)).gameObject.AddComponent<TextMeshProUGUI>();
			((TMP_Text)lbPack).fontSize = 12f;
			((TMP_Text)lbPack).enableWordWrapping = false;
			((TMP_Text)lbPack).alignment = (TextAlignmentOptions)513;
			((Graphic)lbPack).color = Color.red;
			((TMP_Text)lbPack).SetText("NULL");
			List<string> list = (from n in IconPack.CharacterFromName.Keys
				where n != "Empty"
				orderby n
				select n).ToList();
			list.Add("Empty");
			iconPreviews = new List<IconPreview>();
			for (int i = 0; i < list.Count; i++)
			{
				iconPreviews.Add(new IconPreview((Transform)(object)tfContainer, list[i], 0f, (float)(-1 * (i + 1)) * 24f));
			}
			((Component)tfContainer).gameObject.SetActive(false);
		}

		private void Update()
		{
			//IL_0050: Unknown result type (might be due to invalid IL or missing references)
			//IL_0049: Unknown result type (might be due to invalid IL or missing references)
			if (!HarmonyPatches.IconPreviewPatch.isInModMenu)
			{
				((Component)tfContainer).gameObject.SetActive(false);
				return;
			}
			((Component)tfContainer).gameObject.SetActive(true);
			((Graphic)lbPack).color = ((Plugin.Instance.selectedIconPack == null) ? Color.red : Color.green);
			((TMP_Text)lbPack).SetText((Plugin.Instance.selectedIconPack == null) ? "NULL" : Plugin.Instance.selectedIconPack.id);
			iconPreviews.ForEach(delegate(IconPreview preview)
			{
				preview.UpdatePack();
			});
		}
	}
	[BepInPlugin("avgduck.plugins.llb.characterstockicons", "CharacterStockIcons", "1.0.0")]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	public class Plugin : BaseUnityPlugin
	{
		public const string GUID = "avgduck.plugins.llb.characterstockicons";

		internal const string DEPENDENCY_LLBML = "fr.glomzubuk.plugins.llb.llbml";

		internal const string DEPENDENCY_MODMENU = "no.mrgentle.plugins.llb.modmenu";

		private DirectoryInfo packDirectoryDefault;

		private DirectoryInfo packDirectoryCustom;

		private Dictionary<string, IconPack> iconPacksDefault;

		private Dictionary<string, IconPack> iconPacksCustom;

		internal IconPack selectedIconPack;

		internal Sprite defaultIcon;

		public static Plugin Instance { get; private set; }

		internal static ManualLogSource LogGlobal { get; private set; }

		private void Awake()
		{
			//IL_0122: 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)
			Instance = this;
			LogGlobal = ((BaseUnityPlugin)this).Logger;
			HarmonyPatches.PatchAll();
			string path = Path.Combine(Path.GetDirectoryName(((BaseUnityPlugin)this).Info.Location), "packs-default");
			if (!Directory.Exists(path))
			{
				Directory.CreateDirectory(path);
			}
			packDirectoryDefault = new DirectoryInfo(path);
			DirectoryInfo modSubFolder = ModdingFolder.GetModSubFolder(((BaseUnityPlugin)this).Info);
			string path2 = Path.Combine(modSubFolder.FullName, "packs-custom");
			if (!Directory.Exists(path2))
			{
				Directory.CreateDirectory(path2);
			}
			packDirectoryCustom = new DirectoryInfo(path2);
			LoadAllIconPacks();
			if (iconPacksDefault.Count > 0)
			{
				selectedIconPack = iconPacksDefault.First().Value;
			}
			Configs.BindConfigs();
			((BaseUnityPlugin)this).Config.SettingChanged += delegate
			{
				OnConfigChanged();
			};
			OnConfigChanged();
			ModDependenciesUtils.RegisterToModMenu(((BaseUnityPlugin)this).Info, GetModMenuText());
			Texture2D blackTexture = Texture2D.blackTexture;
			defaultIcon = Sprite.Create(blackTexture, new Rect(0f, 0f, (float)((Texture)blackTexture).width, (float)((Texture)blackTexture).height), new Vector2(0.5f, 0.5f));
		}

		private void LoadAllIconPacks()
		{
			iconPacksDefault = new Dictionary<string, IconPack>();
			foreach (DirectoryInfo item in from d in packDirectoryDefault.GetDirectories()
				orderby d.Name
				select d)
			{
				IconPack iconPack = new IconPack(item);
				if (iconPacksDefault.ContainsKey(iconPack.id))
				{
					LogGlobal.LogError((object)("Failed to load default icon pack '" + iconPack.id + "': pack with id '" + iconPack.id + "' already exists"));
				}
				else if (!iconPack.isValid)
				{
					LogGlobal.LogError((object)("Failed to load default icon pack '" + iconPack.id + "': invalid pack format"));
				}
				else
				{
					LogGlobal.LogInfo((object)("Loaded default icon pack '" + iconPack.id + "'"));
					iconPacksDefault.Add(iconPack.id, iconPack);
				}
			}
			iconPacksCustom = new Dictionary<string, IconPack>();
			foreach (DirectoryInfo item2 in from d in packDirectoryCustom.GetDirectories()
				orderby d.Name
				select d)
			{
				IconPack iconPack2 = new IconPack(item2);
				if (iconPacksDefault.ContainsKey(iconPack2.id) || iconPacksCustom.ContainsKey(iconPack2.id))
				{
					LogGlobal.LogError((object)("Failed to load custom icon pack '" + iconPack2.id + "': pack with id '" + iconPack2.id + "' already exists"));
				}
				else if (!iconPack2.isValid)
				{
					LogGlobal.LogError((object)("Failed to load custom icon pack '" + iconPack2.id + "'"));
				}
				else
				{
					LogGlobal.LogInfo((object)("Loaded custom icon pack '" + iconPack2.id + "'"));
					iconPacksCustom.Add(iconPack2.id, iconPack2);
				}
			}
		}

		private List<string> GetModMenuText()
		{
			List<string> text = new List<string>();
			text.Add("Choose an icon pack from those currently loaded (shown below). Default icon packs are included with the mod download, and custom icon packs can be added to your Modding Folder.");
			text.Add("");
			text.Add("");
			text.Add("<b>Default Icon Packs:</b>");
			if (iconPacksDefault.Count == 0)
			{
				text.Add("none");
			}
			else
			{
				iconPacksDefault.ToList().ForEach(delegate(KeyValuePair<string, IconPack> entry)
				{
					text.Add("- " + entry.Key);
				});
			}
			text.Add("");
			text.Add("<b>Custom Icon Packs:</b>");
			if (iconPacksCustom.Count == 0)
			{
				text.Add("none");
			}
			else
			{
				iconPacksCustom.ToList().ForEach(delegate(KeyValuePair<string, IconPack> entry)
				{
					text.Add("- " + entry.Key);
				});
			}
			return text;
		}

		private void OnConfigChanged()
		{
			string value = Configs.SelectedIconPackId.Value;
			if (iconPacksDefault.ContainsKey(value))
			{
				LogGlobal.LogInfo((object)("Selected default icon pack '" + value + "'"));
				selectedIconPack = iconPacksDefault[value];
			}
			else if (iconPacksCustom.ContainsKey(value))
			{
				LogGlobal.LogInfo((object)("Selected custom icon pack '" + value + "'"));
				selectedIconPack = iconPacksCustom[value];
			}
			else
			{
				selectedIconPack = null;
			}
		}
	}
	internal class StockIconContainer : MonoBehaviour
	{
		internal class StockIcon : MonoBehaviour
		{
			internal const float ICON_SIZE = 24f;

			internal RectTransform rectTransform;

			internal Image imgChar;

			internal Image imgEmpty;

			internal int index;

			internal static StockIcon CreateStockIcon(Transform tfParent, string name, int index)
			{
				//IL_007c: Unknown result type (might be due to invalid IL or missing references)
				//IL_0081: Unknown result type (might be due to invalid IL or missing references)
				//IL_00e5: Unknown result type (might be due to invalid IL or missing references)
				//IL_00ea: Unknown result type (might be due to invalid IL or missing references)
				RectTransform val = LLControl.CreatePanel(tfParent, name);
				StockIcon stockIcon = ((Component)val).gameObject.AddComponent<StockIcon>();
				stockIcon.rectTransform = val;
				stockIcon.index = index;
				stockIcon.imgChar = LLControl.CreateImage((Transform)(object)val, Plugin.Instance.defaultIcon);
				((Graphic)stockIcon.imgChar).rectTransform.SetSizeWithCurrentAnchors((Axis)0, 24f);
				((Graphic)stockIcon.imgChar).rectTransform.SetSizeWithCurrentAnchors((Axis)1, 24f);
				((Transform)((Graphic)stockIcon.imgChar).rectTransform).localPosition = Vector2.op_Implicit(new Vector2(0f, 0f));
				stockIcon.imgEmpty = LLControl.CreateImage((Transform)(object)val, Plugin.Instance.defaultIcon);
				((Graphic)stockIcon.imgEmpty).rectTransform.SetSizeWithCurrentAnchors((Axis)0, 24f);
				((Graphic)stockIcon.imgEmpty).rectTransform.SetSizeWithCurrentAnchors((Axis)1, 24f);
				((Transform)((Graphic)stockIcon.imgEmpty).rectTransform).localPosition = Vector2.op_Implicit(new Vector2(0f, 0f));
				return stockIcon;
			}

			internal void SetCharacter(Character character)
			{
				//IL_0016: Unknown result type (might be due to invalid IL or missing references)
				imgChar.sprite = Plugin.Instance.selectedIconPack.icons[character];
				imgEmpty.sprite = Plugin.Instance.selectedIconPack.icons[(Character)101];
			}

			internal void SetDisplay(bool active)
			{
				((Component)imgChar).gameObject.SetActive(active);
				((Component)imgEmpty).gameObject.SetActive(!active);
			}
		}

		private List<StockIcon> stockIcons;

		internal static StockIconContainer CreateStockIconContainer(Transform tfParent, string name, int maxStocks)
		{
			//IL_0067: Unknown result type (might be due to invalid IL or missing references)
			//IL_006c: Unknown result type (might be due to invalid IL or missing references)
			RectTransform val = LLControl.CreatePanel(tfParent, name, -54f, -100f);
			StockIconContainer stockIconContainer = ((Component)val).gameObject.AddComponent<StockIconContainer>();
			stockIconContainer.stockIcons = new List<StockIcon>();
			for (int i = 0; i < 10; i++)
			{
				StockIcon stockIcon = StockIcon.CreateStockIcon((Transform)(object)val, $"stockIcon_{i}", i);
				stockIconContainer.stockIcons.Add(stockIcon);
				((Transform)stockIcon.rectTransform).localPosition = Vector2.op_Implicit(new Vector2(24f * (float)i, 0f));
				if (i > maxStocks - 1)
				{
					((Component)stockIcon).gameObject.SetActive(false);
				}
			}
			return stockIconContainer;
		}

		internal void SetCharacter(Character character)
		{
			//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)
			stockIcons.ForEach(delegate(StockIcon icon)
			{
				//IL_0002: Unknown result type (might be due to invalid IL or missing references)
				icon.SetCharacter(character);
			});
		}

		internal void ShowStocks(int stocks)
		{
			if (stocks <= 0)
			{
				stockIcons.ForEach(delegate(StockIcon icon)
				{
					((Component)icon).gameObject.SetActive(false);
				});
			}
			else
			{
				stockIcons.ForEach(delegate(StockIcon icon)
				{
					icon.SetDisplay(icon.index < stocks);
				});
			}
		}
	}
	public static class MyPluginInfo
	{
		public const string PLUGIN_GUID = "CharacterStockIcons";

		public const string PLUGIN_NAME = "CharacterStockIcons";

		public const string PLUGIN_VERSION = "1.0.0";
	}
}