示例#1
0
        /// <summary>
        /// Выполняем действие
        /// </summary>
        /// <param name="item">Элемент</param>
        private void DoAction(MenuItem item)
        {
            switch (item.Action)
            {
            case ActionType.NewGame:
            {
                _CurrentPanel = new NewGamePanel(_Game);
                break;
            }

            case ActionType.Load:
            {
                _CurrentPanel = new SaveLoadPanel(_Game, false);
                break;
            }

            case ActionType.Save:
            {
                _CurrentPanel = new SaveLoadPanel(_Game, true);
                break;
            }

            case ActionType.SubMenu:
            {
                ReloadMenu(item.Items);
                _CurrentMenu  = item.Items;
                _CurrentPanel = null;
                _Delay        = 15;
                break;
            }

            case ActionType.PreviousMenu:
            {
                if (item.Parent.Parent != null)
                {
                    ReloadMenu(item.Parent.Parent.Items);
                    _CurrentMenu = item.Parent.Parent.Items;
                }
                else
                {
                    ReloadMenu(_Menu.Items);
                    _CurrentMenu = _Menu.Items;
                }
                _CurrentPanel = null;
                break;
            }

            case ActionType.Help:
            {
                _CurrentPanel = new HelpPanel(_Game);
                break;
            }

            case ActionType.exit:
            {
                _Game.CloseGame();
                break;
            }
            }
        }
示例#2
0
 /// <summary>
 /// Обрабатываем выход в систему
 /// </summary>
 /// <param name="result">Результат модального окна</param>
 private void OnLeaveToSystem(ModalResult result)
 {
     if (result == ModalResult.Ok)
     {
         _Game.CloseGame();
     }
     else
     {
         _CurrentDialog.OnDialogClose -= OnLeaveToSystem;
         _CurrentDialog = null;
     }
 }