private void OnEraseFile(MenuPageEventArgs e) { _dialogOpen = true; var dialog = new MenuDialog(); dialog.AddTextLine("Are you sure?"); var yesButton = new MenuButton(new Vector2(0, 0), "Erase", ButtonStyles.Dialog, new EraseFileEventArgs(_fileHighlightIndex)); yesButton.OnSelected += RaiseEraseFileEvent; yesButton.OnSelected += ResetFileButtons; yesButton.OnSelected += RaiseCloseDialogEvent; var noButton = new MenuButton(new Vector2(0, 0), "Cancel", ButtonStyles.Dialog, new CloseDialogEventArgs()); noButton.OnSelected += RaiseCloseDialogEvent; noButton.OnSelected += ResetFileButtons; yesButton.LeftButton = noButton; yesButton.RightButton = noButton; noButton.LeftButton = yesButton; noButton.RightButton = yesButton; dialog.AddButton(yesButton); dialog.AddButton(noButton); _currentDialog = dialog; _currentButton.DeHighlight(); _currentButton = yesButton; _currentButton.Highlight(); }
private void OnSaveFile(MenuPageEventArgs e) { _dialogOpen = true; var dialog = new MenuDialog(); dialog.AddTextLine("Saving..."); _currentDialog = dialog; }
private void OpenKeybindDialog(MenuPageEventArgs e) { var args = e as KeybindChangeEventArgs; if (args == null) { return; } _lastKeybindChanged = args.Button; var keyDialog = new MenuDialog(); keyDialog.AddTextLine("Press any key or button."); _currentDialog = keyDialog; _dialogOpen = true; }
private void OnLoadFile(MenuPageEventArgs e) { _dialogOpen = true; _loadConfirmDialog = new MenuDialog(); _loadConfirmDialog.AddTextLine("Any unsaved progress will be lost."); var okButton = new MenuButton(new Vector2(0, 0), "Ok", ButtonStyles.Dialog, new StartOrLoadEventArgs(_fileHighlightIndex)); okButton.OnSelected += RaiseLoadGameEvent; okButton.OnSelected += RaiseCloseDialogEvent; var cancelButton = new MenuButton(new Vector2(0, 0), "Cancel", ButtonStyles.Dialog, new CloseDialogEventArgs()); cancelButton.OnSelected += RaiseCloseDialogEvent; cancelButton.OnSelected += ResetFileButtons; _loadConfirmDialog.AddButton(okButton); _loadConfirmDialog.AddButton(cancelButton); _currentDialog = _loadConfirmDialog; _currentButton.DeHighlight(); _currentButton = okButton; _currentButton.Highlight(); }