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.Reflection.Emit;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using System.Text;
using System.Threading;
using BepInEx;
using BepInEx.Logging;
using HarmonyLib;
using Microsoft.CodeAnalysis;
using PluginConfig.API;
using PluginConfig.API.Decorators;
using PluginConfig.API.Fields;
using PluginConfig.API.Functionals;
using PluginConfig.Patches;
using PluginConfiguratorComponents;
using SettingsMenu.Components;
using TMPro;
using UnityEngine;
using UnityEngine.AddressableAssets;
using UnityEngine.EventSystems;
using UnityEngine.Events;
using UnityEngine.Networking;
using UnityEngine.ResourceManagement.AsyncOperations;
using UnityEngine.SceneManagement;
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("PluginConfigurator")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyDescription("Ultrakill mod that makes configuring mods easier")]
[assembly: AssemblyFileVersion("1.10.2.0")]
[assembly: AssemblyInformationalVersion("1.10.2+bdaaddf308f270c52f54c00fead436eba2f50ad8")]
[assembly: AssemblyProduct("PluginConfigurator")]
[assembly: AssemblyTitle("PluginConfigurator")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.10.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.Module, AllowMultiple = false, Inherited = false)]
internal sealed class RefSafetyRulesAttribute : Attribute
{
public readonly int Version;
public RefSafetyRulesAttribute(int P_0)
{
Version = P_0;
}
}
}
namespace PluginConfig
{
public static class NotificationPanel
{
private class NotificationPanelComp : MonoBehaviour
{
private void OnEnable()
{
((Component)this).transform.SetAsLastSibling();
MonoSingleton<OptionsManager>.Instance.dontUnpause = true;
}
private void OnDisable()
{
MonoSingleton<OptionsManager>.Instance.dontUnpause = false;
}
}
private class OptionsMenuListener : MonoBehaviour
{
private void OnEnable()
{
if ((Object)(object)root != (Object)null && currentNotification != null)
{
((Component)root).gameObject.SetActive(true);
}
}
}
public abstract class Notification
{
internal bool closed;
public abstract void OnUI(RectTransform panel);
public void Close()
{
if (!closed)
{
closed = true;
if (this == currentNotification)
{
CloseInternal();
}
}
}
}
internal static Queue<Notification> notificationQueue = new Queue<Notification>();
internal static Notification currentNotification = null;
private static RectTransform root;
private static Image currentBackground;
internal static void UpdateBackgroundColor()
{
//IL_0013: 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_0035: Unknown result type (might be due to invalid IL or missing references)
if (!((Object)(object)currentBackground == (Object)null))
{
Color value = PluginConfiguratorController.notificationPanelBackground.value;
value.a = PluginConfiguratorController.notificationPanelOpacity.value / 100f;
((Graphic)currentBackground).color = value;
}
}
internal static void InitUI()
{
//IL_0030: 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_0076: Unknown result type (might be due to invalid IL or missing references)
//IL_008f: 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_00c1: Unknown result type (might be due to invalid IL or missing references)
//IL_00d0: Unknown result type (might be due to invalid IL or missing references)
//IL_0103: Unknown result type (might be due to invalid IL or missing references)
//IL_0108: Unknown result type (might be due to invalid IL or missing references)
//IL_0125: Unknown result type (might be due to invalid IL or missing references)
if ((Object)(object)root == (Object)null && (Object)(object)PluginConfiguratorController.optionsMenu != (Object)null)
{
((Component)PluginConfiguratorController.optionsMenu).gameObject.AddComponent<OptionsMenuListener>();
root = new GameObject().AddComponent<RectTransform>();
((Transform)root).SetParent(PluginConfiguratorController.optionsMenu);
root.anchorMin = new Vector2(0f, 0f);
root.anchorMax = new Vector2(1f, 1f);
root.pivot = new Vector2(0f, 0f);
root.sizeDelta = new Vector2(0f, 0f);
root.anchoredPosition = new Vector2(0f, 0f);
((Transform)root).localScale = Vector3.one;
((Component)root).gameObject.AddComponent<NotificationPanelComp>();
currentBackground = ((Component)root).gameObject.AddComponent<Image>();
Color value = PluginConfiguratorController.notificationPanelBackground.value;
value.a = PluginConfiguratorController.notificationPanelOpacity.value / 100f;
((Graphic)currentBackground).color = value;
((Component)root).gameObject.AddComponent<MenuEsc>().DontClose = true;
if (currentNotification != null)
{
currentNotification.OnUI(root);
((Component)root).gameObject.SetActive(true);
}
else
{
((Component)root).gameObject.SetActive(false);
}
}
}
private static void ClearUI()
{
//IL_0026: Unknown result type (might be due to invalid IL or missing references)
if ((Object)(object)root == (Object)null)
{
return;
}
foreach (Transform item in ((Component)root).transform)
{
Object.Destroy((Object)(object)((Component)item).gameObject);
}
}
public static void Open(Notification notification)
{
if (currentNotification != null)
{
notificationQueue.Enqueue(notification);
return;
}
currentNotification = notification;
if (!((Object)(object)root == (Object)null))
{
ClearUI();
((Component)root).gameObject.SetActive(true);
currentNotification.OnUI(root);
}
}
internal static void CloseInternal()
{
ClearUI();
currentNotification = null;
while (notificationQueue.Count != 0)
{
currentNotification = notificationQueue.Dequeue();
if (!currentNotification.closed)
{
break;
}
currentNotification = null;
}
if (currentNotification != null)
{
if ((Object)(object)root != (Object)null)
{
currentNotification.OnUI(root);
((Component)root).gameObject.SetActive(true);
}
}
else if ((Object)(object)root != (Object)null)
{
((Component)root).gameObject.SetActive(false);
}
}
public static int CurrentNotificationCount()
{
return notificationQueue.Count + ((currentNotification != null) ? 1 : 0);
}
}
internal class OptionsMenuCloseListener : MonoBehaviour
{
private void OnDisable()
{
PluginConfiguratorController.FlushAllConfigs();
}
}
internal class MainPanelComponent : MonoBehaviour
{
private void OnEnable()
{
//IL_0010: Unknown result type (might be due to invalid IL or missing references)
//IL_001a: Expected O, but got Unknown
//IL_002b: Unknown result type (might be due to invalid IL or missing references)
//IL_0035: Expected O, but got Unknown
PluginConfiguratorController.activePanel = ((Component)this).gameObject;
PluginConfiguratorController.backButton.onClick = new ButtonClickedEvent();
((UnityEvent)PluginConfiguratorController.backButton.onClick).AddListener((UnityAction)delegate
{
if ((Object)(object)PluginConfiguratorController.activePanel != (Object)null && (Object)(object)PluginConfiguratorController.activePanel != (Object)(object)((Component)this).gameObject)
{
PluginConfiguratorController.activePanel.SetActive(false);
}
MonoSingleton<OptionsManager>.Instance.CloseOptions();
});
}
private void OnDisable()
{
if ((Object)(object)PluginConfiguratorController.activePanel == (Object)(object)((Component)this).gameObject)
{
PluginConfiguratorController.activePanel = null;
}
}
}
[BepInPlugin("com.eternalUnion.pluginConfigurator", "PluginConfigurator", "1.10.2")]
public class PluginConfiguratorController : BaseUnityPlugin
{
private static class TestConfigs
{
internal enum TestEnum
{
SampleText,
SecondElement,
Third
}
private class CustomImageField : CustomConfigField
{
private class ControllerComp : MonoBehaviour
{
[CompilerGenerated]
private sealed class <LoadSprite>d__0 : IEnumerator<object>, IEnumerator, IDisposable
{
private int <>1__state;
private object <>2__current;
public string url;
public CustomImageField field;
private UnityWebRequest <request>5__2;
object IEnumerator<object>.Current
{
[DebuggerHidden]
get
{
return <>2__current;
}
}
object IEnumerator.Current
{
[DebuggerHidden]
get
{
return <>2__current;
}
}
[DebuggerHidden]
public <LoadSprite>d__0(int <>1__state)
{
this.<>1__state = <>1__state;
}
[DebuggerHidden]
void IDisposable.Dispose()
{
<request>5__2 = null;
<>1__state = -2;
}
private bool MoveNext()
{
//IL_00aa: Unknown result type (might be due to invalid IL or missing references)
//IL_00af: Unknown result type (might be due to invalid IL or missing references)
switch (<>1__state)
{
default:
return false;
case 0:
<>1__state = -1;
<request>5__2 = UnityWebRequestTexture.GetTexture(url);
<>2__current = <request>5__2.SendWebRequest();
<>1__state = 1;
return true;
case 1:
<>1__state = -1;
if (<request>5__2.isNetworkError || <request>5__2.isHttpError)
{
Debug.LogError((object)("Error: " + <request>5__2.error));
}
else
{
Texture2D content = DownloadHandlerTexture.GetContent(<request>5__2);
field.sprite = Sprite.Create(content, new Rect(0f, 0f, (float)((Texture)content).width, (float)((Texture)content).height), Vector2.zero);
field.SetImageSprite();
logger.LogInfo((object)("Loaded sprite from " + url + " successfully"));
}
return false;
}
}
bool IEnumerator.MoveNext()
{
//ILSpy generated this explicit interface implementation from .override directive in MoveNext
return this.MoveNext();
}
[DebuggerHidden]
void IEnumerator.Reset()
{
throw new NotSupportedException();
}
}
[IteratorStateMachine(typeof(<LoadSprite>d__0))]
public IEnumerator LoadSprite(CustomImageField field, string url)
{
//yield-return decompiler failed: Unexpected instruction in Iterator.Dispose()
return new <LoadSprite>d__0(0)
{
field = field,
url = url
};
}
}
private Sprite sprite;
private Image currentUI;
private static ControllerComp controller;
public CustomImageField(ConfigPanel parentPanel, string url)
: base(parentPanel)
{
//IL_0014: 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_001f: Expected O, but got Unknown
if ((Object)(object)controller == (Object)null)
{
GameObject val = new GameObject();
Object.DontDestroyOnLoad((Object)val);
controller = val.AddComponent<ControllerComp>();
}
if (!string.IsNullOrWhiteSpace(url))
{
((MonoBehaviour)controller).StartCoroutine(controller.LoadSprite(this, url));
}
}
public void ReloadImage(string newUrl)
{
((MonoBehaviour)controller).StartCoroutine(controller.LoadSprite(this, newUrl));
}
protected override void OnCreateUI(RectTransform fieldUI)
{
currentUI = ((Component)fieldUI).gameObject.AddComponent<Image>();
if ((Object)(object)sprite != (Object)null)
{
SetImageSprite();
}
((Component)fieldUI).gameObject.SetActive(!base.hierarchyHidden);
}
public override void OnHiddenChange(bool selfHidden, bool hierarchyHidden)
{
if ((Object)(object)currentUI != (Object)null)
{
((Component)currentUI).gameObject.SetActive(!hierarchyHidden);
}
}
private void SetImageSprite()
{
//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_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_005a: Unknown result type (might be due to invalid IL or missing references)
if (!((Object)(object)currentUI == (Object)null) && !((Object)(object)sprite == (Object)null))
{
RectTransform component = ((Component)currentUI).GetComponent<RectTransform>();
Rect rect = sprite.rect;
float height = ((Rect)(ref rect)).height;
rect = sprite.rect;
component.sizeDelta = new Vector2(600f, 600f * (height / ((Rect)(ref rect)).width));
currentUI.sprite = sprite;
}
}
}
private class CustomRandomColorPickerField : CustomConfigValueField
{
private class RandomColorPickerComp : MonoBehaviour
{
public CustomRandomColorPickerField callback;
private void Awake()
{
//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_0012: Unknown result type (might be due to invalid IL or missing references)
//IL_0018: Expected O, but got Unknown
EventTrigger obj = ((Component)this).gameObject.AddComponent<EventTrigger>();
Entry val = new Entry
{
eventID = (EventTriggerType)4
};
((UnityEvent<BaseEventData>)(object)val.callback).AddListener((UnityAction<BaseEventData>)delegate
{
OnPointerClick();
});
obj.triggers.Add(val);
}
private void OnPointerClick()
{
//IL_0010: 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)
if (callback.hierarchyInteractable)
{
Color value = default(Color);
value.r = Random.Range(0f, 1f);
value.g = Random.Range(0f, 1f);
value.b = Random.Range(0f, 1f);
value.a = 1f;
callback.value = value;
}
}
}
private Image currentImg;
private Color _value;
private Color defaultValue;
public Color value
{
get
{
//IL_0001: Unknown result type (might be due to invalid IL or missing references)
return _value;
}
set
{
//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_0008: 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)
_value = value;
SetFieldValue(value);
if ((Object)(object)currentImg != (Object)null)
{
((Graphic)currentImg).color = value;
}
}
}
public override void OnHiddenChange(bool selfHidden, bool hierarchyHidden)
{
if ((Object)(object)currentImg != (Object)null)
{
((Component)currentImg).gameObject.SetActive(!hierarchyHidden);
}
}
private void SetFieldValue(Color c)
{
base.fieldValue = c.r.ToString(CultureInfo.InvariantCulture) + "," + c.g.ToString(CultureInfo.InvariantCulture) + "," + c.b.ToString(CultureInfo.InvariantCulture);
}
public CustomRandomColorPickerField(ConfigPanel parentPanel, string guid, Color defaultValue)
: base(parentPanel, guid)
{
//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)
//IL_0025: Unknown result type (might be due to invalid IL or missing references)
this.defaultValue = defaultValue;
if (base.fieldValue != null)
{
LoadFromString(base.fieldValue);
}
else
{
value = defaultValue;
}
}
protected override void OnCreateUI(RectTransform fieldUI)
{
//IL_0029: Unknown result type (might be due to invalid IL or missing references)
((Component)fieldUI).gameObject.AddComponent<RandomColorPickerComp>().callback = this;
currentImg = ((Component)fieldUI).gameObject.AddComponent<Image>();
((Graphic)currentImg).color = value;
((Component)currentImg).gameObject.SetActive(!base.hierarchyHidden);
}
protected override void LoadDefaultValue()
{
//IL_0002: Unknown result type (might be due to invalid IL or missing references)
value = defaultValue;
}
protected override void LoadFromString(string data)
{
//IL_001f: 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_008d: Unknown result type (might be due to invalid IL or missing references)
string[] array = data.Split(',');
if (array.Length != 3)
{
value = defaultValue;
return;
}
Color val = default(Color);
val.a = 1f;
if (float.TryParse(array[0], NumberStyles.Float, CultureInfo.InvariantCulture, out var result))
{
val.r = result;
}
if (float.TryParse(array[1], NumberStyles.Float, CultureInfo.InvariantCulture, out var result2))
{
val.g = result2;
}
if (float.TryParse(array[2], NumberStyles.Float, CultureInfo.InvariantCulture, out var result3))
{
val.b = result3;
}
value = val;
}
}
private static List<PluginConfigurator> testConfigs = new List<PluginConfigurator>();
public static void SetVisibility(bool visible)
{
foreach (PluginConfigurator testConfig in testConfigs)
{
testConfig.hidden = !visible;
}
}
public static void Init()
{
//IL_01ee: Unknown result type (might be due to invalid IL or missing references)
//IL_01f3: Unknown result type (might be due to invalid IL or missing references)
//IL_0463: Unknown result type (might be due to invalid IL or missing references)
//IL_06d8: Unknown result type (might be due to invalid IL or missing references)
PluginConfigurator pluginConfigurator = PluginConfigurator.Create("Division", "divisionTest");
testConfigs.Add(pluginConfigurator);
pluginConfigurator.saveToFile = true;
pluginConfigurator.rootPanel.onPannelOpenEvent += delegate(bool external)
{
Debug.LogError((object)$"Root panel opened, external: {external}");
};
pluginConfigurator.rootPanel.onPannelCloseEvent += delegate
{
Debug.LogError((object)"Root panel closed");
};
BoolField boolField = new BoolField(pluginConfigurator.rootPanel, "Enable div 1", "enabler1", defaultValue: true);
boolField.presetLoadPriority = 1;
BoolField boolField2 = new BoolField(pluginConfigurator.rootPanel, "Enable div 2", "enabler2", defaultValue: true);
boolField2.presetLoadPriority = 1;
BoolField boolField3 = new BoolField(pluginConfigurator.rootPanel, "Enable interacable 1", "interactable1", defaultValue: true);
boolField3.presetLoadPriority = 1;
BoolField boolField4 = new BoolField(pluginConfigurator.rootPanel, "Enable interacable 2", "interactable2", defaultValue: true);
boolField4.presetLoadPriority = 1;
ConfigDivision div1 = new ConfigDivision(pluginConfigurator.rootPanel, "div1");
new ButtonField(div1, "A Button...", "button").onClick += delegate
{
Application.OpenURL("http://www.google.com");
};
new KeyCodeField(div1, "A key", "aKey", (KeyCode)0);
ConfigPanel configPanel = new ConfigPanel(div1, "Big Button Panel", "bigButtonPanel", ConfigPanel.PanelFieldType.BigButton);
configPanel.onPannelOpenEvent += delegate(bool external)
{
Debug.LogWarning((object)$"Sub panel opened, external: {external}");
};
configPanel.onPannelCloseEvent += delegate
{
Debug.LogWarning((object)"Sub panel closed");
};
new ConfigPanel(div1, "Icon panel", "iconPanel", ConfigPanel.PanelFieldType.StandardWithBigIcon);
FormattedStringBuilder formattedStringBuilder = new FormattedStringBuilder();
formattedStringBuilder.currentFormat = new CharacterInfo
{
bold = true,
color = Color.red
};
formattedStringBuilder += "FORMATTED TEXT";
new FormattedStringField(div1, "Formatted string", "formattedString", formattedStringBuilder.Build());
new StringListField(div1, "Sample list", "strList", new string[3] { "Item 1", "2", "Item 3" }, "2");
new ConfigHeader(div1, "Division 1");
new IntField(div1, "Sample Field", "sampleField1", 0);
new StringMultilineField(div1, "Multiline edit", "strMulti", "Hello!\nThis is a sample multiline field\n\nEnter as many lines as you want!");
ConfigDivision div2 = new ConfigDivision(div1, "div2");
new ConfigHeader(div2, "Division 2");
ButtonArrayField buttonArrayField = new ButtonArrayField(div2, "buttons", 4, new float[4] { 0.25f, 0.5f, 0.125f, 0.125f }, new string[4] { "First", "Second", "Third", "Fourth" });
buttonArrayField.OnClickEventHandler(0).onClick += delegate
{
logger.LogWarning((object)"Button 1 pressed");
};
buttonArrayField.OnClickEventHandler(1).onClick += delegate
{
logger.LogWarning((object)"Button 2 pressed");
};
buttonArrayField.OnClickEventHandler(2).onClick += delegate
{
logger.LogWarning((object)"Button 3 pressed");
};
buttonArrayField.OnClickEventHandler(3).onClick += delegate
{
logger.LogWarning((object)"Button 4 pressed");
};
new BoolField(div2, "Sample Field", "sampleField2", defaultValue: true);
new ConfigPanel(div2, "SamplePanel", "samplePanel");
new FloatSliderField(div2, "Slider field", "slider", new Tuple<float, float>(0f, 100f), 50f, 2).onValueChange += delegate(FloatSliderField.FloatSliderValueChangeEvent e)
{
if (e.newValue == 20f)
{
e.newValue = 5.5f;
}
else if (e.newValue == 30f)
{
e.canceled = true;
}
};
new ColorField(div2, "Sample Color", "sampleColor", new Color(0.3f, 0.2f, 0.1f)).onValueChange += delegate(ColorField.ColorValueChangeEvent data)
{
//IL_000b: Unknown result type (might be due to invalid IL or missing references)
logger.LogDebug((object)$"New color: {data.value}");
};
EnumField<TestEnum> enumField = new EnumField<TestEnum>(div2, "Sample Enum", "sampleEnum1", TestEnum.SampleText);
enumField.SetEnumDisplayName(TestEnum.SampleText, "Sample Text");
enumField.SetEnumDisplayName(TestEnum.SecondElement, "Second Element");
enumField.SetEnumDisplayName(TestEnum.Third, "Third");
boolField.onValueChange += delegate(BoolField.BoolValueChangeEvent data)
{
div1.hidden = !data.value;
};
boolField2.onValueChange += delegate(BoolField.BoolValueChangeEvent data)
{
div2.hidden = !data.value;
};
boolField3.onValueChange += delegate(BoolField.BoolValueChangeEvent data)
{
div1.interactable = data.value;
};
boolField4.onValueChange += delegate(BoolField.BoolValueChangeEvent data)
{
div2.interactable = data.value;
};
PluginConfigurator pluginConfigurator2 = PluginConfigurator.Create("Range", "rangeTest");
testConfigs.Add(pluginConfigurator2);
pluginConfigurator2.saveToFile = false;
new IntField(pluginConfigurator2.rootPanel, "-5 to 5 near", "intrange1", 0, -5, 5, setToNearestValidValueOnUnvalidInput: true);
new IntField(pluginConfigurator2.rootPanel, "-5 to 5 invalid", "intrange2", 0, -5, 5, setToNearestValidValueOnUnvalidInput: false);
new FloatField(pluginConfigurator2.rootPanel, "-2.5 to 2.5 near", "floatrange1", 0f, -2.5f, 2.5f, setToNearestValidValueOnUnvalidInput: true);
new FloatField(pluginConfigurator2.rootPanel, "-2.5 to 2.5 invalid", "floatrange2", 0f, -2.5f, 2.5f, setToNearestValidValueOnUnvalidInput: false);
new StringField(pluginConfigurator2.rootPanel, "do not allow empty string", "stringfield1", "Test", allowEmptyValues: false);
new StringField(pluginConfigurator2.rootPanel, "allow empty string", "stringfield2", "Test", allowEmptyValues: true);
PluginConfigurator pluginConfigurator3 = PluginConfigurator.Create("Custom Fields", "customFields");
testConfigs.Add(pluginConfigurator3);
pluginConfigurator3.saveToFile = true;
new ConfigHeader(pluginConfigurator3.rootPanel, "Test Image Field:");
string defaultValue = "https://c4.wallpaperflare.com/wallpaper/981/954/357/ultrakill-red-background-v1-ultrakill-weapon-hd-wallpaper-thumb.jpg";
CustomImageField imgField = new CustomImageField(pluginConfigurator3.rootPanel, null);
StringField urlField = new StringField(pluginConfigurator3.rootPanel, "URL", "imgUrl", defaultValue, allowEmptyValues: false, saveToConfig: false);
new ButtonField(pluginConfigurator3.rootPanel, "Load Image From URL", "imgUrlLoad").onClick += delegate
{
imgField.ReloadImage(urlField.value);
};
imgField.ReloadImage(urlField.value);
new ConfigHeader(pluginConfigurator3.rootPanel, "Random Color Picker (peak laziness)", 16);
new CustomRandomColorPickerField(pluginConfigurator3.rootPanel, "randomColor", new Color(1f, 0f, 0f));
PluginConfigurator pluginConfigurator4 = PluginConfigurator.Create("Source Config", "eternalUnion.sourceConfig");
testConfigs.Add(pluginConfigurator4);
PluginConfigurator bridgedConfig = PluginConfigurator.Create("Bridged config", "eternalUnion.bridgedConfig");
testConfigs.Add(bridgedConfig);
new StringField(pluginConfigurator4.rootPanel, "Local field", "localFieldSource", "local value");
ConfigDivision parentPanel = new ConfigDivision(pluginConfigurator4.rootPanel, "LocalDiv");
ConfigPanel sourceBridgedPanel = new ConfigPanel(parentPanel, "Bridged panel", "sourceBridgedPanel");
StringField stringField = new StringField(sourceBridgedPanel, "Bridged field", "localBridgedSource", "bridged value", allowEmptyValues: true);
StringField sourceBridgeCopier = new StringField(pluginConfigurator4.rootPanel, "Bridged copier", "sourceBridgeCopier", stringField.value, allowEmptyValues: true);
sourceBridgeCopier.interactable = false;
stringField.postValueChangeEvent += delegate(string newVal)
{
sourceBridgeCopier.value = newVal;
};
ButtonField createBridgeButton = new ButtonField(bridgedConfig.rootPanel, "Create Bridge", "bridge_button");
createBridgeButton.onClick += delegate
{
createBridgeButton.hidden = true;
ConfigBridge bridge = new ConfigBridge(sourceBridgedPanel, bridgedConfig.rootPanel);
new BoolField(bridgedConfig.rootPanel, "Bridge hidden", "bridge_hidden", defaultValue: false, saveToConfig: false).postValueChangeEvent += delegate(bool newVal)
{
bridge.hidden = newVal;
};
new BoolField(bridgedConfig.rootPanel, "Bridge interactable", "bridge_interactable", defaultValue: true, saveToConfig: false).postValueChangeEvent += delegate(bool newVal)
{
bridge.interactable = newVal;
};
};
}
}
[Serializable]
[CompilerGenerated]
private sealed class <>c
{
public static readonly <>c <>9 = new <>c();
public static UnityAction <>9__16_0;
public static Func<GameObject, bool> <>9__23_2;
public static UnityAction <>9__23_5;
public static UnityAction <>9__23_4;
public static UnityAction <>9__23_1;
public static ButtonArrayField.OnClick <>9__35_0;
public static ButtonArrayField.OnClick <>9__35_1;
public static ColorField.PostColorValueChangeEvent <>9__35_2;
public static FloatSliderField.PostFloatSliderValueChangeEvent <>9__35_3;
public static BoolField.PostBoolValueChangeEvent <>9__35_5;
public static Action <>9__35_10;
public static Action<bool> <>9__35_11;
internal void <HandleUltraTweakerUI>b__16_0()
{
if ((Object)(object)activePanel != (Object)null)
{
activePanel.SetActive(false);
}
activePanel = null;
((Component)mainPanel).gameObject.SetActive(false);
}
internal bool <OnSceneLoadAsync>b__23_2(GameObject obj)
{
return ((Object)obj).name == "Canvas";
}
internal void <OnSceneLoadAsync>b__23_4()
{
//IL_002d: Unknown result type (might be due to invalid IL or missing references)
//IL_0037: Expected O, but got Unknown
//IL_0055: 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_0060: Expected O, but got Unknown
((Component)mainPanel).gameObject.SetActive(false);
if ((Object)(object)activePanel != (Object)null)
{
activePanel.SetActive(false);
}
backButton.onClick = new ButtonClickedEvent();
ButtonClickedEvent onClick = backButton.onClick;
object obj = <>9__23_5;
if (obj == null)
{
UnityAction val = delegate
{
MonoSingleton<OptionsMenuToManager>.Instance.CloseOptions();
};
<>9__23_5 = val;
obj = (object)val;
}
((UnityEvent)onClick).AddListener((UnityAction)obj);
}
internal void <OnSceneLoadAsync>b__23_5()
{
MonoSingleton<OptionsMenuToManager>.Instance.CloseOptions();
}
internal void <OnSceneLoadAsync>b__23_1()
{
if ((Object)(object)activePanel != (Object)null && (Object)(object)activePanel != (Object)(object)((Component)mainPanel).gameObject)
{
ConfigPanelComponent configPanelComponent = default(ConfigPanelComponent);
if (activePanel.TryGetComponent<ConfigPanelComponent>(ref configPanelComponent))
{
if (configPanelComponent.panel != null)
{
configPanelComponent.panel.rootConfig.FlushAll();
}
else
{
Debug.LogWarning((object)"Panel component does not have a config panel attached, could not flush");
}
}
else
{
Debug.LogWarning((object)"Could not find panel's component");
}
activePanel.SetActive(false);
}
activePanel = null;
((Component)mainPanel).gameObject.SetActive(true);
}
internal void <Awake>b__35_0()
{
Application.OpenURL(PresetOldFileManager.trashBinDir);
}
internal void <Awake>b__35_1()
{
Application.OpenURL(PresetOldFileManager.resetBinDir);
}
internal void <Awake>b__35_2(Color v)
{
NotificationPanel.UpdateBackgroundColor();
}
internal void <Awake>b__35_3(float v, Tuple<float, float> r)
{
NotificationPanel.UpdateBackgroundColor();
}
internal void <Awake>b__35_5(bool newVal)
{
TestConfigs.SetVisibility(devToggle.value && newVal);
}
internal void <Awake>b__35_10()
{
foreach (PluginConfigurator config in configs)
{
config.FlushAll();
}
}
internal void <Awake>b__35_11(bool hasFocus)
{
if (hasFocus)
{
return;
}
foreach (PluginConfigurator config in configs)
{
config.FlushAll();
}
}
}
[CompilerGenerated]
private sealed class <>c__DisplayClass23_0
{
public ButtonHighlightParent highlightParent;
public Image buttonImage;
internal void <OnSceneLoadAsync>b__0()
{
highlightParent.ChangeButton(buttonImage);
}
}
[CompilerGenerated]
private sealed class <>c__DisplayClass23_1
{
public GamepadObjectSelector goj;
internal void <OnSceneLoadAsync>b__3()
{
((Component)goj).gameObject.SetActive(false);
}
}
[CompilerGenerated]
private sealed class <OnSceneLoadAsync>d__23 : IEnumerator<object>, IEnumerator, IDisposable
{
private int <>1__state;
private object <>2__current;
public LoadSceneMode mode;
public Scene currentScene;
private <>c__DisplayClass23_0 <>8__1;
public PluginConfiguratorController <>4__this;
object IEnumerator<object>.Current
{
[DebuggerHidden]
get
{
return <>2__current;
}
}
object IEnumerator.Current
{
[DebuggerHidden]
get
{
return <>2__current;
}
}
[DebuggerHidden]
public <OnSceneLoadAsync>d__23(int <>1__state)
{
this.<>1__state = <>1__state;
}
[DebuggerHidden]
void IDisposable.Dispose()
{
<>8__1 = null;
<>1__state = -2;
}
private bool MoveNext()
{
//IL_0041: Unknown result type (might be due to invalid IL or missing references)
//IL_0047: Invalid comparison between Unknown and I4
//IL_0172: 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_01d6: Unknown result type (might be due to invalid IL or missing references)
//IL_01e0: Expected O, but got Unknown
//IL_01e9: Unknown result type (might be due to invalid IL or missing references)
//IL_01ee: Unknown result type (might be due to invalid IL or missing references)
//IL_0360: Unknown result type (might be due to invalid IL or missing references)
//IL_0331: Unknown result type (might be due to invalid IL or missing references)
//IL_0336: Unknown result type (might be due to invalid IL or missing references)
//IL_033c: Expected O, but got Unknown
//IL_02b5: Unknown result type (might be due to invalid IL or missing references)
//IL_02bf: Expected O, but got Unknown
//IL_02ec: Unknown result type (might be due to invalid IL or missing references)
//IL_02f1: Unknown result type (might be due to invalid IL or missing references)
//IL_02f7: Expected O, but got Unknown
int num = <>1__state;
PluginConfiguratorController pluginConfiguratorController = <>4__this;
switch (num)
{
default:
return false;
case 0:
<>1__state = -1;
<>8__1 = new <>c__DisplayClass23_0();
<>2__current = null;
<>1__state = 1;
return true;
case 1:
{
<>1__state = -1;
if ((int)mode == 1)
{
return false;
}
if ((Object)(object)mainPanel != (Object)null)
{
return false;
}
GameObject val = null;
foreach (GameObject item in from obj in ((Scene)(ref currentScene)).GetRootGameObjects()
where ((Object)obj).name == "Canvas"
select obj)
{
optionsMenu = item.transform.Find("OptionsMenu");
if (!((Object)(object)optionsMenu == (Object)null))
{
val = item;
}
}
if ((Object)(object)val == (Object)null)
{
return false;
}
((Component)optionsMenu).gameObject.AddComponent<OptionsMenuCloseListener>();
Transform val2 = ((Component)optionsMenu).transform.Find("Text");
if ((Object)(object)val2 != (Object)null)
{
Object.Destroy((Object)(object)((Component)val2).gameObject);
}
Transform val3 = ((Component)optionsMenu).transform.Find("Navigation Rail");
Transform val4 = ((Component)optionsMenu).transform.Find("Pages");
backButton = ((Component)((Component)optionsMenu).transform.Find("Navigation Rail/Back")).GetComponent<Button>();
GameObject val5 = Addressables.InstantiateAsync((object)"PluginConfigurator/PluginConfiguratorButton.prefab", val3, false, true).WaitForCompletion();
val5.SetActive(true);
Button component = val5.GetComponent<Button>();
val5.transform.SetSiblingIndex(0);
<>8__1.buttonImage = val5.GetComponent<Image>();
<>8__1.highlightParent = ((Component)val3).GetComponent<ButtonHighlightParent>();
((UnityEvent)component.onClick).AddListener((UnityAction)delegate
{
<>8__1.highlightParent.ChangeButton(<>8__1.buttonImage);
});
mainPanel = Addressables.InstantiateAsync((object)"PluginConfigurator/Fields/ConcretePanel.prefab", val4, false, true).WaitForCompletion().GetComponent<ConfigPanelConcrete>();
((Component)mainPanel).gameObject.AddComponent<MainPanelComponent>();
((TMP_Text)mainPanel.header).text = "--PLUGIN CONFIGURATOR--";
((Component)mainPanel).gameObject.SetActive(false);
((Component)mainPanel).GetComponent<GamepadObjectSelector>();
Button val6 = default(Button);
foreach (Transform item2 in UnityUtils.GetChilds(val4).Concat(UnityUtils.GetChilds(val3)))
{
<>c__DisplayClass23_1 CS$<>8__locals0 = new <>c__DisplayClass23_1();
if ((Object)(object)item2 == (Object)(object)((Component)mainPanel).transform || (Object)(object)item2 == (Object)(object)val5.transform)
{
continue;
}
if (((Component)item2).gameObject.TryGetComponent<GamepadObjectSelector>(ref CS$<>8__locals0.goj))
{
((UnityEvent)component.onClick).AddListener((UnityAction)delegate
{
((Component)CS$<>8__locals0.goj).gameObject.SetActive(false);
});
}
else
{
if (!((Component)item2).gameObject.TryGetComponent<Button>(ref val6))
{
continue;
}
ButtonClickedEvent onClick = val6.onClick;
object obj2 = <>c.<>9__23_4;
if (obj2 == null)
{
UnityAction val7 = delegate
{
//IL_002d: Unknown result type (might be due to invalid IL or missing references)
//IL_0037: Expected O, but got Unknown
//IL_0055: 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_0060: Expected O, but got Unknown
((Component)mainPanel).gameObject.SetActive(false);
if ((Object)(object)activePanel != (Object)null)
{
activePanel.SetActive(false);
}
backButton.onClick = new ButtonClickedEvent();
ButtonClickedEvent onClick3 = backButton.onClick;
object obj4 = <>c.<>9__23_5;
if (obj4 == null)
{
UnityAction val9 = delegate
{
MonoSingleton<OptionsMenuToManager>.Instance.CloseOptions();
};
<>c.<>9__23_5 = val9;
obj4 = (object)val9;
}
((UnityEvent)onClick3).AddListener((UnityAction)obj4);
};
<>c.<>9__23_4 = val7;
obj2 = (object)val7;
}
((UnityEvent)onClick).AddListener((UnityAction)obj2);
}
}
ButtonClickedEvent onClick2 = component.onClick;
object obj3 = <>c.<>9__23_1;
if (obj3 == null)
{
UnityAction val8 = delegate
{
if ((Object)(object)activePanel != (Object)null && (Object)(object)activePanel != (Object)(object)((Component)mainPanel).gameObject)
{
ConfigPanelComponent configPanelComponent = default(ConfigPanelComponent);
if (activePanel.TryGetComponent<ConfigPanelComponent>(ref configPanelComponent))
{
if (configPanelComponent.panel != null)
{
configPanelComponent.panel.rootConfig.FlushAll();
}
else
{
Debug.LogWarning((object)"Panel component does not have a config panel attached, could not flush");
}
}
else
{
Debug.LogWarning((object)"Could not find panel's component");
}
activePanel.SetActive(false);
}
activePanel = null;
((Component)mainPanel).gameObject.SetActive(true);
};
<>c.<>9__23_1 = val8;
obj3 = (object)val8;
}
((UnityEvent)onClick2).AddListener((UnityAction)obj3);
pluginConfiguratorController.CreateConfigUI(optionsMenu);
mainPanel.rect.normalizedPosition = new Vector2(0f, 1f);
NotificationPanel.InitUI();
return false;
}
}
}
bool IEnumerator.MoveNext()
{
//ILSpy generated this explicit interface implementation from .override directive in MoveNext
return this.MoveNext();
}
[DebuggerHidden]
void IEnumerator.Reset()
{
throw new NotSupportedException();
}
}
[CompilerGenerated]
private sealed class <loadObjectAsync>d__21 : IEnumerator<object>, IEnumerator, IDisposable
{
private int <>1__state;
private object <>2__current;
public Transform panel;
private AsyncOperationHandle<GameObject> <pluginConfigObj>5__2;
object IEnumerator<object>.Current
{
[DebuggerHidden]
get
{
return <>2__current;
}
}
object IEnumerator.Current
{
[DebuggerHidden]
get
{
return <>2__current;
}
}
[DebuggerHidden]
public <loadObjectAsync>d__21(int <>1__state)
{
this.<>1__state = <>1__state;
}
[DebuggerHidden]
void IDisposable.Dispose()
{
//IL_0006: Unknown result type (might be due to invalid IL or missing references)
<pluginConfigObj>5__2 = default(AsyncOperationHandle<GameObject>);
<>1__state = -2;
}
private bool MoveNext()
{
//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_0031: 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)
switch (<>1__state)
{
default:
return false;
case 0:
<>1__state = -1;
<pluginConfigObj>5__2 = Addressables.InstantiateAsync((object)"PluginConfigurator/PluginConfiguratorButton.prefab", panel, false, true);
<>2__current = <pluginConfigObj>5__2;
<>1__state = 1;
return true;
case 1:
<>1__state = -1;
logger.LogInfo((object)"Load object status:");
logger.LogInfo((object)<pluginConfigObj>5__2.Status);
return false;
}
}
bool IEnumerator.MoveNext()
{
//ILSpy generated this explicit interface implementation from .override directive in MoveNext
return this.MoveNext();
}
[DebuggerHidden]
void IEnumerator.Reset()
{
throw new NotSupportedException();
}
}
public static ManualLogSource logger;
public const string PLUGIN_NAME = "PluginConfigurator";
public const string PLUGIN_GUID = "com.eternalUnion.pluginConfigurator";
public const string PLUGIN_VERSION = "1.10.2";
private const string ASSET_PATH_CONFIG_BUTTON = "PluginConfigurator/PluginConfiguratorButton.prefab";
private const string ASSET_PATH_CONFIG_MENU = "PluginConfigurator/PluginConfigField.prefab";
private const string ASSET_PATH_CONFIG_PANEL = "PluginConfigurator/Fields/ConcretePanel.prefab";
public static string workingPath;
public static string workingDir;
public static string catalogPath;
internal static List<PluginConfigurator> configs = new List<PluginConfigurator>();
internal static Transform optionsMenu;
internal static ConfigPanelConcrete mainPanel;
internal static GameObject activePanel;
internal static Button backButton;
internal static Harmony configuratorPatches;
internal static PluginConfigurator config;
internal static BoolField patchCheatKeys;
internal static BoolField patchPause;
internal static BoolField cancelOnEsc;
internal static BoolField devToggle;
internal static BoolField devConfigs;
internal static ColorField notificationPanelBackground;
internal static FloatSliderField notificationPanelOpacity;
internal static Sprite defaultPluginIcon;
internal static void RegisterConfigurator(PluginConfigurator config)
{
configs.Add(config);
}
public static bool ConfigExists(string guid)
{
return configs.Where((PluginConfigurator c) => c.guid == guid).FirstOrDefault() != null;
}
public static PluginConfigurator GetConfig(string guid)
{
return configs.Where((PluginConfigurator c) => c.guid == guid).FirstOrDefault();
}
public static void FlushAllConfigs()
{
foreach (PluginConfigurator config in configs)
{
config.FlushAll();
}
}
private void CreateConfigUI(Transform optionsMenu)
{
//IL_0029: Unknown result type (might be due to invalid IL or missing references)
//IL_002e: Unknown result type (might be due to invalid IL or missing references)
foreach (PluginConfigurator config in configs)
{
try
{
GameObject obj = Addressables.InstantiateAsync((object)"PluginConfigurator/PluginConfigField.prefab", mainPanel.content, false, true).WaitForCompletion();
ConfigPluginMenuField component = obj.GetComponent<ConfigPluginMenuField>();
((TMP_Text)component.name).text = config.displayName;
component.icon.sprite = config.image ?? defaultPluginIcon;
config.configMenu = component;
obj.SetActive(!config.hidden);
((Selectable)component.button).interactable = config.interactable;
config.CreateUI(component.button, optionsMenu);
}
catch (Exception arg)
{
Debug.LogError((object)$"Error while creating ui for {config.guid}: {arg}");
}
}
}
private static void HandleUltraTweakerUI(GameObject ___newBtn)
{
//IL_003f: 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_0025: Unknown result type (might be due to invalid IL or missing references)
//IL_002b: Expected O, but got Unknown
Button component = ___newBtn.GetComponent<Button>();
ButtonClickedEvent onClick = component.onClick;
object obj = <>c.<>9__16_0;
if (obj == null)
{
UnityAction val = delegate
{
if ((Object)(object)activePanel != (Object)null)
{
activePanel.SetActive(false);
}
activePanel = null;
((Component)mainPanel).gameObject.SetActive(false);
};
<>c.<>9__16_0 = val;
obj = (object)val;
}
((UnityEvent)onClick).AddListener((UnityAction)obj);
((Component)component).GetComponent<RectTransform>().anchoredPosition = new Vector2(30f, 330f);
}
[IteratorStateMachine(typeof(<loadObjectAsync>d__21))]
private IEnumerator loadObjectAsync(Transform panel)
{
//yield-return decompiler failed: Unexpected instruction in Iterator.Dispose()
return new <loadObjectAsync>d__21(0)
{
panel = panel
};
}
private void OnSceneLoad(Scene currentScene, LoadSceneMode mode)
{
//IL_0002: 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)
((MonoBehaviour)this).StartCoroutine(OnSceneLoadAsync(currentScene, mode));
}
[IteratorStateMachine(typeof(<OnSceneLoadAsync>d__23))]
private IEnumerator OnSceneLoadAsync(Scene currentScene, LoadSceneMode mode)
{
//IL_000e: Unknown result type (might be due to invalid IL or missing references)
//IL_000f: 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)
//yield-return decompiler failed: Unexpected instruction in Iterator.Dispose()
return new <OnSceneLoadAsync>d__23(0)
{
<>4__this = this,
currentScene = currentScene,
mode = mode
};
}
private void Awake()
{
//IL_0069: Unknown result type (might be due to invalid IL or missing references)
//IL_006e: 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_008d: 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_00a0: Unknown result type (might be due to invalid IL or missing references)
//IL_00b2: Unknown result type (might be due to invalid IL or missing references)
//IL_00bc: Expected O, but got Unknown
//IL_01a9: Unknown result type (might be due to invalid IL or missing references)
//IL_022b: Unknown result type (might be due to invalid IL or missing references)
//IL_028e: Unknown result type (might be due to invalid IL or missing references)
//IL_02ac: Unknown result type (might be due to invalid IL or missing references)
//IL_0379: Unknown result type (might be due to invalid IL or missing references)
//IL_04c9: Unknown result type (might be due to invalid IL or missing references)
//IL_04d6: Expected O, but got Unknown
//IL_04f2: Unknown result type (might be due to invalid IL or missing references)
//IL_04fe: Expected O, but got Unknown
((Object)((Component)this).gameObject).hideFlags = (HideFlags)61;
Thread.CurrentThread.CurrentCulture = CultureInfo.InvariantCulture;
logger = ((BaseUnityPlugin)this).Logger;
workingPath = Assembly.GetExecutingAssembly().Location;
workingDir = Path.GetDirectoryName(workingPath);
catalogPath = Path.Combine(workingDir, "Assets");
PresetOldFileManager.Init();
PresetOldFileManager.CheckForOldFiles();
Addressables.InitializeAsync().WaitForCompletion();
Addressables.LoadContentCatalogAsync(Path.Combine(catalogPath, "catalog.json"), true, (string)null).WaitForCompletion();
defaultPluginIcon = Addressables.LoadAssetAsync<Sprite>((object)"PluginConfigurator/Textures/default-icon.png").WaitForCompletion();
configuratorPatches = new Harmony("com.eternalUnion.pluginConfigurator");
config = PluginConfigurator.Create("Plugin Configurator", "com.eternalUnion.pluginConfigurator");
config.SetIconWithURL(Path.Combine(workingDir, "icon.png"));
ButtonArrayField buttonArrayField = new ButtonArrayField(config.rootPanel, "binButtons", 2, new float[2] { 0.5f, 0.5f }, new string[2] { "Deleted Presets Folder", "Reset Presets Folder" });
buttonArrayField.OnClickEventHandler(0).onClick += delegate
{
Application.OpenURL(PresetOldFileManager.trashBinDir);
};
buttonArrayField.OnClickEventHandler(1).onClick += delegate
{
Application.OpenURL(PresetOldFileManager.resetBinDir);
};
new ConfigHeader(config.rootPanel, "Patches").textColor = new Color(50f / 51f, 32f / 51f, 32f / 51f);
patchCheatKeys = new BoolField(config.rootPanel, "Patch cheat keys", "cheatKeyPatch", defaultValue: true);
patchPause = new BoolField(config.rootPanel, "Patch unpause", "unpausePatch", defaultValue: true);
new ConfigSpace(config.rootPanel, 10f);
new ConfigHeader(config.rootPanel, "Behaviour").textColor = new Color(50f / 51f, 32f / 51f, 32f / 51f);
cancelOnEsc = new BoolField(config.rootPanel, "Cancel on ESC", "cancelOnEsc", defaultValue: false);
new ConfigSpace(config.rootPanel, 10f);
new ConfigHeader(config.rootPanel, "Notification Panel").textColor = new Color(50f / 51f, 32f / 51f, 32f / 51f);
notificationPanelBackground = new ColorField(config.rootPanel, "Background color", "notificationPanelBg", Color.black);
notificationPanelBackground.postValueChangeEvent += delegate
{
NotificationPanel.UpdateBackgroundColor();
};
notificationPanelOpacity = new FloatSliderField(config.rootPanel, "Opacity", "notificationPanelAlpha", new Tuple<float, float>(0f, 100f), 89.64f);
notificationPanelOpacity.postValueChangeEvent += delegate
{
NotificationPanel.UpdateBackgroundColor();
};
new ConfigSpace(config.rootPanel, 10f);
new ConfigHeader(config.rootPanel, "Developer Stuff").textColor = new Color(0.5372549f, 69f / 85f, 0.9411765f);
devToggle = new BoolField(config.rootPanel, "Enable developer features", "devToggle", defaultValue: false);
ConfigDivision devDiv = new ConfigDivision(config.rootPanel, "devDiv");
devToggle.postValueChangeEvent += delegate(bool newVal)
{
devDiv.hidden = !newVal;
TestConfigs.SetVisibility(devConfigs.value && newVal);
};
devConfigs = new BoolField(devDiv, "Config tests", "configTestToggle", defaultValue: false);
devConfigs.postValueChangeEvent += delegate(bool newVal)
{
TestConfigs.SetVisibility(devToggle.value && newVal);
};
TestConfigs.Init();
devToggle.TriggerPostValueChangeEvent();
((BaseUnityPlugin)this).Logger.LogInfo((object)("Working path: " + workingPath + ", Working dir: " + workingDir));
patchCheatKeys.onValueChange += CheatKeyListener;
if (patchCheatKeys.value)
{
CheatKeyListener(new BoolField.BoolValueChangeEvent
{
value = true
});
}
patchPause.onValueChange += UnpauseListener;
if (patchPause.value)
{
UnpauseListener(new BoolField.BoolValueChangeEvent
{
value = true
});
}
configuratorPatches.Patch((MethodBase)GetInstanceMethod<SettingsMenu>("Start"), (HarmonyMethod)null, new HarmonyMethod(GetStaticMethod<MenuFinderPatch>("Postfix")), (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null);
configuratorPatches.Patch((MethodBase)GetInstanceMethod<MenuEsc>("Update"), (HarmonyMethod)null, (HarmonyMethod)null, new HarmonyMethod(GetStaticMethod<MenuEscPatch>("FixNullExcpCausedByUncheckedField")), (HarmonyMethod)null, (HarmonyMethod)null);
config.FlushAll();
SceneManager.sceneLoaded += OnSceneLoad;
Application.quitting += delegate
{
foreach (PluginConfigurator config in configs)
{
config.FlushAll();
}
};
Application.focusChanged += delegate(bool hasFocus)
{
if (!hasFocus)
{
foreach (PluginConfigurator config2 in configs)
{
config2.FlushAll();
}
}
};
((BaseUnityPlugin)this).Logger.LogInfo((object)"Plugin com.eternalUnion.pluginConfigurator is loaded!");
static void CheatKeyListener(BoolField.BoolValueChangeEvent data)
{
//IL_0021: Unknown result type (might be due to invalid IL or missing references)
//IL_002f: Expected O, but got Unknown
if (data.value)
{
configuratorPatches.Patch((MethodBase)GetInstanceMethod<CheatsManager>("HandleCheatBind"), new HarmonyMethod(GetStaticMethod<HandleCheatBindPatch>("Prefix")), (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null);
}
else
{
configuratorPatches.Unpatch((MethodBase)GetInstanceMethod<CheatsManager>("HandleCheatBind"), GetStaticMethod<HandleCheatBindPatch>("Prefix"));
}
}
static MethodInfo GetInstanceMethod<T>(string name)
{
return typeof(T).GetMethod(name, BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic);
}
static MethodInfo GetStaticMethod<T>(string name)
{
return typeof(T).GetMethod(name, BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic);
}
static void UnpauseListener(BoolField.BoolValueChangeEvent data)
{
//IL_0021: Unknown result type (might be due to invalid IL or missing references)
//IL_002f: Expected O, but got Unknown
//IL_0049: Unknown result type (might be due to invalid IL or missing references)
//IL_0057: Expected O, but got Unknown
if (data.value)
{
configuratorPatches.Patch((MethodBase)GetInstanceMethod<OptionsManager>("UnPause"), new HarmonyMethod(GetStaticMethod<UnpausePatch>("Prefix")), (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null);
configuratorPatches.Patch((MethodBase)GetInstanceMethod<OptionsManager>("CloseOptions"), new HarmonyMethod(GetStaticMethod<CloseOptionsPatch>("Prefix")), (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null);
}
else
{
configuratorPatches.Unpatch((MethodBase)GetInstanceMethod<OptionsManager>("UnPause"), GetStaticMethod<UnpausePatch>("Prefix"));
configuratorPatches.Unpatch((MethodBase)GetInstanceMethod<OptionsManager>("CloseOptions"), GetStaticMethod<CloseOptionsPatch>("Prefix"));
}
}
}
private void OnDestroy()
{
//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_002c: 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)
Scene val = SceneManager.GetActiveScene();
Debug.LogError((object)("Plugin configurator controller instance destroyed in scene '" + ((Scene)(ref val)).name + "'"));
val = ((Component)this).gameObject.scene;
Debug.LogError((object)("Plugin was in scene '" + ((Scene)(ref val)).name + "'"));
Debug.LogError((object)("Object name was '" + ((Object)((Component)this).gameObject).name + "'"));
}
}
public static class UnityUtils
{
[CompilerGenerated]
private sealed class <GetComponentsInChildrenRecursively>d__2<T> : IEnumerable<T>, IEnumerable, IEnumerator<T>, IEnumerator, IDisposable
{
private int <>1__state;
private T <>2__current;
private int <>l__initialThreadId;
private Transform obj;
public Transform <>3__obj;
private IEnumerator <>7__wrap1;
private Transform <child>5__3;
private IEnumerator<T> <>7__wrap3;
T IEnumerator<T>.Current
{
[DebuggerHidden]
get
{
return <>2__current;
}
}
object IEnumerator.Current
{
[DebuggerHidden]
get
{
return <>2__current;
}
}
[DebuggerHidden]
public <GetComponentsInChildrenRecursively>d__2(int <>1__state)
{
this.<>1__state = <>1__state;
<>l__initialThreadId = Environment.CurrentManagedThreadId;
}
[DebuggerHidden]
void IDisposable.Dispose()
{
int num = <>1__state;
if ((uint)(num - -4) <= 1u || (uint)(num - 1) <= 1u)
{
try
{
if (num == -4 || num == 2)
{
try
{
}
finally
{
<>m__Finally2();
}
}
}
finally
{
<>m__Finally1();
}
}
<>7__wrap1 = null;
<child>5__3 = null;
<>7__wrap3 = null;
<>1__state = -2;
}
private bool MoveNext()
{
//IL_0051: Unknown result type (might be due to invalid IL or missing references)
//IL_005b: Expected O, but got Unknown
try
{
switch (<>1__state)
{
default:
return false;
case 0:
<>1__state = -1;
<>7__wrap1 = obj.GetEnumerator();
<>1__state = -3;
goto IL_00f8;
case 1:
<>1__state = -3;
goto IL_0091;
case 2:
{
<>1__state = -4;
goto IL_00d7;
}
IL_00f8:
if (<>7__wrap1.MoveNext())
{
<child>5__3 = (Transform)<>7__wrap1.Current;
T component = ((Component)<child>5__3).gameObject.GetComponent<T>();
if (component != null)
{
<>2__current = component;
<>1__state = 1;
return true;
}
goto IL_0091;
}
<>m__Finally1();
<>7__wrap1 = null;
return false;
IL_0091:
<>7__wrap3 = GetComponentsInChildrenRecursively<T>(<child>5__3).GetEnumerator();
<>1__state = -4;
goto IL_00d7;
IL_00d7:
if (<>7__wrap3.MoveNext())
{
T current = <>7__wrap3.Current;
<>2__current = current;
<>1__state = 2;
return true;
}
<>m__Finally2();
<>7__wrap3 = null;
<child>5__3 = null;
goto IL_00f8;
}
}
catch
{
//try-fault
((IDisposable)this).Dispose();
throw;
}
}
bool IEnumerator.MoveNext()
{
//ILSpy generated this explicit interface implementation from .override directive in MoveNext
return this.MoveNext();
}
private void <>m__Finally1()
{
<>1__state = -1;
if (<>7__wrap1 is IDisposable disposable)
{
disposable.Dispose();
}
}
private void <>m__Finally2()
{
<>1__state = -3;
if (<>7__wrap3 != null)
{
<>7__wrap3.Dispose();
}
}
[DebuggerHidden]
void IEnumerator.Reset()
{
throw new NotSupportedException();
}
[DebuggerHidden]
IEnumerator<T> IEnumerable<T>.GetEnumerator()
{
<GetComponentsInChildrenRecursively>d__2<T> <GetComponentsInChildrenRecursively>d__;
if (<>1__state == -2 && <>l__initialThreadId == Environment.CurrentManagedThreadId)
{
<>1__state = 0;
<GetComponentsInChildrenRecursively>d__ = this;
}
else
{
<GetComponentsInChildrenRecursively>d__ = new <GetComponentsInChildrenRecursively>d__2<T>(0);
}
<GetComponentsInChildrenRecursively>d__.obj = <>3__obj;
return <GetComponentsInChildrenRecursively>d__;
}
[DebuggerHidden]
IEnumerator IEnumerable.GetEnumerator()
{
return ((IEnumerable<T>)this).GetEnumerator();
}
}
public static void PrintGameobject(GameObject o, int iters = 0)
{
//IL_0045: Unknown result type (might be due to invalid IL or missing references)
string text = "";
for (int i = 0; i < iters; i++)
{
text += "|";
}
text += ((Object)o).name;
Debug.Log((object)text);
foreach (Transform item in o.transform)
{
PrintGameobject(((Component)item).gameObject, iters + 1);
}
}
public static IEnumerable<Transform> GetChilds(Transform obj)
{
return (from i in Enumerable.Range(0, obj.childCount)
select obj.GetChild(i)).ToArray().AsEnumerable();
}
[IteratorStateMachine(typeof(<GetComponentsInChildrenRecursively>d__2<>))]
public static IEnumerable<T> GetComponentsInChildrenRecursively<T>(Transform obj)
{
//yield-return decompiler failed: Unexpected instruction in Iterator.Dispose()
return new <GetComponentsInChildrenRecursively>d__2<T>(-2)
{
<>3__obj = obj
};
}
public static T GetComponentInChildrenRecursively<T>(Transform obj)
{
//IL_000f: Unknown result type (might be due to invalid IL or missing references)
//IL_0015: Expected O, but got Unknown
foreach (Transform item in obj)
{
Transform val = item;
if (!((Object)(object)val == (Object)(object)obj))
{
T component = ((Component)val).gameObject.GetComponent<T>();
if (component != null)
{
return component;
}
component = GetComponentInChildrenRecursively<T>(val);
if (component != null)
{
return component;
}
}
}
return default(T);
}
}
public static class PluginInfo
{
public const string PLUGIN_GUID = "PluginConfigurator";
public const string PLUGIN_NAME = "PluginConfigurator";
public const string PLUGIN_VERSION = "1.10.2";
}
}
namespace PluginConfig.Patches
{
[HarmonyPatch(typeof(CheatsManager), "HandleCheatBind")]
public class HandleCheatBindPatch
{
public static bool Prefix(CheatsManager __instance)
{
if (((Object)(object)MenuFinderPatch.pauseMenu != (Object)null && ((Component)MenuFinderPatch.pauseMenu).gameObject.activeInHierarchy) || ((Object)(object)MenuFinderPatch.optionsMenu != (Object)null && ((Component)MenuFinderPatch.optionsMenu).gameObject.activeInHierarchy))
{
return false;
}
return true;
}
}
[HarmonyPatch(typeof(MenuEsc))]
public class MenuEscPatch
{
public static MethodInfo vm_UnityEngine_UI_Selectable_Select = (from m in typeof(Selectable).GetMethods()
where m.IsVirtual && !m.IsStatic && m.Name == "Select"
select m).FirstOrDefault();
public static MethodInfo sm_MenuEscPatch_HandleField = typeof(MenuEscPatch).GetMethod("HandleField", BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic);
public static void HandleField(Selectable field)
{
if ((Object)(object)field != (Object)null)
{
field.Select();
}
else
{
EventSystem.current.SetSelectedGameObject((GameObject)null);
}
}
[HarmonyTranspiler]
[HarmonyPatch("Update")]
public static IEnumerable<CodeInstruction> FixNullExcpCausedByUncheckedField(IEnumerable<CodeInstruction> inst)
{
List<CodeInstruction> list = inst.ToList();
for (int i = 0; i < list.Count; i++)
{
if (list[i].opcode == OpCodes.Callvirt && CodeInstructionExtensions.OperandIs(list[i], (MemberInfo)vm_UnityEngine_UI_Selectable_Select))
{
list[i].opcode = OpCodes.Call;
list[i].operand = sm_MenuEscPatch_HandleField;
}
}
return list.AsEnumerable();
}
}
public class MenuFinderPatch
{
public static Transform pauseMenu;
public static Transform optionsMenu;
public static void Postfix(SettingsMenu __instance)
{
//IL_0000: Unknown result type (might be due to invalid IL or missing references)
//IL_0005: Unknown result type (might be due to invalid IL or missing references)
Scene activeScene = SceneManager.GetActiveScene();
GameObject val = (from obj in ((Scene)(ref activeScene)).GetRootGameObjects()
where ((Object)obj).name == "Canvas"
select obj).FirstOrDefault();
if (!((Object)(object)val == (Object)null))
{
pauseMenu = val.transform.Find("PauseMenu");
optionsMenu = val.transform.Find("OptionsMenu");
}
}
}
[HarmonyPatch(typeof(OptionsManager), "CloseOptions")]
public class CloseOptionsPatch
{
private static bool Prefix(OptionsManager __instance)
{
if ((Object)(object)PluginConfiguratorController.activePanel == (Object)null || !PluginConfiguratorController.activePanel.activeSelf)
{
return true;
}
if ((Object)(object)PluginConfiguratorController.activePanel != (Object)null && (Object)(object)PluginConfiguratorController.activePanel != (Object)(object)((Component)PluginConfiguratorController.mainPanel).gameObject)
{
return false;
}
return true;
}
}
[HarmonyPatch(typeof(OptionsManager), "UnPause")]
public class UnpausePatch
{
private static bool Prefix(OptionsManager __instance)
{
if ((Object)(object)MenuFinderPatch.optionsMenu != (Object)null && ((Component)MenuFinderPatch.optionsMenu).gameObject.activeInHierarchy)
{
return false;
}
return true;
}
}
}
namespace PluginConfig.API
{
public class ConfigBridge : ConfigField
{
public readonly ConfigField targetField;
public override string displayName
{
get
{
return targetField.displayName;
}
set
{
if (targetField != null)
{
targetField.displayName = value;
}
}
}
public override bool hidden
{
get
{
return targetField.hidden;
}
set
{
if (targetField != null)
{
targetField.hidden = value;
}
}
}
public override bool interactable
{
get
{
return targetField.interactable;
}
set
{
if (targetField != null)
{
targetField.interactable = value;
}
}
}
public ConfigBridge(ConfigField targetField, ConfigPanel parentPanel)
: base(targetField.displayName, "bridge_" + targetField.guid, parentPanel)
{
base.strictGuid = false;
if (targetField == null)
{
throw new NullReferenceException("Target field cannot be null");
}
if (targetField.bridged)
{
throw new ArgumentException("Tried to create config bridge but target field " + targetField.guid + " is already connected to another config bridge");
}
if (targetField.parentPanel == null)
{
throw new ArgumentException("Root panels cannot be bridged");
}
if (targetField.parentPanel == targetField)
{
throw new ArgumentException("Panels cannot be bridged to themselves");
}
this.targetField = targetField;
DestroyFieldUI(targetField);
Stack<ConfigPanel> stack = new Stack<ConfigPanel>();
if (targetField is ConfigPanel item)
{
stack.Push(item);
}
while (stack.Count != 0)
{
ConfigPanel configPanel = stack.Pop();
configPanel.fieldsCreated = false;
if ((Object)(object)configPanel.currentPanel != (Object)null)
{
Object.Destroy((Object)(object)((Component)configPanel.currentPanel).gameObject);
}
foreach (ConfigField field in configPanel.fields)
{
if (field is ConfigPanel item2)
{
stack.Push(item2);
}
}
}
targetField.bridged = true;
targetField.bridge = this;
parentPanel.Register(this);
static void DestroyFieldUI(ConfigField field)
{
ConfigPanel configPanel2 = field.parentPanel;
if (configPanel2.fieldsCreated)
{
int num = configPanel2.fields.IndexOf(field);
if (num != -1)
{
foreach (Transform item3 in configPanel2.fieldObjects[num])
{
Object.Destroy((Object)(object)((Component)item3).gameObject);
}
}
}
}
}
protected internal override GameObject CreateUI(Transform content)
{
return targetField.CreateUI(content);
}
internal override void ReloadDefault()
{
throw new NotImplementedException();
}
internal override void ReloadFromString(string data)
{
throw new NotImplementedException();
}
}
internal class ConfigDivisionComp : UIBehaviour
{
public ConfigDivision div;
public bool dirty;
public override void OnRectTransformDimensionsChange()
{
((UIBehaviour)this).OnRectTransformDimensionsChange();
div.RecalculateLayout();
}
public override void OnEnable()
{
div.RecalculateLayout();
}
public override void OnDisable()
{
div.RecalculateLayout();
}
public void Update()
{
if (dirty)
{
dirty = false;
div.RecalculateLayout();
}
}
}
public class ConfigDivision : ConfigPanel
{
public const string ASSET_PATH = "PluginConfigurator/Fields/VirtualPanel.prefab";
internal ConfigPanelVirtual currentVirtualPanel;
internal ConfigDivisionComp currentDivComp;
public override string displayName { get; set; }
public override bool hidden
{
get
{
return base.hidden;
}
set
{
base.hidden = value;
if ((Object)(object)currentVirtualPanel != (Object)null)
{
((Component)currentVirtualPanel).gameObject.SetActive(!hidden && !base.parentHidden);
}
foreach (ConfigField field in fields)
{
field.parentHidden = value || hidden || base.parentHidden;
}
}
}
public override bool interactable
{
get
{
return base.interactable;
}
set
{
base.interactable = value;
foreach (ConfigField field in fields)
{
field.parentInteractable = value && interactable && base.parentInteractable;
}
}
}
protected internal override void RecalculateLayoutDeepestFirst()
{
foreach (ConfigPanel childPanel in childPanels)
{
childPanel.RecalculateLayoutDeepestFirst();
}
if (!((Object)(object)currentVirtualPanel == (Object)null))
{
((Component)currentVirtualPanel.contentSizeFitter).SendMessage("SetDirty");
LayoutRebuilder.ForceRebuildLayoutImmediate(currentVirtualPanel.trans);
}
}
protected internal override void RecalculateLayout()
{
if ((Object)(object)currentVirtualPanel != (Object)null)
{
((Component)currentVirtualPanel.contentSizeFitter).SendMessage("SetDirty");
LayoutRebuilder.ForceRebuildLayoutImmediate(currentVirtualPanel.trans);
}
base.parentPanel.RecalculateLayout();
}
public override void FieldDimensionChanged()
{
if ((Object)(object)currentDivComp != (Object)null)
{
currentDivComp.dirty = true;
}
}
public ConfigDivision(ConfigPanel panel, string guid)
: base(panel, guid)
{
panel.Register(this);
panel.childPanels.Add(this);
base.currentDirectory = base.parentPanel.currentDirectory + "/" + guid;
}
internal override void Register(ConfigField field)
{
fields.Add(field);
if ((Object)(object)currentVirtualPanel != (Object)null)
{
int i = currentVirtualPanel.content.childCount;
if (field.createUI && !field.bridged)
{
field.CreateUI(currentVirtualPanel.content);
}
List<Transform> list = new List<Transform>();
for (; i < currentVirtualPanel.content.childCount; i++)
{
list.Add(currentVirtualPanel.content.GetChild(i));
}
fieldObjects.Add(list);
}
}
internal override void ActivatePanel()
{
if (base.parentPanel != null)
{
base.parentPanel.ActivatePanel();
}
}
internal override GameObject GetConcretePanelObj()
{
return base.parentPanel.GetConcretePanelObj();
}
internal override ConfigPanel GetConcretePanel()
{
return base.parentPanel.GetConcretePanel();
}
protected internal override GameObject CreateUI(Transform content)
{
//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)
currentPanel = base.parentPanel.currentPanel;
currentComp = base.parentPanel.currentComp;
GameObject val = Addressables.InstantiateAsync((object)"PluginConfigurator/Fields/VirtualPanel.prefab", content, false, true).WaitForCompletion();
currentVirtualPanel = val.GetComponent<ConfigPanelVirtual>();
val.SetActive(false);
fieldsCreated = true;
fieldObjects.Clear();
int i = currentVirtualPanel.content.childCount;
foreach (ConfigField field in fields)
{
List<Transform> list = new List<Transform>();
if (field.createUI && !field.bridged)
{
field.CreateUI(currentVirtualPanel.content);
}
for (; i < currentVirtualPanel.content.childCount; i++)
{
list.Add(currentVirtualPanel.content.GetChild(i));
}
fieldObjects.Add(list);
}
currentDivComp = val.AddComponent<ConfigDivisionComp>();
currentDivComp.div = this;
((Component)currentVirtualPanel.contentSizeFitter).SendMessage("OnRectTransformDimensionsChange");
val.SetActive(!hidden && !base.parentHidden);
return val;
}
}
public abstract class ConfigField
{
public readonly bool createUI = true;
public int presetLoadPriority;
private bool _parentHidden;
private bool _parentInteractable = true;
public abstract string displayName { get; set; }
public string guid { get; private set; }
public bool strictGuid { get; protected set; }
public abstract bool hidden { get; set; }
internal bool parentHidden
{
get
{
return _parentHidden;
}
set
{
_parentHidden = value;
hidden = hidden;
}
}
public bool hierarchyHidden
{
get
{
if (!hidden)
{
return _parentHidden;
}
return true;
}
}
public abstract bool interactable { get; set; }
internal bool parentInteractable
{
get
{
return _parentInteractable;
}
set
{
_parentInteractable = value;
interactable = interactable;
}
}
public bool hierarchyInteractable
{
get
{
if (interactable)
{
return _parentInteractable;
}
return false;
}
}
public PluginConfigurator rootConfig { get; private set; }
public ConfigPanel parentPanel { get; internal set; }
public bool bridged { get; internal set; }
public ConfigBridge bridge { get; internal set; }
public int siblingIndex
{
get
{
if (parentPanel == null)
{
return 0;
}
return parentPanel.fields.IndexOf(this);
}
set
{
if (parentPanel == null)
{
return;
}
List<ConfigField> fields = parentPanel.fields;
int count = fields.Count;
if (value < 0)
{
value = 0;
}
else if (value >= count)
{
value = count - 1;
}
int num = fields.IndexOf(this);
if (num == value)
{
return;
}
fields.RemoveAt(num);
fields.Insert(value, this);
if (!((Object)(object)parentPanel.currentPanel != (Object)null) || parentPanel.currentPanel.content.childCount == 0)
{
return;
}
List<Transform> item = parentPanel.fieldObjects[num];
parentPanel.fieldObjects.RemoveAt(num);
parentPanel.fieldObjects.Insert(value, item);
int num2 = 0;
foreach (List<Transform> fieldObject in parentPanel.fieldObjects)
{
foreach (Transform item2 in fieldObject)
{
if (!((Object)(object)item2 == (Object)null))
{
item2.SetSiblingIndex(num2++);
}
}
}
}
}
internal ConfigField(string displayName, string guid, PluginConfigurator rootConfig)
{
strictGuid = true;
this.displayName = displayName;
this.guid = guid;
parentPanel = null;
this.rootConfig = rootConfig;
}
public ConfigField(string displayName, string guid, ConfigPanel parentPanel, bool createUI)
{
strictGuid = true;
this.createUI = createUI;
this.displayName = displayName;
this.guid = guid;
this.parentPanel = parentPanel;
rootConfig = parentPanel.rootConfig;
if (parentPanel is ConfigDivision configDivision)
{
_parentHidden = configDivision.hidden || configDivision.parentHidden;
_parentInteractable = configDivision.interactable && configDivision.parentInteractable;
}
}
public ConfigField(string displayName, string guid, ConfigPanel parentPanel)
: this(displayName, guid, parentPanel, createUI: true)
{
}
protected internal abstract GameObject CreateUI(Transform content);
internal abstract void ReloadFromString(string data);
internal abstract void ReloadDefault();
}
internal struct PanelInfo
{
public RectTransform rect;
public ContentSizeFitter content;
}
internal class ConfigPanelComponent : MonoBehaviour
{
public static ConfigPanelComponent lastActivePanel;
public ConfigPanel panel;
public bool dirty;
private void Awake()
{
try
{
panel.CreateFieldUI();
}
catch (Exception arg)
{
Debug.LogError((object)$"Exception thrown while creating panel UI\n{arg}");
}
panel.RecalculateLayoutDeepestFirst();
}
protected void OnEnable()
{
//IL_0016: Unknown result type (might be due to invalid IL or missing references)
//IL_0020: Expected O, but got Unknown
//IL_0031: Unknown result type (might be due to invalid IL or missing references)
//IL_003b: Expected O, but got Unknown
lastActivePanel = this;
PluginConfiguratorController.activePanel = ((Component)this).gameObject;
PluginConfiguratorController.backButton.onClick = new ButtonClickedEvent();
((UnityEvent)PluginConfiguratorController.backButton.onClick).AddListener((UnityAction)delegate
{
((Component)this).gameObject.SetActive(false);
if (!panel.bridged)
{
if (panel.parentPanel == null)
{
panel.rootConfig.FlushAll();
((Component)PluginConfiguratorController.mainPanel).gameObject.SetActive(true);
}
else
{
panel.parentPanel.ActivatePanel();
}
}
else
{
panel.bridge.parentPanel.ActivatePanel();
}
});
if (!panel.bridged)
{
if (panel.parentPanel == null)
{
panel.currentEsc.previousPage = ((Component)PluginConfiguratorController.mainPanel).gameObject;
}
else
{
panel.currentEsc.previousPage = panel.parentPanel.GetConcretePanelObj();
}
}
else
{
panel.currentEsc.previousPage = panel.bridge.parentPanel.GetConcretePanelObj();
}
PluginConfigurator pluginConfigurator = panel.ParentBridgedRootConfig();
pluginConfigurator.presetButtonCanBeShown = true;
((Component)pluginConfigurator.presetMenuButton).gameObject.SetActive(!pluginConfigurator.presetButtonHidden);
try
{
panel.OnPanelOpen(panel.externalPanelOpenFlag);
panel.externalPanelOpenFlag = false;
}
catch (Exception arg)
{
Debug.LogError((object)$"Exception thrown while calling on pannel open event\n{arg}");
}
}
private void OnDisable()
{
PluginConfigurator pluginConfigurator = panel.ParentBridgedRootConfig();
pluginConfigurator.presetButtonCanBeShown = false;
((Component)pluginConfigurator.presetMenuButton).gameObject.SetActive(false);
if ((Object)(object)PluginConfiguratorController.activePanel == (Object)(object)((Component)this).gameObject)
{
PluginConfiguratorController.activePanel = null;
}
try
{
panel.OnPanelClose();
}
catch (Exception arg)
{
Debug.LogError((object)$"Exception thrown while calling on pannel close event\n{arg}");
}
}
public void Update()
{
if (dirty)
{
dirty = false;
panel.RecalculateLayout();
}
}
}
public class ConfigPanel : ConfigField
{
public enum PanelFieldType
{
Standard,
StandardWithIcon,
StandardWithBigIcon,
BigButton
}
public delegate void OpenPanelEventDelegate(bool openedExternally);
public delegate void ClosePanelEventDelegate();
private const string ASSET_PATH_PANEL = "PluginConfigurator/Fields/ConcretePanel.prefab";
private const string ASSET_PATH_MENU_STANDARD = "PluginConfigurator/Fields/ConfigMenu.prefab";
private const string ASSET_PATH_MENU_ICON = "PluginConfigurator/Fields/ConfigMenuIcon.prefab";
private const string ASSET_PATH_MENU_ICON_BIG = "PluginConfigurator/Fields/ConfigMenuBigIcon.prefab";
private const string ASSET_PATH_MENU_BIG_BUTTON = "PluginConfigurator/Fields/ConfigMenuBigButton.prefab";
protected internal ConfigPanelConcrete currentPanel;
protected internal ConfigMenuField currentMenu;
protected internal MenuEsc currentEsc;
internal ConfigPanelComponent currentComp;
private Color _fieldColor = Color.black;
protected internal List<ConfigPanel> childPanels = new List<ConfigPanel>();
private string _displayName;
private string _headerText;
private string _buttonText = "Open";
private PanelFieldType fieldType;
private Sprite _icon;
internal List<ConfigField> fields = new List<ConfigField>();
private bool _hidden;
private bool _interactable = true;
internal List<List<Transform>> fieldObjects = new List<List<Transform>>();
internal bool fieldsCreated;
internal bool externalPanelOpenFlag;
public Color fieldColor
{
get
{
//IL_0001: Unknown result type (might be due to invalid IL or missing references)
return _fieldColor;
}
set
{
//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_0035: Unknown result type (might be due to invalid IL or missing references)
_fieldColor = value;
if (!((Object)(object)currentMenu == (Object)null) && (Object)(object)currentMenu.fieldBg != (Object)null)
{
((Graphic)currentMenu.fieldBg).color = fieldColor;
}
}
}
public override string displayName
{
get
{
return _displayName;
}
set
{
_displayName = value;
if ((Object)(object)currentMenu != (Object)null)
{
((TMP_Text)currentMenu.name).text = _displayName;
}
}
}
public string headerText
{
get
{
return _headerText;
}
set
{
_headerText = value;
if ((Object)(object)currentPanel != (Object)null)
{
((TMP_Text)currentPanel.header).text = _headerText;
}
}
}
public string buttonText
{
get
{
return _buttonText;
}
set
{
_buttonText = value;
if ((Object)(object)currentMenu != (Object)null)
{
((TMP_Text)currentMenu.buttonText).text = _buttonText;
}
}
}
public Sprite icon
{
get
{
return _icon;
}
set
{
_icon = value;
if ((Object)(object)currentMenu != (Object)null && (Object)(object)currentMenu.icon != (Object)null)
{
currentMenu.icon.sprite = icon;
}
}
}
public ConfigField this[int index] => FieldAt(index);
public ConfigField this[string guid] => fields.Where((ConfigField field) => field.guid == guid).FirstOrDefault();
public int fieldCount => fields.Count;
public string currentDirectory { get; protected set; }
public override bool hidden
{
get
{
return _hidden;
}
set
{
_hidden = value;
if ((Object)(object)currentMenu != (Object)null)
{
((Component)currentMenu).gameObject.SetActive(!_hidden && !base.parentHidden);
}
}
}
public override bool interactable
{
get
{
return _interactable;
}
set
{
_interactable = value;
if ((Object)(object)currentMenu != (Object)null)
{
((Selectable)currentMenu.button).interactable = _interactable && base.parentInteractable;
SetInteractableColor(_interactable && base.parentInteractable);
}
}
}
public event OpenPanelEventDelegate onPannelOpenEvent;
public event ClosePanelEventDelegate onPannelCloseEvent;
internal PluginConfigurator ParentBridgedRootConfig()
{
for (ConfigPanel configPanel = this; configPanel != null; configPanel = configPanel.parentPanel)
{
if (configPanel.bridged)
{
return configPanel.bridge.rootConfig;
}
}
return base.rootConfig;
}
protected internal virtual void RecalculateLayoutDeepestFirst()
{
foreach (ConfigPanel childPanel in childPanels)
{
childPanel.RecalculateLayoutDeepestFirst();
}
((Component)currentPanel.contentSizeFitter).SendMessage("SetDirty");
LayoutRebuilder.ForceRebuildLayoutImmediate(currentPanel.trans);
}
protected internal virtual void RecalculateLayout()
{
((Component)currentPanel.contentSizeFitter).SendMessage("SetDirty");
LayoutRebuilder.ForceRebuildLayoutImmediate(currentPanel.trans);
}
public virtual void FieldDimensionChanged()
{
if ((Object)(object)currentComp != (Object)null)
{
currentComp.dirty = true;
}
}
public void SetIconWithURL(string url)
{
if (fieldType != PanelFieldType.StandardWithIcon && fieldType != PanelFieldType.StandardWithBigIcon)
{
return;
}
UnityWebRequest iconDownload = UnityWebRequestTexture.GetTexture(url);
((AsyncOperation)iconDownload.SendWebRequest()).completed += delegate
{
//IL_0041: Unknown result type (might be due to invalid IL or missing references)
//IL_0050: Unknown result type (might be due to invalid IL or missing references)
try
{
if (!iconDownload.isHttpError && !iconDownload.isNetworkError)
{
Texture2D content = DownloadHandlerTexture.GetContent(iconDownload);
Sprite val = Sprite.Create(content, new Rect(0f, 0f, (float)((Texture)content).width, (float)((Texture)content).height), new Vector2(0.5f, 0.5f));
icon = val;
}
}
finally
{
iconDownload.Dispose();
}
};
}
public ConfigField FieldAt(int index)
{
if (index < 0 || index >= fields.Count)
{
return null;
}
return fields[index];
}
public ConfigField[] GetAllFields()
{
return fields.ToArray();
}
private void SetInteractableColor(bool interactable)
{
//IL_0024: 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)
if (!((Object)(object)currentMenu == (Object)null))
{
((Graphic)currentMenu.name).color = (interactable ? Color.white : Color.gray);
}
}
internal ConfigPanel(PluginConfigurator config)
: base(config.displayName, "", config)
{
}//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)
internal ConfigPanel(ConfigPanel panel, string name)
: base(name, "", panel)
{
}//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)
public ConfigPanel(ConfigPanel parentPanel, string name, string guid, PanelFieldType fieldType)
: base(name, guid, parentPanel)
{
//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)
headerText = "--" + displayName + "--";
this.fieldType = fieldType;
parentPanel.Register(this);
currentDirectory = parentPanel.currentDirectory + "/" + guid;
}
public ConfigPanel(ConfigPanel parentPanel, string name, string guid)
: this(parentPanel, name, guid, PanelFieldType.Standard)
{
}
internal virtual void Register(ConfigField field)
{
fields.Add(field);
if ((Object)(object)currentPanel != (Object)null && fieldsCreated)
{
int i = currentPanel.content.childCount;
if (field.createUI && !field.bridged)
{
field.CreateUI(currentPanel.content);
}
List<Transform> list = new List<Transform>();
for (; i < currentPanel.content.childCount; i++)
{
list.Add(currentPanel.content.GetChild(i));
}
fieldObjects.Add(list);
}
}
internal virtual void ActivatePanel()
{
if ((Object)(object)currentPanel != (Object)null)
{
((Component)currentPanel).gameObject.SetActive(true);
}
}
internal virtual GameObject GetConcretePanelObj()
{
if (!((Object)(object)currentPanel == (Object)null))
{
return ((Component)currentPanel).gameObject;
}
return null;
}
internal virtual ConfigPanel GetConcretePanel()
{
return this;
}
protected internal override GameObject CreateUI(Transform content)
{
//IL_0013: 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_00da: 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_00fb: Unknown result type (might be due to invalid IL or missing references)
//IL_0100: Unknown result type (might be due to invalid IL or missing references)
//IL_0134: Unknown result type (might be due to invalid IL or missing references)
//IL_0139: 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_0121: Unknown result type (might be due to invalid IL or missing references)
//IL_01c1: Unknown result type (might be due to invalid IL or missing references)
//IL_01cb: Expected O, but got Unknown
//IL_01e2: Unknown result type (might be due to invalid IL or missing references)
//IL_01ec: Expected O, but got Unknown
//IL_020b: Unknown result type (might be due to invalid IL or missing references)
fieldsCreated = false;
GameObject val = Addressables.InstantiateAsync((object)"PluginConfigurator/Fields/ConcretePanel.prefab", PluginConfiguratorController.optionsMenu, false, true).WaitForCompletion();
currentPanel = val.GetComponent<ConfigPanelConcrete>();
val.SetActive(false);
currentComp = val.AddComponent<ConfigPanelComponent>();
currentComp.panel = this;
((TMP_Text)currentPanel.header).text = _headerText;
MenuEsc val2 = (currentEsc = val.AddComponent<MenuEsc>());
if (!base.bridged)
{
if (base.parentPanel == null)
{
val2.previousPage = ((Component)PluginConfiguratorController.mainPanel).gameObject;
}
else
{
val2.previousPage = base.parentPanel.GetConcretePanelObj();
}
}
else
{
val2.previousPage = base.bridge.parentPanel.GetConcretePanelObj();
}
if ((Object)(object)content != (Object)null)
{
GameObject val3 = null;
val3 = ((fieldType == PanelFieldType.StandardWithIcon) ? Addressables.InstantiateAsync((object)"PluginConfigurator/Fields/ConfigMenuIcon.prefab", content, false, true).WaitForCompletion() : ((fieldType == PanelFieldType.StandardWithBigIcon) ? Addressables.InstantiateAsync((object)"PluginConfigurator/Fields/ConfigMenuBigIcon.prefab", content, false, true).WaitForCompletion() : ((fieldType != PanelFieldType.BigButton) ? Addressables.InstantiateAsync((object)"PluginConfigurator/Fields/ConfigMenu.prefab", content, false, true).WaitForCompletion() : Addressables.InstantiateAsync((object)"PluginConfigurator/Fields/ConfigMenuBigButton.prefab", content, false, true).WaitForCompletion())));
currentMenu = val3.GetComponent<ConfigMenuField>();
((TMP_Text)currentMenu.name).text = displayName;
if ((Object)(object)currentMenu.icon != (Object)null)
{
currentMenu.icon.sprite = icon;
}
if ((Object)(object)currentMenu.buttonText != (Object)null)
{
((TMP_Text)currentMenu.buttonText).text = _buttonText;
}
currentMenu.button.onClick = new ButtonClickedEvent();
((UnityEvent)currentMenu.button.onClick).AddListener((UnityAction)delegate
{
OpenPanelInternally(openedExternally: false);
});
if ((Object)(object)currentMenu.fieldBg != (Object)null)
{
((Graphic)currentMenu.fieldBg).color = _fieldColor;
}
((Component)currentMenu).gameObject.SetActive(!hidden && !base.parentHidden);
((Selectable)currentMenu.button).interactable = interactable && base.parentInteractable;
}
return val;
}
internal void CreateFieldUI()
{
if ((Object)(object)currentPanel == (Object)null || fieldsCreated)
{
return;
}
fieldsCreated = true;
fieldObjects.Clear();
int i = currentPanel.content.childCount;
foreach (ConfigField field in fields)
{
List<Transform> list = new List<Transform>();
if (field.createUI && !field.bridged)
{
field.CreateUI(currentPanel.content);
}
for (; i < currentPanel.content.childCount; i++)
{
list.Add(currentPanel.content.GetChild(i));
}
fieldObjects.Add(list);
}
}
internal void OnPanelClose()
{
if (this.onPannelCloseEvent != null)
{
this.onPannelCloseEvent();
}
}
internal void OnPanelOpen(bool external)
{
if (this.onPannelOpenEvent != null)
{
this.onPannelOpenEvent(external);
}
}
internal void OpenPanelInternally(bool openedExternally)
{
if ((!openedExternally || !((Object)(object)PluginConfiguratorController.activePanel == (Object)null)) && !((Object)(object)currentPanel == (Object)null))
{
if ((Object)(object)PluginConfiguratorController.activePanel != (Object)null)
{
PluginConfiguratorController.activePanel.SetActive(false);
}
externalPanelOpenFlag = openedExternally;
((Component)currentPanel).gameObject.SetActive(true);
PluginConfiguratorController.activePanel = ((Component)currentPanel).gameObject;
}
}
public void OpenPanel()
{
OpenPanelInternally(openedExternally: true);
}
public void ClosePanel()
{
if ((Object)(object)currentPanel != (Object)null && ((Component)currentPanel).gameObject.activeSelf)
{
((Component)currentPanel).gameObject.SetActive(false);
if (base.parentPanel == null)
{
base.rootConfig.FlushAll();
((Component)PluginConfiguratorController.mainPanel).gameObject.SetActive(true);
PluginConfiguratorController.activePanel = ((Component)PluginConfiguratorController.mainPanel).gameObject;
}
else
{
base.parentPanel.ActivatePanel();
}
}
}
internal override void ReloadFromString(string data)
{
throw new NotImplementedException();
}
internal override void ReloadDefault()
{
throw new NotImplementedException();
}
}
internal class PresetPanelComp : MonoBehaviour
{
private MenuEsc esc;
private void Awake()
{
esc = ((Component)this).GetComponent<MenuEsc>();
}
private void OnEnable()
{
esc.previousPage = PluginConfiguratorController.activePanel;
((Component)this).transform.SetSiblingIndex(((Component)this).transform.parent.childCount - 1);
}
private void OnDisable()
{
((Component)this).gameObject.SetActive(false);
}
}
internal static class PresetOldFileManager
{
public static string trashBinDir;
public static string resetBinDir;
private static readonly char[] pathSafeCharacters = new char[4] { '.', '-', '_', ' ' };
public static void Init()
{
trashBinDir = Path.Combine(Paths.ConfigPath, "PluginConfigurator", "preset_trash_bin");
resetBinDir = Path.Combine(Paths.ConfigPath, "PluginConfigurator", "preset_reset_bin");
if (!Directory.Exists(trashBinDir))
{
Directory.CreateDirectory(trashBinDir);
}
if (!Directory.Exists(resetBinDir))
{
Directory.CreateDirectory(resetBinDir);
}
}
public static void CheckForOldFiles()
{
string[] files = Directory.GetFiles(trashBinDir);
for (int i = 0; i < files.Length; i++)
{
FileInfo fileInfo = new FileInfo(files[i]);
if (fileInfo.CreationTime < DateTime.Now.AddDays(-7.0))
{
fileInfo.Delete();
}
}
files = Directory.GetFiles(resetBinDir);
for (int i = 0; i < files.Length; i++)
{
FileInfo fileInfo2 = new FileInfo(files[i]);
if (fileInfo2.CreationTime < DateTime.Now.AddDays(-7.0))
{
fileInfo2.Delete();
}
}
}
private static string TurnToUniquePath(string path)
{
string directoryName = Path.GetDirectoryName(path);
string fileNameWithoutExtension = Path.GetFileNameWithoutExtension(path);
string extension = Path.GetExtension(path);
int num = 0;
string text = path;
while (File.Exists(text))
{
text = Path.Combine(directoryName, $"{fileNameWithoutExtension}_{num++}{extension}");
}
return text;
}
private static string GetPathSafeString(string s)
{
StringBuilder stringBuilder = new StringBuilder();
foreach (char c in s)
{
if (char.IsLetter(c) || char.IsDigit(c) || Array.IndexOf(pathSafeCharacters, c) != -1)
{
stringBuilder.Append(c);
}
else if (stringBuilder.Length != 0 && stringBuilder[stringBuilder.Length - 1] != '_')
{
stringBuilder.Append('_');
}
}
if (stringBuilder.Length != 0)
{
return stringBuilder.ToString();
}
return "file";
}
public static void MoveFileToTrashBin(string path, string fileName)
{
if (File.Exists(path))
{
fileName = GetPathSafeString(fileName);
string destFileName = TurnToUniquePath(Path.Combine(trashBinDir, fileName));
File.Move(path, destFileName);
}
}
public static void CopyFileToResetBin(string path, string fileName)
{
if (File.Exists(path))
{
fileName = GetPathSafeString(fileName);
string destFileName = TurnToUniquePath(Path.Combine(resetBinDir, fileName));
File.Copy(path, destFileName);
}
}
}
public class PluginConfigurator
{
internal class Preset
{
public readonly PluginConfigurator rootConfig;
public string name;
public string filePath;
public string fileId;
public int listIndex;
public ConfigCustomPresetField currentUI;
public bool markedForDelete;
public Preset(PluginConfigurator config)
{
rootConfig = config;
}
public void SetButtonColor()
{
//IL_002f: 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)
if (!((Object)(object)currentUI == (Object)null))
{
((Selectable)currentUI.preset).colors = GetButtonColor((rootConfig.currentPreset == this) ? Color.red : Color.white);
}
}
public void SetResetInteractable()
{
if (!((Object)(object)currentUI == (Object)null))
{
((Selectable)currentUI.reset).interactable = rootConfig.currentPreset == this;
}
}
public void CreateUI()
{
//IL_0027: 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_006b: Unknown result type (might be due to invalid IL or missing references)
//IL_0075: Expected O, but got Unknown
//IL_00aa: Unknown result type (might be due to invalid IL or missing references)
//IL_00b4: Expected O, but got Unknown
//IL_00cb: Unknown result type (might be due to invalid IL or missing references)
//IL_00d5: Expected O, but got Unknown
//IL_010d: Unknown result type (might be due to invalid IL or missing references)
//IL_0117: Expected O, but got Unknown
//IL_012e: Unknown result type (might be due to invalid IL or missing references)
//IL_0138: Expected O, but got Unknown
//IL_014f: Unknown result type (might be due to invalid IL or missing references)
//IL_0159: Expected O, but got Unknown
if ((Object)(object)currentUI != (Object)null)
{
return;
}
currentUI = Addressables.InstantiateAsync((object)"PluginConfigurator/CustomPresetButton.prefab", rootConfig.presetPanel.content, false, true).WaitForCompletion().GetComponent<ConfigCustomPresetField>();
currentUI.nameInput.SetTextWithoutNotify(name);
((UnityEvent)currentUI.preset.onClick).AddListener((UnityAction)delegate
{
if (rootConfig.currentPreset != this)
{
rootConfig.ChangePreset(this);
}
});
((Selectable)currentUI.reset).interactable = rootConfig.currentPreset == this;
((UnityEvent)currentUI.reset.onClick).AddListener((UnityAction)delegate
{
if (rootConfig.currentPreset != this)
{
((Selectable)currentUI.reset).interactable = false;
}
else
{
rootConfig.ResetPreset(this);
}
});
((UnityEvent)currentUI.edit.onClick).AddListener((UnityAction)delegate
{
((Selectable)currentUI.nameInput).interactable = true;
((Selectable)currentUI.nameInput).Select();
});
((UnityEvent<string>)(object)currentUI.nameInput.onEndEdit).AddListener((UnityAction<string>)delegate(string newVal)
{
((Selectable)currentUI.nameInput).interactable = false;
if (!(name == newVal))
{
rootConfig.isPresetHeaderDirty = true;
name = newVal;
currentUI.nameInput.SetTextWithoutNotify(newVal);
}
});
((UnityEvent)currentUI.delete.onClick).AddListener((UnityAction)delegate
{
rootConfig.DeletePreset(this);
});
((UnityEvent)currentUI.moveUp.onClick).AddListener((UnityAction)delegate
{
if (((Component)currentUI).transform.GetSiblingIndex() > 1)
{
((Component)currentUI).transform.SetSiblingIndex(((Component)currentUI).tran