Skip to content

Commit

Permalink
fix(ui): remove button prompts (#80)
Browse files Browse the repository at this point in the history
  • Loading branch information
Xenira committed Jan 23, 2024
1 parent b5680dc commit b9e9605
Show file tree
Hide file tree
Showing 5 changed files with 57 additions and 1 deletion.
2 changes: 1 addition & 1 deletion .github/workflows/release-please.yml
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ jobs:
run: |
gh release upload ${{ steps.release.outputs.tag_name }} techtonica_vr-${{ steps.release.outputs.tag_name }}.zip --repo Xenira/TechtonicaVR
- name: Upload to Thunderstore
uses: GreenTF/upload-thunderstore-package@v4.1
uses: GreenTF/upload-thunderstore-package@v4.3
if: ${{ steps.release.outputs.release_created }}
with:
namespace: "3_141"
Expand Down
1 change: 1 addition & 0 deletions plugin/src/MainGamePatch.cs
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ void Start()
new StorageInventoryUIPatch(),
new IaCMenuPatch(),
new SaveNotificationPatch(),
new HudPatch(),
]).ToArray();

Logger.LogDebug("Hello World!");
Expand Down
18 changes: 18 additions & 0 deletions plugin/src/patch/main_game/ui/HudPatch.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
using TechtonicaVR.Util;

namespace TechtonicaVR.Patches.MainGame.UI;

public class HudPatch : GameComponentPatch<HUD>
{
protected override bool Apply(HUD component)
{
var buttonMappingsCanvas = GameObjectFinder.FindChildObjectByName("Button Mappings Canvas", component.gameObject);
if (buttonMappingsCanvas == null)
{
return false;
}

buttonMappingsCanvas.SetActive(false);
return true;
}
}
8 changes: 8 additions & 0 deletions plugin/src/patch/main_game/ui/IaCMenuPatch.cs
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,12 @@ protected override bool Apply(GameObject gameObject)
return false;
}

var allButtonMappings = GameObjectFinder.FindChildObjectByName("All Button Mappings", iac.gameObject);
if (allButtonMappings != null)
{
allButtonMappings.SetActive(false);
}

var inventoryAnchor = new GameObject("Inventory UI Anchor");
inventoryAnchor.transform.parent = iac.transform;
inventoryAnchor.transform.localPosition = new Vector3(-616, -600, 0);
Expand All @@ -42,6 +48,8 @@ protected override bool Apply(GameObject gameObject)
iac.Refresh();
};

allButtonMappings.SetActive(false);

return true;
}
}
29 changes: 29 additions & 0 deletions plugin/src/ui/patch/UiMenuPatch.cs
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,35 @@ public static void StartPostfix(UIMenu __instance)
{
canvas.transform.localScale = ModConfig.menuScale.Value;
}

disableButtonPrompts(__instance);
}

private static void disableButtonPrompts(UIMenu __instance)
{
var mkbButtonPrompts = __instance.gameObject.GetComponentsInChildren<MKBInventoryButtonPrompts>();
foreach (var buttonPrompt in mkbButtonPrompts)
{
buttonPrompt.gameObject.SetActive(false);
}

var controllerButtonPrompts = __instance.gameObject.GetComponentsInChildren<ControllerInventoryButtonPrompts>();
foreach (var buttonPrompt in controllerButtonPrompts)
{
buttonPrompt.gameObject.SetActive(false);
}

var simpleMkbButtonPrompts = GameObjectFinder.FindChildObjectsByName("MKB Inventory Button Prompts", __instance.gameObject);
foreach (var buttonPrompt in simpleMkbButtonPrompts)
{
buttonPrompt.gameObject.SetActive(false);
}

var simpleControllerButtonPrompts = GameObjectFinder.FindChildObjectsByName("Controller Button Prompts", __instance.gameObject);
foreach (var buttonPrompt in simpleControllerButtonPrompts)
{
buttonPrompt.gameObject.SetActive(false);
}
}

private static GameObject findTlc(GameObject gameObject)
Expand Down

0 comments on commit b9e9605

Please sign in to comment.