using 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 HG;
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.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: TargetFramework(".NETStandard,Version=v2.0", FrameworkDisplayName = ".NET Standard 2.0")]
[assembly: AssemblyCompany("SkinTuner")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0+26bdb203d5f24bb461be8d310a2dafdf920238ba")]
[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]
internal sealed class IsReadOnlyAttribute : Attribute
{
}
[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_000f: Unknown result type (might be due to invalid IL or missing references)
//IL_0019: Expected O, but got Unknown
CharacterMaster.AddDeployable += new hook_AddDeployable(OnDeploy);
}
public void OnDeploy(orig_AddDeployable orig, CharacterMaster self, Deployable deployable, DeployableSlot slot)
{
//IL_0004: 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_000e: 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_0012: 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_0017: Invalid comparison between Unknown and I4
//IL_0029: Unknown result type (might be due to invalid IL or missing references)
//IL_002d: Invalid comparison between Unknown and I4
//IL_0019: Unknown result type (might be due to invalid IL or missing references)
//IL_001c: Invalid comparison between Unknown and I4
//IL_0049: 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_0053: 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_005e: 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_0031: Unknown result type (might be due to invalid IL or missing references)
//IL_0035: Invalid comparison between Unknown and I4
//IL_0020: Unknown result type (might be due to invalid IL or missing references)
//IL_0023: Unknown result type (might be due to invalid IL or missing references)
//IL_0025: Invalid comparison between Unknown and I4
//IL_007b: 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_003d: Invalid comparison between Unknown and I4
//IL_0094: Unknown result type (might be due to invalid IL or missing references)
//IL_009a: Unknown result type (might be due to invalid IL or missing references)
//IL_009f: 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)
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.1.2")]
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_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_0028: 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.1.2";
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_0022: 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_0032: 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_0048: Unknown result type (might be due to invalid IL or missing references)
//IL_0054: Expected O, but got Unknown
//IL_005c: Unknown result type (might be due to invalid IL or missing references)
//IL_0066: Expected O, but got Unknown
//IL_006f: Unknown result type (might be due to invalid IL or missing references)
//IL_0079: Expected O, but got Unknown
//IL_0082: Unknown result type (might be due to invalid IL or missing references)
//IL_008c: 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_0011: 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_001c: Expected O, but got Unknown
//IL_0036: 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_0041: Expected O, but got Unknown
//IL_0057: 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: Expected O, but got Unknown
//IL_0077: Unknown result type (might be due to invalid IL or missing references)
//IL_007c: Unknown result type (might be due to invalid IL or missing references)
//IL_0082: 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_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_0028: 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_011a: 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_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_0132: Unknown result type (might be due to invalid IL or missing references)
//IL_013f: Unknown result type (might be due to invalid IL or missing references)
//IL_019a: Unknown result type (might be due to invalid IL or missing references)
//IL_01a4: Expected O, but got Unknown
//IL_01ac: Unknown result type (might be due to invalid IL or missing references)
//IL_01b6: 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_0071: Unknown result type (might be due to invalid IL or missing references)
//IL_007b: 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> val = config.Bind<float>(name, color, 255f, new ConfigDescription(text, (AcceptableValueBase)(object)range, Array.Empty<object>()));
val.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 val;
}
}
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_0003: 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);
UpdateSkinColor(bodyIndex);
}
public void OnSkinChanged(orig_SetSkinIndex orig, BodyLoadoutManager self, BodyIndex bodyIndex, uint skinIndex)
{
//IL_0003: 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)
orig.Invoke(self, bodyIndex, skinIndex);
UpdateSkinColor(bodyIndex);
}
public void UpdateSkinColor(SurvivorIndex survivorIndex, BodyIndex bodyIndex)
{
//IL_0007: 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_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_002c: 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_0050: 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_0058: Unknown result type (might be due to invalid IL or missing references)
//IL_006c: Unknown result type (might be due to invalid IL or missing references)
//IL_0073: 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: 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_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)
if (!entries.ContainsKey(survivorIndex))
{
return;
}
Color val = entries[survivorIndex];
SkinDef[] bodySkinDefs = SkinCatalog.GetBodySkinDefs(bodyIndex);
foreach (SkinDef val2 in bodySkinDefs)
{
RendererInfo[] rendererInfos = val2.rendererInfos;
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_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_0009: 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)
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_001a: Unknown result type (might be due to invalid IL or missing references)
//IL_0024: Expected O, but got Unknown
//IL_002c: Unknown result type (might be due to invalid IL or missing references)
//IL_0036: Expected O, but got Unknown
//IL_003e: Unknown result type (might be due to invalid IL or missing references)
//IL_0048: 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
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_0069: 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_00a4: Unknown result type (might be due to invalid IL or missing references)
//IL_00f8: Unknown result type (might be due to invalid IL or missing references)
orig.Invoke(self);
GameObject val = GameObject.Find("LoadoutPanel");
GameObject val2 = GameObject.Find("GenericMenuButton (Loadout)");
skinPanel = Object.Instantiate<GameObject>(val, val.transform.parent);
((Object)skinPanel).name = "SkinPanel";
GameObject val3 = Object.Instantiate<GameObject>(val2, val2.transform.parent);
((Object)val3).name = "GenericMenuButton (Skin)";
Header skinHeader = new Header
{
headerName = "Skin",
headerButton = (MPButton)(object)val3.GetComponent<HGButton>(),
headerRoot = skinPanel,
tmpHeaderText = (TextMeshProUGUI)(object)val3.GetComponentInChildren<HGTextMeshProUGUI>()
};
HGHeaderNavigationController controller = ((Component)val2.transform.parent).GetComponent<HGHeaderNavigationController>();
object value = typeof(HGHeaderNavigationController).GetField("headers").GetValue(controller);
if (value is List<Header> list)
{
list.Add(skinHeader);
}
else
{
append();
}
((MonoBehaviour)self).StartCoroutine(delay());
[MethodImpl(MethodImplOptions.NoInlining | MethodImplOptions.NoOptimization)]
void append()
{
ArrayUtils.ArrayAppend<Header>(ref controller.headers, ref skinHeader);
}
static IEnumerator delay()
{
yield return (object)new WaitForEndOfFrame();
GameObject obj = GameObject.Find("Directional Light");
Light light = ((obj != null) ? obj.GetComponent<Light>() : null);
if ((Object)(object)light != (Object)null)
{
Color white = Color.white;
Color color = light.color;
light.color = white * ((Color)(ref color)).grayscale;
}
}
}
private void RebuildLoadoutPanels(orig_Rebuild orig, LoadoutPanelController self)
{
//IL_001e: Unknown result type (might be due to invalid IL or missing references)
//IL_0023: Unknown result type (might be due to invalid IL or missing references)
//IL_002b: 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_0035: Unknown result type (might be due to invalid IL or missing references)
//IL_0076: 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_0153: Unknown result type (might be due to invalid IL or missing references)
//IL_015d: 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")
{
Dictionary<SurvivorIndex, SurvivorConfig.ColorEntry> entries = Main.survivorConfig.entries;
if (entries.TryGetValue(survivorIndex, out var value2))
{
((HorizontalOrVerticalLayoutGroup)((Component)self).GetComponent<VerticalLayoutGroup>()).childForceExpandHeight = true;
Row.FinishSetup -= setup;
Row val = Row.FromSkin(self, bodyIndex);
Transform rowPanelTransform = (Transform)(object)val.rowPanelTransform;
Transform buttonContainerTransform = (Transform)(object)val.buttonContainerTransform;
self.DestroyRows();
rows.Add(val);
Transform obj = rowPanelTransform.Find("Panel");
if (obj != null)
{
((Component)obj).gameObject.SetActive(false);
}
Transform obj2 = rowPanelTransform.Find("SlotLabel");
if (obj2 != null)
{
((Component)obj2).gameObject.SetActive(false);
}
Transform obj3 = 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_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_0028: Expected O, but got Unknown
//IL_00b5: Unknown result type (might be due to invalid IL or missing references)
//IL_00bf: Expected O, but got Unknown
//IL_0111: Unknown result type (might be due to invalid IL or missing references)
//IL_018f: Unknown result type (might be due to invalid IL or missing references)
Row val2 = new Row(self, bodyIndex, title)
{
userProfile = null
};
Transform rowPanelTransform2 = (Transform)(object)val2.rowPanelTransform;
Transform buttonContainerTransform2 = (Transform)(object)val2.buttonContainerTransform;
Transform choiceHighlightRect = (Transform)(object)val2.choiceHighlightRect;
rows.Add(val2);
((Component)rowPanelTransform2.Find("Panel")).gameObject.SetActive(false);
((Component)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 val3 = Object.Instantiate<GameObject>(sliderPrefab, buttonContainerTransform2);
val3.GetComponent<HGButton>().updateTextOnHover = false;
SettingsSlider component2 = val3.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_003c: 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_000b: 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_0049: Unknown result type (might be due to invalid IL or missing references)
//IL_009a: 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_0007: Unknown result type (might be due to invalid IL or missing references)
//IL_0027: 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 } };
}
}
}