예제 #1
0
        public WndWandmaker(Wandmaker wandmaker, Item item)
        {
            _wandmaker = wandmaker;
            _item      = item;
            var titlebar = new IconTitle();

            titlebar.Icon(new ItemSprite(item.image, null));
            titlebar.Label(Utils.Capitalize(item.Name));
            titlebar.SetRect(0, 0, WIDTH, 0);
            Add(titlebar);

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

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


            var btnBattle = new RedButton(TxtBattle);

            btnBattle.ClickAction = BattleAction;
            btnBattle.SetRect(0, message.Y + message.Height + Gap, WIDTH, BtnHeight);
            Add(btnBattle);

            var btnNonBattle = new RedButton(TxtNonBattle);

            btnNonBattle.ClickAction = NonBattleAction;
            btnNonBattle.SetRect(0, btnBattle.Bottom() + Gap, WIDTH, BtnHeight);
            Add(btnNonBattle);

            Resize(WIDTH, (int)btnNonBattle.Bottom());
        }
예제 #2
0
        public WndImp(Imp imp, DwarfToken tokens)
        {
            _imp    = imp;
            _tokens = tokens;
            var titlebar = new IconTitle();

            titlebar.Icon(new ItemSprite(tokens.Image, null));
            titlebar.Label(Utils.Capitalize(tokens.Name));
            titlebar.SetRect(0, 0, WIDTH, 0);
            Add(titlebar);

            BitmapTextMultiline message = PixelScene.CreateMultiline(TxtMessage, 6);

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

            var btnReward = new RedButton(TxtReward);

            btnReward.ClickAction = RewardClickAction;
            btnReward.SetRect(0, message.Y + message.Height + Gap, WIDTH, BtnHeight);
            Add(btnReward);

            Resize(WIDTH, (int)btnReward.Bottom());
        }
예제 #3
0
        public WndSadGhost(Ghost ghost, Item item)
        {
            _ghost = ghost;
            _item  = item;
            var titlebar = new IconTitle();

            titlebar.Icon(new ItemSprite(item.image, null));
            titlebar.Label(Utils.Capitalize(item.Name));
            titlebar.SetRect(0, 0, WIDTH, 0);
            Add(titlebar);

            BitmapTextMultiline message = PixelScene.CreateMultiline(item is DriedRose ? TxtRose : TxtRat, 6);

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

            var btnWeapon = new RedButton(TxtWeapon);

            btnWeapon.ClickAction = WeaponClick;
            btnWeapon.SetRect(0, message.Y + message.Height + GAP, WIDTH, BTN_HEIGHT);
            Add(btnWeapon);

            var btnArmor = new RedButton(TxtArmor);

            btnArmor.ClickAction = ArmorClick;
            btnArmor.SetRect(0, btnWeapon.Bottom() + GAP, WIDTH, BTN_HEIGHT);
            Add(btnArmor);

            Resize(WIDTH, (int)btnArmor.Bottom());
        }
예제 #4
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);
            }
        }
