Exemple #1
0
        private void AddLevelSelectButton(string text, LevelBase level)
        {
            float minHeight = Core.graphicsDevice.Viewport.Height / 12;
            float minWidth  = Core.graphicsDevice.Viewport.Width / 6;
            float margin    = 10f;

            var buttonStyle = new TextButtonStyle(new PrimitiveDrawable(Color.Black, 10f), new PrimitiveDrawable(Color.Yellow), new PrimitiveDrawable(Color.DarkSlateBlue))
            {
                downFontColor = Color.Black
            };

            this._table.add(new TextButton(text, buttonStyle))
            .setFillY()
            .setMinHeight(minHeight)
            .setMinWidth(minWidth)
            .getElement <Button>()
            .onClicked += (obj) => { this.TransitionToLevel(level); };

            this._currentRowWidth += minWidth;

            if (this._currentRowWidth >= Core.graphicsDevice.Viewport.Width - margin)
            {
                this._table.row();
                this._currentRowWidth = 0f;
            }
        }
Exemple #2
0
 private void TransitionToLevel(LevelBase level)
 {
     Core.startSceneTransition(new WindTransition(() => level));
 }