Пример #1
0
        protected ModalDialogBase(IUiContentStorage uiContentStorage, GraphicsDevice graphicsDevice)
        {
            _shadowTexture           = uiContentStorage.GetModalShadowTexture();
            _graphicsDevice          = graphicsDevice;
            _backgroundTopTexture    = uiContentStorage.GetModalTopTextures()[0];
            _backgroundBottomTexture = uiContentStorage.GetModalBottomTextures()[0];

            _dialogRect = new Rectangle(
                (graphicsDevice.Viewport.Width / 2) - (MODAL_WIDTH / 2),
                (graphicsDevice.Viewport.Height / 2) - (MODAL_HEIGHT / 2),
                MODAL_WIDTH,
                MODAL_HEIGHT);

            _closeButton = new TextButton("X", uiContentStorage.GetButtonTexture(), uiContentStorage.GetButtonFont(),
                                          new Rectangle(_dialogRect.Right - CLOSE_BUTTON_SIZE - CLOSE_BUTTON_PADDING,
                                                        _dialogRect.Top + CLOSE_BUTTON_PADDING, CLOSE_BUTTON_SIZE, CLOSE_BUTTON_SIZE));
            _closeButton.OnClick += CloseButton_OnClick;

            ContentRect = new Rectangle(
                _dialogRect.Left + MODAL_CONTENT_MARGIN,
                _dialogRect.Top + MODAL_CONTENT_MARGIN + MODAL_HEADER_HEIGHT,
                _dialogRect.Right - MODAL_CONTENT_MARGIN,
                _dialogRect.Bottom - MODAL_CONTENT_MARGIN);
        }