Ejemplo n.º 1
0
        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();
        }
Ejemplo n.º 2
0
        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();
        }