예제 #1
0
        private void UpdateEnabled()
        {
            var zoom = pdsharp.noosa.Camera.Main.Zoom;

            _btnZoomIn.Enable(zoom < PixelScene.maxZoom);
            _btnZoomOut.Enable(zoom > PixelScene.minZoom);
        }
예제 #2
0
        public WndTradeItem(Heap heap, bool canBuy)
        {
            _heap = heap;
            var item = heap.Peek();

            var pos = CreateDescription(item, true);

            var price = Price(item);

            if (canBuy)
            {
                var btnBuy = new RedButton(Utils.Format(TxtBuy, price));
                btnBuy.ClickAction = BuyAction;
                btnBuy.SetRect(0, pos + Gap, WIDTH, BtnHeight);
                btnBuy.Enable(price <= Dungeon.Gold);
                Add(btnBuy);

                var btnCancel = new RedButton(TxtCancel);
                btnCancel.ClickAction = CancelAction;
                btnCancel.SetRect(0, btnBuy.Bottom() + Gap, WIDTH, BtnHeight);
                Add(btnCancel);

                Resize(WIDTH, (int)btnCancel.Bottom());
            }
            else
            {
                Resize(WIDTH, (int)pos);
            }
        }
예제 #3
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());
        }