Exemplo n.º 1
0
        public Inventory()
        {
            _backDrop = new Rectangle(87 * 2, 38 * 2,
                                      305 * 2, 204 * 2);
            _inactiveY             = _backDrop.Y - _backDrop.Height;
            _activeY               = _backDrop.Y;
            _posAtStartOfAnimation = _backDrop.Y;

            CreateTileHolders();

            int buttonWidth  = 46 * 2;
            int buttonHeight = 15 * 2;

            int spacingBetweenButtons = 6;

            // Category buttons on the side.
            Button button1 = new TextButton(new Vector2(99 * 2, 60 * 2), "Building", false);

            button1.MouseClicked += BuldingCatClicked;
            BuldingCatClicked(button1);
            _categoryButtons.Add(button1);

            Button button2 = new TextButton(new Vector2(button1.GetPosition().X, button1.GetPosition().Y + buttonHeight * 1 + spacingBetweenButtons * 2), "Wall", false);

            button2.MouseClicked += WallCatClicked;
            _categoryButtons.Add(button2);

            Button button3 = new TextButton(new Vector2(button1.GetPosition().X, button1.GetPosition().Y + buttonHeight * 2 + spacingBetweenButtons * 4), "Objects", false);

            button3.MouseClicked += ObjectsCatClicked;;
            _categoryButtons.Add(button3);

            Button button4 = new TextButton(new Vector2(button1.GetPosition().X, button1.GetPosition().Y + buttonHeight * 3 + spacingBetweenButtons * 6), "Entities", false);

            button4.MouseClicked += CharactersCatClicked;;
            _categoryButtons.Add(button4);

            Button button5 = new TextButton(new Vector2(button1.GetPosition().X, button1.GetPosition().Y + buttonHeight * 4 + spacingBetweenButtons * 8), "Special", false);

            button5.MouseClicked += SpecialCatClicked;
            _categoryButtons.Add(button5);

            foreach (var button in _categoryButtons)
            {
                button.BindTo(_backDrop);
                button.ChangeDimensions(new Rectangle(0, 0, (buttonWidth), (buttonHeight)));
                button.Color = new Color(95, 95, 95);
            }

            GraphicsRenderer.OnResolutionChanged += SetElementPositions;
            SetElementPositions(TMBAW_Game.UserResWidth, TMBAW_Game.UserResHeight);
        }