コード例 #1
0
    public void OnClick()
    {
        if (!PlayerList.Instance.IsClientAdmin)
        {
            return;
        }

        //If shift is pressed, don't check anything, just send Examine on contained item if any.
        if (KeyboardInputManager.IsShiftPressed() && ui_itemSlot.Item != null)
        {
            RequestExamineMessage.Send(ui_itemSlot.Item.GetComponent <NetworkIdentity>().netId);
            return;
        }

        var adminHand = AdminManager.Instance.LocalAdminGhostStorage.GetNamedItemSlot(NamedSlot.ghostStorage01);

        if (ui_itemSlot.ItemSlot != adminHand)
        {
            if (ui_itemSlot.Item == null)
            {
                if (adminHand.Item)
                {
                    AdminInventoryTransferMessage.Send(adminHand, ui_itemSlot.ItemSlot);
                }
            }
            else
            {
                if (adminHand.Item == null)
                {
                    AdminInventoryTransferMessage.Send(ui_itemSlot.ItemSlot, adminHand);
                }
            }
        }
    }
コード例 #2
0
    public static void Send(ItemSlot fromSlot, ItemSlot toSlot)
    {
        AdminInventoryTransferMessage msg = new AdminInventoryTransferMessage
        {
            FromStorage   = fromSlot.ItemStorageNetID,
            FromSlotIndex = fromSlot.SlotIdentifier.SlotIndex,
            FromNamedSlot = fromSlot.SlotIdentifier.NamedSlot.GetValueOrDefault(NamedSlot.back),
            ToStorage     = toSlot.ItemStorageNetID,
            ToSlotIndex   = toSlot.SlotIdentifier.SlotIndex,
            ToNamedSlot   = toSlot.SlotIdentifier.NamedSlot.GetValueOrDefault(NamedSlot.back)
        };

        msg.Send();
    }