/// <summary> /// Рисуем меню в прямоугольнике /// </summary> /// <param name="Rect">Прямоугольник</param> public void Draw(Rectangle Rect) { _Game.spriteBatch.Draw(_PanelTexture, Rect, Color.White); foreach (MenuItem item in _CurrentMenu) { Rectangle destinationRectangle; switch (item.Control) { case ControlType.Button: { destinationRectangle = new Rectangle(((Rect.Right - Rect.Left) / 2) - 150, (Rect.Top + 50) + 60 * item.Position, 300, 60); break; } } if (item.Control != ControlType.ComboBox) { if (item.Action != ActionType.PreviousMenu && item.Action != ActionType.ReturnToGame) { if (item.Control != ControlType.Button) { item.Rect = new Rectangle(Rect.Left + 30, (Rect.Top + 50) + 60 * item.Position, Rect.Width - 40, 30); } else { item.Rect = new Rectangle(Rect.Left + 5, (Rect.Top + 50) + 60 * item.Position, 300, 60); } item.ItemControl.Draw(_Game.spriteBatch, item.Rect); } else { item.Rect = new Rectangle(Rect.Left + 5, (Rect.Bottom - 100), 300, 60); item.ItemControl.Draw(_Game.spriteBatch, item.Rect); } } } //Рисуем комбобоксы в самом конце! foreach (MenuItem item in _CurrentMenu) { if (item.Control == ControlType.ComboBox) { item.Rect = new Rectangle(Rect.Left + 40, (Rect.Top + 50) + 35 * item.Position, Rect.Width - 80, 30); item.ItemControl.Draw(_Game.spriteBatch, item.Rect); } } if (_CurrentDialog != null) { _CurrentDialog.Draw(_Game.spriteBatch); } }