From 809ee452648a6a8ebfcbbfe305640078ac379363 Mon Sep 17 00:00:00 2001 From: Sword352 <99792114+Sword352@users.noreply.github.com> Date: Tue, 4 Jul 2023 08:26:17 +0200 Subject: [PATCH] Add a setter for the text variable in the Alphabet class --- source/funkin/menus/ui/Alphabet.hx | 25 ++++++++++++------------- 1 file changed, 12 insertions(+), 13 deletions(-) diff --git a/source/funkin/menus/ui/Alphabet.hx b/source/funkin/menus/ui/Alphabet.hx index c885898e..50a8db46 100644 --- a/source/funkin/menus/ui/Alphabet.hx +++ b/source/funkin/menus/ui/Alphabet.hx @@ -23,7 +23,7 @@ class Alphabet extends FlxSpriteGroup public var targetY:Float = 0; public var isMenuItem:Bool = false; - public var text:String = ""; + public var text(default, set):String = ""; var _finalText:String = ""; var _curText:String = ""; @@ -51,6 +51,16 @@ class Alphabet extends FlxSpriteGroup return super.set_color(c); } + private function set_text(v:String):String { + text = v; + if (text != "") { + if (typed) + startTypedText(); + else + addText(); + } + } + // TODO: fix this shit refreshing public function refreshAlphabetXML(path:String) { AlphaCharacter.__alphaPath = path; @@ -84,7 +94,6 @@ class Alphabet extends FlxSpriteGroup { super(x, y); - _finalText = this.text = text; isBold = bold; var alphabetPath = Paths.xml("alphabet"); @@ -111,17 +120,7 @@ class Alphabet extends FlxSpriteGroup } #end - if (text != "") - { - if (typed) - { - startTypedText(); - } - else - { - addText(); - } - } + _finalText = this.text = text; } public function addText()