From 8cec180353b90c8479b3f3421118efd1052152a3 Mon Sep 17 00:00:00 2001 From: Cameron Taylor Date: Sun, 10 Dec 2023 03:37:12 -0500 Subject: [PATCH 1/5] practice mode in progress --- assets | 2 +- .../ui/debug/charting/ChartEditorState.hx | 9 +++++- .../handlers/ChartEditorToolboxHandler.hx | 29 +++++++++++++++++++ 3 files changed, 38 insertions(+), 2 deletions(-) diff --git a/assets b/assets index 3c8ac202b..b5a90d795 160000 --- a/assets +++ b/assets @@ -1 +1 @@ -Subproject commit 3c8ac202bbb93bf84c7dcd0697a9d7121d3c5283 +Subproject commit b5a90d79524c2e1d770b447bf88bd6ebbe65bd85 diff --git a/source/funkin/ui/debug/charting/ChartEditorState.hx b/source/funkin/ui/debug/charting/ChartEditorState.hx index 66effc775..dc5ef67dc 100644 --- a/source/funkin/ui/debug/charting/ChartEditorState.hx +++ b/source/funkin/ui/debug/charting/ChartEditorState.hx @@ -138,6 +138,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'); @@ -515,6 +516,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 /** @@ -2516,6 +2522,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); @@ -4657,7 +4664,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, diff --git a/source/funkin/ui/debug/charting/handlers/ChartEditorToolboxHandler.hx b/source/funkin/ui/debug/charting/handlers/ChartEditorToolboxHandler.hx index 5834de2ee..28716bd14 100644 --- a/source/funkin/ui/debug/charting/handlers/ChartEditorToolboxHandler.hx +++ b/source/funkin/ui/debug/charting/handlers/ChartEditorToolboxHandler.hx @@ -80,6 +80,8 @@ class ChartEditorToolboxHandler onShowToolboxNoteData(state, toolbox); case ChartEditorState.CHART_EDITOR_TOOLBOX_EVENTDATA_LAYOUT: onShowToolboxEventData(state, toolbox); + case ChartEditorState.CHART_EDITOR_TOOLBOX_PLAYTEST_PROPERTIES_LAYOUT: + onShowToolboxPlaytestProperties(state, toolbox); case ChartEditorState.CHART_EDITOR_TOOLBOX_DIFFICULTY_LAYOUT: onShowToolboxDifficulty(state, toolbox); case ChartEditorState.CHART_EDITOR_TOOLBOX_METADATA_LAYOUT: @@ -117,6 +119,8 @@ class ChartEditorToolboxHandler onHideToolboxNoteData(state, toolbox); case ChartEditorState.CHART_EDITOR_TOOLBOX_EVENTDATA_LAYOUT: onHideToolboxEventData(state, toolbox); + case ChartEditorState.CHART_EDITOR_TOOLBOX_PLAYTEST_PROPERTIES_LAYOUT: + onHideToolboxPlaytestProperties(state, toolbox); case ChartEditorState.CHART_EDITOR_TOOLBOX_DIFFICULTY_LAYOUT: onHideToolboxDifficulty(state, toolbox); case ChartEditorState.CHART_EDITOR_TOOLBOX_METADATA_LAYOUT: @@ -175,6 +179,8 @@ class ChartEditorToolboxHandler toolbox = buildToolboxNoteDataLayout(state); case ChartEditorState.CHART_EDITOR_TOOLBOX_EVENTDATA_LAYOUT: toolbox = buildToolboxEventDataLayout(state); + case ChartEditorState.CHART_EDITOR_TOOLBOX_PLAYTEST_PROPERTIES_LAYOUT: + toolbox = buildToolboxPlaytestPropertiesLayout(state); case ChartEditorState.CHART_EDITOR_TOOLBOX_DIFFICULTY_LAYOUT: toolbox = buildToolboxDifficultyLayout(state); case ChartEditorState.CHART_EDITOR_TOOLBOX_METADATA_LAYOUT: @@ -321,8 +327,12 @@ class ChartEditorToolboxHandler static function onShowToolboxEventData(state:ChartEditorState, toolbox:CollapsibleDialog):Void {} + static function onShowToolboxPlaytestProperties(state:ChartEditorState, toolbox:CollapsibleDialog):Void {} + static function onHideToolboxEventData(state:ChartEditorState, toolbox:CollapsibleDialog):Void {} + static function onHideToolboxPlaytestProperties(state:ChartEditorState, toolbox:CollapsibleDialog):Void {} + static function buildEventDataFormFromSchema(state:ChartEditorState, target:Box, schema:SongEventSchema):Void { trace(schema); @@ -418,6 +428,25 @@ class ChartEditorToolboxHandler } } + static function buildToolboxPlaytestPropertiesLayout(state:ChartEditorState):Null + { + // fill with playtest properties + var toolbox:CollapsibleDialog = cast RuntimeComponentBuilder.fromAsset(ChartEditorState.CHART_EDITOR_TOOLBOX_PLAYTEST_PROPERTIES_LAYOUT); + + if (toolbox == null) return null; + + var checkboxPracticeMode:Null = toolbox.findComponent('practiceModeCheckbox', CheckBox); + if (checkboxPracticeMode == null) throw 'ChartEditorToolboxHandler.buildToolboxPlaytestPropertiesLayout() - Could not find practiceModeCheckbox component.'; + + state.playtestPracticeMode = checkboxPracticeMode.selected; + + checkboxPracticeMode.onClick = _ -> { + state.playtestPracticeMode = checkboxPracticeMode.selected; + }; + + return toolbox; + } + static function buildToolboxDifficultyLayout(state:ChartEditorState):Null { var toolbox:CollapsibleDialog = cast RuntimeComponentBuilder.fromAsset(ChartEditorState.CHART_EDITOR_TOOLBOX_DIFFICULTY_LAYOUT); From 3a70ca4e08e489b502123e52ccc86228f1021e7a Mon Sep 17 00:00:00 2001 From: Cameron Taylor Date: Sun, 10 Dec 2023 03:49:24 -0500 Subject: [PATCH 2/5] menubar selected fix --- assets | 2 +- .../ui/debug/charting/handlers/ChartEditorToolboxHandler.hx | 4 ++++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/assets b/assets index b5a90d795..d29187aea 160000 --- a/assets +++ b/assets @@ -1 +1 @@ -Subproject commit b5a90d79524c2e1d770b447bf88bd6ebbe65bd85 +Subproject commit d29187aeafbb560ec62b15c52fff8c0281912431 diff --git a/source/funkin/ui/debug/charting/handlers/ChartEditorToolboxHandler.hx b/source/funkin/ui/debug/charting/handlers/ChartEditorToolboxHandler.hx index 28716bd14..2876ce2fa 100644 --- a/source/funkin/ui/debug/charting/handlers/ChartEditorToolboxHandler.hx +++ b/source/funkin/ui/debug/charting/handlers/ChartEditorToolboxHandler.hx @@ -435,6 +435,10 @@ class ChartEditorToolboxHandler if (toolbox == null) return null; + toolbox.onDialogClosed = function(_) { + state.menubarItemToggleToolboxPlaytestProperties.selected = false; + } + var checkboxPracticeMode:Null = toolbox.findComponent('practiceModeCheckbox', CheckBox); if (checkboxPracticeMode == null) throw 'ChartEditorToolboxHandler.buildToolboxPlaytestPropertiesLayout() - Could not find practiceModeCheckbox component.'; From c3fa793d971b04ef5e8fa22883a2af261bba79ff Mon Sep 17 00:00:00 2001 From: Cameron Taylor Date: Sun, 10 Dec 2023 04:10:57 -0500 Subject: [PATCH 3/5] adds !isCursorOverHaxeUI around --- .../ui/debug/charting/ChartEditorState.hx | 45 ++++++++++--------- 1 file changed, 24 insertions(+), 21 deletions(-) diff --git a/source/funkin/ui/debug/charting/ChartEditorState.hx b/source/funkin/ui/debug/charting/ChartEditorState.hx index dc5ef67dc..fe538966d 100644 --- a/source/funkin/ui/debug/charting/ChartEditorState.hx +++ b/source/funkin/ui/debug/charting/ChartEditorState.hx @@ -3409,7 +3409,7 @@ class ChartEditorState extends UIState // UIState derives from MusicBeatState { gridPlayheadScrollAreaPressed = true; } - else if (notePreview != null && FlxG.mouse.overlaps(notePreview)) + else if (notePreview != null && !isCursorOverHaxeUI && FlxG.mouse.overlaps(notePreview)) { // Clicked note preview notePreviewScrollAreaStartPos = new FlxPoint(FlxG.mouse.screenX, FlxG.mouse.screenY); @@ -3861,7 +3861,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. @@ -4006,7 +4006,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. @@ -4077,25 +4077,28 @@ class ChartEditorState extends UIState // UIState derives from MusicBeatState } else { - if (notePreview != null && FlxG.mouse.overlaps(notePreview)) + if (!isCursorOverHaxeUI) { - 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; + 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; + } } } } From 43038d0a06cbb828d0ae969215b2f58c7aed8216 Mon Sep 17 00:00:00 2001 From: EliteMasterEric Date: Tue, 12 Dec 2023 17:07:28 -0500 Subject: [PATCH 4/5] Move the "Start at current time" checkbox --- assets | 2 +- source/funkin/ui/debug/charting/ChartEditorState.hx | 3 --- .../charting/handlers/ChartEditorToolboxHandler.hx | 12 +++++++++++- 3 files changed, 12 insertions(+), 5 deletions(-) diff --git a/assets b/assets index d29187aea..dcb65bdb2 160000 --- a/assets +++ b/assets @@ -1 +1 @@ -Subproject commit d29187aeafbb560ec62b15c52fff8c0281912431 +Subproject commit dcb65bdb2a2075dc8d21df5c136a4151a8eea80a diff --git a/source/funkin/ui/debug/charting/ChartEditorState.hx b/source/funkin/ui/debug/charting/ChartEditorState.hx index fe538966d..b36f9c87e 100644 --- a/source/funkin/ui/debug/charting/ChartEditorState.hx +++ b/source/funkin/ui/debug/charting/ChartEditorState.hx @@ -2453,9 +2453,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; }; diff --git a/source/funkin/ui/debug/charting/handlers/ChartEditorToolboxHandler.hx b/source/funkin/ui/debug/charting/handlers/ChartEditorToolboxHandler.hx index 2876ce2fa..ee70c5cb4 100644 --- a/source/funkin/ui/debug/charting/handlers/ChartEditorToolboxHandler.hx +++ b/source/funkin/ui/debug/charting/handlers/ChartEditorToolboxHandler.hx @@ -442,12 +442,22 @@ class ChartEditorToolboxHandler var checkboxPracticeMode:Null = toolbox.findComponent('practiceModeCheckbox', CheckBox); if (checkboxPracticeMode == null) throw 'ChartEditorToolboxHandler.buildToolboxPlaytestPropertiesLayout() - Could not find practiceModeCheckbox component.'; - state.playtestPracticeMode = checkboxPracticeMode.selected; + checkboxPracticeMode.selected = state.playtestPracticeMode; checkboxPracticeMode.onClick = _ -> { state.playtestPracticeMode = checkboxPracticeMode.selected; }; + var checkboxStartTime:Null = toolbox.findComponent('playtestStartTimeCheckbox', CheckBox); + if (checkboxStartTime == null) + throw 'ChartEditorToolboxHandler.buildToolboxPlaytestPropertiesLayout() - Could not find playtestStartTimeCheckbox component.'; + + checkboxStartTime.selected = state.playtestStartTime; + + checkboxStartTime.onClick = _ -> { + state.playtestStartTime = checkboxStartTime.selected; + }; + return toolbox; } From cd05761725627d7cb88134e194b68802ad1afbe3 Mon Sep 17 00:00:00 2001 From: Cameron Taylor Date: Wed, 13 Dec 2023 17:18:39 -0500 Subject: [PATCH 5/5] assets master merge --- assets | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/assets b/assets index dcb65bdb2..42b4bee68 160000 --- a/assets +++ b/assets @@ -1 +1 @@ -Subproject commit dcb65bdb2a2075dc8d21df5c136a4151a8eea80a +Subproject commit 42b4bee68600bfb9c31831ccdd0579c00930d771