diff --git a/ResoniteImGuiLib/Properties/AssemblyInfo.cs b/ResoniteImGuiLib/Properties/AssemblyInfo.cs index 9e8785b..c6d795e 100644 --- a/ResoniteImGuiLib/Properties/AssemblyInfo.cs +++ b/ResoniteImGuiLib/Properties/AssemblyInfo.cs @@ -9,7 +9,7 @@ using System.Runtime.InteropServices; [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("art0007i")] [assembly: AssemblyProduct("ResoniteImGuiLib")] -[assembly: AssemblyCopyright("Copyright © 2023")] +[assembly: AssemblyCopyright("Copyright © 2025")] [assembly: AssemblyTrademark("")] [assembly: AssemblyCulture("")] @@ -31,5 +31,5 @@ using System.Runtime.InteropServices; // You can specify all the values or you can default the Build and Revision Numbers // by using the '*' as shown below: // [assembly: AssemblyVersion("1.0.*")] -[assembly: AssemblyVersion("1.0.0")] -[assembly: AssemblyFileVersion("1.0.0")] +[assembly: AssemblyVersion("1.1.0")] +[assembly: AssemblyFileVersion("1.1.0")] diff --git a/ResoniteImGuiLib/ResoniteImGuiLib.cs b/ResoniteImGuiLib/ResoniteImGuiLib.cs index abb3a78..10cb735 100644 --- a/ResoniteImGuiLib/ResoniteImGuiLib.cs +++ b/ResoniteImGuiLib/ResoniteImGuiLib.cs @@ -8,6 +8,7 @@ using ImGuiUnityInject; using UnityEngine.SceneManagement; using System.Linq; using UnityFrooxEngineRunner; +using System.Collections.Generic; namespace ResoniteImGuiLib; @@ -19,9 +20,17 @@ public static class ImGuiLib } public static ImGuiInstance GetOrCreateInstance(string name = "global", ImGuiReady onReady = null) { - return ImGuiInstance.GetOrCreate((gui, isNew) => + return ImGuiInstance.GetOrCreate(name, (gui, isNew) => { - if (isNew) gui._camera = SceneManager.GetActiveScene().GetRootGameObjects().Where(go => go.name == "FrooxEngine").First().GetComponent().OverlayCamera; + if (isNew) + { + gui._camera = SceneManager.GetActiveScene().GetRootGameObjects().Where(go => go.name == "FrooxEngine").First().GetComponent().OverlayCamera; + gui.Layout += () => + { + var io = ImGui.GetIO(); + ResoniteImGuiLib.WantCapture[name] = (io.WantCaptureMouse, io.WantCaptureKeyboard); + }; + } if (onReady != null) onReady(gui, isNew); else gui.enabled = true; @@ -33,21 +42,21 @@ public class ResoniteImGuiLib : ResoniteMod { public override string Name => "ResoniteImGuiLib"; public override string Author => "art0007i"; - public override string Version => "1.0.0"; + public override string Version => "1.1.0"; public override string Link => "https://github.com/art0007i/ResoniteImGuiLib/"; public override void OnEngineInit() { Harmony harmony = new Harmony("me.art0007i.ResoniteImGuiLib"); harmony.PatchAll(); } + internal static Dictionary WantCapture = new(); [HarmonyPatch(typeof(MouseDriver), "UpdateMouse")] class CursorUpdatePatch { public static bool Prefix(Mouse mouse) { - var io = ImGui.GetIO(); - if (io.WantCaptureMouse) + if (WantCapture.Any(x=>x.Value.Item1)) { mouse.LeftButton.UpdateState(false); mouse.RightButton.UpdateState(false); @@ -72,7 +81,7 @@ public class ResoniteImGuiLib : ResoniteMod { public static bool Prefix() { - if (ImGui.GetIO().WantCaptureKeyboard) + if (WantCapture.Any(x => x.Value.Item2)) { return false; } @@ -84,7 +93,7 @@ public class ResoniteImGuiLib : ResoniteMod { public static bool Prefix(ref bool __result) { - if (ImGui.GetIO().WantCaptureKeyboard) + if (WantCapture.Any(x => x.Value.Item2)) { __result = false; return false;