diff --git a/assets b/assets index 3c8ac202b..7d5968187 160000 --- a/assets +++ b/assets @@ -1 +1 @@ -Subproject commit 3c8ac202bbb93bf84c7dcd0697a9d7121d3c5283 +Subproject commit 7d59681870d2b73417a9f5b553720e8b7120bbde diff --git a/hmm.json b/hmm.json index 0f06acaa7..a10eed1a6 100644 --- a/hmm.json +++ b/hmm.json @@ -49,14 +49,14 @@ "name": "haxeui-core", "type": "git", "dir": null, - "ref": "5d4ac180f85b39e72624f4b8d17925d91ebe4278", + "ref": "032192e849cdb7d1070c0a3241c58ee555ffaccc", "url": "https://github.com/haxeui/haxeui-core" }, { "name": "haxeui-flixel", "type": "git", "dir": null, - "ref": "89a4cf621e5c204922f7a12fbde5d1d84f8b47f5", + "ref": "d90758b229d05206400df867d333c79d9fdbd478", "url": "https://github.com/haxeui/haxeui-flixel" }, { diff --git a/source/funkin/play/character/CharacterData.hx b/source/funkin/play/character/CharacterData.hx index abe8bf992..16cc8b299 100644 --- a/source/funkin/play/character/CharacterData.hx +++ b/source/funkin/play/character/CharacterData.hx @@ -280,6 +280,36 @@ class CharacterDataParser return characterCache.keys().array(); } + /** + * TODO: Hardcode this. + */ + public static function getCharPixelIconAsset(char:String):String + { + var icon:String = char; + + switch (icon) + { + case "bf-christmas" | "bf-car" | "bf-pixel" | "bf-holding-gf": + icon = "bf"; + case "monster-christmas": + icon = "monster"; + case "mom" | "mom-car": + icon = "mommy"; + case "pico-blazin" | "pico-playable" | "pico-speaker": + icon = "pico"; + case "gf-christmas" | "gf-car" | "gf-pixel" | "gf-tankmen": + icon = "gf"; + case "dad": + icon = "daddy"; + case "darnell-blazin": + icon = "darnell"; + case "senpai-angry": + icon = "senpai"; + } + + return Paths.image("freeplay/icons/" + icon + "pixel"); + } + /** * Clears the character data cache. */ diff --git a/source/funkin/ui/debug/charting/ChartEditorState.hx b/source/funkin/ui/debug/charting/ChartEditorState.hx index 96516ae02..df31fb267 100644 --- a/source/funkin/ui/debug/charting/ChartEditorState.hx +++ b/source/funkin/ui/debug/charting/ChartEditorState.hx @@ -1,6 +1,9 @@ package funkin.ui.debug.charting; import funkin.util.logging.CrashHandler; +import haxe.ui.containers.HBox; +import haxe.ui.containers.Grid; +import haxe.ui.containers.ScrollView; import haxe.ui.containers.menus.MenuBar; import flixel.addons.display.FlxSliceSprite; import flixel.addons.display.FlxTiledSprite; @@ -106,6 +109,8 @@ import haxe.ui.containers.menus.MenuItem; import haxe.ui.containers.menus.MenuCheckBox; import haxe.ui.containers.TreeView; import haxe.ui.containers.TreeViewNode; +import haxe.ui.components.Image; +import funkin.ui.debug.charting.toolboxes.ChartEditorBaseToolbox; import haxe.ui.core.Component; import haxe.ui.core.Screen; import haxe.ui.events.DragEvent; @@ -117,6 +122,7 @@ import openfl.display.BitmapData; import funkin.audio.visualize.PolygonSpectogram; import flixel.group.FlxGroup.FlxTypedGroup; import funkin.audio.visualize.PolygonVisGroup; +import flixel.input.mouse.FlxMouseEvent; import flixel.text.FlxText; using Lambda; @@ -142,6 +148,7 @@ class ChartEditorState extends UIState // UIState derives from MusicBeatState public static final CHART_EDITOR_TOOLBOX_NOTEDATA_LAYOUT:String = Paths.ui('chart-editor/toolbox/notedata'); public static final CHART_EDITOR_TOOLBOX_EVENTDATA_LAYOUT:String = Paths.ui('chart-editor/toolbox/eventdata'); + public static final CHART_EDITOR_TOOLBOX_PLAYTEST_PROPERTIES_LAYOUT:String = Paths.ui('chart-editor/toolbox/playtest-properties'); public static final CHART_EDITOR_TOOLBOX_METADATA_LAYOUT:String = Paths.ui('chart-editor/toolbox/metadata'); public static final CHART_EDITOR_TOOLBOX_DIFFICULTY_LAYOUT:String = Paths.ui('chart-editor/toolbox/difficulty'); public static final CHART_EDITOR_TOOLBOX_PLAYER_PREVIEW_LAYOUT:String = Paths.ui('chart-editor/toolbox/player-preview'); @@ -532,6 +539,11 @@ class ChartEditorState extends UIState // UIState derives from MusicBeatState */ var playtestStartTime:Bool = false; + /** + * If true, playtesting a chart will let you "gameover" / die when you lose ur health! + */ + var playtestPracticeMode:Bool = false; + // Visuals /** @@ -2336,6 +2348,21 @@ class ChartEditorState extends UIState // UIState derives from MusicBeatState if (!Preferences.debugDisplay) menubar.paddingLeft = null; this.setupNotifications(); + + // Setup character dropdowns. + FlxMouseEvent.add(healthIconDad, function(_) { + if (!isCursorOverHaxeUI) + { + this.openCharacterDropdown(CharacterType.DAD, true); + } + }); + + FlxMouseEvent.add(healthIconBF, function(_) { + if (!isCursorOverHaxeUI) + { + this.openCharacterDropdown(CharacterType.BF, true); + } + }); } /** @@ -2376,13 +2403,13 @@ class ChartEditorState extends UIState // UIState derives from MusicBeatState else { Conductor.currentTimeChange.bpm += 1; - refreshMetadataToolbox(); + this.refreshToolbox(CHART_EDITOR_TOOLBOX_METADATA_LAYOUT); } } playbarBPM.onRightClick = _ -> { Conductor.currentTimeChange.bpm -= 1; - refreshMetadataToolbox(); + this.refreshToolbox(CHART_EDITOR_TOOLBOX_METADATA_LAYOUT); } // Add functionality to the menu items. @@ -2507,9 +2534,6 @@ class ChartEditorState extends UIState // UIState derives from MusicBeatState menubarItemDifficultyUp.onClick = _ -> incrementDifficulty(1); menubarItemDifficultyDown.onClick = _ -> incrementDifficulty(-1); - menubarItemPlaytestStartTime.onChange = event -> playtestStartTime = event.value; - menubarItemPlaytestStartTime.selected = playtestStartTime; - menuBarItemThemeLight.onChange = function(event:UIEvent) { if (event.target.value) currentTheme = ChartEditorTheme.Light; }; @@ -2576,6 +2600,7 @@ class ChartEditorState extends UIState // UIState derives from MusicBeatState menubarItemToggleToolboxMetadata.onChange = event -> this.setToolboxState(CHART_EDITOR_TOOLBOX_METADATA_LAYOUT, event.value); menubarItemToggleToolboxNotes.onChange = event -> this.setToolboxState(CHART_EDITOR_TOOLBOX_NOTEDATA_LAYOUT, event.value); menubarItemToggleToolboxEvents.onChange = event -> this.setToolboxState(CHART_EDITOR_TOOLBOX_EVENTDATA_LAYOUT, event.value); + menubarItemToggleToolboxPlaytestProperties.onChange = event -> this.setToolboxState(CHART_EDITOR_TOOLBOX_PLAYTEST_PROPERTIES_LAYOUT, event.value); menubarItemToggleToolboxPlayerPreview.onChange = event -> this.setToolboxState(CHART_EDITOR_TOOLBOX_PLAYER_PREVIEW_LAYOUT, event.value); menubarItemToggleToolboxOpponentPreview.onChange = event -> this.setToolboxState(CHART_EDITOR_TOOLBOX_OPPONENT_PREVIEW_LAYOUT, event.value); @@ -2650,7 +2675,7 @@ class ChartEditorState extends UIState // UIState derives from MusicBeatState * Open the backups folder in the file explorer. * Don't call this on HTML5. */ - function openBackupsFolder():Void + function openBackupsFolder(?_):Void { #if sys // TODO: Is there a way to open a folder and highlight a file in it? @@ -3439,6 +3464,8 @@ class ChartEditorState extends UIState // UIState derives from MusicBeatState var overlapsSelection:Bool = FlxG.mouse.overlaps(renderedSelectionSquares); + var overlapsHealthIcons:Bool = FlxG.mouse.overlaps(healthIconBF) || FlxG.mouse.overlaps(healthIconDad); + if (FlxG.mouse.justPressedMiddle) { if (scrollAnchorScreenPos == null) @@ -3458,11 +3485,11 @@ class ChartEditorState extends UIState // UIState derives from MusicBeatState { scrollAnchorScreenPos = null; } - else if (gridPlayheadScrollArea != null && FlxG.mouse.overlaps(gridPlayheadScrollArea)) + else if (gridPlayheadScrollArea != null && FlxG.mouse.overlaps(gridPlayheadScrollArea) && !isCursorOverHaxeUI) { gridPlayheadScrollAreaPressed = true; } - else if (notePreview != null && FlxG.mouse.overlaps(notePreview)) + else if (notePreview != null && FlxG.mouse.overlaps(notePreview) && !isCursorOverHaxeUI) { // Clicked note preview notePreviewScrollAreaStartPos = new FlxPoint(FlxG.mouse.screenX, FlxG.mouse.screenY); @@ -3914,7 +3941,7 @@ class ChartEditorState extends UIState // UIState derives from MusicBeatState if (FlxG.mouse.justPressed) { // Just clicked to place a note. - if (overlapsGrid && !overlapsSelectionBorder) + if (!isCursorOverHaxeUI && overlapsGrid && !overlapsSelectionBorder) { // We clicked on the grid without moving the mouse. @@ -4059,7 +4086,7 @@ class ChartEditorState extends UIState // UIState derives from MusicBeatState var isOrWillSelect = overlapsSelection || dragTargetNote != null || dragTargetEvent != null; // Handle grid cursor. - if (overlapsGrid && !isOrWillSelect && !overlapsSelectionBorder && !gridPlayheadScrollAreaPressed) + if (!isCursorOverHaxeUI && overlapsGrid && !isOrWillSelect && !overlapsSelectionBorder && !gridPlayheadScrollAreaPressed) { // Indicate that we can place a note here. @@ -4130,26 +4157,33 @@ class ChartEditorState extends UIState // UIState derives from MusicBeatState } else { - if (notePreview != null && FlxG.mouse.overlaps(notePreview)) + if (!isCursorOverHaxeUI) + { + if (notePreview != null && FlxG.mouse.overlaps(notePreview)) + { + targetCursorMode = Pointer; + } + else if (gridPlayheadScrollArea != null && FlxG.mouse.overlaps(gridPlayheadScrollArea)) + { + targetCursorMode = Pointer; + } + else if (overlapsSelection) + { + targetCursorMode = Pointer; + } + else if (overlapsSelectionBorder) + { + targetCursorMode = Crosshair; + } + else if (overlapsGrid) + { + targetCursorMode = Cell; + } + } + else if (overlapsHealthIcons) { targetCursorMode = Pointer; } - else if (gridPlayheadScrollArea != null && FlxG.mouse.overlaps(gridPlayheadScrollArea)) - { - targetCursorMode = Pointer; - } - else if (overlapsSelection) - { - targetCursorMode = Pointer; - } - else if (overlapsSelectionBorder) - { - targetCursorMode = Crosshair; - } - else if (overlapsGrid) - { - targetCursorMode = Cell; - } } } @@ -4180,7 +4214,7 @@ class ChartEditorState extends UIState // UIState derives from MusicBeatState difficultySelectDirty = false; // Manage the Select Difficulty tree view. - var difficultyToolbox:Null = this.getToolbox(CHART_EDITOR_TOOLBOX_DIFFICULTY_LAYOUT); + var difficultyToolbox:Null = this.getToolbox_OLD(CHART_EDITOR_TOOLBOX_DIFFICULTY_LAYOUT); if (difficultyToolbox == null) return; var treeView:Null = difficultyToolbox.findComponent('difficultyToolboxTree'); @@ -4227,7 +4261,7 @@ class ChartEditorState extends UIState // UIState derives from MusicBeatState function handlePlayerPreviewToolbox():Void { // Manage the Select Difficulty tree view. - var charPreviewToolbox:Null = this.getToolbox(CHART_EDITOR_TOOLBOX_PLAYER_PREVIEW_LAYOUT); + var charPreviewToolbox:Null = this.getToolbox_OLD(CHART_EDITOR_TOOLBOX_PLAYER_PREVIEW_LAYOUT); if (charPreviewToolbox == null) return; // TODO: Re-enable the player preview once we figure out the performance issues. @@ -4263,7 +4297,7 @@ class ChartEditorState extends UIState // UIState derives from MusicBeatState function handleOpponentPreviewToolbox():Void { // Manage the Select Difficulty tree view. - var charPreviewToolbox:Null = this.getToolbox(CHART_EDITOR_TOOLBOX_OPPONENT_PREVIEW_LAYOUT); + var charPreviewToolbox:Null = this.getToolbox_OLD(CHART_EDITOR_TOOLBOX_OPPONENT_PREVIEW_LAYOUT); if (charPreviewToolbox == null) return; // TODO: Re-enable the player preview once we figure out the performance issues. @@ -4581,7 +4615,14 @@ class ChartEditorState extends UIState // UIState derives from MusicBeatState } // DELETE = Delete - if (FlxG.keys.justPressed.DELETE) + var delete:Bool = FlxG.keys.justPressed.DELETE; + + // on macbooks, Delete == backspace + #if mac + delete = delete || FlxG.keys.justPressed.BACKSPACE; + #end + + if (delete) { // Delete selected items. if (currentNoteSelection.length > 0 && currentEventSelection.length > 0) @@ -4758,7 +4799,7 @@ class ChartEditorState extends UIState // UIState derives from MusicBeatState targetDifficulty: selectedDifficulty, // TODO: Add this. // targetCharacter: targetCharacter, - practiceMode: true, + practiceMode: playtestPracticeMode, minimalMode: minimal, startTimestamp: startTimestamp, overrideMusic: true, @@ -5013,7 +5054,7 @@ class ChartEditorState extends UIState // UIState derives from MusicBeatState Conductor.mapTimeChanges(this.currentSongMetadata.timeChanges); refreshDifficultyTreeSelection(); - refreshMetadataToolbox(); + this.refreshToolbox(CHART_EDITOR_TOOLBOX_METADATA_LAYOUT); } else { @@ -5022,7 +5063,7 @@ class ChartEditorState extends UIState // UIState derives from MusicBeatState selectedDifficulty = prevDifficulty; refreshDifficultyTreeSelection(); - refreshMetadataToolbox(); + this.refreshToolbox(CHART_EDITOR_TOOLBOX_METADATA_LAYOUT); } } else @@ -5041,7 +5082,7 @@ class ChartEditorState extends UIState // UIState derives from MusicBeatState selectedDifficulty = nextDifficulty; refreshDifficultyTreeSelection(); - refreshMetadataToolbox(); + this.refreshToolbox(CHART_EDITOR_TOOLBOX_METADATA_LAYOUT); } else { @@ -5050,7 +5091,7 @@ class ChartEditorState extends UIState // UIState derives from MusicBeatState selectedDifficulty = nextDifficulty; refreshDifficultyTreeSelection(); - refreshMetadataToolbox(); + this.refreshToolbox(CHART_EDITOR_TOOLBOX_METADATA_LAYOUT); } } @@ -5163,7 +5204,7 @@ class ChartEditorState extends UIState // UIState derives from MusicBeatState if (treeView == null) { // Manage the Select Difficulty tree view. - var difficultyToolbox:Null = this.getToolbox(CHART_EDITOR_TOOLBOX_DIFFICULTY_LAYOUT); + var difficultyToolbox:Null = this.getToolbox_OLD(CHART_EDITOR_TOOLBOX_DIFFICULTY_LAYOUT); if (difficultyToolbox == null) return; treeView = difficultyToolbox.findComponent('difficultyToolboxTree'); @@ -5183,7 +5224,7 @@ class ChartEditorState extends UIState // UIState derives from MusicBeatState { if (treeView == null) { - var difficultyToolbox:Null = this.getToolbox(CHART_EDITOR_TOOLBOX_DIFFICULTY_LAYOUT); + var difficultyToolbox:Null = this.getToolbox_OLD(CHART_EDITOR_TOOLBOX_DIFFICULTY_LAYOUT); if (difficultyToolbox == null) return null; treeView = difficultyToolbox.findComponent('difficultyToolboxTree'); @@ -5227,8 +5268,7 @@ class ChartEditorState extends UIState // UIState derives from MusicBeatState trace('Changing difficulty to "$variation:$difficulty"'); selectedVariation = variation; selectedDifficulty = difficulty; - // refreshDifficultyTreeSelection(treeView); - refreshMetadataToolbox(); + this.refreshToolbox(CHART_EDITOR_TOOLBOX_METADATA_LAYOUT); } // case 'song': // case 'variation': @@ -5237,82 +5277,7 @@ class ChartEditorState extends UIState // UIState derives from MusicBeatState trace('Selected wrong node type, resetting selection.'); var currentTreeDifficultyNode = getCurrentTreeDifficultyNode(treeView); if (currentTreeDifficultyNode != null) treeView.selectedNode = currentTreeDifficultyNode; - refreshMetadataToolbox(); - } - } - - /** - * When the difficulty changes, update the song metadata toolbox to reflect the new data. - */ - function refreshMetadataToolbox():Void - { - var toolbox:Null = this.getToolbox(CHART_EDITOR_TOOLBOX_METADATA_LAYOUT); - if (toolbox == null) return; - - var inputSongName:Null = toolbox.findComponent('inputSongName', TextField); - if (inputSongName != null) inputSongName.value = currentSongMetadata.songName; - - var inputSongArtist:Null = toolbox.findComponent('inputSongArtist', TextField); - if (inputSongArtist != null) inputSongArtist.value = currentSongMetadata.artist; - - var inputStage:Null = toolbox.findComponent('inputStage', DropDown); - if (inputStage != null) inputStage.value = currentSongMetadata.playData.stage; - - var inputNoteStyle:Null = toolbox.findComponent('inputNoteStyle', DropDown); - if (inputNoteStyle != null) inputNoteStyle.value = currentSongMetadata.playData.noteStyle; - - var inputBPM:Null = toolbox.findComponent('inputBPM', NumberStepper); - if (inputBPM != null) inputBPM.value = currentSongMetadata.timeChanges[0].bpm; - - var labelScrollSpeed:Null