Esempio n. 1
0
 public ItemButton(InventoryComponent component, int slot)
     : base(Locator.getTextureManager().loadTexture("tile32"), Services.PostCategory.INV_SLOT)
 {
     component_ = component;
     slot_ = slot;
     count_ = new Text("", false);
     count_.parent_ = this;
 }
Esempio n. 2
0
        private void checkStatus()
        {
            InventoryComponent ic = entity_.inventory;

            for (int index = 0; index < ic.capacity; ++index)
            {
                GameEntity item = ic.getItem(index);
                if (item == null)
                {
                    continue;
                }
                if (item.item.ID_ == Locator.getObjectFactory().orbItem.ID_)
                {
                    entity_.info.state = ObjectState.OK;
                    return;
                }
            }
            entity_.info.state = ObjectState.DISABLED;
        }
Esempio n. 3
0
        public InventoryFrame(InventoryComponent source)
            : base(1, 1)
        {
            padding_ = new Vector2(5);
            source_ = source;
            capacity_ = source_.capacity;
            buttons_ = new ItemButton[capacity_];
            int rows = 1;
            int cols = capacity_;
            if (capacity_ > maxPerLine)
            {
                rows = capacity_ / maxPerLine;
                cols = maxPerLine;
            }
            inner_ = new FrameComponent(rows, cols);
            set(0, 0, inner_);
            int row = 0;
            int col = 0;
            for (int index = 0; index < capacity_; ++index)
            {
                buttons_[index] = new ItemButton(source_, index);
                buttons_[index].slot_ = index;
                buttons_[index].getSource = getSource;
                buttons_[index].getComponent = getComponent;
                buttons_[index].getTarget = source_.getItem;
                inner_.set(row, col++, buttons_[index]);
                if (col >= maxPerLine)
                {
                    ++row;
                    col = 0;
                }
            }

            refresh();
            source_.register(refresh);
        }