コード例 #1
0
 /// <summary>
 /// Helper methods to prompt the user if there are unsaved changes
 /// Will call the callback immediately if there are none
 /// </summary>
 /// <param name="callback">Method to call when the user has made a decision</param>
 /// <returns>True if a dialog has been opened, false otherwise</returns>
 private bool CheckForChanges(Action <int> callback)
 {
     if (IsDirty())
     {
         PersistentUI.Instance.ShowDialogBox("SongEditMenu", "unsaved.warning", callback,
                                             PersistentUI.DialogBoxPresetType.YesNo);
         return(true);
     }
     else if (difficultySelect.IsDirty())
     {
         PersistentUI.Instance.ShowDialogBox("SongEditMenu", "unsaveddiff.warning", callback,
                                             PersistentUI.DialogBoxPresetType.YesNo);
         return(true);
     }
     else if (contributorController.IsDirty())
     {
         PersistentUI.Instance.ShowDialogBox("SongEditMenu", "unsavedcontributor.warning", callback,
                                             PersistentUI.DialogBoxPresetType.YesNo);
         return(true);
     }
     callback(0);
     return(false);
 }