using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.Versioning;
using MelonLoader;
using RUMBLE.Managers;
using RumbleModdingFramework;
using RumbleModdingFramework.AssetLoading;
using RumbleModdingFramework.Assetloading;
using TMPro;
using UnhollowerBaseLib;
using UnhollowerBaseLib.Attributes;
using UnhollowerRuntimeLib;
using UnityEngine;
using UnityEngine.InputSystem;
[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: MelonInfo(typeof(RMFMain), "RumbleModdingFramework", "1.1.0", "Hazzy", null)]
[assembly: AssemblyTitle("RumbleModdingFramework")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("RumbleModdingFramework")]
[assembly: AssemblyCopyright("Copyright © 2023")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("A54BEB42-9D4C-420F-9109-2C7FB3B509E5")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: TargetFramework(".NETFramework,Version=v4.7.2", FrameworkDisplayName = ".NET Framework 4.7.2")]
[assembly: AssemblyVersion("1.0.0.0")]
namespace RumbleModdingFramework
{
[RegisterTypeInIl2Cpp]
public class MenuBehavior : MonoBehaviour
{
public GameObject button;
public int pageIndex = 0;
private float scale = 0.5f;
private List<GameObject> activeButtons = new List<GameObject>();
private List<GameObject> totalButtons = new List<GameObject>();
public bool isShowingCustomPage = false;
private List<GameObject> temporaryButtons = new List<GameObject>();
private List<GameObject> allTemporaryButtons = new List<GameObject>();
public float lastSelect;
public MenuBehavior(IntPtr intPtr)
: base(intPtr)
{
}
public void IncreasePage()
{
pageIndex++;
if (!isShowingCustomPage)
{
if ((double)pageIndex > Math.Ceiling((double)totalButtons.Count / 4.0) - 1.0)
{
pageIndex--;
}
}
else if ((double)pageIndex > Math.Ceiling((double)allTemporaryButtons.Count / 4.0) - 1.0)
{
pageIndex--;
}
ShowPage();
}
public void DecreasePage()
{
pageIndex--;
if (!isShowingCustomPage)
{
if (pageIndex < 0)
{
pageIndex++;
}
}
else if (pageIndex < 0)
{
DestroyTempPage();
isShowingCustomPage = false;
}
ShowPage();
}
private void FixRotationTemp()
{
//IL_001b: Unknown result type (might be due to invalid IL or missing references)
((Component)this).gameObject.transform.rotation = Quaternion.Euler(0f, 0f, 0f);
}
private void FixScaleGrow()
{
//IL_001a: Unknown result type (might be due to invalid IL or missing references)
AssetLoader.menu.transform.localScale = new Vector3(1f, 1f, 1f);
}
private void FixScaleShrink()
{
//IL_001d: Unknown result type (might be due to invalid IL or missing references)
AssetLoader.menu.transform.localScale = new Vector3(scale, scale, scale);
}
public void ShowButtonList(List<GameObject> buttons)
{
if (isShowingCustomPage)
{
DestroyTempPage();
}
isShowingCustomPage = true;
pageIndex = 0;
FixRotationTemp();
foreach (GameObject activeButton in activeButtons)
{
activeButton.SetActive(false);
}
activeButtons.Clear();
allTemporaryButtons = buttons;
for (int i = 0; i < buttons.Count; i++)
{
if (activeButtons.Count == 4)
{
break;
}
GameObject item = buttons[i];
Display(item);
temporaryButtons.Add(item);
}
}
private void DestroyTempPage()
{
foreach (GameObject temporaryButton in temporaryButtons)
{
if (activeButtons.Contains(temporaryButton))
{
activeButtons.Remove(temporaryButton);
}
Object.Destroy((Object)(object)temporaryButton);
}
temporaryButtons.Clear();
}
public void ShowPage()
{
FixRotationTemp();
foreach (GameObject activeButton in activeButtons)
{
activeButton.SetActive(false);
}
activeButtons.Clear();
if (!isShowingCustomPage)
{
for (int i = 0; i < totalButtons.Count; i++)
{
if (i >= pageIndex * 4)
{
if (activeButtons.Count == 4)
{
break;
}
GameObject val = totalButtons[i];
Display(val);
}
}
return;
}
for (int j = 0; j < allTemporaryButtons.Count; j++)
{
if (j >= pageIndex * 4)
{
if (activeButtons.Count == 4)
{
break;
}
GameObject item = allTemporaryButtons[j];
Display(item);
temporaryButtons.Add(item);
}
}
}
public GameObject MakeButton(string label, Action buttonAction, Color color)
{
//IL_0041: Unknown result type (might be due to invalid IL or missing references)
//IL_0061: Unknown result type (might be due to invalid IL or missing references)
//IL_00ad: Unknown result type (might be due to invalid IL or missing references)
FixScaleGrow();
GameObject val = Object.Instantiate<GameObject>(button);
val.transform.parent = ((Component)this).gameObject.transform.parent;
val.transform.position = ((Component)this).gameObject.transform.position;
val.transform.rotation = Quaternion.Euler(0f, 0f, 0f);
ButtonScript component = val.GetComponent<ButtonScript>();
component.SetAction(buttonAction);
((Component)val.transform.Find("Text (TMP)")).GetComponent<TMP_Text>().SetText(label, true);
((Component)val.transform.Find("Text (TMP)")).GetComponent<TMP_Text>().color = color;
val.gameObject.SetActive(false);
FixScaleShrink();
return val;
}
public void AddButton(string label, Action buttonAction, Color color)
{
//IL_0004: Unknown result type (might be due to invalid IL or missing references)
GameObject item = MakeButton(label, buttonAction, color);
totalButtons.Add(item);
}
private void Display(GameObject button)
{
//IL_0052: Unknown result type (might be due to invalid IL or missing references)
button.gameObject.SetActive(true);
button.gameObject.transform.parent = ((Component)this).gameObject.transform;
button.transform.localPosition = new Vector3(0f, 0.333f - (float)activeButtons.Count * 0.2f, 0f);
activeButtons.Add(button);
}
}
[RegisterTypeInIl2Cpp]
public class ButtonScript : MonoBehaviour
{
private Action buttonAction = null;
public ButtonScript(IntPtr intPtr)
: base(intPtr)
{
}
public void SetAction(Action action)
{
((Component)this).gameObject.layer = 30;
buttonAction = action;
}
public void OnTriggerEnter(Collider other)
{
MenuBehavior componentInParent = ((Component)this).GetComponentInParent<MenuBehavior>();
if (Time.unscaledTime - componentInParent.lastSelect >= 0.5f && ((Object)other).name.ToLower().Contains("playercollider"))
{
((Component)((Component)this).transform.root).GetComponent<AudioSource>().Play();
MelonCoroutines.Start(GrayifyButton(((Component)this).gameObject));
buttonAction();
componentInParent.lastSelect = Time.unscaledTime;
}
}
public static IEnumerator GrayifyButton(GameObject gameObject)
{
MeshRenderer renderer = gameObject.GetComponent<MeshRenderer>();
Material material = ((Renderer)renderer).material;
Color originalColor = material.color;
material.color = Color.gray;
yield return (object)new WaitForSecondsRealtime(0.2f);
if ((Object)(object)gameObject != (Object)null)
{
if (!gameObject.activeInHierarchy)
{
gameObject.SetActive(true);
((Renderer)renderer).material.color = originalColor;
gameObject.SetActive(false);
}
else
{
((Renderer)renderer).material.color = originalColor;
}
}
}
}
[RegisterTypeInIl2Cpp]
public class ChangePageButton : MonoBehaviour
{
public bool isAdd;
public ChangePageButton(IntPtr intPtr)
: base(intPtr)
{
}
private void Start()
{
((Component)this).gameObject.layer = 30;
if (((Object)((Component)this).gameObject).name.Equals("PrevPageButton"))
{
isAdd = false;
}
else
{
isAdd = true;
}
}
private void Update()
{
}
public void OnTriggerEnter(Collider other)
{
MenuBehavior componentInParent = ((Component)this).GetComponentInParent<MenuBehavior>();
if (Time.unscaledTime - componentInParent.lastSelect >= 0.5f && ((Object)other).name.ToLower().Contains("playercollider"))
{
if (isAdd)
{
componentInParent.IncreasePage();
}
else
{
componentInParent.DecreasePage();
}
componentInParent.lastSelect = Time.unscaledTime;
}
}
}
public class ReflectionUtil
{
public static void InvokeMethod(object obj, string methodName, object[] parameters)
{
Type type = obj.GetType();
MethodInfo method = type.GetMethod(methodName, BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic);
method.Invoke(obj, parameters);
}
public static void InvokeMethod(object obj, Type forceType, string methodName, object[] parameters)
{
MethodInfo method = forceType.GetMethod(methodName, BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic);
method.Invoke(obj, parameters);
}
public static T InvokeStaticMethod<T>(Type forceType, string methodName, object[] parameters)
{
MethodInfo method = forceType.GetMethod(methodName, BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic);
return (T)method.Invoke(null, parameters);
}
public static void SetPropertyValue(object obj, string propertyName, object value)
{
Type type = obj.GetType();
PropertyInfo property = type.GetProperty(propertyName, BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic);
property.SetValue(obj, value);
}
public static T GetPropertyValue<T>(object obj, string propertyName)
{
Type type = obj.GetType();
PropertyInfo property = type.GetProperty(propertyName, BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic);
return (T)property.GetValue(obj);
}
public static object GetPropertyValueGen(object obj, string propertyName)
{
Type type = obj.GetType();
PropertyInfo property = type.GetProperty(propertyName, BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic);
return property.GetValue(obj);
}
public static T InvokeMethod<T>(object obj, string methodName, object[] parameters)
{
Type type = obj.GetType();
MethodInfo method = type.GetMethod(methodName, BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic);
return (T)method.Invoke(obj, parameters);
}
public static T GetFieldValue<T>(object obj, string fieldName)
{
Type type = obj.GetType();
FieldInfo field = type.GetField(fieldName, BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic);
return (T)field.GetValue(obj);
}
public static void SetFieldValue(object obj, string fieldName, object value)
{
Type type = obj.GetType();
FieldInfo field = type.GetField(fieldName, BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic);
field.SetValue(obj, value);
}
}
public static class BuildInfo
{
public const string Name = "RMF";
public const string Author = "Hazzy";
public const string Company = null;
public const string Version = "0.0.1";
public const string DownloadLink = null;
}
public class RMFMain : MelonMod
{
public static MelonPreferences_Category RMFCat;
public static MelonPreferences_Entry<bool> ConfigRMF;
private static bool debounce = false;
private static bool initDone;
private static bool isUIactive;
private bool controllerDone;
private static InputActionMap xrmap = new InputActionMap("My XR Input Map");
private static InputAction rightPrimary = InputActionSetupExtensions.AddAction(xrmap, "Right Controller Primary Button", (InputActionType)0, (string)null, (string)null, (string)null, (string)null, (string)null);
private static InputAction rightSecondary = InputActionSetupExtensions.AddAction(xrmap, "Right Controller Secondary Button", (InputActionType)0, (string)null, (string)null, (string)null, (string)null, (string)null);
private static InputAction rightGrip = InputActionSetupExtensions.AddAction(xrmap, "Right Controller Grip Button", (InputActionType)0, (string)null, (string)null, (string)null, (string)null, (string)null);
private static InputAction rightTrigger = InputActionSetupExtensions.AddAction(xrmap, "Right Controller Trigger Button", (InputActionType)0, (string)null, (string)null, (string)null, (string)null, (string)null);
private static InputAction rightJoystick = InputActionSetupExtensions.AddAction(xrmap, "Right Controller Primary Joystick", (InputActionType)0, (string)null, (string)null, (string)null, (string)null, (string)null);
private static InputAction leftPrimary = InputActionSetupExtensions.AddAction(xrmap, "Left Controller Primary Button", (InputActionType)0, (string)null, (string)null, (string)null, (string)null, (string)null);
private static InputAction leftGrip = InputActionSetupExtensions.AddAction(xrmap, "Left Controller Grip Button", (InputActionType)0, (string)null, (string)null, (string)null, (string)null, (string)null);
private static InputAction leftJoystick = InputActionSetupExtensions.AddAction(xrmap, "Left Controller Primary Joystick", (InputActionType)0, (string)null, (string)null, (string)null, (string)null, (string)null);
private static InputAction leftSecondary = InputActionSetupExtensions.AddAction(xrmap, "Left Controller Secondary Button", (InputActionType)0, (string)null, (string)null, (string)null, (string)null, (string)null);
private static InputAction leftTrigger = InputActionSetupExtensions.AddAction(xrmap, "Left Controller Trigger Button", (InputActionType)0, (string)null, (string)null, (string)null, (string)null, (string)null);
private bool ran;
private GetPlayerRefScript refScript = null;
private string currentScene;
private Stopwatch stopwatch = new Stopwatch();
private Stopwatch stopwatch2 = new Stopwatch();
public override void OnSceneWasLoaded(int buildIndex, string sceneName)
{
currentScene = sceneName;
if (sceneName == "CustomArena0" || sceneName == "CustomArena1")
{
return;
}
if (sceneName == "Loader")
{
InputActionSetupExtensions.AddBinding(rightPrimary, "<XRController>{RightHand}/primaryButton", (string)null, (string)null, (string)null);
InputActionSetupExtensions.AddBinding(rightSecondary, "<XRController>{RightHand}/secondaryButton", (string)null, (string)null, (string)null);
InputActionSetupExtensions.AddBinding(rightGrip, "<XRController>{RightHand}/grip", (string)null, (string)null, (string)null);
InputActionSetupExtensions.AddBinding(rightTrigger, "<XRController>{RightHand}/trigger", (string)null, (string)null, (string)null);
InputActionSetupExtensions.AddBinding(rightJoystick, "<XRController>{RightHand}/primary2DAxis", (string)null, (string)null, (string)null);
InputActionSetupExtensions.AddBinding(leftPrimary, "<XRController>{LeftHand}/primaryButton", (string)null, (string)null, (string)null);
InputActionSetupExtensions.AddBinding(leftGrip, "<XRController>{LeftHand}/grip", (string)null, (string)null, (string)null);
InputActionSetupExtensions.AddBinding(leftJoystick, "<XRController>{LeftHand}/primary2DAxis", (string)null, (string)null, (string)null);
InputActionSetupExtensions.AddBinding(leftSecondary, "<XRController>{LeftHand}/secondaryButton", (string)null, (string)null, (string)null);
InputActionSetupExtensions.AddBinding(leftTrigger, "<XRController>{LeftHand}/trigger", (string)null, (string)null, (string)null);
xrmap.Enable();
MelonLogger.Msg("successfully loaded input");
AssetLoader.SpawnMenu(1);
}
initDone = false;
controllerDone = true;
if (!ran)
{
GameObject val = GameObject.Find("Game Instance/Initializable/PlayerManager");
if ((Object)(object)val == (Object)null)
{
MelonLogger.Msg("playerManagerGO is null");
}
refScript = val.AddComponent<GetPlayerRefScript>();
ran = true;
}
else
{
stopwatch = Stopwatch.StartNew();
refScript.OnSceneWasLoaded(sceneName);
}
}
public void AddRefs()
{
//IL_0125: Unknown result type (might be due to invalid IL or missing references)
//IL_0130: Unknown result type (might be due to invalid IL or missing references)
//IL_01c3: Unknown result type (might be due to invalid IL or missing references)
GameObjectRef.playerController = refScript.playerController;
GameObjectRef.playerHead = refScript.playerHead;
GameObjectRef.leftHand = refScript.leftHand;
GameObjectRef.rightHand = refScript.rightHand;
GameObjectRef.playerManager = refScript.playerManager;
if ((Object)(object)GameObjectRef.playerController != (Object)null)
{
GameObjectRef.leftHandCollider = ((Component)((Component)((Component)GameObjectRef.playerController.transform.Find("Physics")).transform.Find("LeftPhysicsController")).transform.Find("Collider")).GetComponent<Collider>();
GameObjectRef.rightHandCollider = ((Component)((Component)((Component)GameObjectRef.playerController.transform.Find("Physics")).transform.Find("RightPhysicsController")).transform.Find("Collider")).GetComponent<Collider>();
GameObject gameObject = ((Component)AssetLoader.menu.transform.Find("MenuHolder").Find("PlayerCollider")).gameObject;
gameObject.layer = 31;
Transform val = GameObjectRef.playerController.transform.Find("Visuals/RIG/Bone_Pelvis/Bone_Spine/Bone_Chest/Bone_Shoulderblade_R/Bone_Shoulder_R/Bone_Lowerarm_R/Bone_Hand_R/Bone_Pointer_A_R/Bone_Pointer_B_R/Bone_Pointer_C_R");
Object.Instantiate((Object)(object)gameObject, ((Component)val).transform.position, ((Component)val).transform.rotation, ((Component)val).transform);
VrMenu.menuObject = ((Component)AssetLoader.menu.transform.Find("MenuHolder").Find("VRMenu")).gameObject;
MenuBehavior component = VrMenu.menuObject.GetComponent<MenuBehavior>();
component.button = ((Component)AssetLoader.menu.transform.Find("MenuHolder").Find("Button")).gameObject;
VrMenu.RefreshMenu();
VrMenu.ShowPage(0);
AssetLoader.menu.transform.localScale = new Vector3(0.5f, 0.5f, 0.5f);
isUIactive = false;
initDone = true;
}
}
public override void OnUpdate()
{
//IL_026e: Unknown result type (might be due to invalid IL or missing references)
//IL_0273: Unknown result type (might be due to invalid IL or missing references)
//IL_02ff: Unknown result type (might be due to invalid IL or missing references)
//IL_0304: Unknown result type (might be due to invalid IL or missing references)
//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_00dc: Unknown result type (might be due to invalid IL or missing references)
//IL_00ed: Unknown result type (might be due to invalid IL or missing references)
//IL_00ef: 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_00fb: 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_0104: Unknown result type (might be due to invalid IL or missing references)
//IL_0108: 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_01cb: 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_01a0: Unknown result type (might be due to invalid IL or missing references)
//IL_01a5: Unknown result type (might be due to invalid IL or missing references)
if (stopwatch2.ElapsedMilliseconds >= 1000 && stopwatch2 != null)
{
stopwatch2.Stop();
stopwatch2.Reset();
AddRefs();
}
if (stopwatch.ElapsedMilliseconds >= 2000 && stopwatch != null)
{
stopwatch.Stop();
stopwatch.Reset();
refScript.OnSceneWasLoaded(currentScene);
stopwatch2 = Stopwatch.StartNew();
}
if (initDone)
{
if ((Object)(object)VrMenu.menuObject != (Object)null)
{
Vector3 position = VrMenu.menuObject.transform.position;
Vector3 position2 = GameObjectRef.playerHead.transform.position;
Transform transform = VrMenu.menuObject.transform;
Quaternion val = Quaternion.LookRotation(position - position2);
val = ((Quaternion)(ref val)).normalized;
transform.eulerAngles = new Vector3(0f, ((Quaternion)(ref val)).eulerAngles.y, 0f);
}
if (Input.RightSecButton)
{
if (!debounce)
{
debounce = true;
if (isUIactive)
{
isUIactive = false;
}
else
{
isUIactive = true;
}
}
}
else
{
debounce = false;
}
if (isUIactive)
{
VrMenu.menuObject.transform.position = GameObjectRef.leftHand.transform.position + new Vector3(0f, 0.3f, 0f);
}
else
{
VrMenu.menuObject.transform.position = new Vector3(0f, 3000f, 0f);
}
}
if (controllerDone)
{
Input.RightPrimButton = rightPrimary.ReadValue<float>() != 0f;
Input.RightSecButton = rightSecondary.ReadValue<float>() != 0f;
Input.RightGripPress = rightGrip.ReadValue<float>() >= 0.5f;
Input.RightGrip = rightGrip.ReadValue<float>();
Input.RightTrigger = rightTrigger.ReadValue<float>();
Input.RightTriggerPress = rightTrigger.ReadValue<float>() >= 0.5f;
Input.RightJoyAxis = rightJoystick.ReadValue<Vector2>();
Input.LeftPrimButton = leftPrimary.ReadValue<float>() != 0f;
Input.LeftSecButton = leftSecondary.ReadValue<float>() != 0f;
Input.LeftGripPress = leftGrip.ReadValue<float>() >= 0.5f;
Input.LeftGrip = leftGrip.ReadValue<float>();
Input.LeftTrigger = leftTrigger.ReadValue<float>();
Input.LeftTriggerPress = leftTrigger.ReadValue<float>() >= 0.5f;
Input.LeftJoyAxis = leftJoystick.ReadValue<Vector2>();
Input.LeftGripPress = leftGrip.ReadValue<float>() >= 0.5f;
}
}
}
[RegisterTypeInIl2Cpp]
public class Input : MonoBehaviour
{
public static bool LeftJoystickClick;
public static bool RightJoystickClick;
public static bool LeftPrimButton;
public static bool RightPrimButton;
public static bool LeftMenuButton;
public static bool RightMenuButton;
public static bool LeftSecButton;
public static bool RightSecButton;
public static bool LeftTrackpad;
public static bool RightTrackPad;
public static bool LeftTriggerPress;
public static bool RightTriggerPress;
public static Vector3 LeftVelocity;
public static Vector3 RightVelocity;
public static Vector2 LeftJoyAxis;
public static Vector2 RightJoyAxis;
public static float LeftTrigger;
public static float RightTrigger;
public static float LeftGrip;
public static float RightGrip;
public static bool LeftGripPress;
public static bool RightGripPress;
public Input(IntPtr intPtr)
: base(intPtr)
{
}
}
[RegisterTypeInIl2Cpp]
public class GameObjectRef : MonoBehaviour
{
public static PlayerManager playerManager;
public static GameObject playerController;
public static GameObject playerHead;
public static GameObject leftHand;
public static GameObject rightHand;
public static Collider leftHandCollider;
public static Collider rightHandCollider;
public static GameObject enemyPlayerController;
public GameObjectRef(IntPtr intPtr)
: base(intPtr)
{
}
}
[RegisterTypeInIl2Cpp]
public class GetPlayerRefScript : MonoBehaviour
{
public PlayerManager playerManager;
public GameObject playerController;
public GameObject playerHead;
public GameObject leftHand;
public GameObject rightHand;
public GameObject enemyPlayerController;
public bool refsDone = false;
public GetPlayerRefScript(IntPtr intPtr)
: base(intPtr)
{
}
public void Start()
{
playerManager = ((Component)this).gameObject.GetComponent<PlayerManager>();
}
public void OnSceneWasLoaded(string sceneName)
{
refsDone = false;
if (sceneName != "Loader")
{
MelonCoroutines.Start(GetPlayerObjs());
}
}
private IEnumerator GetPlayerObjs()
{
yield return (object)new WaitForSeconds(1f);
try
{
playerController = ((Component)playerManager.LocalPlayer.Controller).gameObject;
playerHead = ((Component)((Component)playerController.transform.Find("Physics")).transform.Find("PhysicsHeadset")).gameObject;
leftHand = ((Component)((Component)playerController.transform.Find("Physics")).transform.Find("LeftPhysicsController")).gameObject;
rightHand = ((Component)((Component)playerController.transform.Find("Physics")).transform.Find("RightPhysicsController")).gameObject;
}
catch (Exception e)
{
MelonLogger.Msg(e.ToString());
MelonCoroutines.Start(GetPlayerObjs());
}
refsDone = true;
}
}
public class VrMenu
{
public static GameObject menuObject;
public static List<VrMenuButton> registeredButtons = new List<VrMenuButton>();
public static List<VrMenuButton> previousButtons = new List<VrMenuButton>();
public static void RegisterMainButton(VrMenuButton button)
{
MelonLogger.Msg("Registered button with label: " + button.label);
registeredButtons.Add(button);
}
public static void RefreshMenu()
{
foreach (VrMenuButton registeredButton in registeredButtons)
{
if (previousButtons.Contains(registeredButton))
{
break;
}
previousButtons.Add(registeredButton);
AddMainButton(registeredButton);
}
}
public static void ShowPage(int page)
{
MenuBehavior component = menuObject.GetComponent<MenuBehavior>();
component.pageIndex = 0;
component.ShowPage();
}
private static void AddMainButton(VrMenuButton vrMenuButton)
{
//IL_001a: Unknown result type (might be due to invalid IL or missing references)
MenuBehavior component = menuObject.GetComponent<MenuBehavior>();
component.AddButton(vrMenuButton.label, vrMenuButton.buttonAction, vrMenuButton.color);
}
public static void DisplayButtonsManual(List<VrMenuButton> buttons)
{
//IL_0034: Unknown result type (might be due to invalid IL or missing references)
List<GameObject> list = new List<GameObject>();
MenuBehavior component = menuObject.GetComponent<MenuBehavior>();
foreach (VrMenuButton button in buttons)
{
list.Add(component.MakeButton(button.label, button.buttonAction, button.color));
}
component.ShowButtonList(list);
}
}
public class VrMenuButton
{
public string label;
public Action buttonAction;
public Color color;
public VrMenuButton(string label, Action buttonAction)
{
//IL_0017: Unknown result type (might be due to invalid IL or missing references)
//IL_001c: Unknown result type (might be due to invalid IL or missing references)
this.label = label;
this.buttonAction = buttonAction;
color = Color.white;
}
public VrMenuButton(string label, Action buttonAction, Color color)
{
//IL_0017: Unknown result type (might be due to invalid IL or missing references)
//IL_0018: Unknown result type (might be due to invalid IL or missing references)
this.label = label;
this.buttonAction = buttonAction;
this.color = color;
}
}
public class VrMenuPage
{
private List<VrMenuButton> buttons;
public VrMenuPage(List<VrMenuButton> vrMenuButtons)
{
buttons = new List<VrMenuButton>();
buttons = vrMenuButtons;
}
public void Open()
{
VrMenu.DisplayButtonsManual(buttons);
}
}
public class VrMenuPageBuilder
{
private List<VrMenuButton> buttons;
public VrMenuPageBuilder()
{
buttons = new List<VrMenuButton>();
}
public VrMenuPageBuilder AddButton(VrMenuButton button)
{
buttons.Add(button);
return this;
}
public static VrMenuPageBuilder Builder()
{
return new VrMenuPageBuilder();
}
public VrMenuPage Build()
{
return new VrMenuPage(buttons);
}
}
}
namespace RumbleModdingFramework.AssetLoading
{
internal class AssetLoader
{
public static GameObject menu;
public static GameObject noti;
public static GameObject spawnGun;
public static AudioClip menuSelectClip;
public static AudioClip notificationClip;
public static void SpawnMenu(int num)
{
MelonLogger.Msg("Spawning menu");
AssetBundle assetBundle = AssetBundle.LoadFromMemory(EmbeddedAssetBundle.LoadFromAssembly(Assembly.GetExecutingAssembly(), "RumbleModdingFramework.Resources.vrmenu.vm"));
if ((Object)(object)assetBundle == (Object)null)
{
MelonLogger.Msg("Failed");
return;
}
GameObject val = assetBundle.LoadAsset<GameObject>("MenuPrefab");
Transform transform = Object.Instantiate<GameObject>(val).transform;
menu = ((Component)transform).gameObject;
Object.DontDestroyOnLoad((Object)(object)menu);
assetBundle.Unload(unloadAllLoadedObjects: false);
if ((Object)(object)GameObject.Find("MenuPrefab(Clone)") == (Object)null)
{
MelonLogger.Msg("Failed");
SpawnMenu(1);
return;
}
((Component)menu.gameObject.transform.Find("MenuHolder").Find("VRMenu")).gameObject.AddComponent<MenuBehavior>();
Object.Destroy((Object)(object)((Component)menu.gameObject.transform.Find("MenuHolder").Find("VRMenu").Find("Background")).gameObject.GetComponent<BoxCollider>());
((Component)menu.gameObject.transform.Find("MenuHolder").Find("VRMenu").Find("PrevPageButton")).gameObject.AddComponent<ChangePageButton>();
((Component)menu.gameObject.transform.Find("MenuHolder").Find("VRMenu").Find("NextPageButton")).gameObject.AddComponent<ChangePageButton>();
((Component)menu.gameObject.transform.Find("MenuHolder").Find("Button")).gameObject.AddComponent<ButtonScript>();
}
}
public static class EmbeddedAssetBundle
{
public static byte[] LoadFromAssembly(Assembly assembly, string name)
{
string[] manifestResourceNames = assembly.GetManifestResourceNames();
if (manifestResourceNames.Contains(name))
{
using (Stream stream = assembly.GetManifestResourceStream(name))
{
using MemoryStream memoryStream = new MemoryStream();
stream.CopyTo(memoryStream);
return memoryStream.ToArray();
}
}
return null;
}
}
}
namespace RumbleModdingFramework.Assetloading
{
public class AssetBundle : Object
{
internal delegate IntPtr d_LoadFromFile(IntPtr path, uint crc, ulong offset);
private delegate IntPtr d_LoadFromMemory(IntPtr binary, uint crc);
public delegate IntPtr d_GetAllLoadedAssetBundles_Native();
internal delegate IntPtr d_LoadAssetWithSubAssets_Internal(IntPtr _this, IntPtr name, IntPtr type);
internal delegate IntPtr d_LoadAsset_Internal(IntPtr _this, IntPtr name, IntPtr type);
internal delegate void d_Unload(IntPtr _this, bool unloadAllLoadedObjects);
public readonly IntPtr m_bundlePtr = IntPtr.Zero;
static AssetBundle()
{
ClassInjector.RegisterTypeInIl2Cpp<AssetBundle>();
}
[HideFromIl2Cpp]
public static AssetBundle LoadFromFile(string path)
{
IntPtr intPtr = ICallManager.GetICallUnreliable<d_LoadFromFile>(new string[2] { "UnityEngine.AssetBundle::LoadFromFile_Internal", "UnityEngine.AssetBundle::LoadFromFile" })(IL2CPP.ManagedStringToIl2Cpp(path), 0u, 0uL);
return (intPtr != IntPtr.Zero) ? new AssetBundle(intPtr) : null;
}
[HideFromIl2Cpp]
public static AssetBundle LoadFromMemory(byte[] binary, uint crc = 0u)
{
IntPtr intPtr = ICallManager.GetICallUnreliable<d_LoadFromMemory>(new string[2] { "UnityEngine.AssetBundle::LoadFromMemory_Internal", "UnityEngine.AssetBundle::LoadFromMemory" })(((Il2CppObjectBase)Il2CppStructArray<byte>.op_Implicit(binary)).Pointer, crc);
return (intPtr != IntPtr.Zero) ? new AssetBundle(intPtr) : null;
}
[HideFromIl2Cpp]
public static AssetBundle[] GetAllLoadedAssetBundles()
{
IntPtr intPtr = ICallManager.GetICall<d_GetAllLoadedAssetBundles_Native>("UnityEngine.AssetBundle::GetAllLoadedAssetBundles_Native")();
return (intPtr != IntPtr.Zero) ? Il2CppArrayBase<AssetBundle>.op_Implicit((Il2CppArrayBase<AssetBundle>)(object)new Il2CppReferenceArray<AssetBundle>(intPtr)) : null;
}
public AssetBundle(IntPtr ptr)
: base(ptr)
{
m_bundlePtr = ptr;
}
[HideFromIl2Cpp]
public Object[] LoadAllAssets()
{
IntPtr intPtr = ICallManager.GetICall<d_LoadAssetWithSubAssets_Internal>("UnityEngine.AssetBundle::LoadAssetWithSubAssets_Internal")(m_bundlePtr, IL2CPP.ManagedStringToIl2Cpp(""), ((Il2CppObjectBase)Il2CppType.Of<Object>()).Pointer);
return (Object[])((intPtr != IntPtr.Zero) ? ((Array)Il2CppArrayBase<Object>.op_Implicit((Il2CppArrayBase<Object>)(object)new Il2CppReferenceArray<Object>(intPtr))) : ((Array)new Object[0]));
}
[HideFromIl2Cpp]
public T LoadAsset<T>(string name) where T : Object
{
//IL_0040: Unknown result type (might be due to invalid IL or missing references)
IntPtr intPtr = ICallManager.GetICall<d_LoadAsset_Internal>("UnityEngine.AssetBundle::LoadAsset_Internal")(m_bundlePtr, IL2CPP.ManagedStringToIl2Cpp(name), ((Il2CppObjectBase)Il2CppType.Of<T>()).Pointer);
return (intPtr != IntPtr.Zero) ? ((Il2CppObjectBase)new Object(intPtr)).TryCast<T>() : default(T);
}
[HideFromIl2Cpp]
public void Unload(bool unloadAllLoadedObjects)
{
ICallManager.GetICall<d_Unload>("UnityEngine.AssetBundle::Unload")(m_bundlePtr, unloadAllLoadedObjects);
}
}
public static class ICallManager
{
private static readonly Dictionary<string, Delegate> iCallCache = new Dictionary<string, Delegate>();
private static readonly Dictionary<string, Delegate> unreliableCache = new Dictionary<string, Delegate>();
public static T GetICall<T>(string signature) where T : Delegate
{
if (iCallCache.ContainsKey(signature))
{
return (T)iCallCache[signature];
}
IntPtr intPtr = IL2CPP.il2cpp_resolve_icall(signature);
if (intPtr == IntPtr.Zero)
{
throw new MissingMethodException("Could not find any iCall with the signature '" + signature + "'!");
}
Delegate delegateForFunctionPointer = Marshal.GetDelegateForFunctionPointer(intPtr, typeof(T));
iCallCache.Add(signature, delegateForFunctionPointer);
return (T)delegateForFunctionPointer;
}
public static T GetICallUnreliable<T>(params string[] possibleSignatures) where T : Delegate
{
string text = possibleSignatures.First();
if (unreliableCache.ContainsKey(text))
{
return (T)unreliableCache[text];
}
foreach (string text2 in possibleSignatures)
{
IntPtr intPtr = IL2CPP.il2cpp_resolve_icall(text2);
if (intPtr != IntPtr.Zero)
{
T val = (T)Marshal.GetDelegateForFunctionPointer(intPtr, typeof(T));
unreliableCache.Add(text, val);
return val;
}
}
throw new MissingMethodException("Could not find any iCall from list of provided signatures starting with '" + text + "'!");
}
}
}