Esempio n. 1
0
        public WndBlacksmith(Blacksmith troll, Hero hero)
        {
            ItemSelector = new BlacksmithItemSelector(this);

            var titlebar = new IconTitle();

            titlebar.Icon(troll.Sprite);
            titlebar.Label(Utils.Capitalize(troll.Name));
            titlebar.SetRect(0, 0, WIDTH, 0);
            Add(titlebar);

            var message = PixelScene.CreateMultiline(TxtPrompt, 6);

            message.MaxWidth = WIDTH;
            message.Measure();
            message.Y = titlebar.Bottom() + Gap;
            Add(message);

            BtnItem1             = new ItemButton();
            BtnItem1.ClickAction = () =>
            {
                BtnPressed = BtnItem1;
                GameScene.SelectItem(ItemSelector, WndBag.Mode.UPGRADEABLE, TxtSelect);
            };
            BtnItem1.SetRect((WIDTH - BtnGap) / 2 - BtnSize, message.Y + message.Height + BtnGap, BtnSize, BtnSize);
            Add(BtnItem1);

            BtnItem2             = new ItemButton();
            BtnItem2.ClickAction = () =>
            {
                BtnPressed = BtnItem2;
                GameScene.SelectItem(ItemSelector, WndBag.Mode.UPGRADEABLE, TxtSelect);
            };
            BtnItem2.SetRect(BtnItem1.Right() + BtnGap, BtnItem1.Top(), BtnSize, BtnSize);
            Add(BtnItem2);

            BtnReforge             = new RedButton(TxtReforge);
            BtnReforge.ClickAction = button =>
            {
                troll.Upgrade(BtnItem1.Item, BtnItem2.Item);
                Hide();
            };
            BtnReforge.Enable(false);
            BtnReforge.SetRect(0, BtnItem1.Bottom() + BtnGap, WIDTH, 20);
            Add(BtnReforge);


            Resize(WIDTH, (int)BtnReforge.Bottom());
        }