Esempio n. 1
0
        public override void LoadContent(ContentManager contentManager)
        {
            base.LoadContent(contentManager);
            var font       = Content.Load <SpriteFont>(GameResource.FontPath);
            var buttonText = "Play";
            var center     = Global.VirtualWidth / 2 - font.MeasureString(buttonText).X / 2;
            var play       = new Button(font, _vectorInput, PlayClicked, buttonText, new Vector2(center, 1470));
            var closeText  = "X";
            var close      = new Button(font, _vectorInput, CloseClicked, closeText, new Vector2(Global.VirtualWidth - font.MeasureString(closeText).X, 0));

            UpdateDrawables.Add(play);
            UpdateDrawables.Add(close);
            UpdateDrawables.Add(_vectorInput);
        }
Esempio n. 2
0
        public override void LoadContent(ContentManager contentManager)
        {
            base.LoadContent(contentManager);
            var font         = Content.Load <SpriteFont>(GameResource.FontPath);
            var gameOverText = "GameOver";
            var gameOver     = new TextWrapper(font,
                                               new Rectangle((int)font.CenterX(gameOverText), 960, (int)Global.VirtualWidth, 250), gameOverText);

            var scoreText = $"Score: {Score.LastScore}";
            var score     = new TextWrapper(font,
                                            new Rectangle((int)font.CenterX(scoreText), 1210, (int)Global.VirtualWidth, 250), scoreText);

            var buttonText = "Ok";
            var ok         = new Button(font, _vectorInput, OkClicked, buttonText, new Vector2(font.CenterX(buttonText), 1460));

            UpdateDrawables.Add(gameOver);
            UpdateDrawables.Add(score);
            UpdateDrawables.Add(ok);
            UpdateDrawables.Add(_vectorInput);
        }
Esempio n. 3
0
        public override void LoadContent(ContentManager contentManager)
        {
            base.LoadContent(contentManager);
            var font = Content.Load <SpriteFont>(GameResource.FontPath);

            var gemFactory = new RandomGemFactory(Content.Load <Texture2D>(GameResource.Gem1Path),
                                                  Content.Load <Texture2D>(GameResource.Gem2Path), Content.Load <Texture2D>(GameResource.Gem3Path),
                                                  Content.Load <Texture2D>(GameResource.Gem4Path), Content.Load <Texture2D>(GameResource.Gem5Path));

            _score = new Score(font, new Rectangle(2790, 50, 1000, 200));
            var timer = new Timer(font, new Rectangle(2790, 500, 1000, 200), OnTimeExpired, 60);

            var lineBonusFactory = new LineBonusFactory(Content.Load <Texture2D>(GameResource.LineHorizontalPath),
                                                        Content.Load <Texture2D>(GameResource.LineVerticalPath),
                                                        Content.Load <Texture2D>(GameResource.BreakerPath));
            var bombBonusFactory = new BombBonusFactory(Content.Load <Texture2D>(GameResource.BombPath));

            _bonusFactories.Add(bombBonusFactory);
            _bonusFactories.Add(lineBonusFactory);

            var cellTexture2D  = Content.Load <Texture2D>(GameResource.CellPath);
            var boardContainer = new Rectangle(50, 50, 2740, 2060);

            _board = new Board(cellTexture2D, boardContainer, 8, 8, gemFactory, _vectorInput);
            foreach (var bonus in _bonusFactories)
            {
                _board.LineDestroy += bonus.LineDestroy;
            }
            _board.LineDestroy += _score.LineDestroy;
            _board.GemDestroy  += _score.GemDestroy;

            UpdateDrawables.Add(timer);
            UpdateDrawables.Add(_score);
            UpdateDrawables.Add(_board);
            UpdateDrawables.Add(_vectorInput);
        }