예제 #5
0
            public WndBalance(Weapon weapon)
            {
                var titlebar = new IconTitle(weapon);

                titlebar.SetRect(0, 0, WIDTH, 0);
                Add(titlebar);

                var tfMesage = PixelScene.CreateMultiline(Utils.Format(TXT_CHOICE, weapon.Name), 8);

                tfMesage.MaxWidth = WIDTH - MARGIN * 2;
                tfMesage.Measure();
                tfMesage.X = MARGIN;
                tfMesage.Y = titlebar.Bottom() + MARGIN;
                Add(tfMesage);

                var pos = tfMesage.Y + tfMesage.Height;

                if (weapon.imbue != Weapon.Imbue.Speed)
                {
                    var btnSpeed = new RedButton(TXT_SPEED);
                    btnSpeed.ClickAction = button =>
                    {
                        Hide();
                        Apply(weapon, true);
                    };
                    btnSpeed.SetRect(MARGIN, pos + MARGIN, BUTTON_WIDTH, BUTTON_HEIGHT);
                    Add(btnSpeed);

                    pos = btnSpeed.Bottom();
                }

                if (weapon.imbue != Weapon.Imbue.Accuracy)
                {
                    var btnAccuracy = new RedButton(TXT_ACCURACY);
                    btnAccuracy.ClickAction = button =>
                    {
                        Hide();
                        Apply(weapon, false);
                    };
                    btnAccuracy.SetRect(MARGIN, pos + MARGIN, BUTTON_WIDTH, BUTTON_HEIGHT);
                    Add(btnAccuracy);

                    pos = btnAccuracy.Bottom();
                }

                var btnCancel = new RedButton(TXT_CANCEL);

                btnCancel.ClickAction = button => Hide();
                btnCancel.SetRect(MARGIN, pos + MARGIN, BUTTON_WIDTH, BUTTON_HEIGHT);
                Add(btnCancel);

                Resize(WIDTH, (int)btnCancel.Bottom() + MARGIN);
            }
예제 #6
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());
        }
예제 #7
0
        public WndResurrect(Ankh ankh, object causeOfDeath)
        {
            Instance     = this;
            CauseOfDeath = causeOfDeath;

            var titlebar = new IconTitle();

            titlebar.Icon(new ItemSprite(ankh.image, null));
            titlebar.Label(ankh.Name);
            titlebar.SetRect(0, 0, WIDTH, 0);
            Add(titlebar);

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

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


            var btnYes = new RedButton(TxtYes);

            btnYes.ClickAction = button =>
            {
                Hide();
                Statistics.AnkhsUsed++;
                InterlevelScene.mode = InterlevelScene.Mode.RESURRECT;
                Game.SwitchScene <InterlevelScene>();
            };
            btnYes.SetRect(0, message.Y + message.Height + Gap, WIDTH, BtnHeight);
            Add(btnYes);

            var btnNo = new RedButton(TxtNo);

            btnNo.ClickAction = button =>
            {
                Hide();
                Rankings.Instance.Submit(false);
                Hero.ReallyDie(causeOfDeath);
            };
            btnNo.SetRect(0, btnYes.Bottom() + Gap, WIDTH, BtnHeight);
            Add(btnNo);


            Resize(WIDTH, (int)btnNo.Bottom());
        }
예제 #8
0
            public StatsTab()
            {
                var heroClass = Dungeon.Hero.ClassName();

                var title = new IconTitle();

                title.Icon(HeroSprite.Avatar(Dungeon.Hero.heroClass, Dungeon.Hero.Tier()));
                title.Label(Utils.Format(TxtTitle, Dungeon.Hero.Lvl, heroClass).ToUpper(CultureInfo.CurrentCulture));
                title.SetRect(0, 0, WIDTH, 0);
                Add(title);

                float pos = title.Bottom();

                if (Dungeon.Challenges > 0)
                {
                    var btnCatalogus = new RedButton(TxtChallenges);
                    btnCatalogus.ClickAction = button => Game.Scene.Add(new WndChallenges(Dungeon.Challenges, false));
                    btnCatalogus.SetRect(0, pos + Gap, btnCatalogus.ReqWidth() + 2, btnCatalogus.ReqHeight() + 2);
                    Add(btnCatalogus);

                    pos = btnCatalogus.Bottom();
                }

                pos += Gap + Gap;

                pos = StatSlot(this, TxtStr, Dungeon.Hero.STR.ToString(), pos);
                pos = StatSlot(this, TxtHealth, Dungeon.Hero.HT.ToString(), pos);

                pos += Gap;

                pos = StatSlot(this, TxtDuration, ((int)Statistics.Duration).ToString(), pos);

                pos += Gap;

                pos = StatSlot(this, TxtDepth, Statistics.DeepestFloor.ToString(), pos);
                pos = StatSlot(this, TxtEnemies, Statistics.EnemiesSlain.ToString(), pos);
                pos = StatSlot(this, TxtGold, Statistics.GoldCollected.ToString(), pos);

                pos += Gap;

                pos = StatSlot(this, TxtFood, Statistics.FoodEaten.ToString(), pos);
                pos = StatSlot(this, TxtAlchemy, Statistics.PotionsCooked.ToString(), pos);
                pos = StatSlot(this, TxtAnkhs, Statistics.AnkhsUsed.ToString(), pos);
            }
