using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.Globalization;
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 BepInEx.Logging;
using DarkMachine.UI;
using HarmonyLib;
using Microsoft.CodeAnalysis;
using ModMenu.Behaviors;
using MonoMod.RuntimeDetour;
using TMPro;
using UnityEngine;
using UnityEngine.Events;
using UnityEngine.UI;
using WKLib.API.Input;
[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.1", FrameworkDisplayName = ".NET Standard 2.1")]
[assembly: AssemblyCompany("ModMenu")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyDescription("My first plugin")]
[assembly: AssemblyFileVersion("1.2.0.0")]
[assembly: AssemblyInformationalVersion("1.2.0+ff030c5e689114c639667709fe467c5434a13abb")]
[assembly: AssemblyProduct("ModMenu")]
[assembly: AssemblyTitle("ModMenu")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.2.0.0")]
[module: UnverifiableCode]
[module: RefSafetyRules(11)]
namespace Microsoft.CodeAnalysis
{
[CompilerGenerated]
[Microsoft.CodeAnalysis.Embedded]
internal sealed class EmbeddedAttribute : Attribute
{
}
}
namespace System.Runtime.CompilerServices
{
[CompilerGenerated]
[Microsoft.CodeAnalysis.Embedded]
[AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)]
internal sealed class RefSafetyRulesAttribute : Attribute
{
public readonly int Version;
public RefSafetyRulesAttribute(int P_0)
{
Version = P_0;
}
}
}
namespace ModMenu
{
public static class Extensions
{
public static GameObject Search(this GameObject go, string search)
{
if (!Object.op_Implicit((Object)(object)go))
{
return null;
}
if (string.IsNullOrEmpty(search))
{
return null;
}
Queue<string> queue = new Queue<string>(search.Split('/', StringSplitOptions.RemoveEmptyEntries));
Transform val = go.transform;
while (queue.Count > 0)
{
string text = queue.Dequeue();
bool flag = false;
if (text.Equals("..") && Object.op_Implicit((Object)(object)val.parent))
{
flag = true;
val = val.parent;
}
else
{
for (int i = 0; i < val.childCount; i++)
{
Transform child = val.GetChild(i);
if (text.Equals(((Object)((Component)child).gameObject).name))
{
val = child;
flag = true;
break;
}
}
}
if (!flag)
{
return null;
}
}
return ((Component)val).gameObject;
}
public static GameObject Search(this Transform tr, string search)
{
if (!Object.op_Implicit((Object)(object)tr))
{
return null;
}
return ((Component)tr).gameObject.Search(search);
}
}
internal sealed class ModMenu
{
private static RectTransform _settingsMenuTransform;
private static RectTransform _modMenuPanel;
private static Dictionary<string, ConfigEntryBase[]> _configs;
public static void Initialize(Transform target)
{
GameObject obj = target.Search("SettingsParent/Settings Pane");
_settingsMenuTransform = ((obj != null) ? obj.GetComponent<RectTransform>() : null);
_configs = GetModConfigs();
_modMenuPanel = UI.CreateSettingsPanel(_settingsMenuTransform, "Mods");
CreateMenuTab();
CreateModMenus();
((Component)_modMenuPanel).gameObject.SetActive(false);
}
private static void CreateMenuTab()
{
//IL_0076: Unknown result type (might be due to invalid IL or missing references)
//IL_0080: Unknown result type (might be due to invalid IL or missing references)
UI_TabGroup val = ((IEnumerable<UI_TabGroup>)((Component)_settingsMenuTransform).GetComponentsInChildren<UI_TabGroup>()).FirstOrDefault((Func<UI_TabGroup, bool>)((UI_TabGroup c) => ((Object)((Component)c).gameObject).name == "Tab Selection Hor"));
if ((Object)(object)val == (Object)null)
{
Plugin.Log.LogError((object)"No tab group found");
return;
}
RectTransform component = ((Component)val.AddTab(Templates.MainTabButton, "Mods", ((Component)_modMenuPanel).gameObject)).GetComponent<RectTransform>();
component.sizeDelta = new Vector2(80f, component.sizeDelta.y);
}
private static void CreateModMenus()
{
//IL_001b: 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_0053: Unknown result type (might be due to invalid IL or missing references)
//IL_0069: 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_00b1: Unknown result type (might be due to invalid IL or missing references)
ScrollRect val = UI.CreateScrollRect(_modMenuPanel);
((Component)val.viewport).GetComponent<RectMask2D>().softness = new Vector2Int(10, 0);
Transform transform = ((Component)val).transform;
RectTransform val2 = (RectTransform)(object)((transform is RectTransform) ? transform : null);
val2.anchorMin = new Vector2(0f, 1f);
val2.anchorMax = new Vector2(1f, 1f);
val2.anchoredPosition = new Vector2(0f, -50f);
val2.sizeDelta = new Vector2(-20f, 70f);
UI_TabGroup tabGroup = UI.CreateTabGroup(val.content, ((Component)val.content).gameObject, vertical: false, supportGamepad: false, (Color?)new Color(0.3868f, 0.3868f, 0.3868f, 1f), (Color?)null, "TabMainLeft", "TabMainRight");
foreach (KeyValuePair<string, ConfigEntryBase[]> config in _configs)
{
Selectable firstElement;
GameObject val3 = CreateModMenu(config.Value, out firstElement);
val3.SetActive(false);
tabGroup.AddTab(Templates.TabButton, config.Key, val3, firstElement);
}
}
private static GameObject CreateModMenu(ConfigEntryBase[] entries, out Selectable firstElement)
{
//IL_001b: 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_0053: Unknown result type (might be due to invalid IL or missing references)
//IL_0069: 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_0115: Unknown result type (might be due to invalid IL or missing references)
//IL_011a: Unknown result type (might be due to invalid IL or missing references)
//IL_0141: Unknown result type (might be due to invalid IL or missing references)
//IL_0146: Unknown result type (might be due to invalid IL or missing references)
//IL_014b: Unknown result type (might be due to invalid IL or missing references)
//IL_02ae: Unknown result type (might be due to invalid IL or missing references)
//IL_02b4: Unknown result type (might be due to invalid IL or missing references)
//IL_02c8: Unknown result type (might be due to invalid IL or missing references)
//IL_02cd: Unknown result type (might be due to invalid IL or missing references)
//IL_02d2: Unknown result type (might be due to invalid IL or missing references)
//IL_035a: 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_0374: 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_037e: Unknown result type (might be due to invalid IL or missing references)
//IL_0cd1: Unknown result type (might be due to invalid IL or missing references)
//IL_0cd6: Unknown result type (might be due to invalid IL or missing references)
//IL_03c2: Unknown result type (might be due to invalid IL or missing references)
//IL_03c8: Unknown result type (might be due to invalid IL or missing references)
//IL_03e6: Unknown result type (might be due to invalid IL or missing references)
//IL_03eb: Unknown result type (might be due to invalid IL or missing references)
//IL_03f0: Unknown result type (might be due to invalid IL or missing references)
//IL_047b: Unknown result type (might be due to invalid IL or missing references)
//IL_0481: Unknown result type (might be due to invalid IL or missing references)
//IL_0495: Unknown result type (might be due to invalid IL or missing references)
//IL_049a: Unknown result type (might be due to invalid IL or missing references)
//IL_049f: Unknown result type (might be due to invalid IL or missing references)
//IL_04e3: Unknown result type (might be due to invalid IL or missing references)
//IL_04e9: Unknown result type (might be due to invalid IL or missing references)
//IL_0507: Unknown result type (might be due to invalid IL or missing references)
//IL_050c: Unknown result type (might be due to invalid IL or missing references)
//IL_0511: Unknown result type (might be due to invalid IL or missing references)
//IL_059a: Unknown result type (might be due to invalid IL or missing references)
//IL_05a0: Unknown result type (might be due to invalid IL or missing references)
//IL_05b4: Unknown result type (might be due to invalid IL or missing references)
//IL_05b9: Unknown result type (might be due to invalid IL or missing references)
//IL_05be: Unknown result type (might be due to invalid IL or missing references)
//IL_0659: Unknown result type (might be due to invalid IL or missing references)
//IL_0672: Unknown result type (might be due to invalid IL or missing references)
//IL_0678: Unknown result type (might be due to invalid IL or missing references)
//IL_0696: Unknown result type (might be due to invalid IL or missing references)
//IL_069b: Unknown result type (might be due to invalid IL or missing references)
//IL_06a0: Unknown result type (might be due to invalid IL or missing references)
//IL_0602: Unknown result type (might be due to invalid IL or missing references)
//IL_0608: Unknown result type (might be due to invalid IL or missing references)
//IL_0626: Unknown result type (might be due to invalid IL or missing references)
//IL_062b: Unknown result type (might be due to invalid IL or missing references)
//IL_0630: Unknown result type (might be due to invalid IL or missing references)
//IL_0747: Unknown result type (might be due to invalid IL or missing references)
//IL_074d: Unknown result type (might be due to invalid IL or missing references)
//IL_0761: Unknown result type (might be due to invalid IL or missing references)
//IL_0766: Unknown result type (might be due to invalid IL or missing references)
//IL_076b: Unknown result type (might be due to invalid IL or missing references)
//IL_0790: Unknown result type (might be due to invalid IL or missing references)
//IL_0795: Unknown result type (might be due to invalid IL or missing references)
//IL_07f3: Unknown result type (might be due to invalid IL or missing references)
//IL_07ff: Unknown result type (might be due to invalid IL or missing references)
//IL_080b: Unknown result type (might be due to invalid IL or missing references)
//IL_0819: Unknown result type (might be due to invalid IL or missing references)
//IL_081f: Unknown result type (might be due to invalid IL or missing references)
//IL_0843: Unknown result type (might be due to invalid IL or missing references)
//IL_0848: Unknown result type (might be due to invalid IL or missing references)
//IL_084d: Unknown result type (might be due to invalid IL or missing references)
//IL_0872: Unknown result type (might be due to invalid IL or missing references)
//IL_0877: Unknown result type (might be due to invalid IL or missing references)
//IL_08b3: Unknown result type (might be due to invalid IL or missing references)
//IL_08bf: Unknown result type (might be due to invalid IL or missing references)
//IL_08cd: Unknown result type (might be due to invalid IL or missing references)
//IL_08d3: Unknown result type (might be due to invalid IL or missing references)
//IL_08eb: Unknown result type (might be due to invalid IL or missing references)
//IL_08f0: Unknown result type (might be due to invalid IL or missing references)
//IL_08f5: Unknown result type (might be due to invalid IL or missing references)
//IL_091a: Unknown result type (might be due to invalid IL or missing references)
//IL_091f: Unknown result type (might be due to invalid IL or missing references)
//IL_096c: Unknown result type (might be due to invalid IL or missing references)
//IL_0978: Unknown result type (might be due to invalid IL or missing references)
//IL_0984: Unknown result type (might be due to invalid IL or missing references)
//IL_0992: Unknown result type (might be due to invalid IL or missing references)
//IL_0998: Unknown result type (might be due to invalid IL or missing references)
//IL_09b2: Unknown result type (might be due to invalid IL or missing references)
//IL_09b7: Unknown result type (might be due to invalid IL or missing references)
//IL_09bc: Unknown result type (might be due to invalid IL or missing references)
//IL_09e1: Unknown result type (might be due to invalid IL or missing references)
//IL_09e6: Unknown result type (might be due to invalid IL or missing references)
//IL_0a44: Unknown result type (might be due to invalid IL or missing references)
//IL_0a50: Unknown result type (might be due to invalid IL or missing references)
//IL_0a5c: Unknown result type (might be due to invalid IL or missing references)
//IL_0a6a: Unknown result type (might be due to invalid IL or missing references)
//IL_0a70: Unknown result type (might be due to invalid IL or missing references)
//IL_0a94: Unknown result type (might be due to invalid IL or missing references)
//IL_0a99: Unknown result type (might be due to invalid IL or missing references)
//IL_0a9e: Unknown result type (might be due to invalid IL or missing references)
//IL_0ac3: Unknown result type (might be due to invalid IL or missing references)
//IL_0ac8: Unknown result type (might be due to invalid IL or missing references)
//IL_0b26: Unknown result type (might be due to invalid IL or missing references)
//IL_0b32: Unknown result type (might be due to invalid IL or missing references)
//IL_0b3e: Unknown result type (might be due to invalid IL or missing references)
//IL_0b4c: Unknown result type (might be due to invalid IL or missing references)
//IL_0b52: Unknown result type (might be due to invalid IL or missing references)
//IL_0b76: Unknown result type (might be due to invalid IL or missing references)
//IL_0b7b: Unknown result type (might be due to invalid IL or missing references)
//IL_0b80: Unknown result type (might be due to invalid IL or missing references)
//IL_0ba5: Unknown result type (might be due to invalid IL or missing references)
//IL_0baa: Unknown result type (might be due to invalid IL or missing references)
//IL_0c1a: Unknown result type (might be due to invalid IL or missing references)
//IL_0c20: Unknown result type (might be due to invalid IL or missing references)
//IL_0c5c: Unknown result type (might be due to invalid IL or missing references)
//IL_0c61: Unknown result type (might be due to invalid IL or missing references)
//IL_0c66: Unknown result type (might be due to invalid IL or missing references)
ScrollRect val5 = UI.CreateScrollRect(_modMenuPanel);
((Component)val5.viewport).GetComponent<RectMask2D>().softness = new Vector2Int(10, 0);
Transform transform = ((Component)val5).transform;
RectTransform val6 = (RectTransform)(object)((transform is RectTransform) ? transform : null);
val6.anchorMin = new Vector2(0f, 0f);
val6.anchorMax = new Vector2(1f, 1f);
val6.anchoredPosition = new Vector2(0f, -45f);
val6.sizeDelta = new Vector2(-20f, -70f);
HorizontalOrVerticalLayoutGroup component = ((Component)val5.content).GetComponent<HorizontalOrVerticalLayoutGroup>();
component.childControlHeight = true;
component.childForceExpandHeight = true;
component.spacing = 0f;
((LayoutGroup)component).childAlignment = (TextAnchor)0;
firstElement = null;
IEnumerable<IGrouping<string, ConfigEntryBase>> enumerable = from entry in entries
group entry by entry.Definition.Section;
foreach (IGrouping<string, ConfigEntryBase> item in enumerable)
{
RectTransform val7 = CreateEntriesColumn(val5.content);
float num = 0f;
Rect rect = val5.content.rect;
float height = ((Rect)(ref rect)).height;
float num2 = 5f;
float num3 = num;
rect = ((RectTransform)UI.CreateLabel(val7, item.Key).transform).rect;
num = num3 + (((Rect)(ref rect)).height + num2);
foreach (ConfigEntryBase entry2 in item)
{
string label = PrettifyName(entry2.Definition.Key);
ConfigEntryBase val8 = entry2;
ConfigEntryBase val9 = val8;
if (!(val9 is ConfigEntry<bool>))
{
if (!(val9 is ConfigEntry<float>))
{
if (!(val9 is ConfigEntry<int>))
{
if (!(val9 is ConfigEntry<string>))
{
if (!(val9 is ConfigEntry<KeyCode>))
{
if (val9 != null)
{
if (!entry2.SettingType.IsSubclassOf(typeof(Enum)))
{
if (!(val9 is ConfigEntry<Color>))
{
if (!(val9 is ConfigEntry<Vector2>))
{
if (!(val9 is ConfigEntry<Vector3>))
{
if (!(val9 is ConfigEntry<Vector4>))
{
if (!(val9 is ConfigEntry<Quaternion>))
{
if (val9 is ConfigEntry<Rect>)
{
Rect val10 = (Rect)entry2.BoxedValue;
UI.CreateQuadInputField(val7, label, ((Rect)(ref val10)).x.ToString(CultureInfo.InvariantCulture), ((Rect)(ref val10)).y.ToString(CultureInfo.InvariantCulture), ((Rect)(ref val10)).width.ToString(CultureInfo.InvariantCulture), ((Rect)(ref val10)).height.ToString(CultureInfo.InvariantCulture), delegate(string val1, string val2, string val3, string val4)
{
//IL_003c: Unknown result type (might be due to invalid IL or missing references)
if (float.TryParse(val1, out var result20) && float.TryParse(val2, out var result21) && float.TryParse(val3, out var result22) && float.TryParse(val4, out var result23))
{
entry2.BoxedValue = (object)new Rect(result20, result21, result22, result23);
}
}, (ContentType)3, (CharacterValidation)3);
float num4 = num;
rect = ((RectTransform)Templates.InputField.transform).rect;
num = num4 + (((Rect)(ref rect)).height + num2);
}
}
else
{
Quaternion val11 = (Quaternion)entry2.BoxedValue;
RectTransform parent = val7;
string value2 = val11.x.ToString(CultureInfo.InvariantCulture);
string value3 = val11.y.ToString(CultureInfo.InvariantCulture);
string value4 = val11.z.ToString(CultureInfo.InvariantCulture);
string value5 = val11.y.ToString(CultureInfo.InvariantCulture);
Action<string, string, string, string> onValueChanged = delegate(string val1, string val2, string val3, string val4)
{
//IL_003c: Unknown result type (might be due to invalid IL or missing references)
if (float.TryParse(val1, out var result16) && float.TryParse(val2, out var result17) && float.TryParse(val3, out var result18) && float.TryParse(val4, out var result19))
{
entry2.BoxedValue = (object)new Quaternion(result16, result17, result18, result19);
}
};
Color? color = Color.red;
Color? color2 = Color.green;
Color? color3 = Color.blue;
UI.CreateQuadInputField(parent, label, value2, value3, value4, value5, onValueChanged, (ContentType)3, (CharacterValidation)3, default(Vector2), color, color2, color3);
float num5 = num;
rect = ((RectTransform)Templates.InputField.transform).rect;
num = num5 + (((Rect)(ref rect)).height + num2);
}
}
else
{
Vector4 val12 = (Vector4)entry2.BoxedValue;
RectTransform parent2 = val7;
string value6 = val12.x.ToString(CultureInfo.InvariantCulture);
string value7 = val12.y.ToString(CultureInfo.InvariantCulture);
string value8 = val12.z.ToString(CultureInfo.InvariantCulture);
string value9 = val12.y.ToString(CultureInfo.InvariantCulture);
Action<string, string, string, string> onValueChanged2 = delegate(string val1, string val2, string val3, string val4)
{
//IL_003c: Unknown result type (might be due to invalid IL or missing references)
if (float.TryParse(val1, out var result12) && float.TryParse(val2, out var result13) && float.TryParse(val3, out var result14) && float.TryParse(val4, out var result15))
{
entry2.BoxedValue = (object)new Vector4(result12, result13, result14, result15);
}
};
Color? color3 = Color.red;
Color? color2 = Color.green;
Color? color = Color.blue;
UI.CreateQuadInputField(parent2, label, value6, value7, value8, value9, onValueChanged2, (ContentType)3, (CharacterValidation)3, default(Vector2), color3, color2, color);
float num6 = num;
rect = ((RectTransform)Templates.InputField.transform).rect;
num = num6 + (((Rect)(ref rect)).height + num2);
}
}
else
{
Vector3 val13 = (Vector3)entry2.BoxedValue;
RectTransform parent3 = val7;
string value10 = val13.x.ToString(CultureInfo.InvariantCulture);
string value11 = val13.y.ToString(CultureInfo.InvariantCulture);
string value12 = val13.z.ToString(CultureInfo.InvariantCulture);
Action<string, string, string> onValueChanged3 = delegate(string val1, string val2, string val3)
{
//IL_002e: Unknown result type (might be due to invalid IL or missing references)
if (float.TryParse(val1, out var result9) && float.TryParse(val2, out var result10) && float.TryParse(val3, out var result11))
{
entry2.BoxedValue = (object)new Vector3(result9, result10, result11);
}
};
Color? color = Color.red;
Color? color2 = Color.green;
Color? color3 = Color.blue;
UI.CreateTrippleInputField(parent3, label, value10, value11, value12, onValueChanged3, (ContentType)3, (CharacterValidation)3, default(Vector2), color, color2, color3);
float num7 = num;
rect = ((RectTransform)Templates.InputField.transform).rect;
num = num7 + (((Rect)(ref rect)).height + num2);
}
}
else
{
Vector2 val14 = (Vector2)entry2.BoxedValue;
RectTransform parent4 = val7;
string value13 = val14.x.ToString(CultureInfo.InvariantCulture);
string value14 = val14.y.ToString(CultureInfo.InvariantCulture);
Action<string, string> onValueChanged4 = delegate(string val1, string val2)
{
//IL_0023: Unknown result type (might be due to invalid IL or missing references)
if (float.TryParse(val1, out var result7) && float.TryParse(val2, out var result8))
{
entry2.BoxedValue = (object)new Vector2(result7, result8);
}
};
Color? color2 = Color.red;
Color? color = Color.green;
UI.CreateDualInputField(parent4, label, value13, value14, onValueChanged4, (ContentType)3, (CharacterValidation)3, default(Vector2), color2, color);
float num8 = num;
rect = ((RectTransform)Templates.InputField.transform).rect;
num = num8 + (((Rect)(ref rect)).height + num2);
}
}
else
{
Color val15 = (Color)entry2.BoxedValue;
RectTransform parent5 = val7;
string value15 = val15.r.ToString(CultureInfo.InvariantCulture);
string value16 = val15.g.ToString(CultureInfo.InvariantCulture);
string value17 = val15.b.ToString(CultureInfo.InvariantCulture);
string value18 = val15.a.ToString(CultureInfo.InvariantCulture);
Action<string, string, string, string> onValueChanged5 = delegate(string val1, string val2, string val3, string val4)
{
//IL_003c: Unknown result type (might be due to invalid IL or missing references)
if (float.TryParse(val1, out var result3) && float.TryParse(val2, out var result4) && float.TryParse(val3, out var result5) && float.TryParse(val4, out var result6))
{
entry2.BoxedValue = (object)new Color(result3, result4, result5, result6);
}
};
Color? color3 = Color.red;
Color? color = Color.green;
Color? color2 = Color.blue;
UI.CreateQuadInputField(parent5, label, value15, value16, value17, value18, onValueChanged5, (ContentType)3, (CharacterValidation)3, default(Vector2), color3, color, color2);
float num9 = num;
rect = ((RectTransform)Templates.InputField.transform).rect;
num = num9 + (((Rect)(ref rect)).height + num2);
}
}
else
{
Type enumType = entry2.SettingType;
List<string> values = Enum.GetNames(enumType).ToList();
UI.CreateDropdown(val7, label, values, values.IndexOf(entry2.BoxedValue.ToString()), delegate(int value)
{
object boxedValue = Enum.Parse(enumType, values[value]);
entry2.BoxedValue = boxedValue;
});
float num10 = num;
rect = ((RectTransform)Templates.Dropdown.transform).rect;
num = num10 + (((Rect)(ref rect)).height + num2);
}
}
}
else
{
UI.CreateKeyBindingInput(val7, label, (KeyCode)entry2.BoxedValue, delegate(KeyCode key)
{
//IL_0007: Unknown result type (might be due to invalid IL or missing references)
entry2.BoxedValue = key;
}).Setup((Transform)(object)_settingsMenuTransform);
float num11 = num;
rect = ((RectTransform)((Component)Templates.KeyBindingInput).transform).rect;
num = num11 + (((Rect)(ref rect)).height + num2);
}
}
else if (entry2.Description.AcceptableValues is AcceptableValueList<string> val16)
{
List<string> valueList = val16.AcceptableValues.ToList();
UI.CreateDropdown(val7, label, valueList, valueList.IndexOf(entry2.BoxedValue.ToString()), delegate(int value)
{
entry2.BoxedValue = valueList[value];
});
float num12 = num;
rect = ((RectTransform)Templates.Dropdown.transform).rect;
num = num12 + (((Rect)(ref rect)).height + num2);
}
else
{
UI.CreateInputField(val7, label, entry2.BoxedValue.ToString(), delegate(string value)
{
entry2.BoxedValue = value;
}, (ContentType)0, (CharacterValidation)0);
float num13 = num;
rect = ((RectTransform)Templates.InputField.transform).rect;
num = num13 + (((Rect)(ref rect)).height + num2);
}
}
else if (entry2.Description.AcceptableValues is AcceptableValueRange<int> val17)
{
int minValue = val17.MinValue;
int maxValue = val17.MaxValue;
UI.CreateSlider(val7, label, (int)entry2.BoxedValue, delegate(float value)
{
entry2.BoxedValue = (int)value;
}, minValue, maxValue, 1f, "0");
float num14 = num;
rect = ((RectTransform)Templates.Slider.transform).rect;
num = num14 + (((Rect)(ref rect)).height + num2);
}
else
{
UI.CreateInputField(val7, label, entry2.BoxedValue.ToString(), delegate(string value)
{
if (int.TryParse(value, out var result2))
{
entry2.BoxedValue = result2;
}
}, (ContentType)2, (CharacterValidation)2);
float num15 = num;
rect = ((RectTransform)Templates.InputField.transform).rect;
num = num15 + (((Rect)(ref rect)).height + num2);
}
}
else if (entry2.Description.AcceptableValues is AcceptableValueRange<float> val18)
{
float minValue2 = val18.MinValue;
float maxValue2 = val18.MaxValue;
UI.CreateSlider(val7, label, (float)entry2.BoxedValue, delegate(float value)
{
entry2.BoxedValue = value;
}, minValue2, maxValue2, 0f);
float num16 = num;
rect = ((RectTransform)Templates.Slider.transform).rect;
num = num16 + (((Rect)(ref rect)).height + num2);
}
else
{
UI.CreateInputField(val7, label, entry2.BoxedValue.ToString(), delegate(string value)
{
if (float.TryParse(value, NumberStyles.Number, CultureInfo.InvariantCulture, out var result))
{
entry2.BoxedValue = result;
}
}, (ContentType)3, (CharacterValidation)3);
float num17 = num;
rect = ((RectTransform)Templates.InputField.transform).rect;
num = num17 + (((Rect)(ref rect)).height + num2);
}
}
else
{
UI.CreateToggle(val7, label, (bool)entry2.BoxedValue, delegate(bool isOn)
{
entry2.BoxedValue = isOn;
});
float num18 = num;
rect = ((RectTransform)Templates.Toggle.transform).rect;
num = num18 + (((Rect)(ref rect)).height + num2);
}
if (!Object.op_Implicit((Object)(object)firstElement))
{
firstElement = ((Component)((Transform)val7).GetChild(((Transform)val7).childCount - 1)).GetComponentInChildren<Selectable>(true);
}
if (num >= height - 50f)
{
val7 = CreateEntriesColumn(val5.content);
num = 0f;
rect = val5.content.rect;
height = ((Rect)(ref rect)).height;
}
}
}
return ((Component)val5).gameObject;
}
private static RectTransform CreateEntriesColumn(RectTransform parent)
{
//IL_0006: 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_003b: Unknown result type (might be due to invalid IL or missing references)
//IL_0051: Unknown result type (might be due to invalid IL or missing references)
//IL_0067: Unknown result type (might be due to invalid IL or missing references)
RectTransform val = new GameObject("column").AddComponent<RectTransform>();
((Transform)val).SetParent((Transform)(object)parent, false);
val.anchorMin = new Vector2(0f, 0f);
val.anchorMax = new Vector2(0f, 1f);
val.anchoredPosition = new Vector2(0f, 0f);
val.sizeDelta = new Vector2(300f, 0f);
VerticalLayoutGroup val2 = ((Component)val).gameObject.AddComponent<VerticalLayoutGroup>();
((HorizontalOrVerticalLayoutGroup)val2).childControlHeight = false;
((HorizontalOrVerticalLayoutGroup)val2).childForceExpandHeight = false;
((HorizontalOrVerticalLayoutGroup)val2).childForceExpandWidth = true;
((HorizontalOrVerticalLayoutGroup)val2).spacing = 5f;
return val;
}
private static Dictionary<string, ConfigEntryBase[]> GetModConfigs()
{
Dictionary<string, ConfigEntryBase[]> dictionary = new Dictionary<string, ConfigEntryBase[]>();
foreach (PluginInfo item in Chainloader.PluginInfos.Values.OrderBy((PluginInfo p) => p.Metadata.Name))
{
List<ConfigEntryBase> list = new List<ConfigEntryBase>();
foreach (ConfigEntryBase item2 in ((IEnumerable<KeyValuePair<ConfigDefinition, ConfigEntryBase>>)item.Instance.Config).Select((KeyValuePair<ConfigDefinition, ConfigEntryBase> configEntry) => configEntry.Value))
{
ConfigDescription description = item2.Description;
object[] array = ((description != null) ? description.Tags : null);
if (array == null || !array.Contains("Hidden"))
{
list.Add(item2);
}
}
if (list.Count > 0)
{
dictionary.TryAdd(PrettifyName(item.Metadata.Name), list.ToArray());
}
}
return dictionary;
}
private static string PrettifyName(string input)
{
input = Regex.Replace(input, "([a-z])([A-Z])", "$1 $2");
input = Regex.Replace(input, "([A-Z])([A-Z][a-z])", "$1 $2");
input = Regex.Replace(input, "\\s+", " ");
input = Regex.Replace(input, "([A-Z]\\.)\\s([A-Z]\\.)", "$1$2");
return input.Trim();
}
}
[BepInPlugin("ModMenu", "ModMenu", "1.2.0")]
[BepInDependency(/*Could not decode attribute arguments.*/)]
internal sealed class Plugin : BaseUnityPlugin
{
public static ManualLogSource Log { get; private set; }
private void Awake()
{
//IL_0012: Unknown result type (might be due to invalid IL or missing references)
//IL_0018: Expected O, but got Unknown
//IL_0050: Unknown result type (might be due to invalid IL or missing references)
Log = ((BaseUnityPlugin)this).Logger;
Harmony val = new Harmony("ModMenu.patch");
val.PatchAll();
new Hook((MethodBase)AccessTools.Method(typeof(UI_SettingsMenu), "Start", (Type[])null, (Type[])null), (Delegate)new Action<Action<UI_SettingsMenu>, UI_SettingsMenu>(UI_SettingsMenu_StartHook));
((BaseUnityPlugin)this).Logger.LogInfo((object)"Plugin ModMenu is loaded!");
}
private static void UI_SettingsMenu_StartHook(Action<UI_SettingsMenu> orig, UI_SettingsMenu self)
{
Templates.LoadTemplates(((Component)self).transform);
if (!Object.op_Implicit((Object)(object)((Component)self).GetComponent<ModMenuBehavior>()))
{
((Component)self).gameObject.AddComponent<ModMenuBehavior>();
}
}
}
public static class Templates
{
public static GameObject Button;
public static GameObject MainTabButton;
public static GameObject Toggle;
public static GameObject Dropdown;
public static GameObject Slider;
public static GameObject TabButton;
public static GameObject SettingsPanel;
public static GameObject InputField;
public static UI_TabGroup TabGroup;
public static ScrollRect ScrollRect;
public static TMP_Text Label;
public static KeyCodeInput KeyBindingInput;
private static RectTransform _settingsRoot;
private static GameObject _templateContainer;
private static bool _loaded;
public static void LoadTemplates(Transform target)
{
//IL_0016: Unknown result type (might be due to invalid IL or missing references)
//IL_0020: Expected O, but got Unknown
//IL_02cc: Unknown result type (might be due to invalid IL or missing references)
//IL_03f3: Unknown result type (might be due to invalid IL or missing references)
if (_loaded)
{
return;
}
_templateContainer = new GameObject("[TemplateContainer]");
Object.DontDestroyOnLoad((Object)(object)_templateContainer);
_templateContainer.SetActive(false);
GameObject obj = target.Search("SettingsParent/Settings Pane");
_settingsRoot = ((obj != null) ? obj.GetComponent<RectTransform>() : null);
if (!CheckValidity((Object)(object)_settingsRoot, "settingsRoot"))
{
return;
}
Button = MakeTemplate(((Transform)(object)_settingsRoot).Search("Save And Close"));
((Object)Button).name = "Button";
if (!CheckValidity((Object)(object)Button, "button"))
{
return;
}
Object.DestroyImmediate((Object)(object)Button.GetComponent<UI_CloseButtonOnBack>());
Button.GetComponent<UT_ButtonAudio>().onSubmit = false;
MainTabButton = MakeTemplate(((Transform)(object)_settingsRoot).Search("Tab Selection Hor/Accessibility"));
if (!CheckValidity((Object)(object)MainTabButton, "mainTabButton"))
{
return;
}
((Object)MainTabButton).name = "MainTabButton";
((UnityEventBase)MainTabButton.GetComponent<Button>().onClick).RemoveAllListeners();
Toggle = MakeTemplate(((Transform)(object)_settingsRoot).Search("Video Settings/Options Tab/Video/Fullscreen Toggle"));
if (!CheckValidity((Object)(object)Toggle, "toggle"))
{
return;
}
((Object)Toggle).name = "Toggle";
Object.DestroyImmediate((Object)(object)Toggle.GetComponent<ToggleSettingsBinder>());
Dropdown = MakeTemplate(((Transform)(object)_settingsRoot).Search("Video Settings/Options Tab/Video/Screen Resolution"));
if (!CheckValidity((Object)(object)Dropdown, "dropdown"))
{
return;
}
((Object)Dropdown).name = "Dropdown";
Object.DestroyImmediate((Object)(object)Dropdown.GetComponent<Settings_Resolution>());
TMP_Dropdown componentInChildren = Dropdown.GetComponentInChildren<TMP_Dropdown>(true);
componentInChildren.ClearOptions();
InputField = MakeTemplate(Dropdown);
if (!CheckValidity((Object)(object)InputField, "InputField"))
{
return;
}
((Object)InputField).name = "InputField";
Transform child = InputField.transform.GetChild(0);
((Object)child).name = "Text Area";
((Component)child).gameObject.AddComponent<RectMask2D>();
Object.DestroyImmediate((Object)(object)((Component)child).GetComponent<TMP_Dropdown>());
Object.DestroyImmediate((Object)(object)child.Search("Arrow"));
Object.DestroyImmediate((Object)(object)child.Search("Template"));
Object.DestroyImmediate((Object)(object)InputField.GetComponent<Settings_Resolution>());
GameObject val = child.Search("Label");
TMP_Text component = Object.Instantiate<GameObject>(val, val.transform.parent, false).GetComponent<TMP_Text>();
((Graphic)component).color = new Color(1f, 1f, 1f, 0.5f);
TMP_InputField val2 = ((Component)child).gameObject.AddComponent<TMP_InputField>();
? val3 = val2;
Transform transform = ((Component)child).transform;
((TMP_InputField)val3).textViewport = (RectTransform)(object)((transform is RectTransform) ? transform : null);
val2.textComponent = val.GetComponent<TMP_Text>();
val2.placeholder = (Graphic)(object)component;
val2.fontAsset = component.font;
val2.pointSize = component.fontSize;
KeyBindingInput = MakeTemplate(Dropdown).AddComponent<KeyCodeInput>();
if (!CheckValidity((Object)(object)KeyBindingInput, "KeyBindingInput"))
{
return;
}
((Object)((Component)KeyBindingInput).gameObject).name = "KeyBindingInput";
Transform child2 = ((Component)KeyBindingInput).transform.GetChild(0);
((Component)child2).gameObject.AddComponent<RectMask2D>();
Object.DestroyImmediate((Object)(object)((Component)child2).GetComponent<TMP_Dropdown>());
Object.DestroyImmediate((Object)(object)child2.Search("Arrow"));
Object.DestroyImmediate((Object)(object)child2.Search("Template"));
Object.DestroyImmediate((Object)(object)((Component)KeyBindingInput).GetComponent<Settings_Resolution>());
Button val4 = ((Component)KeyBindingInput).gameObject.AddComponent<Button>();
((Selectable)val4).targetGraphic = ((Component)child2).GetComponent<Graphic>();
((Selectable)val4).colors = ((Selectable)componentInChildren).colors;
Slider = MakeTemplate(((Transform)(object)_settingsRoot).Search("Video Settings/Options Tab/Video/SliderAsset - Brightness"));
if (!CheckValidity((Object)(object)Slider, "slider"))
{
return;
}
((Object)Slider).name = "Slider";
Object.DestroyImmediate((Object)(object)Slider.GetComponentInChildren<SliderSettingBinder>(true));
TextSettingsBinder componentInChildren2 = Slider.GetComponentInChildren<TextSettingsBinder>(true);
((Component)componentInChildren2).gameObject.AddComponent<SliderTextSync>();
Object.DestroyImmediate((Object)(object)componentInChildren2);
TabButton = MakeTemplate(((Transform)(object)_settingsRoot).Search("Controls Page/Controls Page Tab Selector/Options"));
if (!CheckValidity((Object)(object)TabButton, "tabButton"))
{
return;
}
((Object)TabButton.gameObject).name = "TabButton";
Label = MakeTemplate(((Transform)(object)_settingsRoot).Search("Video Settings/Options Tab/Video/Video Settings")).GetComponent<TMP_Text>();
if (!CheckValidity((Object)(object)Label, "Label"))
{
return;
}
((Object)((Component)Label).gameObject).name = "Label";
SettingsPanel = MakeTemplate(((Transform)(object)_settingsRoot).Search("Video Settings"));
if (!CheckValidity((Object)(object)SettingsPanel, "SettingsPanel"))
{
return;
}
((Object)SettingsPanel).name = "SettingsPanel";
Object.DestroyImmediate((Object)(object)SettingsPanel.Search("Options Tab"));
TabGroup = MakeTemplate(((Transform)(object)_settingsRoot).Search("Tab Selection Hor")).GetComponent<UI_TabGroup>();
if (!CheckValidity((Object)(object)TabGroup, "TabGroup"))
{
return;
}
((Object)((Component)TabGroup).gameObject).name = "TabGroup";
ScrollRect = MakeTemplate(target.parent.parent.Search("Canvas - Screen - Play/Play Menu/Play Pane/Tab Objects/Play Pane - Scroll View Tab - Endless Variant")).GetComponent<ScrollRect>();
if (CheckValidity((Object)(object)ScrollRect, "ScrollRect"))
{
((Object)((Component)ScrollRect).gameObject).name = "ScrollRect";
RectTransform content = ScrollRect.content;
for (int num = ((Transform)content).childCount - 1; num >= 0; num--)
{
Object.DestroyImmediate((Object)(object)((Component)((Transform)content).GetChild(num)).gameObject);
}
((Behaviour)((Component)content).GetComponent<ContentSizeFitter>()).enabled = true;
_loaded = true;
}
}
private static bool CheckValidity(Object obj, string name)
{
if (!Object.op_Implicit(obj))
{
Plugin.Log.LogError((object)(name + " is null"));
return false;
}
return true;
}
private static GameObject MakeTemplate(GameObject source)
{
if (!Object.op_Implicit((Object)(object)source))
{
return null;
}
GameObject val = Object.Instantiate<GameObject>(source, _templateContainer.transform, false);
val.SetActive(true);
return val;
}
}
public static class UI
{
public static Button CreateButton(RectTransform parent, string label, UnityAction onClick = null, Color? normalColor = null, Color? highlightedColor = null, Color? pressedColor = null, Color? selectedColor = null, Color? disabledColor = null, Color? labelColor = null, Vector2 size = default(Vector2))
{
//IL_001c: Unknown result type (might be due to invalid IL or missing references)
//IL_0028: Unknown result type (might be due to invalid IL or missing references)
//IL_0034: Unknown result type (might be due to invalid IL or missing references)
//IL_003f: Unknown result type (might be due to invalid IL or missing references)
//IL_0043: Unknown result type (might be due to invalid IL or missing references)
//IL_0049: Unknown result type (might be due to invalid IL or missing references)
//IL_0069: Unknown result type (might be due to invalid IL or missing references)
//IL_0057: Unknown result type (might be due to invalid IL or missing references)
//IL_0086: Unknown result type (might be due to invalid IL or missing references)
//IL_007d: Unknown result type (might be due to invalid IL or missing references)
//IL_00bd: 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_00f4: Unknown result type (might be due to invalid IL or missing references)
//IL_00eb: Unknown result type (might be due to invalid IL or missing references)
//IL_012b: Unknown result type (might be due to invalid IL or missing references)
//IL_0122: Unknown result type (might be due to invalid IL or missing references)
//IL_0162: Unknown result type (might be due to invalid IL or missing references)
//IL_0159: Unknown result type (might be due to invalid IL or missing references)
//IL_0170: Unknown result type (might be due to invalid IL or missing references)
//IL_0175: Unknown result type (might be due to invalid IL or missing references)
//IL_0187: Unknown result type (might be due to invalid IL or missing references)
//IL_018c: Unknown result type (might be due to invalid IL or missing references)
//IL_019b: Unknown result type (might be due to invalid IL or missing references)
//IL_021f: Unknown result type (might be due to invalid IL or missing references)
//IL_0216: Unknown result type (might be due to invalid IL or missing references)
GameObject val = Object.Instantiate<GameObject>(Templates.Button);
RectTransform component = val.GetComponent<RectTransform>();
((Transform)component).SetParent((Transform)(object)parent);
((Transform)component).localPosition = Vector3.zero;
((Transform)component).localScale = Vector3.one;
((Transform)component).localRotation = Quaternion.identity;
if (size != default(Vector2))
{
component.sizeDelta = size;
}
Button component2 = val.GetComponent<Button>();
ColorBlock colors = default(ColorBlock);
((ColorBlock)(ref colors)).normalColor = (Color)(((??)normalColor) ?? Color.white);
((ColorBlock)(ref colors)).highlightedColor = (Color)(((??)highlightedColor) ?? new Color(1f, 0f, 0.0651f, 1f));
((ColorBlock)(ref colors)).pressedColor = (Color)(((??)pressedColor) ?? new Color(0.7843f, 0.7843f, 0.7843f, 1f));
((ColorBlock)(ref colors)).selectedColor = (Color)(((??)selectedColor) ?? new Color(1f, 0.0479f, 0f, 1f));
((ColorBlock)(ref colors)).disabledColor = (Color)(((??)disabledColor) ?? new Color(0.7843f, 0.7843f, 0.7843f, 0.502f));
ColorBlock colors2 = ((Selectable)component2).colors;
((ColorBlock)(ref colors)).colorMultiplier = ((ColorBlock)(ref colors2)).colorMultiplier;
colors2 = ((Selectable)component2).colors;
((ColorBlock)(ref colors)).fadeDuration = ((ColorBlock)(ref colors2)).fadeDuration;
((Selectable)component2).colors = colors;
((UnityEventBase)component2.onClick).m_PersistentCalls.Clear();
((UnityEventBase)component2.onClick).RemoveAllListeners();
if (onClick != null)
{
((UnityEvent)component2.onClick).AddListener(onClick);
}
TMP_Text componentInChildren = val.GetComponentInChildren<TMP_Text>(true);
componentInChildren.text = label;
componentInChildren.fontSizeMin = 0f;
componentInChildren.fontSizeMax = componentInChildren.fontSize;
componentInChildren.enableAutoSizing = true;
((Graphic)componentInChildren).color = (Color)(((??)labelColor) ?? Color.white);
return component2;
}
public static Toggle CreateToggle(RectTransform parent, string label, bool value = false, UnityAction<bool> onClick = null, Color? normalColor = null, Color? highlightedColor = null, Color? pressedColor = null, Color? selectedColor = null, Color? disabledColor = null, Vector2 size = default(Vector2))
{
//IL_001c: Unknown result type (might be due to invalid IL or missing references)
//IL_0028: Unknown result type (might be due to invalid IL or missing references)
//IL_0034: Unknown result type (might be due to invalid IL or missing references)
//IL_003f: Unknown result type (might be due to invalid IL or missing references)
//IL_0043: Unknown result type (might be due to invalid IL or missing references)
//IL_0049: Unknown result type (might be due to invalid IL or missing references)
//IL_0069: Unknown result type (might be due to invalid IL or missing references)
//IL_0057: Unknown result type (might be due to invalid IL or missing references)
//IL_0087: Unknown result type (might be due to invalid IL or missing references)
//IL_007e: Unknown result type (might be due to invalid IL or missing references)
//IL_00be: Unknown result type (might be due to invalid IL or missing references)
//IL_00b5: Unknown result type (might be due to invalid IL or missing references)
//IL_00f5: Unknown result type (might be due to invalid IL or missing references)
//IL_00ec: Unknown result type (might be due to invalid IL or missing references)
//IL_012c: Unknown result type (might be due to invalid IL or missing references)
//IL_0123: Unknown result type (might be due to invalid IL or missing references)
//IL_0163: Unknown result type (might be due to invalid IL or missing references)
//IL_015a: Unknown result type (might be due to invalid IL or missing references)
//IL_0171: Unknown result type (might be due to invalid IL or missing references)
//IL_0176: Unknown result type (might be due to invalid IL or missing references)
//IL_0188: Unknown result type (might be due to invalid IL or missing references)
//IL_018d: Unknown result type (might be due to invalid IL or missing references)
//IL_019c: Unknown result type (might be due to invalid IL or missing references)
GameObject val = Object.Instantiate<GameObject>(Templates.Toggle);
RectTransform component = val.GetComponent<RectTransform>();
((Transform)component).SetParent((Transform)(object)parent);
((Transform)component).localPosition = Vector3.zero;
((Transform)component).localScale = Vector3.one;
((Transform)component).localRotation = Quaternion.identity;
if (size != default(Vector2))
{
component.sizeDelta = size;
}
Toggle component2 = val.GetComponent<Toggle>();
ColorBlock colors = default(ColorBlock);
((ColorBlock)(ref colors)).normalColor = (Color)(((??)normalColor) ?? Color.white);
((ColorBlock)(ref colors)).highlightedColor = (Color)(((??)highlightedColor) ?? new Color(1f, 0f, 0f, 1f));
((ColorBlock)(ref colors)).pressedColor = (Color)(((??)pressedColor) ?? new Color(0.7843f, 0.7843f, 0.7843f, 1f));
((ColorBlock)(ref colors)).selectedColor = (Color)(((??)selectedColor) ?? new Color(1f, 0f, 0f, 1f));
((ColorBlock)(ref colors)).disabledColor = (Color)(((??)disabledColor) ?? new Color(0.7843f, 0.7843f, 0.7843f, 0.502f));
ColorBlock colors2 = ((Selectable)component2).colors;
((ColorBlock)(ref colors)).colorMultiplier = ((ColorBlock)(ref colors2)).colorMultiplier;
colors2 = ((Selectable)component2).colors;
((ColorBlock)(ref colors)).fadeDuration = ((ColorBlock)(ref colors2)).fadeDuration;
((Selectable)component2).colors = colors;
((UnityEventBase)component2.onValueChanged).m_PersistentCalls.Clear();
((UnityEventBase)component2.onValueChanged).RemoveAllListeners();
if (onClick != null)
{
((UnityEvent<bool>)(object)component2.onValueChanged).AddListener(onClick);
}
component2.SetIsOnWithoutNotify(value);
TMP_Text componentInChildren = val.GetComponentInChildren<TMP_Text>(true);
componentInChildren.text = label;
componentInChildren.fontSizeMin = 0f;
componentInChildren.fontSizeMax = componentInChildren.fontSize;
componentInChildren.enableAutoSizing = true;
return component2;
}
public static TMP_Dropdown CreateDropdown(RectTransform parent, string label, List<string> options, int value = 0, UnityAction<int> onValueChanged = null, Vector2 size = default(Vector2))
{
//IL_001c: Unknown result type (might be due to invalid IL or missing references)
//IL_0028: Unknown result type (might be due to invalid IL or missing references)
//IL_0034: Unknown result type (might be due to invalid IL or missing references)
//IL_003f: Unknown result type (might be due to invalid IL or missing references)
//IL_0043: Unknown result type (might be due to invalid IL or missing references)
//IL_0049: Unknown result type (might be due to invalid IL or missing references)
//IL_0057: Unknown result type (might be due to invalid IL or missing references)
GameObject val = Object.Instantiate<GameObject>(Templates.Dropdown);
RectTransform component = val.GetComponent<RectTransform>();
((Transform)component).SetParent((Transform)(object)parent);
((Transform)component).localPosition = Vector3.zero;
((Transform)component).localScale = Vector3.one;
((Transform)component).localRotation = Quaternion.identity;
if (size != default(Vector2))
{
component.sizeDelta = size;
}
TMP_Dropdown componentInChildren = val.GetComponentInChildren<TMP_Dropdown>(true);
((UnityEventBase)componentInChildren.onValueChanged).m_PersistentCalls.Clear();
((UnityEventBase)componentInChildren.onValueChanged).RemoveAllListeners();
if (onValueChanged != null)
{
((UnityEvent<int>)(object)componentInChildren.onValueChanged).AddListener(onValueChanged);
}
componentInChildren.ClearOptions();
componentInChildren.AddOptions(options);
componentInChildren.SetValueWithoutNotify(value);
TMP_Text component2 = val.GetComponent<TMP_Text>();
component2.text = label;
component2.fontSizeMin = 0f;
component2.fontSizeMax = component2.fontSize;
component2.enableAutoSizing = true;
return componentInChildren;
}
public static KeyCodeInput CreateKeyBindingInput(RectTransform parent, string label, KeyCode value = 0, UnityAction<KeyCode> onValueChanged = null, Vector2 size = default(Vector2))
{
//IL_001c: Unknown result type (might be due to invalid IL or missing references)
//IL_0028: Unknown result type (might be due to invalid IL or missing references)
//IL_0034: Unknown result type (might be due to invalid IL or missing references)
//IL_003f: Unknown result type (might be due to invalid IL or missing references)
//IL_0043: Unknown result type (might be due to invalid IL or missing references)
//IL_0049: Unknown result type (might be due to invalid IL or missing references)
//IL_0057: Unknown result type (might be due to invalid IL or missing references)
//IL_009b: Unknown result type (might be due to invalid IL or missing references)
KeyCodeInput keyCodeInput = Object.Instantiate<KeyCodeInput>(Templates.KeyBindingInput);
RectTransform component = ((Component)keyCodeInput).GetComponent<RectTransform>();
((Transform)component).SetParent((Transform)(object)parent);
((Transform)component).localPosition = Vector3.zero;
((Transform)component).localScale = Vector3.one;
((Transform)component).localRotation = Quaternion.identity;
if (size != default(Vector2))
{
component.sizeDelta = size;
}
KeyCodeInput component2 = ((Component)keyCodeInput).GetComponent<KeyCodeInput>();
((UnityEventBase)component2.onValueChanged).m_PersistentCalls.Clear();
((UnityEventBase)component2.onValueChanged).RemoveAllListeners();
if (onValueChanged != null)
{
component2.onValueChanged.AddListener(onValueChanged);
}
component2.SetValueWithoutNotify(value);
TMP_Text component3 = ((Component)keyCodeInput).GetComponent<TMP_Text>();
component3.text = label;
component3.fontSizeMin = 0f;
component3.fontSizeMax = component3.fontSize;
component3.enableAutoSizing = true;
return component2;
}
public static SubmitSlider CreateSlider(RectTransform parent, string label, float value = 0f, UnityAction<float> onValueChanged = null, float minValue = 0f, float maxValue = 1f, float stepSize = 0.1f, string displayFormat = "0.00", Vector2 size = default(Vector2))
{
//IL_001b: 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_0033: 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_00e6: Unknown result type (might be due to invalid IL or missing references)
//IL_00f2: Unknown result type (might be due to invalid IL or missing references)
GameObject val = Object.Instantiate<GameObject>(Templates.Slider);
RectTransform component = val.GetComponent<RectTransform>();
((Transform)component).SetParent((Transform)(object)parent);
if (size != default(Vector2))
{
component.sizeDelta = size;
}
SubmitSlider componentInChildren = val.GetComponentInChildren<SubmitSlider>(true);
((UnityEventBase)componentInChildren.onValueChanged).m_PersistentCalls.Clear();
((UnityEventBase)componentInChildren.onValueChanged).RemoveAllListeners();
if (onValueChanged != null)
{
((UnityEvent<float>)(object)componentInChildren.onValueChanged).AddListener(onValueChanged);
}
componentInChildren.minValue = minValue;
componentInChildren.maxValue = maxValue;
componentInChildren.stepAmount = stepSize;
componentInChildren.SetValueWithoutNotify(value);
val.GetComponentInChildren<SliderTextSync>(true).Setup(componentInChildren, displayFormat);
TMP_Text component2 = ((Component)component).GetComponent<TMP_Text>();
component2.text = label;
component2.fontSizeMin = 0f;
component2.fontSizeMax = component2.fontSize;
component2.enableAutoSizing = true;
((Transform)component).localPosition = Vector3.zero;
((Transform)component).localScale = Vector3.one;
((Transform)component).localRotation = Quaternion.identity;
return componentInChildren;
}
public static TMP_InputField CreateInputField(RectTransform parent, string label, string value = "", UnityAction<string> onValueChanged = null, ContentType contentType = 0, CharacterValidation characterValidation = 0, Vector2 size = default(Vector2), Color? color = null)
{
//IL_001c: Unknown result type (might be due to invalid IL or missing references)
//IL_0028: Unknown result type (might be due to invalid IL or missing references)
//IL_0034: Unknown result type (might be due to invalid IL or missing references)
//IL_003f: Unknown result type (might be due to invalid IL or missing references)
//IL_0043: Unknown result type (might be due to invalid IL or missing references)
//IL_0049: Unknown result type (might be due to invalid IL or missing references)
//IL_0070: Unknown result type (might be due to invalid IL or missing references)
//IL_0079: Unknown result type (might be due to invalid IL or missing references)
//IL_0096: Unknown result type (might be due to invalid IL or missing references)
//IL_0057: Unknown result type (might be due to invalid IL or missing references)
//IL_0105: Unknown result type (might be due to invalid IL or missing references)
//IL_00fc: Unknown result type (might be due to invalid IL or missing references)
GameObject val = Object.Instantiate<GameObject>(Templates.InputField);
RectTransform component = val.GetComponent<RectTransform>();
((Transform)component).SetParent((Transform)(object)parent);
((Transform)component).localPosition = Vector3.zero;
((Transform)component).localScale = Vector3.one;
((Transform)component).localRotation = Quaternion.identity;
if (size != default(Vector2))
{
component.sizeDelta = size;
}
TMP_InputField componentInChildren = val.GetComponentInChildren<TMP_InputField>(true);
componentInChildren.richText = false;
componentInChildren.contentType = contentType;
componentInChildren.characterValidation = characterValidation;
componentInChildren.selectionColor = new Color(0.6981f, 0.1153f, 0.1153f, 0.75f);
((UnityEventBase)componentInChildren.onValueChanged).m_PersistentCalls.Clear();
((UnityEventBase)componentInChildren.onValueChanged).RemoveAllListeners();
if (onValueChanged != null)
{
((UnityEvent<string>)(object)componentInChildren.onValueChanged).AddListener(onValueChanged);
}
componentInChildren.SetTextWithoutNotify(value);
((Component)componentInChildren).gameObject.AddComponent<InputFieldValidator>();
((Graphic)((Component)componentInChildren).GetComponent<Image>()).color = (Color)(((??)color) ?? Color.white);
TMP_Text component2 = val.GetComponent<TMP_Text>();
component2.text = label;
component2.fontSizeMin = 0f;
component2.fontSizeMax = component2.fontSize;
component2.enableAutoSizing = true;
return componentInChildren;
}
public static GameObject CreateDualInputField(RectTransform parent, string label, string value1 = "", string value2 = "", Action<string, string> onValueChanged = null, ContentType contentType = 0, CharacterValidation characterValidation = 0, Vector2 size = default(Vector2), Color? color1 = null, Color? color2 = null)
{
//IL_0014: 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_0018: Unknown result type (might be due to invalid IL or missing references)
//IL_003e: Unknown result type (might be due to invalid IL or missing references)
//IL_0048: 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_0064: Unknown result type (might be due to invalid IL or missing references)
//IL_00b5: Unknown result type (might be due to invalid IL or missing references)
//IL_00c0: Unknown result type (might be due to invalid IL or missing references)
//IL_00ca: Unknown result type (might be due to invalid IL or missing references)
//IL_00f5: Unknown result type (might be due to invalid IL or missing references)
//IL_00ec: Unknown result type (might be due to invalid IL or missing references)
TMP_InputField inputField1 = CreateInputField(parent, label, value1, null, contentType, characterValidation, size, color1);
Transform transform = ((Component)inputField1).transform;
RectTransform val = (RectTransform)(object)((transform is RectTransform) ? transform : null);
val.anchoredPosition = new Vector2(35f, val.anchoredPosition.y);
val.sizeDelta = new Vector2(60f, val.sizeDelta.y);
inputField1.SetTextWithoutNotify(value1);
TMP_InputField inputField2 = Object.Instantiate<TMP_InputField>(inputField1, ((Component)inputField1).transform.parent);
inputField2.SetTextWithoutNotify(value2);
((RectTransform)((Component)inputField2).transform).anchoredPosition = new Vector2(100f, val.anchoredPosition.y);
((Graphic)((Component)inputField2).GetComponent<Image>()).color = (Color)(((??)color2) ?? Color.white);
if (onValueChanged != null)
{
((UnityEvent<string>)(object)inputField1.onValueChanged).AddListener((UnityAction<string>)delegate
{
onValueChanged(inputField1.text, inputField2.text);
});
((UnityEvent<string>)(object)inputField2.onValueChanged).AddListener((UnityAction<string>)delegate
{
onValueChanged(inputField1.text, inputField2.text);
});
}
return ((Component)((Component)inputField1).transform.parent).gameObject;
}
public static GameObject CreateTrippleInputField(RectTransform parent, string label, string value1 = "", string value2 = "", string value3 = "", Action<string, string, string> onValueChanged = null, ContentType contentType = 0, CharacterValidation characterValidation = 0, Vector2 size = default(Vector2), Color? color1 = null, Color? color2 = null, Color? color3 = null)
{
//IL_0014: 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_0018: Unknown result type (might be due to invalid IL or missing references)
//IL_003e: Unknown result type (might be due to invalid IL or missing references)
//IL_0048: 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_0064: Unknown result type (might be due to invalid IL or missing references)
//IL_00b5: Unknown result type (might be due to invalid IL or missing references)
//IL_00c0: Unknown result type (might be due to invalid IL or missing references)
//IL_00ca: Unknown result type (might be due to invalid IL or missing references)
//IL_00f5: Unknown result type (might be due to invalid IL or missing references)
//IL_00ec: Unknown result type (might be due to invalid IL or missing references)
//IL_013a: Unknown result type (might be due to invalid IL or missing references)
//IL_0145: Unknown result type (might be due to invalid IL or missing references)
//IL_014f: Unknown result type (might be due to invalid IL or missing references)
//IL_017a: Unknown result type (might be due to invalid IL or missing references)
//IL_0171: Unknown result type (might be due to invalid IL or missing references)
TMP_InputField inputField1 = CreateInputField(parent, label, value1, null, contentType, characterValidation, size, color1);
Transform transform = ((Component)inputField1).transform;
RectTransform val = (RectTransform)(object)((transform is RectTransform) ? transform : null);
val.anchoredPosition = new Vector2(35f, val.anchoredPosition.y);
val.sizeDelta = new Vector2(60f, val.sizeDelta.y);
inputField1.SetTextWithoutNotify(value1);
TMP_InputField inputField2 = Object.Instantiate<TMP_InputField>(inputField1, ((Component)inputField1).transform.parent);
inputField2.SetTextWithoutNotify(value2);
((RectTransform)((Component)inputField2).transform).anchoredPosition = new Vector2(100f, val.anchoredPosition.y);
((Graphic)((Component)inputField2).GetComponent<Image>()).color = (Color)(((??)color2) ?? Color.white);
TMP_InputField inputField3 = Object.Instantiate<TMP_InputField>(inputField1, ((Component)inputField1).transform.parent);
inputField3.SetTextWithoutNotify(value3);
((RectTransform)((Component)inputField3).transform).anchoredPosition = new Vector2(165f, val.anchoredPosition.y);
((Graphic)((Component)inputField3).GetComponent<Image>()).color = (Color)(((??)color3) ?? Color.white);
if (onValueChanged != null)
{
((UnityEvent<string>)(object)inputField1.onValueChanged).AddListener((UnityAction<string>)delegate
{
onValueChanged(inputField1.text, inputField2.text, inputField3.text);
});
((UnityEvent<string>)(object)inputField2.onValueChanged).AddListener((UnityAction<string>)delegate
{
onValueChanged(inputField1.text, inputField2.text, inputField3.text);
});
((UnityEvent<string>)(object)inputField3.onValueChanged).AddListener((UnityAction<string>)delegate
{
onValueChanged(inputField1.text, inputField2.text, inputField3.text);
});
}
return ((Component)((Component)inputField1).transform.parent).gameObject;
}
public static GameObject CreateQuadInputField(RectTransform parent, string label, string value1 = "", string value2 = "", string value3 = "", string value4 = "", Action<string, string, string, string> onValueChanged = null, ContentType contentType = 0, CharacterValidation characterValidation = 0, Vector2 size = default(Vector2), Color? color1 = null, Color? color2 = null, Color? color3 = null, Color? color4 = null)
{
//IL_0014: 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_0018: Unknown result type (might be due to invalid IL or missing references)
//IL_003e: Unknown result type (might be due to invalid IL or missing references)
//IL_0048: 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_0064: Unknown result type (might be due to invalid IL or missing references)
//IL_00b5: Unknown result type (might be due to invalid IL or missing references)
//IL_00c0: Unknown result type (might be due to invalid IL or missing references)
//IL_00ca: Unknown result type (might be due to invalid IL or missing references)
//IL_00f5: Unknown result type (might be due to invalid IL or missing references)
//IL_00ec: Unknown result type (might be due to invalid IL or missing references)
//IL_013a: Unknown result type (might be due to invalid IL or missing references)
//IL_0145: Unknown result type (might be due to invalid IL or missing references)
//IL_014f: Unknown result type (might be due to invalid IL or missing references)
//IL_017a: Unknown result type (might be due to invalid IL or missing references)
//IL_0171: Unknown result type (might be due to invalid IL or missing references)
//IL_01bf: Unknown result type (might be due to invalid IL or missing references)
//IL_01ca: Unknown result type (might be due to invalid IL or missing references)
//IL_01d4: Unknown result type (might be due to invalid IL or missing references)
//IL_01ff: Unknown result type (might be due to invalid IL or missing references)
//IL_01f6: Unknown result type (might be due to invalid IL or missing references)
TMP_InputField inputField1 = CreateInputField(parent, label, value1, null, contentType, characterValidation, size, color1);
Transform transform = ((Component)inputField1).transform;
RectTransform val = (RectTransform)(object)((transform is RectTransform) ? transform : null);
val.anchoredPosition = new Vector2(35f, val.anchoredPosition.y);
val.sizeDelta = new Vector2(60f, val.sizeDelta.y);
inputField1.SetTextWithoutNotify(value1);
TMP_InputField inputField2 = Object.Instantiate<TMP_InputField>(inputField1, ((Component)inputField1).transform.parent);
inputField2.SetTextWithoutNotify(value2);
((RectTransform)((Component)inputField2).transform).anchoredPosition = new Vector2(100f, val.anchoredPosition.y);
((Graphic)((Component)inputField2).GetComponent<Image>()).color = (Color)(((??)color2) ?? Color.white);
TMP_InputField inputField3 = Object.Instantiate<TMP_InputField>(inputField1, ((Component)inputField1).transform.parent);
inputField3.SetTextWithoutNotify(value3);
((RectTransform)((Component)inputField3).transform).anchoredPosition = new Vector2(165f, val.anchoredPosition.y);
((Graphic)((Component)inputField3).GetComponent<Image>()).color = (Color)(((??)color3) ?? Color.white);
TMP_InputField inputField4 = Object.Instantiate<TMP_InputField>(inputField1, ((Component)inputField1).transform.parent);
inputField4.SetTextWithoutNotify(value4);
((RectTransform)((Component)inputField4).transform).anchoredPosition = new Vector2(230f, val.anchoredPosition.y);
((Graphic)((Component)inputField4).GetComponent<Image>()).color = (Color)(((??)color4) ?? Color.white);
if (onValueChanged != null)
{
((UnityEvent<string>)(object)inputField1.onValueChanged).AddListener((UnityAction<string>)delegate
{
onValueChanged(inputField1.text, inputField2.text, inputField3.text, inputField4.text);
});
((UnityEvent<string>)(object)inputField2.onValueChanged).AddListener((UnityAction<string>)delegate
{
onValueChanged(inputField1.text, inputField2.text, inputField3.text, inputField4.text);
});
((UnityEvent<string>)(object)inputField3.onValueChanged).AddListener((UnityAction<string>)delegate
{
onValueChanged(inputField1.text, inputField2.text, inputField3.text, inputField4.text);
});
((UnityEvent<string>)(object)inputField4.onValueChanged).AddListener((UnityAction<string>)delegate
{
onValueChanged(inputField1.text, inputField2.text, inputField3.text, inputField4.text);
});
}
return ((Component)((Component)inputField1).transform.parent).gameObject;
}
public static RectTransform CreateSettingsPanel(RectTransform parent, string label)
{
GameObject val = Object.Instantiate<GameObject>(Templates.SettingsPanel, (Transform)(object)parent, false);
val.GetComponentInChildren<TMP_Text>(true).text = label;
return val.GetComponent<RectTransform>();
}
public static UI_TabGroup CreateTabGroup(RectTransform parent, GameObject target = null, bool vertical = false, bool supportGamepad = true, Color? closeColor = null, Color? openColor = null, string tabLeftButton = "TabMainLeft", string tabRightButton = "TabMainRight")
{
//IL_0018: Unknown result type (might be due to invalid IL or missing references)
//IL_001e: Expected O, but got Unknown
//IL_0082: 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_0087: Unknown result type (might be due to invalid IL or missing references)
//IL_00b7: Unknown result type (might be due to invalid IL or missing references)
//IL_00ae: Unknown result type (might be due to invalid IL or missing references)
//IL_00bc: Unknown result type (might be due to invalid IL or missing references)
//IL_00c2: Unknown result type (might be due to invalid IL or missing references)
//IL_00cc: Expected O, but got Unknown
GameObject val = target;
if (!Object.op_Implicit((Object)(object)val))
{
val = new GameObject("TabGroup");
((Transform)val.AddComponent<RectTransform>()).SetParent((Transform)(object)parent, false);
}
val.AddComponent<CanvasGroup>();
UI_TabGroup val2 = val.AddComponent<UI_TabGroup>();
Transform transform = val.transform;
RectTransform val3 = (RectTransform)(object)((transform is RectTransform) ? transform : null);
val2.switchTabSound = Templates.TabGroup.switchTabSound;
val2.openColor = (Color)(((??)openColor) ?? new Color(0.6981f, 0.1153f, 0.1153f, 1f));
val2.closeColor = (Color)(((??)closeColor) ?? new Color(0.2642f, 0.2642f, 0.2642f, 1f));
val2.EventOnChangeTab = new UnityEvent();
HorizontalOrVerticalLayoutGroup val4 = val.GetComponent<HorizontalOrVerticalLayoutGroup>();
if (vertical && !Object.op_Implicit((Object)(object)val4))
{
val4 = (HorizontalOrVerticalLayoutGroup)(object)val.AddComponent<VerticalLayoutGroup>();
}
else if (!Object.op_Implicit((Object)(object)val4))
{
val4 = (HorizontalOrVerticalLayoutGroup)(object)val.AddComponent<HorizontalLayoutGroup>();
}
val4.spacing = 10f;
((LayoutGroup)val4).childAlignment = (TextAnchor)3;
if (supportGamepad)
{
val2.tabLeftButton = tabLeftButton;
val2.tabRightButton = tabRightButton;
Object.Instantiate<GameObject>(((Component)Templates.TabGroup).gameObject.Search("LB"), (Transform)(object)val3);
Object.Instantiate<GameObject>(((Component)Templates.TabGroup).gameObject.Search("RB.02"), (Transform)(object)val3);
}
else
{
val2.tabLeftButton = "";
val2.tabRightButton = "";
}
return val2;
}
public static Button AddTab(this UI_TabGroup tabGroup, GameObject template, string text, GameObject targetObject, Selectable firstSelect = null)
{
//IL_00d4: Unknown result type (might be due to invalid IL or missing references)
//IL_00d9: Unknown result type (might be due to invalid IL or missing references)
//IL_00e0: Unknown result type (might be due to invalid IL or missing references)
//IL_00e7: Unknown result type (might be due to invalid IL or missing references)
//IL_00ee: Unknown result type (might be due to invalid IL or missing references)
//IL_00fb: Expected O, but got Unknown
//IL_0148: Unknown result type (might be due to invalid IL or missing references)
//IL_0152: Expected O, but got Unknown
GameObject val = Object.Instantiate<GameObject>(template, ((Component)tabGroup).transform, false);
((Object)val).name = text;
if (tabGroup.tabs == null || tabGroup.tabs.Count == 0)
{
if (((Component)tabGroup).transform.childCount > 0)
{
val.transform.SetSiblingIndex(((Component)tabGroup).transform.GetChild(0).GetSiblingIndex() + 1);
}
}
else
{
val.transform.SetSiblingIndex(((Component)tabGroup.tabs.Last().button).transform.GetSiblingIndex() + 1);
}
val.GetComponentInChildren<TMP_Text>(true).text = text;
Button component = val.GetComponent<Button>();
Tab tab = new Tab
{
name = text,
button = component,
tabObject = targetObject,
firstSelect = firstSelect
};
UI_TabGroup val2 = tabGroup;
if (val2.tabs == null)
{
val2.tabs = new List<Tab>();
}
tabGroup.tabs.Add(tab);
((UnityEventBase)component.onClick).RemoveAllListeners();
((UnityEvent)component.onClick).AddListener((UnityAction)delegate
{
tabGroup.SelectTab(tab.name);
});
return component;
}
public static ScrollRect CreateScrollRect(RectTransform parent, bool supportGamepad = false)
{
//IL_0091: Unknown result type (might be due to invalid IL or missing references)
//IL_00ac: Unknown result type (might be due to invalid IL or missing references)
//IL_00c7: Unknown result type (might be due to invalid IL or missing references)
//IL_00d8: Unknown result type (might be due to invalid IL or missing references)
ScrollRect val = Object.Instantiate<ScrollRect>(Templates.ScrollRect, (Transform)(object)parent, false);
ScrollRect component = ((Component)val).GetComponent<ScrollRect>();
if (!supportGamepad)
{
Object.Destroy((Object)(object)((Component)val).gameObject.Search("Scroll Holder/Scroll Right Button/RB"));
Object.Destroy((Object)(object)((Component)val).gameObject.Search("Scroll Holder/Scroll Left Button/LB"));
Object.Destroy((Object)(object)((Component)val).gameObject.Search("Scroll Holder/Scroll Right Button").GetComponent<UI_PressButtonOnInput>());
Object.Destroy((Object)(object)((Component)val).gameObject.Search("Scroll Holder/Scroll Left Button").GetComponent<UI_PressButtonOnInput>());
}
component.content.anchorMin = new Vector2(0f, 0f);
component.content.anchorMax = new Vector2(0f, 1f);
component.content.anchoredPosition = new Vector2(0f, 0f);
component.content.sizeDelta = Vector2.zero;
return component;
}
public static TMP_Text CreateLabel(RectTransform parent, string text)
{
TMP_Text val = Object.Instantiate<TMP_Text>(Templates.Label, (Transform)(object)parent, false);
val.text = text;
return val;
}
}
public static class PluginInfo
{
public const string PLUGIN_GUID = "ModMenu";
public const string PLUGIN_NAME = "ModMenu";
public const string PLUGIN_VERSION = "1.2.0";
}
}
namespace ModMenu.Behaviors
{
public class InputFieldValidator : MonoBehaviour
{
private TMP_InputField _inputField;
private string _originalText;
private void Start()
{
_inputField = ((Component)this).GetComponent<TMP_InputField>();
((UnityEvent<string>)(object)_inputField.onSelect).AddListener((UnityAction<string>)OnStartEdit);
((UnityEvent<string>)(object)_inputField.onEndEdit).AddListener((UnityAction<string>)OnEndEdit);
}
private void OnStartEdit(string text)
{
_originalText = text;
}
private void OnEndEdit(string text)
{
//IL_0007: Unknown result type (might be due to invalid IL or missing references)
//IL_000d: Invalid comparison between Unknown and I4
//IL_0057: Unknown result type (might be due to invalid IL or missing references)
//IL_005d: Invalid comparison between Unknown and I4
int result2;
if ((int)_inputField.contentType == 3)
{
if (!float.TryParse(_inputField.text, out var result) && float.TryParse(_originalText, out result))
{
_inputField.text = _originalText;
}
}
else if ((int)_inputField.contentType == 2 && !int.TryParse(_inputField.text, out result2) && int.TryParse(_originalText, out result2))
{
_inputField.text = _originalText;
}
}
}
public class KeyCodeInput : MonoBehaviour
{
private static bool _lockInputBinding;
private TMP_Text _text;
private UI_RebindOverlay _uiRebindOverlay;
private UI_CloseButtonOnBack _closeButtonOnBack;
private bool _waitingForNoInput;
private bool _listeningForKey;
private KeyCode _key;
public UnityEvent<KeyCode> onValueChanged;
private void Awake()
{
//IL_002b: Unknown result type (might be due to invalid IL or missing references)
//IL_0035: Expected O, but got Unknown
_text = ((Component)((Component)this).transform.GetChild(0)).GetComponentInChildren<TMP_Text>(true);
((UnityEvent)((Component)this).GetComponent<Button>().onClick).AddListener(new UnityAction(StartListening));
}
public void Setup(Transform settingsMenu)
{
UI_SettingsMenu componentInParent = ((Component)settingsMenu).GetComponentInParent<UI_SettingsMenu>(true);
_uiRebindOverlay = ((componentInParent != null) ? ((Component)componentInParent).GetComponentInChildren<UI_RebindOverlay>(true) : null);
_closeButtonOnBack = ((Component)settingsMenu).GetComponentInChildren<UI_CloseButtonOnBack>(true);
}
public void StartListening()
{
if (!_lockInputBinding)
{
_waitingForNoInput = true;
_text.text = "Waiting for key press";
if (Object.op_Implicit((Object)(object)_uiRebindOverlay))
{
((Component)_uiRebindOverlay).gameObject.SetActive(true);
((Component)_uiRebindOverlay).GetComponentInChildren<Text>(true).text = "Waiting for button input.";
}
if (Object.op_Implicit((Object)(object)_closeButtonOnBack))
{
((Behaviour)_closeButtonOnBack).enabled = false;
}
}
}
private void Update()
{
//IL_005d: Unknown result type (might be due to invalid IL or missing references)
//IL_0061: Unknown result type (might be due to invalid IL or missing references)
//IL_0066: Unknown result type (might be due to invalid IL or missing references)
//IL_0082: Unknown result type (might be due to invalid IL or missing references)
//IL_0089: Invalid comparison between Unknown and I4
//IL_009c: Unknown result type (might be due to invalid IL or missing references)
//IL_00a1: Unknown result type (might be due to invalid IL or missing references)
//IL_00d9: Unknown result type (might be due to invalid IL or missing references)
if (_waitingForNoInput && !InputUtility.GetFirstActiveKey().HasValue)
{
_waitingForNoInput = false;
_listeningForKey = true;
_lockInputBinding = true;
}
else
{
if (!_listeningForKey)
{
return;
}
KeyCode? val = InputUtility.GetFirstActiveKey();
if (val.HasValue && val != (KeyCode?)0)
{
if ((int)val.GetValueOrDefault() == 27)
{
val = (KeyCode)0;
}
_key = val.Value;
_text.text = val.ToString();
_listeningForKey = false;
_lockInputBinding = false;
onValueChanged?.Invoke(_key);
if (Object.op_Implicit((Object)(object)_uiRebindOverlay))
{
((Component)_uiRebindOverlay).gameObject.SetActive(false);
}
if (Object.op_Implicit((Object)(object)_closeButtonOnBack))
{
((Behaviour)_closeButtonOnBack).enabled = true;
}
}
}
}
public void SetValueWithoutNotify(KeyCode key)
{
//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)
_key = key;
_text.text = ((object)(KeyCode)(ref key)).ToString();
}
}
public class ModMenuBehavior : MonoBehaviour
{
[CompilerGenerated]
private sealed class <Start>d__0 : IEnumerator<object>, IEnumerator, IDisposable
{
private int <>1__state;
private object <>2__current;
public ModMenuBehavior <>4__this;
object IEnumerator<object>.Current
{
[DebuggerHidden]
get
{
return <>2__current;
}
}
object IEnumerator.Current
{
[DebuggerHidden]
get
{
return <>2__current;
}
}
[DebuggerHidden]
public <Start>d__0(int <>1__state)
{
this.<>1__state = <>1__state;
}
[DebuggerHidden]
void IDisposable.Dispose()
{
<>1__state = -2;
}
private bool MoveNext()
{
switch (<>1__state)
{
default:
return false;
case 0:
<>1__state = -1;
<>2__current = null;
<>1__state = 1;
return true;
case 1:
<>1__state = -1;
ModMenu.Initialize(((Component)<>4__this).transform);
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(<Start>d__0))]
private IEnumerator Start()
{
//yield-return decompiler failed: Unexpected instruction in Iterator.Dispose()
return new <Start>d__0(0)
{
<>4__this = this
};
}
}
public class SliderTextSync : MonoBehaviour
{
private TMP_Text _text;
private string _format;
public void Setup(SubmitSlider slider, string format = "0.00")
{
_format = format;
_text = ((Component)this).GetComponent<TMP_Text>();
((UnityEvent<float>)(object)slider.onValueChanged).AddListener((UnityAction<float>)OnSliderValueChanged);
OnSliderValueChanged(slider.value);
}
private void OnSliderValueChanged(float value)
{
_text.text = value.ToString(_format, CultureInfo.InvariantCulture);
}
}
}