using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Globalization;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using System.Text.RegularExpressions;
using HarmonyLib;
using Il2CppGame.Menu;
using Il2CppInterop.Runtime.Injection;
using Il2CppInterop.Runtime.InteropTypes.Arrays;
using Il2CppSystem;
using Il2CppSystem.Reflection;
using Il2CppTMPro;
using MelonLoader;
using MelonLoader.Preferences;
using POGMods.Config;
using UnityEngine;
using UnityEngine.EventSystems;
using UnityEngine.Events;
using UnityEngine.UI;
[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: MelonInfo(typeof(PogConfigMelon), "POG Config", "1.0.0", "largo", "")]
[assembly: TargetFramework(".NETCoreApp,Version=v6.0", FrameworkDisplayName = ".NET 6.0")]
[assembly: AssemblyCompany("POGConfig")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0+f6025dd69441a04fedc3c74df093f96fcb47389e")]
[assembly: AssemblyProduct("POGConfig")]
[assembly: AssemblyTitle("POGConfig")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.0.0")]
[module: UnverifiableCode]
namespace POGMods.Config;
internal static class Clicks
{
internal static readonly Dictionary<RectTransform, Action> Map = new Dictionary<RectTransform, Action>();
internal static void Register(RectTransform rt, Action cb)
{
Map[rt] = cb;
}
internal static void Clear()
{
Map.Clear();
}
}
internal static class UI
{
private static Sprite _white;
internal static Sprite White
{
get
{
//IL_0015: Unknown result type (might be due to invalid IL or missing references)
//IL_001a: Unknown result type (might be due to invalid IL or missing references)
//IL_001d: Unknown result type (might be due to invalid IL or missing references)
//IL_0027: Unknown result type (might be due to invalid IL or missing references)
//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)
//IL_005a: Expected O, but got Unknown
if ((Object)(object)_white != (Object)null)
{
return _white;
}
Texture2D val = new Texture2D(1, 1);
val.SetPixel(0, 0, Color.white);
val.Apply();
_white = Sprite.Create(val, new Rect(0f, 0f, 1f, 1f), new Vector2(0.5f, 0.5f));
return _white;
}
}
internal static GameObject Make(string name, Transform parent)
{
//IL_0001: Unknown result type (might be due to invalid IL or missing references)
//IL_0006: Unknown result type (might be due to invalid IL or missing references)
//IL_000d: Unknown result type (might be due to invalid IL or missing references)
//IL_001b: Expected O, but got Unknown
GameObject val = new GameObject(name);
val.AddComponent<RectTransform>();
val.transform.SetParent(parent, false);
return val;
}
internal static RectTransform Rt(GameObject go)
{
return go.GetComponent<RectTransform>();
}
internal static void Stretch(RectTransform rt, float l = 0f, float r = 0f, float b = 0f, float t = 0f)
{
//IL_0001: Unknown result type (might be due to invalid IL or missing references)
//IL_000c: Unknown result type (might be due to invalid IL or missing references)
//IL_0019: Unknown result type (might be due to invalid IL or missing references)
//IL_0029: Unknown result type (might be due to invalid IL or missing references)
rt.anchorMin = Vector2.zero;
rt.anchorMax = Vector2.one;
rt.offsetMin = new Vector2(l, b);
rt.offsetMax = new Vector2(0f - r, 0f - t);
}
internal static Image AddImage(GameObject go, Color color, bool raycast = true)
{
//IL_0012: Unknown result type (might be due to invalid IL or missing references)
Image obj = go.AddComponent<Image>();
obj.sprite = White;
((Graphic)obj).color = color;
((Graphic)obj).raycastTarget = raycast;
return obj;
}
internal static TextMeshProUGUI AddText(GameObject go, string text, TMP_FontAsset font, int size, Color color, TextAlignmentOptions align = 4097)
{
//IL_0027: 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)
TextMeshProUGUI val = go.AddComponent<TextMeshProUGUI>();
if ((Object)(object)font != (Object)null)
{
((TMP_Text)val).font = font;
}
((TMP_Text)val).text = text;
((TMP_Text)val).fontSize = size;
((Graphic)val).color = color;
((TMP_Text)val).alignment = align;
((Graphic)val).raycastTarget = false;
return val;
}
internal static void PlaceFromTop(RectTransform rt, float yTop, float height, float padL = 0f, float padR = 0f)
{
//IL_000b: Unknown result type (might be due to invalid IL or missing references)
//IL_0020: Unknown result type (might be due to invalid IL or missing references)
//IL_0035: Unknown result type (might be due to invalid IL or missing references)
//IL_0045: Unknown result type (might be due to invalid IL or missing references)
//IL_0055: Unknown result type (might be due to invalid IL or missing references)
rt.anchorMin = new Vector2(0f, 1f);
rt.anchorMax = new Vector2(1f, 1f);
rt.pivot = new Vector2(0.5f, 1f);
rt.offsetMin = new Vector2(padL, 0f - (yTop + height));
rt.offsetMax = new Vector2(0f - padR, 0f - yTop);
}
}
public abstract class ConfigEntry
{
public string Label { get; protected set; }
public virtual float Height => 36f;
protected ConfigEntry(string label)
{
Label = label;
}
public virtual void Draw(float x, float y, float width, GUIStyle labelStyle)
{
}
internal abstract void BuildRowInto(GameObject row, TMP_FontAsset font);
internal virtual void BuildRow(Transform parent, TMP_FontAsset font)
{
}
internal virtual void OnUpdate()
{
}
internal virtual void BindPrefs(MelonPreferences_Category cat)
{
}
}
public class ToggleEntry : ConfigEntry
{
private readonly Func<bool> _get;
private Action<bool> _set;
private readonly string _prefKey;
private Toggle _toggle;
private bool _lastValue;
private bool _suppressToggleCallback;
public ToggleEntry(string label, Func<bool> get, Action<bool> set)
: this(label, get, set, null)
{
}
public ToggleEntry(string label, Func<bool> get, Action<bool> set, string prefKey)
: base(label)
{
_get = get;
_set = set;
_prefKey = prefKey;
}
internal override void BindPrefs(MelonPreferences_Category cat)
{
if (_prefKey != null)
{
MelonPreferences_Entry<bool> pref = cat.CreateEntry<bool>(_prefKey, _get(), (string)null, (string)null, false, false, (ValueValidator)null, (string)null);
_set(pref.Value);
Action<bool> orig = _set;
_set = delegate(bool v)
{
orig(v);
pref.Value = v;
MelonPreferences.Save();
};
}
}
internal override void BuildRowInto(GameObject row, TMP_FontAsset font)
{
//IL_0017: 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_0047: Unknown result type (might be due to invalid IL or missing references)
//IL_004c: Unknown result type (might be due to invalid IL or missing references)
//IL_004d: Unknown result type (might be due to invalid IL or missing references)
//IL_0054: Unknown result type (might be due to invalid IL or missing references)
//IL_0074: Unknown result type (might be due to invalid IL or missing references)
//IL_00ae: 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_00c7: Unknown result type (might be due to invalid IL or missing references)
//IL_00dc: Unknown result type (might be due to invalid IL or missing references)
//IL_00e6: Unknown result type (might be due to invalid IL or missing references)
//IL_013c: Unknown result type (might be due to invalid IL or missing references)
//IL_0186: Unknown result type (might be due to invalid IL or missing references)
GameObject go = UI.Make("Label", row.transform);
UI.Rt(go).anchorMin = Vector2.zero;
UI.Rt(go).anchorMax = new Vector2(0.78f, 1f);
Vector2 val2 = (UI.Rt(go).offsetMin = (UI.Rt(go).offsetMax = Vector2.zero));
UI.AddText(go, base.Label, font, 14, new Color(0.88f, 0.88f, 0.88f), (TextAlignmentOptions)4097);
GameObject val3 = UI.Make("Toggle", row.transform);
RectTransform obj = UI.Rt(val3);
((Vector2)(ref val2))..ctor(1f, 0.5f);
obj.anchorMax = val2;
obj.anchorMin = val2;
obj.pivot = new Vector2(1f, 0.5f);
obj.sizeDelta = new Vector2(40f, 24f);
obj.anchoredPosition = Vector2.zero;
_toggle = val3.AddComponent<Toggle>();
GameObject val4 = UI.Make("BG", val3.transform);
UI.Stretch(UI.Rt(val4));
Image targetGraphic = UI.AddImage(val4, new Color(0.18f, 0.18f, 0.2f));
GameObject go2 = UI.Make("Check", val4.transform);
UI.Stretch(UI.Rt(go2), 3f, 3f, 3f, 3f);
Image graphic = UI.AddImage(go2, new Color(1f, 0.82f, 0.3f));
((Selectable)_toggle).targetGraphic = (Graphic)(object)targetGraphic;
_toggle.graphic = (Graphic)(object)graphic;
_lastValue = _get();
_toggle.SetIsOnWithoutNotify(_lastValue);
((UnityEvent<bool>)(object)_toggle.onValueChanged).AddListener(UnityAction<bool>.op_Implicit((Action<bool>)OnToggleChanged));
}
private void OnToggleChanged(bool value)
{
if (!_suppressToggleCallback && value != _lastValue)
{
_lastValue = value;
_set(value);
}
}
internal override void OnUpdate()
{
if (!((Object)(object)_toggle == (Object)null))
{
bool flag = _get();
if (_toggle.isOn != flag)
{
_suppressToggleCallback = true;
_toggle.SetIsOnWithoutNotify(flag);
_suppressToggleCallback = false;
_lastValue = flag;
}
}
}
}
public class SliderEntry : ConfigEntry
{
private readonly Func<float> _get;
private Action<float> _set;
private readonly float _min;
private readonly float _max;
private readonly Func<float, string> _fmt;
private readonly string _prefKey;
private readonly float _originValue;
private readonly bool _showFill;
private readonly bool _wholeNumbers;
private readonly int _stepPointsCount;
private Slider _slider;
private TextMeshProUGUI _inputText;
private RectTransform _valueBgRt;
private Image _valueBgImg;
private RectTransform _fillRt;
private bool _editingInput;
private string _inputBuffer = "";
private RectTransform _labelMaskRt;
private RectTransform _valueMaskRt;
private RectTransform _labelTextRt;
private RectTransform _valueTextRt;
private TextMeshProUGUI _labelTmp;
private float _lastValue;
private float _marqueeTimer;
private const float MarqueeSpeed = 52f;
internal static bool AnyInputActive;
public float LabelFraction { get; set; } = 0.35f;
public float ValueFraction { get; set; } = 0.15f;
public SliderEntry(string label, Func<float> get, Action<float> set, float min, float max, Func<float, string> fmt = null)
: this(label, get, set, min, max, fmt, null)
{
}
public SliderEntry(string label, Func<float> get, Action<float> set, float min, float max, Func<float, string> fmt, string prefKey)
: this(label, get, set, min, max, fmt, prefKey, 0f, showFill: true, wholeNumbers: false, 0)
{
}
public SliderEntry(string label, Func<float> get, Action<float> set, float min, float max, Func<float, string> fmt, string prefKey, float originValue, bool showFill, bool wholeNumbers)
: this(label, get, set, min, max, fmt, prefKey, originValue, showFill, wholeNumbers, 0)
{
}
public SliderEntry(string label, Func<float> get, Action<float> set, float min, float max, Func<float, string> fmt, string prefKey, float originValue, bool showFill, bool wholeNumbers, int stepPointsCount)
: base(label)
{
_get = get;
_set = set;
_min = min;
_max = max;
_fmt = fmt ?? ((Func<float, string>)((float v) => v.ToString("F1")));
_prefKey = prefKey;
_originValue = Mathf.Clamp(originValue, min, max);
_showFill = showFill;
_wholeNumbers = wholeNumbers;
_stepPointsCount = Math.Max(0, stepPointsCount);
}
internal override void BindPrefs(MelonPreferences_Category cat)
{
if (_prefKey != null)
{
MelonPreferences_Entry<float> pref = cat.CreateEntry<float>(_prefKey, _get(), (string)null, (string)null, false, false, (ValueValidator)null, (string)null);
_set(pref.Value);
Action<float> orig = _set;
_set = delegate(float v)
{
orig(v);
pref.Value = v;
MelonPreferences.Save();
};
}
}
internal override void BuildRowInto(GameObject row, TMP_FontAsset font)
{
//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)
//IL_006c: Unknown result type (might be due to invalid IL or missing references)
//IL_006d: Unknown result type (might be due to invalid IL or missing references)
//IL_0074: Unknown result type (might be due to invalid IL or missing references)
//IL_00a7: 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_00cd: Unknown result type (might be due to invalid IL or missing references)
//IL_00d2: Unknown result type (might be due to invalid IL or missing references)
//IL_00d3: 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_00fc: Unknown result type (might be due to invalid IL or missing references)
//IL_0153: Unknown result type (might be due to invalid IL or missing references)
//IL_0169: Unknown result type (might be due to invalid IL or missing references)
//IL_017f: Unknown result type (might be due to invalid IL or missing references)
//IL_0184: Unknown result type (might be due to invalid IL or missing references)
//IL_0185: 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_01cb: Unknown result type (might be due to invalid IL or missing references)
//IL_01e5: 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_0219: Unknown result type (might be due to invalid IL or missing references)
//IL_023a: Unknown result type (might be due to invalid IL or missing references)
//IL_0287: Unknown result type (might be due to invalid IL or missing references)
//IL_0297: Unknown result type (might be due to invalid IL or missing references)
//IL_02b1: Unknown result type (might be due to invalid IL or missing references)
//IL_02cb: Unknown result type (might be due to invalid IL or missing references)
//IL_0300: Unknown result type (might be due to invalid IL or missing references)
//IL_034b: Unknown result type (might be due to invalid IL or missing references)
//IL_0366: 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_0383: Unknown result type (might be due to invalid IL or missing references)
//IL_0384: Unknown result type (might be due to invalid IL or missing references)
//IL_038b: Unknown result type (might be due to invalid IL or missing references)
//IL_041d: Unknown result type (might be due to invalid IL or missing references)
//IL_045a: Unknown result type (might be due to invalid IL or missing references)
//IL_0475: Unknown result type (might be due to invalid IL or missing references)
//IL_048d: Unknown result type (might be due to invalid IL or missing references)
//IL_0492: Unknown result type (might be due to invalid IL or missing references)
//IL_0493: 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_04bb: Unknown result type (might be due to invalid IL or missing references)
//IL_04d6: Unknown result type (might be due to invalid IL or missing references)
//IL_04ee: Unknown result type (might be due to invalid IL or missing references)
//IL_04f3: Unknown result type (might be due to invalid IL or missing references)
//IL_04f4: Unknown result type (might be due to invalid IL or missing references)
//IL_04fb: Unknown result type (might be due to invalid IL or missing references)
//IL_0513: Unknown result type (might be due to invalid IL or missing references)
//IL_059e: Unknown result type (might be due to invalid IL or missing references)
//IL_05a5: Unknown result type (might be due to invalid IL or missing references)
//IL_05bd: Unknown result type (might be due to invalid IL or missing references)
//IL_05d8: Unknown result type (might be due to invalid IL or missing references)
float labelFraction = LabelFraction;
float num = labelFraction + ValueFraction;
float num2 = num + 0.02f;
GameObject val = UI.Make("LabelMask", row.transform);
_labelMaskRt = UI.Rt(val);
_labelMaskRt.anchorMin = Vector2.zero;
_labelMaskRt.anchorMax = new Vector2(labelFraction, 1f);
Vector2 val3 = (_labelMaskRt.offsetMin = (_labelMaskRt.offsetMax = Vector2.zero));
val.AddComponent<RectMask2D>();
GameObject go = UI.Make("Label", val.transform);
_labelTextRt = UI.Rt(go);
_labelTextRt.anchorMin = Vector2.zero;
_labelTextRt.anchorMax = Vector2.one;
val3 = (_labelTextRt.offsetMin = (_labelTextRt.offsetMax = Vector2.zero));
_labelTmp = UI.AddText(go, base.Label, font, 14, new Color(0.88f, 0.88f, 0.88f), (TextAlignmentOptions)4097);
((TMP_Text)_labelTmp).enableWordWrapping = false;
((TMP_Text)_labelTmp).overflowMode = (TextOverflowModes)1;
GameObject val5 = UI.Make("ValueMask", row.transform);
_valueMaskRt = UI.Rt(val5);
_valueMaskRt.anchorMin = new Vector2(labelFraction, 0f);
_valueMaskRt.anchorMax = new Vector2(num, 1f);
val3 = (_valueMaskRt.offsetMin = (_valueMaskRt.offsetMax = Vector2.zero));
val5.AddComponent<RectMask2D>();
GameObject val7 = UI.Make("ValueBG", val5.transform);
_valueBgRt = UI.Rt(val7);
_valueBgRt.anchorMin = new Vector2(0f, 0.18f);
_valueBgRt.anchorMax = new Vector2(1f, 0.82f);
_valueBgRt.offsetMin = new Vector2(2f, 0f);
_valueBgRt.offsetMax = new Vector2(-2f, 0f);
_valueBgImg = UI.AddImage(val7, new Color(0.16f, 0.16f, 0.18f, 0.95f));
Clicks.Register(_valueBgRt, StartEditing);
GameObject go2 = UI.Make("ValueInput", val7.transform);
_valueTextRt = UI.Rt(go2);
_valueTextRt.anchorMin = Vector2.zero;
_valueTextRt.anchorMax = Vector2.one;
_valueTextRt.offsetMin = new Vector2(6f, 0f);
_valueTextRt.offsetMax = new Vector2(-6f, 0f);
_inputText = UI.AddText(go2, _fmt(_get()), font, 13, new Color(1f, 0.82f, 0.3f), (TextAlignmentOptions)4100);
((TMP_Text)_inputText).enableWordWrapping = false;
((TMP_Text)_inputText).overflowMode = (TextOverflowModes)1;
GameObject val8 = UI.Make("Slider", row.transform);
UI.Rt(val8).anchorMin = new Vector2(num2, 0.25f);
UI.Rt(val8).anchorMax = new Vector2(1f, 0.75f);
val3 = (UI.Rt(val8).offsetMin = (UI.Rt(val8).offsetMax = Vector2.zero));
_slider = val8.AddComponent<Slider>();
_slider.minValue = _min;
_slider.maxValue = _max;
_slider.wholeNumbers = _wholeNumbers;
_slider.direction = (Direction)0;
GameObject go3 = UI.Make("Track", val8.transform);
UI.Stretch(UI.Rt(go3));
UI.AddImage(go3, new Color(0.2f, 0.2f, 0.22f));
BuildStepPoints(val8.transform);
GameObject val10 = UI.Make("FillArea", val8.transform);
UI.Rt(val10).anchorMin = new Vector2(0f, 0.25f);
UI.Rt(val10).anchorMax = new Vector2(1f, 0.75f);
val3 = (UI.Rt(val10).offsetMin = (UI.Rt(val10).offsetMax = Vector2.zero));
GameObject go4 = UI.Make("Fill", val10.transform);
UI.Rt(go4).anchorMin = Vector2.zero;
UI.Rt(go4).anchorMax = new Vector2(0f, 1f);
val3 = (UI.Rt(go4).offsetMin = (UI.Rt(go4).offsetMax = Vector2.zero));
UI.AddImage(go4, new Color(1f, 0.72f, 0.1f));
_fillRt = UI.Rt(go4);
val10.SetActive(_showFill);
GameObject val13 = UI.Make("HandleArea", val8.transform);
UI.Stretch(UI.Rt(val13));
GameObject go5 = UI.Make("Handle", val13.transform);
RectTransform obj = UI.Rt(go5);
RectTransform obj2 = UI.Rt(go5);
((Vector2)(ref val3))..ctor(0f, 0.5f);
obj2.anchorMax = val3;
obj.anchorMin = val3;
UI.Rt(go5).sizeDelta = new Vector2(14f, 14f);
Image targetGraphic = UI.AddImage(go5, new Color(1f, 0.82f, 0.3f));
_slider.fillRect = null;
_slider.handleRect = UI.Rt(go5);
((Selectable)_slider).targetGraphic = (Graphic)(object)targetGraphic;
_lastValue = _get();
_slider.SetValueWithoutNotify(_lastValue);
((UnityEvent<float>)(object)_slider.onValueChanged).AddListener(UnityAction<float>.op_Implicit((Action<float>)OnSliderChanged));
UpdateFillFromOrigin(_lastValue);
}
private void BuildStepPoints(Transform sliderTransform)
{
//IL_0027: Unknown result type (might be due to invalid IL or missing references)
//IL_003c: Unknown result type (might be due to invalid IL or missing references)
//IL_0051: Unknown result type (might be due to invalid IL or missing references)
//IL_0065: Unknown result type (might be due to invalid IL or missing references)
//IL_00c4: 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_00db: Unknown result type (might be due to invalid IL or missing references)
//IL_00f0: Unknown result type (might be due to invalid IL or missing references)
//IL_00fa: Unknown result type (might be due to invalid IL or missing references)
//IL_0118: Unknown result type (might be due to invalid IL or missing references)
if (_stepPointsCount >= 2)
{
GameObject val = UI.Make("StepPoints", sliderTransform);
RectTransform obj = UI.Rt(val);
obj.anchorMin = new Vector2(0f, 0.5f);
obj.anchorMax = new Vector2(1f, 0.5f);
obj.offsetMin = new Vector2(0f, -1f);
obj.offsetMax = new Vector2(0f, 1f);
Vector2 val2 = default(Vector2);
for (int i = 0; i < _stepPointsCount; i++)
{
float num = ((_stepPointsCount <= 1) ? 0f : ((float)i / (float)(_stepPointsCount - 1)));
GameObject go = UI.Make("P" + i, val.transform);
RectTransform obj2 = UI.Rt(go);
((Vector2)(ref val2))..ctor(num, 0.5f);
obj2.anchorMax = val2;
obj2.anchorMin = val2;
obj2.pivot = new Vector2(0.5f, 0.5f);
obj2.sizeDelta = new Vector2(4f, 4f);
obj2.anchoredPosition = Vector2.zero;
UI.AddImage(go, new Color(0.48f, 0.48f, 0.52f, 0.75f), raycast: false);
}
}
}
private void StartEditing()
{
//IL_0055: Unknown result type (might be due to invalid IL or missing references)
if (!AnyInputActive)
{
_editingInput = true;
AnyInputActive = true;
_marqueeTimer = 0f;
_inputBuffer = ToEditableNumericString(_lastValue);
if ((Object)(object)_valueBgImg != (Object)null)
{
((Graphic)_valueBgImg).color = new Color(0.28f, 0.22f, 0.08f);
}
if ((Object)(object)_inputText != (Object)null)
{
((TMP_Text)_inputText).text = _inputBuffer + "|";
}
}
}
private void StopEditing(bool commit)
{
//IL_0035: Unknown result type (might be due to invalid IL or missing references)
_editingInput = false;
AnyInputActive = false;
if ((Object)(object)_valueBgImg != (Object)null)
{
((Graphic)_valueBgImg).color = new Color(0.16f, 0.16f, 0.18f, 0.95f);
}
if (commit && TryParseValue(_inputBuffer, out var parsed))
{
ApplyValue(parsed, writeBack: true);
}
if ((Object)(object)_inputText != (Object)null)
{
((TMP_Text)_inputText).text = _fmt(_lastValue);
}
}
private bool TryParseValue(string text, out float parsed)
{
text = (text ?? string.Empty).Trim();
parsed = 0f;
if (text.Length == 0)
{
return false;
}
Match match = Regex.Match(text, "[-+]?\\d+(?:[.,]\\d+)?");
if (match.Success)
{
text = match.Value;
}
bool flag = float.TryParse(text.Replace(',', '.'), NumberStyles.Float, CultureInfo.InvariantCulture, out parsed);
if (!flag)
{
flag = float.TryParse(text, NumberStyles.Float, CultureInfo.CurrentCulture, out parsed);
}
if (!flag)
{
return false;
}
parsed = Mathf.Clamp(parsed, _min, _max);
if (_wholeNumbers)
{
parsed = Mathf.Round(parsed);
}
return true;
}
private string ToEditableNumericString(float value)
{
if (_wholeNumbers)
{
return Mathf.RoundToInt(value).ToString(CultureInfo.InvariantCulture);
}
return value.ToString("0.###", CultureInfo.InvariantCulture);
}
private void OnSliderChanged(float value)
{
ApplyValue(value, writeBack: true);
}
private void ApplyValue(float value, bool writeBack)
{
value = Mathf.Clamp(value, _min, _max);
if (_wholeNumbers)
{
value = Mathf.Round(value);
}
_lastValue = value;
if ((Object)(object)_slider != (Object)null && Math.Abs(_slider.value - value) > 0.0001f)
{
_slider.SetValueWithoutNotify(value);
}
if (!_editingInput && (Object)(object)_inputText != (Object)null)
{
((TMP_Text)_inputText).text = _fmt(value);
}
UpdateFillFromOrigin(value);
if (writeBack)
{
_set(value);
}
}
private void UpdateFillFromOrigin(float current)
{
//IL_0054: 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_0080: Unknown result type (might be due to invalid IL or missing references)
//IL_0090: Unknown result type (might be due to invalid IL or missing references)
if (!((Object)(object)_fillRt == (Object)null) && _showFill)
{
float num = Mathf.InverseLerp(_min, _max, _originValue);
float num2 = Mathf.InverseLerp(_min, _max, current);
_fillRt.anchorMin = new Vector2(Mathf.Min(num, num2), 0f);
_fillRt.anchorMax = new Vector2(Mathf.Max(num, num2), 1f);
_fillRt.offsetMin = Vector2.zero;
_fillRt.offsetMax = Vector2.zero;
}
}
private void UpdateMarquee(RectTransform maskRt, RectTransform textRt, TextMeshProUGUI tmp, bool hovered)
{
//IL_0023: 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_0042: Unknown result type (might be due to invalid IL or missing references)
//IL_009a: Unknown result type (might be due to invalid IL or missing references)
//IL_009f: Unknown result type (might be due to invalid IL or missing references)
//IL_00c9: Unknown result type (might be due to invalid IL or missing references)
//IL_0059: Unknown result type (might be due to invalid IL or missing references)
if (!((Object)(object)maskRt == (Object)null) && !((Object)(object)textRt == (Object)null) && !((Object)(object)tmp == (Object)null))
{
float preferredWidth = ((TMP_Text)tmp).preferredWidth;
Rect rect = maskRt.rect;
if (!(preferredWidth > ((Rect)(ref rect)).width + 1f))
{
((TMP_Text)tmp).overflowMode = (TextOverflowModes)1;
textRt.anchoredPosition = Vector2.zero;
return;
}
if (!hovered)
{
((TMP_Text)tmp).overflowMode = (TextOverflowModes)1;
textRt.anchoredPosition = Vector2.zero;
_marqueeTimer = 0f;
return;
}
((TMP_Text)tmp).overflowMode = (TextOverflowModes)0;
_marqueeTimer += Time.unscaledDeltaTime * 52f;
float preferredWidth2 = ((TMP_Text)tmp).preferredWidth;
rect = maskRt.rect;
float num = Mathf.Max(0f, preferredWidth2 - ((Rect)(ref rect)).width + 12f);
float num2 = Mathf.PingPong(_marqueeTimer, num);
textRt.anchoredPosition = new Vector2(0f - num2, 0f);
}
}
internal override void OnUpdate()
{
//IL_0147: Unknown result type (might be due to invalid IL or missing references)
//IL_014c: Unknown result type (might be due to invalid IL or missing references)
//IL_0151: Unknown result type (might be due to invalid IL or missing references)
//IL_016b: Unknown result type (might be due to invalid IL or missing references)
//IL_018f: Unknown result type (might be due to invalid IL or missing references)
//IL_0028: Unknown result type (might be due to invalid IL or missing references)
//IL_002d: Unknown result type (might be due to invalid IL or missing references)
if ((Object)(object)_slider == (Object)null)
{
return;
}
if (_editingInput)
{
if (Input.GetMouseButtonDown(0) && !ConfigBehaviour.HitTest(_valueBgRt, Vector2.op_Implicit(Input.mousePosition)))
{
StopEditing(commit: true);
return;
}
if (Input.GetKeyDown((KeyCode)27))
{
StopEditing(commit: false);
return;
}
if (Input.GetKeyDown((KeyCode)13) || Input.GetKeyDown((KeyCode)271))
{
StopEditing(commit: true);
return;
}
string inputString = Input.inputString;
for (int i = 0; i < inputString.Length; i++)
{
char c = inputString[i];
if (c == '\b')
{
if (_inputBuffer.Length > 0)
{
_inputBuffer = _inputBuffer.Substring(0, _inputBuffer.Length - 1);
}
continue;
}
if (c == '\n' || c == '\r')
{
StopEditing(commit: true);
return;
}
if (c >= ' ')
{
_inputBuffer += c;
}
}
if ((Object)(object)_inputText != (Object)null)
{
((TMP_Text)_inputText).text = _inputBuffer + "|";
}
}
else
{
float num = _get();
if (Math.Abs(num - _lastValue) > 0.0001f)
{
ApplyValue(num, writeBack: false);
}
Vector2 screenPoint = Vector2.op_Implicit(Input.mousePosition);
UpdateMarquee(_labelMaskRt, _labelTextRt, _labelTmp, ConfigBehaviour.HitTest(_labelMaskRt, screenPoint));
UpdateMarquee(_valueMaskRt, _valueTextRt, _inputText, ConfigBehaviour.HitTest(_valueMaskRt, screenPoint));
}
}
}
public class OptionsSliderEntry : ConfigEntry
{
private readonly Func<int> _get;
private Action<int> _set;
private readonly string[] _options;
private readonly string _prefKey;
private Slider _slider;
private TextMeshProUGUI _displayText;
private int _lastIndex;
public OptionsSliderEntry(string label, Func<int> get, Action<int> set, string[] options, string prefKey = null)
: base(label)
{
_get = get;
_set = set;
_options = options ?? Array.Empty<string>();
_prefKey = prefKey;
}
internal override void BindPrefs(MelonPreferences_Category cat)
{
if (_prefKey != null && _options.Length != 0)
{
MelonPreferences_Entry<int> pref = cat.CreateEntry<int>(_prefKey, Mathf.Clamp(_get(), 0, _options.Length - 1), (string)null, (string)null, false, false, (ValueValidator)null, (string)null);
_set(Mathf.Clamp(pref.Value, 0, _options.Length - 1));
Action<int> orig = _set;
_set = delegate(int i)
{
orig(i);
pref.Value = i;
MelonPreferences.Save();
};
}
}
internal override void BuildRowInto(GameObject row, TMP_FontAsset font)
{
//IL_0017: 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_0047: Unknown result type (might be due to invalid IL or missing references)
//IL_004c: Unknown result type (might be due to invalid IL or missing references)
//IL_004d: Unknown result type (might be due to invalid IL or missing references)
//IL_0054: Unknown result type (might be due to invalid IL or missing references)
//IL_0074: Unknown result type (might be due to invalid IL or missing references)
//IL_00b2: 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_00d2: Unknown result type (might be due to invalid IL or missing references)
//IL_00d7: Unknown result type (might be due to invalid IL or missing references)
//IL_00d8: 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_00ff: Unknown result type (might be due to invalid IL or missing references)
//IL_014c: Unknown result type (might be due to invalid IL or missing references)
//IL_0166: Unknown result type (might be due to invalid IL or missing references)
//IL_017c: Unknown result type (might be due to invalid IL or missing references)
//IL_0181: Unknown result type (might be due to invalid IL or missing references)
//IL_0182: Unknown result type (might be due to invalid IL or missing references)
//IL_0189: Unknown result type (might be due to invalid IL or missing references)
//IL_021e: Unknown result type (might be due to invalid IL or missing references)
//IL_028b: Unknown result type (might be due to invalid IL or missing references)
//IL_0292: Unknown result type (might be due to invalid IL or missing references)
//IL_02aa: Unknown result type (might be due to invalid IL or missing references)
//IL_02c5: Unknown result type (might be due to invalid IL or missing references)
GameObject go = UI.Make("Label", row.transform);
UI.Rt(go).anchorMin = Vector2.zero;
UI.Rt(go).anchorMax = new Vector2(0.26f, 1f);
Vector2 val2 = (UI.Rt(go).offsetMin = (UI.Rt(go).offsetMax = Vector2.zero));
TextMeshProUGUI obj = UI.AddText(go, base.Label, font, 14, new Color(0.88f, 0.88f, 0.88f), (TextAlignmentOptions)4097);
((TMP_Text)obj).enableWordWrapping = false;
((TMP_Text)obj).overflowMode = (TextOverflowModes)1;
GameObject go2 = UI.Make("ValueText", row.transform);
RectTransform obj2 = UI.Rt(go2);
obj2.anchorMin = new Vector2(0.26f, 0f);
obj2.anchorMax = new Vector2(0.52f, 1f);
val2 = (obj2.offsetMin = (obj2.offsetMax = Vector2.zero));
_displayText = UI.AddText(go2, "", font, 13, new Color(1f, 0.82f, 0.3f), (TextAlignmentOptions)4100);
((TMP_Text)_displayText).enableWordWrapping = false;
((TMP_Text)_displayText).overflowMode = (TextOverflowModes)1;
GameObject val4 = UI.Make("Slider", row.transform);
UI.Rt(val4).anchorMin = new Vector2(0.54f, 0.25f);
UI.Rt(val4).anchorMax = new Vector2(1f, 0.75f);
val2 = (UI.Rt(val4).offsetMin = (UI.Rt(val4).offsetMax = Vector2.zero));
_slider = val4.AddComponent<Slider>();
_slider.minValue = 0f;
_slider.maxValue = Mathf.Max(0, _options.Length - 1);
_slider.wholeNumbers = true;
_slider.direction = (Direction)0;
GameObject go3 = UI.Make("Track", val4.transform);
UI.Stretch(UI.Rt(go3));
UI.AddImage(go3, new Color(0.2f, 0.2f, 0.22f));
GameObject val6 = UI.Make("HandleArea", val4.transform);
UI.Stretch(UI.Rt(val6));
GameObject go4 = UI.Make("Handle", val6.transform);
RectTransform obj3 = UI.Rt(go4);
RectTransform obj4 = UI.Rt(go4);
((Vector2)(ref val2))..ctor(0f, 0.5f);
obj4.anchorMax = val2;
obj3.anchorMin = val2;
UI.Rt(go4).sizeDelta = new Vector2(14f, 14f);
Image targetGraphic = UI.AddImage(go4, new Color(1f, 0.82f, 0.3f));
_slider.fillRect = null;
_slider.handleRect = UI.Rt(go4);
((Selectable)_slider).targetGraphic = (Graphic)(object)targetGraphic;
((UnityEvent<float>)(object)_slider.onValueChanged).AddListener(UnityAction<float>.op_Implicit((Action<float>)OnSliderChanged));
_lastIndex = Mathf.Clamp(_get(), 0, _options.Length - 1);
_slider.SetValueWithoutNotify((float)_lastIndex);
SyncText(_lastIndex);
}
private void OnSliderChanged(float value)
{
int num = Mathf.Clamp(Mathf.RoundToInt(value), 0, _options.Length - 1);
if (num != _lastIndex)
{
_lastIndex = num;
SyncText(num);
_set(num);
}
}
private void SyncText(int idx)
{
string text = ((_options.Length == 0 || idx < 0 || idx >= _options.Length) ? "-" : _options[idx]);
if ((Object)(object)_displayText != (Object)null)
{
((TMP_Text)_displayText).text = text;
}
}
internal override void OnUpdate()
{
if (!((Object)(object)_slider == (Object)null) && _options.Length != 0)
{
int num = Mathf.Clamp(_get(), 0, _options.Length - 1);
if (num != _lastIndex)
{
_lastIndex = num;
_slider.SetValueWithoutNotify((float)num);
SyncText(num);
}
}
}
}
public class KeyEntry : ConfigEntry
{
private readonly Func<KeyCode> _get;
private Action<KeyCode> _set;
private readonly string _prefKey;
internal static bool AnyWaiting;
private bool _listening;
private TextMeshProUGUI _keyText;
private TextMeshProUGUI _btnText;
public bool AllowMouseButtons { get; set; }
public KeyEntry(string label, Func<KeyCode> get, Action<KeyCode> set)
: this(label, get, set, null)
{
}
public KeyEntry(string label, Func<KeyCode> get, Action<KeyCode> set, string prefKey)
: base(label)
{
_get = get;
_set = set;
_prefKey = prefKey;
}
internal override void BindPrefs(MelonPreferences_Category cat)
{
//IL_001d: Unknown result type (might be due to invalid IL or missing references)
//IL_0022: Unknown result type (might be due to invalid IL or missing references)
//IL_005a: Unknown result type (might be due to invalid IL or missing references)
if (_prefKey != null)
{
string prefKey = _prefKey;
KeyCode val = _get();
MelonPreferences_Entry<string> pref = cat.CreateEntry<string>(prefKey, ((object)(KeyCode)(ref val)).ToString(), (string)null, (string)null, false, false, (ValueValidator)null, (string)null);
if (Enum.TryParse<KeyCode>(pref.Value, out KeyCode result))
{
_set(result);
}
Action<KeyCode> orig = _set;
_set = delegate(KeyCode v)
{
//IL_0006: Unknown result type (might be due to invalid IL or missing references)
orig(v);
pref.Value = ((object)(KeyCode)(ref v)).ToString();
MelonPreferences.Save();
};
}
}
internal override void BuildRowInto(GameObject row, TMP_FontAsset font)
{
//IL_0017: 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_0047: Unknown result type (might be due to invalid IL or missing references)
//IL_004c: Unknown result type (might be due to invalid IL or missing references)
//IL_004d: Unknown result type (might be due to invalid IL or missing references)
//IL_0054: Unknown result type (might be due to invalid IL or missing references)
//IL_0074: Unknown result type (might be due to invalid IL or missing references)
//IL_00a5: Unknown result type (might be due to invalid IL or missing references)
//IL_00bf: Unknown result type (might be due to invalid IL or missing references)
//IL_00d5: 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_00db: Unknown result type (might be due to invalid IL or missing references)
//IL_00e2: Unknown result type (might be due to invalid IL or missing references)
//IL_00f1: Unknown result type (might be due to invalid IL or missing references)
//IL_00f6: Unknown result type (might be due to invalid IL or missing references)
//IL_0117: Unknown result type (might be due to invalid IL or missing references)
//IL_0155: Unknown result type (might be due to invalid IL or missing references)
//IL_015c: Unknown result type (might be due to invalid IL or missing references)
//IL_016e: Unknown result type (might be due to invalid IL or missing references)
//IL_0183: Unknown result type (might be due to invalid IL or missing references)
//IL_018e: Unknown result type (might be due to invalid IL or missing references)
//IL_01a8: Unknown result type (might be due to invalid IL or missing references)
//IL_01fd: Unknown result type (might be due to invalid IL or missing references)
GameObject go = UI.Make("Label", row.transform);
UI.Rt(go).anchorMin = Vector2.zero;
UI.Rt(go).anchorMax = new Vector2(0.42f, 1f);
Vector2 val2 = (UI.Rt(go).offsetMin = (UI.Rt(go).offsetMax = Vector2.zero));
UI.AddText(go, base.Label, font, 14, new Color(0.88f, 0.88f, 0.88f), (TextAlignmentOptions)4097);
GameObject go2 = UI.Make("KeyName", row.transform);
UI.Rt(go2).anchorMin = new Vector2(0.42f, 0f);
UI.Rt(go2).anchorMax = new Vector2(0.7f, 1f);
val2 = (UI.Rt(go2).offsetMin = (UI.Rt(go2).offsetMax = Vector2.zero));
KeyCode val4 = _get();
_keyText = UI.AddText(go2, ((object)(KeyCode)(ref val4)).ToString(), font, 13, new Color(1f, 0.82f, 0.3f), (TextAlignmentOptions)4100);
GameObject val5 = UI.Make("ChangeBtn", row.transform);
RectTransform obj = UI.Rt(val5);
((Vector2)(ref val2))..ctor(1f, 0.5f);
obj.anchorMax = val2;
obj.anchorMin = val2;
obj.pivot = new Vector2(1f, 0.5f);
obj.sizeDelta = new Vector2(90f, 28f);
obj.anchoredPosition = Vector2.zero;
UI.AddImage(val5, new Color(0.25f, 0.25f, 0.3f));
GameObject go3 = UI.Make("Text", val5.transform);
UI.Stretch(UI.Rt(go3));
_btnText = UI.AddText(go3, "Change", font, 12, new Color(0.85f, 0.85f, 0.85f), (TextAlignmentOptions)514);
Clicks.Register(obj, ToggleListen);
}
private void ToggleListen()
{
//IL_002f: Unknown result type (might be due to invalid IL or missing references)
//IL_0034: Unknown result type (might be due to invalid IL or missing references)
if (_listening)
{
_listening = false;
AnyWaiting = false;
if ((Object)(object)_keyText != (Object)null)
{
TextMeshProUGUI keyText = _keyText;
KeyCode val = _get();
((TMP_Text)keyText).text = ((object)(KeyCode)(ref val)).ToString();
}
if ((Object)(object)_btnText != (Object)null)
{
((TMP_Text)_btnText).text = "Change";
}
}
else if (!AnyWaiting)
{
_listening = true;
AnyWaiting = true;
if ((Object)(object)_keyText != (Object)null)
{
((TMP_Text)_keyText).text = "[ press key ]";
}
if ((Object)(object)_btnText != (Object)null)
{
((TMP_Text)_btnText).text = "Cancel";
}
}
}
internal override void OnUpdate()
{
//IL_0031: Unknown result type (might be due to invalid IL or missing references)
//IL_0036: Unknown result type (might be due to invalid IL or missing references)
//IL_0037: Unknown result type (might be due to invalid IL or missing references)
//IL_003d: Unknown result type (might be due to invalid IL or missing references)
//IL_0040: Invalid comparison between Unknown and I4
//IL_005a: Unknown result type (might be due to invalid IL or missing references)
//IL_004a: Unknown result type (might be due to invalid IL or missing references)
//IL_0050: Invalid comparison between Unknown and I4
//IL_0068: Unknown result type (might be due to invalid IL or missing references)
//IL_0052: Unknown result type (might be due to invalid IL or missing references)
//IL_0058: Invalid comparison between Unknown and I4
if (!_listening || SliderEntry.AnyInputActive)
{
return;
}
foreach (KeyCode value in Enum.GetValues(typeof(KeyCode)))
{
KeyCode val = value;
if ((int)val != 0 && (int)val != 27 && (AllowMouseButtons || (int)val < 323 || (int)val > 329) && Input.GetKeyDown(val))
{
_set(val);
_listening = false;
AnyWaiting = false;
if ((Object)(object)_keyText != (Object)null)
{
((TMP_Text)_keyText).text = ((object)(KeyCode)(ref val)).ToString();
}
if ((Object)(object)_btnText != (Object)null)
{
((TMP_Text)_btnText).text = "Change";
}
break;
}
}
}
}
public static class POGConfig
{
private static readonly List<(string Name, List<ConfigEntry> Entries)> _mods = new List<(string, List<ConfigEntry>)>();
private static int _registryVersion;
public static bool PanelOpen { get; internal set; }
internal static int RegistryVersion => _registryVersion;
public static void Register(string modName, List<ConfigEntry> entries)
{
try
{
MelonPreferences_Category cat = MelonPreferences.CreateCategory(modName.Replace(" ", "_"));
foreach (ConfigEntry entry in entries)
{
try
{
entry.BindPrefs(cat);
}
catch (Exception ex)
{
MelonLogger.Warning("[POGConfig] BindPrefs '" + modName + "': " + ex.Message);
}
}
}
catch (Exception ex2)
{
MelonLogger.Warning("[POGConfig] Prefs skipped for '" + modName + "': " + ex2.Message);
}
_mods.Add((modName, entries));
_registryVersion++;
MelonLogger.Msg($"[POGConfig] Registered: {modName} ({entries.Count} entries)");
}
internal static IReadOnlyList<(string Name, List<ConfigEntry> Entries)> GetAll()
{
return _mods;
}
}
[HarmonyPatch(typeof(NetworkMenu), "TogglePauseMenu")]
internal class PatchTogglePauseMenu
{
private static bool Prefix()
{
if (!ConfigBehaviour.PanelOpen)
{
return true;
}
ConfigBehaviour.RequestClose();
return false;
}
}
public class PogConfigMelon : MelonMod
{
public override void OnInitializeMelon()
{
//IL_002f: Unknown result type (might be due to invalid IL or missing references)
//IL_0034: Unknown result type (might be due to invalid IL or missing references)
//IL_003a: Expected O, but got Unknown
//IL_003a: Unknown result type (might be due to invalid IL or missing references)
try
{
((MelonBase)this).HarmonyInstance.PatchAll();
}
catch (Exception ex)
{
MelonLogger.Warning("[POGConfig] Harmony patch failed: " + ex.Message);
}
ClassInjector.RegisterTypeInIl2Cpp<ConfigBehaviour>();
GameObject val = new GameObject("POGConfigRunner");
Object.DontDestroyOnLoad((Object)val);
((Object)val).hideFlags = (HideFlags)61;
val.AddComponent<ConfigBehaviour>();
MelonLogger.Msg("POG Config 1.0.0 loaded.");
}
}
public class ConfigBehaviour : MonoBehaviour
{
internal static bool PanelOpen;
private static ConfigBehaviour _instance;
private const float PANEL_H = 560f;
private const float TOP_H = 68f;
private const float BOT_H = 60f;
private const float SB_W = 20f;
private const float VIEWPORT_H = 432f;
private const float SCROLL_SPD = 40f;
private bool _isPause;
private bool _isMainMenu;
private bool _panelOpen;
private bool _updateErrLogged;
private RectTransform _modsBtnRt;
private RectTransform _doneBtnRt;
private GameObject _overlay;
private Image _modsBtnImg;
private Transform _scrollContent;
private RectTransform _scrollContentRt;
private RectTransform _scrollTrackRt;
private RectTransform _scrollThumbRt;
private GameObject _scrollbarGo;
private float _totalContentH;
private float _scrollOffset;
private bool _uiReady;
private bool _contentBuilt;
private int _builtRegistryVersion = -1;
private TMP_FontAsset _font;
public ConfigBehaviour(IntPtr ptr)
: base(ptr)
{
}
internal static void RequestClose()
{
_instance?.DoClose();
}
private void Awake()
{
_instance = this;
}
private void Start()
{
BuildStaticUI();
}
internal static bool HitTest(RectTransform rt, Vector2 screenPoint)
{
//IL_002e: Unknown result type (might be due to invalid IL or missing references)
//IL_0042: Unknown result type (might be due to invalid IL or missing references)
//IL_000d: Unknown result type (might be due to invalid IL or missing references)
if ((Object)(object)rt == (Object)null)
{
return false;
}
try
{
return RectTransformUtility.RectangleContainsScreenPoint(rt, screenPoint, (Camera)null);
}
catch
{
try
{
Vector3[] array = (Vector3[])(object)new Vector3[4];
rt.GetWorldCorners(Il2CppStructArray<Vector3>.op_Implicit(array));
float num = screenPoint.x - (float)Screen.width * 0.5f;
float num2 = screenPoint.y - (float)Screen.height * 0.5f;
return num >= array[0].x && num <= array[2].x && num2 >= array[0].y && num2 <= array[2].y;
}
catch
{
return false;
}
}
}
private void Update()
{
//IL_00d0: Unknown result type (might be due to invalid IL or missing references)
if (!_uiReady)
{
BuildStaticUI();
}
try
{
NetworkMenu instance = NetworkMenu.Instance;
string text = (((Object)(object)instance != (Object)null && (Object)(object)instance.CurrentState != (Object)null) ? ((MemberInfo)((Object)instance.CurrentState).GetIl2CppType()).Name : "");
_isPause = text == "NetworkMenuPauseState";
_isMainMenu = text == "NetworkMenuMainState";
bool flag = _isPause || _isMainMenu;
if ((Object)(object)_modsBtnRt != (Object)null)
{
((Component)_modsBtnRt).gameObject.SetActive(flag);
if (flag)
{
PositionModsButton();
UpdateModsButtonHover();
}
else if ((Object)(object)_modsBtnImg != (Object)null)
{
((Graphic)_modsBtnImg).color = new Color(0f, 0f, 0f, 0f);
}
}
if (!flag && _panelOpen)
{
DoClose();
}
HandleClicks();
if (!_panelOpen)
{
return;
}
HandleScroll();
foreach (var item in POGConfig.GetAll())
{
foreach (ConfigEntry item2 in item.Entries)
{
item2.OnUpdate();
}
}
}
catch (Exception value)
{
if (!_updateErrLogged)
{
_updateErrLogged = true;
MelonLogger.Warning($"[POGConfig] Update error: {value}");
}
}
}
private void HandleScroll()
{
//IL_0020: Unknown result type (might be due to invalid IL or missing references)
float num = Mathf.Max(0f, _totalContentH - 432f);
if (!(num <= 0f))
{
float y = Input.mouseScrollDelta.y;
if (Mathf.Abs(y) > 0.001f)
{
_scrollOffset = Mathf.Clamp(_scrollOffset - y * 40f, 0f, num);
ApplyScroll(num);
}
else
{
UpdateScrollThumb(num);
}
}
}
private void ApplyScroll(float maxScroll)
{
//IL_0036: Unknown result type (might be due to invalid IL or missing references)
_scrollOffset = Mathf.Clamp(_scrollOffset, 0f, maxScroll);
if ((Object)(object)_scrollContentRt != (Object)null)
{
_scrollContentRt.anchoredPosition = new Vector2(0f, _scrollOffset);
}
UpdateScrollThumb(maxScroll);
}
private void UpdateScrollThumb(float maxScroll)
{
//IL_0060: 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)
if (!((Object)(object)_scrollThumbRt == (Object)null) && !(_totalContentH <= 0f))
{
float num = ((maxScroll > 0f) ? (_scrollOffset / maxScroll) : 0f);
float num2 = Mathf.Max(30f, 186624f / _totalContentH);
float num3 = (0f - num) * (432f - num2);
_scrollThumbRt.sizeDelta = new Vector2(0f, num2);
_scrollThumbRt.anchoredPosition = new Vector2(0f, num3);
}
}
private void HandleClicks()
{
//IL_0009: Unknown result type (might be due to invalid IL or missing references)
//IL_000e: Unknown result type (might be due to invalid IL or missing references)
//IL_0013: Unknown result type (might be due to invalid IL or missing references)
//IL_003a: Unknown result type (might be due to invalid IL or missing references)
//IL_0078: 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_013b: Unknown result type (might be due to invalid IL or missing references)
if (!Input.GetMouseButtonDown(0))
{
return;
}
Vector2 val = Vector2.op_Implicit(Input.mousePosition);
if ((Object)(object)_modsBtnRt != (Object)null && ((Component)_modsBtnRt).gameObject.activeSelf && HitTest(_modsBtnRt, val))
{
if (_panelOpen)
{
DoClose();
}
else
{
OpenPanel();
}
}
else
{
if (!_panelOpen)
{
return;
}
if (!((Object)(object)_scrollTrackRt != (Object)null) || !HitTest(_scrollTrackRt, val))
{
foreach (var (val3, action2) in Clicks.Map)
{
if (!((Object)(object)val3 == (Object)null) && HitTest(val3, val))
{
action2?.Invoke();
break;
}
}
return;
}
Vector3[] array = (Vector3[])(object)new Vector3[4];
_scrollTrackRt.GetWorldCorners(Il2CppStructArray<Vector3>.op_Implicit(array));
float num = array[1].y - array[0].y;
float num2 = val.y - array[0].y;
float num3 = 1f - Mathf.Clamp01(num2 / num);
float num4 = Mathf.Max(0f, _totalContentH - 432f);
_scrollOffset = num3 * num4;
ApplyScroll(num4);
}
}
private void UpdateModsButtonHover()
{
//IL_0023: 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_006b: 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)
if (!((Object)(object)_modsBtnImg == (Object)null) && !((Object)(object)_modsBtnRt == (Object)null))
{
bool flag = HitTest(_modsBtnRt, Vector2.op_Implicit(Input.mousePosition));
((Graphic)_modsBtnImg).color = (flag ? new Color(1f, 1f, 1f, 0.14f) : new Color(0f, 0f, 0f, 0f));
}
}
private void PositionModsButton()
{
//IL_006a: 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_0086: 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: Unknown result type (might be due to invalid IL or missing references)
//IL_0041: 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)
Vector2 val = default(Vector2);
if (_isPause)
{
RectTransform modsBtnRt = _modsBtnRt;
RectTransform modsBtnRt2 = _modsBtnRt;
((Vector2)(ref val))..ctor(0.5f, 0.685f);
modsBtnRt2.anchorMax = val;
modsBtnRt.anchorMin = val;
_modsBtnRt.sizeDelta = new Vector2(260f, 34f);
}
else
{
RectTransform modsBtnRt3 = _modsBtnRt;
RectTransform modsBtnRt4 = _modsBtnRt;
((Vector2)(ref val))..ctor(0.7f, 0.25f);
modsBtnRt4.anchorMax = val;
modsBtnRt3.anchorMin = val;
_modsBtnRt.sizeDelta = new Vector2(200f, 34f);
}
_modsBtnRt.anchoredPosition = Vector2.zero;
}
private void OpenPanel()
{
if (_builtRegistryVersion != POGConfig.RegistryVersion)
{
_contentBuilt = false;
}
EnsureContent();
_overlay.SetActive(true);
_panelOpen = true;
PanelOpen = true;
POGConfig.PanelOpen = true;
}
internal void DoClose()
{
if ((Object)(object)_overlay != (Object)null)
{
_overlay.SetActive(false);
}
_panelOpen = false;
PanelOpen = false;
POGConfig.PanelOpen = false;
KeyEntry.AnyWaiting = false;
}
private void BuildStaticUI()
{
//IL_0058: Unknown result type (might be due to invalid IL or missing references)
//IL_005e: Expected O, but got Unknown
//IL_0093: 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_00c5: Unknown result type (might be due to invalid IL or missing references)
//IL_00cb: Expected O, but got Unknown
//IL_00cb: Unknown result type (might be due to invalid IL or missing references)
if (_uiReady)
{
return;
}
_uiReady = true;
try
{
try
{
Il2CppArrayBase<TMP_FontAsset> val = Resources.FindObjectsOfTypeAll<TMP_FontAsset>();
if (val != null && val.Count > 0)
{
_font = val[0];
}
}
catch
{
}
try
{
if ((Object)(object)_font == (Object)null)
{
_font = TMP_Settings.defaultFontAsset;
}
}
catch
{
}
GameObject val2 = new GameObject("POGCanvas");
Object.DontDestroyOnLoad((Object)(object)val2);
Canvas obj3 = val2.AddComponent<Canvas>();
obj3.renderMode = (RenderMode)0;
obj3.sortingOrder = 9999;
CanvasScaler obj4 = val2.AddComponent<CanvasScaler>();
obj4.uiScaleMode = (ScaleMode)1;
obj4.referenceResolution = new Vector2(1920f, 1080f);
obj4.matchWidthOrHeight = 0.5f;
val2.AddComponent<GraphicRaycaster>();
if ((Object)(object)Object.FindObjectOfType<EventSystem>() == (Object)null)
{
GameObject val3 = new GameObject("POG_EventSystem");
Object.DontDestroyOnLoad((Object)val3);
val3.AddComponent<EventSystem>();
val3.AddComponent<StandaloneInputModule>();
}
GameObject val4 = BuildModsButton(val2.transform);
_modsBtnRt = UI.Rt(val4);
val4.SetActive(false);
_overlay = BuildOverlay(val2.transform);
_overlay.SetActive(false);
MelonLogger.Msg("[POGConfig] Canvas created.");
}
catch (Exception ex)
{
_uiReady = false;
MelonLogger.Warning("[POGConfig] BuildStaticUI failed: " + ex.Message);
}
}
private GameObject BuildModsButton(Transform parent)
{
//IL_0022: 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)
GameObject val = UI.Make("ModsButton", parent);
_modsBtnImg = UI.AddImage(val, new Color(0f, 0f, 0f, 0f));
GameObject go = UI.Make("Text", val.transform);
UI.Stretch(UI.Rt(go));
((TMP_Text)UI.AddText(go, "MODS", _font, 20, Color.white, (TextAlignmentOptions)514)).fontStyle = (FontStyles)1;
return val;
}
private GameObject BuildOverlay(Transform parent)
{
//IL_0040: 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_007d: Unknown result type (might be due to invalid IL or missing references)
//IL_008e: 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_0103: 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_0137: Unknown result type (might be due to invalid IL or missing references)
//IL_014c: Unknown result type (might be due to invalid IL or missing references)
//IL_0161: Unknown result type (might be due to invalid IL or missing references)
//IL_016b: 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_01b9: Unknown result type (might be due to invalid IL or missing references)
//IL_0211: Unknown result type (might be due to invalid IL or missing references)
//IL_024a: Unknown result type (might be due to invalid IL or missing references)
//IL_0264: Unknown result type (might be due to invalid IL or missing references)
//IL_027e: Unknown result type (might be due to invalid IL or missing references)
//IL_0298: Unknown result type (might be due to invalid IL or missing references)
//IL_02b2: Unknown result type (might be due to invalid IL or missing references)
//IL_02cc: Unknown result type (might be due to invalid IL or missing references)
//IL_0323: Unknown result type (might be due to invalid IL or missing references)
GameObject val = UI.Make("Overlay", parent);
UI.Stretch(UI.Rt(val));
UI.AddImage(val, new Color(0f, 0f, 0f, 0.82f));
GameObject val2 = UI.Make("Panel", val.transform);
RectTransform obj = UI.Rt(val2);
Vector2 val3 = default(Vector2);
((Vector2)(ref val3))..ctor(0.5f, 0.5f);
obj.anchorMax = val3;
obj.anchorMin = val3;
obj.sizeDelta = new Vector2(740f, 560f);
Color color = default(Color);
((Color)(ref color))..ctor(0.055f, 0.055f, 0.07f, 0.99f);
UI.AddImage(val2, color);
BuildViewport(val2.transform);
BuildScrollbar(val2.transform);
GameObject go = UI.Make("TopCover", val2.transform);
UI.PlaceFromTop(UI.Rt(go), 0f, 68f);
UI.AddImage(go, color, raycast: false);
GameObject go2 = UI.Make("BotCover", val2.transform);
RectTransform obj2 = UI.Rt(go2);
obj2.anchorMin = Vector2.zero;
obj2.anchorMax = new Vector2(1f, 0f);
obj2.pivot = new Vector2(0.5f, 0f);
obj2.sizeDelta = new Vector2(0f, 60f);
obj2.anchoredPosition = Vector2.zero;
UI.AddImage(go2, color, raycast: false);
GameObject go3 = UI.Make("Title", val2.transform);
UI.PlaceFromTop(UI.Rt(go3), 14f, 40f, 24f, 24f);
((TMP_Text)UI.AddText(go3, "MOD SETTINGS", _font, 22, Color.white, (TextAlignmentOptions)4097)).fontStyle = (FontStyles)1;
GameObject go4 = UI.Make("Sep", val2.transform);
UI.PlaceFromTop(UI.Rt(go4), 62f, 1f, 24f, 24f);
UI.AddImage(go4, new Color(1f, 1f, 1f, 0.12f), raycast: false);
GameObject val4 = UI.Make("DoneBtn", val2.transform);
_doneBtnRt = UI.Rt(val4);
_doneBtnRt.anchorMin = new Vector2(1f, 0f);
_doneBtnRt.anchorMax = new Vector2(1f, 0f);
_doneBtnRt.pivot = new Vector2(1f, 0f);
_doneBtnRt.offsetMin = new Vector2(-170f, 14f);
_doneBtnRt.offsetMax = new Vector2(-20f, 52f);
UI.AddImage(val4, new Color(0.85f, 0.65f, 0.1f));
GameObject go5 = UI.Make("Text", val4.transform);
UI.Stretch(UI.Rt(go5));
((TMP_Text)UI.AddText(go5, "DONE", _font, 15, new Color(0.08f, 0.04f, 0f), (TextAlignmentOptions)514)).fontStyle = (FontStyles)1;
return val;
}
private void BuildViewport(Transform panelTr)
{
//IL_0013: Unknown result type (might be due to invalid IL or missing references)
//IL_001e: Unknown result type (might be due to invalid IL or missing references)
//IL_0033: Unknown result type (might be due to invalid IL or missing references)
//IL_0047: Unknown result type (might be due to invalid IL or missing references)
//IL_0085: Unknown result type (might be due to invalid IL or missing references)
//IL_009f: Unknown result type (might be due to invalid IL or missing references)
//IL_00b9: Unknown result type (might be due to invalid IL or missing references)
//IL_00d3: Unknown result type (might be due to invalid IL or missing references)
//IL_00e3: Unknown result type (might be due to invalid IL or missing references)
GameObject val = UI.Make("Viewport", panelTr);
RectTransform obj = UI.Rt(val);
obj.anchorMin = Vector2.zero;
obj.anchorMax = Vector2.one;
obj.offsetMin = new Vector2(16f, 60f);
obj.offsetMax = new Vector2(-42f, -68f);
val.AddComponent<RectMask2D>();
GameObject val2 = UI.Make("ScrollContent", val.transform);
_scrollContentRt = UI.Rt(val2);
_scrollContentRt.anchorMin = new Vector2(0f, 1f);
_scrollContentRt.anchorMax = new Vector2(1f, 1f);
_scrollContentRt.pivot = new Vector2(0.5f, 1f);
_scrollContentRt.sizeDelta = new Vector2(0f, 0f);
_scrollContentRt.anchoredPosition = Vector2.zero;
_scrollContent = val2.transform;
}
private void BuildScrollbar(Transform panelTr)
{
//IL_0032: Unknown result type (might be due to invalid IL or missing references)
//IL_004c: 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_0080: Unknown result type (might be due to invalid IL or missing references)
//IL_009a: Unknown result type (might be due to invalid IL or missing references)
//IL_00b9: Unknown result type (might be due to invalid IL or missing references)
//IL_00f7: Unknown result type (might be due to invalid IL or missing references)
//IL_0111: 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_0145: Unknown result type (might be due to invalid IL or missing references)
//IL_015f: Unknown result type (might be due to invalid IL or missing references)
//IL_0179: Unknown result type (might be due to invalid IL or missing references)
//IL_0189: Unknown result type (might be due to invalid IL or missing references)
//IL_01a3: Unknown result type (might be due to invalid IL or missing references)
_scrollbarGo = UI.Make("ScrollTrack", panelTr);
_scrollTrackRt = UI.Rt(_scrollbarGo);
_scrollTrackRt.anchorMin = new Vector2(1f, 0f);
_scrollTrackRt.anchorMax = new Vector2(1f, 1f);
_scrollTrackRt.pivot = new Vector2(1f, 0.5f);
_scrollTrackRt.offsetMin = new Vector2(-28f, 60f);
_scrollTrackRt.offsetMax = new Vector2(-8f, -68f);
UI.AddImage(_scrollbarGo, new Color(0.12f, 0.12f, 0.14f));
GameObject go = UI.Make("Thumb", _scrollbarGo.transform);
_scrollThumbRt = UI.Rt(go);
_scrollThumbRt.anchorMin = new Vector2(0f, 1f);
_scrollThumbRt.anchorMax = new Vector2(1f, 1f);
_scrollThumbRt.pivot = new Vector2(0.5f, 1f);
_scrollThumbRt.offsetMin = new Vector2(2f, 0f);
_scrollThumbRt.offsetMax = new Vector2(-2f, 0f);
_scrollThumbRt.sizeDelta = new Vector2(-4f, 40f);
_scrollThumbRt.anchoredPosition = Vector2.zero;
UI.AddImage(go, new Color(0.45f, 0.45f, 0.5f));
_scrollbarGo.SetActive(false);
}
private void EnsureContent()
{
//IL_02be: Unknown result type (might be due to invalid IL or missing references)
//IL_01aa: 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_031c: Unknown result type (might be due to invalid IL or missing references)
if (_contentBuilt || (Object)(object)_scrollContent == (Object)null)
{
return;
}
_contentBuilt = true;
Clicks.Clear();
_builtRegistryVersion = POGConfig.RegistryVersion;
for (int num = _scrollContent.childCount - 1; num >= 0; num--)
{
Transform child = _scrollContent.GetChild(num);
if ((Object)(object)child != (Object)null)
{
Object.Destroy((Object)(object)((Component)child).gameObject);
}
}
if ((Object)(object)_doneBtnRt != (Object)null)
{
Clicks.Register(_doneBtnRt, DoClose);
}
try
{
IReadOnlyList<(string, List<ConfigEntry>)> all = POGConfig.GetAll();
MelonLogger.Msg($"[POGConfig] Building content: {all.Count} mod(s).");
float num2 = 4f;
if (all.Count == 0)
{
GameObject go = UI.Make("Empty", _scrollContent);
UI.PlaceFromTop(UI.Rt(go), num2, 36f);
UI.AddText(go, "No mods registered yet.", _font, 14, new Color(0.6f, 0.6f, 0.6f), (TextAlignmentOptions)4097);
num2 += 40f;
}
else
{
for (int i = 0; i < all.Count; i++)
{
(string, List<ConfigEntry>) tuple = all[i];
string item = tuple.Item1;
List<ConfigEntry> item2 = tuple.Item2;
GameObject go2 = UI.Make("H_" + item, _scrollContent);
UI.PlaceFromTop(UI.Rt(go2), num2, 32f);
((TMP_Text)UI.AddText(go2, item, _font, 15, new Color(1f, 0.82f, 0.3f), (TextAlignmentOptions)4097)).fontStyle = (FontStyles)1;
num2 += 34f;
for (int j = 0; j < item2.Count; j++)
{
ConfigEntry configEntry = item2[j];
try
{
GameObject val = UI.Make("R_" + configEntry.Label, _scrollContent);
UI.PlaceFromTop(UI.Rt(val), num2, 40f);
configEntry.BuildRowInto(val, _font);
}
catch (Exception ex)
{
MelonLogger.Warning("[POGConfig] Row '" + configEntry.Label + "': " + ex.Message);
}
num2 += 42f;
}
if (i < all.Count - 1)
{
GameObject go3 = UI.Make("Sep_" + i, _scrollContent);
UI.PlaceFromTop(UI.Rt(go3), num2, 6f);
UI.AddImage(go3, new Color(1f, 1f, 1f, 0.08f), raycast: false);
num2 += 10f;
}
}
}
_totalContentH = num2 + 4f;
_scrollOffset = 0f;
if ((Object)(object)_scrollContentRt != (Object)null)
{
_scrollContentRt.sizeDelta = new Vector2(0f, _totalContentH);
}
bool flag = _totalContentH > 432f;
if ((Object)(object)_scrollbarGo != (Object)null)
{
_scrollbarGo.SetActive(flag);
}
MelonLogger.Msg($"[POGConfig] Done. ContentH={_totalContentH:F0} ViewportH={432f} Scroll={flag}");
}
catch (Exception value)
{
MelonLogger.Warning($"[POGConfig] EnsureContent failed: {value}");
}
}
}