From f8e2abd623b8ce6ae82254dd933332bad259fb76 Mon Sep 17 00:00:00 2001 From: RhenaudTheLukark Date: Fri, 15 Mar 2024 11:23:04 +0100 Subject: [PATCH] [Fix] Encounter text skipped after exiting a battle submenu --- Assets/Scripts/Battle/UIController.cs | 10 ++-------- Assets/Scripts/Lua/CLRBindings/LuaTextManager.cs | 2 +- Assets/Scripts/Text/TextManager.cs | 2 +- 3 files changed, 4 insertions(+), 10 deletions(-) diff --git a/Assets/Scripts/Battle/UIController.cs b/Assets/Scripts/Battle/UIController.cs index 63ad4dad3..ca98dfda3 100644 --- a/Assets/Scripts/Battle/UIController.cs +++ b/Assets/Scripts/Battle/UIController.cs @@ -783,18 +783,14 @@ private void HandleAction() { case Actions.FIGHT: if (encounter.EnabledEnemies.Length > 0) SwitchState("ENEMYSELECT"); - else - mainTextManager.DoSkipFromPlayer(); break; case Actions.ACT: if (GlobalControls.crate) if (ControlPanel.instance.Safe) UnitaleUtil.PlaySound("MEOW", "sounds/meow" + Math.RandomRange(1, 8)); - else UnitaleUtil.PlaySound("MEOW", "sounds/meow" + Math.RandomRange(1, 9)); + else UnitaleUtil.PlaySound("MEOW", "sounds/meow" + Math.RandomRange(1, 9)); else if (encounter.EnabledEnemies.Length > 0) SwitchState("ENEMYSELECT"); - else - mainTextManager.DoSkipFromPlayer(); break; case Actions.ITEM: @@ -807,9 +803,7 @@ private void HandleAction() { } else { if (Inventory.inventory.Count == 0) { - //ActionDialogResult(new TextMessage("Your Inventory is empty.", true, false), UIState.ACTIONSELECT); PlaySound(AudioClipRegistry.GetSound("menuconfirm")); - mainTextManager.DoSkipFromPlayer(); return; } SwitchState("ITEMMENU"); @@ -1076,7 +1070,7 @@ private void HandleCancel() { switch (state) { case "ACTIONSELECT": case "DIALOGRESULT": - if (mainTextManager.CanSkip() &&!mainTextManager.LineComplete()) + if (mainTextManager.CanSkip() && !mainTextManager.LineComplete()) mainTextManager.DoSkipFromPlayer(); break; diff --git a/Assets/Scripts/Lua/CLRBindings/LuaTextManager.cs b/Assets/Scripts/Lua/CLRBindings/LuaTextManager.cs index 93c377ab2..1ee33209b 100644 --- a/Assets/Scripts/Lua/CLRBindings/LuaTextManager.cs +++ b/Assets/Scripts/Lua/CLRBindings/LuaTextManager.cs @@ -123,7 +123,7 @@ protected override void Update() { } if (CanAutoSkipAny() && (!UIController.instance || !UIController.instance.monsterDialogues.Contains(this))) NextLine(); - if (CanSkip() && !LineComplete() && GlobalControls.input.Cancel == ButtonState.PRESSED) + if (GlobalControls.input.Cancel == ButtonState.PRESSED && CanSkip() && !LineComplete() && (!UIController.instance || this != UIController.instance.mainTextManager || !UIController.instance.stateSwitched)) DoSkipFromPlayer(); } diff --git a/Assets/Scripts/Text/TextManager.cs b/Assets/Scripts/Text/TextManager.cs index 4d2debd3e..b051a0377 100644 --- a/Assets/Scripts/Text/TextManager.cs +++ b/Assets/Scripts/Text/TextManager.cs @@ -45,7 +45,7 @@ public LetterData(int index, Image image, Sprite sprite, Vector2 position, bool [MoonSharpHidden] public int _textMaxWidth; public int currentCharacter; public int currentReferenceCharacter; - private bool currentSkippable = true; + public bool currentSkippable = true; private bool decoratedTextOffset; private RectTransform self;