add F11 to fullscreen

This commit is contained in:
NotAKidoS 2023-04-11 15:08:13 -05:00
parent af265f09ce
commit 1fcdd63a35
5 changed files with 64 additions and 39 deletions

View file

@ -1,33 +1,54 @@
using ABI_RC.Systems.Camera; using ABI_RC.Systems.Camera;
using HarmonyLib; using HarmonyLib;
using NAK.Melons.PortableCameraAdditions.VisualMods;
using UnityEngine; using UnityEngine;
namespace NAK.Melons.PortableCameraAdditions.HarmonyPatches; namespace NAK.Melons.PortableCameraAdditions.HarmonyPatches;
[HarmonyPatch] [HarmonyPatch]
internal class HarmonyPatches internal class PortableCameraPatches
{ {
[HarmonyPostfix] [HarmonyPostfix]
[HarmonyPatch(typeof(PortableCamera), "Start")] [HarmonyPatch(typeof(PortableCamera), nameof(PortableCamera.Start))]
private static void Postfix_PortableCamera_Start(ref PortableCamera __instance) private static void Postfix_PortableCamera_Start(ref PortableCamera __instance)
{ {
//run mod.Setup() instead of registering full mod with icon //run mod.Setup() instead of registering full mod with icon
AdditionalSettings mainMod = new AdditionalSettings(); VisualMods.CameraAdditions mainMod = new VisualMods.CameraAdditions();
mainMod.Setup(__instance); mainMod.Setup(__instance);
} }
[HarmonyPostfix] [HarmonyPostfix]
[HarmonyPatch(typeof(PortableCamera), "OnWorldLoaded")] [HarmonyPatch(typeof(PortableCamera), nameof(PortableCamera.OnWorldLoaded))]
private static void Postfix_PortableCamera_OnWorldLoaded(Camera worldCamera) private static void Postfix_PortableCamera_OnWorldLoaded(Camera worldCamera)
{ {
AdditionalSettings.Instance?.OnWorldLoaded(worldCamera); VisualMods.CameraAdditions.Instance?.OnWorldLoaded(worldCamera);
} }
[HarmonyPostfix] [HarmonyPostfix]
[HarmonyPatch(typeof(PortableCamera), "UpdateOptionsDisplay")] [HarmonyPatch(typeof(PortableCamera), nameof(PortableCamera.UpdateOptionsDisplay))]
private static void Postfix_PortableCamera_UpdateOptionsDisplay(ref bool ____showExpertSettings) private static void Postfix_PortableCamera_UpdateOptionsDisplay(ref bool ____showExpertSettings)
{ {
AdditionalSettings.Instance?.OnUpdateOptionsDisplay(____showExpertSettings); VisualMods.CameraAdditions.Instance?.OnUpdateOptionsDisplay(____showExpertSettings);
}
[HarmonyPostfix]
[HarmonyPatch(typeof(PortableCamera), nameof(PortableCamera.Update))]
private static void Postfix_PortableCamera_Update(ref PortableCamera __instance)
{
if (Input.GetKeyDown(KeyCode.F11))
{
bool flag = __instance.mode == MirroringMode.NoMirror;
__instance.mode = (flag) ? MirroringMode.Mirror : MirroringMode.NoMirror;
__instance.mirroringActive.SetActive(flag);
__instance.mirroringCanvas.gameObject.SetActive(flag);
}
}
[HarmonyPostfix]
[HarmonyPatch(typeof(PortableCamera), nameof(PortableCamera.OnDisable))]
private static void Postfix_PortableCamera_OnDisable(ref PortableCamera __instance)
{
__instance.mode = MirroringMode.NoMirror;
__instance.mirroringActive.SetActive(false);
__instance.mirroringCanvas.gameObject.SetActive(false);
} }
} }

View file

