character selector

This commit is contained in:
Cameron Taylor 2023-12-11 03:38:44 -05:00
parent 9ffffe9c8a
commit 05f977f85f

View file

@ -2089,11 +2089,11 @@ class ChartEditorState extends UIState // UIState derives from MusicBeatState
healthIconBF.zIndex = 30; healthIconBF.zIndex = 30;
FlxMouseEvent.add(healthIconDad, function(_) { FlxMouseEvent.add(healthIconDad, function(_) {
createAndOpenCharSelect(1); if (!isCursorOverHaxeUI) createAndOpenCharSelect(1);
}); });
FlxMouseEvent.add(healthIconBF, function(_) { FlxMouseEvent.add(healthIconBF, function(_) {
createAndOpenCharSelect(0); if (!isCursorOverHaxeUI) createAndOpenCharSelect(0);
}); });
} }
@ -2110,7 +2110,28 @@ class ChartEditorState extends UIState // UIState derives from MusicBeatState
default: throw 'Invalid charType: ' + charType; default: throw 'Invalid charType: ' + charType;
}; };
var toolbox:CollapsibleDialog = cast haxe.ui.RuntimeComponentBuilder.fromAsset(Paths.ui('chart-editor/toolbox/iconselector')); var toolbox:CollapsibleDialog = cast haxe.ui.RuntimeComponentBuilder.fromAsset(Paths.ui('chart-editor/toolbox/iconselector'));
toolbox.title += " - " + switch (charType)
{
case 0: "Player";
case 1: "Opponent";
default: throw 'Invalid charType: ' + charType;
};
var _overlay = new Component();
_overlay.id = "modal-background";
_overlay.addClass("modal-background");
_overlay.percentWidth = _overlay.percentHeight = 100;
_overlay.opacity = 0;
FlxTween.tween(_overlay, {opacity: 0.2}, 0.1, {ease: FlxEase.quartOut});
_overlay.onClick = function(_) {
toolbox.hideDialog(haxe.ui.containers.dialogs.Dialog.DialogButton.CANCEL);
Screen.instance.removeComponent(_overlay);
};
Screen.instance.addComponent(_overlay);
toolbox.showDialog(false); toolbox.showDialog(false);
toolbox.closable = false;
var scrollView = toolbox.findComponent('charSelectScroll'); var scrollView = toolbox.findComponent('charSelectScroll');
var hbox = new Grid(); var hbox = new Grid();
@ -2153,7 +2174,7 @@ class ChartEditorState extends UIState // UIState derives from MusicBeatState
default: throw 'Invalid charType: ' + charType; default: throw 'Invalid charType: ' + charType;
}; };
toolbox.hideDialog(haxe.ui.containers.dialogs.Dialog.DialogButton.APPLY); toolbox.hideDialog(haxe.ui.containers.dialogs.Dialog.DialogButton.APPLY);
Screen.instance.removeComponent(_overlay);
// var label = toolbox.findComponent('charIconName'); // var label = toolbox.findComponent('charIconName');
// label.text = char; // label.text = char;
}; };
@ -2165,8 +2186,8 @@ class ChartEditorState extends UIState // UIState derives from MusicBeatState
hbox.addComponent(image); hbox.addComponent(image);
} }
toolbox.x = FlxG.mouse.screenX; toolbox.x = FlxG.mouse.screenX - toolbox.width / 2;
toolbox.y = FlxG.mouse.screenY; toolbox.y = FlxG.mouse.screenY - 16;
} }
function buildNotePreview():Void function buildNotePreview():Void