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.Logging;
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("BetterSecurityCameras")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("BetterSecurityCameras")]
[assembly: AssemblyCopyright("Copyright © 2023")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("2cee61ba-15cf-4687-8f41-c05b556dd1d2")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: TargetFramework(".NETFramework,Version=v4.8", FrameworkDisplayName = ".NET Framework 4.8")]
[assembly: AssemblyVersion("1.0.0.0")]
namespace BetterSecurityCameras;
[BepInPlugin("stormytuna.BetterSecurityCameras", "BetterSecurityCameras", "1.0.0")]
public class BetterSecurityCameras : BaseUnityPlugin
{
public const string ModGUID = "stormytuna.BetterSecurityCameras";
public const string ModName = "BetterSecurityCameras";
public const string ModVersion = "1.0.0";
private readonly bool appliedMonitorChanges = false;
public static ManualLogSource Log = Logger.CreateLogSource("stormytuna.BetterSecurityCameras");
public static BetterSecurityCameras Instance;
private void Awake()
{
if (Instance == null)
{
Instance = this;
((Object)((Component)this).gameObject).hideFlags = (HideFlags)61;
}
Log.LogInfo((object)"Better Security Cameras has awoken!");
Object.DontDestroyOnLoad((Object)(object)this);
SceneManager.sceneLoaded += delegate(Scene scene, LoadSceneMode mode)
{
if (((Scene)(ref scene)).name != "MainMenu" && ((Scene)(ref scene)).name != "InitScene" && ((Scene)(ref scene)).name != "InitSceneLaunchOptions")
{
((MonoBehaviour)this).StartCoroutine(OnSceneLoaded());
}
};
}
private IEnumerator OnSceneLoaded()
{
yield return (object)new WaitForSeconds(5f);
if (!appliedMonitorChanges)
{
RenderTexture internalCameraRt = new RenderTexture(160, 120, 32, (RenderTextureFormat)0);
GameObject internalCamera = GameObject.Find("Environment/HangarShip/Cameras/ShipCamera");
internalCamera.GetComponent<Camera>().targetTexture = internalCameraRt;
GameObject topMonitors = GameObject.Find("Environment/HangarShip/ShipModels2b/MonitorWall/Cube");
((Renderer)topMonitors.GetComponent<MeshRenderer>()).materials[2].mainTexture = (Texture)(object)internalCameraRt;
RenderTexture externalCameraRt = new RenderTexture(1600, 1200, 32, (RenderTextureFormat)0);
GameObject externalCamera = GameObject.Find("Environment/HangarShip/Cameras/FrontDoorSecurityCam/SecurityCamera");
externalCamera.GetComponent<Camera>().targetTexture = externalCameraRt;
GameObject bottomMonitors = GameObject.Find("Environment/HangarShip/ShipModels2b/MonitorWall/Cube.001");
((Renderer)bottomMonitors.GetComponent<MeshRenderer>()).materials[2].mainTexture = (Texture)(object)externalCameraRt;
GameObject doorMonitor = GameObject.Find("Environment/HangarShip/ShipModels2b/MonitorWall/SingleScreen");
((Renderer)doorMonitor.GetComponent<MeshRenderer>()).materials[1].mainTexture = (Texture)(object)externalCameraRt;
}
}
}