Ejemplo n.º 1
0
        public WndCatalogus()
        {
            Resize(WIDTH, HEIGHT);

            _txtTitle = PixelScene.CreateText(TxtTitle, 9);
            _txtTitle.Hardlight(TitleColor);
            _txtTitle.Measure();
            Add(_txtTitle);

            _list             = new ScrollPane(new Component());
            _list.ClickAction = ListClick;
            Add(_list);
            _list.SetRect(0, _txtTitle.Height, WIDTH, HEIGHT - _txtTitle.Height);

            var potionTab = new LabeledTab(this, TxtPotions);

            potionTab.SelectAction = PotionTabSelect;
            Tabs.Add(potionTab);

            var scrollTab = new LabeledTab(this, TxtPotions);

            scrollTab.SelectAction = ScrollTabSelect;
            Tabs.Add(potionTab);

            foreach (var tab in Tabs)
            {
                tab.SetSize(TabWidth, TabHeight());
                Add(tab);
            }

            Select(ShowPotions ? 0 : 1);
        }
Ejemplo n.º 2
0
        public WndChallenges(int isChecked, bool editable)
        {
            _editable = editable;

            var title = PixelScene.CreateText(Title, 9);

            title.Hardlight(TitleColor);
            title.Measure();
            title.X = PixelScene.Align(Camera, (WIDTH - title.Width) / 2);
            Add(title);

            _boxes = new List <CheckBox>();

            var pos = title.Height + Gap;

            for (var i = 0; i < Challenges.NAMES.Length; i++)
            {
                var cb = new CheckBox(Challenges.NAMES[i]);
                cb.SetChecked((isChecked & Challenges.MASKS[i]) != 0);
                cb.Active = editable;

                if (i > 0)
                {
                    pos += Gap;
                }

                cb.SetRect(0, pos, WIDTH, BtnHeight);
                pos = cb.Bottom();

                Add(cb);
                _boxes.Add(cb);
            }

            Resize(WIDTH, (int)pos);
        }
Ejemplo n.º 3
0
        public WndJournal()
        {
            Resize(WIDTH, HEIGHT);

            txtTitle = PixelScene.CreateText(TxtTitle, 9);
            txtTitle.Hardlight(TitleColor);
            txtTitle.Measure();
            txtTitle.X = PixelScene.Align(PixelScene.uiCamera, (WIDTH - txtTitle.Width) / 2);
            Add(txtTitle);

            var content = new Component();

            Collections.Sort(Journal.Records);

            float pos = 0;

            foreach (var rec in Journal.Records)
            {
                var item = new ListItem(rec.feature, rec.depth);
                item.SetRect(0, pos, WIDTH, ItemHeight);
                content.Add(item);

                pos += item.Height;
            }

            content.SetSize(WIDTH, pos);

            list = new ScrollPane(content);
            Add(list);

            list.SetRect(0, txtTitle.Height, WIDTH, HEIGHT - txtTitle.Height);
        }
Ejemplo n.º 4
0
            protected override void CreateChildren()
            {
                base.CreateChildren();

                _btLabel = PixelScene.CreateText(9);

                Add(_btLabel);
            }
Ejemplo n.º 5
0
        protected override void CreateChildren()
        {
            _sprite = new ItemSprite();
            Add(_sprite);

            _label = PixelScene.CreateText(8);
            Add(_label);
        }
Ejemplo n.º 6
0
            protected override void CreateChildren()
            {
                _icon = new Image();
                Add(_icon);

                _label = PixelScene.CreateText(6);
                Add(_label);
            }
Ejemplo n.º 7
0
        protected override void CreateChildren()
        {
            base.CreateChildren();

            Bg = Chrome.Get(Chrome.Type.BUTTON);
            Add(Bg);

            InternalText = PixelScene.CreateText(9);
            Add(InternalText);
        }
Ejemplo n.º 8
0
            protected override void CreateChildren()
            {
                _feature = PixelScene.CreateText(9);
                Add(_feature);

                _depth = new BitmapText(PixelScene.font1x);
                Add(_depth);

                _icon = Icons.DEPTH.Get();
                Add(_icon);
            }
Ejemplo n.º 9
0
            protected override void CreateChildren()
            {
                _bg = new ColorBlock(HEIGHT, HEIGHT, Color.Argb(0xFF, 0x4A, 0x4D, 0x44));
                Add(_bg);

                _slot = new ItemSlot();
                Add(_slot);

                _name = PixelScene.CreateText("?", 7);
                Add(_name);

                base.CreateChildren();
            }
Ejemplo n.º 10
0
        protected override void CreateChildren()
        {
            base.CreateChildren();

            Bg = Chrome.Get(Chrome.Type.TOAST_TR);
            Add(Bg);

            Close             = new SimpleButton(Icons.CLOSE.Get());
            Close.ClickAction = OnClose;
            Add(Close);

            BitmapText = PixelScene.CreateText(8);
            Add(BitmapText);
        }
Ejemplo n.º 11
0
            private void StatSlot(string label, string value)
            {
                var txt = PixelScene.CreateText(label, 8);

                txt.Y = pos;
                Add(txt);

                txt = PixelScene.CreateText(value, 8);
                txt.Measure();
                txt.X = PixelScene.Align(WIDTH * 0.65f);
                txt.Y = pos;
                Add(txt);

                pos += GAP + txt.BaseLine();
            }
