Fixed bug where playbar wasn't showing

This commit is contained in:
EliteMasterEric 2023-02-02 18:26:03 -05:00
parent c0bd57a573
commit 2ed4752399

View file

@ -1106,8 +1106,7 @@ class ChartEditorState extends HaxeUIState
playbarHead.height = 10; playbarHead.height = 10;
playbarHead.styleString = "padding-left: 0px; padding-right: 0px; border-left: 0px; border-right: 0px;"; playbarHead.styleString = "padding-left: 0px; padding-right: 0px; border-left: 0px; border-right: 0px;";
playbarHead.onDragStart = function(_:DragEvent) playbarHead.onDragStart = function(_:DragEvent) {
{
playbarHeadDragging = true; playbarHeadDragging = true;
// If we were dragging the playhead while the song was playing, resume playing. // If we were dragging the playhead while the song was playing, resume playing.
@ -1122,8 +1121,7 @@ class ChartEditorState extends HaxeUIState
} }
} }
playbarHead.onDragEnd = function(_:DragEvent) playbarHead.onDragEnd = function(_:DragEvent) {
{
playbarHeadDragging = false; playbarHeadDragging = false;
// Set the song position to where the playhead was moved to. // Set the song position to where the playhead was moved to.
@ -1139,7 +1137,7 @@ class ChartEditorState extends HaxeUIState
} }
} }
// add(playbarHeadLayout); add(playbarHeadLayout);
} }
/** /**
@ -1165,8 +1163,7 @@ class ChartEditorState extends HaxeUIState
addUIClickListener('menubarItemRedo', (event:MouseEvent) -> redoLastCommand()); addUIClickListener('menubarItemRedo', (event:MouseEvent) -> redoLastCommand());
addUIClickListener('menubarItemCopy', (event:MouseEvent) -> addUIClickListener('menubarItemCopy', (event:MouseEvent) -> {
{
// Doesn't use a command because it's not undoable. // Doesn't use a command because it's not undoable.
SongDataUtils.writeItemsToClipboard( SongDataUtils.writeItemsToClipboard(
{ {
@ -1175,18 +1172,15 @@ class ChartEditorState extends HaxeUIState
}); });
}); });
addUIClickListener('menubarItemCut', (event:MouseEvent) -> addUIClickListener('menubarItemCut', (event:MouseEvent) -> {
{
performCommand(new CutItemsCommand(currentNoteSelection, currentEventSelection)); performCommand(new CutItemsCommand(currentNoteSelection, currentEventSelection));
}); });
addUIClickListener('menubarItemPaste', (event:MouseEvent) -> addUIClickListener('menubarItemPaste', (event:MouseEvent) -> {
{
performCommand(new PasteItemsCommand(scrollPositionInMs + playheadPositionInMs)); performCommand(new PasteItemsCommand(scrollPositionInMs + playheadPositionInMs));
}); });
addUIClickListener('menubarItemDelete', (event:MouseEvent) -> addUIClickListener('menubarItemDelete', (event:MouseEvent) -> {
{
if (currentNoteSelection.length > 0 && currentEventSelection.length > 0) if (currentNoteSelection.length > 0 && currentEventSelection.length > 0)
{ {
performCommand(new RemoveItemsCommand(currentNoteSelection, currentEventSelection)); performCommand(new RemoveItemsCommand(currentNoteSelection, currentEventSelection));
@ -1205,18 +1199,15 @@ class ChartEditorState extends HaxeUIState
} }
}); });
addUIClickListener('menubarItemSelectAll', (event:MouseEvent) -> addUIClickListener('menubarItemSelectAll', (event:MouseEvent) -> {
{
performCommand(new SelectAllItemsCommand(currentNoteSelection, currentEventSelection)); performCommand(new SelectAllItemsCommand(currentNoteSelection, currentEventSelection));
}); });
addUIClickListener('menubarItemSelectInverse', (event:MouseEvent) -> addUIClickListener('menubarItemSelectInverse', (event:MouseEvent) -> {
{
performCommand(new InvertSelectedItemsCommand(currentNoteSelection, currentEventSelection)); performCommand(new InvertSelectedItemsCommand(currentNoteSelection, currentEventSelection));
}); });
addUIClickListener('menubarItemSelectNone', (event:MouseEvent) -> addUIClickListener('menubarItemSelectNone', (event:MouseEvent) -> {
{
performCommand(new DeselectAllItemsCommand(currentNoteSelection, currentEventSelection)); performCommand(new DeselectAllItemsCommand(currentNoteSelection, currentEventSelection));
}); });
@ -1239,61 +1230,52 @@ class ChartEditorState extends HaxeUIState
addUIClickListener('menubarItemUserGuide', (event:MouseEvent) -> ChartEditorDialogHandler.openUserGuideDialog(this)); addUIClickListener('menubarItemUserGuide', (event:MouseEvent) -> ChartEditorDialogHandler.openUserGuideDialog(this));
addUIChangeListener('menubarItemDownscroll', (event:UIEvent) -> addUIChangeListener('menubarItemDownscroll', (event:UIEvent) -> {
{
isViewDownscroll = event.value; isViewDownscroll = event.value;
}); });
setUICheckboxSelected('menubarItemDownscroll', isViewDownscroll); setUICheckboxSelected('menubarItemDownscroll', isViewDownscroll);
addUIChangeListener('menuBarItemThemeLight', (event:UIEvent) -> addUIChangeListener('menuBarItemThemeLight', (event:UIEvent) -> {
{
if (event.target.value) currentTheme = ChartEditorTheme.Light; if (event.target.value) currentTheme = ChartEditorTheme.Light;
}); });
setUICheckboxSelected('menuBarItemThemeLight', currentTheme == ChartEditorTheme.Light); setUICheckboxSelected('menuBarItemThemeLight', currentTheme == ChartEditorTheme.Light);
addUIChangeListener('menuBarItemThemeDark', (event:UIEvent) -> addUIChangeListener('menuBarItemThemeDark', (event:UIEvent) -> {
{
if (event.target.value) currentTheme = ChartEditorTheme.Dark; if (event.target.value) currentTheme = ChartEditorTheme.Dark;
}); });
setUICheckboxSelected('menuBarItemThemeDark', currentTheme == ChartEditorTheme.Dark); setUICheckboxSelected('menuBarItemThemeDark', currentTheme == ChartEditorTheme.Dark);
addUIChangeListener('menubarItemMetronomeEnabled', (event:UIEvent) -> addUIChangeListener('menubarItemMetronomeEnabled', (event:UIEvent) -> {
{
shouldPlayMetronome = event.value; shouldPlayMetronome = event.value;
}); });
setUICheckboxSelected('menubarItemMetronomeEnabled', shouldPlayMetronome); setUICheckboxSelected('menubarItemMetronomeEnabled', shouldPlayMetronome);
addUIChangeListener('menubarItemPlayerHitsounds', (event:UIEvent) -> addUIChangeListener('menubarItemPlayerHitsounds', (event:UIEvent) -> {
{
hitsoundsEnabledPlayer = event.value; hitsoundsEnabledPlayer = event.value;
}); });
setUICheckboxSelected('menubarItemPlayerHitsounds', hitsoundsEnabledPlayer); setUICheckboxSelected('menubarItemPlayerHitsounds', hitsoundsEnabledPlayer);
addUIChangeListener('menubarItemOpponentHitsounds', (event:UIEvent) -> addUIChangeListener('menubarItemOpponentHitsounds', (event:UIEvent) -> {
{
hitsoundsEnabledOpponent = event.value; hitsoundsEnabledOpponent = event.value;
}); });
setUICheckboxSelected('menubarItemOpponentHitsounds', hitsoundsEnabledOpponent); setUICheckboxSelected('menubarItemOpponentHitsounds', hitsoundsEnabledOpponent);
var instVolumeLabel:Label = findComponent('menubarLabelVolumeInstrumental', Label); var instVolumeLabel:Label = findComponent('menubarLabelVolumeInstrumental', Label);
addUIChangeListener('menubarItemVolumeInstrumental', (event:UIEvent) -> addUIChangeListener('menubarItemVolumeInstrumental', (event:UIEvent) -> {
{
var volume:Float = event.value / 100.0; var volume:Float = event.value / 100.0;
if (audioInstTrack != null) audioInstTrack.volume = volume; if (audioInstTrack != null) audioInstTrack.volume = volume;
instVolumeLabel.text = 'Instrumental - ${Std.int(event.value)}%'; instVolumeLabel.text = 'Instrumental - ${Std.int(event.value)}%';
}); });
var vocalsVolumeLabel:Label = findComponent('menubarLabelVolumeVocals', Label); var vocalsVolumeLabel:Label = findComponent('menubarLabelVolumeVocals', Label);
addUIChangeListener('menubarItemVolumeVocals', (event:UIEvent) -> addUIChangeListener('menubarItemVolumeVocals', (event:UIEvent) -> {
{
var volume:Float = event.value / 100.0; var volume:Float = event.value / 100.0;
if (audioVocalTrackGroup != null) audioVocalTrackGroup.volume = volume; if (audioVocalTrackGroup != null) audioVocalTrackGroup.volume = volume;
vocalsVolumeLabel.text = 'Vocals - ${Std.int(event.value)}%'; vocalsVolumeLabel.text = 'Vocals - ${Std.int(event.value)}%';
}); });
var playbackSpeedLabel:Label = findComponent('menubarLabelPlaybackSpeed', Label); var playbackSpeedLabel:Label = findComponent('menubarLabelPlaybackSpeed', Label);
addUIChangeListener('menubarItemPlaybackSpeed', (event:UIEvent) -> addUIChangeListener('menubarItemPlaybackSpeed', (event:UIEvent) -> {
{
var pitch = event.value * 2.0 / 100.0; var pitch = event.value * 2.0 / 100.0;
#if FLX_PITCH #if FLX_PITCH
if (audioInstTrack != null) audioInstTrack.pitch = pitch; if (audioInstTrack != null) audioInstTrack.pitch = pitch;
@ -1302,37 +1284,29 @@ class ChartEditorState extends HaxeUIState
playbackSpeedLabel.text = 'Playback Speed - ${Std.int(event.value * 100) / 100}x'; playbackSpeedLabel.text = 'Playback Speed - ${Std.int(event.value * 100) / 100}x';
}); });
addUIChangeListener('menubarItemToggleToolboxTools', (event:UIEvent) -> addUIChangeListener('menubarItemToggleToolboxTools', (event:UIEvent) -> {
{
ChartEditorToolboxHandler.setToolboxState(this, CHART_EDITOR_TOOLBOX_TOOLS_LAYOUT, event.value); ChartEditorToolboxHandler.setToolboxState(this, CHART_EDITOR_TOOLBOX_TOOLS_LAYOUT, event.value);
}); });
// setUICheckboxSelected('menubarItemToggleToolboxTools', true); // setUICheckboxSelected('menubarItemToggleToolboxTools', true);
addUIChangeListener('menubarItemToggleToolboxNotes', (event:UIEvent) -> addUIChangeListener('menubarItemToggleToolboxNotes', (event:UIEvent) -> {
{
ChartEditorToolboxHandler.setToolboxState(this, CHART_EDITOR_TOOLBOX_NOTEDATA_LAYOUT, event.value); ChartEditorToolboxHandler.setToolboxState(this, CHART_EDITOR_TOOLBOX_NOTEDATA_LAYOUT, event.value);
}); });
addUIChangeListener('menubarItemToggleToolboxEvents', (event:UIEvent) -> addUIChangeListener('menubarItemToggleToolboxEvents', (event:UIEvent) -> {
{
ChartEditorToolboxHandler.setToolboxState(this, CHART_EDITOR_TOOLBOX_EVENTDATA_LAYOUT, event.value); ChartEditorToolboxHandler.setToolboxState(this, CHART_EDITOR_TOOLBOX_EVENTDATA_LAYOUT, event.value);
}); });
addUIChangeListener('menubarItemToggleToolboxDifficulty', (event:UIEvent) -> addUIChangeListener('menubarItemToggleToolboxDifficulty', (event:UIEvent) -> {
{
ChartEditorToolboxHandler.setToolboxState(this, CHART_EDITOR_TOOLBOX_DIFFICULTY_LAYOUT, event.value); ChartEditorToolboxHandler.setToolboxState(this, CHART_EDITOR_TOOLBOX_DIFFICULTY_LAYOUT, event.value);
}); });
addUIChangeListener('menubarItemToggleToolboxMetadata', (event:UIEvent) -> addUIChangeListener('menubarItemToggleToolboxMetadata', (event:UIEvent) -> {
{
ChartEditorToolboxHandler.setToolboxState(this, CHART_EDITOR_TOOLBOX_METADATA_LAYOUT, event.value); ChartEditorToolboxHandler.setToolboxState(this, CHART_EDITOR_TOOLBOX_METADATA_LAYOUT, event.value);
}); });
addUIChangeListener('menubarItemToggleToolboxCharacters', (event:UIEvent) -> addUIChangeListener('menubarItemToggleToolboxCharacters', (event:UIEvent) -> {
{
ChartEditorToolboxHandler.setToolboxState(this, CHART_EDITOR_TOOLBOX_CHARACTERS_LAYOUT, event.value); ChartEditorToolboxHandler.setToolboxState(this, CHART_EDITOR_TOOLBOX_CHARACTERS_LAYOUT, event.value);
}); });
addUIChangeListener('menubarItemToggleToolboxPlayerPreview', (event:UIEvent) -> addUIChangeListener('menubarItemToggleToolboxPlayerPreview', (event:UIEvent) -> {
{
ChartEditorToolboxHandler.setToolboxState(this, CHART_EDITOR_TOOLBOX_PLAYER_PREVIEW_LAYOUT, event.value); ChartEditorToolboxHandler.setToolboxState(this, CHART_EDITOR_TOOLBOX_PLAYER_PREVIEW_LAYOUT, event.value);
}); });
addUIChangeListener('menubarItemToggleToolboxOpponentPreview', (event:UIEvent) -> addUIChangeListener('menubarItemToggleToolboxOpponentPreview', (event:UIEvent) -> {
{
ChartEditorToolboxHandler.setToolboxState(this, CHART_EDITOR_TOOLBOX_OPPONENT_PREVIEW_LAYOUT, event.value); ChartEditorToolboxHandler.setToolboxState(this, CHART_EDITOR_TOOLBOX_OPPONENT_PREVIEW_LAYOUT, event.value);
}); });
@ -1736,8 +1710,7 @@ class ChartEditorState extends HaxeUIState
// We build a list of columns to select. // We build a list of columns to select.
var columnStart:Int = Std.int(Math.min(cursorColumnBase, cursorColumnBaseStart)); var columnStart:Int = Std.int(Math.min(cursorColumnBase, cursorColumnBaseStart));
var columnEnd:Int = Std.int(Math.max(cursorColumnBase, cursorColumnBaseStart)); var columnEnd:Int = Std.int(Math.max(cursorColumnBase, cursorColumnBaseStart));
var columns:Array<Int> = [for (i in columnStart...(columnEnd + 1)) i].map(function(i:Int):Int var columns:Array<Int> = [for (i in columnStart...(columnEnd + 1)) i].map(function(i:Int):Int {
{
if (i >= eventColumn) if (i >= eventColumn)
{ {
// Don't invert the event column. // Don't invert the event column.
@ -1824,16 +1797,14 @@ class ChartEditorState extends HaxeUIState
// We clicked on the grid without moving the mouse. // We clicked on the grid without moving the mouse.
// Find the first note that is at the cursor position. // Find the first note that is at the cursor position.
var highlightedNote:ChartEditorNoteSprite = renderedNotes.members.find(function(note:ChartEditorNoteSprite):Bool var highlightedNote:ChartEditorNoteSprite = renderedNotes.members.find(function(note:ChartEditorNoteSprite):Bool {
{
// If note.alive is false, the note is dead and awaiting recycling. // If note.alive is false, the note is dead and awaiting recycling.
return note.alive && FlxG.mouse.overlaps(note); return note.alive && FlxG.mouse.overlaps(note);
}); });
var highlightedEvent:ChartEditorEventSprite = null; var highlightedEvent:ChartEditorEventSprite = null;
if (highlightedNote == null) if (highlightedNote == null)
{ {
highlightedEvent = renderedEvents.members.find(function(event:ChartEditorEventSprite):Bool highlightedEvent = renderedEvents.members.find(function(event:ChartEditorEventSprite):Bool {
{
return event.alive && FlxG.mouse.overlaps(event); return event.alive && FlxG.mouse.overlaps(event);
}); });
} }
@ -1931,16 +1902,14 @@ class ChartEditorState extends HaxeUIState
// We clicked on the grid without moving the mouse. // We clicked on the grid without moving the mouse.
// Find the first note that is at the cursor position. // Find the first note that is at the cursor position.
var highlightedNote:ChartEditorNoteSprite = renderedNotes.members.find(function(note:ChartEditorNoteSprite):Bool var highlightedNote:ChartEditorNoteSprite = renderedNotes.members.find(function(note:ChartEditorNoteSprite):Bool {
{
// If note.alive is false, the note is dead and awaiting recycling. // If note.alive is false, the note is dead and awaiting recycling.
return note.alive && FlxG.mouse.overlaps(note); return note.alive && FlxG.mouse.overlaps(note);
}); });
var highlightedEvent:ChartEditorEventSprite = null; var highlightedEvent:ChartEditorEventSprite = null;
if (highlightedNote == null) if (highlightedNote == null)
{ {
highlightedEvent = renderedEvents.members.find(function(event:ChartEditorEventSprite):Bool highlightedEvent = renderedEvents.members.find(function(event:ChartEditorEventSprite):Bool {
{
// If event.alive is false, the event is dead and awaiting recycling. // If event.alive is false, the event is dead and awaiting recycling.
return event.alive && FlxG.mouse.overlaps(event); return event.alive && FlxG.mouse.overlaps(event);
}); });
@ -2025,16 +1994,14 @@ class ChartEditorState extends HaxeUIState
// We right clicked on the grid. // We right clicked on the grid.
// Find the first note that is at the cursor position. // Find the first note that is at the cursor position.
var highlightedNote:ChartEditorNoteSprite = renderedNotes.members.find(function(note:ChartEditorNoteSprite):Bool var highlightedNote:ChartEditorNoteSprite = renderedNotes.members.find(function(note:ChartEditorNoteSprite):Bool {
{
// If note.alive is false, the note is dead and awaiting recycling. // If note.alive is false, the note is dead and awaiting recycling.
return note.alive && FlxG.mouse.overlaps(note); return note.alive && FlxG.mouse.overlaps(note);
}); });
var highlightedEvent:ChartEditorEventSprite = null; var highlightedEvent:ChartEditorEventSprite = null;
if (highlightedNote == null) if (highlightedNote == null)
{ {
highlightedEvent = renderedEvents.members.find(function(event:ChartEditorEventSprite):Bool highlightedEvent = renderedEvents.members.find(function(event:ChartEditorEventSprite):Bool {
{
// If event.alive is false, the event is dead and awaiting recycling. // If event.alive is false, the event is dead and awaiting recycling.
return event.alive && FlxG.mouse.overlaps(event); return event.alive && FlxG.mouse.overlaps(event);
}); });
@ -3036,8 +3003,7 @@ class ChartEditorState extends HaxeUIState
function postLoadInstrumental() function postLoadInstrumental()
{ {
// Prevent the time from skipping back to 0 when the song ends. // Prevent the time from skipping back to 0 when the song ends.
audioInstTrack.onComplete = function() audioInstTrack.onComplete = function() {
{
if (audioInstTrack != null) audioInstTrack.pause(); if (audioInstTrack != null) audioInstTrack.pause();
if (audioVocalTrackGroup != null) audioVocalTrackGroup.pause(); if (audioVocalTrackGroup != null) audioVocalTrackGroup.pause();
}; };
@ -3205,13 +3171,11 @@ class ChartEditorState extends HaxeUIState
function sortChartData() function sortChartData()
{ {
currentSongChartNoteData.sort(function(a:SongNoteData, b:SongNoteData):Int currentSongChartNoteData.sort(function(a:SongNoteData, b:SongNoteData):Int {
{
return FlxSort.byValues(FlxSort.ASCENDING, a.time, b.time); return FlxSort.byValues(FlxSort.ASCENDING, a.time, b.time);
}); });
currentSongChartEventData.sort(function(a:SongEventData, b:SongEventData):Int currentSongChartEventData.sort(function(a:SongEventData, b:SongEventData):Int {
{
return FlxSort.byValues(FlxSort.ASCENDING, a.time, b.time); return FlxSort.byValues(FlxSort.ASCENDING, a.time, b.time);
}); });
} }
@ -3321,13 +3285,11 @@ class ChartEditorState extends HaxeUIState
} }
// Prompt and save. // Prompt and save.
var onSave:Array<String>->Void = (paths:Array<String>) -> var onSave:Array<String>->Void = (paths:Array<String>) -> {
{
trace('Successfully exported files.'); trace('Successfully exported files.');
}; };
var onCancel:Void->Void = () -> var onCancel:Void->Void = () -> {
{
trace('Export cancelled.'); trace('Export cancelled.');
}; };