From a88f0f5899dfe127d562c338fb429786455fc8ef Mon Sep 17 00:00:00 2001 From: benneh Date: Thu, 22 Aug 2019 16:12:41 +0200 Subject: [PATCH] formatted some files --- CameraPlus/CameraMovement.cs | 52 +++++++-------- CameraPlus/CameraPlusBehaviour.cs | 98 ++++++++++++++--------------- CameraPlus/CameraUtilities.cs | 6 +- CameraPlus/Config.cs | 4 +- CameraPlus/ContextMenu.cs | 27 ++++---- CameraPlus/Plugin.cs | 8 ++- CameraPlus/ScreenCameraBehaviour.cs | 2 +- CameraPlus/TransparentWallsPatch.cs | 1 + CameraPlus/Utilities.cs | 2 +- 9 files changed, 105 insertions(+), 95 deletions(-) diff --git a/CameraPlus/CameraMovement.cs b/CameraPlus/CameraMovement.cs index 43711ab..a9f5edd 100644 --- a/CameraPlus/CameraMovement.cs +++ b/CameraPlus/CameraMovement.cs @@ -23,32 +23,32 @@ public override bool Init(CameraPlusBehaviour cameraPlus) } return false; } - + public override void OnActiveSceneChanged(Scene from, Scene to) { if (to.name == "GameCore") { - //var standardLevelSceneSetupDataSO = Resources.FindObjectsOfTypeAll().FirstOrDefault(); - //if(standardLevelSceneSetupDataSO) - //{ - // foreach(var pair in standardLevelSceneSetupDataSO.sceneInfoSceneSetupDataPairs) - // { - // if(pair.data is GameplayCoreSceneSetupData) - // { - // var sceneSetupData = (GameplayCoreSceneSetupData)pair.data; - - // var level = sceneSetupData.difficultyBeatmap.level; - // Plugin.Log($"Level: {level.levelID}"); - // if (level is SongLoaderPlugin.OverrideClasses.CustomLevel) - // { - // if (LoadCameraData(Path.Combine((level as SongLoaderPlugin.OverrideClasses.CustomLevel).customSongInfo.path, "CameraMovementData.json"))) - // data.ActiveInPauseMenu = false; - // } - // } - // } - //} + // var standardLevelSceneSetupDataSO = Resources.FindObjectsOfTypeAll().FirstOrDefault(); + // if(standardLevelSceneSetupDataSO) + // { + // foreach(var pair in standardLevelSceneSetupDataSO.sceneInfoSceneSetupDataPairs) + // { + // if(pair.data is GameplayCoreSceneSetupData) + // { + // var sceneSetupData = (GameplayCoreSceneSetupData)pair.data; + + // var level = sceneSetupData.difficultyBeatmap.level; + // Plugin.Log($"Level: {level.levelID}"); + // if (level is SongLoaderPlugin.OverrideClasses.CustomLevel) + // { + // if (LoadCameraData(Path.Combine((level as SongLoaderPlugin.OverrideClasses.CustomLevel).customSongInfo.path, "CameraMovementData.json"))) + // data.ActiveInPauseMenu = false; + // } + // } + // } + // } } - else if(dataLoaded) + else if (dataLoaded) { dataLoaded = false; _cameraPlus.ThirdPersonPos = _cameraPlus.Config.Position; @@ -95,7 +95,7 @@ public class CameraData { public bool ActiveInPauseMenu = true; public List Movements = new List(); - + public bool LoadFromJson(string jsonString) { Movements.Clear(); @@ -121,7 +121,7 @@ public bool LoadFromJson(string jsonString) newMovement.Delay = movement["Delay"].AsFloat; newMovement.Duration = Mathf.Clamp(movement["Duration"].AsFloat, 0.01f, float.MaxValue); // Make sure duration is at least 0.01 seconds, to avoid a divide by zero error - + if (movement["EaseTransition"].IsBoolean) newMovement.EaseTransition = movement["EaseTransition"].AsBool; @@ -152,7 +152,7 @@ protected void Update() if (movePerc == 1 && movementDelayEndTime <= DateTime.Now) UpdatePosAndRot(); - + long differenceTicks = (movementEndTime - movementStartTime).Ticks; long currentTicks = (DateTime.Now - movementStartTime).Ticks; movePerc = Mathf.Clamp((float)currentTicks / (float)differenceTicks, 0, 1); @@ -225,7 +225,7 @@ protected bool LoadCameraData(string path) protected void FindShortestDelta(ref Vector3 from, ref Vector3 to) { - if(Mathf.DeltaAngle(from.x, to.x) < 0) + if (Mathf.DeltaAngle(from.x, to.x) < 0) from.x += 360.0f; if (Mathf.DeltaAngle(from.y, to.y) < 0) from.y += 360.0f; @@ -259,7 +259,7 @@ protected float Ease(float p) if (!easeTransition) return p; - if (p < 0.5f) //Cubic Hopefully + if (p < 0.5f) // Cubic Hopefully { return 4 * p * p * p; } diff --git a/CameraPlus/CameraPlusBehaviour.cs b/CameraPlus/CameraPlusBehaviour.cs index 2bfeb77..2307f4b 100644 --- a/CameraPlus/CameraPlusBehaviour.cs +++ b/CameraPlus/CameraPlusBehaviour.cs @@ -24,7 +24,7 @@ public enum CursorType DiagonalLeft, DiagonalRight } - + protected readonly WaitUntil _waitForMainCamera = new WaitUntil(() => Camera.main); private readonly WaitForSecondsRealtime _waitForSecondsRealtime = new WaitForSecondsRealtime(1f); protected const int OnlyInThirdPerson = 3; @@ -99,7 +99,7 @@ public bool ThirdPerson public static bool wasWithinBorder = false; public static bool anyInstanceBusy = false; private static bool _contextMenuEnabled = true; - + public virtual void Init(Config config) { DontDestroyOnLoad(gameObject); @@ -111,14 +111,14 @@ public virtual void Init(Config config) StartCoroutine(DelayedInit()); } - + protected IEnumerator DelayedInit() { yield return _waitForMainCamera; _mainCamera = Camera.main; - // _menuStrip = null; - if(_contextMenu == null) + // _menuStrip = null; + if (_contextMenu == null) { MenuObj = new GameObject("CameraPlusMenu"); _contextMenu = MenuObj.AddComponent(); @@ -128,7 +128,7 @@ protected IEnumerator DelayedInit() Config.ConfigChangedEvent += PluginOnConfigChangedEvent; var gameObj = Instantiate(_mainCamera.gameObject); - + gameObj.SetActive(false); gameObj.name = "Camera Plus"; gameObj.tag = "Untagged"; @@ -136,7 +136,7 @@ protected IEnumerator DelayedInit() DestroyImmediate(gameObj.GetComponent("CameraRenderCallbacksManager")); DestroyImmediate(gameObj.GetComponent("AudioListener")); DestroyImmediate(gameObj.GetComponent("MeshCollider")); - + _cam = gameObj.GetComponent(); _cam.stereoTargetEye = StereoTargetEyeMask.None; _cam.enabled = true; @@ -178,7 +178,7 @@ protected IEnumerator DelayedInit() _quad.transform.localEulerAngles = new Vector3(0, 180, 0); _quad.transform.localScale = new Vector3(_cam.aspect, 1, 1); _cameraPreviewQuad = _quad; - + ReadConfig(); if (ThirdPerson) @@ -203,12 +203,12 @@ protected IEnumerator DelayedInit() Plugin.Instance.ActiveSceneChanged += SceneManager_activeSceneChanged; - // FirstPersonOffset = Config.FirstPersonPositionOffset; - // FirstPersonRotationOffset = Config.FirstPersonRotationOffset; + // FirstPersonOffset = Config.FirstPersonPositionOffset; + // FirstPersonRotationOffset = Config.FirstPersonRotationOffset; SceneManager_activeSceneChanged(new Scene(), new Scene()); Logger.Log($"Camera \"{Path.GetFileName(Config.FilePath)}\" successfully initialized!"); } - + protected virtual void OnDestroy() { Config.ConfigChangedEvent -= PluginOnConfigChangedEvent; @@ -247,8 +247,8 @@ protected virtual void ReadConfig() { ThirdPersonPos = Config.Position; ThirdPersonRot = Config.Rotation; - // FirstPersonOffset = Config.FirstPersonPositionOffset; - // FirstPersonRotationOffset = Config.FirstPersonRotationOffset; + // FirstPersonOffset = Config.FirstPersonPositionOffset; + // FirstPersonRotationOffset = Config.FirstPersonRotationOffset; } SetCullingMask(); @@ -282,11 +282,11 @@ internal virtual void CreateScreenRenderTexture() if (!replace) { - //Logger.Log("Don't need to replace"); + // Logger.Log("Don't need to replace"); return; } - if(Config.fitToCanvas) + if (Config.fitToCanvas) { Config.screenPosX = 0; Config.screenPosY = 0; @@ -295,7 +295,7 @@ internal virtual void CreateScreenRenderTexture() } _lastRenderUpdate = DateTime.Now; - //GetScaledScreenResolution(Config.renderScale, out var scaledWidth, out var scaledHeight); + // GetScaledScreenResolution(Config.renderScale, out var scaledWidth, out var scaledHeight); _camRenderTexture.width = Mathf.Clamp(Mathf.RoundToInt(Config.screenWidth * Config.renderScale), 1, int.MaxValue); _camRenderTexture.height = Mathf.Clamp(Mathf.RoundToInt(Config.screenHeight * Config.renderScale), 1, int.MaxValue); @@ -318,12 +318,12 @@ internal virtual void CreateScreenRenderTexture() _prevScreenPosY = Config.screenPosY; }); } - + public virtual void SceneManager_activeSceneChanged(Scene from, Scene to) { StartCoroutine(GetMainCamera()); var vrPointers = to.name == "GameCore" ? Resources.FindObjectsOfTypeAll() : Resources.FindObjectsOfTypeAll(); - if(vrPointers.Count() == 0) + if (vrPointers.Count() == 0) { Logger.Log("Failed to get VRPointer!", LogLevel.Warning); return; @@ -340,8 +340,8 @@ public virtual void SceneManager_activeSceneChanged(Scene from, Scene to) protected void OnApplicationFocus(bool hasFocus) { - // if(!hasFocus && GetActiveWindow() == IntPtr.Zero) - // CloseContextMenu(); + // if(!hasFocus && GetActiveWindow() == IntPtr.Zero) + // CloseContextMenu(); } protected virtual void Update() @@ -356,8 +356,8 @@ protected virtual void Update() { transform.position = _mainCamera.transform.position; transform.rotation = _mainCamera.transform.rotation; - // FirstPersonOffset = Config.FirstPersonPositionOffset; - // FirstPersonRotationOffset = Config.FirstPersonRotationOffset; + // FirstPersonOffset = Config.FirstPersonPositionOffset; + // FirstPersonRotationOffset = Config.FirstPersonRotationOffset; } else { @@ -386,21 +386,21 @@ protected virtual void LateUpdate() _cameraCube.eulerAngles = ThirdPersonRot; return; } - // Console.WriteLine(Config.FirstPersonPositionOffset.ToString()); + // Console.WriteLine(Config.FirstPersonPositionOffset.ToString()); transform.position = Vector3.Lerp(transform.position, camera.position + Config.FirstPersonPositionOffset, Config.positionSmooth * Time.unscaledDeltaTime); - if(!Config.forceFirstPersonUpRight) - transform.rotation = Quaternion.Slerp(transform.rotation, camera.rotation * Quaternion.Euler(Config.FirstPersonRotationOffset), - Config.rotationSmooth * Time.unscaledDeltaTime); - else + if (!Config.forceFirstPersonUpRight) + transform.rotation = Quaternion.Slerp(transform.rotation, camera.rotation * Quaternion.Euler(Config.FirstPersonRotationOffset), + Config.rotationSmooth * Time.unscaledDeltaTime); + else { Quaternion rot = Quaternion.Slerp(transform.rotation, camera.rotation * Quaternion.Euler(Config.FirstPersonRotationOffset), Config.rotationSmooth * Time.unscaledDeltaTime); - transform.rotation = rot * Quaternion.Euler(0, 0, -(rot.eulerAngles.z) ); + transform.rotation = rot * Quaternion.Euler(0, 0, -(rot.eulerAngles.z)); } - + } catch { } } @@ -444,7 +444,7 @@ internal virtual void SetFOV() internal virtual void SetCullingMask() { - if(Config.transparentWalls) + if (Config.transparentWalls) _cam.cullingMask &= ~(1 << TransparentWallsPatch.WallLayerMask); else _cam.cullingMask |= (1 << TransparentWallsPatch.WallLayerMask); @@ -471,13 +471,13 @@ public bool IsTopmostRenderAreaAtPos(Vector2 mousePos) return false; } - if (c.Config.layer == Config.layer && + if (c.Config.layer == Config.layer && c.Instance._lastRenderUpdate > _lastRenderUpdate) { return false; } - if (c.Instance._mouseHeld && (c.Instance._isMoving || + if (c.Instance._mouseHeld && (c.Instance._isMoving || c.Instance._isResizing || c.Instance._contextMenuOpen)) { return false; @@ -517,7 +517,7 @@ internal void CloseContextMenu() */ _contextMenuOpen = false; } - + public static void SetCursor(CursorType type) { if (type != currentCursor) @@ -538,7 +538,7 @@ public static void SetCursor(CursorType type) texture = Utils.LoadTextureFromResources("CameraPlus.Resources.Resize_DiagLeft.png"); break; } - UnityEngine.Cursor.SetCursor(texture, texture ? new Vector2(texture.width / 2, texture.height / 2) : new Vector2(0,0), CursorMode.Auto); + UnityEngine.Cursor.SetCursor(texture, texture ? new Vector2(texture.width / 2, texture.height / 2) : new Vector2(0, 0), CursorMode.Auto); currentCursor = type; } } @@ -555,7 +555,7 @@ protected void HandleMouseEvents() { if (/*_menuStrip != null &&*/ mousePos.x > 0 && mousePos.x < Screen.width && mousePos.y > 0 && mousePos.y < Screen.height) { - // CloseContextMenu(); + // CloseContextMenu(); } } @@ -611,7 +611,7 @@ protected void HandleMouseEvents() { _initialOffset.x = currentMouseOffsetX; _initialOffset.y = currentMouseOffsetY; - + _lastScreenPos = Config.ScreenPosition; _lastGrabPos = new Vector2(mousePos.x, mousePos.y); @@ -649,20 +649,20 @@ protected void HandleMouseEvents() Config.screenHeight = Mathf.Clamp(Config.screenHeight, 100, Screen.height); Config.screenPosX = Mathf.Clamp(Config.screenPosX, 0, Screen.width - Config.screenWidth); Config.screenPosY = Mathf.Clamp(Config.screenPosY, 0, Screen.height - Config.screenHeight); - + CreateScreenRenderTexture(); } else if (holdingRightClick && _contextMenuEnabled) { if (_mouseHeld) return; - // if (_menuStrip == null) - // { - DisplayContextMenu(); - _contextMenuOpen = true; - // } - // _menuStrip.SetBounds(Cursor.Position.X, Cursor.Position.Y, 0, 0); - // if (!_menuStrip.Visible) - // _menuStrip.Show(); + // if (_menuStrip == null) + // { + DisplayContextMenu(); + _contextMenuOpen = true; + // } + // _menuStrip.SetBounds(Cursor.Position.X, Cursor.Position.Y, 0, 0); + // if (!_menuStrip.Visible) + // _menuStrip.Show(); anyInstanceBusy = true; _mouseHeld = true; } @@ -745,8 +745,8 @@ void DisplayContextMenu() ThirdPerson = Config.thirdPerson; ThirdPersonPos = Config.Position; ThirdPersonRot = Config.Rotation; - //FirstPersonOffset = Config.FirstPersonPositionOffset; - // FirstPersonRotationOffset = Config.FirstPersonRotationOffset; + // FirstPersonOffset = Config.FirstPersonPositionOffset; + // FirstPersonRotationOffset = Config.FirstPersonRotationOffset; CreateScreenRenderTexture(); CloseContextMenu(); Config.Save(); @@ -771,8 +771,8 @@ void DisplayContextMenu() Config.FirstPersonRotationOffset = Config.DefaultFirstPersonRotationOffset; ThirdPersonPos = Config.DefaultPosition; ThirdPersonRot = Config.DefaultRotation; - //FirstPersonOffset = Config.FirstPersonPositionOffset; - // FirstPersonRotationOffset = Config.FirstPersonRotationOffset; + // FirstPersonOffset = Config.FirstPersonPositionOffset; + // FirstPersonRotationOffset = Config.FirstPersonRotationOffset; Config.Save(); CloseContextMenu(); }); diff --git a/CameraPlus/CameraUtilities.cs b/CameraPlus/CameraUtilities.cs index 78f5ccc..87653e3 100644 --- a/CameraPlus/CameraUtilities.cs +++ b/CameraPlus/CameraUtilities.cs @@ -15,14 +15,14 @@ public static bool CameraExists(string cameraName) { return Plugin.Instance.Cameras.Keys.Where(c => c == cameraName + ".cfg").Count() > 0; } - + public static void AddNewCamera(string cameraName, Config CopyConfig = null, bool meme = false) { string path = Path.Combine(BeatSaber.UserDataPath, Plugin.Name, $"{cameraName}.cfg"); if (!File.Exists(path)) { // Try to copy their old config file into the new camera location - if(cameraName == Plugin.MainCamera) + if (cameraName == Plugin.MainCamera) { string oldPath = Path.Combine(Environment.CurrentDirectory, $"{Plugin.MainCamera}.cfg"); if (File.Exists(oldPath)) @@ -71,7 +71,7 @@ public static void AddNewCamera(string cameraName, Config CopyConfig = null, boo config.screenHeight /= 4; config.screenWidth /= 4; } - + config.Position = config.DefaultPosition; config.Rotation = config.DefaultRotation; config.FirstPersonPositionOffset = config.DefaultFirstPersonPositionOffset; diff --git a/CameraPlus/Config.cs b/CameraPlus/Config.cs index 819d027..4b5667c 100644 --- a/CameraPlus/Config.cs +++ b/CameraPlus/Config.cs @@ -43,7 +43,7 @@ public class Config public bool transparentWalls = false; public bool forceFirstPersonUpRight = false; public string movementScriptPath = String.Empty; - //public int maxFps = 90; + // public int maxFps = 90; public event Action ConfigChangedEvent; @@ -123,6 +123,7 @@ public Vector3 FirstPersonPositionOffset firstPersonPosOffsetZ = value.z; } } + public Vector3 FirstPersonRotationOffset { get @@ -144,6 +145,7 @@ public Vector3 DefaultFirstPersonPositionOffset return new Vector3(0, 0, 0); } } + public Vector3 DefaultFirstPersonRotationOffset { get diff --git a/CameraPlus/ContextMenu.cs b/CameraPlus/ContextMenu.cs index 214e4bf..5011546 100644 --- a/CameraPlus/ContextMenu.cs +++ b/CameraPlus/ContextMenu.cs @@ -5,6 +5,7 @@ using System.Threading.Tasks; using UnityEngine; using LogLevel = IPA.Logging.Logger.Level; + namespace CameraPlus { public class ContextMenu : MonoBehaviour @@ -14,35 +15,39 @@ internal Vector2 menuPos get { return new Vector2( - Mathf.Min(mousePosition.x / (Screen.width / 1600f), (Screen.width * ( 0.806249998f / (Screen.width / 1600f)))), - Mathf.Min(mousePosition.y / (Screen.height / 900f), (Screen.height * (0.555555556f / (Screen.height / 900f)))) - ); + Mathf.Min(mousePosition.x / (Screen.width / 1600f), (Screen.width * (0.806249998f / (Screen.width / 1600f)))), + Mathf.Min(mousePosition.y / (Screen.height / 900f), (Screen.height * (0.555555556f / (Screen.height / 900f))))); } } + internal Vector2 mousePosition; internal bool showMenu; internal bool layoutMode = false; internal bool verify38 = false; internal CameraPlusBehaviour parentBehaviour; + public void Awake() { } + public void EnableMenu(Vector2 mousePos, CameraPlusBehaviour parentBehaviour) { this.enabled = true; - // Console.WriteLine("Enable Menu"); + // Console.WriteLine("Enable Menu"); mousePosition = mousePos; showMenu = true; this.parentBehaviour = parentBehaviour; layoutMode = false; verify38 = false; } + public void DisableMenu() { this.enabled = false; - // Console.WriteLine("Disable Menu"); + // Console.WriteLine("Disable Menu"); showMenu = false; } + void OnGUI() { @@ -58,7 +63,7 @@ void OnGUI() scale.z = 1; Matrix4x4 originalMatrix = GUI.matrix; GUI.matrix = Matrix4x4.TRS(new Vector3(0, 0, 0), Quaternion.identity, scale); - //Layer boxes for Opacity + // Layer boxes for Opacity GUI.Box(new Rect(menuPos.x - 5, menuPos.y, 310, 400), "CameraPlus"); GUI.Box(new Rect(menuPos.x - 5, menuPos.y, 310, 400), "CameraPlus"); GUI.Box(new Rect(menuPos.x - 5, menuPos.y, 310, 400), "CameraPlus"); @@ -123,8 +128,8 @@ void OnGUI() parentBehaviour.ThirdPerson = parentBehaviour.Config.thirdPerson; parentBehaviour.ThirdPersonPos = parentBehaviour.Config.Position; parentBehaviour.ThirdPersonRot = parentBehaviour.Config.Rotation; - //FirstPersonOffset = Config.FirstPersonPositionOffset; - // FirstPersonRotationOffset = Config.FirstPersonRotationOffset; + // FirstPersonOffset = Config.FirstPersonPositionOffset; + // FirstPersonRotationOffset = Config.FirstPersonRotationOffset; parentBehaviour.CreateScreenRenderTexture(); parentBehaviour.CloseContextMenu(); parentBehaviour.Config.Save(); @@ -174,7 +179,7 @@ void OnGUI() parentBehaviour.Config.Save(); parentBehaviour.CloseContextMenu(); } - //Layer + // Layer GUI.Box(new Rect(menuPos.x, menuPos.y + 65, 290, 70), "Layer: " + parentBehaviour.Config.layer); if (GUI.Button(new Rect(menuPos.x, menuPos.y + 85, 140, 30), new GUIContent("-"))) { @@ -188,7 +193,7 @@ void OnGUI() parentBehaviour.CreateScreenRenderTexture(); parentBehaviour.Config.Save(); } - //FOV + // FOV GUI.Box(new Rect(menuPos.x, menuPos.y + 125, 290, 70), "FOV: " + parentBehaviour.Config.fov); if (GUI.Button(new Rect(menuPos.x, menuPos.y + 145, 140, 30), new GUIContent("-"))) { @@ -204,7 +209,7 @@ void OnGUI() parentBehaviour.CreateScreenRenderTexture(); parentBehaviour.Config.Save(); } - //Render Scale + // Render Scale GUI.Box(new Rect(menuPos.x, menuPos.y + 185, 290, 70), "Render Scale: " + parentBehaviour.Config.renderScale.ToString("F1")); if (GUI.Button(new Rect(menuPos.x, menuPos.y + 205, 140, 30), new GUIContent("-"))) { diff --git a/CameraPlus/Plugin.cs b/CameraPlus/Plugin.cs index 655d0cc..fd8122d 100644 --- a/CameraPlus/Plugin.cs +++ b/CameraPlus/Plugin.cs @@ -46,7 +46,7 @@ public void OnApplicationStart() { Logger.Log($"Failed to apply harmony patches! {ex}", LogLevel.Error); } - + // Add our default cameraplus camera CameraUtilities.AddNewCamera(Plugin.MainCamera); @@ -62,7 +62,7 @@ private IEnumerator DelayedActiveSceneChanged(Scene from, Scene to) { yield return new WaitForSeconds(0.5f); // If any new cameras have been added to the config folder, render them - // if(to.name == ) + // if(to.name == ) CameraUtilities.ReloadCameras(); if (ActiveSceneChanged != null) @@ -89,13 +89,15 @@ public void OnApplicationQuit() } public void OnSceneLoaded(Scene scene, LoadSceneMode sceneMode) { } + public void OnSceneUnloaded(Scene scene) { } + public void OnUpdate() { } public void OnFixedUpdate() { // Fix the cursor when the user resizes the main camera to be smaller than the canvas size and they hover over the black portion of the canvas - if (CameraPlusBehaviour.currentCursor != CameraPlusBehaviour.CursorType.None && !CameraPlusBehaviour.anyInstanceBusy && + if (CameraPlusBehaviour.currentCursor != CameraPlusBehaviour.CursorType.None && !CameraPlusBehaviour.anyInstanceBusy && CameraPlusBehaviour.wasWithinBorder && CameraPlusBehaviour.GetTopmostInstanceAtCursorPos() == null) { CameraPlusBehaviour.SetCursor(CameraPlusBehaviour.CursorType.None); diff --git a/CameraPlus/ScreenCameraBehaviour.cs b/CameraPlus/ScreenCameraBehaviour.cs index 093c4b2..62abef4 100644 --- a/CameraPlus/ScreenCameraBehaviour.cs +++ b/CameraPlus/ScreenCameraBehaviour.cs @@ -32,7 +32,7 @@ public void Awake() _cam.cullingMask = 0; _cam.stereoTargetEye = StereoTargetEyeMask.None; } - + private void OnRenderImage(RenderTexture src, RenderTexture dest) { if (_renderTexture == null) return; diff --git a/CameraPlus/TransparentWallsPatch.cs b/CameraPlus/TransparentWallsPatch.cs index a2613ec..fef4e89 100644 --- a/CameraPlus/TransparentWallsPatch.cs +++ b/CameraPlus/TransparentWallsPatch.cs @@ -7,6 +7,7 @@ namespace CameraPlus public class TransparentWallsPatch { public static int WallLayerMask = 25; + public static void Postfix(StretchableCube __instance) { __instance.gameObject.layer = WallLayerMask; diff --git a/CameraPlus/Utilities.cs b/CameraPlus/Utilities.cs index 577d2a2..ce97801 100644 --- a/CameraPlus/Utilities.cs +++ b/CameraPlus/Utilities.cs @@ -32,7 +32,7 @@ public static Texture2D LoadTextureFromResources(string resourcePath) private static Dictionary _cachedImages = new Dictionary(); public static System.Drawing.Image LoadImageFromResources(string resourcePath) { - if(!_cachedImages.ContainsKey(resourcePath)) + if (!_cachedImages.ContainsKey(resourcePath)) _cachedImages.Add(resourcePath, new System.Drawing.Bitmap(Assembly.GetCallingAssembly().GetManifestResourceStream(resourcePath))); return _cachedImages[resourcePath]; }