예제 #9
0
        public WndTradeItem(Shopkeeper keeper, Item item, WndBag owner)
        {
            _keeper = keeper;
            _item   = item;
            _owner  = owner;

            var pos = CreateDescription(item, false);

            if (item.Quantity() == 1)
            {
                var btnSell = new RedButton(Utils.Format(TxtSell, item.Price()));
                btnSell.ClickAction = SellAction;
                btnSell.SetRect(0, pos + Gap, WIDTH, BtnHeight);
                Add(btnSell);

                pos = btnSell.Bottom();
            }
            else
            {
                var priceAll = item.Price();
                var btnSell1 = new RedButton(Utils.Format(TxtSell1, priceAll / item.Quantity()));
                btnSell1.ClickAction = SellOneAction;
                btnSell1.SetRect(0, pos + Gap, WIDTH, BtnHeight);
                Add(btnSell1);

                var btnSellAll = new RedButton(Utils.Format(TxtSellAll, priceAll));
                btnSellAll.ClickAction = SellAction;
                btnSellAll.SetRect(0, btnSell1.Bottom() + Gap, WIDTH, BtnHeight);
                Add(btnSellAll);

                pos = btnSellAll.Bottom();
            }

            var btnCancel = new RedButton(TxtCancel);

            btnCancel.ClickAction = CancelAction;
            btnCancel.SetRect(0, pos + Gap, WIDTH, BtnHeight);
            Add(btnCancel);

            Resize(WIDTH, (int)btnCancel.Bottom());
        }
예제 #10
0
            public StatsTab(WndHero wndHero)
            {
                _wndHero = wndHero;
                var hero = Dungeon.Hero;

                var title = PixelScene.CreateText(Utils.Format(TXT_TITLE, hero.Lvl, hero.ClassName()).ToUpper(), 9);

                title.Hardlight(TitleColor);
                title.Measure();
                Add(title);

                var btnCatalogus = new RedButton(TXT_CATALOGUS);

                btnCatalogus.ClickAction = CatalogusClickAction;
                btnCatalogus.SetRect(0, title.Y + title.Height, btnCatalogus.ReqWidth() + 2, btnCatalogus.ReqHeight() + 2);
                Add(btnCatalogus);

                var btnJournal = new RedButton(TXT_JOURNAL);

                btnJournal.ClickAction = JournalClickAction;
                btnJournal.SetRect(btnCatalogus.Right() + 1, btnCatalogus.Top(), btnJournal.ReqWidth() + 2, btnJournal.ReqHeight() + 2);
                Add(btnJournal);

                pos = btnCatalogus.Bottom() + GAP;

                StatSlot(TXT_STR, hero.STR);
                StatSlot(TXT_HEALTH, hero.HP + "/" + hero.HT);
                StatSlot(TXT_EXP, hero.Exp + "/" + hero.MaxExp());

                pos += GAP;

                StatSlot(TXT_GOLD, Statistics.GoldCollected);
                StatSlot(TXT_DEPTH, Statistics.DeepestFloor);

                pos += GAP;
            }
