mirror of
https://github.com/ninjamuffin99/Funkin.git
synced 2024-08-20 07:25:59 +00:00
Fixes for autosave notification
This commit is contained in:
parent
4ace7c9cf4
commit
668fbd3b37
|
@ -1650,13 +1650,13 @@ class ChartEditorState extends HaxeUIState
|
|||
}
|
||||
else
|
||||
{
|
||||
this.error('Failure', 'Failed to load chart (${params.fnfcTargetPath})');
|
||||
this.error('Failure', 'Failed to load chart (${chartPath.toString()})');
|
||||
}
|
||||
}
|
||||
|
||||
if (!FileUtil.doesFileExist(chartPath))
|
||||
{
|
||||
trace('Previously loaded chart file (${chartPath}) does not exist, disabling link...');
|
||||
trace('Previously loaded chart file (${chartPath.toString()}) does not exist, disabling link...');
|
||||
menuItemRecentChart.disabled = true;
|
||||
}
|
||||
else
|
||||
|
@ -2030,7 +2030,7 @@ class ChartEditorState extends HaxeUIState
|
|||
this.exportAllSongData(false, null);
|
||||
}
|
||||
});
|
||||
addUIClickListener('menubarItemSaveChartAs', _ -> this.exportAllSongData());
|
||||
addUIClickListener('menubarItemSaveChartAs', _ -> this.exportAllSongData(false, null));
|
||||
addUIClickListener('menubarItemLoadInst', _ -> this.openUploadInstDialog(true));
|
||||
addUIClickListener('menubarItemImportChart', _ -> this.openImportChartDialog('legacy', true));
|
||||
addUIClickListener('menubarItemExit', _ -> quitChartEditor());
|
||||
|
@ -2269,12 +2269,13 @@ class ChartEditorState extends HaxeUIState
|
|||
if (needsAutoSave)
|
||||
{
|
||||
this.exportAllSongData(true, null);
|
||||
this.infoWithActions('Auto-Save', 'Chart auto-saved to your backups folder.', [
|
||||
var absoluteBackupsPath:String = Path.join([Sys.getCwd(), ChartEditorImportExportHandler.BACKUPS_PATH]);
|
||||
this.infoWithActions('Auto-Save', 'Chart auto-saved to ${absoluteBackupsPath}.', [
|
||||
{
|
||||
"text": "Take Me There",
|
||||
action: openBackupsFolder,
|
||||
text: "Take Me There",
|
||||
callback: openBackupsFolder,
|
||||
}
|
||||
], true);
|
||||
]);
|
||||
}
|
||||
#end
|
||||
}
|
||||
|
@ -3487,6 +3488,11 @@ class ChartEditorState extends HaxeUIState
|
|||
// Finished dragging. Release the note.
|
||||
currentPlaceNoteData = null;
|
||||
}
|
||||
else
|
||||
{
|
||||
// Cursor should be a grabby hand.
|
||||
if (targetCursorMode == null) targetCursorMode = Grabbing;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -4031,23 +4037,21 @@ class ChartEditorState extends HaxeUIState
|
|||
if (currentWorkingFilePath == null || FlxG.keys.pressed.SHIFT)
|
||||
{
|
||||
// CTRL + SHIFT + S = Save As
|
||||
this.exportAllSongData(false, null);
|
||||
this.exportAllSongData(false, null, function(path:String) {
|
||||
// CTRL + SHIFT + S Successful
|
||||
this.success('Saved Chart', 'Chart saved successfully to ${path}.');
|
||||
}, function() {
|
||||
// CTRL + SHIFT + S Cancelled
|
||||
});
|
||||
}
|
||||
else
|
||||
{
|
||||
// CTRL + S = Save Chart
|
||||
this.exportAllSongData(true, currentWorkingFilePath);
|
||||
this.success('Saved Chart', 'Chart saved successfully to ${currentWorkingFilePath}.');
|
||||
}
|
||||
}
|
||||
|
||||
if (FlxG.keys.pressed.CONTROL && FlxG.keys.pressed.SHIFT && FlxG.keys.justPressed.S)
|
||||
{
|
||||
this.exportAllSongData(false, null, function(path:String) {
|
||||
// CTRL + SHIFT + S Successful
|
||||
}, function() {
|
||||
// CTRL + SHIFT + S Cancelled
|
||||
});
|
||||
}
|
||||
// CTRL + Q = Quit to Menu
|
||||
if (FlxG.keys.pressed.CONTROL && FlxG.keys.justPressed.Q)
|
||||
{
|
||||
|
|
|
@ -77,9 +77,9 @@ class ChartEditorNotificationHandler
|
|||
* @param actions The actions to add to the notification.
|
||||
* @return The notification that was sent.
|
||||
*/
|
||||
public static function info(state:ChartEditorState, title:String, body:String):Notification
|
||||
public static function infoWithActions(state:ChartEditorState, title:String, body:String, actions:Array<NotificationAction>):Notification
|
||||
{
|
||||
return sendNotification(title, body, NotificationType.Info);
|
||||
return sendNotification(title, body, NotificationType.Info, actions);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -104,7 +104,7 @@ class ChartEditorNotificationHandler
|
|||
static function sendNotification(title:String, body:String, ?type:NotificationType, ?actions:Array<NotificationAction>):Notification
|
||||
{
|
||||
#if !mac
|
||||
var actionNames:Array<String> = actions.map(action -> action.text);
|
||||
var actionNames:Array<String> = actions == null ? [] : actions.map(action -> action.text);
|
||||
|
||||
var notif = NotificationManager.instance.addNotification(
|
||||
{
|
||||
|
@ -115,21 +115,25 @@ class ChartEditorNotificationHandler
|
|||
actions: actionNames
|
||||
});
|
||||
|
||||
// TODO: Tell Ian that this is REALLY dumb.
|
||||
var actionsContainer:HBox = notif.findComponent('actionsContainer', HBox);
|
||||
actionsContainer.walkComponents(function(component) {
|
||||
if (Std.isOfType(component, Button))
|
||||
{
|
||||
var button:Button = cast component;
|
||||
var action:Null<NotificationAction> = actions.find(action -> action.text == button.text);
|
||||
if (action != null && action.callback != null)
|
||||
if (actionNames.length > 0)
|
||||
{
|
||||
// TODO: Tell Ian that this is REALLY dumb.
|
||||
var actionsContainer:HBox = notif.findComponent('actionsContainer', HBox);
|
||||
actionsContainer.walkComponents(function(component) {
|
||||
if (Std.isOfType(component, Button))
|
||||
{
|
||||
button.onClick = function(_) {
|
||||
action.callback();
|
||||
};
|
||||
var button:Button = cast component;
|
||||
var action:Null<NotificationAction> = actions.find(action -> action.text == button.text);
|
||||
if (action != null && action.callback != null)
|
||||
{
|
||||
button.onClick = function(_) {
|
||||
action.callback();
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
return true; // Continue walking.
|
||||
});
|
||||
}
|
||||
|
||||
return notif;
|
||||
#else
|
||||
|
|
Loading…
Reference in a new issue