Ejemplo n.º 12
0
            private float StatSlot(Group parent, string label, string value, float pos)
            {
                var txt = PixelScene.CreateText(label, 7);

                txt.Y = pos;
                parent.Add(txt);

                txt = PixelScene.CreateText(value, 7);
                txt.Measure();
                txt.X = PixelScene.Align(WIDTH * 0.65f);
                txt.Y = pos;
                parent.Add(txt);

                return(pos + Gap + txt.BaseLine());
            }
Ejemplo n.º 13
0
            public PerksTab(HeroClass cl)
            {
                float dotWidth = 0;

                var   items = cl.Perks();
                float pos   = MARGIN;

                for (var i = 0; i < items.Length; i++)
                {
                    if (i > 0)
                    {
                        pos += GAP;
                    }

                    var dot = PixelScene.CreateText(DOT, 6);
                    dot.X = MARGIN;
                    dot.Y = pos;
                    if (dotWidth == 0)
                    {
                        dot.Measure();
                        dotWidth = dot.Width;
                    }
                    Add(dot);

                    var item = PixelScene.CreateMultiline(items[i], 6);
                    item.X        = dot.X + dotWidth;
                    item.Y        = pos;
                    item.MaxWidth = (int)(WIDTH - MARGIN * 2 - dotWidth);
                    item.Measure();
                    Add(item);

                    pos += item.Height;
                    var w = item.Width;
                    if (w > Width)
                    {
                        Width = w;
                    }
                }

                Width += MARGIN + dotWidth;
                Height = pos + MARGIN;
            }
Ejemplo n.º 14
0
        public WndList(IList <string> items)
        {
            float pos      = Margin;
            float dotWidth = 0;
            float maxWidth = 0;

            for (var i = 0; i < items.Count; i++)
            {
                if (i > 0)
                {
                    pos += Gap;
                }

                var dot = PixelScene.CreateText(Dot, 6);
                dot.X = Margin;
                dot.Y = pos;

                if (Math.Abs(dotWidth) < 0.0001)
                {
                    dot.Measure();
                    dotWidth = dot.Width;
                }

                Add(dot);

                var item = PixelScene.CreateMultiline(items[i], 6);
                item.X        = dot.X + dotWidth;
                item.Y        = pos;
                item.MaxWidth = (int)(LocalWidth - Margin * 2 - dotWidth);
                item.Measure();
                Add(item);

                pos += item.Height;
                var w = item.Width;
                if (w > maxWidth)
                {
                    maxWidth = w;
                }
            }

            Resize((int)(maxWidth + dotWidth + Margin * 2), (int)(pos + Margin));
        }
Ejemplo n.º 15
0
            public MobTitle(Mob mob)
            {
                _hp = (float)mob.HP / mob.HT;

                _name = PixelScene.CreateText(Utils.Capitalize(mob.Name), 9);
                _name.Hardlight(TitleColor);
                _name.Measure();
                Add(_name);

                _image = mob.Sprite;
                Add(_image);

                _hpBg = new ColorBlock(1, 1, _colorBg);
                Add(_hpBg);

                _hpLvl = new ColorBlock(1, 1, _colorLvl);
                Add(_hpLvl);

                _buffs = new BuffIndicator(mob);
                Add(_buffs);
            }
Ejemplo n.º 16
0
        public WndBag(Bag bag, Listener listener, Mode mode, string title)
        {
            this.listener = listener;
            this.mode     = mode;
            this.title    = title;

            lastMode = mode;
            lastBag  = bag;

            var txtTitle = PixelScene.CreateText(title ?? Utils.Capitalize(bag.Name), 9);

            txtTitle.Hardlight(TitleColor);
            txtTitle.Measure();
            txtTitle.X = (int)(SLOT_SIZE * COLS + SLOT_MARGIN * (COLS - 1) - txtTitle.Width) / 2;
            txtTitle.Y = (int)(TITLE_HEIGHT - txtTitle.Height) / 2;
            Add(txtTitle);

            PlaceItems(bag);

            Resize(SLOT_SIZE * COLS + SLOT_MARGIN * (COLS - 1), SLOT_SIZE * ROWS + SLOT_MARGIN * (ROWS - 1) + TITLE_HEIGHT);

            var stuff = Dungeon.Hero.Belongings;

            Bag[] bags = { stuff.Backpack, stuff.GetItem <SeedPouch>(), stuff.GetItem <ScrollHolder>(), stuff.GetItem <WandHolster>() };

            foreach (var b in bags)
            {
                if (b == null)
                {
                    continue;
                }

                var tab = new BagTab(this, b);
                tab.SetSize(TAB_WIDTH, TabHeight());
                Add(tab);

                tab.Select(b == bag);
            }
        }
Ejemplo n.º 17
0
            private void BuffSlot(Buff buff)
            {
                var index = buff.Icon();

                if (index == BuffIndicator.NONE)
                {
                    return;
                }

                var icon = new Image(_heroWindow.icons);

                icon.Frame(_heroWindow.film.Get(index));
                icon.Y = _pos;
                Add(icon);

                var txt = PixelScene.CreateText(buff.ToString(), 8);

                txt.X = icon.Width + Gap;
                txt.Y = _pos + (int)(icon.Height - txt.BaseLine()) / 2;
                Add(txt);

                _pos += Gap + icon.Height;
            }
Ejemplo n.º 18
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;
            }