예제 #1
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;
            }
예제 #2
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());
            }
        }
예제 #3
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());
        }