using System; using System.Collections.Generic; using System.Diagnostics; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using Il2CppInterop.Runtime.InteropTypes.Arrays; using Il2CppRUMBLE.Interactions.InteractionBase; using Il2CppRUMBLE.Players; using Il2CppRUMBLE.Players.Subsystems; using Il2CppRUMBLE.Slabs.Forms; using Il2CppRUMBLE.Slabs.States; using MelonLoader; using RockUI; using RumbleModdingAPI.RMAPI; using UnityEngine; using UnityEngine.Events; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)] [assembly: MelonInfo(typeof(Main), "RockUI", "1.1.0", "SpooderCode", null)] [assembly: MelonGame(null, null)] [assembly: MelonColor(255, 0, 255, 150)] [assembly: TargetFramework(".NETCoreApp,Version=v6.0", FrameworkDisplayName = ".NET 6.0")] [assembly: AssemblyCompany("RockUI")] [assembly: AssemblyConfiguration("Debug")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyInformationalVersion("1.0.0+33388af220f75d04f443b8ca599d1c87f37c757b")] [assembly: AssemblyProduct("RockUI")] [assembly: AssemblyTitle("RockUI")] [assembly: AssemblyVersion("1.0.0.0")] namespace RockUI; public class Main : MelonMod { public class RockUI { public static GameObject SliderPrefab; public static GameObject LeverPrefab; public static Mesh panelMesh; public static Material panelMat; public static GameObject CreateFinalisedUI(UIElement element, bool followPlayer) { //IL_000a: Unknown result type (might be due to invalid IL or missing references) //IL_0010: Expected O, but got Unknown //IL_0032: Unknown result type (might be due to invalid IL or missing references) //IL_0038: Expected O, but got Unknown //IL_00ad: Unknown result type (might be due to invalid IL or missing references) //IL_00b3: Expected O, but got Unknown //IL_00d5: Unknown result type (might be due to invalid IL or missing references) //IL_00dc: Expected O, but got Unknown //IL_0100: Unknown result type (might be due to invalid IL or missing references) //IL_0107: Expected O, but got Unknown //IL_0154: Unknown result type (might be due to invalid IL or missing references) //IL_015a: Expected O, but got Unknown //IL_015c: Unknown result type (might be due to invalid IL or missing references) //IL_0162: Expected O, but got Unknown //IL_0164: Unknown result type (might be due to invalid IL or missing references) //IL_016a: Expected O, but got Unknown GameObject val; if (followPlayer) { val = new GameObject(); ((Object)val).name = "RockUIFollowOffset"; val.AddComponent().playerVR = ((Component)Players.GetLocalPlayerController()).GetComponentInChildren(); AutonomousBehaviour val2 = new AutonomousBehaviour(); val2.ControllerType = (ControllerType)1; val2.DistanceFromPlayerBody = 1f; val2.EnableRotationalControl = true; val2.EndTime = 0.4167; val2.Player = Players.GetLocalPlayer(); val2.PlayerHeightFactor = 0.75f; val2.DistanceFromPlayerBody = 0.75f; val2.PositionSmoothnessMultiplier = 3f; val2.RotationSmoothnessMultiplier = 1f; val2.autonomousTransform = val.GetComponent(); AnimationCurve val3 = new AnimationCurve(); val3.AddKey(0f, 0.3f); val3.AddKey(1f, 0.5f); AnimationCurve val4 = new AnimationCurve(); val4.AddKey(0f, 0f); val4.AddKey(1f, 1f); AnimationCurve val5 = new AnimationCurve(); val5.AddKey(0f, 0.3f); val5.AddKey(1f, 0.5f); val2.PositionSmoothness = new Il2CppReferenceArray((AnimationCurve[])(object)new AnimationCurve[3] { val3, val4, val5 }); val2.RotationSmoothness = new Il2CppReferenceArray((AnimationCurve[])(object)new AnimationCurve[3] { new AnimationCurve(), new AnimationCurve(), new AnimationCurve() }); val2.variablesDefined = true; val.GetComponent().Behaviour = val2; GameObject val6 = BuildUI(element); val6.transform.SetParent(val.transform, false); val6.transform.Rotate(0f, 180f, 0f, (Space)1); } else { val = BuildUI(element); } return val; } public static GameObject BuildUI(UIElement uiElement, GameObject UIRoot = null, GameObject ParentObj = null, UIElement ParentUI = null) { //IL_0014: Unknown result type (might be due to invalid IL or missing references) //IL_001b: Expected O, but got Unknown //IL_00b4: Unknown result type (might be due to invalid IL or missing references) //IL_00c5: Unknown result type (might be due to invalid IL or missing references) //IL_00ca: Unknown result type (might be due to invalid IL or missing references) //IL_0083: 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) //IL_0099: Unknown result type (might be due to invalid IL or missing references) //IL_00dd: Unknown result type (might be due to invalid IL or missing references) //IL_00fd: Unknown result type (might be due to invalid IL or missing references) //IL_0107: Unknown result type (might be due to invalid IL or missing references) //IL_010c: Unknown result type (might be due to invalid IL or missing references) //IL_012e: Unknown result type (might be due to invalid IL or missing references) //IL_0142: 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) GameObject val = uiElement.Create(); if ((Object)(object)UIRoot == (Object)null) { UIRoot = new GameObject(); } if ((Object)(object)ParentObj == (Object)null) { ParentObj = UIRoot; } val.transform.SetParent(UIRoot.transform, false); float num = 0.068f; if (uiElement is RockPanel) { num = 0.054f; } if (ParentUI is RockPanel) { val.transform.position = ParentObj.transform.GetChild((int)uiElement.anchor).position + new Vector3(0f, 0f, 0f - num); } else { val.transform.position = ParentObj.transform.position + new Vector3(0f, 0f, 0f - num); } Transform transform = val.transform; transform.localPosition += new Vector3(uiElement.anchorOffset.x, uiElement.anchorOffset.y, 0f) / 10f; if (uiElement is RockSlider) { Transform transform2 = val.transform; transform2.localPosition -= new Vector3(0.116f, 0f, 0f); } foreach (UIElement childElement in uiElement.childElements) { BuildUI(childElement, UIRoot, val, uiElement); } return UIRoot; } } public abstract class UIElement { public enum AnchorType { TopLeft, TopRight, BottomLeft, BottomRight, LeftMiddle, RightMiddle, TopMiddle, BottomMiddle, Center } public List childElements = new List(); public Vector2 anchorOffset = new Vector2(0f, 0f); public AnchorType anchor = AnchorType.Center; public abstract GameObject Create(); public void AddChildUI(UIElement childUI) { childElements.Add(childUI); } } public class RockPanel : UIElement { public Vector2 size = new Vector2(100f, 100f); public override GameObject Create() { //IL_004f: Unknown result type (might be due to invalid IL or missing references) //IL_0073: Unknown result type (might be due to invalid IL or missing references) //IL_0079: Expected O, but got Unknown //IL_00d6: 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_0120: Unknown result type (might be due to invalid IL or missing references) //IL_0145: Unknown result type (might be due to invalid IL or missing references) //IL_016a: Unknown result type (might be due to invalid IL or missing references) //IL_018f: Unknown result type (might be due to invalid IL or missing references) //IL_01b1: 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_01f5: Unknown result type (might be due to invalid IL or missing references) GameObject val = GameObject.CreatePrimitive((PrimitiveType)3); val.GetComponent().mesh = RockUI.panelMesh; val.layer = 10; val.transform.localScale = new Vector3(size.x / 10f, size.y / 10f, 0.12f); ((Renderer)val.GetComponent()).material = RockUI.panelMat; for (int i = 0; i < 9; i++) { GameObject val2 = new GameObject(); val2.transform.SetParent(val.transform, false); switch (i) { case 0: val2.transform.localPosition = new Vector3(-0.5f, 0.5f, 0f); break; case 1: val2.transform.localPosition = new Vector3(0.5f, 0.5f, 0f); break; case 2: val2.transform.localPosition = new Vector3(-0.5f, -0.5f, 0f); break; case 3: val2.transform.localPosition = new Vector3(0.5f, -0.5f, 0f); break; case 4: val2.transform.localPosition = new Vector3(-0.5f, 0f, 0f); break; case 5: val2.transform.localPosition = new Vector3(0.5f, 0f, 0f); break; case 6: val2.transform.localPosition = new Vector3(0f, 0.5f, 0f); break; case 7: val2.transform.localPosition = new Vector3(0f, -0.5f, 0f); break; case 8: val2.transform.localPosition = new Vector3(0f, 0f, 0f); break; } } return val; } } public class RockButton : UIElement { public Action pressAction; public override GameObject Create() { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0006: Unknown result type (might be due to invalid IL or missing references) GameObject val = Create.NewButton(Vector3.zero, Quaternion.identity, pressAction); val.transform.Rotate(90f, 180f, 0f); return val; } } public class RockText : UIElement { public string text; public int fontSize = 1; public Color fontColor = Color.black; public override GameObject Create() { //IL_000f: 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_0019: Unknown result type (might be due to invalid IL or missing references) return Create.NewText(text, (float)fontSize, fontColor, Vector3.zero, Quaternion.identity); } } public class RockSlider : UIElement { public bool useSteps = false; public int stepCount = 2; public Action valueChangedAction; public Action stepReachedAction; public override GameObject Create() { //IL_001a: Unknown result type (might be due to invalid IL or missing references) GameObject val = Object.Instantiate(RockUI.SliderPrefab); val.SetActive(true); val.transform.rotation = Quaternion.identity; val.transform.Rotate(90f, 0f, 180f); InteractionSlider component = ((Component)val.transform.Find("Slider handle")).GetComponent(); ((InteractionNumericalBase)component).useSteps = useSteps; ((InteractionNumericalBase)component).stepCount = stepCount; ((UnityEventBase)((InteractionNumericalBase)component).onNormalizedValueChanged).RemoveAllListeners(); ((UnityEventBase)((InteractionNumericalBase)component).onStepReached).RemoveAllListeners(); if (valueChangedAction != null) { ((UnityEvent)(object)((InteractionNumericalBase)component).onNormalizedValueChanged).AddListener(UnityAction.op_Implicit(valueChangedAction)); } if (stepReachedAction != null) { ((UnityEvent)(object)((InteractionNumericalBase)component).onStepReached).AddListener(UnityAction.op_Implicit(stepReachedAction)); } return val; } } public class RockLever : UIElement { public Action leverToggledAction; public override GameObject Create() { //IL_001a: Unknown result type (might be due to invalid IL or missing references) GameObject val = Object.Instantiate(RockUI.LeverPrefab); val.SetActive(true); val.transform.rotation = Quaternion.identity; val.transform.Rotate(0f, -90f, 90f); InteractionLever component = ((Component)val.transform.Find("ReferenceTransform/Lever")).GetComponent(); ((UnityEventBase)((InteractionNumericalBase)component).onStepReached).RemoveAllListeners(); ((InteractionRotator)component).rotatorMax = 15f; ((InteractionRotator)component).rotatorMin = -105f; if (leverToggledAction != null) { ((UnityEvent)(object)((InteractionNumericalBase)component).onStepReached).AddListener(UnityAction.op_Implicit(leverToggledAction)); } return val; } } private float a = 0f; private string t = ""; public override void OnLateInitializeMelon() { Actions.onMapInitialized += init; } public void init(string obj) { if (Scene.GetSceneName() == "Gym") { if ((Object)(object)RockUI.SliderPrefab == (Object)null) { RockUI.SliderPrefab = Object.Instantiate(Slider.GetGameObject()); Object.DontDestroyOnLoad((Object)(object)RockUI.SliderPrefab); RockUI.SliderPrefab.SetActive(false); } if ((Object)(object)RockUI.LeverPrefab == (Object)null) { RockUI.LeverPrefab = Object.Instantiate(InteractionLever.GetGameObject()); Object.DontDestroyOnLoad((Object)(object)RockUI.LeverPrefab); RockUI.LeverPrefab.SetActive(false); } RockUI.panelMesh = Mesh.GetGameObject().GetComponent().mesh; RockUI.panelMat = ((Renderer)Mesh.GetGameObject().GetComponent()).material; } } private void debug() { //IL_0012: 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_0034: Unknown result type (might be due to invalid IL or missing references) //IL_0039: 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_0095: Unknown result type (might be due to invalid IL or missing references) //IL_009a: Unknown result type (might be due to invalid IL or missing references) //IL_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_00fd: Unknown result type (might be due to invalid IL or missing references) //IL_0102: Unknown result type (might be due to invalid IL or missing references) //IL_012e: Unknown result type (might be due to invalid IL or missing references) //IL_0133: Unknown result type (might be due to invalid IL or missing references) //IL_019d: Unknown result type (might be due to invalid IL or missing references) RockPanel rockPanel = new RockPanel(); rockPanel.size = new Vector2(10f, 15f); RockButton rockButton = new RockButton(); rockButton.anchor = UIElement.AnchorType.Center; rockButton.anchorOffset = new Vector2(0f, 2f); rockButton.pressAction = log; RockText rockText = new RockText(); rockText.anchor = UIElement.AnchorType.Center; rockText.anchorOffset = new Vector2(0f, 4f); rockText.text = "Print Debug Message"; RockText rockText2 = new RockText(); rockText2.anchor = UIElement.AnchorType.Center; rockText2.anchorOffset = new Vector2(0f, -2f); rockText2.text = "Number to Print"; RockSlider rockSlider = new RockSlider(); rockSlider.anchor = UIElement.AnchorType.Center; rockSlider.anchorOffset = new Vector2(0f, -4f); rockSlider.valueChangedAction = setAmount; RockText rockText3 = new RockText(); rockText3.anchor = UIElement.AnchorType.Center; rockText3.anchorOffset = new Vector2(-3f, 2f); rockText3.text = "!!!"; RockLever rockLever = new RockLever(); rockLever.anchor = UIElement.AnchorType.Center; rockLever.anchorOffset = new Vector2(-3f, 0f); rockLever.leverToggledAction = setEnding; rockPanel.AddChildUI(rockText); rockPanel.AddChildUI(rockButton); rockPanel.AddChildUI(rockLever); rockPanel.AddChildUI(rockText2); rockPanel.AddChildUI(rockText3); rockPanel.AddChildUI(rockSlider); GameObject val = RockUI.CreateFinalisedUI(rockPanel, followPlayer: true); val.transform.position = new Vector3(0f, 1f, 0f); } private void log() { MelonLogger.Msg("Pressed Button, Amount: " + a + t); } private void setAmount(float amount) { a = 10f * amount; } private void setEnding(int ending) { if (ending == 1) { t = "!!!!!!!!!"; } else { t = ""; } } }