Ejemplo n.º 1
0
    // TODO: use the invUpdate delegate idea to refactor the inventory with GUI synchronisation system
    public GUIInventorySlot(GUIInventorySlot exchangeSlot_, Item.ItemType type_, int index_, Vector2 pos,
                            Func <ItemStack, bool> quickMoveItem_ = null, Action invUpdate_ = null, Func <bool> shouldShow = null)
        : base(new Vector2(), SIZE, Game.guiResourceLoader.GetResource(SLOT_TEXTURE) as Texture, shouldShow)
    {
        SetPosition(pos);

        exchangeSlot  = exchangeSlot_;
        quickMoveItem = quickMoveItem_;
        invUpdate     = invUpdate_;
        index         = index_;
        type          = type_;

        labelChild = new GUILabel();
        labelChild.SetZAsRelative(true);
        labelChild.SetZIndex(LABEL_Z);

        hoverLabel = new GUILabel();
        hoverLabel.Hide();
        hoverLabel.SetZAsRelative(true);
        hoverLabel.SetZIndex(HOVER_LABEL_Z);
        AddChild(hoverLabel);

        AssignItemStack(null);
    }