Skip to content

Commit

Permalink
[Fix] Encounter text skipped after exiting a battle submenu
Browse files Browse the repository at this point in the history
  • Loading branch information
RhenaudTheLukark committed Mar 15, 2024
1 parent b863ffd commit f8e2abd
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 10 deletions.
10 changes: 2 additions & 8 deletions Assets/Scripts/Battle/UIController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand All @@ -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");
Expand Down Expand Up @@ -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;

Expand Down
2 changes: 1 addition & 1 deletion Assets/Scripts/Lua/CLRBindings/LuaTextManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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();
}

Expand Down
2 changes: 1 addition & 1 deletion Assets/Scripts/Text/TextManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down

0 comments on commit f8e2abd

Please sign in to comment.