@ -6,6 +6,7 @@
<ImplicitUsings>enable</ImplicitUsings> <ImplicitUsings>enable</ImplicitUsings>
<LangVersion>latest</LangVersion> <LangVersion>latest</LangVersion>
<GenerateAssemblyInfo>false</GenerateAssemblyInfo> <GenerateAssemblyInfo>false</GenerateAssemblyInfo>
<AllowUnsafeBlocks>True</AllowUnsafeBlocks>
</PropertyGroup> </PropertyGroup>
<ItemGroup> <ItemGroup>
@ -16,49 +17,52 @@
<ItemGroup> <ItemGroup>
<Reference Include="0Harmony"> <Reference Include="0Harmony">
<HintPath>C:\Program Files (x86)\Steam\steamapps\common\ChilloutVR\MelonLoader\0Harmony.dll</HintPath> <HintPath>C:\Users\krist\Documents\GitHub\_ChilloutVR Modding\_ManagedLibs\0Harmony.dll</HintPath>
</Reference> </Reference>
<Reference Include="Assembly-CSharp"> <Reference Include="Assembly-CSharp">
<HintPath>C:\Program Files (x86)\Steam\steamapps\common\ChilloutVR\ChilloutVR_Data\Managed\Assembly-CSharp.dll</HintPath> <HintPath>C:\Users\krist\Documents\GitHub\_ChilloutVR Modding\_ManagedLibs\Assembly-CSharp.dll</HintPath>
</Reference> </Reference>
<Reference Include="Assembly-CSharp-firstpass"> <Reference Include="Assembly-CSharp-firstpass">
<HintPath>..\..\..\..\..\..\..\Program Files (x86)\Steam\steamapps\common\ChilloutVR\ChilloutVR_Data\Managed\Assembly-CSharp-firstpass.dll</HintPath> <HintPath>C:\Users\krist\Documents\GitHub\_ChilloutVR Modding\_ManagedLibs\Assembly-CSharp-firstpass.dll</HintPath>
</Reference> </Reference>
<Reference Include="BTKUILib"> <Reference Include="BTKUILib">
<HintPath>..\..\..\..\..\..\..\Program Files (x86)\Steam\steamapps\common\ChilloutVR\Mods\BTKUILib.dll</HintPath> <HintPath>C:\Program Files (x86)\Steam\steamapps\common\ChilloutVR\Mods\BTKUILib.dll</HintPath>
</Reference> </Reference>
<Reference Include="Cohtml.Runtime"> <Reference Include="Cohtml.Runtime">
<HintPath>..\..\..\..\..\..\..\Program Files (x86)\Steam\steamapps\common\ChilloutVR\ChilloutVR_Data\Managed\Cohtml.Runtime.dll</HintPath> <HintPath>C:\Users\krist\Documents\GitHub\_ChilloutVR Modding\_ManagedLibs\Cohtml.Runtime.dll</HintPath>
</Reference> </Reference>
<Reference Include="MelonLoader"> <Reference Include="MelonLoader">
<HintPath>C:\Program Files (x86)\Steam\steamapps\common\ChilloutVR\MelonLoader\MelonLoader.dll</HintPath> <HintPath>C:\Users\krist\Documents\GitHub\_ChilloutVR Modding\_ManagedLibs\MelonLoader.dll</HintPath>
</Reference> </Reference>
<Reference Include="Unity.Postprocessing.Runtime"> <Reference Include="Unity.Postprocessing.Runtime">
<HintPath>..\..\..\..\..\..\..\Program Files (x86)\Steam\steamapps\common\ChilloutVR\ChilloutVR_Data\Managed\Unity.Postprocessing.Runtime.dll</HintPath> <HintPath>C:\Users\krist\Documents\GitHub\_ChilloutVR Modding\_ManagedLibs\Unity.Postprocessing.Runtime.dll</HintPath>
</Reference> </Reference>
<Reference Include="Unity.TextMeshPro"> <Reference Include="Unity.TextMeshPro">
<HintPath>..\..\..\..\..\..\..\Program Files (x86)\Steam\steamapps\common\ChilloutVR\ChilloutVR_Data\Managed\Unity.TextMeshPro.dll</HintPath> <HintPath>C:\Users\krist\Documents\GitHub\_ChilloutVR Modding\_ManagedLibs\Unity.TextMeshPro.dll</HintPath>
</Reference> </Reference>
<Reference Include="UnityEngine"> <Reference Include="UnityEngine">
<HintPath>..\..\..\..\..\..\..\Program Files (x86)\Steam\steamapps\common\ChilloutVR\ChilloutVR_Data\Managed\UnityEngine.dll</HintPath> <HintPath>C:\Users\krist\Documents\GitHub\_ChilloutVR Modding\_ManagedLibs\UnityEngine.dll</HintPath>
</Reference> </Reference>
<Reference Include="UnityEngine.AssetBundleModule"> <Reference Include="UnityEngine.AssetBundleModule">
<HintPath>..\..\..\..\..\..\..\Program Files (x86)\Steam\steamapps\common\ChilloutVR\ChilloutVR_Data\Managed\UnityEngine.AssetBundleModule.dll</HintPath> <HintPath>C:\Users\krist\Documents\GitHub\_ChilloutVR Modding\_ManagedLibs\UnityEngine.AssetBundleModule.dll</HintPath>
</Reference> </Reference>
<Reference Include="UnityEngine.CoreModule"> <Reference Include="UnityEngine.CoreModule">
<HintPath>C:\Program Files (x86)\Steam\steamapps\common\ChilloutVR\ChilloutVR_Data\Managed\UnityEngine.CoreModule.dll</HintPath> <HintPath>C:\Users\krist\Documents\GitHub\_ChilloutVR Modding\_ManagedLibs\UnityEngine.CoreModule.dll</HintPath>
</Reference> </Reference>
<Reference Include="UnityEngine.ImageConversionModule"> <Reference Include="UnityEngine.ImageConversionModule">
<HintPath>..\..\..\..\..\..\..\Program Files (x86)\Steam\steamapps\common\ChilloutVR\ChilloutVR_Data\Managed\UnityEngine.ImageConversionModule.dll</HintPath> <HintPath>C:\Users\krist\Documents\GitHub\_ChilloutVR Modding\_ManagedLibs\UnityEngine.ImageConversionModule.dll</HintPath>
</Reference> </Reference>
<Reference Include="UnityEngine.InputLegacyModule"> <Reference Include="UnityEngine.InputLegacyModule">
<HintPath>C:\Program Files (x86)\Steam\steamapps\common\ChilloutVR\ChilloutVR_Data\Managed\UnityEngine.InputLegacyModule.dll</HintPath> <HintPath>C:\Users\krist\Documents\GitHub\_ChilloutVR Modding\_ManagedLibs\UnityEngine.InputLegacyModule.dll</HintPath>
</Reference> </Reference>
<Reference Include="UnityEngine.PhysicsModule"> <Reference Include="UnityEngine.PhysicsModule">
<HintPath>..\..\..\..\..\..\..\Program Files (x86)\Steam\steamapps\common\ChilloutVR\ChilloutVR_Data\Managed\UnityEngine.PhysicsModule.dll</HintPath> <HintPath>C:\Users\krist\Documents\GitHub\_ChilloutVR Modding\_ManagedLibs\UnityEngine.PhysicsModule.dll</HintPath>
</Reference> </Reference>
<Reference Include="UnityEngine.UI"> <Reference Include="UnityEngine.UI">
<HintPath>..\..\..\..\..\..\..\Program Files (x86)\Steam\steamapps\common\ChilloutVR\ChilloutVR_Data\Managed\UnityEngine.UI.dll</HintPath> <HintPath>C:\Users\krist\Documents\GitHub\_ChilloutVR Modding\_ManagedLibs\UnityEngine.UI.dll</HintPath>
</Reference>
<Reference Include="UnityEngine.UIModule">
<HintPath>..\..\..\_ManagedLibs\UnityEngine.UIModule.dll</HintPath>
</Reference> </Reference>
</ItemGroup> </ItemGroup>

