Пример #1
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);
            }
        }
Пример #2
0
 public List <Item> GetList(BagTab tab)
 {
     //returns the list of items in the tab given
     return(tabs[tab]);
 }