ok i added the buttons
This commit is contained in:
Binary file not shown.
|
Before Width: | Height: | Size: 1.1 KiB After Width: | Height: | Size: 1021 B |
@@ -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],
|
||||
|
||||
@@ -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<FlxKey>;
|
||||
var ?keybinds:Array<Array<FlxKey>>;
|
||||
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<UIContextMenuOption>;
|
||||
}
|
||||
|
||||
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user