예제 #1
0
        public CannonUpgradeInterface(UpgradeCannon upgrade, Texture2D icon, string valueString, GraphicsDevice graphics,
                                      int x, int y, int width, int height, SpriteFont font, CannonStats stat)
        {
            Stat = stat;

            this.icon       = icon;
            this.upgrade    = upgrade;
            this.font       = font;
            this.stat       = stat;
            this.graphics   = graphics;
            origValueString = valueString;

            bgImg  = new Texture2D(graphics, width, height);
            bgImg  = DrawHelper.AddBorder(bgImg, 3, Color.Gray, Color.LightGray);
            bgRect = new Rectangle(x, y, width, height);

            iconRect        = new Rectangle(0, bgRect.Y + SPACING, bgRect.Width - (SPACING * 2), 0);
            iconRect.Height = iconRect.Width;
            iconRect.X      = bgRect.X + (bgRect.Width / 2 - (iconRect.Width / 2));

            this.valueString = Language.Translate(valueString);

            upgradeButton = new MenuButton(Upgrade, Language.Translate("Upgrade") + " " + valueString, 0,
                                           0, true, font, graphics);
            upgradeButton.CanHold = true;
            Position();

            costPos = new Vector2(0, upgradeButton.Y + upgradeButton.Height + SPACING);
        }
예제 #2
0
        public CannonUpgradeMenu(int windowWidth, int windowHeight, GraphicsDevice graphics, Texture2D arrowImg,
                                 List <CannonStats> stats, UpgradeCannon upgrade, List <Texture2D> statIcons, SpriteFont font)
        {
            this.windowWidth  = windowWidth;
            this.windowHeight = windowHeight;

            for (int i = 0; i < stats.Count; i++)
            {
                interfaces.Add(new CannonUpgradeInterface(upgrade, statIcons[i], stats[i].ToString().AddSpaces(),
                                                          graphics, 0, 0, INT_WIDTH, INT_HEIGHT, font, stats[i]));
            }
            UpdatePagesToInterfaces();

            nextButton   = new MenuButton(NextPage, 0, 0, true, graphics, arrowImg);
            nextButton.X = windowWidth - SPACING - nextButton.Width;
            nextButton.Y = windowHeight - SPACING - nextButton.Height;
            prevButton   = new MenuButton(PrevPage, SPACING, nextButton.Y, true, graphics, arrowImg);

            X_OFFSET = (windowWidth - (interfaces[0].Width * ITEMS_PER_ROW + SPACING * ITEMS_PER_ROW)) / 2;

            statInfoHover = new StatInfoHover(CannonStats.Accuracy, font, graphics, windowWidth);
        }