Merge pull request #309 from FunkinCrew/feature/chart-editor-freeplay-difficulty

Implement difficulty rank into Metadata toolbox.
This commit is contained in:
Cameron Taylor 2024-02-10 02:32:37 -05:00 committed by GitHub
commit 2d5b67d880
4 changed files with 31 additions and 3 deletions

2
assets

@ -1 +1 @@
Subproject commit ba25cf692f7a09174860d50f011fef5643f68b0c
Subproject commit 594853037cbea06caa5c141b0d9ed3736818e592

View file

@ -418,10 +418,10 @@ class SongPlayData implements ICloneable<SongPlayData>
/**
* The difficulty ratings for this song as displayed in Freeplay.
* Key is a difficulty ID or `default`.
* Key is a difficulty ID.
*/
@:optional
@:default(['default' => 1])
@:default(['normal' => 0])
public var ratings:Map<String, Int>;
/**

View file

@ -1296,6 +1296,29 @@ class ChartEditorState extends UIState // UIState derives from MusicBeatState
return currentSongChartData.events = value;
}
/**
* Convenience property to get the rating for this difficulty in the Freeplay menu.
*/
var currentSongChartDifficultyRating(get, set):Int;
function get_currentSongChartDifficultyRating():Int
{
var result:Null<Int> = currentSongMetadata.playData.ratings.get(selectedDifficulty);
if (result == null)
{
// Initialize to the default value if not set.
currentSongMetadata.playData.ratings.set(selectedDifficulty, 0);
return 0;
}
return result;
}
function set_currentSongChartDifficultyRating(value:Int):Int
{
currentSongMetadata.playData.ratings.set(selectedDifficulty, value);
return value;
}
var currentSongNoteStyle(get, set):String;
function get_currentSongNoteStyle():String

View file

@ -151,6 +151,10 @@ class ChartEditorMetadataToolbox extends ChartEditorBaseToolbox
labelScrollSpeed.text = 'Scroll Speed: ${chartEditorState.currentSongChartScrollSpeed}x';
};
inputDifficultyRating.onChange = function(event:UIEvent) {
chartEditorState.currentSongChartDifficultyRating = event.target.value;
};
buttonCharacterOpponent.onClick = function(_) {
chartEditorState.openCharacterDropdown(CharacterType.DAD, false);
};
@ -175,6 +179,7 @@ class ChartEditorMetadataToolbox extends ChartEditorBaseToolbox
inputStage.value = chartEditorState.currentSongMetadata.playData.stage;
inputNoteStyle.value = chartEditorState.currentSongMetadata.playData.noteStyle;
inputBPM.value = chartEditorState.currentSongMetadata.timeChanges[0].bpm;
inputDifficultyRating.value = chartEditorState.currentSongChartDifficultyRating;
inputScrollSpeed.value = chartEditorState.currentSongChartScrollSpeed;
labelScrollSpeed.text = 'Scroll Speed: ${chartEditorState.currentSongChartScrollSpeed}x';
frameVariation.text = 'Variation: ${chartEditorState.selectedVariation.toTitleCase()}';