using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Security;
using System.Security.Permissions;
using System.Text.RegularExpressions;
using BepInEx;
using BepInEx.Configuration;
using LLGUI;
using LLHandlers;
using LLScreen;
using SFB;
using UnityEngine;
[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("af5240d2-01ef-4a83-b7a2-fc685570e16d")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyTitle("ModMenu (no.mrgentle.plugins.llb.modmenu)")]
[assembly: AssemblyProduct("ModMenu")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.3.2.0")]
[module: UnverifiableCode]
namespace ModMenu;
public static class ModMenuStyle
{
private static Dictionary<string, Texture2D> texColors = new Dictionary<string, Texture2D>();
public static GUIStyle border = new GUIStyle
{
padding = new RectOffset(10, 10, 24, 10),
fontSize = 136
};
public static GUIStyle mainStyle
{
get
{
//IL_0000: Unknown result type (might be due to invalid IL or missing references)
//IL_0005: Unknown result type (might be due to invalid IL or missing references)
//IL_000a: Unknown result type (might be due to invalid IL or missing references)
//IL_0014: Expected O, but got Unknown
//IL_0015: Expected O, but got Unknown
GUIStyle val = new GUIStyle
{
padding = new RectOffset(4, 4, 4, 4)
};
val.normal.background = texColors["Black"];
return val;
}
}
public static GUIStyle labStyle
{
get
{
//IL_000a: Unknown result type (might be due to invalid IL or missing references)
//IL_000f: Unknown result type (might be due to invalid IL or missing references)
//IL_0017: Unknown result type (might be due to invalid IL or missing references)
//IL_001f: Expected O, but got Unknown
//IL_0034: Unknown result type (might be due to invalid IL or missing references)
GUIStyle val = new GUIStyle(GUI.skin.label)
{
fontSize = 16,
alignment = (TextAnchor)4
};
val.normal.textColor = new Color(1f, 0.968f, 0.3f);
return val;
}
}
public static GUIStyle windStyle
{
get
{
//IL_0000: Unknown result type (might be due to invalid IL or missing references)
//IL_0005: Unknown result type (might be due to invalid IL or missing references)
//IL_000a: Unknown result type (might be due to invalid IL or missing references)
//IL_0014: Expected O, but got Unknown
//IL_0014: Unknown result type (might be due to invalid IL or missing references)
//IL_001b: Unknown result type (might be due to invalid IL or missing references)
//IL_0023: Unknown result type (might be due to invalid IL or missing references)
//IL_002b: Expected O, but got Unknown
//IL_005a: Unknown result type (might be due to invalid IL or missing references)
GUIStyle val = new GUIStyle
{
padding = new RectOffset(4, 4, 4, 4),
alignment = (TextAnchor)1,
fontSize = 20,
fontStyle = (FontStyle)1
};
val.normal.background = texColors["Black"];
val.normal.textColor = new Color(1f, 0.968f, 0.3f);
return val;
}
}
public static GUIStyle button
{
get
{
//IL_000a: Unknown result type (might be due to invalid IL or missing references)
//IL_000f: Unknown result type (might be due to invalid IL or missing references)
//IL_0017: 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_0025: Unknown result type (might be due to invalid IL or missing references)
//IL_002a: Unknown result type (might be due to invalid IL or missing references)
//IL_0034: Expected O, but got Unknown
//IL_0035: Expected O, but got Unknown
//IL_003b: Unknown result type (might be due to invalid IL or missing references)
//IL_004b: Unknown result type (might be due to invalid IL or missing references)
//IL_005b: Unknown result type (might be due to invalid IL or missing references)
GUIStyle val = new GUIStyle(GUI.skin.button)
{
fontSize = 15,
fontStyle = (FontStyle)1,
alignment = (TextAnchor)4,
padding = new RectOffset(4, 4, 4, 4)
};
val.normal.textColor = Color.black;
val.hover.textColor = Color.black;
val.active.textColor = Color.white;
val.normal.background = texColors["Yellow"];
val.hover.background = texColors["LightYellow"];
return val;
}
}
public static GUIStyle box
{
get
{
//IL_000a: Unknown result type (might be due to invalid IL or missing references)
//IL_000f: Unknown result type (might be due to invalid IL or missing references)
//IL_0017: 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_0025: Unknown result type (might be due to invalid IL or missing references)
//IL_002a: Unknown result type (might be due to invalid IL or missing references)
//IL_0034: Expected O, but got Unknown
//IL_0035: Expected O, but got Unknown
//IL_003b: Unknown result type (might be due to invalid IL or missing references)
//IL_004b: Unknown result type (might be due to invalid IL or missing references)
//IL_005b: Unknown result type (might be due to invalid IL or missing references)
GUIStyle val = new GUIStyle(GUI.skin.box)
{
fontSize = 15,
fontStyle = (FontStyle)1,
alignment = (TextAnchor)4,
padding = new RectOffset(4, 4, 4, 4)
};
val.normal.textColor = Color.black;
val.hover.textColor = Color.black;
val.active.textColor = Color.white;
val.normal.background = texColors["Yellow"];
val.hover.background = texColors["Yellow"];
return val;
}
}
public static GUIStyle headerBox
{
get
{
//IL_000a: Unknown result type (might be due to invalid IL or missing references)
//IL_000f: Unknown result type (might be due to invalid IL or missing references)
//IL_0017: 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_0025: Unknown result type (might be due to invalid IL or missing references)
//IL_002a: Unknown result type (might be due to invalid IL or missing references)
//IL_0034: Expected O, but got Unknown
//IL_0035: Expected O, but got Unknown
//IL_003b: Unknown result type (might be due to invalid IL or missing references)
//IL_004b: Unknown result type (might be due to invalid IL or missing references)
//IL_005b: Unknown result type (might be due to invalid IL or missing references)
GUIStyle val = new GUIStyle(GUI.skin.box)
{
fontSize = 18,
fontStyle = (FontStyle)1,
alignment = (TextAnchor)4,
padding = new RectOffset(4, 4, 4, 4)
};
val.normal.textColor = Color.black;
val.hover.textColor = Color.black;
val.active.textColor = Color.white;
val.normal.background = texColors["Yellow"];
val.hover.background = texColors["Yellow"];
return val;
}
}
public static GUIStyle versionBox
{
get
{
//IL_000a: Unknown result type (might be due to invalid IL or missing references)
//IL_000f: Unknown result type (might be due to invalid IL or missing references)
//IL_0017: 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_0025: Unknown result type (might be due to invalid IL or missing references)
//IL_002a: Unknown result type (might be due to invalid IL or missing references)
//IL_0034: Expected O, but got Unknown
//IL_0035: Expected O, but got Unknown
//IL_004a: 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_0088: Unknown result type (might be due to invalid IL or missing references)
GUIStyle val = new GUIStyle(GUI.skin.box)
{
fontSize = 15,
fontStyle = (FontStyle)1,
alignment = (TextAnchor)4,
padding = new RectOffset(4, 4, 4, 4)
};
val.normal.textColor = new Color(1f, 0.968f, 0.3f);
val.hover.textColor = new Color(1f, 0.968f, 0.3f);
val.active.textColor = new Color(1f, 0.968f, 0.3f);
val.normal.background = texColors["Black"];
val.hover.background = texColors["Black"];
return val;
}
}
public static GUIStyle _sliderThumbStyle
{
get
{
//IL_0000: Unknown result type (might be due to invalid IL or missing references)
//IL_0005: Unknown result type (might be due to invalid IL or missing references)
//IL_000d: Unknown result type (might be due to invalid IL or missing references)
//IL_0014: Unknown result type (might be due to invalid IL or missing references)
//IL_001c: Expected O, but got Unknown
GUIStyle val = new GUIStyle
{
fontSize = 24,
fontStyle = (FontStyle)1,
alignment = (TextAnchor)4
};
val.stretchHeight = true;
val.fixedWidth = 40f;
val.normal.background = texColors["Black"];
val.hover.background = texColors["Black"];
val.active.background = texColors["LightGray"];
return val;
}
}
public static GUIStyle _sliderBackgroundStyle
{
get
{
//IL_0000: Unknown result type (might be due to invalid IL or missing references)
//IL_0005: Unknown result type (might be due to invalid IL or missing references)
//IL_000c: Unknown result type (might be due to invalid IL or missing references)
//IL_0011: Unknown result type (might be due to invalid IL or missing references)
//IL_001b: Expected O, but got Unknown
//IL_001c: Expected O, but got Unknown
//IL_0021: Unknown result type (might be due to invalid IL or missing references)
//IL_002b: Expected O, but got Unknown
GUIStyle val = new GUIStyle
{
stretchWidth = true,
padding = new RectOffset(2, 2, 2, 2)
};
val.margin = new RectOffset(0, 0, 7, 0);
val.normal.background = texColors["Yellow"];
val.hover.background = texColors["Yellow"];
val.active.background = texColors["Yellow"];
val.focused.background = texColors["Yellow"];
return val;
}
}
public static GUIStyle _textFieldStyle
{
get
{
//IL_0000: Unknown result type (might be due to invalid IL or missing references)
//IL_0005: Unknown result type (might be due to invalid IL or missing references)
//IL_000d: Unknown result type (might be due to invalid IL or missing references)
//IL_0012: Unknown result type (might be due to invalid IL or missing references)
//IL_001c: Expected O, but got Unknown
//IL_001d: Expected O, but got Unknown
//IL_0022: Unknown result type (might be due to invalid IL or missing references)
//IL_002c: Expected O, but got Unknown
//IL_0041: Unknown result type (might be due to invalid IL or missing references)
GUIStyle val = new GUIStyle
{
fontSize = 16,
padding = new RectOffset(4, 4, 4, 4)
};
val.margin = new RectOffset(0, 0, 5, 0);
val.normal.textColor = new Color(1f, 0.968f, 0.3f);
val.normal.background = texColors["Black"];
return val;
}
}
public static GUIStyle readStyle
{
get
{
//IL_0000: Unknown result type (might be due to invalid IL or missing references)
//IL_0005: Unknown result type (might be due to invalid IL or missing references)
//IL_000c: Unknown result type (might be due to invalid IL or missing references)
//IL_0015: Expected O, but got Unknown
//IL_001c: Unknown result type (might be due to invalid IL or missing references)
//IL_0026: Expected O, but got Unknown
//IL_0033: Unknown result type (might be due to invalid IL or missing references)
GUIStyle val = new GUIStyle
{
alignment = (TextAnchor)3,
fontSize = 16
};
val.margin = new RectOffset(25, 25, 0, 0);
val.wordWrap = true;
val.normal.textColor = Color.white;
return val;
}
}
public static void InitStyle()
{
//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_0050: Unknown result type (might be due to invalid IL or missing references)
//IL_0055: Unknown result type (might be due to invalid IL or missing references)
//IL_007d: 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_00aa: Unknown result type (might be due to invalid IL or missing references)
//IL_00af: Unknown result type (might be due to invalid IL or missing references)
//IL_00d3: Unknown result type (might be due to invalid IL or missing references)
//IL_0100: Unknown result type (might be due to invalid IL or missing references)
texColors.Clear();
texColors.Add("Yellow", ColorToTexture2D(Color32.op_Implicit(new Color(1f, 0.968f, 0.3f))));
texColors.Add("LightYellow", ColorToTexture2D(Color32.op_Implicit(new Color(1f, 1f, 0.5f))));
texColors.Add("DarkGray", ColorToTexture2D(Color32.op_Implicit(new Color(0.145f, 0.145f, 0.145f))));
texColors.Add("LightGray", ColorToTexture2D(Color32.op_Implicit(new Color(0.5f, 0.5f, 0.5f))));
texColors.Add("Black", ColorToTexture2D(new Color32((byte)12, (byte)12, (byte)12, byte.MaxValue)));
texColors.Add("White", ColorToTexture2D(new Color32(byte.MaxValue, byte.MaxValue, byte.MaxValue, byte.MaxValue)));
}
private static Texture2D ColorToTexture2D(Color32 color)
{
//IL_0004: Unknown result type (might be due to invalid IL or missing references)
//IL_000a: Expected O, but got Unknown
//IL_000d: 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)
Texture2D val = new Texture2D(1, 1, (TextureFormat)4, false);
val.SetPixel(0, 0, Color32.op_Implicit(color));
val.Apply();
return val;
}
}
[BepInPlugin("no.mrgentle.plugins.llb.modmenu", "ModMenu", "1.3.2")]
[BepInDependency(/*Could not decode attribute arguments.*/)]
[BepInProcess("LLBlaze.exe")]
public class ModMenu : BaseUnityPlugin
{
public static Dictionary<PluginInfo, List<string>> registeredMods = new Dictionary<PluginInfo, List<string>>();
private readonly Array keyCodes = Enum.GetValues(typeof(KeyCode));
private ScreenMenu mainmenu;
private ScreenBase submenu;
private LLButton modSettingsButton;
public List<LLButton> modButtons = new List<LLButton>();
public Vector2 keybindScrollpos = new Vector2(0f, 0f);
public Vector2 optionsScrollpos = new Vector2(0f, 0f);
public Vector2 optionsTextpos = new Vector2(0f, 0f);
private PluginInfo currentOpenMod;
private PluginInfo previousOpenMod;
private bool sliderChange;
private ConfigDefinition definitionToRebind;
private bool rebindingKey;
private bool inModOptions;
private bool inModSubOptions;
private WindowFunction keybindWindowFunction;
private WindowFunction optionsWindowFunction;
private WindowFunction textWindowFunction;
public static ModMenu Instance { get; private set; } = null;
public void Awake()
{
Instance = this;
ModMenuStyle.InitStyle();
}
public static bool InModOptions()
{
return Instance.inModOptions;
}
public static void RegisterMod(PluginInfo pluginInfo, List<string> modmenu_textinfo = null)
{
registeredMods.Add(pluginInfo, modmenu_textinfo);
}
private void Update()
{
//IL_0112: Unknown result type (might be due to invalid IL or missing references)
//IL_0118: Invalid comparison between Unknown and I4
//IL_0069: Unknown result type (might be due to invalid IL or missing references)
//IL_006e: Unknown result type (might be due to invalid IL or missing references)
//IL_006f: Unknown result type (might be due to invalid IL or missing references)
//IL_015e: 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_0094: Unknown result type (might be due to invalid IL or missing references)
if (sliderChange && Input.GetKeyUp((KeyCode)323))
{
currentOpenMod.Instance.Config.Save();
currentOpenMod.Instance.Config.SaveOnConfigSet = true;
sliderChange = false;
}
if (rebindingKey && Input.anyKeyDown)
{
foreach (KeyCode keyCode in keyCodes)
{
if (Input.GetKey(keyCode))
{
ConfigFile config = currentOpenMod.Instance.Config;
config[definitionToRebind].BoxedValue = (object)keyCode;
config.Save();
rebindingKey = false;
}
}
}
if ((Object)(object)mainmenu == (Object)null)
{
ScreenBase obj = UIScreen.currentScreens[0];
ScreenMenu val2 = (ScreenMenu)(object)((obj is ScreenMenu) ? obj : null);
if (val2 != null)
{
mainmenu = val2;
}
}
if ((Object)(object)submenu == (Object)null)
{
submenu = UIScreen.currentScreens[1];
}
else if ((int)submenu.screenType == 8 && (Object)(object)modSettingsButton == (Object)null)
{
modSettingsButton = InitModSettingsButton();
}
if (inModSubOptions && currentOpenMod != previousOpenMod)
{
previousOpenMod = currentOpenMod;
}
if (inModOptions)
{
Controller mouseKeyboard = Controller.mouseKeyboard;
if (((Controller)(ref mouseKeyboard)).GetButton(InputAction.ESC))
{
previousOpenMod = null;
UIScreen.Open((ScreenType)8, 1, (ScreenTransition)2, true);
inModOptions = false;
inModSubOptions = false;
}
}
}
public void HandleModSettingsClick(int playerNr)
{
//IL_0026: Unknown result type (might be due to invalid IL or missing references)
//IL_0030: Expected O, but got Unknown
//IL_00ba: 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_00fb: Unknown result type (might be due to invalid IL or missing references)
//IL_0105: Expected O, but got Unknown
ScreenBase val = UIScreen.Open((ScreenType)31, 1);
inModOptions = true;
((LLClickable)GameObject.Find("btQuit").GetComponent<LLButton>()).onClick = new ControlDelegate(HandleQuitClick);
mainmenu.lbTitle.text = "MOD SETTINGS";
int num = 0;
int num2 = 0;
foreach (PluginInfo plugin in registeredMods.Keys)
{
LLButton val2 = Object.Instantiate<LLButton>(modSettingsButton, ((Component)val).transform);
val2.SetText(plugin.Metadata.Name, 50, false);
((Component)val2).transform.localScale = new Vector3(0.4f, 0.3f);
((Component)val2).transform.position = new Vector3(-1.5f + 0.75f * (float)num2, 0.8f - 0.125f * (float)num);
((LLClickable)val2).onClick = (ControlDelegate)delegate
{
HandleModSubSettingsClick(plugin);
};
modButtons.Add(val2);
if (num < 12)
{
num++;
continue;
}
num2++;
num = 0;
}
}
private void HandleModSubSettingsClick(PluginInfo plugin)
{
inModSubOptions = true;
currentOpenMod = plugin;
ScreenBase val = UIScreen.Open((ScreenType)31, 1);
mainmenu.lbTitle.text = plugin.Metadata.Name.ToUpper() + " SETTINGS";
}
private void HandleQuitClick(int playerNr)
{
//IL_004e: Unknown result type (might be due to invalid IL or missing references)
//IL_0054: Invalid comparison between Unknown and I4
//IL_002d: Unknown result type (might be due to invalid IL or missing references)
//IL_0033: Invalid comparison between Unknown and I4
previousOpenMod = null;
if (inModOptions)
{
UIScreen.Open((ScreenType)8, 1);
}
else if ((Object)(object)submenu != (Object)null)
{
if ((int)submenu.screenType == 3)
{
DNPFJHMAIBP.GKBNNFEAJGO((Msg)1, playerNr, -1);
}
else
{
DNPFJHMAIBP.GKBNNFEAJGO((Msg)2, playerNr, -1);
}
}
if ((int)UIScreen.currentScreens[1].screenType == 8)
{
mainmenu.lbTitle.text = "OPTIONS";
inModOptions = false;
inModSubOptions = false;
AudioHandler.PlayMenuSfx((Sfx)7);
AudioHandler.PlayMenuSfx((Sfx)6);
}
}
public LLButton InitModSettingsButton()
{
//IL_0084: Unknown result type (might be due to invalid IL or missing references)
//IL_008e: Expected O, but got Unknown
//IL_00ba: 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_00f6: Unknown result type (might be due to invalid IL or missing references)
//IL_0113: Unknown result type (might be due to invalid IL or missing references)
//IL_012a: Unknown result type (might be due to invalid IL or missing references)
//IL_020e: Unknown result type (might be due to invalid IL or missing references)
//IL_0224: Unknown result type (might be due to invalid IL or missing references)
//IL_0231: Unknown result type (might be due to invalid IL or missing references)
//IL_023e: Unknown result type (might be due to invalid IL or missing references)
//IL_0245: Unknown result type (might be due to invalid IL or missing references)
//IL_0167: 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_01a6: Unknown result type (might be due to invalid IL or missing references)
//IL_01bc: Unknown result type (might be due to invalid IL or missing references)
//IL_01c9: Unknown result type (might be due to invalid IL or missing references)
//IL_01d6: Unknown result type (might be due to invalid IL or missing references)
//IL_01dd: Unknown result type (might be due to invalid IL or missing references)
LLButton val = null;
List<LLButton> list = new List<LLButton>();
ScreenMenuOptions val2 = Object.FindObjectOfType<ScreenMenuOptions>();
list.Add(val2.btGame);
list.Add(val2.btInput);
list.Add(val2.btAudio);
list.Add(val2.btVideo);
list.Add(val2.btCredits);
val = Object.Instantiate<LLButton>(list[4], ((Component)list[4]).transform, true);
((Object)val).name = "btMods";
val.SetText("mod settings", -1, false);
((LLClickable)val).onClick = new ControlDelegate(HandleModSettingsClick);
list.Add(val);
for (int i = 0; i < list.Count(); i++)
{
if (!((Object)(object)list[i] == (Object)null))
{
Vector3 localScale = ((Component)list[i]).transform.localScale;
int num = 2560;
int num2 = 1440;
if ((Object)(object)list[i] == (Object)(object)val)
{
((Component)list[i]).transform.localPosition = new Vector3(((Component)list[i]).transform.localPosition.x - (float)(num / 100), ((Component)list[i]).transform.localPosition.y - (float)(num2 / 100) * 9.5f);
}
else if ((Object)(object)list[i] != (Object)(object)val2.btGame)
{
((Component)list[i]).transform.localPosition = new Vector3(((Component)val2.btGame).transform.localPosition.x - (float)(num / 100) * 0.55f * (float)i, ((Component)val2.btGame).transform.localPosition.y - (float)(num2 / 100) * 5.3f * (float)i);
((Component)list[i]).transform.localScale = new Vector3(localScale.x * 0.85f, localScale.y * 0.85f, localScale.z);
}
else
{
((Component)list[i]).transform.localPosition = new Vector3(0f - (float)(num / 100) * 8.375f, (float)(num2 / 100) * 12.625f);
((Component)list[i]).transform.localScale = new Vector3(localScale.x * 0.85f, localScale.y * 0.85f, localScale.z);
}
}
}
return val;
}
private void OnGUI()
{
//IL_0010: Unknown result type (might be due to invalid IL or missing references)
//IL_001a: Expected O, but got Unknown
//IL_002a: Unknown result type (might be due to invalid IL or missing references)
//IL_0034: Expected O, but got Unknown
//IL_0044: Unknown result type (might be due to invalid IL or missing references)
//IL_004e: Expected O, but got Unknown
//IL_00b3: Unknown result type (might be due to invalid IL or missing references)
//IL_00ba: Expected O, but got Unknown
//IL_00c6: Unknown result type (might be due to invalid IL or missing references)
//IL_00cb: Unknown result type (might be due to invalid IL or missing references)
//IL_00d7: Unknown result type (might be due to invalid IL or missing references)
//IL_00e4: 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_0140: 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_01df: Unknown result type (might be due to invalid IL or missing references)
//IL_016a: 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_0199: Unknown result type (might be due to invalid IL or missing references)
//IL_01ae: Unknown result type (might be due to invalid IL or missing references)
if (keybindWindowFunction == null)
{
keybindWindowFunction = new WindowFunction(OpenKeybindsWindow);
}
if (optionsWindowFunction == null)
{
optionsWindowFunction = new WindowFunction(OpenOptionsWindow);
}
if (textWindowFunction == null)
{
textWindowFunction = new WindowFunction(OpenTextWindow);
}
int num = Screen.width / 6;
int num2 = Screen.height / 10;
int num3 = Screen.width - Screen.width / 6 * 2;
int num4 = Screen.height - Screen.height / 6;
if (inModSubOptions)
{
GUIContent val = new GUIContent(" ModMenu " + ((BaseUnityPlugin)this).Info.Metadata.Version?.ToString() + " ");
Vector2 val2 = GUI.skin.box.CalcSize(val);
GUI.Box(new Rect(10f, 10f, val2.x + 20f, val2.y), "ModMenu " + ((BaseUnityPlugin)this).Info.Metadata.Version, ModMenuStyle.versionBox);
GUI.Window(0, new Rect((float)num, (float)num2, (float)num3, (float)(num4 / 3)), keybindWindowFunction, "Keybindings", ModMenuStyle.windStyle);
if (registeredMods[currentOpenMod] != null)
{
GUI.Window(1, new Rect((float)num, (float)(num2 + num4 / 3 + 10), (float)num3, (float)(num4 / 3)), optionsWindowFunction, "Options", ModMenuStyle.windStyle);
GUI.Window(2, new Rect((float)num, (float)(num2 + (num4 / 3 + 10) * 2), (float)num3, (float)(num4 / 5)), textWindowFunction, "Mod Information", ModMenuStyle.windStyle);
}
else
{
GUI.Window(1, new Rect((float)num, (float)(num2 + num4 / 3 + 10), (float)num3, (float)(2 * num4 / 3)), optionsWindowFunction, "Options", ModMenuStyle.windStyle);
}
GUI.skin.window = null;
}
GUI.skin.label.fontSize = 15;
}
private void OpenKeybindsWindow(int wId)
{
//IL_0028: Unknown result type (might be due to invalid IL or missing references)
//IL_0035: Unknown result type (might be due to invalid IL or missing references)
//IL_003a: Unknown result type (might be due to invalid IL or missing references)
GUILayout.Space(30f);
GUILayout.BeginHorizontal((GUILayoutOption[])(object)new GUILayoutOption[0]);
GUILayout.BeginVertical((GUILayoutOption[])(object)new GUILayoutOption[0]);
keybindScrollpos = GUILayout.BeginScrollView(keybindScrollpos, false, true, (GUILayoutOption[])(object)new GUILayoutOption[0]);
ConfigFile modConfig = currentOpenMod.Instance.Config;
foreach (ConfigDefinition item in modConfig.Keys.Where((ConfigDefinition setting) => (object)modConfig[setting].SettingType == typeof(KeyCode)))
{
string text = UppercaseFirst(Regex.Replace(item.Key, "([a-z])([A-Z])", "$1 $2"));
GUILayout.BeginHorizontal((GUILayoutOption[])(object)new GUILayoutOption[0]);
GUILayout.FlexibleSpace();
GUILayout.Label(text + ":", ModMenuStyle.labStyle, (GUILayoutOption[])(object)new GUILayoutOption[0]);
GUILayout.Space(10f);
string text2 = ((!rebindingKey || !(item == definitionToRebind)) ? currentOpenMod.Instance.Config[item].BoxedValue.ToString() : "WAITING FOR KEY");
if (GUILayout.Button("[" + text2 + "]", ModMenuStyle.button, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.MinWidth(100f) }))
{
rebindingKey = true;
definitionToRebind = item;
}
GUILayout.FlexibleSpace();
GUILayout.EndHorizontal();
}
GUILayout.EndScrollView();
GUILayout.EndVertical();
GUILayout.EndHorizontal();
}
private void OpenOptionsWindow(int wId)
{
//IL_0022: Unknown result type (might be due to invalid IL or missing references)
//IL_002f: Unknown result type (might be due to invalid IL or missing references)
//IL_0034: Unknown result type (might be due to invalid IL or missing references)
GUILayout.Space(30f);
GUILayout.BeginHorizontal((GUILayoutOption[])(object)new GUILayoutOption[0]);
GUILayout.BeginVertical((GUILayoutOption[])(object)new GUILayoutOption[0]);
optionsScrollpos = GUILayout.BeginScrollView(optionsScrollpos, false, true, (GUILayoutOption[])(object)new GUILayoutOption[0]);
ConfigFile config = currentOpenMod.Instance.Config;
foreach (ConfigDefinition key in config.Keys)
{
object[] tags = config[key].Description.Tags;
Type settingType = config[key].SettingType;
if (config[key].Description.Tags.Contains("modmenu_hidden"))
{
continue;
}
if (tags.Contains("modmenu_filepicker") || tags.Contains("modmenu_directorypicker"))
{
MakeFilePickerSettingGUI(config, key);
}
else if (tags.Contains("modmenu_header"))
{
MakeHeaderGUI(config, key);
}
else if (tags.Contains("modmenu_gap"))
{
MakeGapGUI(config, key);
}
else if ((object)settingType == typeof(bool))
{
MakeBoolSettingGUI(config, key);
}
else if ((object)settingType == typeof(int))
{
ConfigDescription description = config[key].Description;
if (((description != null) ? description.AcceptableValues : null) is AcceptableValueRange<int>)
{
MakeSliderSettingGUI(config, key);
}
else
{
MakeNumericSettingGUI(config, key);
}
}
else if ((object)settingType == typeof(string))
{
MakeStringSettingGUI(config, key);
}
}
GUILayout.EndScrollView();
GUILayout.EndVertical();
GUILayout.EndHorizontal();
}
private void MakeHeaderGUI(ConfigFile modConfig, ConfigDefinition setting)
{
GUILayout.BeginHorizontal((GUILayoutOption[])(object)new GUILayoutOption[0]);
GUILayout.FlexibleSpace();
GUILayout.Box((string)modConfig[setting].BoxedValue, ModMenuStyle.headerBox, (GUILayoutOption[])(object)new GUILayoutOption[0]);
GUILayout.FlexibleSpace();
GUILayout.EndHorizontal();
}
private void MakeGapGUI(ConfigFile modConfig, ConfigDefinition setting)
{
Type settingType = modConfig[setting].SettingType;
int result;
if ((object)settingType == typeof(int))
{
GUILayout.Space((float)(int)modConfig[setting].BoxedValue);
}
else if (int.TryParse((string)modConfig[setting].BoxedValue, out result))
{
GUILayout.Space((float)result);
}
else
{
GUILayout.Space(20f);
}
}
private void MakeBoolSettingGUI(ConfigFile modConfig, ConfigDefinition setting)
{
bool flag = (bool)modConfig[setting].BoxedValue;
string text = UppercaseFirst(Regex.Replace(setting.Key, "([a-z])([A-Z])", "$1 $2"));
GUILayout.BeginHorizontal((GUILayoutOption[])(object)new GUILayoutOption[0]);
GUILayout.FlexibleSpace();
GUILayout.Label(text + ":", ModMenuStyle.labStyle, (GUILayoutOption[])(object)new GUILayoutOption[0]);
GUILayout.Space(10f);
string text2 = "";
text2 = ((!flag) ? "Disabled" : "Enabled");
if (GUILayout.Button(text2, ModMenuStyle.button, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.MinWidth(100f) }))
{
modConfig[setting].BoxedValue = !flag;
modConfig.Save();
}
GUILayout.FlexibleSpace();
GUILayout.EndHorizontal();
}
private void MakeNumericSettingGUI(ConfigFile modConfig, ConfigDefinition setting)
{
int num = (int)modConfig[setting].BoxedValue;
string text = UppercaseFirst(Regex.Replace(setting.Key, "([a-z])([A-Z])", "$1 $2"));
GUILayout.BeginHorizontal((GUILayoutOption[])(object)new GUILayoutOption[0]);
GUILayout.FlexibleSpace();
GUILayout.Label(text + ": ", ModMenuStyle.labStyle, (GUILayoutOption[])(object)new GUILayoutOption[0]);
GUILayout.Box(num.ToString(), ModMenuStyle.box, (GUILayoutOption[])(object)new GUILayoutOption[0]);
GUILayout.Space(10f);
bool flag = GUILayout.Button(" - ", ModMenuStyle.button, (GUILayoutOption[])(object)new GUILayoutOption[0]);
bool flag2 = GUILayout.Button(" + ", ModMenuStyle.button, (GUILayoutOption[])(object)new GUILayoutOption[0]);
GUILayout.Space(30f);
string s = GUILayout.TextField(num.ToString(), 10, ModMenuStyle._textFieldStyle, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.MinWidth(32f) });
bool flag3 = GUILayout.Button("Set Value From Textbox", ModMenuStyle.button, (GUILayoutOption[])(object)new GUILayoutOption[0]);
int result;
if (flag2)
{
modConfig[setting].BoxedValue = num + 1;
modConfig.Save();
}
else if (flag)
{
modConfig[setting].BoxedValue = num - 1;
modConfig.Save();
}
else if (int.TryParse(s, out result))
{
if ((int)modConfig[setting].BoxedValue != result)
{
modConfig[setting].BoxedValue = result;
modConfig.Save();
}
if (flag3)
{
modConfig[setting].BoxedValue = result;
modConfig.Save();
}
}
GUILayout.FlexibleSpace();
GUILayout.EndHorizontal();
}
private void MakeSliderSettingGUI(ConfigFile modConfig, ConfigDefinition setting)
{
int num = (int)modConfig[setting].BoxedValue;
AcceptableValueRange<int> val = modConfig[setting].Description.AcceptableValues as AcceptableValueRange<int>;
string text = UppercaseFirst(Regex.Replace(setting.Key, "([a-z])([A-Z])", "$1 $2"));
float num2 = num;
GUILayout.BeginHorizontal((GUILayoutOption[])(object)new GUILayoutOption[0]);
GUILayout.FlexibleSpace();
GUILayout.Label(text + ": ", ModMenuStyle.labStyle, (GUILayoutOption[])(object)new GUILayoutOption[0]);
num2 = GUILayout.HorizontalSlider(num2, (float)val.MinValue, (float)val.MaxValue, ModMenuStyle._sliderBackgroundStyle, ModMenuStyle._sliderThumbStyle, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(300f) });
GUILayout.Box(Math.Round(double.Parse(num2.ToString())).ToString(), ModMenuStyle.box, (GUILayoutOption[])(object)new GUILayoutOption[0]);
int num3 = (int)Math.Round(num2);
if (num3 != num)
{
modConfig.SaveOnConfigSet = false;
sliderChange = true;
modConfig[setting].BoxedValue = num3;
}
GUILayout.FlexibleSpace();
GUILayout.EndHorizontal();
}
private void MakeStringSettingGUI(ConfigFile modConfig, ConfigDefinition setting)
{
string text = (string)modConfig[setting].BoxedValue;
string text2 = UppercaseFirst(Regex.Replace(setting.Key, "([a-z])([A-Z])", "$1 $2"));
GUILayout.BeginHorizontal((GUILayoutOption[])(object)new GUILayoutOption[0]);
GUILayout.FlexibleSpace();
GUILayout.Label(text2 + ": ", ModMenuStyle.labStyle, (GUILayoutOption[])(object)new GUILayoutOption[0]);
GUILayout.Space(30f);
string text3 = GUILayout.TextField(text, 256, ModMenuStyle._textFieldStyle, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.MinWidth(120f) });
GUIStyle button = ModMenuStyle.button;
if ((string)modConfig[setting].BoxedValue != text3)
{
button.fontStyle = (FontStyle)1;
modConfig.SaveOnConfigSet = false;
modConfig[setting].BoxedValue = text3;
}
if (GUILayout.Button("Set Value", button, (GUILayoutOption[])(object)new GUILayoutOption[0]))
{
modConfig.Save();
modConfig.SaveOnConfigSet = true;
}
GUILayout.FlexibleSpace();
GUILayout.EndHorizontal();
}
private void MakeFilePickerSettingGUI(ConfigFile modConfig, ConfigDefinition setting)
{
string text = (string)modConfig[setting].BoxedValue;
string text2 = UppercaseFirst(Regex.Replace(setting.Key, "([a-z])([A-Z])", "$1 $2"));
GUILayout.BeginHorizontal((GUILayoutOption[])(object)new GUILayoutOption[0]);
GUILayout.FlexibleSpace();
GUILayout.Label(text2 + ": ", ModMenuStyle.labStyle, (GUILayoutOption[])(object)new GUILayoutOption[0]);
GUILayout.Space(30f);
string text3 = GUILayout.TextField(text, 256, ModMenuStyle._textFieldStyle, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.MinWidth(120f) });
GUIStyle button = ModMenuStyle.button;
if ((string)modConfig[setting].BoxedValue != text3)
{
button.fontStyle = (FontStyle)1;
modConfig.SaveOnConfigSet = false;
modConfig[setting].BoxedValue = text3;
}
bool flag = GUILayout.Button("Set Value", button, (GUILayoutOption[])(object)new GUILayoutOption[0]);
bool flag2 = GUILayout.Button("Browse Files", ModMenuStyle.button, (GUILayoutOption[])(object)new GUILayoutOption[0]);
GUILayout.FlexibleSpace();
GUILayout.EndHorizontal();
if (flag)
{
modConfig.Save();
modConfig.SaveOnConfigSet = true;
}
else if (flag2)
{
object[] tags = modConfig[setting].Description.Tags;
if (tags.Contains("modmenu_directorypicker"))
{
StandaloneFileBrowser.OpenFolderPanelAsync("Select Folder for: " + modConfig[setting].Definition.Key, text, false, FileSelectionCallback(modConfig[setting]));
}
else if (tags.Contains("modmenu_filepicker"))
{
StandaloneFileBrowser.OpenFilePanelAsync("Select File for: " + modConfig[setting].Definition.Key, text, "*", false, FileSelectionCallback(modConfig[setting]));
}
}
}
private Action<string[]> FileSelectionCallback(ConfigEntryBase setting)
{
return delegate(string[] results)
{
if (results.Length != 0 && results[0].Length > 0)
{
((BaseUnityPlugin)this).Logger.LogDebug((object)("Got directory: '" + results[0] + "'."));
setting.BoxedValue = results[0];
}
else
{
((BaseUnityPlugin)this).Logger.LogInfo((object)"File selection was cancelled.");
}
};
}
private void OpenTextWindow(int wId)
{
//IL_0017: Unknown result type (might be due to invalid IL or missing references)
//IL_0024: 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)
GUILayout.Space(30f);
GUILayout.BeginVertical((GUILayoutOption[])(object)new GUILayoutOption[0]);
optionsTextpos = GUILayout.BeginScrollView(optionsTextpos, false, true, (GUILayoutOption[])(object)new GUILayoutOption[0]);
ConfigFile config = currentOpenMod.Instance.Config;
if (registeredMods.ContainsKey(currentOpenMod.Instance.Info) && registeredMods[currentOpenMod.Instance.Info] != null)
{
foreach (string item in registeredMods[currentOpenMod.Instance.Info])
{
GUILayout.BeginHorizontal((GUILayoutOption[])(object)new GUILayoutOption[0]);
GUILayout.Label(item, ModMenuStyle.readStyle, (GUILayoutOption[])(object)new GUILayoutOption[0]);
GUILayout.EndHorizontal();
}
}
GUILayout.EndScrollView();
GUILayout.EndVertical();
}
private static string UppercaseFirst(string s)
{
if (string.IsNullOrEmpty(s))
{
return string.Empty;
}
return char.ToUpper(s[0]) + s.Substring(1);
}
}
public static class PluginInfos
{
public const string PLUGIN_NAME = "ModMenu";
public const string PLUGIN_ID = "no.mrgentle.plugins.llb.modmenu";
public const string PLUGIN_VERSION = "1.3.2";
}