Skip to content

Commit

Permalink
[Fix] Using SkipText() on the first frame of a text object's creation…
Browse files Browse the repository at this point in the history
… causes the text to stay invisible
  • Loading branch information
RhenaudTheLukark committed May 18, 2024
1 parent 916a77f commit 2f4ffb2
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 6 deletions.
3 changes: 2 additions & 1 deletion Assets/Scripts/Lua/CLRBindings/LuaTextManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -651,8 +651,9 @@ public void HideBubble() {
}

public override void SkipLine() {
if (noSkip1stFrame) return;
CheckExists();
if (lateStartWaiting)
LateStartSetText();
if (GlobalControls.isInFight && EnemyEncounter.script.GetVar("playerskipdocommand").Boolean
|| UnitaleUtil.IsOverworld && (EventManager.instance.script != null && EventManager.instance.script.GetVar("playerskipdocommand").Boolean
|| GlobalControls.isInShop && GameObject.Find("Canvas").GetComponent<ShopScript>().script.GetVar("playerskipdocommand").Boolean))
Expand Down
6 changes: 1 addition & 5 deletions Assets/Scripts/Text/TextManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,6 @@ public float rotation {
//public string[] mugshotsPath;
//public bool overworld;
[MoonSharpHidden] public bool skipNowIfBlocked = false;
internal bool noSkip1stFrame = true;

[MoonSharpHidden] public bool lateStartWaiting = false; // Lua text objects will use a late start
public TextManager() {
Expand Down Expand Up @@ -457,7 +456,7 @@ [MoonSharpHidden] public void DoSkipFromPlayer() {
}

public virtual void SkipLine() {
if (noSkip1stFrame) return;
if (lateStartWaiting) return;
foreach (LetterData d in letters)
d.image.enabled = true;
currentCharacter = textQueue[currentLine].Text.Length;
Expand Down Expand Up @@ -599,7 +598,6 @@ private void MoveLetter(string currentText, int letterIndex) {
}

protected virtual void SpawnText() {
noSkip1stFrame = true;
string currentText = textQueue[currentLine].Text;
letters.Clear();
if (currentText.Length > 1 && GetAutoLineBreak())
Expand Down Expand Up @@ -878,8 +876,6 @@ protected virtual void Update() {
}
}
}

noSkip1stFrame = false;
}

private void HandleShowLettersOnce(ref bool soundPlayed, ref int lastLetter) {
Expand Down

0 comments on commit 2f4ffb2

Please sign in to comment.