Skip to content

Commit

Permalink
fix(input): hide ui interaction when menu is not open (#76)
Browse files Browse the repository at this point in the history
  • Loading branch information
Xenira committed Jan 19, 2024
1 parent 1675887 commit 0b5fa2a
Show file tree
Hide file tree
Showing 13 changed files with 14 additions and 2 deletions.
1 change: 1 addition & 0 deletions .github/FUNDING.yml
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
liberapay: rip3.141
github: Xenira
2 changes: 1 addition & 1 deletion README.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ ifndef::env-github[]
endif::[]
:icons: font
:source-highlighter: highlightjs
:game-version: 0.2.0h
:game-version: 0.2.1c
:repo: Xenira/TechtonicaVR

image:https://img.shields.io/github/v/release/{repo}["GitHub release (with filter)", link="https://github.com/{repo}/releases/latest"]
Expand Down
Binary file modified icon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion plugin/src/TechtonicaVR.cs
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@

namespace TechtonicaVR;

[BepInPlugin("de.xenira.techtonica", MyPluginInfo.PLUGIN_NAME, MyPluginInfo.PLUGIN_VERSION)]
[BepInPlugin("de.xenira.techtonicavr", MyPluginInfo.PLUGIN_NAME, MyPluginInfo.PLUGIN_VERSION)]
[BepInProcess("Techtonica.exe")]
[BepInDependency("Tobey.UnityAudio", BepInDependency.DependencyFlags.SoftDependency)]
public class TechtonicaVR : BaseUnityPlugin
Expand Down
7 changes: 7 additions & 0 deletions plugin/src/input/ui/InteractableUi.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
using System.Collections.Generic;
using System.Linq;
using TechtonicaVR.UI;
using TechtonicaVR.Util;
using UnityEngine;
using UnityEngine.UI;
Expand All @@ -12,6 +13,7 @@ public abstract class InteractableUi
public List<Interactable> interactable = new List<Interactable>();
public UiEnterEvent OnEnterEvent;
public UiExitEvent OnExitEvent;
public Menu menu;

public Transform transform;
protected ScrollRect scrollRect;
Expand Down Expand Up @@ -39,6 +41,11 @@ public UiRaycastHit Raycast(Ray ray)
return null;
}

if (menu?.isOpen() == false)
{
return null;
}

if (getUiPlane().Raycast(ray, out var distance))
{
var point = ray.GetPoint(distance);
Expand Down
2 changes: 2 additions & 0 deletions plugin/src/patch/main_game/ui/IaCMenuPatch.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using TechtonicaVR.Input.Ui;
using TechtonicaVR.UI;
using TechtonicaVR.Util;
using UnityEngine;

Expand Down Expand Up @@ -34,6 +35,7 @@ protected override bool Apply(GameObject gameObject)

var menu = new InventoryInteractableUI(playerInventory.gameObject);
menu.transform = inventoryAnchor.transform;
menu.menu = new UIMenuWrapper(iac);
menu.OnEnterEvent += () =>
{
iac.inventoryHasFocus = true;
Expand Down
2 changes: 2 additions & 0 deletions plugin/src/ui/patch/UiMenuPatch.cs
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,8 @@ public static void OnClosePostfix(UIMenu __instance)

lastPosition = Vector3.zero;
lastCamOrigin = Vector3.zero;

getWorldAnchor().transform.position = Vector3.zero;
}

[HarmonyPatch(typeof(FHG_Utils), nameof(FHG_Utils.ToggleAlpha))]
Expand Down
Binary file modified strip-dll/Assembly-CSharp-firstpass.dll
Binary file not shown.
Binary file modified strip-dll/Assembly-CSharp.dll
Binary file not shown.
Binary file modified strip-dll/Unity.Postprocessing.Runtime.dll
Binary file not shown.
Binary file modified strip-dll/Unity.XR.Management.dll
Binary file not shown.
Binary file modified strip-dll/UnityEngine.SubsystemsModule.dll
Binary file not shown.
Binary file modified strip-dll/UnityEngine.UI.dll
Binary file not shown.

0 comments on commit 0b5fa2a

Please sign in to comment.