diff --git a/assets/images/editors/ui/context-icons.png b/assets/images/editors/ui/context-icons.png index 7bf46448..91976656 100644 Binary files a/assets/images/editors/ui/context-icons.png and b/assets/images/editors/ui/context-icons.png differ diff --git a/source/funkin/editors/charter/Charter.hx b/source/funkin/editors/charter/Charter.hx index e8bf93e4..cb2b7522 100644 --- a/source/funkin/editors/charter/Charter.hx +++ b/source/funkin/editors/charter/Charter.hx @@ -1,5 +1,6 @@ package funkin.editors.charter; +import funkin.editors.ui.UIContextMenu.UIContextMenuOptionSpr; import funkin.editors.ui.UITopMenu.UITopMenuButton; import funkin.editors.charter.CharterStrumline; import funkin.editors.charter.CharterBackdropGroup.EventBackdrop; @@ -268,6 +269,22 @@ class Charter extends UIState { onSelect: _note_selectmeasure }, null, + { + label: "Add Note Type", + closeOnSelect: false, + onSelect: function (p) {trace(p);} + }, + { + label: "Edit Note Type", + closeOnSelect: false, + onSelect: function (p) {trace(p);} + }, + { + label: "Delete Note Type", + closeOnSelect: false, + onSelect: function (p) {trace(p);} + }, + null, { label: "(0) Default Note", keybind: [ZERO] @@ -1426,6 +1443,31 @@ class Charter extends UIState { onSelect: _note_selectmeasure }, null, + { + label: "Add Note Type", + color: 0xFF1E8020, icon: 2, + onCreate: function (button:UIContextMenuOptionSpr) {button.label.offset.x = button.icon.offset.x = -2;}, + closeOnSelect: false, + onSelect: function (_) { + var addButton:UIContextMenuOptionSpr = _.button; + trace(addButton, addButton.label.text); + }, + }, + { + label: "Edit Note Type", + color: 0xFF959829, icon: 4, + onCreate: function (button:UIContextMenuOptionSpr) {button.label.offset.x = button.icon.offset.x = -2;}, + closeOnSelect: false, + onSelect: function (p) {trace(p);}, + }, + { + label: "Delete Note Type", + color: 0xFF8F2222, icon: 3, + onCreate: function (button:UIContextMenuOptionSpr) {button.label.offset.x = button.icon.offset.x = -2; button.icon.offset.y = -1;}, + closeOnSelect: false, + onSelect: function (p) {trace(p);}, + }, + null, { label: "(0) Default Note", keybind: [ZERO], diff --git a/source/funkin/editors/ui/UIContextMenu.hx b/source/funkin/editors/ui/UIContextMenu.hx index 8a60a0ff..89132e98 100644 --- a/source/funkin/editors/ui/UIContextMenu.hx +++ b/source/funkin/editors/ui/UIContextMenu.hx @@ -1,5 +1,7 @@ package funkin.editors.ui; +import flixel.util.FlxColor; +import flixel.util.typeLimit.OneOfTwo; import flixel.input.keyboard.FlxKey; class UIContextMenu extends MusicBeatSubstate { @@ -55,6 +57,9 @@ class UIContextMenu extends MusicBeatSubstate { lastY = spr.y + spr.bHeight; contextMenuOptions.push(spr); add(spr); + + o.button = spr; + if (o.onCreate != null) o.onCreate(spr); } var maxW = bg.bWidth - 8; @@ -86,7 +91,8 @@ class UIContextMenu extends MusicBeatSubstate { option.onSelect(option); if (callback != null) callback(this, index, option); - close(); + if (option.closeOnSelect == null ? true : option.closeOnSelect) + close(); } public override function update(elapsed:Float) { @@ -115,9 +121,12 @@ typedef UIContextMenuOption = { var ?keybind:Array; var ?keybinds:Array>; var ?keybindText:String; - var ?color:Int; + var ?closeOnSelect:Bool; + var ?color:FlxColor; var ?icon:Int; var ?onSelect:UIContextMenuOption->Void; + var ?button:UIContextMenuOptionSpr; + var ?onCreate:UIContextMenuOptionSpr->Void; var ?childs:Array; } @@ -172,7 +181,9 @@ class UIContextMenuOptionSpr extends UISliceSprite { } public override function draw() { - alpha = hovered ? 1 : 0; + alpha = option.color == null ? (hovered ? 1 : 0) : 1; + if (option.color != null) color = hovered ? option.color.getDarkened(.4) : option.color; + label.follow(this, 20, 2); if (icon != null) icon.follow(this, 0, 0);