예제 #1
0
        public WndItem(WndBag owner, Item item)
        {
            var titlebar = new IconTitle();

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

            if (item.levelKnown && item.level > 0)
            {
                titlebar.Color(ItemSlot.Upgraded);
            }
            else
            if (item.levelKnown && item.level < 0)
            {
                titlebar.Color(ItemSlot.Degraded);
            }

            var info = PixelScene.CreateMultiline(item.Info(), 6);

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

            var   y = info.Y + info.Height + Gap;
            float x = 0;

            if (Dungeon.Hero.IsAlive && owner != null)
            {
                foreach (var action in item.Actions(Dungeon.Hero))
                {
                    var btn = new RedButton(action);
                    btn.ClickAction = button =>
                    {
                        item.Execute(Dungeon.Hero, action);
                        Hide();
                        owner.Hide();
                    };
                    btn.SetSize(Math.Max(ButtonWidth, btn.ReqWidth()), ButtonHeight);
                    if (x + btn.Width > WIDTH)
                    {
                        x  = 0;
                        y += ButtonHeight + Gap;
                    }
                    btn.SetPos(x, y);
                    Add(btn);

                    x += btn.Width + Gap;
                }
            }

            Resize(WIDTH, (int)(y + (x > 0 ? ButtonHeight : 0)));
        }
예제 #2
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);
            }
예제 #3
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;
            }