From 968c6e05605632317c3e482fe4123664532e037f Mon Sep 17 00:00:00 2001 From: Abbysssal Date: Wed, 23 Feb 2022 11:50:41 +0700 Subject: [PATCH] :sparkles: Implement refreshing of custom interactions menu --- RogueLibsCore/Interactions/InteractionModel.cs | 4 ++-- RogueLibsCore/Patches/Patches_Interactions.cs | 3 ++- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/RogueLibsCore/Interactions/InteractionModel.cs b/RogueLibsCore/Interactions/InteractionModel.cs index 81aaf0eaf..f0eb3969b 100644 --- a/RogueLibsCore/Interactions/InteractionModel.cs +++ b/RogueLibsCore/Interactions/InteractionModel.cs @@ -111,8 +111,8 @@ public void OnPressedButton(string buttonName) return; } - // TODO: re-render the menu; this might be really complicated - + // refresh the buttons (restarts the cycle) + Agent.worldSpaceGUI.StartCoroutine(Agent.worldSpaceGUI.RefreshObjectButtons2(Object)); } } diff --git a/RogueLibsCore/Patches/Patches_Interactions.cs b/RogueLibsCore/Patches/Patches_Interactions.cs index df27695af..b6b36871f 100644 --- a/RogueLibsCore/Patches/Patches_Interactions.cs +++ b/RogueLibsCore/Patches/Patches_Interactions.cs @@ -123,7 +123,8 @@ public static bool InteractHook(PlayfieldObject __instance, Agent agent) __instance.playerInvDatabase = agent.GetComponent(); #endregion - __instance.ShowObjectButtons(); + if (__instance.buttons.Count > 0) + __instance.ShowObjectButtons(); return false; } // unnecessary?