예제 #11
0
        public WndSettings(bool inGame)
        {
            CheckBox btnImmersive = null;

            if (inGame)
            {
                var w = BtnHeight;

                _btnZoomOut             = new RedButton(TxtZoomOut);
                _btnZoomOut.ClickAction = button => Zoom(pdsharp.noosa.Camera.Main.Zoom - 1);
                Add(_btnZoomOut.SetRect(0, 0, w, BtnHeight));

                _btnZoomIn             = new RedButton(TxtZoomIn);
                _btnZoomIn.ClickAction = button => Zoom(pdsharp.noosa.Camera.Main.Zoom + 1);
                Add(_btnZoomIn.SetRect(WIDTH - w, 0, w, BtnHeight));

                var btnZoomDefault = new RedButton(TxtZoomDefault);
                btnZoomDefault.ClickAction = button => Zoom(PixelScene.defaultZoom);
                btnZoomDefault.SetRect(_btnZoomOut.Right(), 0, WIDTH - _btnZoomIn.Width - _btnZoomOut.Width, BtnHeight);
                Add(btnZoomDefault);
            }
            else
            {
                var btnScaleUp = new CheckBox(TxtScaleUp);
                btnScaleUp.ClickAction = ScaleUpClick;
                btnScaleUp.SetRect(0, 0, WIDTH, BtnHeight);
                btnScaleUp.SetChecked(PixelDungeon.ScaleUp());
                Add(btnScaleUp);

                btnImmersive             = new CheckBox(TxtImmersive);
                btnImmersive.ClickAction = ImmersiveClick;
                btnImmersive.SetRect(0, btnScaleUp.Bottom() + Gap, WIDTH, BtnHeight);
                btnImmersive.SetChecked(PixelDungeon.Immersed());
                btnImmersive.Enable(Build.VERSION.SdkInt >= BuildVersionCodes.Kitkat);
                Add(btnImmersive);
            }

            var btnMusic = new CheckBox(TxtMusic);

            btnMusic.ClickAction = button =>
            {
                var checkBox = button as CheckBox;
                PixelDungeon.Music(checkBox != null && checkBox.Checked());
            };
            btnMusic.SetRect(0, (btnImmersive != null ? btnImmersive.Bottom() : BtnHeight) + Gap, WIDTH, BtnHeight);
            btnMusic.SetChecked(PixelDungeon.Music());
            Add(btnMusic);

            var btnSound = new CheckBox(TxtSound);

            btnSound.ClickAction = SoundClick;
            btnSound.SetRect(0, btnMusic.Bottom() + Gap, WIDTH, BtnHeight);
            btnSound.SetChecked(PixelDungeon.SoundFx());
            Add(btnSound);

            if (!inGame)
            {
                var btnOrientation = new RedButton(OrientationText());
                btnOrientation.ClickAction = OrientationClick;
                btnOrientation.SetRect(0, btnSound.Bottom() + Gap, WIDTH, BtnHeight);
                Add(btnOrientation);

                Resize(WIDTH, (int)btnOrientation.Bottom());
            }
            else
            {
                var btnBrightness = new CheckBox(TxtBrightness);
                btnBrightness.ClickAction = button =>
                {
                    var checkBox = button as CheckBox;
                    PixelDungeon.Brightness(checkBox != null && checkBox.Checked());
                };
                btnBrightness.SetRect(0, btnSound.Bottom() + Gap, WIDTH, BtnHeight);
                btnBrightness.SetChecked(PixelDungeon.Brightness());
                Add(btnBrightness);

                Resize(WIDTH, (int)btnBrightness.Bottom());
            }
        }
