using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using BepInEx;
using Microsoft.CodeAnalysis;
using Photon.Pun;
using UnityEngine;
using UnityEngine.SceneManagement;
[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: TargetFramework(".NETFramework,Version=v4.7.1", FrameworkDisplayName = ".NET Framework 4.7.1")]
[assembly: AssemblyCompany("CWTM")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyDescription("Mod Menu for CW")]
[assembly: AssemblyFileVersion("0.1.0.0")]
[assembly: AssemblyInformationalVersion("0.1.0")]
[assembly: AssemblyProduct("CWTM")]
[assembly: AssemblyTitle("CWTM")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("0.1.0.0")]
[module: UnverifiableCode]
[module: RefSafetyRules(11)]
namespace Microsoft.CodeAnalysis
{
[CompilerGenerated]
[Microsoft.CodeAnalysis.Embedded]
internal sealed class EmbeddedAttribute : Attribute
{
}
}
namespace System.Runtime.CompilerServices
{
[CompilerGenerated]
[Microsoft.CodeAnalysis.Embedded]
[AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)]
internal sealed class RefSafetyRulesAttribute : Attribute
{
public readonly int Version;
public RefSafetyRulesAttribute(int P_0)
{
Version = P_0;
}
}
}
namespace CWTM
{
[BepInPlugin("org.bepinex.plugins.cwtm", "Content Warning Mod Menu", "1.0.0.0")]
public class Plugin : BaseUnityPlugin
{
public const string PluginGUID = "org.bepinex.tatzy.cwtm";
public const string PluginName = "Content Warning Mod Menu";
public const string PluginVersion = "0.0.1.9";
private int itemsPerPage = 5;
private int currentPage = 0;
private bool menuVisible = false;
private int selectedIndex = 0;
private string currentMenu = "main";
private List<string> mainMenuItems = new List<string> { "Player Options", "Monster Options", "Settings", "Exit" };
private List<string> monsterMenuItems = new List<string>
{
"BigSlap", "Bombs", "BarnacleBall", "Dog", "Ear", "EyeGuy", "Flicker", "Ghost", "Knifo", "Jello",
"Larva", "Mouthe", "Slurper", "Snatcho", "Spider", "Weeping", "Zombe", "Toolkit_Fan", "Toolkit_Hammer", "Toolkit_Iron",
"Toolkit_Vaccuum", "Toolkit_Wisk"
};
private Rect windowRect = new Rect(100f, 100f, 400f, 300f);
private GUIStyle textFieldStyle;
private GUIStyle buttonStyle;
private GUIStyle labelStyle;
private GUIStyle windowStyle;
private bool stylesInitialized = false;
private void Awake()
{
((BaseUnityPlugin)this).Logger.LogInfo((object)"Mod org.bepinex.tatzy.cwtm is loaded!");
SceneManager.sceneLoaded += OnSceneLoaded;
}
private void OnDestroy()
{
SceneManager.sceneLoaded -= OnSceneLoaded;
}
private void OnSceneLoaded(Scene scene, LoadSceneMode mode)
{
menuVisible = false;
}
private void Update()
{
if (Input.GetKeyDown((KeyCode)286) && PhotonNetwork.IsMasterClient)
{
menuVisible = !menuVisible;
ManageCursorVisibility(menuVisible);
}
if (menuVisible)
{
HandleKeyboardInput();
}
}
private void ManageCursorVisibility(bool isVisible)
{
Cursor.visible = isVisible;
Cursor.lockState = (CursorLockMode)((!isVisible) ? 1 : 0);
}
private void HandleKeyboardInput()
{
List<string> list = ((currentMenu == "main") ? mainMenuItems : monsterMenuItems);
int num = (int)Math.Ceiling((float)list.Count / (float)itemsPerPage);
if (Input.GetKeyDown((KeyCode)274))
{
selectedIndex = (selectedIndex + 1) % itemsPerPage + currentPage * itemsPerPage;
if (selectedIndex >= list.Count)
{
selectedIndex = list.Count - 1;
}
}
else if (Input.GetKeyDown((KeyCode)273))
{
selectedIndex = ((selectedIndex - 1 < currentPage * itemsPerPage) ? ((currentPage + 1) * itemsPerPage - 1) : (selectedIndex - 1));
}
else if (Input.GetKeyDown((KeyCode)276))
{
currentPage = Math.Max(0, currentPage - 1);
selectedIndex = currentPage * itemsPerPage;
}
else if (Input.GetKeyDown((KeyCode)275))
{
currentPage = Math.Min(num - 1, currentPage + 1);
selectedIndex = currentPage * itemsPerPage;
}
else if (Input.GetKeyDown((KeyCode)8) && currentMenu == "monsters")
{
currentMenu = "main";
selectedIndex = 0;
currentPage = 0;
}
else if (Input.GetKeyDown((KeyCode)27) && currentMenu == "monsters")
{
currentMenu = "main";
selectedIndex = 0;
currentPage = 0;
}
else if (Input.GetKeyDown((KeyCode)13) || Input.GetKeyDown((KeyCode)271))
{
ExecuteMenuItem(list[selectedIndex]);
}
}
private void ExecuteMenuItem(string menuItem)
{
if (currentMenu == "main")
{
switch (menuItem)
{
case "Player Options":
((BaseUnityPlugin)this).Logger.LogInfo((object)"Navigating to Player Options");
break;
case "Monster Options":
currentMenu = "monsters";
selectedIndex = 0;
break;
case "Settings":
((BaseUnityPlugin)this).Logger.LogInfo((object)"Navigating to Settings");
break;
case "Exit":
menuVisible = false;
((BaseUnityPlugin)this).Logger.LogInfo((object)"Exiting Menu");
break;
}
}
else
{
SpawnMonsterUsingReflection(menuItem);
((BaseUnityPlugin)this).Logger.LogInfo((object)("Spawning " + menuItem));
}
}
private void OnGUI()
{
//IL_002c: Unknown result type (might be due to invalid IL or missing references)
//IL_0038: Unknown result type (might be due to invalid IL or missing references)
//IL_0052: Expected O, but got Unknown
//IL_004d: 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)
if (menuVisible)
{
if (!stylesInitialized)
{
InitializeGUIStyles();
stylesInitialized = true;
}
windowRect = GUILayout.Window(0, windowRect, new WindowFunction(DrawModMenu), "tModMenu", windowStyle, Array.Empty<GUILayoutOption>());
}
}
private void InitializeGUIStyles()
{
//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_001a: Unknown result type (might be due to invalid IL or missing references)
//IL_0024: Expected O, but got Unknown
//IL_0025: 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_005f: Expected O, but got Unknown
//IL_006a: 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_0078: 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_0086: Unknown result type (might be due to invalid IL or missing references)
//IL_0091: Unknown result type (might be due to invalid IL or missing references)
//IL_0096: Unknown result type (might be due to invalid IL or missing references)
//IL_00a0: Expected O, but got Unknown
//IL_00a1: 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_00b4: Expected O, but got Unknown
//IL_00ba: Expected O, but got Unknown
//IL_00c5: 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_00d3: 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_00e1: Unknown result type (might be due to invalid IL or missing references)
//IL_00ec: Unknown result type (might be due to invalid IL or missing references)
//IL_0109: Unknown result type (might be due to invalid IL or missing references)
//IL_0119: Unknown result type (might be due to invalid IL or missing references)
//IL_011f: Unknown result type (might be due to invalid IL or missing references)
//IL_012a: Unknown result type (might be due to invalid IL or missing references)
//IL_0147: Unknown result type (might be due to invalid IL or missing references)
//IL_0157: 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_0166: Expected O, but got Unknown
//IL_0167: Unknown result type (might be due to invalid IL or missing references)
//IL_0170: Unknown result type (might be due to invalid IL or missing references)
//IL_017a: Expected O, but got Unknown
//IL_0180: Expected O, but got Unknown
//IL_018b: Unknown result type (might be due to invalid IL or missing references)
//IL_0190: 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_01a1: Unknown result type (might be due to invalid IL or missing references)
//IL_01a9: Unknown result type (might be due to invalid IL or missing references)
//IL_01af: Unknown result type (might be due to invalid IL or missing references)
//IL_01ba: Unknown result type (might be due to invalid IL or missing references)
//IL_01bf: Unknown result type (might be due to invalid IL or missing references)
//IL_01c9: Expected O, but got Unknown
//IL_01ca: Unknown result type (might be due to invalid IL or missing references)
//IL_01d3: Unknown result type (might be due to invalid IL or missing references)
//IL_01dd: Expected O, but got Unknown
//IL_01e3: Expected O, but got Unknown
GUIStyle val = new GUIStyle(GUI.skin.window)
{
padding = new RectOffset(10, 10, 25, 10)
};
val.normal.background = MakeTex(600, 400, new Color(0.15f, 0.15f, 0.15f, 0.85f));
windowStyle = val;
GUIStyle val2 = new GUIStyle(GUI.skin.textField)
{
fontSize = 14,
alignment = (TextAnchor)3
};
val2.normal.textColor = Color.white;
val2.margin = new RectOffset(5, 5, 5, 5);
val2.padding = new RectOffset(10, 10, 10, 10);
textFieldStyle = val2;
GUIStyle val3 = new GUIStyle(GUI.skin.button)
{
fontSize = 14,
fontStyle = (FontStyle)1
};
val3.normal.textColor = Color.white;
val3.normal.background = MakeTex(1, 1, new Color(0.25f, 0.25f, 0.25f, 0.85f));
val3.hover.textColor = Color.cyan;
val3.hover.background = MakeTex(1, 1, new Color(0.35f, 0.35f, 0.35f, 0.85f));
val3.margin = new RectOffset(5, 5, 5, 5);
val3.padding = new RectOffset(10, 10, 10, 10);
buttonStyle = val3;
GUIStyle val4 = new GUIStyle(GUI.skin.label)
{
fontSize = 14,
fontStyle = (FontStyle)1,
alignment = (TextAnchor)3
};
val4.normal.textColor = Color.white;
val4.margin = new RectOffset(5, 5, 5, 5);
val4.padding = new RectOffset(10, 10, 10, 10);
labelStyle = val4;
}
private Texture2D MakeTex(int width, int height, Color col)
{
//IL_0011: 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_0028: Unknown result type (might be due to invalid IL or missing references)
//IL_002e: Expected O, but got Unknown
Color[] array = (Color[])(object)new Color[width * height];
for (int i = 0; i < array.Length; i++)
{
array[i] = col;
}
Texture2D val = new Texture2D(width, height);
val.SetPixels(array);
val.Apply();
return val;
}
private void DrawModMenu(int windowID)
{
//IL_00e7: Unknown result type (might be due to invalid IL or missing references)
if (!stylesInitialized)
{
InitializeGUIStyles();
stylesInitialized = true;
}
GUILayout.BeginVertical(Array.Empty<GUILayoutOption>());
List<string> list = ((currentMenu == "main") ? mainMenuItems : monsterMenuItems);
int num = currentPage * itemsPerPage;
int num2 = Math.Min(num + itemsPerPage, list.Count);
for (int i = num; i < num2; i++)
{
string text = list[i];
GUIStyle val = ((selectedIndex == i) ? buttonStyle : labelStyle);
if (GUILayout.Button(text, val, Array.Empty<GUILayoutOption>()))
{
ExecuteMenuItem(text);
}
}
GUILayout.EndVertical();
GUI.DragWindow(new Rect(0f, 0f, ((Rect)(ref windowRect)).width, 20f));
}
private void SpawnMonsterUsingReflection(string monsterName)
{
Type type = Type.GetType("MonsterSpawner, Assembly-CSharp");
if (type != null)
{
MethodInfo method = type.GetMethod("SpawnMonster", new Type[1] { typeof(string) });
if (method != null)
{
method.Invoke(null, new object[1] { monsterName });
((BaseUnityPlugin)this).Logger.LogInfo((object)("Monster " + monsterName + " spawned successfully!"));
}
else
{
((BaseUnityPlugin)this).Logger.LogError((object)"SpawnMonster method not found!");
}
}
else
{
((BaseUnityPlugin)this).Logger.LogError((object)"MonsterSpawner type not found!");
}
}
}
public static class MyPluginInfo
{
public const string PLUGIN_GUID = "CWTM";
public const string PLUGIN_NAME = "CWTM";
public const string PLUGIN_VERSION = "0.1.0";
}
}