Add a setter for the text variable in the Alphabet class

This commit is contained in:
Sword352
2023-07-04 08:26:17 +02:00
committed by GitHub
parent 029cdaa032
commit 809ee45264
+12 -13
View File
@@ -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()