player char select

This commit is contained in:
Cameron Taylor 2023-12-11 02:40:58 -05:00
parent 181e3f85b8
commit 9ffffe9c8a

View file

@ -2089,8 +2089,26 @@ class ChartEditorState extends UIState // UIState derives from MusicBeatState
healthIconBF.zIndex = 30;
FlxMouseEvent.add(healthIconDad, function(_) {
trace("clicked dad");
createAndOpenCharSelect(1);
});
FlxMouseEvent.add(healthIconBF, function(_) {
createAndOpenCharSelect(0);
});
}
/**
* @param charType 0 == BF, 1 == Dad
*/
function createAndOpenCharSelect(charType:Int = 0):Void
{
var charData = currentSongMetadata.playData.characters;
var currentChar:String = switch (charType)
{
case 0: charData.player;
case 1: charData.opponent;
default: throw 'Invalid charType: ' + charType;
};
var toolbox:CollapsibleDialog = cast haxe.ui.RuntimeComponentBuilder.fromAsset(Paths.ui('chart-editor/toolbox/iconselector'));
toolbox.showDialog(false);
var scrollView = toolbox.findComponent('charSelectScroll');
@ -2123,12 +2141,17 @@ class ChartEditorState extends UIState // UIState derives from MusicBeatState
image.width = 70;
image.height = 70;
if (char == currentSongMetadata.playData.characters.opponent) image.selected = true;
if (char == currentChar) image.selected = true;
image.icon = CharacterDataParser.getCharPixelIconAsset(char);
image.onClick = _ -> {
healthIconsDirty = true;
currentSongMetadata.playData.characters.opponent = char;
switch (charType)
{
case 0: currentSongMetadata.playData.characters.player = char;
case 1: currentSongMetadata.playData.characters.opponent = char;
default: throw 'Invalid charType: ' + charType;
};
toolbox.hideDialog(haxe.ui.containers.dialogs.Dialog.DialogButton.APPLY);
// var label = toolbox.findComponent('charIconName');
@ -2144,11 +2167,6 @@ class ChartEditorState extends UIState // UIState derives from MusicBeatState
toolbox.x = FlxG.mouse.screenX;
toolbox.y = FlxG.mouse.screenY;
});
FlxMouseEvent.add(healthIconBF, function(_) {
trace("clicked bf");
});
}
function buildNotePreview():Void