Пример #1
0
        public Menu(SpriteBatch spriteBatch, ContentManager content) : base(spriteBatch)
        {
            _panel = new Sprite(spriteBatch)
            {
                Texture = content.Load <Texture2D>("UI/yellow_panel")
            };
            AddChild(_panel);
            _panel.Scale = 3.0f;

            _playButton = new Sprite(spriteBatch)
            {
                Texture = content.Load <Texture2D>("UI/blue_button00")
            };
            AddChild(_playButton);

            _pressedTexture = content.Load <Texture2D>("UI/green_button00");

            var text = new Label(spriteBatch)
            {
                Text = "PLAY",
                Font = Match3TextureManager.GetDefaultFont()
            };

            _playButton.AddChild(text);

            var pressShape = new ShapeButton(spriteBatch);
            var halfSize   = new Vector2(_playButton.Texture.Width * 0.5f, _playButton.Texture.Height * 0.5f);

            pressShape.ShapeRect = new RectangleF(-halfSize.X, -halfSize.Y, _playButton.Texture.Width, _playButton.Texture.Height);
            _playButton.AddChild(pressShape);
            pressShape.EventReleased += OnReleased;
            pressShape.EventPressed  += OnPressed;
        }
Пример #2
0
 public CellBonusBomb(SpriteBatch spriteBatch, Grid grid, Point pos) : base(spriteBatch)
 {
     _grid = grid;
     _pos  = pos;
     CellStateSemaphore.ActiveBonuses++;
     _frames = Match3TextureManager.GetTexturesExplotion();
     Scale   = 3.0f;
 }
        //Load resource and content
        protected override void LoadContent()
        {
            _spriteBatch = new SpriteBatch(GraphicsDevice);
            Match3TextureManager.LoadTextures(Content);

            LoadMenu();

            base.LoadContent();
        }
Пример #4
0
        public GameOver(SpriteBatch spriteBatch, ContentManager content, int score) : base(spriteBatch)
        {
            _panel = new Sprite(spriteBatch)
            {
                Texture = content.Load <Texture2D>("UI/red_panel")
            };
            AddChild(_panel);
            _panel.Scale = 3.0f;

            _playButton = new Sprite(spriteBatch)
            {
                Texture = content.Load <Texture2D>("UI/yellow_button00")
            };
            AddChild(_playButton);

            _pressedTexture = content.Load <Texture2D>("UI/red_button00");

            var buttonLabel = new Label(spriteBatch)
            {
                Text = "OK",
                Font = Match3TextureManager.GetDefaultFont()
            };

            _playButton.AddChild(buttonLabel);

            var scoreLabel = new Label(spriteBatch)
            {
                Text     = $"You SCORE {score}",
                Font     = Match3TextureManager.GetDefaultFont(),
                Position = new Vector2(0, -400f),
                Scale    = 0.5f
            };

            AddChild(scoreLabel);

            var pressShape = new ShapeButton(spriteBatch);
            var halfSize   = new Vector2(_playButton.Texture.Width * 0.5f, _playButton.Texture.Height * 0.5f);

            pressShape.ShapeRect = new Rectangle((int)-halfSize.X, (int)-halfSize.Y, _playButton.Texture.Width, _playButton.Texture.Height);
            _playButton.AddChild(pressShape);
            pressShape.EventReleased += OnReleased;
            pressShape.EventPressed  += OnPressed;
        }
Пример #5
0
        protected override void OnEnteredTree()
        {
            _firstDestroyed = new Sprite(_spriteBatch)
            {
                Texture = Match3TextureManager.GetTextureParticle()
            };
            AddChild(_firstDestroyed);
            _firstDestroyed.Position = Vector2.Zero;
            _firstDestroyed.Scale    = 1.5f;

            _secondDestroyed = new Sprite(_spriteBatch)
            {
                Texture = Match3TextureManager.GetTextureParticle()
            };
            AddChild(_secondDestroyed);
            _secondDestroyed.Position = Vector2.Zero;
            _secondDestroyed.Scale    = 1.5f;
            Processing = true;
            base.OnEnteredTree();
        }
Пример #6
0
        protected override void Process(GameTime gameTime)
        {
            switch (Select)
            {
            case SelectType.None:
                Texture = Match3TextureManager.GetTextureBackgroundTile();
                break;

            case SelectType.Focus:
                Texture = Match3TextureManager.GetTextureTileBack(CellBackType.Yellow);
                break;

            case SelectType.FirstSelect:
                Texture = Match3TextureManager.GetTextureTileBack(CellBackType.Green);
                break;

            case SelectType.SecondSelect:
                Texture = Match3TextureManager.GetTextureTileBack(CellBackType.Blue);
                break;
            }
        }