View file

@ -25,6 +25,6 @@ using System.Reflection;
namespace NAK.Melons.PortableCameraAdditions.Properties; namespace NAK.Melons.PortableCameraAdditions.Properties;
internal static class AssemblyInfoParams internal static class AssemblyInfoParams
{ {
public const string Version = "1.0.1"; public const string Version = "1.0.2";
public const string Author = "NotAKidoS"; public const string Author = "NotAKidoS";
} }

View file

@ -3,9 +3,9 @@ using UnityEngine;
namespace NAK.Melons.PortableCameraAdditions.VisualMods; namespace NAK.Melons.PortableCameraAdditions.VisualMods;
public class AdditionalSettings public class CameraAdditions
{ {
public static AdditionalSettings Instance; public static CameraAdditions Instance;
public Camera referenceCamera; public Camera referenceCamera;
public bool orthographicMode; public bool orthographicMode;
@ -25,7 +25,7 @@ public class AdditionalSettings
{ {
Instance = this; Instance = this;
__instance.@interface.AddAndGetHeader(null, typeof(AdditionalSettings), "Additional Settings"); __instance.@interface.AddAndGetHeader(null, typeof(CameraAdditions), "Additional Settings");
//Basic Settings //Basic Settings
@ -33,7 +33,7 @@ public class AdditionalSettings
setting_CopyWorldNearClip.BoolChanged = new Action<bool>(value => UpdateCameraSettingBool("CopyNearClip", value)); setting_CopyWorldNearClip.BoolChanged = new Action<bool>(value => UpdateCameraSettingBool("CopyNearClip", value));
setting_CopyWorldNearClip.SettingName = "CopyNearClip"; setting_CopyWorldNearClip.SettingName = "CopyNearClip";
setting_CopyWorldNearClip.DisplayName = "Copy World Near Clip"; setting_CopyWorldNearClip.DisplayName = "Copy World Near Clip";
setting_CopyWorldNearClip.OriginType = typeof(AdditionalSettings); setting_CopyWorldNearClip.OriginType = typeof(CameraAdditions);
setting_CopyWorldNearClip.DefaultValue = true; setting_CopyWorldNearClip.DefaultValue = true;
setting_CopyWorldNearClip.Load(); setting_CopyWorldNearClip.Load();
@ -41,7 +41,7 @@ public class AdditionalSettings
setting_CopyWorldFarClip.BoolChanged = new Action<bool>(value => UpdateCameraSettingBool("CopyFarClip", value)); setting_CopyWorldFarClip.BoolChanged = new Action<bool>(value => UpdateCameraSettingBool("CopyFarClip", value));
setting_CopyWorldFarClip.SettingName = "CopyFarClip"; setting_CopyWorldFarClip.SettingName = "CopyFarClip";
setting_CopyWorldFarClip.DisplayName = "Copy World Far Clip"; setting_CopyWorldFarClip.DisplayName = "Copy World Far Clip";
setting_CopyWorldFarClip.OriginType = typeof(AdditionalSettings); setting_CopyWorldFarClip.OriginType = typeof(CameraAdditions);
setting_CopyWorldFarClip.DefaultValue = true; setting_CopyWorldFarClip.DefaultValue = true;
setting_CopyWorldFarClip.Load(); setting_CopyWorldFarClip.Load();
@ -52,7 +52,7 @@ public class AdditionalSettings
setting_Orthographic.SettingName = "Orthographic"; setting_Orthographic.SettingName = "Orthographic";
setting_Orthographic.DisplayName = "Orthographic"; setting_Orthographic.DisplayName = "Orthographic";
setting_Orthographic.isExpertSetting = true; setting_Orthographic.isExpertSetting = true;
setting_Orthographic.OriginType = typeof(AdditionalSettings); setting_Orthographic.OriginType = typeof(CameraAdditions);
setting_Orthographic.DefaultValue = false; setting_Orthographic.DefaultValue = false;
setting_Orthographic.Load(); setting_Orthographic.Load();
@ -63,7 +63,7 @@ public class AdditionalSettings
setting_NearClip.SettingName = "NearClip"; setting_NearClip.SettingName = "NearClip";
setting_NearClip.DisplayName = "Near Clip Plane"; setting_NearClip.DisplayName = "Near Clip Plane";
setting_NearClip.isExpertSetting = true; setting_NearClip.isExpertSetting = true;
setting_NearClip.OriginType = typeof(AdditionalSettings); setting_NearClip.OriginType = typeof(CameraAdditions);
setting_NearClip.DefaultValue = 0.01f; setting_NearClip.DefaultValue = 0.01f;
setting_NearClip.MinValue = 0.001f; setting_NearClip.MinValue = 0.001f;
setting_NearClip.MaxValue = 5000f; setting_NearClip.MaxValue = 5000f;
@ -74,7 +74,7 @@ public class AdditionalSettings
setting_FarClip.SettingName = "FarClip"; setting_FarClip.SettingName = "FarClip";
setting_FarClip.DisplayName = "Far Clip Plane"; setting_FarClip.DisplayName = "Far Clip Plane";
setting_FarClip.isExpertSetting = true; setting_FarClip.isExpertSetting = true;
setting_FarClip.OriginType = typeof(AdditionalSettings); setting_FarClip.OriginType = typeof(CameraAdditions);
setting_FarClip.DefaultValue = 1000f; setting_FarClip.DefaultValue = 1000f;
setting_FarClip.MinValue = 0.002f; setting_FarClip.MinValue = 0.002f;
setting_FarClip.MaxValue = 5000f; setting_FarClip.MaxValue = 5000f;
@ -87,7 +87,7 @@ public class AdditionalSettings
setting_OrthographicSize.SettingName = "OrthographicSize"; setting_OrthographicSize.SettingName = "OrthographicSize";
setting_OrthographicSize.DisplayName = "Orthographic Size"; setting_OrthographicSize.DisplayName = "Orthographic Size";
setting_OrthographicSize.isExpertSetting = true; setting_OrthographicSize.isExpertSetting = true;
setting_OrthographicSize.OriginType = typeof(AdditionalSettings); setting_OrthographicSize.OriginType = typeof(CameraAdditions);
setting_OrthographicSize.DefaultValue = 5f; setting_OrthographicSize.DefaultValue = 5f;
setting_OrthographicSize.MinValue = 0.01f; setting_OrthographicSize.MinValue = 0.01f;
setting_OrthographicSize.MaxValue = 150f; setting_OrthographicSize.MaxValue = 150f;
@ -98,7 +98,7 @@ public class AdditionalSettings
setting_OrthographicNearClip.SettingName = "OrthographicNearClip"; setting_OrthographicNearClip.SettingName = "OrthographicNearClip";
setting_OrthographicNearClip.DisplayName = "Orthographic Near"; setting_OrthographicNearClip.DisplayName = "Orthographic Near";
setting_OrthographicNearClip.isExpertSetting = true; setting_OrthographicNearClip.isExpertSetting = true;
setting_OrthographicNearClip.OriginType = typeof(AdditionalSettings); setting_OrthographicNearClip.OriginType = typeof(CameraAdditions);
setting_OrthographicNearClip.DefaultValue = 0.001f; setting_OrthographicNearClip.DefaultValue = 0.001f;
setting_OrthographicNearClip.MinValue = -5000f; setting_OrthographicNearClip.MinValue = -5000f;
setting_OrthographicNearClip.MaxValue = 5000f; setting_OrthographicNearClip.MaxValue = 5000f;
@ -109,7 +109,7 @@ public class AdditionalSettings
setting_OrthographicFarClip.SettingName = "OrthographicFarClip"; setting_OrthographicFarClip.SettingName = "OrthographicFarClip";
setting_OrthographicFarClip.DisplayName = "Orthographic Far"; setting_OrthographicFarClip.DisplayName = "Orthographic Far";
setting_OrthographicFarClip.isExpertSetting = true; setting_OrthographicFarClip.isExpertSetting = true;
setting_OrthographicFarClip.OriginType = typeof(AdditionalSettings); setting_OrthographicFarClip.OriginType = typeof(CameraAdditions);
setting_OrthographicFarClip.DefaultValue = 1000f; setting_OrthographicFarClip.DefaultValue = 1000f;
setting_OrthographicFarClip.MinValue = -5000f; setting_OrthographicFarClip.MinValue = -5000f;
setting_OrthographicFarClip.MaxValue = 5000f; setting_OrthographicFarClip.MaxValue = 5000f;

View file

@ -1,12 +1,12 @@
{ {
"_id": 123, "_id": 123,
"name": "PortableCameraAdditions", "name": "PortableCameraAdditions",
"modversion": "1.0.1", "modversion": "1.0.2",
"gameversion": "2022r170", "gameversion": "2022r170",
"loaderversion": "0.5.7", "loaderversion": "0.5.7",
"modtype": "Mod", "modtype": "Mod",
"author": "NotAKidoS", "author": "NotAKidoS",
"description": "Adds a few basic settings to the Portable Camera.\n\nExpert settings for Near Clip & Far Clip.\nExpert settings for Orthographic & Orthographic Size.\nBy default, Near Clip & Far Clip are copied on world load.", "description": "Adds a few basic settings to the Portable Camera.\n\nExpert settings for Near Clip & Far Clip.\nExpert settings for Orthographic & Orthographic Size.\nBy default, Near Clip & Far Clip are copied on world load.\nF11 to fullscreen on Desktop.",
"searchtags": [ "searchtags": [
"camera", "camera",
"settings", "settings",
@ -18,8 +18,8 @@
"requirements": [ "requirements": [
"None" "None"
], ],
"downloadlink": "https://github.com/NotAKidOnSteam/PortableCameraAdditions/releases/download/v1.0.1/PortableCameraAdditions.dll", "downloadlink": "https://github.com/NotAKidOnSteam/PortableCameraAdditions/releases/download/v1.0.2/PortableCameraAdditions.dll",
"sourcelink": "https://github.com/NotAKidOnSteam/PortableCameraAdditions/", "sourcelink": "https://github.com/NotAKidOnSteam/PortableCameraAdditions/",
"changelog": "Imagine not actually setting stuff on world load.", "changelog": "Added F11 bind to fullscreen Portable Camera on Desktop.",
"embedcolor": "9b59b6" "embedcolor": "9b59b6"
} }