Decompiled source of RockCamGreenScreen v1.0.0

Mods/RockCamGreenScreen.dll

Decompiled 16 hours ago
using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Reflection;
using System.Resources;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using Il2CppRUMBLE.Managers;
using Il2CppRUMBLE.Players;
using Il2CppRUMBLE.Utilities;
using Il2CppSystem.Collections.Generic;
using Il2CppTMPro;
using MelonLoader;
using MelonLoader.Preferences;
using Microsoft.CodeAnalysis;
using RockCamGreenScreen;
using RumbleModdingAPI;
using UnityEngine;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: MelonInfo(typeof(global::RockCamGreenScreen.RockCamGreenScreen), "RockCamGreenScreen", "1.0.0", "iListen2Sound", null)]
[assembly: MelonGame("Buckethead Entertainment", "RUMBLE")]
[assembly: MelonAuthorColor(255, 87, 166, 80)]
[assembly: MelonColor(255, 87, 166, 80)]
[assembly: TargetFramework(".NETCoreApp,Version=v6.0", FrameworkDisplayName = ".NET 6.0")]
[assembly: AssemblyCompany("RockCamGreenScreen")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0+7512fb25266e214b32bbd8fd38152eebe02e692c")]
[assembly: AssemblyProduct("RockCamGreenScreen")]
[assembly: AssemblyTitle("RockCamGreenScreen")]
[assembly: NeutralResourcesLanguage("en-US")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.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 RockCamGreenScreen
{
	public class RockCamGreenScreen : MelonMod
	{
		[CompilerGenerated]
		private sealed class <DelayEnvironmentHiding>d__31 : IEnumerator<object>, IEnumerator, IDisposable
		{
			private int <>1__state;

			private object <>2__current;

			public RockCamGreenScreen <>4__this;

			object IEnumerator<object>.Current
			{
				[DebuggerHidden]
				get
				{
					return <>2__current;
				}
			}

			object IEnumerator.Current
			{
				[DebuggerHidden]
				get
				{
					return <>2__current;
				}
			}

			[DebuggerHidden]
			public <DelayEnvironmentHiding>d__31(int <>1__state)
			{
				this.<>1__state = <>1__state;
			}

			[DebuggerHidden]
			void IDisposable.Dispose()
			{
				<>1__state = -2;
			}

			private bool MoveNext()
			{
				//IL_0032: Unknown result type (might be due to invalid IL or missing references)
				//IL_003c: Expected O, but got Unknown
				switch (<>1__state)
				{
				default:
					return false;
				case 0:
					<>1__state = -1;
					<>2__current = (object)new WaitForSeconds((float)<>4__this.PrefDelayEnvHide.Value);
					<>1__state = 1;
					return true;
				case 1:
					<>1__state = -1;
					<>4__this.SetEnvironmentVisibility(isVisible: false);
					return false;
				}
			}

			bool IEnumerator.MoveNext()
			{
				//ILSpy generated this explicit interface implementation from .override directive in MoveNext
				return this.MoveNext();
			}

			[DebuggerHidden]
			void IEnumerator.Reset()
			{
				throw new NotSupportedException();
			}
		}

		[CompilerGenerated]
		private sealed class <HideOtherMods>d__32 : IEnumerator<object>, IEnumerator, IDisposable
		{
			private int <>1__state;

			private object <>2__current;

			public RockCamGreenScreen <>4__this;

			object IEnumerator<object>.Current
			{
				[DebuggerHidden]
				get
				{
					return <>2__current;
				}
			}

			object IEnumerator.Current
			{
				[DebuggerHidden]
				get
				{
					return <>2__current;
				}
			}

			[DebuggerHidden]
			public <HideOtherMods>d__32(int <>1__state)
			{
				this.<>1__state = <>1__state;
			}

			[DebuggerHidden]
			void IDisposable.Dispose()
			{
				<>1__state = -2;
			}

			private bool MoveNext()
			{
				//IL_0032: Unknown result type (might be due to invalid IL or missing references)
				//IL_003c: Expected O, but got Unknown
				switch (<>1__state)
				{
				default:
					return false;
				case 0:
					<>1__state = -1;
					<>2__current = (object)new WaitForSeconds((float)<>4__this.PrefDelayEnvHide.Value);
					<>1__state = 1;
					return true;
				case 1:
					<>1__state = -1;
					<>4__this.HideTimers();
					<>4__this.HideMabels();
					<>4__this.HideNameTags();
					return false;
				}
			}

			bool IEnumerator.MoveNext()
			{
				//ILSpy generated this explicit interface implementation from .override directive in MoveNext
				return this.MoveNext();
			}

			[DebuggerHidden]
			void IEnumerator.Reset()
			{
				throw new NotSupportedException();
			}
		}

		private GameObject DebugUi;

		private TextMeshPro DebugUiText;

		private GameObject PlayerUi;

		private bool DebugModeActive = true;

		private GameObject DerivedCylinder;

		private GameObject DerivedPitMask;

		private GameObject DerivedFullFloorMask;

		private Dictionary<GameObject, int> HideableObjectsToLayer;

		private List<int> OriginalLayer = new List<int>();

		private bool IsEnvVisible = true;

		private bool IsFloorVisible = true;

		private bool IsRingVisible = true;

		private const string USER_DATA = "UserData/RockCamGreenScreen/";

		private const string CONFIG_FILE = "config.cfg";

		private MelonPreferences_Category CatMain;

		private MelonPreferences_Entry<string> PrefGreenScreenColor;

		private MelonPreferences_Entry<bool> PrefHideFloor;

		private MelonPreferences_Entry<string> PrefFloorBackgroundColor;

		private MelonPreferences_Entry<bool> PrefGreenScreenActive;

		private MelonPreferences_Entry<bool> PrefHideRingClamp;

		private MelonPreferences_Category CatInput;

		private MelonPreferences_Entry<string> PrefModifierKey;

		private MelonPreferences_Category CatCompat;

		private MelonPreferences_Entry<double> PrefDelayEnvHide;

		private MelonPreferences_Category CatDiagnostics;

		private MelonPreferences_Entry<bool> PrefDebugMode;

		private string LastScene = "";

		private string CurrentScene = "";

		private bool isFirstLoad = true;

		private string lastDiffLogMessage = string.Empty;

		private const int NO_LIV_LAYER = 23;

		private const int LIV_ONLY_LAYER = 19;

		private KeyCode HoldKey = (KeyCode)308;

		private GameObject CurrentMapProduction;

		private GameObject ScreenPack;

		private GameObject BasePitMask;

		private GameObject BaseCylinder;

		private GameObject BaseFullFloorMask;

		private void BuildDebugScreen()
		{
			//IL_003c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0050: 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)
			//IL_008d: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b2: Unknown result type (might be due to invalid IL or missing references)
			PlayerUi = ((Component)((Component)Singleton<PlayerManager>.Instance.LocalPlayer.Controller).gameObject.transform.GetChild(6).GetChild(0)).gameObject;
			DebugUi = Create.NewText("Placeholder text. You shouldn't be seeing this without some UE Shenanigans\n or decompiled code. Unless I (probably) told you about this.", 1f, Color.white, new Vector3(0f, 0.1f, 1f), Quaternion.Euler(0f, 0f, 0f));
			DebugUi.transform.localScale = new Vector3(0.2f, 0.2f, 0.2f);
			DebugUi.transform.localPosition = new Vector3(0f, 0.1f, 0.96f);
			DebugUi.transform.SetParent(PlayerUi.transform, false);
			DebugUiText = DebugUi.GetComponent<TextMeshPro>();
			DebugUi.SetActive(false);
		}

		private void UpdateDebugScreen(string message)
		{
			if (Calls.IsMapInitialized())
			{
				((TMP_Text)DebugUiText).text = message;
			}
		}

		private void DiffLog(string message, bool debugOnly = true, int logLevel = 0)
		{
			if (message != lastDiffLogMessage)
			{
				lastDiffLogMessage = message;
				Log("DIFFLOG: " + message, debugOnly, logLevel);
			}
		}

		private void Log(string message, bool debugOnly = false, int logLevel = 0)
		{
			if (!(!DebugModeActive && debugOnly))
			{
				switch (logLevel)
				{
				case 0:
					((MelonBase)this).LoggerInstance.Msg(message);
					break;
				case 1:
					((MelonBase)this).LoggerInstance.Warning("Warn: " + message);
					break;
				case 2:
					((MelonBase)this).LoggerInstance.Error("Error: " + message);
					break;
				default:
					((MelonBase)this).LoggerInstance.Msg("Unrecognized logLevel: " + message);
					break;
				}
			}
		}

		private void CreateGreenScreens()
		{
			//IL_001e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0024: Expected O, but got Unknown
			//IL_00df: Unknown result type (might be due to invalid IL or missing references)
			//IL_011c: Unknown result type (might be due to invalid IL or missing references)
			if (CurrentScene.Contains("map"))
			{
				GameObject val = new GameObject("Liv Environment Hider");
				val.transform.SetParent(GrabMapProduction().transform, true);
				val.SetActive(true);
				DerivedCylinder = Object.Instantiate<GameObject>(BaseCylinder);
				DerivedCylinder.transform.SetParent(val.transform, true);
				DerivedCylinder.SetActive(false);
				DerivedFullFloorMask = Object.Instantiate<GameObject>(BaseFullFloorMask);
				DerivedFullFloorMask.transform.SetParent(val.transform, true);
				DerivedFullFloorMask.SetActive(false);
				if (CurrentScene == "map0")
				{
					DerivedFullFloorMask.transform.localPosition = new Vector3(-0.2f, -0.277f, 0f);
				}
				else if (CurrentScene == "map1")
				{
					DerivedFullFloorMask.transform.localPosition = new Vector3(-0.2f, 0.002f, 0f);
					DerivedPitMask = Object.Instantiate<GameObject>(BasePitMask);
					DerivedPitMask.transform.SetParent(val.transform, true);
					DerivedPitMask.SetActive(false);
				}
			}
		}

		private GameObject GrabArenaStaticGroup()
		{
			GameObject gameObject;
			if (CurrentScene == "map0")
			{
				gameObject = Mainstaticgroup.GetGameObject();
			}
			else
			{
				if (!(CurrentScene == "map1"))
				{
					Log("GrabArenaStaticGroup: Current scene is not a supported map", debugOnly: false, 1);
					return null;
				}
				gameObject = Mainstaticgroup.GetGameObject();
			}
			return gameObject;
		}

		private GameObject GrabMapProduction()
		{
			GameObject gameObject;
			if (CurrentScene == "map0")
			{
				gameObject = Map0production.GetGameObject();
			}
			else
			{
				if (!(CurrentScene == "map1"))
				{
					Log("GrabMapProduction: Current scene is not a supported map", debugOnly: false, 1);
					return null;
				}
				gameObject = Map1production.GetGameObject();
			}
			return gameObject;
		}

		private void SetFloorVisibility(bool isVisible)
		{
			GameObject gameObject;
			if (CurrentScene == "map0")
			{
				gameObject = ((Component)GrabArenaStaticGroup().transform.GetChild(2)).gameObject;
			}
			else
			{
				if (!(CurrentScene == "map1"))
				{
					Log("SetFloorVisibility: unsupported map", debugOnly: true);
					return;
				}
				gameObject = ((Component)GrabArenaStaticGroup().transform.GetChild(1)).gameObject;
				DerivedPitMask.SetActive(isVisible && !IsEnvVisible);
			}
			gameObject.layer = (isVisible ? 9 : 23);
			DerivedFullFloorMask.SetActive(!isVisible);
			IsFloorVisible = isVisible;
		}

		private void SetRingVisibility(bool isVisible)
		{
			GameObject gameObject;
			if (CurrentScene == "map0")
			{
				gameObject = ((Component)GrabArenaStaticGroup().transform.GetChild(5)).gameObject;
			}
			else
			{
				if (!(CurrentScene == "map1"))
				{
					Log("SetRingVisibility: unsupported map", debugOnly: true);
					return;
				}
				gameObject = ((Component)GrabArenaStaticGroup().transform.GetChild(5)).gameObject;
			}
			gameObject.layer = ((!isVisible) ? 23 : 0);
			IsRingVisible = isVisible;
		}

		private Dictionary<GameObject, int> GrabHideableObjects()
		{
			Dictionary<GameObject, int> dictionary = new Dictionary<GameObject, int>();
			List<string> list = new List<string>();
			if (CurrentScene == "map0")
			{
				list = new List<string> { "Background plane", "Backgroundrocks", "Gutter", "leave", "Root" };
			}
			else
			{
				if (!(CurrentScene == "map1"))
				{
					Log("GrabHideableObjects: Current scene is not a supported map", debugOnly: true, 1);
					return null;
				}
				list = new List<string> { "Cliff", "Deathdert", "Leaves_Map2", "Outherboundry" };
			}
			GameObject val = GrabArenaStaticGroup();
			for (int i = 0; i < val.transform.childCount; i++)
			{
				GameObject gameObject = ((Component)val.transform.GetChild(i)).gameObject;
				if (list.Contains(((Object)gameObject).name))
				{
					dictionary.Add(gameObject, gameObject.layer);
				}
			}
			return dictionary;
		}

		private void SetEnvironmentVisibility(bool isVisible, bool manualCall = false)
		{
			if (!CurrentScene.Contains("map"))
			{
				Log("SetEnvVis: Current Scene is not a supported map");
				return;
			}
			Log("SetEnvVis: CurrentScene is " + CurrentScene, debugOnly: true);
			if (IsEnvVisible == isVisible)
			{
				Log("SetEnvVis: Environment is already " + (isVisible ? "visible" : "hidden") + ".", debugOnly: false, 1);
				return;
			}
			GameObject val = GameObject.Find("NewTextGameObject(Clone)");
			if ((Object)(object)val != (Object)null)
			{
				val.layer = 23;
			}
			DerivedCylinder.SetActive(!isVisible);
			if (CurrentScene == "map1")
			{
				DerivedPitMask.SetActive(!isVisible);
			}
			foreach (KeyValuePair<GameObject, int> item in HideableObjectsToLayer)
			{
				item.Key.layer = (isVisible ? item.Value : 23);
				Log("SetEnvVis: Setting " + ((Object)item.Key).name + " to layer " + (isVisible ? item.Value.ToString() : 23.ToString()), debugOnly: true);
			}
			IsEnvVisible = isVisible;
			if (isVisible)
			{
				SetFloorVisibility(isVisible);
				SetRingVisibility(isVisible);
			}
			else
			{
				if (PrefHideFloor.Value)
				{
					SetFloorVisibility(isVisible);
				}
				if (PrefHideRingClamp.Value)
				{
					SetRingVisibility(isVisible);
				}
			}
			PrefGreenScreenActive.Value = !isVisible;
			SetGreenSreenColor(PrefGreenScreenColor.Value);
			SavePrefs();
		}

		private void ToggleEnvHide()
		{
			SetEnvironmentVisibility(!IsEnvVisible, manualCall: true);
		}

		private void HideTimers()
		{
			GameObject parent = GameObject.Find("Timers");
			HideAllChildren(parent);
		}

		private void HideMabels()
		{
			GameObject parent = GameObject.Find("Mabels");
			HideAllChildren(parent);
		}

		private void HideNameTags()
		{
			try
			{
				Enumerator<Player> enumerator = Singleton<PlayerManager>.Instance.AllPlayers.GetEnumerator();
				while (enumerator.MoveNext())
				{
					Player current = enumerator.Current;
					GameObject gameObject = ((Component)((Component)current.Controller).gameObject.transform.GetChild(9)).gameObject;
					Log("HideNameTag: Name tag found for player " + current.Data.GeneralData.PublicUsername, debugOnly: true);
					HideAllChildren(gameObject);
				}
			}
			catch (Exception ex)
			{
				Log("HideNameTags: " + ex.Message, debugOnly: false, 2);
			}
		}

		private void HideAllChildren(GameObject parent)
		{
			if (parent == null)
			{
				Log("HideAllChildren: Parent is null", debugOnly: true, 1);
				return;
			}
			if (parent.transform.childCount == 0)
			{
				Log("HideAllChildren: Parent has no children to hide\n", debugOnly: true);
				return;
			}
			Log("HideAllChildren: Hiding " + ((Object)parent).name + " from LIV", debugOnly: true);
			for (int i = 0; i < parent.transform.childCount; i++)
			{
				GameObject gameObject = ((Component)parent.transform.GetChild(i)).gameObject;
				gameObject.layer = 23;
				HideAllChildren(gameObject);
			}
		}

		private void ToggleFloorVis()
		{
			SetFloorVisibility(!IsFloorVisible);
			PrefHideFloor.Value = !IsFloorVisible;
			SavePrefs();
		}

		private void ToggleRingVis()
		{
			SetRingVisibility(!IsRingVisible);
			PrefHideRingClamp.Value = !IsRingVisible;
			SavePrefs();
		}

		private void SetGreenSreenColor(string hexCode)
		{
			//IL_0068: 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_00ba: Unknown result type (might be due to invalid IL or missing references)
			if (IsEnvVisible)
			{
				Log("SetGreenScreenColor: Can't change green screen colors when inactive", debugOnly: true, 1);
				return;
			}
			Color color = default(Color);
			if (!ColorUtility.TryParseHtmlString(hexCode, ref color))
			{
				Log("Failed to parse color from: " + hexCode, debugOnly: false, 2);
				return;
			}
			if ((Object)(object)DerivedPitMask != (Object)null)
			{
				((Renderer)DerivedPitMask.GetComponent<MeshRenderer>()).material.color = color;
			}
			if ((Object)(object)DerivedCylinder != (Object)null)
			{
				((Renderer)DerivedCylinder.GetComponent<MeshRenderer>()).material.color = color;
			}
			if ((Object)(object)DerivedFullFloorMask != (Object)null)
			{
				((Renderer)DerivedFullFloorMask.GetComponent<MeshRenderer>()).material.color = color;
			}
			if (hexCode != PrefGreenScreenColor.Value)
			{
				PrefGreenScreenColor.Value = hexCode;
				SavePrefs();
			}
			Log("SetGreenScreenColor: Green screen color set to " + hexCode, debugOnly: true);
		}

		[IteratorStateMachine(typeof(<DelayEnvironmentHiding>d__31))]
		private IEnumerator DelayEnvironmentHiding()
		{
			//yield-return decompiler failed: Unexpected instruction in Iterator.Dispose()
			return new <DelayEnvironmentHiding>d__31(0)
			{
				<>4__this = this
			};
		}

		[IteratorStateMachine(typeof(<HideOtherMods>d__32))]
		private IEnumerator HideOtherMods()
		{
			//yield-return decompiler failed: Unexpected instruction in Iterator.Dispose()
			return new <HideOtherMods>d__32(0)
			{
				<>4__this = this
			};
		}

		private void InitPreferences()
		{
			if (!Directory.Exists("UserData/RockCamGreenScreen/"))
			{
				Log("Userdata folder not found. Creating...");
				Directory.CreateDirectory("UserData/RockCamGreenScreen/");
			}
			CatMain = MelonPreferences.CreateCategory("RockCamGreenScreen", "RockCamGreenScreen");
			CatMain.SetFilePath(Path.Combine("UserData/RockCamGreenScreen/", "config.cfg"));
			PrefGreenScreenActive = CatMain.CreateEntry<bool>("Green Screen Active", true, (string)null, "Activates or deactivates green screen function", false, false, (ValueValidator)null, (string)null);
			PrefGreenScreenColor = CatMain.CreateEntry<string>("Green Screen Color", "#FF00FF", (string)null, "Doesn't actually have to be green. You can use black with a luma key filter", false, false, (ValueValidator)null, (string)null);
			PrefHideFloor = CatMain.CreateEntry<bool>("Hide Combat Floor", false, (string)null, "Hides the combat floor from the Rock Cam.", false, false, (ValueValidator)null, (string)null);
			PrefHideRingClamp = CatMain.CreateEntry<bool>("Hide Ring Clamp", false, (string)null, "Hides the ring clamp from the Rock Cam.", false, false, (ValueValidator)null, (string)null);
			CatInput = MelonPreferences.CreateCategory("Input");
			CatInput.SetFilePath(Path.Combine("UserData/RockCamGreenScreen/", "config.cfg"));
			PrefModifierKey = CatInput.CreateEntry<string>("Modifier Key", "LeftAlt", (string)null, "Key to use as a modifier to use keyboard input (specify left or right when using Alt, Ctrl, or Shift)", false, false, (ValueValidator)null, (string)null);
			CatCompat = MelonPreferences.CreateCategory("Compatability with other mods");
			CatCompat.SetFilePath(Path.Combine("UserData/RockCamGreenScreen/", "config.cfg"));
			PrefDelayEnvHide = CatCompat.CreateEntry<double>("Hide Environment Delay", 2.0, (string)null, "Delay in seconds for hiding map environment from Liv. Needed for Rumble HUD's portrait creation", false, false, (ValueValidator)null, (string)null);
			CatDiagnostics = MelonPreferences.CreateCategory("Diagnostic options");
			CatDiagnostics.SetFilePath(Path.Combine("UserData/RockCamGreenScreen/", "config.cfg"));
			PrefDebugMode = CatDiagnostics.CreateEntry<bool>("Enable Debug Mode", false, (string)null, "Enables more verbose logging and other debugging helper tools", false, false, (ValueValidator)null, (string)null);
			DebugModeActive = PrefDebugMode.Value;
			CatMain.SaveToFile(true);
			CatInput.SaveToFile(true);
			CatCompat.SaveToFile(true);
			CatDiagnostics.SaveToFile(true);
		}

		private void ReadPrefs()
		{
			CatMain.LoadFromFile(true);
			CatCompat.LoadFromFile(true);
			CatDiagnostics.LoadFromFile(true);
			DebugModeActive = PrefDebugMode.Value;
		}

		private void SavePrefs()
		{
			CatMain.SaveToFile(true);
		}

		public override void OnInitializeMelon()
		{
			Calls.onAMapInitialized += OnMapInitialized;
			InitPreferences();
			((MelonBase)this).LoggerInstance.Msg("Initialized.");
		}

		private void FirstLoad()
		{
			if (isFirstLoad)
			{
				InitImportedAssets();
				isFirstLoad = false;
			}
		}

		private void OnMapInitialized(string sceneName)
		{
			LastScene = CurrentScene;
			CurrentScene = sceneName.Trim().ToLower();
			IsEnvVisible = true;
			if (!isFirstLoad)
			{
				ReadPrefs();
			}
			FirstLoad();
			if (!Enum.TryParse<KeyCode>(PrefModifierKey.Value, out HoldKey))
			{
				Log("Unable to parse Modifier Key Config " + PrefModifierKey.Value, debugOnly: false, 2);
			}
			HideableObjectsToLayer = GrabHideableObjects();
			if (CurrentScene.Contains("map"))
			{
				MelonCoroutines.Start(HideOtherMods());
			}
			CreateGreenScreens();
			if (PrefGreenScreenActive.Value)
			{
				if (LastScene == CurrentScene)
				{
					SetEnvironmentVisibility(isVisible: false);
				}
				else
				{
					MelonCoroutines.Start(DelayEnvironmentHiding());
				}
			}
		}

		public override void OnUpdate()
		{
			//IL_004e: Unknown result type (might be due to invalid IL or missing references)
			if ((Object)(object)CurrentMapProduction != (Object)null)
			{
				DiffLog($"Map Production Active: {CurrentMapProduction.activeSelf}");
			}
			if (!Input.GetKey(HoldKey))
			{
				return;
			}
			string text = null;
			if (Input.GetKeyDown((KeyCode)122))
			{
				ToggleEnvHide();
			}
			if (Input.GetKeyDown((KeyCode)102))
			{
				if (!IsEnvVisible)
				{
					ToggleFloorVis();
				}
				else
				{
					Log("Can't toggle floor visibility when greater environment isn't hidden");
				}
			}
			if (Input.GetKeyDown((KeyCode)113))
			{
				if (!IsEnvVisible)
				{
					ToggleRingVis();
				}
				else
				{
					Log("Can't toggle ring visibility when greater environment isn't hidden");
				}
			}
			else if (Input.GetKeyDown((KeyCode)103))
			{
				text = "#00FF00";
			}
			else if (Input.GetKeyDown((KeyCode)98))
			{
				text = "#00F";
			}
			else if (Input.GetKeyDown((KeyCode)114))
			{
				text = "#F00";
			}
			else if (Input.GetKeyDown((KeyCode)107))
			{
				text = "#000";
			}
			else if (Input.GetKeyDown((KeyCode)109))
			{
				text = "#F0F";
			}
			else if (Input.GetKeyDown((KeyCode)119))
			{
				text = "#FFF";
			}
			else if (Input.GetKeyDown((KeyCode)121))
			{
				text = "#FF0";
			}
			else if (Input.GetKeyDown((KeyCode)99))
			{
				text = "#0FF";
			}
			else if (Input.GetKeyDown((KeyCode)111))
			{
				text = "#FFA500";
			}
			else if (Input.GetKeyDown((KeyCode)112))
			{
				text = "#FFC0CB";
			}
			else if (Input.GetKeyDown((KeyCode)108))
			{
				text = "#FAE";
			}
			else if (Input.GetKeyDown((KeyCode)116))
			{
				text = "#F30";
			}
			else if (Input.GetKeyDown((KeyCode)105))
			{
				text = "#57A650";
			}
			if (text != null)
			{
				DiffLog("SetGreenSreenColor called with " + text);
				SetGreenSreenColor(text);
			}
		}

		private void InitImportedAssets()
		{
			//IL_00b9: 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_0127: Unknown result type (might be due to invalid IL or missing references)
			//IL_014c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0171: Unknown result type (might be due to invalid IL or missing references)
			//IL_0196: Unknown result type (might be due to invalid IL or missing references)
			//IL_01bb: Unknown result type (might be due to invalid IL or missing references)
			//IL_01e0: Unknown result type (might be due to invalid IL or missing references)
			//IL_0205: Unknown result type (might be due to invalid IL or missing references)
			//IL_022a: Unknown result type (might be due to invalid IL or missing references)
			ScreenPack = Object.Instantiate<GameObject>(Calls.LoadAssetFromStream<GameObject>((MelonMod)(object)this, "RockCamGreenScreen.Assets.livgreenscreen", "LivEnvironmentHider"));
			Object.DontDestroyOnLoad((Object)(object)ScreenPack);
			BasePitMask = ((Component)ScreenPack.transform.GetChild(0)).gameObject;
			BaseCylinder = ((Component)ScreenPack.transform.GetChild(2)).gameObject;
			BaseFullFloorMask = ((Component)ScreenPack.transform.GetChild(1)).gameObject;
			ScreenPack.SetActive(false);
			for (int i = 0; i < ScreenPack.transform.childCount; i++)
			{
				GameObject gameObject = ((Component)ScreenPack.transform.GetChild(i)).gameObject;
				gameObject.layer = 19;
				((Renderer)gameObject.GetComponent<MeshRenderer>()).material.color = Color.black;
				gameObject.SetActive(false);
			}
			BasePitMask.transform.localPosition = new Vector3(-0.2f, 0.01f, 0f);
			BasePitMask.transform.localRotation = Quaternion.Euler(270f, 0f, 0f);
			BasePitMask.transform.localScale = new Vector3(44.4f, 44.4f, 44.4f);
			BaseFullFloorMask.transform.localPosition = new Vector3(-0.2f, 0.01f, 0f);
			BaseFullFloorMask.transform.localRotation = Quaternion.Euler(270f, 0f, 0f);
			BaseFullFloorMask.transform.localScale = new Vector3(44.4f, 44.4f, 44.4f);
			BaseCylinder.transform.localPosition = new Vector3(0f, 0.39f, 0f);
			BaseCylinder.transform.localRotation = Quaternion.Euler(0f, 0f, 0f);
			BaseCylinder.transform.localScale = new Vector3(70f, 70f, 70f);
		}
	}
	public static class BuildInfo
	{
		public const string Name = "RockCamGreenScreen";

		public const string Author = "iListen2Sound";

		public const string Version = "1.0.0";
	}
}