2022-03-08 03:13:53 -05:00
|
|
|
package funkin.ui;
|
2021-02-21 13:08:30 -05:00
|
|
|
|
2022-03-08 03:13:53 -05:00
|
|
|
import funkin.ui.AtlasText;
|
|
|
|
import funkin.ui.MenuList;
|
2021-02-21 13:08:30 -05:00
|
|
|
|
2021-02-23 19:55:24 -05:00
|
|
|
class TextMenuList extends MenuTypedList<TextMenuItem>
|
2021-02-21 13:08:30 -05:00
|
|
|
{
|
2021-03-26 21:22:07 -04:00
|
|
|
public function new(navControls:NavControls = Vertical, ?wrapMode)
|
2021-02-21 13:08:30 -05:00
|
|
|
{
|
2021-03-22 08:48:52 -04:00
|
|
|
super(navControls, wrapMode);
|
2021-02-21 13:08:30 -05:00
|
|
|
}
|
2021-03-26 21:22:07 -04:00
|
|
|
|
2022-03-29 21:56:04 -04:00
|
|
|
public function createItem(x = 0.0, y = 0.0, name:String, font:AtlasFont = BOLD, callback, fireInstantly = false)
|
2021-02-21 13:08:30 -05:00
|
|
|
{
|
2021-02-23 19:55:24 -05:00
|
|
|
var item = new TextMenuItem(x, y, name, font, callback);
|
2021-02-21 13:08:30 -05:00
|
|
|
item.fireInstantly = fireInstantly;
|
|
|
|
return addItem(name, item);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2021-02-23 19:55:24 -05:00
|
|
|
class TextMenuItem extends TextTypedMenuItem<AtlasText>
|
2021-02-21 13:08:30 -05:00
|
|
|
{
|
2022-03-29 21:56:04 -04:00
|
|
|
public function new(x = 0.0, y = 0.0, name:String, font:AtlasFont = BOLD, callback)
|
2021-02-21 13:08:30 -05:00
|
|
|
{
|
2021-02-23 19:55:24 -05:00
|
|
|
super(x, y, new AtlasText(0, 0, name, font), name, callback);
|
|
|
|
setEmptyBackground();
|
2021-02-21 13:08:30 -05:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2021-02-23 19:55:24 -05:00
|
|
|
class TextTypedMenuItem<T:AtlasText> extends MenuTypedItem<T>
|
2021-02-21 13:08:30 -05:00
|
|
|
{
|
2021-03-26 21:22:07 -04:00
|
|
|
public function new(x = 0.0, y = 0.0, label:T, name:String, callback)
|
2021-02-21 13:08:30 -05:00
|
|
|
{
|
|
|
|
super(x, y, label, name, callback);
|
|
|
|
}
|
2021-03-26 21:22:07 -04:00
|
|
|
|
|
|
|
override function setItem(name:String, ?callback:Void->Void)
|
2021-02-21 13:08:30 -05:00
|
|
|
{
|
|
|
|
if (label != null)
|
|
|
|
{
|
|
|
|
label.text = name;
|
2021-03-16 10:56:08 -04:00
|
|
|
label.alpha = alpha;
|
2021-02-21 13:08:30 -05:00
|
|
|
width = label.width;
|
|
|
|
height = label.height;
|
|
|
|
}
|
2021-03-26 21:22:07 -04:00
|
|
|
|
2021-02-21 13:08:30 -05:00
|
|
|
super.setItem(name, callback);
|
|
|
|
}
|
2021-03-26 21:22:07 -04:00
|
|
|
|
2021-02-21 13:08:30 -05:00
|
|
|
override function set_label(value:T):T
|
|
|
|
{
|
|
|
|
super.set_label(value);
|
|
|
|
setItem(name, callback);
|
|
|
|
return value;
|
|
|
|
}
|
2021-03-26 21:22:07 -04:00
|
|
|
}
|