Please disclose if any significant portion of your mod was created using AI tools by adding the 'AI Generated' category. Failing to do so may result in the mod being removed from Thunderstore.
Decompiled source of SkillsPreview v0.5.2
SkillsPreview.dll
Decompiled a week ago
The result has been truncated due to the large size, download it to view full contents!
using System; using System.Collections; using System.Collections.Generic; using System.Diagnostics; using System.Globalization; using System.IO; using System.Linq; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using System.Security; using System.Security.Permissions; using BepInEx; using BepInEx.Configuration; using BepInEx.Logging; using HarmonyLib; using Microsoft.CodeAnalysis; using SkillsPreview.App.Data; using SkillsPreview.App.Locale; using SkillsPreview.App.Logging; using SkillsPreview.App.Store; using SkillsPreview.App.UI.CharacterStatsPanel; using SkillsPreview.App.UI.FavoriteSkillsHud; using SkillsPreview.App.UI.LevelUpToast; using SkillsPreview.App.UI.SettingsPanel; using TMPro; using UnityEngine; using UnityEngine.Events; using UnityEngine.UI; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: TargetFramework(".NETFramework,Version=v4.8", FrameworkDisplayName = ".NET Framework 4.8")] [assembly: AssemblyCompany("SkillsPreview")] [assembly: AssemblyConfiguration("Release")] [assembly: AssemblyFileVersion("0.5.2.0")] [assembly: AssemblyInformationalVersion("0.5.2+567001adb8542b5d7ba2b0a1ba05ef5ad0025561")] [assembly: AssemblyProduct("SkillsPreview")] [assembly: AssemblyTitle("SkillsPreview")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("0.5.2.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.Class | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Event | AttributeTargets.Parameter | AttributeTargets.ReturnValue | AttributeTargets.GenericParameter, AllowMultiple = false, Inherited = false)] internal sealed class NullableAttribute : Attribute { public readonly byte[] NullableFlags; public NullableAttribute(byte P_0) { NullableFlags = new byte[1] { P_0 }; } public NullableAttribute(byte[] P_0) { NullableFlags = P_0; } } [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] [AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Method | AttributeTargets.Interface | AttributeTargets.Delegate, AllowMultiple = false, Inherited = false)] internal sealed class NullableContextAttribute : Attribute { public readonly byte Flag; public NullableContextAttribute(byte P_0) { Flag = P_0; } } [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; } } internal static class IsExternalInit { } } namespace SkillsPreview.App { [BepInPlugin("godzki.skills_preview", "Skills Preview", "0.5.2")] public class Plugin : BaseUnityPlugin { internal static Plugin Instance; internal static ManualLogSource Log; private readonly Harmony _harmony = new Harmony("godzki.skills_preview"); internal static void SaveConfig() { ((BaseUnityPlugin)Instance).Config.Save(); FavoriteSkillsStore.NotifyConfigChanged(); } private void Awake() { Instance = this; Log = ((BaseUnityPlugin)this).Logger; Config.Bind((BaseUnityPlugin)(object)this); _harmony.PatchAll(); Log.LogInfo((object)"Skills Preview 0.5.2 loaded."); } private void OnDestroy() { _harmony.UnpatchSelf(); } } } namespace SkillsPreview.App.UI { internal static class SpriteUtils { private static readonly Dictionary<int, Sprite> RoundedRectCache = new Dictionary<int, Sprite>(); private static readonly Dictionary<(int, int), Sprite> RoundedRectFrameCache = new Dictionary<(int, int), Sprite>(); internal static Sprite RoundedRect(int radius) { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002a: Expected O, but got Unknown //IL_00a6: Unknown result type (might be due to invalid IL or missing references) //IL_00b5: Unknown result type (might be due to invalid IL or missing references) //IL_00c1: Unknown result type (might be due to invalid IL or missing references) //IL_005a: 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) if (RoundedRectCache.TryGetValue(radius, out Sprite value) && (Object)(object)value != (Object)null) { return value; } int num = radius * 2 + 2; Texture2D val = new Texture2D(num, num, (TextureFormat)5, false); ((Texture)val).filterMode = (FilterMode)1; ((Texture)val).wrapMode = (TextureWrapMode)1; Color32[] array = (Color32[])(object)new Color32[num * num]; for (int i = 0; i < num; i++) { for (int j = 0; j < num; j++) { array[i * num + j] = SampleRoundedRectPixel(j, i, num, num, radius); } } val.SetPixels32(array); val.Apply(false); Vector4 val2 = default(Vector4); ((Vector4)(ref val2))..ctor((float)radius, (float)radius, (float)radius, (float)radius); Sprite val3 = Sprite.Create(val, new Rect(0f, 0f, (float)num, (float)num), new Vector2(0.5f, 0.5f), 100f, 0u, (SpriteMeshType)0, val2); RoundedRectCache[radius] = val3; return val3; } internal static Sprite ResetIcon(int size = 24) { //IL_0004: Unknown result type (might be due to invalid IL or missing references) //IL_000a: Expected O, but got Unknown //IL_002d: Unknown result type (might be due to invalid IL or missing references) //IL_0032: 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_0243: Unknown result type (might be due to invalid IL or missing references) //IL_0245: Unknown result type (might be due to invalid IL or missing references) //IL_0247: Unknown result type (might be due to invalid IL or missing references) //IL_026a: Unknown result type (might be due to invalid IL or missing references) //IL_0279: Unknown result type (might be due to invalid IL or missing references) //IL_0163: Unknown result type (might be due to invalid IL or missing references) //IL_0169: Unknown result type (might be due to invalid IL or missing references) //IL_016f: Unknown result type (might be due to invalid IL or missing references) //IL_0177: Unknown result type (might be due to invalid IL or missing references) //IL_017c: Unknown result type (might be due to invalid IL or missing references) Texture2D val = new Texture2D(size, size, (TextureFormat)5, false); ((Texture)val).filterMode = (FilterMode)1; ((Texture)val).wrapMode = (TextureWrapMode)1; Color32[] array = (Color32[])(object)new Color32[size * size]; for (int i = 0; i < array.Length; i++) { array[i] = new Color32((byte)0, (byte)0, (byte)0, (byte)0); } Color32 val2 = default(Color32); ((Color32)(ref val2))..ctor((byte)160, (byte)115, (byte)55, byte.MaxValue); float num = (float)(size - 1) * 0.5f; float num2 = (float)(size - 1) * 0.5f; float num3 = (float)size * 0.44f; float num4 = (float)size * 0.27f; float num5 = (num3 + num4) * 0.5f; float num6 = (num3 - num4) * 0.5f; for (int j = 0; j < size; j++) { for (int k = 0; k < size; k++) { float num7 = (float)k - num; float num8 = (float)j - num2; float num9 = Mathf.Sqrt(num7 * num7 + num8 * num8); if (!(num9 < num4 - 1f) && !(num9 > num3 + 1f)) { float num10 = Mathf.Atan2(num8, num7) * 57.29578f; if (num10 < 0f) { num10 += 360f; } if (!(num10 >= 60f) || !(num10 <= 105f)) { float num11 = Mathf.Min(num9 - num4, num3 - num9); byte b = (byte)((num11 >= 1f) ? byte.MaxValue : ((num11 > 0f) ? ((byte)(255f * num11)) : 0)); array[j * size + k] = new Color32(val2.r, val2.g, val2.b, b); } } } } float num12 = (float)Math.PI / 3f; float num13 = num + num5 * Mathf.Cos(num12); float num14 = num2 + num5 * Mathf.Sin(num12); float num15 = Mathf.Sin(num12); float num16 = 0f - Mathf.Cos(num12); float num17 = Mathf.Cos(num12); float num18 = Mathf.Sin(num12); float num19 = num6 * 2.8f; float num20 = num6 * 1.5f; Vector2 a = default(Vector2); ((Vector2)(ref a))..ctor(num13 + num15 * num19, num14 + num16 * num19); Vector2 b2 = default(Vector2); ((Vector2)(ref b2))..ctor(num13 + num17 * num20, num14 + num18 * num20); Vector2 c = default(Vector2); ((Vector2)(ref c))..ctor(num13 - num17 * num20, num14 - num18 * num20); FillTriangle(array, size, a, b2, c, val2); val.SetPixels32(array); val.Apply(false); return Sprite.Create(val, new Rect(0f, 0f, (float)size, (float)size), new Vector2(0.5f, 0.5f), 100f); } private static void FillTriangle(Color32[] pixels, int size, Vector2 a, Vector2 b, Vector2 c, Color32 color) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_000d: 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) //IL_0032: Unknown result type (might be due to invalid IL or missing references) //IL_0038: Unknown result type (might be due to invalid IL or missing references) //IL_0055: Unknown result type (might be due to invalid IL or missing references) //IL_005b: Unknown result type (might be due to invalid IL or missing references) //IL_0061: Unknown result type (might be due to invalid IL or missing references) //IL_007f: Unknown result type (might be due to invalid IL or missing references) //IL_0085: Unknown result type (might be due to invalid IL or missing references) //IL_008b: Unknown result type (might be due to invalid IL or missing references) //IL_00b4: Unknown result type (might be due to invalid IL or missing references) //IL_00b9: Unknown result type (might be due to invalid IL or missing references) //IL_00ba: Unknown result type (might be due to invalid IL or missing references) //IL_00bb: Unknown result type (might be due to invalid IL or missing references) //IL_00cb: Unknown result type (might be due to invalid IL or missing references) //IL_00cd: Unknown result type (might be due to invalid IL or missing references) int num = Mathf.Max(0, Mathf.FloorToInt(Mathf.Min(a.x, Mathf.Min(b.x, c.x)))); int num2 = Mathf.Min(size - 1, Mathf.CeilToInt(Mathf.Max(a.x, Mathf.Max(b.x, c.x)))); int num3 = Mathf.Max(0, Mathf.FloorToInt(Mathf.Min(a.y, Mathf.Min(b.y, c.y)))); int num4 = Mathf.Min(size - 1, Mathf.CeilToInt(Mathf.Max(a.y, Mathf.Max(b.y, c.y)))); for (int i = num3; i <= num4; i++) { for (int j = num; j <= num2; j++) { if (PointInTriangle(new Vector2((float)j, (float)i), a, b, c)) { pixels[i * size + j] = color; } } } } private static bool PointInTriangle(Vector2 p, Vector2 a, Vector2 b, Vector2 c) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0002: Unknown result type (might be due to invalid IL or missing references) //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_0009: Unknown result type (might be due to invalid IL or missing references) //IL_0014: Unknown result type (might be due to invalid IL or missing references) //IL_0015: Unknown result type (might be due to invalid IL or missing references) //IL_0016: Unknown result type (might be due to invalid IL or missing references) //IL_001b: Unknown result type (might be due to invalid IL or missing references) //IL_001c: Unknown result type (might be due to invalid IL or missing references) //IL_001d: Unknown result type (might be due to invalid IL or missing references) //IL_0028: Unknown result type (might be due to invalid IL or missing references) //IL_0029: Unknown result type (might be due to invalid IL or missing references) //IL_002a: Unknown result type (might be due to invalid IL or missing references) //IL_002f: Unknown result type (might be due to invalid IL or missing references) //IL_0030: Unknown result type (might be due to invalid IL or missing references) //IL_0031: Unknown result type (might be due to invalid IL or missing references) float num = Cross(p - a, b - a); float num2 = Cross(p - b, c - b); float num3 = Cross(p - c, a - c); if (!(num >= 0f) || !(num2 >= 0f) || !(num3 >= 0f)) { if (num <= 0f && num2 <= 0f) { return num3 <= 0f; } return false; } return true; } private static float Cross(Vector2 v1, Vector2 v2) { //IL_0000: 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_000d: Unknown result type (might be due to invalid IL or missing references) //IL_0013: Unknown result type (might be due to invalid IL or missing references) return v1.x * v2.y - v1.y * v2.x; } internal static Sprite RoundedRectFrame(int radius, int frameWidth) { //IL_0048: Unknown result type (might be due to invalid IL or missing references) //IL_004f: Expected O, but got Unknown //IL_0146: Unknown result type (might be due to invalid IL or missing references) //IL_0155: Unknown result type (might be due to invalid IL or missing references) //IL_0161: Unknown result type (might be due to invalid IL or missing references) //IL_0080: Unknown result type (might be due to invalid IL or missing references) //IL_00f0: Unknown result type (might be due to invalid IL or missing references) //IL_00f5: Unknown result type (might be due to invalid IL or missing references) //IL_00ba: Unknown result type (might be due to invalid IL or missing references) (int, int) key = (radius, frameWidth); if (RoundedRectFrameCache.TryGetValue(key, out Sprite value) && (Object)(object)value != (Object)null) { return value; } int num = Mathf.Max(radius * 2 + 2, frameWidth * 2 + 3); int r = Mathf.Max(0, radius - frameWidth); int num2 = num - frameWidth * 2; Texture2D val = new Texture2D(num, num, (TextureFormat)5, false); ((Texture)val).filterMode = (FilterMode)1; ((Texture)val).wrapMode = (TextureWrapMode)1; Color32[] array = (Color32[])(object)new Color32[num * num]; for (int i = 0; i < num; i++) { for (int j = 0; j < num; j++) { byte a = SampleRoundedRectPixel(j, i, num, num, radius).a; int num3 = j - frameWidth; int num4 = i - frameWidth; byte b = (byte)((num3 >= 0 && num4 >= 0 && num3 < num2 && num4 < num2) ? SampleRoundedRectPixel(num3, num4, num2, num2, r).a : 0); array[i * num + j] = new Color32(byte.MaxValue, byte.MaxValue, byte.MaxValue, (byte)(a * (255 - b) / 255)); } } val.SetPixels32(array); val.Apply(false); Vector4 val2 = default(Vector4); ((Vector4)(ref val2))..ctor((float)radius, (float)radius, (float)radius, (float)radius); Sprite val3 = Sprite.Create(val, new Rect(0f, 0f, (float)num, (float)num), new Vector2(0.5f, 0.5f), 100f, 0u, (SpriteMeshType)0, val2); RoundedRectFrameCache[key] = val3; return val3; } private static Color32 SampleRoundedRectPixel(int x, int y, int w, int h, int r) { //IL_0059: 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) //IL_006f: Unknown result type (might be due to invalid IL or missing references) float num = Mathf.Clamp(x, r, w - r - 1); float num2 = Mathf.Clamp(y, r, h - r - 1); float num3 = Mathf.Sqrt(((float)x - num) * ((float)x - num) + ((float)y - num2) * ((float)y - num2)); if (num3 <= (float)r - 1f) { return new Color32(byte.MaxValue, byte.MaxValue, byte.MaxValue, byte.MaxValue); } if (num3 >= (float)r + 0.5f) { return new Color32((byte)0, (byte)0, (byte)0, (byte)0); } byte b = (byte)(255f * Mathf.Clamp01((float)r + 0.5f - num3)); return new Color32(byte.MaxValue, byte.MaxValue, byte.MaxValue, b); } } } namespace SkillsPreview.App.UI.SettingsPanel { internal class SettingsPanel { private static Log.Scoped Logger { get; } = Log.For("SettingsPanel"); public GameObject Root { get; private set; } internal bool IsAlive => (Object)(object)Root != (Object)null; internal bool IsVisible { get { if ((Object)(object)Root != (Object)null) { return Root.activeSelf; } return false; } } private SettingsPanel(GameObject root) { Root = root; } internal void Show() { if ((Object)(object)Root != (Object)null) { Root.SetActive(true); } } internal void Hide() { if ((Object)(object)Root != (Object)null) { Root.SetActive(false); } } internal static SettingsPanel Create(Transform skillsFrame) { Font builtinResource = Resources.GetBuiltinResource<Font>("Arial.ttf"); GameObject val = SettingsPanelLayout.BuildRoot(skillsFrame); SettingsPanelLayout.BuildBackground(val, skillsFrame); ILabels current = L.Current; Transform content = SettingsPanelLayout.AddScrollView(val.transform); List<Action> resets = new List<Action>(); List<Action> refreshes = new List<Action>(); SettingsPanelLayout.AddTitle(val.transform, skillsFrame, current.SectionSkillsPanel); SettingsPanelRows.Populate(content, builtinResource, resets, refreshes, skillsFrame, current); SettingsPanelLayout.AddResetAllButton(val.transform, current.ResetAll, resets, skillsFrame); SettingsPanelLayout.AddCloseButton(val.transform, val, skillsFrame); Logger.Debug("Settings panel created."); return new SettingsPanel(val); } } internal static class SettingsPanelLayout { private const float PanelWidth = 500f; private const float PanelHeight = 620f; private const int SectionFontSize = 12; private static readonly Color PanelBgColor = new Color(0.08f, 0.06f, 0.04f, 0.97f); private static readonly Color SectionColor = new Color(0.65f, 0.52f, 0.28f); internal static GameObject BuildRoot(Transform skillsFrame) { //IL_0018: Unknown result type (might be due to invalid IL or missing references) //IL_001d: Unknown result type (might be due to invalid IL or missing references) //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_0031: Unknown result type (might be due to invalid IL or missing references) //IL_003c: Unknown result type (might be due to invalid IL or missing references) //IL_004d: Unknown result type (might be due to invalid IL or missing references) //IL_0062: Unknown result type (might be due to invalid IL or missing references) //IL_0077: 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) //IL_0096: Unknown result type (might be due to invalid IL or missing references) //IL_00a1: Expected O, but got Unknown GameObject val = new GameObject("godzki_SettingsPanel", new Type[1] { typeof(RectTransform) }); val.SetActive(false); val.transform.SetParent(skillsFrame, false); val.transform.SetAsLastSibling(); RectTransform component = val.GetComponent<RectTransform>(); component.anchorMin = new Vector2(0.5f, 0.5f); component.anchorMax = new Vector2(0.5f, 0.5f); component.pivot = new Vector2(0.5f, 0.5f); component.sizeDelta = new Vector2(500f, 620f); component.anchoredPosition = Vector2.zero; return val; } internal static void BuildBackground(GameObject root, Transform skillsFrame) { //IL_009e: Unknown result type (might be due to invalid IL or missing references) //IL_00a3: Unknown result type (might be due to invalid IL or missing references) //IL_00b5: 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_0043: Unknown result type (might be due to invalid IL or missing references) //IL_004e: Unknown result type (might be due to invalid IL or missing references) //IL_0059: Unknown result type (might be due to invalid IL or missing references) //IL_005e: 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_0065: Unknown result type (might be due to invalid IL or missing references) Transform obj = skillsFrame.Find("bkg"); Image val = ((obj != null) ? ((Component)obj).GetComponent<Image>() : null); if ((Object)(object)val != (Object)null) { GameObject obj2 = Object.Instantiate<GameObject>(((Component)val).gameObject, root.transform); ((Object)obj2).name = "bkg"; RectTransform component = obj2.GetComponent<RectTransform>(); component.anchorMin = Vector2.zero; component.anchorMax = Vector2.one; Vector2 offsetMin = (component.offsetMax = Vector2.zero); component.offsetMin = offsetMin; } else { GameObject val2 = new GameObject("bkg", new Type[3] { typeof(RectTransform), typeof(CanvasRenderer), typeof(Image) }); val2.transform.SetParent(root.transform, false); SettingsPanelWidgets.Stretch(val2.GetComponent<RectTransform>()); ((Graphic)val2.GetComponent<Image>()).color = PanelBgColor; } } internal static void AddTitle(Transform parent, Transform skillsFrame, string label) { //IL_0046: Unknown result type (might be due to invalid IL or missing references) //IL_005b: Unknown result type (might be due to invalid IL or missing references) //IL_0070: Unknown result type (might be due to invalid IL or missing references) //IL_0084: Unknown result type (might be due to invalid IL or missing references) Transform obj = skillsFrame.Find("topic"); if ((Object)(object)obj == (Object)null) { throw new InvalidOperationException("topic not found in SkillsFrame"); } GameObject obj2 = Object.Instantiate<GameObject>(((Component)obj).gameObject, parent); ((Object)obj2).name = "Topic"; RectTransform component = obj2.GetComponent<RectTransform>(); component.anchorMin = new Vector2(0.5f, 1f); component.anchorMax = new Vector2(0.5f, 1f); component.pivot = new Vector2(0.5f, 1f); component.anchoredPosition = new Vector2(0f, -10f); obj2.GetComponentInChildren<TMP_Text>().text = label; } internal static Transform AddScrollView(Transform parent) { //IL_0025: Unknown result type (might be due to invalid IL or missing references) //IL_002b: Expected O, but got Unknown //IL_003f: Unknown result type (might be due to invalid IL or missing references) //IL_004a: 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_0073: Unknown result type (might be due to invalid IL or missing references) //IL_00bc: Unknown result type (might be due to invalid IL or missing references) //IL_00c2: Expected O, but got Unknown //IL_00fb: Unknown result type (might be due to invalid IL or missing references) //IL_0143: Unknown result type (might be due to invalid IL or missing references) //IL_0148: 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_016c: Unknown result type (might be due to invalid IL or missing references) //IL_0181: Unknown result type (might be due to invalid IL or missing references) //IL_0196: Unknown result type (might be due to invalid IL or missing references) //IL_01a1: Unknown result type (might be due to invalid IL or missing references) //IL_01ac: Unknown result type (might be due to invalid IL or missing references) //IL_01b6: Unknown result type (might be due to invalid IL or missing references) //IL_01d0: Unknown result type (might be due to invalid IL or missing references) //IL_01da: Expected O, but got Unknown //IL_01e7: Unknown result type (might be due to invalid IL or missing references) GameObject val = new GameObject("ScrollView", new Type[2] { typeof(RectTransform), typeof(ScrollRect) }); val.transform.SetParent(parent, false); RectTransform component = val.GetComponent<RectTransform>(); component.anchorMin = Vector2.zero; component.anchorMax = Vector2.one; component.offsetMin = new Vector2(8f, 90f); component.offsetMax = new Vector2(-8f, -62f); GameObject val2 = new GameObject("Viewport", new Type[4] { typeof(RectTransform), typeof(CanvasRenderer), typeof(Image), typeof(Mask) }); val2.transform.SetParent(val.transform, false); RectTransform component2 = val2.GetComponent<RectTransform>(); SettingsPanelWidgets.Stretch(component2); ((Graphic)val2.GetComponent<Image>()).color = new Color(0f, 0f, 0f, 0.01f); val2.GetComponent<Mask>().showMaskGraphic = false; GameObject val3 = new GameObject("Content", new Type[3] { typeof(RectTransform), typeof(VerticalLayoutGroup), typeof(ContentSizeFitter) }); val3.transform.SetParent(val2.transform, false); RectTransform component3 = val3.GetComponent<RectTransform>(); component3.anchorMin = new Vector2(0f, 1f); component3.anchorMax = new Vector2(1f, 1f); component3.pivot = new Vector2(0.5f, 1f); component3.anchoredPosition = Vector2.zero; component3.sizeDelta = Vector2.zero; VerticalLayoutGroup component4 = val3.GetComponent<VerticalLayoutGroup>(); ((HorizontalOrVerticalLayoutGroup)component4).spacing = 2f; ((LayoutGroup)component4).padding = new RectOffset(24, 24, 24, 24); ((HorizontalOrVerticalLayoutGroup)component4).childForceExpandWidth = true; ((HorizontalOrVerticalLayoutGroup)component4).childForceExpandHeight = false; val3.GetComponent<ContentSizeFitter>().verticalFit = (FitMode)2; ScrollRect component5 = val.GetComponent<ScrollRect>(); component5.content = component3; component5.viewport = component2; component5.horizontal = false; component5.vertical = true; component5.scrollSensitivity = 30f; component5.movementType = (MovementType)2; component5.inertia = false; return val3.transform; } internal static void AddSection(Transform parent, Font font, string label) { //IL_0045: Unknown result type (might be due to invalid IL or missing references) //IL_004a: Unknown result type (might be due to invalid IL or missing references) //IL_0057: Unknown result type (might be due to invalid IL or missing references) //IL_0093: Unknown result type (might be due to invalid IL or missing references) GameObject val = new GameObject("Section_" + label, new Type[4] { typeof(RectTransform), typeof(CanvasRenderer), typeof(Text), typeof(LayoutElement) }); val.transform.SetParent(parent, false); LayoutElement component = val.GetComponent<LayoutElement>(); float preferredHeight = (component.minHeight = 22f); component.preferredHeight = preferredHeight; Text component2 = val.GetComponent<Text>(); component2.font = font; component2.fontSize = 12; component2.fontStyle = (FontStyle)1; component2.alignment = (TextAnchor)6; ((Graphic)component2).color = SectionColor; component2.text = "— " + label; ((Graphic)component2).raycastTarget = false; } internal static void AddResetAllButton(Transform parent, string label, List<Action> resets, Transform skillsFrame) { //IL_0053: Unknown result type (might be due to invalid IL or missing references) //IL_0068: Unknown result type (might be due to invalid IL or missing references) //IL_007d: Unknown result type (might be due to invalid IL or missing references) //IL_0092: Unknown result type (might be due to invalid IL or missing references) //IL_00a6: Unknown result type (might be due to invalid IL or missing references) //IL_00c2: Unknown result type (might be due to invalid IL or missing references) //IL_00cc: Expected O, but got Unknown //IL_00d8: Unknown result type (might be due to invalid IL or missing references) //IL_00e2: Expected O, but got Unknown List<Action> resets2 = resets; Transform obj = skillsFrame.Find("Closebutton"); if ((Object)(object)obj == (Object)null) { throw new InvalidOperationException("Closebutton not found in SkillsFrame"); } GameObject obj2 = Object.Instantiate<GameObject>(((Component)obj).gameObject, parent); ((Object)obj2).name = "ResetBtn"; RectTransform component = obj2.GetComponent<RectTransform>(); component.anchorMin = new Vector2(0f, 0f); component.anchorMax = new Vector2(0f, 0f); component.pivot = new Vector2(0f, 0f); component.sizeDelta = new Vector2(130f, 40f); component.anchoredPosition = new Vector2(15f, 30f); obj2.GetComponentInChildren<TMP_Text>().text = label; Button component2 = obj2.GetComponent<Button>(); component2.onClick = new ButtonClickedEvent(); ((UnityEvent)component2.onClick).AddListener((UnityAction)delegate { foreach (Action item in resets2) { item(); } }); } internal static void AddCloseButton(Transform parent, GameObject panelRoot, Transform skillsFrame) { //IL_0053: Unknown result type (might be due to invalid IL or missing references) //IL_0068: Unknown result type (might be due to invalid IL or missing references) //IL_007d: Unknown result type (might be due to invalid IL or missing references) //IL_0091: Unknown result type (might be due to invalid IL or missing references) //IL_00a1: Unknown result type (might be due to invalid IL or missing references) //IL_00ab: Expected O, but got Unknown //IL_00b7: Unknown result type (might be due to invalid IL or missing references) //IL_00c1: Expected O, but got Unknown GameObject panelRoot2 = panelRoot; Transform obj = skillsFrame.Find("Closebutton"); if ((Object)(object)obj == (Object)null) { throw new InvalidOperationException("Closebutton not found in SkillsFrame"); } GameObject obj2 = Object.Instantiate<GameObject>(((Component)obj).gameObject, parent); ((Object)obj2).name = "CloseBtn"; RectTransform component = obj2.GetComponent<RectTransform>(); component.anchorMin = new Vector2(0.5f, 0f); component.anchorMax = new Vector2(0.5f, 0f); component.pivot = new Vector2(0.5f, 0f); component.anchoredPosition = new Vector2(0f, 25f); Button component2 = obj2.GetComponent<Button>(); component2.onClick = new ButtonClickedEvent(); ((UnityEvent)component2.onClick).AddListener((UnityAction)delegate { panelRoot2.SetActive(false); }); } } internal static class ColorPickerPopup { private const float SwatchSize = 22f; private const float SwatchSpacing = 0f; private const int GridColumns = 12; private const int GridRows = 8; private const float AlphaBarWidth = 18f; private const float PopupPadding = 8f; private const float GridToBarGap = 14f; private static readonly Color PopupBgColor = new Color(0.08f, 0.06f, 0.04f, 0.97f); private static GameObject? CurrentlyOpenOverlay; private static Sprite? CachedGradient; private static Sprite AlphaGradientSprite => CachedGradient ?? (CachedGradient = BuildAlphaGradientSprite()); internal static (GameObject overlay, Action<Color> syncAlpha) Build(Transform panelRoot, Func<Color> getColor, Action<Color> applyColor) { //IL_007a: Unknown result type (might be due to invalid IL or missing references) //IL_00d2: Unknown result type (might be due to invalid IL or missing references) //IL_00dc: Expected O, but got Unknown Func<Color> getColor2 = getColor; Action<Color> applyColor2 = applyColor; GameObject overlayGo = BuildOverlay(panelRoot); GameObject val = BuildPopupPanel(overlayGo.transform); float gridWidth = 264f; float gridHeight = 176f; GameObject obj = BuildGrid(val.transform, gridWidth, gridHeight); GameObject sliderGo = BuildAlphaSlider(val.transform, gridWidth, gridHeight); Slider slider = sliderGo.GetComponent<Slider>(); slider.value = getColor2().a; AddSwatches(obj.transform, slider, applyColor2); ((UnityEvent<float>)(object)slider.onValueChanged).AddListener((UnityAction<float>)delegate(float alpha) { //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_000b: Unknown result type (might be due to invalid IL or missing references) //IL_0012: Unknown result type (might be due to invalid IL or missing references) //IL_0018: Unknown result type (might be due to invalid IL or missing references) //IL_001e: Unknown result type (might be due to invalid IL or missing references) //IL_0025: Unknown result type (might be due to invalid IL or missing references) //IL_0035: Unknown result type (might be due to invalid IL or missing references) Color val2 = getColor2(); applyColor2(new Color(val2.r, val2.g, val2.b, alpha)); UpdateSliderTint(sliderGo, val2); }); ((UnityEvent)overlayGo.GetComponent<Button>().onClick).AddListener((UnityAction)delegate { CloseOverlay(overlayGo); }); return (overlayGo, SyncAlpha); void SyncAlpha(Color c) { //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_0017: Unknown result type (might be due to invalid IL or missing references) slider.value = c.a; UpdateSliderTint(sliderGo, c); } } internal static void OpenOverlay(GameObject overlay, Color currentColor, Action<Color> syncAlpha) { //IL_0033: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)CurrentlyOpenOverlay != (Object)null && (Object)(object)CurrentlyOpenOverlay != (Object)(object)overlay) { CurrentlyOpenOverlay.SetActive(false); } CurrentlyOpenOverlay = overlay; overlay.SetActive(true); syncAlpha(currentColor); } private static void CloseOverlay(GameObject overlay) { overlay.SetActive(false); if ((Object)(object)CurrentlyOpenOverlay == (Object)(object)overlay) { CurrentlyOpenOverlay = null; } } private static GameObject BuildOverlay(Transform panelRoot) { //IL_003f: Unknown result type (might be due to invalid IL or missing references) //IL_0044: Unknown result type (might be due to invalid IL or missing references) //IL_0051: 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_005f: 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_0075: Unknown result type (might be due to invalid IL or missing references) //IL_007a: Unknown result type (might be due to invalid IL or missing references) //IL_007b: 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_0087: Unknown result type (might be due to invalid IL or missing references) //IL_00a1: Unknown result type (might be due to invalid IL or missing references) //IL_00ac: Expected O, but got Unknown GameObject val = new GameObject("ColorPickerOverlay", new Type[4] { typeof(RectTransform), typeof(CanvasRenderer), typeof(Image), typeof(Button) }); val.transform.SetParent(panelRoot, false); val.SetActive(false); RectTransform component = val.GetComponent<RectTransform>(); component.anchorMin = Vector2.zero; component.anchorMax = Vector2.one; Vector2 offsetMin = (component.offsetMax = Vector2.zero); component.offsetMin = offsetMin; ((Graphic)val.GetComponent<Image>()).color = new Color(0f, 0f, 0f, 0f); return val; } private static GameObject BuildPopupPanel(Transform overlayTransform) { //IL_0073: Unknown result type (might be due to invalid IL or missing references) //IL_0078: Unknown result type (might be due to invalid IL or missing references) //IL_0085: Unknown result type (might be due to invalid IL or missing references) //IL_0096: Unknown result type (might be due to invalid IL or missing references) //IL_00ab: Unknown result type (might be due to invalid IL or missing references) //IL_00c0: Unknown result type (might be due to invalid IL or missing references) //IL_00cd: Unknown result type (might be due to invalid IL or missing references) //IL_00d7: Unknown result type (might be due to invalid IL or missing references) //IL_00e1: Unknown result type (might be due to invalid IL or missing references) //IL_00eb: Unknown result type (might be due to invalid IL or missing references) //IL_00f5: Unknown result type (might be due to invalid IL or missing references) //IL_0103: Expected O, but got Unknown float num = 264f; float num2 = 176f; float num3 = 8f + num + 14f + 18f + 8f; float num4 = 8f + num2 + 8f; GameObject val = new GameObject("ColorPickerPopup", new Type[4] { typeof(RectTransform), typeof(CanvasRenderer), typeof(Image), typeof(Button) }); val.transform.SetParent(overlayTransform, false); RectTransform component = val.GetComponent<RectTransform>(); component.anchorMin = new Vector2(0.5f, 0.5f); component.anchorMax = new Vector2(0.5f, 0.5f); component.pivot = new Vector2(0.5f, 0.5f); component.sizeDelta = new Vector2(num3, num4); component.anchoredPosition = Vector2.zero; Image component2 = val.GetComponent<Image>(); ((Graphic)component2).color = PopupBgColor; ((Selectable)val.GetComponent<Button>()).targetGraphic = (Graphic)(object)component2; return val; } private static GameObject BuildGrid(Transform popupTransform, float gridWidth, float gridHeight) { //IL_0025: Unknown result type (might be due to invalid IL or missing references) //IL_002a: 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_0048: Unknown result type (might be due to invalid IL or missing references) //IL_005d: Unknown result type (might be due to invalid IL or missing references) //IL_0072: Unknown result type (might be due to invalid IL or missing references) //IL_0087: Unknown result type (might be due to invalid IL or missing references) //IL_0093: 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) //IL_00ae: Unknown result type (might be due to invalid IL or missing references) //IL_00c3: Unknown result type (might be due to invalid IL or missing references) //IL_00f1: Expected O, but got Unknown GameObject val = new GameObject("ColorGrid", new Type[2] { typeof(RectTransform), typeof(GridLayoutGroup) }); val.transform.SetParent(popupTransform, false); RectTransform component = val.GetComponent<RectTransform>(); component.anchorMin = new Vector2(0f, 0f); component.anchorMax = new Vector2(0f, 0f); component.pivot = new Vector2(0f, 0f); component.anchoredPosition = new Vector2(8f, 8f); component.sizeDelta = new Vector2(gridWidth, gridHeight); GridLayoutGroup component2 = val.GetComponent<GridLayoutGroup>(); component2.cellSize = new Vector2(22f, 22f); component2.spacing = new Vector2(0f, 0f); component2.startCorner = (Corner)0; component2.startAxis = (Axis)0; component2.constraint = (Constraint)1; component2.constraintCount = 12; ((LayoutGroup)component2).childAlignment = (TextAnchor)0; return val; } private static void AddSwatches(Transform gridTransform, Slider alphaSlider, Action<Color> applyColor) { //IL_002f: Unknown result type (might be due to invalid IL or missing references) //IL_0034: Unknown result type (might be due to invalid IL or missing references) //IL_0083: Unknown result type (might be due to invalid IL or missing references) //IL_0088: Unknown result type (might be due to invalid IL or missing references) //IL_0095: Unknown result type (might be due to invalid IL or missing references) //IL_009e: Unknown result type (might be due to invalid IL or missing references) //IL_00c0: Unknown result type (might be due to invalid IL or missing references) //IL_00ca: Expected O, but got Unknown Slider alphaSlider2 = alphaSlider; Action<Color> applyColor2 = applyColor; for (int i = 0; i < ColorPicker.Palette.Length; i++) { Color swatchColor = ColorPicker.Palette[i]; GameObject val = new GameObject($"Swatch_{i}", new Type[4] { typeof(RectTransform), typeof(CanvasRenderer), typeof(Image), typeof(Button) }); val.transform.SetParent(gridTransform, false); Image component = val.GetComponent<Image>(); ((Graphic)component).color = swatchColor; Button component2 = val.GetComponent<Button>(); ((Selectable)component2).targetGraphic = (Graphic)(object)component; ((UnityEvent)component2.onClick).AddListener((UnityAction)delegate { //IL_0043: Unknown result type (might be due to invalid IL or missing references) Color obj = default(Color); ((Color)(ref obj))..ctor(swatchColor.r, swatchColor.g, swatchColor.b, alphaSlider2.value); applyColor2(obj); }); } } private static GameObject BuildAlphaSlider(Transform popupTransform, float gridWidth, float gridHeight) { //IL_0025: Unknown result type (might be due to invalid IL or missing references) //IL_002b: Expected O, but got Unknown //IL_0049: Unknown result type (might be due to invalid IL or missing references) //IL_005e: Unknown result type (might be due to invalid IL or missing references) //IL_0073: Unknown result type (might be due to invalid IL or missing references) //IL_0090: 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_00dc: Unknown result type (might be due to invalid IL or missing references) //IL_00e1: Unknown result type (might be due to invalid IL or missing references) //IL_00f3: Unknown result type (might be due to invalid IL or missing references) //IL_011c: Unknown result type (might be due to invalid IL or missing references) //IL_013e: Unknown result type (might be due to invalid IL or missing references) //IL_0144: Expected O, but got Unknown //IL_015d: Unknown result type (might be due to invalid IL or missing references) //IL_0168: Unknown result type (might be due to invalid IL or missing references) //IL_0173: Unknown result type (might be due to invalid IL or missing references) //IL_0178: Unknown result type (might be due to invalid IL or missing references) //IL_0179: Unknown result type (might be due to invalid IL or missing references) //IL_0180: Unknown result type (might be due to invalid IL or missing references) //IL_01b9: Unknown result type (might be due to invalid IL or missing references) //IL_01bf: Expected O, but got Unknown //IL_01d8: 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_01f7: Unknown result type (might be due to invalid IL or missing references) //IL_021b: Unknown result type (might be due to invalid IL or missing references) //IL_023d: Unknown result type (might be due to invalid IL or missing references) //IL_0243: Expected O, but got Unknown //IL_025c: Unknown result type (might be due to invalid IL or missing references) //IL_0267: Unknown result type (might be due to invalid IL or missing references) //IL_027c: 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_02cc: Unknown result type (might be due to invalid IL or missing references) //IL_02d3: Expected O, but got Unknown //IL_02f7: Unknown result type (might be due to invalid IL or missing references) //IL_030c: Unknown result type (might be due to invalid IL or missing references) GameObject val = new GameObject("AlphaSlider", new Type[2] { typeof(RectTransform), typeof(Slider) }); val.transform.SetParent(popupTransform, false); RectTransform component = val.GetComponent<RectTransform>(); component.anchorMin = new Vector2(0f, 0f); component.anchorMax = new Vector2(0f, 0f); component.pivot = new Vector2(0f, 0f); component.anchoredPosition = new Vector2(8f + gridWidth + 14f, 8f); component.sizeDelta = new Vector2(18f, gridHeight); GameObject val2 = new GameObject("Background", new Type[3] { typeof(RectTransform), typeof(CanvasRenderer), typeof(Image) }); val2.transform.SetParent(val.transform, false); SettingsPanelWidgets.Stretch(val2.GetComponent<RectTransform>()); Image component2 = val2.GetComponent<Image>(); component2.sprite = AlphaGradientSprite; component2.type = (Type)0; component2.preserveAspect = false; ((Graphic)component2).color = Color.white; GameObject val3 = new GameObject("Fill Area", new Type[1] { typeof(RectTransform) }); val3.transform.SetParent(val.transform, false); RectTransform component3 = val3.GetComponent<RectTransform>(); component3.anchorMin = Vector2.zero; component3.anchorMax = Vector2.one; Vector2 offsetMin = (component3.offsetMax = Vector2.zero); component3.offsetMin = offsetMin; GameObject val4 = new GameObject("Fill", new Type[3] { typeof(RectTransform), typeof(CanvasRenderer), typeof(Image) }); val4.transform.SetParent(val3.transform, false); RectTransform component4 = val4.GetComponent<RectTransform>(); component4.anchorMin = Vector2.zero; component4.anchorMax = new Vector2(1f, 0f); component4.sizeDelta = Vector2.zero; ((Graphic)val4.GetComponent<Image>()).color = new Color(0f, 0f, 0f, 0f); GameObject val5 = new GameObject("Handle Slide Area", new Type[1] { typeof(RectTransform) }); val5.transform.SetParent(val.transform, false); RectTransform component5 = val5.GetComponent<RectTransform>(); component5.anchorMin = Vector2.zero; component5.anchorMax = Vector2.one; component5.offsetMin = new Vector2(0f, 8f); component5.offsetMax = new Vector2(0f, -8f); GameObject val6 = new GameObject("Handle", new Type[3] { typeof(RectTransform), typeof(CanvasRenderer), typeof(Image) }); val6.transform.SetParent(val5.transform, false); val6.GetComponent<RectTransform>().sizeDelta = new Vector2(24f, 7f); Image component6 = val6.GetComponent<Image>(); ((Graphic)component6).color = Color.white; SettingsPanelWidgets.ApplyRoundedSprite(component6); Slider component7 = val.GetComponent<Slider>(); component7.direction = (Direction)2; component7.minValue = 0f; component7.maxValue = 1f; component7.value = 1f; component7.wholeNumbers = false; component7.fillRect = val4.GetComponent<RectTransform>(); component7.handleRect = val6.GetComponent<RectTransform>(); ((Selectable)component7).targetGraphic = (Graphic)(object)component6; return val; } private static void UpdateSliderTint(GameObject sliderGo, Color color) { //IL_0027: Unknown result type (might be due to invalid IL or missing references) //IL_002d: Unknown result type (might be due to invalid IL or missing references) //IL_0033: Unknown result type (might be due to invalid IL or missing references) //IL_003e: Unknown result type (might be due to invalid IL or missing references) Transform obj = sliderGo.transform.Find("Background"); Image val = ((obj != null) ? ((Component)obj).GetComponent<Image>() : null); if ((Object)(object)val != (Object)null) { ((Graphic)val).color = new Color(color.r, color.g, color.b, 1f); } } private static Sprite BuildAlphaGradientSprite() { //IL_0005: Unknown result type (might be due to invalid IL or missing references) //IL_000a: Unknown result type (might be due to invalid IL or missing references) //IL_0011: Unknown result type (might be due to invalid IL or missing references) //IL_0019: Expected O, but got Unknown //IL_0037: Unknown result type (might be due to invalid IL or missing references) //IL_0065: Unknown result type (might be due to invalid IL or missing references) //IL_0074: Unknown result type (might be due to invalid IL or missing references) Texture2D val = new Texture2D(1, 64, (TextureFormat)4, false) { filterMode = (FilterMode)1, wrapMode = (TextureWrapMode)1 }; for (int i = 0; i < 64; i++) { val.SetPixel(0, i, new Color(1f, 1f, 1f, (float)i / 63f)); } val.Apply(); return Sprite.Create(val, new Rect(0f, 0f, 1f, 64f), new Vector2(0.5f, 0.5f)); } } internal sealed class RowContext { public Transform Content { get; init; } public Font Font { get; init; } public List<Action> Resets { get; init; } public List<Action> Refreshes { get; init; } public Transform SkillsFrame { get; init; } public ILabels Labels { get; init; } } internal sealed class ConfigBinding<T> { public Func<T> Get { get; } public Action<T> Set { get; } public Func<T> Default { get; } public ConfigBinding(Func<T> get, Action<T> set, Func<T> getDefault) { Get = get; Set = set; Default = getDefault; } } internal static class ConfigBinding { public static ConfigBinding<T> Of<T>(ConfigEntry<T> entry) { ConfigEntry<T> entry2 = entry; return new ConfigBinding<T>(() => entry2.Value, delegate(T v) { entry2.Value = v; }, () => (T)((ConfigEntryBase)entry2).DefaultValue); } } internal static class SettingsPanelRows { [Serializable] [CompilerGenerated] private sealed class <>c { public static readonly <>c <>9 = new <>c(); public static OnValidateInput <>9__15_0; internal char <AddFloatRow>b__15_0(string _, int _, char c) { if ("0123456789.-".IndexOf(c) < 0) { return '\0'; } return c; } internal string <.cctor>b__19_0(ILabels t) { return t.ThemeValheim; } internal string <.cctor>b__19_1(ILabels t) { return t.ThemeDark; } internal string <.cctor>b__19_2(ILabels t) { return t.ThemeMinimal; } internal string <.cctor>b__19_3(ILabels t) { return t.ThemeHighContrast; } } private static readonly (ThemePresets.Theme Theme, Func<ILabels, string> Label)[] ThemeButtons = new(ThemePresets.Theme, Func<ILabels, string>)[4] { (ThemePresets.Valheim, (ILabels t) => t.ThemeValheim), (ThemePresets.Dark, (ILabels t) => t.ThemeDark), (ThemePresets.Minimal, (ILabels t) => t.ThemeMinimal), (ThemePresets.HighContrast, (ILabels t) => t.ThemeHighContrast) }; private static Log.Scoped Logger { get; } = Log.For("SettingsPanelRows"); internal static void Populate(Transform content, Font font, List<Action> resets, List<Action> refreshes, Transform skillsFrame, ILabels labels) { RowContext ctx = new RowContext { Content = content, Font = font, Resets = resets, Refreshes = refreshes, SkillsFrame = skillsFrame, Labels = labels }; AddThemePresetsRow(ctx); PopulateGeneral(ctx); PopulateSkillsPanel(ctx); PopulateHudPosition(ctx); PopulateHudSize(ctx); PopulateHudColors(ctx); PopulateToast(ctx); } private static void PopulateGeneral(RowContext ctx) { Section(ctx, ctx.Labels.SectionGeneral); AddToggleRow(ctx, ctx.Labels.DebugMode, ConfigBinding.Of<bool>(Config.DebugMode)); AddToggleRow(ctx, ctx.Labels.HudWidgetsVisible, ConfigBinding.Of<bool>(Config.HudWidgetsVisible)); } private static void PopulateSkillsPanel(RowContext ctx) { Section(ctx, ctx.Labels.SectionSkillsPanel); AddColorRow(ctx, ctx.Labels.StarFavorite, ConfigBinding.Of<Color>(Config.FavoriteStarColor)); AddColorRow(ctx, ctx.Labels.StarUnfavorite, ConfigBinding.Of<Color>(Config.UnfavoriteStarColor)); } private static void PopulateHudPosition(RowContext ctx) { Section(ctx, ctx.Labels.SectionHudPosition); AddFloatRow(ctx, ctx.Labels.PositionX, ConfigBinding.Of<float>(Config.HudPositionX)); AddFloatRow(ctx, ctx.Labels.PositionY, ConfigBinding.Of<float>(Config.HudPositionY)); AddSliderFloatRow(ctx, ctx.Labels.HudScale, ConfigBinding.Of<float>(Config.HudScale), 50f, 150f, 0); } private static void PopulateHudSize(RowContext ctx) { Section(ctx, ctx.Labels.SectionHudSize); AddSliderFloatRow(ctx, ctx.Labels.Width, ConfigBinding.Of<float>(Config.WidgetWidth), 30f, 200f, 1); AddSliderFloatRow(ctx, ctx.Labels.Height, ConfigBinding.Of<float>(Config.WidgetHeight), 30f, 200f, 1); AddSliderFloatRow(ctx, ctx.Labels.IconSize, ConfigBinding.Of<float>(Config.WidgetIconSize), 10f, 100f, 1); AddSliderIntRow(ctx, ctx.Labels.FontLevel, ConfigBinding.Of<int>(Config.WidgetFontSizeLevel), 6, 30); AddSliderIntRow(ctx, ctx.Labels.FontProgress, ConfigBinding.Of<int>(Config.WidgetFontSizeProgress), 6, 24); AddSliderFloatRow(ctx, ctx.Labels.WidgetSpacing, ConfigBinding.Of<float>(Config.WidgetSpacing), 0f, 30f, 1); AddSliderFloatRow(ctx, ctx.Labels.BorderThickness, ConfigBinding.Of<float>(Config.WidgetBorderSize), 0f, 10f, 1); AddSliderIntRow(ctx, ctx.Labels.CornerRadius, ConfigBinding.Of<int>(Config.WidgetCornerRadius), 0, 20); AddSliderFloatRow(ctx, ctx.Labels.LevelUpDuration, ConfigBinding.Of<float>(Config.WidgetLevelUpDuration), 0f, 5f, 2); AddToggleRow(ctx, ctx.Labels.ProgressBarVisible, ConfigBinding.Of<bool>(Config.WidgetProgressBarVisible)); AddSliderFloatRow(ctx, ctx.Labels.ProgressBarHeight, ConfigBinding.Of<float>(Config.WidgetProgressBarHeight), 0f, 12f, 1); } private static void PopulateHudColors(RowContext ctx) { Section(ctx, ctx.Labels.SectionHudColors); AddColorRow(ctx, ctx.Labels.ColorBorder, ConfigBinding.Of<Color>(Config.WidgetBorderColor)); AddColorRow(ctx, ctx.Labels.ColorBackground, ConfigBinding.Of<Color>(Config.WidgetBgColor)); AddColorRow(ctx, ctx.Labels.ColorLevelText, ConfigBinding.Of<Color>(Config.WidgetLevelColor)); AddColorRow(ctx, ctx.Labels.ColorProgressText, ConfigBinding.Of<Color>(Config.WidgetProgressColor)); AddColorRow(ctx, ctx.Labels.ColorMaxText, ConfigBinding.Of<Color>(Config.WidgetProgressMaxColor)); AddColorRow(ctx, ctx.Labels.ColorLevelUpFlash, ConfigBinding.Of<Color>(Config.WidgetLevelUpColor)); AddColorRow(ctx, ctx.Labels.ColorProgressBarBg, ConfigBinding.Of<Color>(Config.WidgetProgressBarBgColor)); } private static void PopulateToast(RowContext ctx) { Section(ctx, ctx.Labels.SectionToast); AddToggleRow(ctx, ctx.Labels.ToastEnabled, ConfigBinding.Of<bool>(Config.ToastEnabled)); AddSliderFloatRow(ctx, ctx.Labels.ToastPositionTop, ConfigBinding.Of<float>(Config.ToastPositionTopPercent), 0f, 50f, 0); AddSliderFloatRow(ctx, ctx.Labels.ToastDuration, ConfigBinding.Of<float>(Config.ToastDuration), 1f, 10f, 1); AddSliderIntRow(ctx, ctx.Labels.ToastFontSize, ConfigBinding.Of<int>(Config.ToastFontSize), 14, 50); AddColorRow(ctx, ctx.Labels.ToastColor, ConfigBinding.Of<Color>(Config.ToastColor)); } private static void Section(RowContext ctx, string label) { SettingsPanelLayout.AddSection(ctx.Content, ctx.Font, label); } private static void AddThemePresetsRow(RowContext ctx) { Section(ctx, ctx.Labels.SectionThemes); GameObject val = SettingsPanelWidgets.MakeRow(ctx.Content, "Themes"); (ThemePresets.Theme, Func<ILabels, string>)[] themeButtons = ThemeButtons; for (int i = 0; i < themeButtons.Length; i++) { var (theme, func) = themeButtons[i]; AddThemeButton(ctx, val.transform, func(ctx.Labels), theme); } } private static void AddThemeButton(RowContext ctx, Transform parent, string label, ThemePresets.Theme theme) { //IL_0070: 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_0082: Unknown result type (might be due to invalid IL or missing references) //IL_00a8: Unknown result type (might be due to invalid IL or missing references) //IL_00b0: Unknown result type (might be due to invalid IL or missing references) //IL_00c0: Unknown result type (might be due to invalid IL or missing references) //IL_00f3: Unknown result type (might be due to invalid IL or missing references) //IL_00fd: Expected O, but got Unknown ThemePresets.Theme theme2 = theme; RowContext ctx2 = ctx; GameObject val = new GameObject("Theme_" + theme2.Key, new Type[5] { typeof(RectTransform), typeof(CanvasRenderer), typeof(Image), typeof(Button), typeof(LayoutElement) }); val.transform.SetParent(parent, false); LayoutElement component = val.GetComponent<LayoutElement>(); component.flexibleWidth = 1f; component.preferredWidth = 90f; component.minWidth = 60f; Image component2 = val.GetComponent<Image>(); ((Graphic)component2).color = SettingsPanelWidgets.InputBgColor; SettingsPanelWidgets.ApplyRoundedSprite(component2); SettingsPanelWidgets.AddChildText(val.transform, ctx2.Font, label, 12, (FontStyle)1); Button component3 = val.GetComponent<Button>(); ((Selectable)component3).targetGraphic = (Graphic)(object)component2; ((UnityEvent)component3.onClick).AddListener((UnityAction)delegate { ThemePresets.Apply(theme2); Plugin.SaveConfig(); foreach (Action refresh in ctx2.Refreshes) { refresh(); } Logger.Debug("Applied theme '" + theme2.Key + "'."); }); } private static void AddToggleRow(RowContext ctx, string label, ConfigBinding<bool> binding) { //IL_0089: Unknown result type (might be due to invalid IL or missing references) //IL_008f: Expected O, but got Unknown //IL_00dc: Unknown result type (might be due to invalid IL or missing references) //IL_015f: Unknown result type (might be due to invalid IL or missing references) //IL_0169: Expected O, but got Unknown ConfigBinding<bool> binding2 = binding; string label2 = label; GameObject val = SettingsPanelWidgets.MakeRow(ctx.Content, label2); SettingsPanelWidgets.MakeLabel(val.transform, ctx.Font, label2); GameObject val2 = new GameObject("Toggle", new Type[5] { typeof(RectTransform), typeof(CanvasRenderer), typeof(Image), typeof(Button), typeof(LayoutElement) }); val2.transform.SetParent(val.transform, false); LayoutElement component = val2.GetComponent<LayoutElement>(); float preferredWidth = (component.minWidth = 68f); component.preferredWidth = preferredWidth; Image img = val2.GetComponent<Image>(); ((Graphic)img).color = SettingsPanelWidgets.ToggleColor(binding2.Get()); SettingsPanelWidgets.ApplyRoundedSprite(img); ILabels labels = ctx.Labels; Text labelText = SettingsPanelWidgets.AddChildText(val2.transform, ctx.Font, binding2.Get() ? labels.ToggleOn : labels.ToggleOff, 12, (FontStyle)1); Button component2 = val2.GetComponent<Button>(); ((Selectable)component2).targetGraphic = (Graphic)(object)img; ((UnityEvent)component2.onClick).AddListener((UnityAction)delegate { //IL_0031: Unknown result type (might be due to invalid IL or missing references) bool flag2 = !binding2.Get(); binding2.Set(flag2); Plugin.SaveConfig(); ((Graphic)img).color = SettingsPanelWidgets.ToggleColor(flag2); labelText.text = (flag2 ? labels.ToggleOn : labels.ToggleOff); Logger.Debug($"Toggle '{label2}' → {flag2}"); }); ctx.Refreshes.Add(Refresh); SettingsPanelWidgets.MakeResetButton(val.transform, Reset, ctx.SkillsFrame); ctx.Resets.Add(Reset); void Refresh() { //IL_0018: Unknown result type (might be due to invalid IL or missing references) bool flag = binding2.Get(); ((Graphic)img).color = SettingsPanelWidgets.ToggleColor(flag); labelText.text = (flag ? labels.ToggleOn : labels.ToggleOff); } void Reset() { binding2.Set(binding2.Default()); Plugin.SaveConfig(); Refresh(); } } private static void AddFloatRow(RowContext ctx, string label, ConfigBinding<float> binding) { //IL_0092: Unknown result type (might be due to invalid IL or missing references) //IL_0097: Unknown result type (might be due to invalid IL or missing references) //IL_009d: Expected O, but got Unknown ConfigBinding<float> binding2 = binding; GameObject obj = SettingsPanelWidgets.MakeRow(ctx.Content, label); SettingsPanelWidgets.MakeLabel(obj.transform, ctx.Font, label); GameObject val = SettingsPanelWidgets.MakeInputField(obj.transform, ctx.Font, binding2.Get().ToString("0.##"), "0.0"); InputField input = val.GetComponent<InputField>(); input.characterLimit = 10; InputField obj2 = input; object obj3 = <>c.<>9__15_0; if (obj3 == null) { OnValidateInput val2 = (string _, int _, char c) => ("0123456789.-".IndexOf(c) >= 0) ? c : '\0'; <>c.<>9__15_0 = val2; obj3 = (object)val2; } obj2.onValidateInput = (OnValidateInput)obj3; SettingsPanelWidgets.ApplyRoundedSprite(((Component)input).GetComponent<Image>()); ((UnityEvent<string>)(object)input.onValueChanged).AddListener((UnityAction<string>)delegate(string raw) { //IL_004b: Unknown result type (might be due to invalid IL or missing references) //IL_001f: Unknown result type (might be due to invalid IL or missing references) if (float.TryParse(raw, NumberStyles.Float, CultureInfo.InvariantCulture, out var result2)) { ((Graphic)input.textComponent).color = Color.white; binding2.Set(result2); Plugin.SaveConfig(); } else { ((Graphic)input.textComponent).color = SettingsPanelWidgets.ErrorColor; } }); ((UnityEvent<string>)(object)input.onEndEdit).AddListener((UnityAction<string>)delegate(string raw) { //IL_0047: Unknown result type (might be due to invalid IL or missing references) if (!float.TryParse(raw, NumberStyles.Float, CultureInfo.InvariantCulture, out var _)) { input.text = binding2.Get().ToString("0.##"); ((Graphic)input.textComponent).color = Color.white; } }); ctx.Refreshes.Add(Refresh); SettingsPanelWidgets.MakeResetButton(obj.transform, Reset, ctx.SkillsFrame); ctx.Resets.Add(Reset); void Refresh() { //IL_0033: Unknown result type (might be due to invalid IL or missing references) input.text = binding2.Get().ToString("0.##"); ((Graphic)input.textComponent).color = Color.white; } void Reset() { binding2.Set(binding2.Default()); Plugin.SaveConfig(); Refresh(); } } private static void AddSliderFloatRow(RowContext ctx, string label, ConfigBinding<float> binding, float min, float max, int decimals) { ConfigBinding<float> binding2 = binding; string fmt = "F" + decimals; GameObject obj = SettingsPanelWidgets.MakeRow(ctx.Content, label); SettingsPanelWidgets.MakeLabel(obj.transform, ctx.Font, label); var (slider, valueText) = SettingsPanelWidgets.MakeSlider(obj.transform, ctx.Font, min, max, binding2.Get(), fmt); ((UnityEvent<float>)(object)slider.onValueChanged).AddListener((UnityAction<float>)delegate(float raw) { float obj2 = (float)Math.Round(raw, decimals); valueText.text = obj2.ToString(fmt); binding2.Set(obj2); Plugin.SaveConfig(); }); ctx.Refreshes.Add(Refresh); SettingsPanelWidgets.MakeResetButton(obj.transform, Reset, ctx.SkillsFrame); ctx.Resets.Add(Reset); void Refresh() { float num = binding2.Get(); slider.SetValueWithoutNotify(Mathf.Clamp(num, min, max)); valueText.text = num.ToString(fmt); } void Reset() { binding2.Set(binding2.Default()); Plugin.SaveConfig(); Refresh(); } } private static void AddSliderIntRow(RowContext ctx, string label, ConfigBinding<int> binding, int min, int max) { ConfigBinding<int> binding2 = binding; GameObject obj = SettingsPanelWidgets.MakeRow(ctx.Content, label); SettingsPanelWidgets.MakeLabel(obj.transform, ctx.Font, label); var (slider, valueText) = SettingsPanelWidgets.MakeSlider(obj.transform, ctx.Font, min, max, binding2.Get(), "F0"); slider.wholeNumbers = true; ((UnityEvent<float>)(object)slider.onValueChanged).AddListener((UnityAction<float>)delegate(float raw) { int obj2 = Mathf.RoundToInt(raw); valueText.text = obj2.ToString(); binding2.Set(obj2); Plugin.SaveConfig(); }); ctx.Refreshes.Add(Refresh); SettingsPanelWidgets.MakeResetButton(obj.transform, Reset, ctx.SkillsFrame); ctx.Resets.Add(Reset); void Refresh() { int num = binding2.Get(); slider.SetValueWithoutNotify((float)Mathf.Clamp(num, min, max)); valueText.text = num.ToString(); } void Reset() { binding2.Set(binding2.Default()); Plugin.SaveConfig(); Refresh(); } } private static void AddColorRow(RowContext ctx, string label, ConfigBinding<Color> binding) { //IL_0078: Unknown result type (might be due to invalid IL or missing references) //IL_007e: Expected O, but got Unknown //IL_00c8: Unknown result type (might be due to invalid IL or missing references) //IL_00f4: Unknown result type (might be due to invalid IL or missing references) //IL_019e: Unknown result type (might be due to invalid IL or missing references) //IL_01a8: Expected O, but got Unknown ConfigBinding<Color> binding2 = binding; GameObject val = SettingsPanelWidgets.MakeRow(ctx.Content, label); SettingsPanelWidgets.MakeLabel(val.transform, ctx.Font, label); GameObject val2 = new GameObject("Preview", new Type[5] { typeof(RectTransform), typeof(CanvasRenderer), typeof(Image), typeof(LayoutElement), typeof(Button) }); val2.transform.SetParent(val.transform, false); LayoutElement component = val2.GetComponent<LayoutElement>(); float preferredWidth = (component.minWidth = 22f); component.preferredWidth = preferredWidth; Image previewImg = val2.GetComponent<Image>(); ((Graphic)previewImg).color = binding2.Get(); SettingsPanelWidgets.ApplyRoundedSprite(previewImg); GameObject val3 = SettingsPanelWidgets.MakeInputField(val.transform, ctx.Font, ColorUtility.ToHtmlStringRGBA(binding2.Get())); val3.transform.SetSiblingIndex(1); InputField input = val3.GetComponent<InputField>(); Text inputText = input.textComponent; SettingsPanelWidgets.ApplyRoundedSprite(((Component)input).GetComponent<Image>()); (GameObject, Action<Color>) tuple = ColorPickerPopup.Build(ctx.SkillsFrame, binding2.Get, delegate(Color chosen) { //IL_000b: Unknown result type (might be due to invalid IL or missing references) //IL_001c: Unknown result type (might be due to invalid IL or missing references) //IL_0028: 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) binding2.Set(chosen); Plugin.SaveConfig(); ((Graphic)previewImg).color = chosen; input.text = ColorUtility.ToHtmlStringRGBA(chosen); ((Graphic)inputText).color = Color.white; }); GameObject pickerOverlay = tuple.Item1; Action<Color> syncAlpha = tuple.Item2; Button component2 = val2.GetComponent<Button>(); ((Selectable)component2).targetGraphic = (Graphic)(object)previewImg; ((UnityEvent)component2.onClick).AddListener((UnityAction)delegate { //IL_0011: Unknown result type (might be due to invalid IL or missing references) ColorPickerPopup.OpenOverlay(pickerOverlay, binding2.Get(), syncAlpha); }); ((UnityEvent<string>)(object)input.onValueChanged).AddListener((UnityAction<string>)delegate(string hex) { //IL_004f: 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_0010: Unknown result type (might be due to invalid IL or missing references) //IL_001c: Unknown result type (might be due to invalid IL or missing references) //IL_0031: Unknown result type (might be due to invalid IL or missing references) //IL_0042: Unknown result type (might be due to invalid IL or missing references) if (SettingsPanelWidgets.TryParseColor(hex, out var color2)) { ((Graphic)previewImg).color = color2; ((Graphic)inputText).color = Color.white; binding2.Set(color2); Plugin.SaveConfig(); syncAlpha(color2); } else { ((Graphic)previewImg).color = SettingsPanelWidgets.ErrorPreviewColor; ((Graphic)inputText).color = SettingsPanelWidgets.ErrorColor; } }); ((UnityEvent<string>)(object)input.onEndEdit).AddListener((UnityAction<string>)delegate(string hex) { //IL_001b: Unknown result type (might be due to invalid IL or missing references) //IL_003b: Unknown result type (might be due to invalid IL or missing references) //IL_004b: Unknown result type (might be due to invalid IL or missing references) if (!SettingsPanelWidgets.TryParseColor(hex, out var _)) { input.text = ColorUtility.ToHtmlStringRGBA(binding2.Get()); ((Graphic)previewImg).color = binding2.Get(); ((Graphic)inputText).color = Color.white; } }); ctx.Refreshes.Add(Refresh); SettingsPanelWidgets.MakeResetButton(val.transform, Reset, ctx.SkillsFrame); ctx.Resets.Add(Reset); void Refresh() { //IL_000b: Unknown result type (might be due to invalid IL or missing references) //IL_0010: Unknown result type (might be due to invalid IL or missing references) //IL_0017: Unknown result type (might be due to invalid IL or missing references) //IL_0028: Unknown result type (might be due to invalid IL or missing references) //IL_0034: Unknown result type (might be due to invalid IL or missing references) //IL_0044: Unknown result type (might be due to invalid IL or missing references) Color val4 = binding2.Get(); input.text = ColorUtility.ToHtmlStringRGBA(val4); ((Graphic)previewImg).color = val4; ((Graphic)inputText).color = Color.white; syncAlpha(val4); } void Reset() { //IL_0016: Unknown result type (might be due to invalid IL or missing references) binding2.Set(binding2.Default()); Plugin.SaveConfig(); Refresh(); } } } internal static class SettingsPanelWidgets { [Serializable] [CompilerGenerated] private sealed class <>c { public static readonly <>c <>9 = new <>c(); public static OnValidateInput <>9__18_0; internal char <MakeInputField>b__18_0(string _, int _, char c) { if ("0123456789ABCDEFabcdef".IndexOf(c) < 0) { return '\0'; } return char.ToUpper(c); } } internal static readonly Color ErrorColor = new Color(1f, 0.4f, 0.4f); internal static readonly Color ErrorPreviewColor = new Color(0.4f, 0f, 0f); private static readonly Color ToggleOnColor = new Color(0.18f, 0.58f, 0.18f); private static readonly Color ToggleOffColor = new Color(0.48f, 0.14f, 0.14f); private static readonly Color LabelColor = new Color(0.9f, 0.88f, 0.82f); internal static readonly Color InputBgColor = new Color(0.1f, 0.08f, 0.06f); private static readonly Color SliderTrackColor = new Color(0.1f, 0.08f, 0.06f); private static readonly Color SliderFillColor = new Color(0.58f, 0.44f, 0.18f); private static readonly Color SliderHandleColor = new Color(0.76f, 0.6f, 0.3f); private static readonly Color SliderHandleHighlight = new Color(0.92f, 0.76f, 0.44f); private static readonly Color SliderHandlePressed = new Color(0.46f, 0.34f, 0.12f); private const int LabelFontSize = 14; private const int InputFontSize = 11; private const int PlaceholderFontSize = 10; internal static Color ToggleColor(bool on) { //IL_0009: Unknown result type (might be due to invalid IL or missing references) //IL_0003: Unknown result type (might be due to invalid IL or missing references) if (!on) { return ToggleOffColor; } return ToggleOnColor; } internal static void MakeResetButton(Transform parent, Action onClick, Transform skillsFrame) { //IL_00ca: Unknown result type (might be due to invalid IL or missing references) //IL_00cf: Unknown result type (might be due to invalid IL or missing references) //IL_00e1: 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_0107: Unknown result type (might be due to invalid IL or missing references) //IL_0112: 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_0118: Unknown result type (might be due to invalid IL or missing references) //IL_011f: Unknown result type (might be due to invalid IL or missing references) //IL_013e: Unknown result type (might be due to invalid IL or missing references) //IL_0148: Expected O, but got Unknown //IL_0154: Unknown result type (might be due to invalid IL or missing references) //IL_015e: Expected O, but got Unknown Action onClick2 = onClick; Transform obj = skillsFrame.Find("Closebutton"); if ((Object)(object)obj == (Object)null) { throw new InvalidOperationException("Closebutton not found in SkillsFrame"); } GameObject val = Object.Instantiate<GameObject>(((Component)obj).gameObject, parent); ((Object)val).name = "ResetBtn"; LayoutElement obj2 = val.GetComponent<LayoutElement>() ?? val.AddComponent<LayoutElement>(); float num2 = (obj2.minWidth = 28f); float num4 = (obj2.preferredWidth = num2); float preferredHeight = (obj2.minHeight = num4); obj2.preferredHeight = preferredHeight; TMP_Text componentInChildren = val.GetComponentInChildren<TMP_Text>(); if ((Object)(object)componentInChildren != (Object)null) { ((Component)componentInChildren).gameObject.SetActive(false); } GameObject val2 = new GameObject("Icon", new Type[3] { typeof(RectTransform), typeof(CanvasRenderer), typeof(Image) }); val2.transform.SetParent(val.transform, false); RectTransform component = val2.GetComponent<RectTransform>(); component.anchorMin = new Vector2(0.2f, 0.2f); component.anchorMax = new Vector2(0.8f, 0.8f); Vector2 offsetMin = (component.offsetMax = Vector2.zero); component.offsetMin = offsetMin; val2.GetComponent<Image>().sprite = SpriteUtils.ResetIcon(10); Button component2 = val.GetComponent<Button>(); component2.onClick = new ButtonClickedEvent(); ((UnityEvent)component2.onClick).AddListener((UnityAction)delegate { onClick2(); }); } internal static GameObject MakeRow(Transform parent, string name) { //IL_0038: Unknown result type (might be due to invalid IL or missing references) //IL_003d: Unknown result type (might be due to invalid IL or missing references) //IL_004a: Unknown result type (might be due to invalid IL or missing references) //IL_0063: Unknown result type (might be due to invalid IL or missing references) //IL_008d: Unknown result type (might be due to invalid IL or missing references) //IL_0097: Expected O, but got Unknown //IL_0098: Expected O, but got Unknown GameObject val = new GameObject("Row_" + name, new Type[3] { typeof(RectTransform), typeof(HorizontalLayoutGroup), typeof(LayoutElement) }); val.transform.SetParent(parent, false); LayoutElement component = val.GetComponent<LayoutElement>(); float preferredHeight = (component.minHeight = 28f); component.preferredHeight = preferredHeight; HorizontalLayoutGroup component2 = val.GetComponent<HorizontalLayoutGroup>(); ((HorizontalOrVerticalLayoutGroup)component2).spacing = 4f; ((HorizontalOrVerticalLayoutGroup)component2).childForceExpandWidth = false; ((HorizontalOrVerticalLayoutGroup)component2).childForceExpandHeight = true; ((LayoutGroup)component2).childAlignment = (TextAnchor)3; ((LayoutGroup)component2).padding = new RectOffset(0, 0, 1, 1); return val; } internal static void MakeLabel(Transform parent, Font font, string text) { //IL_003f: Unknown result type (might be due to invalid IL or missing references) //IL_0044: Unknown result type (might be due to invalid IL or missing references) //IL_0051: Unknown result type (might be due to invalid IL or missing references) //IL_007d: Unknown result type (might be due to invalid IL or missing references) GameObject val = new GameObject("Label", new Type[4] { typeof(RectTransform), typeof(CanvasRenderer), typeof(Text), typeof(LayoutElement) }); val.transform.SetParent(parent, false); val.GetComponent<LayoutElement>().flexibleWidth = 1f; Text component = val.GetComponent<Text>(); component.font = font; component.fontSize = 14; component.alignment = (TextAnchor)3; ((Graphic)component).color = LabelColor; component.text = text; ((Graphic)component).raycastTarget = false; } internal static GameObject MakeInputField(Transform parent, Font font, string initialValue, string placeholder = "RRGGBBAA") { //IL_004c: Unknown result type (might be due to invalid IL or missing references) //IL_0052: Expected O, but got Unknown //IL_007e: Unknown result type (might be due to invalid IL or missing references) //IL_00ba: Unknown result type (might be due to invalid IL or missing references) //IL_00bf: Unknown result type (might be due to invalid IL or missing references) //IL_00d1: Unknown result type (might be due to invalid IL or missing references) //IL_0106: Unknown result type (might be due to invalid IL or missing references) //IL_0157: Unknown result type (might be due to invalid IL or missing references) //IL_015c: Unknown result type (might be due to invalid IL or missing references) //IL_016e: Unknown result type (might be due to invalid IL or missing references) //IL_0194: 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_0200: Unknown result type (might be due to invalid IL or missing references) //IL_0206: Expected O, but got Unknown GameObject val = new GameObject("Input", new Type[5] { typeof(RectTransform), typeof(CanvasRenderer), typeof(Image), typeof(InputField), typeof(LayoutElement) }); val.transform.SetParent(parent, false); LayoutElement component = val.GetComponent<LayoutElement>(); float preferredWidth = (component.minWidth = 86f); component.preferredWidth = preferredWidth; ((Graphic)val.GetComponent<Image>()).color = InputBgColor; GameObject val2 = new GameObject("Placeholder", new Type[3] { typeof(RectTransform), typeof(CanvasRenderer), typeof(Text) }); val2.transform.SetParent(val.transform, false); StretchInset(val2.GetComponent<RectTransform>(), 3f); Text component2 = val2.GetComponent<Text>(); component2.font = font; component2.fontSize = 10; ((Graphic)component2).color = new Color(0.35f, 0.35f, 0.35f); component2.text = placeholder; component2.alignment = (TextAnchor)4; ((Graphic)component2).raycastTarget = false; GameObject val3 = new GameObject("Text", new Type[3] { typeof(RectTransform), typeof(CanvasRenderer), typeof(Text) }); val3.transform.SetParent(val.transform, false); StretchInset(val3.GetComponent<RectTransform>(), 3f); Text component3 = val3.GetComponent<Text>(); component3.font = font; component3.fontSize = 11; ((Graphic)component3).color = Color.white; component3.alignment = (TextAnchor)4; component3.supportRichText = false; ((Graphic)component3).raycastTarget = false; InputField component4 = val.GetComponent<InputField>(); component4.textComponent = component3; component4.placeholder = (Graphic)(object)component2; component4.characterLimit = 8; component4.lineType = (LineType)0; component4.text = initialValue; ApplyRoundedSprite(((Component)component4).GetComponent<Image>()); object obj = <>c.<>9__18_0; if (obj == null) { OnValidateInput val4 = (string _, int _, char c) => ("0123456789ABCDEFabcdef".IndexOf(c) >= 0) ? char.ToUpper(c) : '\0'; <>c.<>9__18_0 = val4; obj = (object)val4; } component4.onValidateInput = (OnValidateInput)obj; return val; } internal static Text AddChildText(Transform parent, Font font, string text, int fontSize, FontStyle style) { //IL_0032: 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_0044: Unknown result type (might be due to invalid IL or missing references) //IL_0063: Unknown result type (might be due to invalid IL or missing references) //IL_0072: Unknown result type (might be due to invalid IL or missing references) GameObject val = new GameObject("Text", new Type[3] { typeof(RectTransform), typeof(CanvasRenderer), typeof(Text) }); val.transform.SetParent(parent, false); Stretch(val.GetComponent<RectTransform>()); Text component = val.GetComponent<Text>(); component.font = font; component.fontSize = fontSize; component.fontStyle = style; component.alignment = (TextAnchor)4; ((Graphic)component).color = Color.white; component.text = text; ((Graphic)component).raycastTarget = false; return component; } internal static void ApplyRoundedSprite(Image img) { Sprite val = SpriteUtils.RoundedRect(6); if (!((Object)(object)val == (Object)null)) { img.sprite = val; img.type = (Type)1; } } internal static bool TryParseColor(string hex, out Color color) { //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) color = Color.white; if (hex.Length != 8) { return false; } return ColorUtility.TryParseHtmlString("#" + hex, ref color); } internal static void Stretch(RectTransform rt) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_000c: Unknown result type (might be due to invalid IL or missing references) //IL_0018: Unknown result type (might be due to invalid IL or missing references) //IL_001d: Unknown result type (might be due to invalid IL or missing references) //IL_001e: Unknown result type (might be due to invalid IL or missing references) //IL_0024: Unknown result type (might be due to invalid IL or missing references) rt.anchorMin = Vector2.zero; rt.anchorMax = Vector2.one; Vector2 offsetMin = (rt.offsetMax = Vector2.zero); rt.offsetMin = offsetMin; } internal static void StretchInset(RectTransform rt, float inset) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_000c: Unknown result type (might be due to invalid IL or missing references) //IL_001d: Unknown result type (might be due to invalid IL or missing references) //IL_002f: Unknown result type (might be due to invalid IL or missing references) rt.anchorMin = Vector2.zero; rt.anchorMax = Vector2.one; rt.offsetMin = new Vector2(inset, 0f); rt.offsetMax = new Vector2(0f - inset, 0f); } internal static (Slider slider, Text valueText) MakeSlider(Transform parent, Font font, float min, float max, float initialValue, string valueFormat) { //IL_0025: Unknown result type (might be due to invalid IL or missing references) //IL_002b: Expected O, but got Unknown //IL_0078: Unknown result type (might be due to invalid IL or missing references) //IL_007e: Expected O, but got Unknown //IL_00a1: Unknown result type (might be due to invalid IL or missing references) //IL_00b6: Unknown result type (might be due to invalid IL or missing references) //IL_00cb: Unknown result type (might be due to invalid IL or missing references) //IL_00df: Unknown result type (might be due to invalid IL or missing references) //IL_011b: Unknown result type (might be due to invalid IL or missing references) //IL_0120: 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_0143: Unknown result type (might be due to invalid IL or missing references) //IL_0158: Unknown result type (might be due to invalid IL or missing references) //IL_016d: Unknown result type (might be due to invalid IL or missing references) //IL_0181: Unknown result type (might be due to invalid IL or missing references) //IL_0191: Unknown result type (might be due to invalid IL or missing references) //IL_01b8: Unknown result type (might be due to invalid IL or missing references) //IL_01be: Expected O, but got Unknown //IL_01e1: 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_020b: Unknown result type (might be due to invalid IL or missing references) //IL_021f: Unknown result type (might be due to invalid IL or missing references) //IL_025b: Unknown result type (might be due to invalid IL or missing references) //IL_0260: Unknown result type (might be due to invalid IL or missing references) //IL_0272: Unknown result type (might be due to invalid IL or missing references) //IL_027a: Unknown result type (might be due to invalid IL or missing references) //IL_028f: Unknown result type (might be due to invalid IL or missing references) //IL_029b: Unknown result type (might be due to invalid IL or missing references) //IL_02a0: Unknown result type (might be due to invalid IL or missing references) //IL_02a1: Unknown result type (might be due to invalid IL or missing references) //IL_02a8: Unknown result type (might be due to invalid IL or missing references) //IL_02b5: Unknown result type (might be due to invalid IL or missing references) //IL_02dc: Unknown result type (might be due to invalid IL or missing references) //IL_02e3: Expected O, but got Unknown //IL_02fe: Unknown result type (might be due to invalid IL or missing references) //IL_0309: Unknown result type (might be due to invalid IL or missing references) //IL_031e: 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_036e: Unknown result type (might be due to invalid IL or missing references) //IL_0373: Unknown result type (might be due to invalid IL or missing references) //IL_0386: Unknown result type (might be due to invalid IL or missing references) //IL_039a: Unknown result type (might be due to invalid IL or missing references) //IL_03b0: Unknown result type (might be due to invalid IL or missing references) //IL_03c6: Unknown result type (might be due to invalid IL or missing references) //IL_03dc: Unknown result type (might be due to invalid IL or missing references) //IL_03ef: Unknown result type (might be due to invalid IL or missing references) //IL_044e: Unknown result type (might be due to invalid IL or missing references) //IL_0456: Unknown result type (might be due to invalid IL or missing references) //IL_0462: Unknown result type (might be due to invalid IL or missing references) //IL_046e: Unknown result type (might be due to invalid IL or missing references) //IL_047a: Unknown result type (might be due to invalid IL or missing references) //IL_0495: Unknown result type (might be due to invalid IL or missing references) //IL_04b7: Unknown result type (might be due to invalid IL or missing references) //IL_04fd: Unknown result type (might be due to invalid IL or missing references) //IL_0502: Unknown result type (might be due to invalid IL or missing references) //IL_050f: Unknown result type (might be due to invalid IL or missing references) //IL_054c: Unknown result type (might be due to invalid IL or missing references) GameObject val = new GameObject("SliderWrap", new Type[2] { typeof(RectTransform), typeof(LayoutElement) }); val.transform.SetParent(parent, false); LayoutElement component = val.GetComponent<LayoutElement>(); component.preferredWidth = 160f; component.minWidth = 80f; GameObject val2 = new GameObject("Slider", new Type[2] { typeof(RectTransform), typeof(Slider) }); val2.transform.SetParent(val.transform, false); RectTransform component2 = val2.GetComponent<RectTransform>(); component2.anchorMin = new Vector2(0f, 0.5f); component2.anchorMax = new Vector2(1f, 0.5f); component2.offsetMin = new Vector2(0f, -7f); component2.offsetMax = new Vector2(0f, 7f); GameObject val3 = new GameObject("Background", new Type[3] { typeof(RectTransform), typeof(CanvasRenderer), typeof(Image) }); val3.transform.SetParent(val2.transform, false); RectTransform component3 = val3.GetComponent<RectTransform>(); component3.anchorMin = new Vector2(0f, 0.5f); component3.anchorMax = new Vector2(1f, 0.5f); component3.offsetMin = new Vector2(0f, -1.5f); component3.offsetMax = new Vector2(0f, 1.5f); Image component4 = val3.GetComponent<Image>(); ((Graphic)component4).color = SliderTrackColor; ApplyRoundedSprite(component4); GameObject val4 = new GameObject("Fill Area", new Type[1] { typeof(RectTransform) }); val4.transform.SetParent(val2.transform, false); RectTransform component5 = val4.GetComponent<RectTransform>(); component5.anchorMin = new Vector2(0f, 0.5f); component5.anchorMax = new Vector2(1f, 0.5f); component5.offsetMin = new Vector2(0f, -1.5f); component5.offsetMax = new Vector2(-7f, 1.5f); GameObject val5 = new GameObject("Fill", new Type[3] { typeof(RectTransform), typeof(CanvasRenderer), typeof(Image) }); val5.transform.SetParent(val4.transform, false); RectTransform component6 = val5.GetComponent<RectTransform>(); component6.anchorMin = Vector2.zero; component6.anchorMax = new Vector2(0f, 1f); Vector2 offsetMin = (component6.offsetMax = Vector2.zero); component6.offsetMin = offsetMin; Image component7 = val5.GetComponent<Image>(); ((Graphic)component7).color = SliderFillColor; ApplyRoundedSprite(component7); GameObject val6 = new GameObject("Handle Slide Area", new Type[1] { typeof(RectTransform) }); val6.transform.SetParent(val2.transform, false); RectTransform component8 = val6.GetComponent<RectTransform>(); component8.anchorMin = Vector2.zero; component8.anchorMax = Vector2.one; component8.offsetMin = new Vector2(7f, 0f); component8.offsetMax = new Vector2(-7f, 0f); GameObject val7 = new GameObject("Handle", new Type[3] { typeof(RectTransform), typeof(CanvasRenderer), typeof(Image) }); val7.transform.SetParent(val6.transform, false); RectTransform component9 = val7.GetComponent<RectTransform>(); component9.anchorMin = new Vector2(0f, 0.5f); component9.anchorMax = new Vector2(0f, 0.5f); component9.pivot = new Vector2(0.5f, 0.5f); component9.sizeDelta = new Vector2(14f, 14f); Image component10 = val7.GetComponent<Image>(); ((Graphic)component10).color = SliderHandleColor; ApplyRoundedSprite(component10); Slider component11 = val2.GetComponent<Slider>(); component11.fillRect = component6; component11.handleRect = component9; ((Selectable)component11).targetGraphic = (Graphic)(object)component10; component11.direction = (Direction)0; component11.minValue = min; component11.maxValue = max; component11.value = Mathf.Clamp(initialValue, min, max); ColorBlock colors = default(ColorBlock); ((ColorBlock)(ref colors)).normalColor = SliderHandleColor; ((ColorBlock)(ref colors)).highlightedColor = SliderHandleHighlight; ((ColorBlock)(ref colors)).pressedColor = SliderHandlePressed; ((ColorBlock)(ref colors)).selectedColor = SliderHandleColor; ((ColorBlock)(ref colors)).disabledColor = new Color(0.4f, 0.4f, 0.4f); ((ColorBlock)(ref colors)).colorMultiplier = 1f; ((ColorBlock)(ref colors)).fadeDuration = 0.1f; ((Selectable)component11).colors = colors; GameObject val8 = new GameObject("SliderValue", new Type[4] { typeof(RectTransform), typeof(CanvasRenderer), typeof(Text), typeof(LayoutElement) }); val8.transform.SetParent(parent, false); LayoutElement component12 = val8.GetComponent<LayoutElement>(); float preferredWidth = (component12.minWidth = 44f); component12.preferredWidth = preferredWidth; Text component13 = val8.GetComponent<Text>(); component13.font = font; component13.fontSize = 11; component13.alignment = (TextAnchor)5; ((Graphic)component13).color = LabelColor; component13.text = initialValue.ToString(valueFormat); ((Graphic)component13).raycastTarget = false; return (component11, component13); } } } namespace SkillsPreview.App.UI.CharacterStatsPanel { internal class CharacterStatsPanel { private static readonly Log.Scoped _log = Log.For("CharacterStatsPanel"); private static readonly Color SkillNameColor = new Color(0.85f, 0.78f, 0.62f, 1f); private static readonly Color SkillLevelColor = new Color(1f, 1f, 1f, 1f); private static readonly Color ZeroLevelColor = new Color(0.4f, 0.4f, 0.4f, 1f); private static readonly Color HintColor = new Color(0.55f, 0.5f, 0.4f, 1f); private const int FontSizeName = 14; private const int FontSizeLevel = 14; private const int RowHeight = 21; private readonly Font _font; private readonly Transform _content; private readonly List<(Text nameText, Text levelText)> _rows = new List<(Text, Text)>(); private const string HintObjectName = "godzki_StatsHint"; internal GameObject Root { get; } internal bool IsAlive => (Object)(object)Root != (Object)null; private CharacterStatsPanel(GameObject root, Transform content, Font font) { //IL_0034: 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) Root = root; _content = content; _font = font; foreach (SkillType allSkillType in SkillProfileReader.AllSkillTypes) { SkillType current = allSkillType; string text = "$skill_" + ((object)(SkillType)(ref current)).ToString().ToLower(); string skillName = ((Localization.instance != null) ? Localization.instance.Localize(text) : ((object)(SkillType)(ref current)).ToString()); var (item, item2) = AddSkillRow(skillName); _rows.Add((item, item2)); } } internal static CharacterStatsPanel Create(Transform parent) { Font builtinResource = Resources.GetBuiltinResource<Font>("Arial.ttf"); GameObject root = CharacterStatsPanelLayout.BuildRoot(parent); CharacterStatsPanelLayout.BuildBackground(root); CharacterStatsPanelLayout.AddTitle(root, L.Current.StatsTitle); Transform content = CharacterStatsPanelLayout.AddScrollView(root); CharacterStatsPanel result = new CharacterStatsPanel(root, content, builtinResource); _log.Debug("CharacterStatsPanel created."); return result; } internal void Refresh(PlayerProfile? profile) { //IL_003d: 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_0099: Unknown result type (might be due to invalid IL or missing references) if (profile == null) { ShowHint(L.Current.StatsNoCharacter); _log.Debug("Refresh — no profile."); return; } HideHint(); Dictionary<SkillType, float> dictionary = SkillProfileReader.ReadSkills(profile); IReadOnlyList<SkillType> allSkillTypes = SkillProfileReader.AllSkillTypes; for (int i = 0; i < _rows.Count && i < allSkillTypes.Count; i++) { dictionary.TryGetValue(allSkillTypes[i], out var value); bool flag = value < 0.5f; _rows[i].levelText.text = (flag ? "0" : Mathf.FloorToInt(value).ToString()); ((Graphic)_rows[i].levelText).color = (flag ? ZeroLevelColor : SkillLevelColor); } _log.Debug("Refreshed for '" + profile.GetFilename() + "'."); } private (Text nameText, Text levelText) AddSkillRow(string skillName) { //IL_0025: Unknown result type (might be due to invalid IL or missing references) //IL_002b: Expected O, but got Unknown //IL_006c: Unknown result type (might be due to invalid IL or missing references) //IL_007b: Unknown result type (might be due to invalid IL or missing references) //IL_0082: Unknown result type (might be due to invalid IL or missing references) //IL_00a2: Unknown result type (might be due to invalid IL or missing references) //IL_00b1: Unknown result type (might be due to invalid IL or missing references) //IL_00bc: Unknown result type (might be due to invalid IL or missing references) GameObject val = new GameObject("Row", new Type[2] { typeof(RectTransform), typeof(LayoutElement) }); val.transform.SetParent(_content, false); LayoutElement component = val.GetComponent<LayoutElement>(); float preferredHeight = (component.minHeight = 21f); component.preferredHeight = preferredHeight; Text item = MakeLabel(val.transform, "Name", new Vector2(0f, 0f), new Vector2(0.75f, 1f), skillName, (TextAnchor)3, SkillNameColor); Text item2 = MakeLabel(val.transform, "Level", new Vector2(0.75f, 0f), new Vector2(1f, 1f), "0", (TextAnchor)5, ZeroLevelColor); return (item, item2); } private Text MakeLabel(Transform parent, string goName, Vector2 anchorMin, Vector2 anchorMax, string text, TextAnchor alignment, Color color) { //IL_002e: Unknown result type (might be due to invalid IL or missing references) //IL_0033: Unknown result type (might be due to invalid IL or missing references) //IL_0040: Unknown result type (might be due to invalid IL or missing references) //IL_0047: Unknown result type (might be due to invalid IL or missing references) //IL_004e: 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_005b: Unknown result type (might be due to invalid IL or missing references) //IL_005c: Unknown result type (might be due to invalid IL or missing references) //IL_0062: Unknown result type (might be due to invalid IL or missing references) //IL_0093: Unknown result type (might be due to invalid IL or missing references) //IL_009b: Unknown result type (might be due to invalid IL or missing references) GameObject val = new GameObject(goName, new Type[3] { typeof(RectTransform), typeof(CanvasRenderer), typeof(Text) }); val.transform.SetParent(parent, false); RectTransform component = val.GetComponent<RectTransform>(); component.anchorMin = anchorMin; component.anchorMax = anchorMax; Vector2 offsetMin = (component.offsetMax = Vector2.zero); component.offsetMin = offsetMin; Text component2 = val.GetComponent<Text>(); component2.font = _font; component2.fontSize = ((goName == "Name") ? 14 : 14); component2.alignment = alignment; ((Graphic)component2).color = color; component2.text = text; ((Graphic)component2).raycastTarget = false; return component2; } private void ShowHint(string message) { //IL_0054: Unknown result type (might be due to invalid IL or missing references) //IL_0059: Unknown result type (might be due to invalid IL or missing references) //IL_0070: 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_0096: Unknown result type (might be due to invalid IL or missing references) //IL_00ab: Unknown result type (might be due to invalid IL or missing references) //IL_00c0: 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) //IL_00d4: 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) Transform val = Root.transform.Find("godzki_StatsHint"); if ((Object)(object)val == (Object)null) { GameObject val2 = new GameObject("godzki_StatsHint", new Type[3] { typeof(RectTransform), typeof(CanvasRenderer), typeof(Text) }); val2.transform.SetParent(Root.transform, false); RectTransform component = val2.GetComponent<RectTransform>(); component.anchorMin = new Vector2(0f, 0.5f); component.anchorMax = new Vector2(1f, 0.5f); component.pivot = new Vector2(0.5f, 0.5f); component.sizeDelta = new Vector2(0f, 30f); component.anchoredPosition = Vector2.zero; Text component2 = val2.GetComponent<Text>(); component2.font = _font; component2.fontSize = 12; component2.alignment = (TextAnchor)4; component2.fontStyle = (FontStyle)2; ((Graphic