Some mods may be broken due to the recent Alloyed Collective update.
Decompiled source of SkinTuner v1.2.0
SkinTuner.dll
Decompiled 6 months agousing System; using System.Collections; using System.Collections.Generic; using System.Diagnostics; using System.Linq; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using System.Security; using System.Security.Permissions; using System.Text.RegularExpressions; using BepInEx; using BepInEx.Bootstrap; using BepInEx.Configuration; using Microsoft.CodeAnalysis; using On.RoR2; using On.RoR2.UI; using RiskOfOptions; using RiskOfOptions.OptionConfigs; using RiskOfOptions.Options; using RoR2; using RoR2.Projectile; using RoR2.UI; using ScrollableLobbyUI; using TMPro; using UnityEngine; using UnityEngine.AddressableAssets; using UnityEngine.Events; using UnityEngine.UI; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")] [assembly: AssemblyCompany("SkinTuner")] [assembly: AssemblyConfiguration("Release")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyInformationalVersion("1.0.0+d9f9d2c27c07bcddbd3f9b2c6dcfe12426be0c13")] [assembly: AssemblyProduct("SkinTuner")] [assembly: AssemblyTitle("SkinTuner")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("1.0.0.0")] [module: UnverifiableCode] [module: RefSafetyRules(11)] namespace Microsoft.CodeAnalysis { [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] internal sealed class EmbeddedAttribute : Attribute { } } namespace System.Runtime.CompilerServices { [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] [AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)] internal sealed class RefSafetyRulesAttribute : Attribute { public readonly int Version; public RefSafetyRulesAttribute(int P_0) { Version = P_0; } } } namespace SkinTuning { public class Deployables { public Deployables() { //IL_000d: Unknown result type (might be due to invalid IL or missing references) //IL_0017: Expected O, but got Unknown CharacterMaster.AddDeployable += new hook_AddDeployable(OnDeploy); } public void OnDeploy(orig_AddDeployable orig, CharacterMaster self, Deployable deployable, DeployableSlot slot) { //IL_0003: 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_000d: Invalid comparison between Unknown and I4 //IL_001c: Unknown result type (might be due to invalid IL or missing references) //IL_0020: Invalid comparison between Unknown and I4 //IL_000f: Unknown result type (might be due to invalid IL or missing references) //IL_0012: Invalid comparison between Unknown and I4 //IL_0030: 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) //IL_003a: 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_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_0022: Unknown result type (might be due to invalid IL or missing references) //IL_0026: Invalid comparison between Unknown and I4 //IL_0014: 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_0019: Invalid comparison between Unknown and I4 //IL_0062: 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_002c: Invalid comparison between Unknown and I4 //IL_0074: 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_007f: 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_00fc: Unknown result type (might be due to invalid IL or missing references) orig.Invoke(self, deployable, slot); if ((int)slot <= 5) { if ((int)slot > 1 && slot - 4 > 1) { return; } } else if ((int)slot != 15 && (int)slot != 17 && (int)slot != 21) { return; } SurvivorIndex survivorIndexFromBodyIndex = SurvivorCatalog.GetSurvivorIndexFromBodyIndex(self.backupBodyIndex); Color val = Color.white * 0.5f; if (Object.op_Implicit((Object)(object)self.playerCharacterMasterController) && Main.survivorConfig.entries.ContainsKey(survivorIndexFromBodyIndex)) { val = Main.survivorConfig.entries[survivorIndexFromBodyIndex]; } ModelLocator component = ((Component)deployable).GetComponent<ModelLocator>(); object obj = ((component != null) ? component.modelTransform : null); if (obj == null) { ProjectileController component2 = ((Component)deployable).GetComponent<ProjectileController>(); obj = ((component2 == null) ? null : component2.ghost?.transform) ?? ((Component)deployable).transform; } Transform val2 = (Transform)obj; Renderer componentInChildren = (Renderer)(object)((Component)val2).GetComponentInChildren<SkinnedMeshRenderer>(); if (componentInChildren == null) { componentInChildren = (Renderer)(object)((Component)val2).GetComponentInChildren<MeshRenderer>(); } if (Object.op_Implicit((Object)(object)componentInChildren)) { Material[] materials = componentInChildren.materials; foreach (Material val3 in materials) { val3.color = ((Color)(ref val)).AlphaMultiplied(val3.color.a); } } } } [BepInPlugin("RiskOfResources.SkinTuner", "SkinTuner", "1.2.0")] public class Main : BaseUnityPlugin { [CompilerGenerated] private static class <>O { public static hook_Awake <0>__LoadoutPanelControllerAwake; public static hook_ctor <1>__LoadoutPanelControllerRowCtor; public static hook_FinishSetup <2>__LoadoutPanelControllerRowFinishSetup; } [Serializable] [CompilerGenerated] private sealed class <>c { public static readonly <>c <>9 = new <>c(); public static orig_Awake <>9__7_1; public static hook_Awake <>9__7_0; internal void <ChangeHook>b__7_0(orig_Awake orig, CharacterSelectController self) { //IL_001b: Unknown result type (might be due to invalid IL or missing references) //IL_0020: Unknown result type (might be due to invalid IL or missing references) //IL_0026: Expected O, but got Unknown orig.Invoke(self); object obj = <>9__7_1; if (obj == null) { orig_Awake val = delegate { }; <>9__7_1 = val; obj = (object)val; } UIHooks.LoadoutPanelControllerAwake((orig_Awake)obj, GameObject.Find("LoadoutPanel").GetComponent<LoadoutPanelController>()); } internal void <ChangeHook>b__7_1(LoadoutPanelController _) { } } public const string PluginGUID = "RiskOfResources.SkinTuner"; public const string PluginAuthor = "RiskOfResources"; public const string PluginName = "SkinTuner"; public const string PluginVersion = "1.2.0"; public static SurvivorConfig survivorConfig; public void Awake() { RoR2Application.onLoad = (Action)Delegate.Combine(RoR2Application.onLoad, (Action)delegate { survivorConfig = new SurvivorConfig(((BaseUnityPlugin)this).Config); new UI(); if (Chainloader.PluginInfos.ContainsKey("com.rune580.riskofoptions")) { AddSliders(); } if (Chainloader.PluginInfos.ContainsKey("com.KingEnderBrine.ScrollableLobbyUI")) { ChangeHook(); } }); } [MethodImpl(MethodImplOptions.NoInlining)] public void AddSliders() { //IL_001f: 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_003a: Unknown result type (might be due to invalid IL or missing references) //IL_0045: Unknown result type (might be due to invalid IL or missing references) //IL_0051: Expected O, but got Unknown //IL_0059: Unknown result type (might be due to invalid IL or missing references) //IL_0063: Expected O, but got Unknown //IL_006b: Unknown result type (might be due to invalid IL or missing references) //IL_0075: Expected O, but got Unknown //IL_007d: Unknown result type (might be due to invalid IL or missing references) //IL_0087: Expected O, but got Unknown foreach (SurvivorDef orderedSurvivorDef in SurvivorCatalog.orderedSurvivorDefs) { SurvivorConfig.ColorEntry colorEntry = survivorConfig.entries[orderedSurvivorDef.survivorIndex]; StepSliderConfig val = new StepSliderConfig { min = 0f, max = 765f, increment = 1f }; ModSettingsManager.AddOption((BaseOption)new StepSliderOption(colorEntry.R, val)); ModSettingsManager.AddOption((BaseOption)new StepSliderOption(colorEntry.G, val)); ModSettingsManager.AddOption((BaseOption)new StepSliderOption(colorEntry.B, val)); } } [MethodImpl(MethodImplOptions.NoInlining)] private void ChangeHook() { //IL_0010: 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_001b: Expected O, but got Unknown //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) //IL_003f: Expected O, but got Unknown //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_005f: Expected O, but got Unknown //IL_0074: Unknown result type (might be due to invalid IL or missing references) //IL_0079: Unknown result type (might be due to invalid IL or missing references) //IL_007f: Expected O, but got Unknown object obj = <>O.<0>__LoadoutPanelControllerAwake; if (obj == null) { hook_Awake val = UIHooks.LoadoutPanelControllerAwake; <>O.<0>__LoadoutPanelControllerAwake = val; obj = (object)val; } LoadoutPanelController.Awake -= (hook_Awake)obj; object obj2 = <>c.<>9__7_0; if (obj2 == null) { hook_Awake val2 = delegate(orig_Awake orig, CharacterSelectController self) { //IL_001b: Unknown result type (might be due to invalid IL or missing references) //IL_0020: Unknown result type (might be due to invalid IL or missing references) //IL_0026: Expected O, but got Unknown orig.Invoke(self); object obj5 = <>c.<>9__7_1; if (obj5 == null) { orig_Awake val5 = delegate { }; <>c.<>9__7_1 = val5; obj5 = (object)val5; } UIHooks.LoadoutPanelControllerAwake((orig_Awake)obj5, GameObject.Find("LoadoutPanel").GetComponent<LoadoutPanelController>()); }; <>c.<>9__7_0 = val2; obj2 = (object)val2; } CharacterSelectController.Awake += (hook_Awake)obj2; object obj3 = <>O.<1>__LoadoutPanelControllerRowCtor; if (obj3 == null) { hook_ctor val3 = UIHooks.LoadoutPanelControllerRowCtor; <>O.<1>__LoadoutPanelControllerRowCtor = val3; obj3 = (object)val3; } UI.ctor = (hook_ctor)obj3; object obj4 = <>O.<2>__LoadoutPanelControllerRowFinishSetup; if (obj4 == null) { hook_FinishSetup val4 = UIHooks.LoadoutPanelControllerRowFinishSetup; <>O.<2>__LoadoutPanelControllerRowFinishSetup = val4; obj4 = (object)val4; } UI.setup = (hook_FinishSetup)obj4; } } public class SurvivorConfig { public record struct ColorEntry(ConfigEntry<float> R, ConfigEntry<float> G, ConfigEntry<float> B) { public static implicit operator Color(ColorEntry entry) { //IL_0029: 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) return new Color(entry.R.Value, entry.G.Value, entry.B.Value, 255f) / 255f; } } public readonly Dictionary<SurvivorIndex, ColorEntry> entries = new Dictionary<SurvivorIndex, ColorEntry>(); public const float threshold = 255f; public const float min = 0f; public const float max = 765f; public event Action<SurvivorIndex> OnSkinColorUpdated; public SurvivorConfig(ConfigFile config) { //IL_0115: Unknown result type (might be due to invalid IL or missing references) //IL_011a: Unknown result type (might be due to invalid IL or missing references) //IL_0123: Unknown result type (might be due to invalid IL or missing references) //IL_0128: Unknown result type (might be due to invalid IL or missing references) //IL_012d: Unknown result type (might be due to invalid IL or missing references) //IL_013a: 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_019b: Expected O, but got Unknown //IL_01a2: Unknown result type (might be due to invalid IL or missing references) //IL_01ac: Expected O, but got Unknown SurvivorConfig survivorConfig = this; AcceptableValueRange<float> range = new AcceptableValueRange<float>(0f, 765f); foreach (SurvivorDef orderedSurvivorDef in SurvivorCatalog.orderedSurvivorDefs) { Debug.Log((object)orderedSurvivorDef.displayNameToken); string name = RemoveColorTags(Language.GetString(orderedSurvivorDef.displayNameToken).Trim().Replace("\\n", "") .Replace("\\t", "") .Replace("\\", "") .Replace("\"", "") .Replace("'", "") .Replace("[", "") .Replace("]", "")); name = HandleDupeSurvivors(config, name); SurvivorIndex survivor = orderedSurvivorDef.survivorIndex; BodyIndex body = SurvivorCatalog.GetBodyIndexFromSurvivorIndex(survivor); entries[survivor] = new ColorEntry(entry("Red"), entry("Green"), entry("Blue")); ConfigEntry<float> entry(string color) { //IL_0070: Unknown result type (might be due to invalid IL or missing references) //IL_007a: Expected O, but got Unknown string text = "How " + color.ToLower() + " the skin color is for " + name + "." + $" Going over {255f} will make the skin incandescent."; ConfigEntry<float> obj = config.Bind<float>(name, color, 255f, new ConfigDescription(text, (AcceptableValueBase)(object)range, Array.Empty<object>())); obj.SettingChanged += delegate { //IL_000c: 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) survivorConfig.UpdateSkinColor(survivor, body); }; return obj; } } NetworkUser.SetBodyPreference += new hook_SetBodyPreference(OnBodyChanged); BodyLoadoutManager.SetSkinIndex += new hook_SetSkinIndex(OnSkinChanged); new Deployables(); } private void OnBodyChanged(orig_SetBodyPreference orig, NetworkUser self, BodyIndex bodyIndex) { //IL_0002: 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) orig.Invoke(self, bodyIndex); UpdateSkinColor(bodyIndex); } public void OnSkinChanged(orig_SetSkinIndex orig, BodyLoadoutManager self, BodyIndex bodyIndex, uint skinIndex) { //IL_0002: 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) orig.Invoke(self, bodyIndex, skinIndex); UpdateSkinColor(bodyIndex); } public void UpdateSkinColor(SurvivorIndex survivorIndex, BodyIndex bodyIndex) { //IL_0006: 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_001b: Unknown result type (might be due to invalid IL or missing references) //IL_0020: Unknown result type (might be due to invalid IL or missing references) //IL_0021: Unknown result type (might be due to invalid IL or missing references) //IL_0151: 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) //IL_0050: Unknown result type (might be due to invalid IL or missing references) //IL_0054: 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) //IL_00a8: Unknown result type (might be due to invalid IL or missing references) //IL_00ad: 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_00e1: Unknown result type (might be due to invalid IL or missing references) //IL_00e6: Unknown result type (might be due to invalid IL or missing references) //IL_00e8: Unknown result type (might be due to invalid IL or missing references) //IL_00f7: Unknown result type (might be due to invalid IL or missing references) //IL_00fe: Unknown result type (might be due to invalid IL or missing references) //IL_0104: Unknown result type (might be due to invalid IL or missing references) //IL_010a: Unknown result type (might be due to invalid IL or missing references) //IL_0110: 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_0121: Unknown result type (might be due to invalid IL or missing references) if (!entries.ContainsKey(survivorIndex)) { return; } Color val = entries[survivorIndex]; SkinDef[] bodySkinDefs = SkinCatalog.GetBodySkinDefs(bodyIndex); foreach (SkinDef val2 in bodySkinDefs) { List<RendererInfo> list = new List<RendererInfo>(); RendererInfo[] rendererInfos = val2.rendererInfos; foreach (RendererInfo item in rendererInfos) { list.Add(item); } foreach (RendererInfo item2 in ((IEnumerable<RendererInfoTemplate>)(object)val2.runtimeSkin.rendererInfoTemplates).Select(delegate(RendererInfoTemplate template) { //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_0004: Unknown result type (might be due to invalid IL or missing references) RendererInfoTemplate val4 = template; return ((RendererInfoTemplate)(ref val4)).rendererInfoData; })) { list.Add(item2); } rendererInfos = list.ToArray(); foreach (RendererInfo val3 in rendererInfos) { if ((Object)(object)val3.defaultMaterial != (Object)null) { val3.defaultMaterial.color = new Color(val.r, val.g, val.b, val3.defaultMaterial.color.a); } } } this.OnSkinColorUpdated?.Invoke(survivorIndex); } public void UpdateSkinColor(BodyIndex bodyIndex) { //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_0006: 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) SurvivorIndex survivorIndexFromBodyIndex = SurvivorCatalog.GetSurvivorIndexFromBodyIndex(bodyIndex); UpdateSkinColor(survivorIndexFromBodyIndex, bodyIndex); } public string HandleDupeSurvivors(ConfigFile config, string name) { string result = name; int num = 0; while (config.Keys.Any((ConfigDefinition configDefinition) => configDefinition.Section == result)) { result = $"{name}_{++num}"; } return result; } private string RemoveColorTags(string input) { return Regex.Replace(input, "<.*?>", string.Empty); } } public class UI : MonoBehaviour { [Serializable] [CompilerGenerated] private sealed class <>c { public static readonly <>c <>9 = new <>c(); public static hook_OnEnable <>9__7_0; internal void <.ctor>b__7_0(orig_OnEnable orig, LoadoutPanelController self) { orig.Invoke(self); self.Rebuild(); } internal void <.cctor>b__13_0(orig_ctor orig, object self, LoadoutPanelController arg1, BodyIndex arg2, string arg3) { //IL_0003: Unknown result type (might be due to invalid IL or missing references) orig.Invoke(self, arg1, arg2, arg3); } internal void <.cctor>b__13_1(orig_FinishSetup orig, object self, bool arg1) { orig.Invoke(self, arg1); } } private const string panel = "SkinPanel"; private const string button = "GenericMenuButton (Skin)"; private static readonly GameObject sliderPrefab = Addressables.LoadAssetAsync<GameObject>((object)"RoR2/Base/UI/SettingsEntryButton, Slider.prefab").WaitForCompletion(); private readonly Dictionary<SurvivorIndex, Dictionary<string, Slider>> survivorSliders = new Dictionary<SurvivorIndex, Dictionary<string, Slider>>(); private GameObject skinPanel; internal static hook_ctor ctor = (hook_ctor)delegate(orig_ctor orig, object self, LoadoutPanelController arg1, BodyIndex arg2, string arg3) { //IL_0003: Unknown result type (might be due to invalid IL or missing references) orig.Invoke(self, arg1, arg2, arg3); }; internal static hook_FinishSetup setup = (hook_FinishSetup)delegate(orig_FinishSetup orig, object self, bool arg1) { orig.Invoke(self, arg1); }; public UI() { //IL_0018: Unknown result type (might be due to invalid IL or missing references) //IL_0022: Expected O, but got Unknown //IL_0029: Unknown result type (might be due to invalid IL or missing references) //IL_0033: Expected O, but got Unknown //IL_003a: Unknown result type (might be due to invalid IL or missing references) //IL_0044: Expected O, but got Unknown //IL_006e: 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_0079: Expected O, but got Unknown CharacterSelectController.Awake += new hook_Awake(UIBuilder); LoadoutPanelController.Rebuild += new hook_Rebuild(RebuildLoadoutPanels); CharacterSelectController.UpdateSurvivorInfoPanel += new hook_UpdateSurvivorInfoPanel(UIUpdate); Main.survivorConfig.OnSkinColorUpdated += UpdateSliders; object obj = <>c.<>9__7_0; if (obj == null) { hook_OnEnable val = delegate(orig_OnEnable orig, LoadoutPanelController self) { orig.Invoke(self); self.Rebuild(); }; <>c.<>9__7_0 = val; obj = (object)val; } LoadoutPanelController.OnEnable += (hook_OnEnable)obj; } private void UIBuilder(orig_Awake orig, CharacterSelectController self) { //IL_0062: 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) //IL_009c: 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) orig.Invoke(self); GameObject val = GameObject.Find("LoadoutPanel"); GameObject obj = GameObject.Find("GenericMenuButton (Loadout)"); skinPanel = Object.Instantiate<GameObject>(val, val.transform.parent); ((Object)skinPanel).name = "SkinPanel"; GameObject val2 = Object.Instantiate<GameObject>(obj, obj.transform.parent); ((Object)val2).name = "GenericMenuButton (Skin)"; Header item = new Header { headerName = "Skin", headerButton = (MPButton)(object)val2.GetComponent<HGButton>(), headerRoot = skinPanel, tmpHeaderText = (TextMeshProUGUI)(object)val2.GetComponentInChildren<HGTextMeshProUGUI>() }; ((Component)obj.transform.parent).GetComponent<HGHeaderNavigationController>().headers.Add(item); ((MonoBehaviour)self).StartCoroutine(delay()); static IEnumerator delay() { yield return (object)new WaitForEndOfFrame(); GameObject obj2 = GameObject.Find("Directional Light"); Light val3 = ((obj2 != null) ? obj2.GetComponent<Light>() : null); if ((Object)(object)val3 != (Object)null) { Color white = Color.white; Color color = val3.color; val3.color = white * ((Color)(ref color)).grayscale; } } } private void RebuildLoadoutPanels(orig_Rebuild orig, LoadoutPanelController self) { //IL_001d: Unknown result type (might be due to invalid IL or missing references) //IL_0022: 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_0034: 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_00a1: Unknown result type (might be due to invalid IL or missing references) //IL_012f: Unknown result type (might be due to invalid IL or missing references) //IL_0139: Expected O, but got Unknown BodyIndex bodyIndex = self.currentDisplayData.bodyIndex; SurvivorIndex survivorIndex = SurvivorCatalog.GetSurvivorIndexFromBodyIndex(bodyIndex); List<Row> rows = self.rows; if (((Object)self).name == "SkinPanel") { if (Main.survivorConfig.entries.TryGetValue(survivorIndex, out var value2)) { ((HorizontalOrVerticalLayoutGroup)((Component)self).GetComponent<VerticalLayoutGroup>()).childForceExpandHeight = true; Row.FinishSetup -= setup; Row val = Row.FromSkin(self, bodyIndex); RectTransform rowPanelTransform = val.rowPanelTransform; Transform buttonContainerTransform = (Transform)(object)val.buttonContainerTransform; self.DestroyRows(); rows.Add(val); Transform obj = ((Transform)rowPanelTransform).Find("Panel"); if (obj != null) { ((Component)obj).gameObject.SetActive(false); } Transform obj2 = ((Transform)rowPanelTransform).Find("SlotLabel"); if (obj2 != null) { ((Component)obj2).gameObject.SetActive(false); } Transform obj3 = ((Transform)rowPanelTransform).Find("LabelContainer"); if (obj3 != null) { ((Component)obj3).gameObject.SetActive(false); } ((LayoutGroup)((Component)buttonContainerTransform).GetComponent<HorizontalLayoutGroup>()).padding = new RectOffset(12, 12, 0, 0); Row.ctor -= ctor; createSlider(value2.R, "Red"); createSlider(value2.G, "Green"); createSlider(value2.B, "Blue"); Row.ctor += ctor; Row.FinishSetup += setup; } } else { orig.Invoke(self); if (rows.Any()) { rows.Last().Dispose(); rows.RemoveAt(rows.Count - 1); } } void createSlider(ConfigEntry<float> entry, string title) { //IL_0014: Unknown result type (might be due to invalid IL or missing references) //IL_001a: Unknown result type (might be due to invalid IL or missing references) //IL_001f: Unknown result type (might be due to invalid IL or missing references) //IL_0027: Expected O, but got Unknown //IL_00a5: Unknown result type (might be due to invalid IL or missing references) //IL_00af: Expected O, but got Unknown //IL_00fa: Unknown result type (might be due to invalid IL or missing references) //IL_0171: Unknown result type (might be due to invalid IL or missing references) Row val2 = new Row(self, bodyIndex, title) { userProfile = null }; RectTransform rowPanelTransform2 = val2.rowPanelTransform; Transform buttonContainerTransform2 = (Transform)(object)val2.buttonContainerTransform; Transform choiceHighlightRect = (Transform)(object)val2.choiceHighlightRect; rows.Add(val2); ((Component)((Transform)rowPanelTransform2).Find("Panel")).gameObject.SetActive(false); ((Component)((Transform)rowPanelTransform2).Find("SlotLabel")).gameObject.SetActive(false); ((Component)buttonContainerTransform2.Find("Spacer")).gameObject.SetActive(false); ((Component)choiceHighlightRect).gameObject.SetActive(false); HorizontalLayoutGroup component = ((Component)buttonContainerTransform2).GetComponent<HorizontalLayoutGroup>(); ((HorizontalOrVerticalLayoutGroup)component).childForceExpandWidth = true; ((LayoutGroup)component).padding = new RectOffset(8, 8, 0, 0); GameObject obj4 = Object.Instantiate<GameObject>(sliderPrefab, buttonContainerTransform2); obj4.GetComponent<HGButton>().updateTextOnHover = false; SettingsSlider component2 = obj4.GetComponent<SettingsSlider>(); ((BaseSettingsControl)component2).nameLabel.token = title; ((Component)((Component)component2).transform.Find("SliderControl")).GetComponent<RectTransform>().anchorMin = new Vector2(0.225f, 0f); Slider slider = component2.slider; HGTextMeshProUGUI display = component2.valueText; ((UnityEventBase)slider.onValueChanged).RemoveAllListeners(); Object.Destroy((Object)(object)component2); slider.minValue = 0f; slider.maxValue = 765f; ((UnityEvent<float>)(object)slider.onValueChanged).AddListener((UnityAction<float>)delegate(float value) { ((TMP_Text)display).text = value.ToString("0"); if (value != entry.Value) { entry.Value = Mathf.Round(value); } }); slider.value = entry.Value; RegisterSliders(survivorIndex, slider, title); } } private void UIUpdate(orig_UpdateSurvivorInfoPanel orig, CharacterSelectController self) { //IL_003a: Unknown result type (might be due to invalid IL or missing references) GameObject gameObject = ((Component)((Component)self.activeSurvivorInfoPanel.transform.Find("SubheaderPanel (Overview, Skills, Loadout)")).transform.Find("GenericMenuButton (Skin)")).gameObject; ((Graphic)gameObject.GetComponent<Image>()).color = ((Graphic)self.primaryColorImages.First()).color; ((TMP_Text)((Component)gameObject.transform.Find("ButtonText")).GetComponent<HGTextMeshProUGUI>()).text = Language.GetString("LOADOUT_SKIN"); orig.Invoke(self); } private void UpdateSliders(SurvivorIndex survivorIndex) { //IL_000a: Unknown result type (might be due to invalid IL or missing references) //IL_0019: Unknown result type (might be due to invalid IL or missing references) //IL_0040: 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) if (!Main.survivorConfig.entries.TryGetValue(survivorIndex, out var value)) { Debug.LogWarning((object)$"No config entry found for SurvivorIndex: {survivorIndex}"); } else { if (!Object.op_Implicit((Object)(object)skinPanel) || !survivorSliders.TryGetValue(survivorIndex, out var value2)) { return; } foreach (KeyValuePair<string, Slider> item in value2) { string key = item.Key; Slider value3 = item.Value; if ((Object)(object)value3 == (Object)null) { Debug.LogWarning((object)$"Slider is null for SurvivorIndex: {survivorIndex}, SliderName: {key}"); continue; } switch (key) { case "Red": value3.value = value.R.Value; break; case "Green": value3.value = value.G.Value; break; case "Blue": value3.value = value.B.Value; break; default: Debug.LogWarning((object)("Unknown slider name: " + key)); break; } } Transform transform = skinPanel.transform; LayoutRebuilder.MarkLayoutForRebuild((RectTransform)(object)((transform is RectTransform) ? transform : null)); } } private void RegisterSliders(SurvivorIndex survivorIndex, Slider slider, string sliderName) { //IL_0006: 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 (survivorSliders.TryGetValue(survivorIndex, out var value)) { value[sliderName] = slider; return; } survivorSliders[survivorIndex] = new Dictionary<string, Slider> { { sliderName, slider } }; } } }