示例#1
0
    public void RenderItemRow(int i, int iw, int ih)
    {
        Inventory inv        = manager.actor.inventory;
        Data      item       = inv.Peek(i);
        EquipSlot arms       = manager.actor.arms;
        string    statusText = "";
        int       status     = inv.GetStatus(i);

        switch (status)
        {
        case Inventory.PRIMARY: statusText = "[Right]"; break;

        case Inventory.SECONDARY: statusText = "[Left]"; break;

        case Inventory.HEAD: statusText = "[Head]"; break;

        case Inventory.TORSO: statusText = "[Torso]"; break;

        case Inventory.LEGS: statusText = "[Legs]"; break;
        }
        string name = item == null ? "EMPTY" : item.displayName;
        string info = item == null ? "" : " " + item.stack + "/" + item.stackSize;
        string str  = statusText + name + info;

        if (Button(str, 0, ih * i, iw, ih, 0, i))
        {
            if (status == Inventory.STORED)
            {
                manager.actor.Equip(i);
            }
            else if (status != Inventory.EMPTY)
            {
                UnequipByIndex(i);
            }
            Sound(0);
        }
        if (status == Inventory.STORED && arms.DualEquipAvailable(item))
        {
            if (Button("Dual Wield", iw, ih * i, iw / 2, ih, 1, i))
            {
                manager.actor.DualEquip(i);
                Sound(0);
            }
        }
        if (Button("Drop", iw + iw / 2, ih * i, iw / 2, ih, 2, i))
        {
            manager.actor.DiscardItem(i);
            Sound(0);
        }
    }