Keybind text

This commit is contained in:
NeeEoo
2023-08-05 22:38:35 +02:00
parent 641328e701
commit 4c98b8b6cd
2 changed files with 13 additions and 8 deletions
+11 -6
View File
@@ -114,6 +114,7 @@ typedef UIContextMenuOption = {
var label:String;
var ?keybind:Array<FlxKey>;
var ?keybinds:Array<Array<FlxKey>>;
var ?keybindText:String;
var ?icon:Int;
var ?onSelect:UIContextMenuOption->Void;
var ?childs:Array<UIContextMenuOption>;
@@ -144,14 +145,18 @@ class UIContextMenuOptionSpr extends UISliceSprite {
}
}
if (option.keybinds != null) {
var textKeys:Array<String> = [];
for (o in option.keybinds[0]) {
if (Std.int(o) > 0) {
textKeys.push(o.toUIString());
if (option.keybinds != null || option.keybindText != null) {
var text = if(option.keybindText == null) {
var textKeys:Array<String> = [];
for (o in option.keybinds[0]) {
if (Std.int(o) > 0) {
textKeys.push(o.toUIString());
}
}
textKeys.join("+");
} else {
option.keybindText;
}
var text = textKeys.join("+");
labelKeybind = new UIText(label.x + label.frameWidth + 10, 2, 0, text);
labelKeybind.alpha = 0.75;
}