예제 #12
0
        public WndChooseWay(TomeOfMastery tome, HeroSubClass way1, HeroSubClass way2)
        {
            var titlebar = new IconTitle();

            titlebar.Icon(new ItemSprite(tome.Image, null));
            titlebar.Label(tome.Name);
            titlebar.SetRect(0, 0, WIDTH, 0);
            Add(titlebar);

            var hl = new Highlighter(way1.Desc + "\\Negative\\Negative" + way2.Desc + "\\Negative\\Negative" + TxtMessage);

            var normal = PixelScene.CreateMultiline(hl.Text, 6);

            normal.MaxWidth = WIDTH;
            normal.Measure();
            normal.X = titlebar.Left();
            normal.Y = titlebar.Bottom() + Gap;
            Add(normal);

            if (hl.IsHighlighted)
            {
                normal.Mask = hl.Inverted();

                var highlighted = PixelScene.CreateMultiline(hl.Text, 6);
                highlighted.MaxWidth = normal.MaxWidth;
                highlighted.Measure();
                highlighted.X = normal.X;
                highlighted.Y = normal.Y;
                Add(highlighted);

                highlighted.Mask = hl.Mask;
                highlighted.Hardlight(TitleColor);
            }

            var btnWay1 = new RedButton(Utils.Capitalize(way1.Title));

            btnWay1.ClickAction = button =>
            {
                Hide();
                tome.Choose(way1);
            };
            btnWay1.SetRect(0, normal.Y + normal.Height + Gap, (WIDTH - Gap) / 2, BtnHeight);
            Add(btnWay1);

            var btnWay2 = new RedButton(Utils.Capitalize(way2.Title));

            btnWay2.ClickAction = button =>
            {
                Hide();
                tome.Choose(way2);
            };
            btnWay2.SetRect(btnWay1.Right() + Gap, btnWay1.Top(), btnWay1.Width, BtnHeight);
            Add(btnWay2);

            var btnCancel = new RedButton(TxtCancel);

            btnCancel.ClickAction = button => Hide();
            btnCancel.SetRect(0, btnWay2.Bottom() + Gap, WIDTH, BtnHeight);
            Add(btnCancel);

            Resize(WIDTH, (int)btnCancel.Bottom());
        }
예제 #13
0
        public override void Create()
        {
            base.Create();

            BitmapTextMultiline text = null;

            if (!NoText)
            {
                text          = CreateMultiline(Txt, 8);
                text.MaxWidth = WIDTH;
                text.Measure();
                Add(text);
            }

            _amulet = new Image(Assets.AMULET);
            Add(_amulet);

            var btnExit = new RedButton(TxtExit);

            btnExit.ClickAction = button =>
            {
                Dungeon.Win(ResultDescriptions.WIN);
                Dungeon.DeleteGame(Dungeon.Hero.heroClass, true);
                if (NoText)
                {
                    Game.SwitchScene <TitleScene>();
                }
                else
                {
                    Game.SwitchScene <RankingsScene>();
                }
            };
            btnExit.SetSize(WIDTH, BtnHeight);
            Add(btnExit);

            var btnStay = new RedButton(TxtStay);

            btnStay.ClickAction = button => OnBackPressed();
            btnStay.SetSize(WIDTH, BtnHeight);
            Add(btnStay);

            float height;

            if (NoText)
            {
                height = _amulet.Height + LargeGap + btnExit.Height + SmallGap + btnStay.Height;

                _amulet.X = Align((Camera.Main.CameraWidth - _amulet.Width) / 2);
                _amulet.Y = Align((Camera.Main.CameraHeight - height) / 2);

                btnExit.SetPos((Camera.Main.CameraWidth - btnExit.Width) / 2, _amulet.Y + _amulet.Height + LargeGap);
                btnStay.SetPos(btnExit.Left(), btnExit.Bottom() + SmallGap);
            }
            else
            {
                height = _amulet.Height + LargeGap + text.Height + LargeGap + btnExit.Height + SmallGap + btnStay.Height;

                _amulet.X = Align((Camera.Main.CameraWidth - _amulet.Width) / 2);
                _amulet.Y = Align((Camera.Main.CameraHeight - height) / 2);

                text.X = Align((Camera.Main.CameraWidth - text.Width) / 2);
                text.Y = _amulet.Y + _amulet.Height + LargeGap;

                btnExit.SetPos((Camera.Main.CameraWidth - btnExit.Width) / 2, text.Y + text.Height + LargeGap);
                btnStay.SetPos(btnExit.Left(), btnExit.Bottom() + SmallGap);
            }

            new Flare(8, 48).Color(0xFFDDBB, true).Show(_amulet, 0).AngularSpeed = +30;

            FadeIn();
        }