Exemplo n.º 1
0
        /// <summary>Отрисовываем панель</summary>
        /// <param name="panel">панель</param>
        private void DrawPanel(Panel panel)
        {
            if (panel == null)
            return;
              _Game.spriteBatch.Begin();

              var width = _Game.graphics.GraphicsDevice.Viewport.Width;
              var height = _Game.graphics.GraphicsDevice.Viewport.Height;
              panel.Draw(_Game.spriteBatch, new Rectangle(10, 10, width - 350, height-100));
              _Game.spriteBatch.End();
        }
Exemplo n.º 2
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;
       }
       }
 }