using System;
using System.Collections;
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.Versioning;
using BepInEx;
using BepInEx.Configuration;
using BepInEx.Logging;
using MuckVR.MonoBehaviours;
using MuckVR.Utils;
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: AssemblyTitle("MuckVR")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("MuckVR")]
[assembly: AssemblyCopyright("Copyright © 2023")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("93d5db50-aad4-4f29-97bd-3c02ee98d432")]
[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 MuckVR
{
[BepInPlugin("com.offle.MuckVR", "MuckVR", "1.0.0")]
public class MuckVRPlugin : BaseUnityPlugin
{
private const string MyGUID = "com.offle.MuckVR";
private const string PluginName = "MuckVR";
private const string VersionString = "1.0.0";
public static string FloatExampleKey = "Float Example Key";
public static string IntExampleKey = "Int Example Key";
public static string KeyboardShortcutExampleKey = "Recall Keyboard Shortcut";
public static ConfigEntry<float> FloatExample;
public static ConfigEntry<int> IntExample;
public static ConfigEntry<KeyboardShortcut> KeyboardShortcutExample;
public static ManualLogSource Log = new ManualLogSource("MuckVR");
private void Awake()
{
//IL_002f: Unknown result type (might be due to invalid IL or missing references)
//IL_0039: Expected O, but got Unknown
//IL_0061: Unknown result type (might be due to invalid IL or missing references)
//IL_006b: Expected O, but got Unknown
//IL_0090: Unknown result type (might be due to invalid IL or missing references)
FloatExample = ((BaseUnityPlugin)this).Config.Bind<float>("General", FloatExampleKey, 1f, new ConfigDescription("Example float configuration setting.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0f, 10f), Array.Empty<object>()));
IntExample = ((BaseUnityPlugin)this).Config.Bind<int>("General", IntExampleKey, 1, new ConfigDescription("Example int configuration setting.", (AcceptableValueBase)(object)new AcceptableValueRange<int>(0, 10), Array.Empty<object>()));
KeyboardShortcutExample = ((BaseUnityPlugin)this).Config.Bind<KeyboardShortcut>("General", KeyboardShortcutExampleKey, new KeyboardShortcut((KeyCode)97, (KeyCode[])(object)new KeyCode[1] { (KeyCode)306 }), (ConfigDescription)null);
FloatExample.SettingChanged += ConfigSettingChanged;
IntExample.SettingChanged += ConfigSettingChanged;
KeyboardShortcutExample.SettingChanged += ConfigSettingChanged;
((BaseUnityPlugin)this).Logger.LogInfo((object)"PluginName: MuckVR, VersionString: 1.0.0 is loading...");
((BaseUnityPlugin)this).Logger.LogInfo((object)"PluginName: MuckVR, VersionString: 1.0.0 is loaded.");
Log = ((BaseUnityPlugin)this).Logger;
}
private void Start()
{
//IL_0006: Unknown result type (might be due to invalid IL or missing references)
ModUtils.vrman = new GameObject("MuckVR Manager").AddComponent<MuckVRManager>();
}
private void Update()
{
//IL_0006: Unknown result type (might be due to invalid IL or missing references)
//IL_000b: Unknown result type (might be due to invalid IL or missing references)
KeyboardShortcut value = KeyboardShortcutExample.Value;
if (((KeyboardShortcut)(ref value)).IsDown())
{
((BaseUnityPlugin)this).Logger.LogInfo((object)"Keypress detected!");
}
}
private void ConfigSettingChanged(object sender, EventArgs e)
{
//IL_007f: Unknown result type (might be due to invalid IL or missing references)
//IL_0084: Unknown result type (might be due to invalid IL or missing references)
SettingChangedEventArgs val = (SettingChangedEventArgs)(object)((e is SettingChangedEventArgs) ? e : null);
if (val != null)
{
if (val.ChangedSetting.Definition.Key == FloatExampleKey)
{
}
if (val.ChangedSetting.Definition.Key == IntExampleKey)
{
}
if (val.ChangedSetting.Definition.Key == KeyboardShortcutExampleKey)
{
KeyboardShortcut val2 = (KeyboardShortcut)val.ChangedSetting.BoxedValue;
}
}
}
}
}
namespace MuckVR.Utils
{
internal static class ModUtils
{
public static MuckVRManager vrman;
public static GameObject vrmanRef;
public static Transform GetPlayerTransform()
{
return null;
}
}
}
namespace MuckVR.MonoBehaviours
{
internal class MuckVRManager : MonoBehaviour
{
public bool isMainMenu = true;
private GameObject ui;
private GameObject uianchor;
private GameObject player;
public void Start()
{
//IL_001b: Unknown result type (might be due to invalid IL or missing references)
Object.DontDestroyOnLoad((Object)(object)this);
SceneManager.sceneLoaded += OnBeforeSceneLoad;
OnBeforeSceneLoad(SceneManager.GetActiveScene(), (LoadSceneMode)0);
}
private void OnBeforeSceneLoad(Scene scene, LoadSceneMode mode)
{
//IL_0006: Unknown result type (might be due to invalid IL or missing references)
//IL_0010: Expected O, but got Unknown
ModUtils.vrmanRef = new GameObject("ref");
isMainMenu = ((((Scene)(ref scene)).name == "Menu") ? true : false);
if (isMainMenu)
{
((MonoBehaviour)this).StartCoroutine(ConfigureMainMenu());
}
else
{
((MonoBehaviour)this).StartCoroutine(ConfigureGame());
}
}
private IEnumerator ConfigureMainMenu()
{
ui = null;
while ((Object)(object)ui == (Object)null)
{
Scene activeScene = SceneManager.GetActiveScene();
GameObject[] rootGameObjects = ((Scene)(ref activeScene)).GetRootGameObjects();
foreach (GameObject i in rootGameObjects)
{
ui = ((((Object)i).name == "UI") ? i : ui);
}
yield return (object)new WaitForEndOfFrame();
}
ui.GetComponent<Canvas>().renderMode = (RenderMode)2;
ui.gameObject.transform.position = new Vector3(108.5603f, 28.9318f, 668.936f);
ui.gameObject.transform.localScale = new Vector3(0.015f, 0.015f, 0.015f);
}
private IEnumerator ConfigureGame()
{
yield return (object)new WaitForSeconds(5f);
ui = null;
player = null;
uianchor = new GameObject("UI_Anchor");
while ((Object)(object)ui == (Object)null && (Object)(object)player == (Object)null)
{
try
{
Scene activeScene = SceneManager.GetActiveScene();
GameObject[] rootGameObjects = ((Scene)(ref activeScene)).GetRootGameObjects();
foreach (GameObject j in rootGameObjects)
{
ui = ((((Object)j).name == "UI (1)") ? j : ui);
}
activeScene = SceneManager.GetActiveScene();
GameObject[] rootGameObjects2 = ((Scene)(ref activeScene)).GetRootGameObjects();
foreach (GameObject i in rootGameObjects2)
{
player = ((((Object)i).name == "Player") ? i : player);
}
}
catch (Exception e)
{
Debug.LogError((object)e);
}
yield return (object)new WaitForEndOfFrame();
}
ui.GetComponent<Canvas>().renderMode = (RenderMode)2;
uianchor.transform.SetParent(player.transform);
ui.transform.SetParent(uianchor.transform);
ui.transform.localScale = new Vector3(0.01f, 0.01f, 0.01f);
ui.transform.localPosition = new Vector3(0f, 0f, 10f);
ui.layer = 1 << LayerMask.NameToLayer("3");
uianchor.transform.localPosition = new Vector3(0f, 0f, 0f);
Camera uicam = new GameObject("UICam").AddComponent<Camera>();
uicam.aspect = Camera.main.aspect;
uicam.fieldOfView = Camera.main.fieldOfView;
((Component)uicam).transform.parent = ((Component)Camera.main).transform;
((Component)uicam).transform.rotation = new Quaternion(0f, 0f, 0f, 0f);
uicam.cullingMask = 2222;
uicam.depth = 1f;
((Component)uicam).transform.localPosition = Vector3.zero;
uicam.clearFlags = (CameraClearFlags)3;
}
public void Update()
{
//IL_002f: Unknown result type (might be due to invalid IL or missing references)
//IL_0046: 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_007d: 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_0085: Unknown result type (might be due to invalid IL or missing references)
//IL_00b9: Unknown result type (might be due to invalid IL or missing references)
//IL_00ba: Unknown result type (might be due to invalid IL or missing references)
if (isMainMenu)
{
ui.transform.position = new Vector3(108.5603f, 28.9318f, 668.936f + ((Component)Camera.main).transform.position.z * 1.01f - 652f);
}
else if ((Object)(object)ui != (Object)null)
{
Quaternion rotation = ((Component)Camera.main).transform.parent.parent.rotation;
Vector3 eulerAngles = ((Quaternion)(ref rotation)).eulerAngles;
eulerAngles.y -= 0.5f;
eulerAngles.x = 0f;
eulerAngles.z = 0f;
uianchor.transform.rotation = Quaternion.Euler(eulerAngles);
}
}
public void LateUpdate()
{
}
}
}