Compare commits
3 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 7e118874ce | |||
| 1c8b0cbdc3 | |||
| 65c276b617 |
@@ -2,6 +2,8 @@
|
||||
|
||||
A [ResoniteModLoader](https://github.com/resonite-modding-group/ResoniteModLoader) mod for [Resonite](https://resonite.com/) that is a library which allows modders to use [ImGuiUnityInject](https://github.com/art0007i/ImGuiUnityInject) in resonite.
|
||||
|
||||
Example usage can be found here: https://github.com/art0007i/ImGuiExample
|
||||
|
||||
## Installation
|
||||
1. Install [ResoniteModLoader](https://github.com/resonite-modding-group/ResoniteModLoader).
|
||||
1. Place [ResoniteImGuiLib.dll](https://github.com/art0007i/ResoniteImGuiLib/releases/latest/download/ResoniteImGuiLib.dll) into your `rml_mods` folder. This folder should be at `C:\Program Files (x86)\Steam\steamapps\common\Resonite\rml_mods` for a default install. You can create it if it's missing, or if you launch the game once with ResoniteModLoader installed it will create the folder for you.
|
||||
|
||||
@@ -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")]
|
||||
|
||||
@@ -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<FrooxEngineRunner>().OverlayCamera;
|
||||
if (isNew)
|
||||
{
|
||||
gui._camera = SceneManager.GetActiveScene().GetRootGameObjects().Where(go => go.name == "FrooxEngine").First().GetComponent<FrooxEngineRunner>().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<string, (bool, bool)> 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;
|
||||
|
||||
Reference in New Issue
Block a user