using System; using System.Collections.Generic; using System.Diagnostics; using System.IO; using System.Linq; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using GorillaLibrary.Attributes; using GorillaLibrary.Utilities; using GorillaLocomotion; using MelonLoader; using Microsoft.CodeAnalysis; using Monke_Mod_Panel; using Monke_Mod_Panel.Attributes; using NAudio.Wave; using TMPro; using UnityEngine; using UnityEngine.UI; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)] [assembly: MelonInfo(typeof(Core), "Monke Mod Panel", "1.0.5", "Estatic & biotest05", null)] [assembly: MelonGame("Another Axiom", "Gorilla Tag")] [assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")] [assembly: AssemblyCompany("WristMenu")] [assembly: AssemblyConfiguration("Debug")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyInformationalVersion("1.0.0+8025ed41e5c504147da0e8066a9e0c66a508fc81")] [assembly: AssemblyProduct("WristMenu")] [assembly: AssemblyTitle("WristMenu")] [assembly: AssemblyVersion("1.0.0.0")] [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 ModTemplate { [Toggleable] public class UPNDN : Mod { public override string Name => "Up & Down (L & R)"; public override void OnUpdate() { //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_004c: Unknown result type (might be due to invalid IL or missing references) //IL_0056: 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_006a: Unknown result type (might be due to invalid IL or missing references) //IL_00a3: 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_00c1: 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_00da: Unknown result type (might be due to invalid IL or missing references) //IL_00df: Unknown result type (might be due to invalid IL or missing references) if ((double)((ControllerInputPoller)ControllerInputPoller.instance).rightControllerIndexFloat > 0.5) { Rigidbody attachedRigidbody = ((Collider)GTPlayer.Instance.bodyCollider).attachedRigidbody; attachedRigidbody.velocity += ((Component)GTPlayer.Instance.bodyCollider).transform.up * 25f * Time.deltaTime * GTPlayer.Instance.scale; } if ((double)((ControllerInputPoller)ControllerInputPoller.instance).leftControllerIndexFloat > 0.5) { Rigidbody attachedRigidbody2 = ((Collider)GTPlayer.Instance.bodyCollider).attachedRigidbody; attachedRigidbody2.velocity += ((Component)GTPlayer.Instance.bodyCollider).transform.up * -25f * Time.deltaTime * GTPlayer.Instance.scale; } } } } namespace Monke_Mod_Panel { public class AudioUtil { private static Dictionary clipCache = new Dictionary(); public static AudioClip GetClip(string resourcePath) { if (clipCache.TryGetValue(resourcePath, out var value)) { return value; } Assembly executingAssembly = Assembly.GetExecutingAssembly(); using Stream stream = executingAssembly.GetManifestResourceStream(resourcePath); if (stream == null) { MelonLogger.Error("Audio resource not found: " + resourcePath); return null; } AudioClip val = LoadWav(stream, Path.GetFileNameWithoutExtension(resourcePath)); if ((Object)(object)val != (Object)null) { clipCache[resourcePath] = val; } return val; } public static void PlayClip(string resourcePath, Vector3 position) { //IL_0016: Unknown result type (might be due to invalid IL or missing references) AudioClip clip = GetClip(resourcePath); if (!((Object)(object)clip == (Object)null)) { AudioSource.PlayClipAtPoint(clip, position, 0.5f); } } private static AudioClip LoadWav(Stream stream, string clipName) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0008: Expected O, but got Unknown WaveFileReader val = new WaveFileReader(stream); try { int channels = ((WaveStream)val).WaveFormat.Channels; int sampleRate = ((WaveStream)val).WaveFormat.SampleRate; int num = (int)val.SampleCount; float[] array = new float[num * channels]; int num2 = 0; float[] array2 = new float[((WaveStream)val).WaveFormat.Channels]; ISampleProvider val2 = WaveExtensionMethods.ToSampleProvider((IWaveProvider)(object)val); int num3; while ((num3 = val2.Read(array2, 0, array2.Length)) > 0) { for (int i = 0; i < num3; i++) { array[num2++] = array2[i]; } } AudioClip val3 = AudioClip.Create(clipName, num, channels, sampleRate, false); val3.SetData(array, 0); return val3; } finally { ((IDisposable)val)?.Dispose(); } } } [ModdedGamemode] public class Core : MelonMod { public static Core Instance; public static List Mods = new List(); public GameObject ButtonPresser; private List btnObj = new List(); private GameObject menu; private Vector3 targetScale; private Vector3 closedScale = Vector3.zero; private Vector3 openScale = new Vector3(0.2f, 0.3f, 0.02f); private bool menuOpen = false; private bool animating = false; private float animSpeed = 8f; private int currentPage = 0; private bool prevLeftPrimary = false; private bool prevLeftSecondary = false; private bool openRequested = false; private bool prevStickClick = false; public static bool IsSteamVR = false; public override void OnEarlyInitializeMelon() { Instance = this; } public override void OnInitializeMelon() { LoadMods(); if ((Object)(object)AudioUtil.GetClip("WristMenu.Resources.close.wav") == (Object)null) { ((MelonBase)this).LoggerInstance.Error("Could not find WritstMenu.Resources.close.wav"); } if ((Object)(object)AudioUtil.GetClip("WristMenu.Resources.open.wav") == (Object)null) { ((MelonBase)this).LoggerInstance.Error("Could not find WritstMenu.Resources.open.wav"); } foreach (Mod mod in Mods) { mod.OnInitializeMelon(); } } [ModdedGamemodeJoin] public void OnModdedJoin() { CreateMenu(); foreach (Mod mod in Mods) { mod.OnModdedJoin(); } } [ModdedGamemodeLeave] public void OnModdedLeave() { foreach (Mod mod in Mods) { if (mod.Enabled) { mod.OnDisable(); } } ObjectExtensions.Destroy((Object)(object)menu); ObjectExtensions.Destroy((Object)(object)ButtonPresser); foreach (Mod mod2 in Mods) { mod2.OnModdedLeave(); } } public override void OnUpdate() { //IL_00ae: Unknown result type (might be due to invalid IL or missing references) //IL_00b3: Unknown result type (might be due to invalid IL or missing references) //IL_00cf: Unknown result type (might be due to invalid IL or missing references) //IL_0068: 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_0096: Unknown result type (might be due to invalid IL or missing references) //IL_021d: Unknown result type (might be due to invalid IL or missing references) //IL_0223: Unknown result type (might be due to invalid IL or missing references) //IL_0256: Unknown result type (might be due to invalid IL or missing references) //IL_025c: Unknown result type (might be due to invalid IL or missing references) //IL_0279: Unknown result type (might be due to invalid IL or missing references) //IL_028f: Unknown result type (might be due to invalid IL or missing references) //IL_0295: Unknown result type (might be due to invalid IL or missing references) //IL_02b9: 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_02d2: 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_01ee: Unknown result type (might be due to invalid IL or missing references) if (!Object.op_Implicit((Object)(object)menu)) { return; } ButtonPresser.SetActive(menu.activeSelf); bool value = InputUtility.LeftStickClick.GetValue(); if (value && !prevStickClick) { if (!openRequested) { openRequested = true; targetScale = openScale; animating = true; menu.SetActive(true); AudioUtil.PlayClip("WristMenu.Resources.open.wav", menu.transform.position); } else { openRequested = false; targetScale = closedScale; animating = true; AudioUtil.PlayClip("WristMenu.Resources.close.wav", menu.transform.position); } } prevStickClick = value; if (Mods.Count > 5 && menu.activeSelf) { bool leftControllerPrimaryButton = ((ControllerInputPoller)ControllerInputPoller.instance).leftControllerPrimaryButton; bool leftControllerSecondaryButton = ((ControllerInputPoller)ControllerInputPoller.instance).leftControllerSecondaryButton; if (leftControllerPrimaryButton && !prevLeftPrimary) { currentPage--; if (currentPage < 0) { currentPage = (Mods.Count - 1) / 5; } RefreshButtons(); AudioUtil.PlayClip("WristMenu.Resources.woosj.wav", menu.transform.position); } if (leftControllerSecondaryButton && !prevLeftSecondary) { currentPage++; if (currentPage > (Mods.Count - 1) / 5) { currentPage = 0; } RefreshButtons(); AudioUtil.PlayClip("WristMenu.Resources.woosj.wav", menu.transform.position); } prevLeftPrimary = leftControllerPrimaryButton; prevLeftSecondary = leftControllerSecondaryButton; } if (animating) { animSpeed = ((targetScale == openScale) ? 8f : 16f); menu.transform.localScale = Vector3.Lerp(menu.transform.localScale, targetScale, 1f - Mathf.Exp((0f - animSpeed) * Time.deltaTime)); if (Vector3.Distance(menu.transform.localScale, targetScale) < 0.01f) { menu.transform.localScale = targetScale; animating = false; if (targetScale == closedScale) { menu.SetActive(false); } } } for (int i = 0; i < Mods.Count; i++) { if (Mods[i].Enabled) { Mods[i].OnUpdate(); } } } private void CreateMenu() { //IL_0054: 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_00ac: Unknown result type (might be due to invalid IL or missing references) //IL_00d1: 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_00fb: Expected O, but got Unknown //IL_010c: Unknown result type (might be due to invalid IL or missing references) //IL_015b: Unknown result type (might be due to invalid IL or missing references) //IL_0161: Expected O, but got Unknown //IL_019e: Unknown result type (might be due to invalid IL or missing references) //IL_01de: Unknown result type (might be due to invalid IL or missing references) //IL_01fe: Unknown result type (might be due to invalid IL or missing references) //IL_0210: 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_0229: Unknown result type (might be due to invalid IL or missing references) menu = GameObject.CreatePrimitive((PrimitiveType)3); ButtonPresser = GameObject.CreatePrimitive((PrimitiveType)0); ButtonPresser.transform.SetParent(GorillaTagger.Instance.rightHandTriggerCollider.transform, false); ButtonPresser.transform.localScale = new Vector3(0.02f, 0.02f, 0.02f); menu.transform.localScale = closedScale; menu.transform.SetParent(GorillaTagger.Instance.leftHandTransform, false); menu.transform.localRotation = Quaternion.Euler(0f, 90f, 90f); menu.transform.localPosition = new Vector3(0.05f, 0f, 0f); menu.GetComponent().material = new Material(Shader.Find("GorillaTag/UberShader")); menu.GetComponent().material.color = Color.black; ObjectExtensions.Destroy((Object)(object)menu.GetComponent()); Rigidbody val = ButtonPresser.AddComponent(); val.useGravity = false; val.isKinematic = true; ButtonPresser.GetComponent().isTrigger = true; GameObject val2 = new GameObject("Title"); val2.transform.SetParent(menu.transform, false); TextMeshPro val3 = val2.AddComponent(); ((TMP_Text)val3).text = "Monke Mod Panel"; ((TMP_Text)val3).font = Resources.Load("Fonts & Materials/LiberationSans SDF"); ((Graphic)val3).color = Color.white; ((TMP_Text)val3).fontSize = 0.7f; ((TMP_Text)val3).fontStyle = (FontStyles)0; ((TMP_Text)val3).alignment = (TextAlignmentOptions)514; val2.transform.localScale = new Vector3(1.6666666f, 1f, 16.666666f); val2.transform.localRotation = Quaternion.Euler(0f, 180f, 0f); Transform transform = val2.transform; transform.localPosition += new Vector3(0f, 0.45f, 0.85f); RefreshButtons(); menu.SetActive(false); } private void RefreshButtons() { //IL_00da: Unknown result type (might be due to invalid IL or missing references) //IL_0100: Unknown result type (might be due to invalid IL or missing references) //IL_0120: Unknown result type (might be due to invalid IL or missing references) //IL_012a: Expected O, but got Unknown //IL_0142: 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) //IL_017f: Unknown result type (might be due to invalid IL or missing references) //IL_0186: Expected O, but got Unknown //IL_01c7: Unknown result type (might be due to invalid IL or missing references) //IL_020b: Unknown result type (might be due to invalid IL or missing references) //IL_022c: Unknown result type (might be due to invalid IL or missing references) //IL_024d: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)menu == (Object)null) { return; } foreach (GameObject item in btnObj) { Object.Destroy((Object)(object)item); } btnObj.Clear(); int num = currentPage * 5; int num2 = Mathf.Min(num + 5, Mods.Count); float num3 = 0.1f; float num4 = num3 + 0.06f; float num5 = 0.35f; for (int i = num; i < num2; i++) { Mod mod = Mods[i]; GameObject val = GameObject.CreatePrimitive((PrimitiveType)3); val.transform.SetParent(menu.transform, false); val.transform.localScale = new Vector3(0.75f, num3, 0.75f); val.transform.localPosition = new Vector3(0f, num5 - (float)(i - num) * num4, 0.75f); Renderer component = val.GetComponent(); component.material = new Material(Shader.Find("GorillaTag/UberShader")); component.material.color = (mod.Enabled ? Color.green : Color.red); BoxCollider component2 = val.GetComponent(); ((Collider)component2).isTrigger = true; ModButtonTrigger modButtonTrigger = val.AddComponent(); modButtonTrigger.Mod = mod; modButtonTrigger.Renderer = component; GameObject val2 = new GameObject("Text"); val2.transform.SetParent(val.transform, false); TextMeshPro val3 = val2.AddComponent(); ((TMP_Text)val3).text = mod.Name; ((TMP_Text)val3).font = Resources.Load("Fonts & Materials/LiberationSans SDF"); ((Graphic)val3).color = Color.black; ((TMP_Text)val3).fontSize = 0.35f; ((TMP_Text)val3).fontStyle = (FontStyles)0; ((TMP_Text)val3).alignment = (TextAlignmentOptions)514; val2.transform.localScale = new Vector3(3f, 16f, 150f); val2.transform.localRotation = Quaternion.Euler(0f, 180f, 0f); val2.transform.localPosition = new Vector3(0f, 0f, 0.76f); btnObj.Add(val); } } private void LoadMods() { ((MelonBase)this).LoggerInstance.Msg("Loading mods..."); IEnumerable enumerable = MelonTypeBase.RegisteredMelons.Select((MelonMod x) => ((MelonBase)x).MelonAssembly.Assembly); foreach (Assembly item in enumerable) { try { Type[] types = item.GetTypes(); foreach (Type type in types) { if (!type.IsAbstract && typeof(Mod).IsAssignableFrom(type)) { Mod mod = (Mod)Activator.CreateInstance(type); mod.Toggleable = type.GetCustomAttributes(typeof(ToggleableAttribute), inherit: true).Length != 0; Mods.Add(mod); ((MelonBase)this).LoggerInstance.Msg("Loaded mod: " + mod.Name); } } } catch (Exception arg) { ((MelonBase)this).LoggerInstance.Warning($"Failed scanning {item.FullName}\n{arg}"); } } ((MelonBase)this).LoggerInstance.Msg($"Loaded {Mods.Count} mods."); } } public abstract class Mod { public abstract string Name { get; } public bool Toggleable { get; set; } public bool Enabled { get; private set; } public virtual void OnEnable() { } public virtual void OnUpdate() { } public virtual void OnDisable() { } public virtual void OnModdedLeave() { } public virtual void OnModdedJoin() { } public virtual void OnInitializeMelon() { } public virtual void OnClicked() { if (Toggleable) { Enabled = !Enabled; if (Enabled) { OnEnable(); } else { OnDisable(); } } } } public class ModButtonTrigger : MonoBehaviour { public Mod Mod; public Renderer Renderer; private void OnTriggerEnter(Collider other) { //IL_0026: 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_0064: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)((Component)other).gameObject == (Object)(object)Core.Instance.ButtonPresser) { AudioUtil.PlayClip("WristMenu.Resources.click.wav", ((Component)this).transform.position); Mod.OnClicked(); if (Mod.Toggleable) { Renderer.material.color = (Mod.Enabled ? Color.green : Color.red); } } } } } namespace Monke_Mod_Panel.Mods { [Toggleable] public class Platforms : Mod { private GameObject lPlatform; private GameObject rPlatform; public override string Name => "Platforms"; public override void OnUpdate() { //IL_007b: Unknown result type (might be due to invalid IL or missing references) //IL_00a4: Unknown result type (might be due to invalid IL or missing references) //IL_00c0: Unknown result type (might be due to invalid IL or missing references) //IL_00ca: Expected O, but got Unknown //IL_0155: Unknown result type (might be due to invalid IL or missing references) //IL_017e: Unknown result type (might be due to invalid IL or missing references) //IL_019a: Unknown result type (might be due to invalid IL or missing references) //IL_01a4: Expected O, but got Unknown Vector3 localScale = default(Vector3); ((Vector3)(ref localScale))..ctor(0.02f, 0.2f, 0.2f); Transform leftHandTransform = GorillaTagger.Instance.leftHandTransform; Transform rightHandTransform = GorillaTagger.Instance.rightHandTransform; if (((ControllerInputPoller)ControllerInputPoller.instance).leftGrab && !Object.op_Implicit((Object)(object)lPlatform)) { lPlatform = GameObject.CreatePrimitive((PrimitiveType)3); lPlatform.transform.SetParent(leftHandTransform, false); lPlatform.transform.localRotation = Quaternion.identity; lPlatform.transform.SetParent((Transform)null, true); lPlatform.transform.localScale = localScale; lPlatform.GetComponent().material = new Material(Shader.Find("GorillaTag/UberShader")); } else if (!((ControllerInputPoller)ControllerInputPoller.instance).leftGrab && Object.op_Implicit((Object)(object)lPlatform)) { Object.Destroy((Object)(object)lPlatform); lPlatform = null; } if (((ControllerInputPoller)ControllerInputPoller.instance).rightGrab && !Object.op_Implicit((Object)(object)rPlatform)) { rPlatform = GameObject.CreatePrimitive((PrimitiveType)3); rPlatform.transform.SetParent(rightHandTransform, false); rPlatform.transform.localRotation = Quaternion.identity; rPlatform.transform.SetParent((Transform)null, true); rPlatform.transform.localScale = localScale; rPlatform.GetComponent().material = new Material(Shader.Find("GorillaTag/UberShader")); } else if (!((ControllerInputPoller)ControllerInputPoller.instance).rightGrab && Object.op_Implicit((Object)(object)rPlatform)) { Object.Destroy((Object)(object)rPlatform); rPlatform = null; } } public override void OnDisable() { if (Object.op_Implicit((Object)(object)lPlatform)) { ObjectExtensions.Destroy((Object)(object)lPlatform); } if (Object.op_Implicit((Object)(object)rPlatform)) { ObjectExtensions.Destroy((Object)(object)rPlatform); } } } } namespace Monke_Mod_Panel.Attributes { [AttributeUsage(AttributeTargets.Class)] public class ToggleableAttribute : Attribute { } }