Exemplo n.º 1
0
    /// <summary>
    /// Sets the item to the slot and sends network messages to update character sprites and the player's UI
    /// </summary>
    public static void EquipInInvSlot(InventorySlot inventorySlot, GameObject item)
    {
        if (inventorySlot.IsUISlot)
        {
            UpdateSlotMessage.Send(inventorySlot.Owner, item, false, inventorySlot.equipSlot);

            if (IsEquipSpriteSlot(inventorySlot.equipSlot))
            {
                var att       = item.GetComponent <ItemAttributes>();
                var reference = att.clothingReference;
                {
                    if (inventorySlot.equipSlot == EquipSlot.leftHand)
                    {
                        reference = att.NetworkInHandRefLeft();
                    }
                    else if (inventorySlot.equipSlot == EquipSlot.rightHand)
                    {
                        reference = att.NetworkInHandRefRight();
                    }
                }
                if (att.spriteType == SpriteType.Clothing || att.hierarchy.Contains("headset") ||
                    att.hierarchy.Contains("storage/backpack") || att.hierarchy.Contains("storage/bag") ||
                    att.hierarchy.Contains("storage/belt") || att.hierarchy.Contains("tank") || inventorySlot.equipSlot == EquipSlot.handcuffs ||
                    inventorySlot.equipSlot == EquipSlot.leftHand || inventorySlot.equipSlot == EquipSlot.rightHand)
                {
                    EquipmentSpritesMessage.SendToAll(inventorySlot.Owner, (int)inventorySlot.equipSlot, reference);
                }
            }
        }
        inventorySlot.Item = item;
    }
Exemplo n.º 2
0
 public void NotifyPlayer(GameObject recipient)
 {
     for (int i = 0; i < clothingSlots.Length; i++)
     {
         var clothItem = clothingSlots[i];
         EquipmentSpritesMessage.SendTo(gameObject, i, recipient, clothItem.GameObjectReference, true, false);
     }
 }
Exemplo n.º 3
0
    /// <summary>
    /// Sets the item to the slot and sends network messages to update character sprites and the player's UI
    /// </summary>
    public static void EquipInInvSlot(InventorySlot inventorySlot, GameObject item, bool isInit = false)
    {
        if (inventorySlot.IsUISlot)
        {
            UpdateSlotMessage.Send(inventorySlot.Owner, item, false, inventorySlot.equipSlot);

            if (IsEquipSpriteSlot(inventorySlot.equipSlot))
            {
                EquipmentSpritesMessage.SendToAll(inventorySlot.Owner, (int)inventorySlot.equipSlot, item, isInit);
            }
        }
        inventorySlot.Item = item;
    }
Exemplo n.º 4
0
    /// <summary>
    /// Clears the slot and sends network messages to update character sprites and the player's UI
    /// </summary>
    public static void ClearInvSlot(InventorySlot inventorySlot)
    {
        if (inventorySlot.IsUISlot)
        {
            UpdateSlotMessage.Send(inventorySlot.Owner, inventorySlot.Item, true, inventorySlot.equipSlot);

            if (IsEquipSpriteSlot(inventorySlot.equipSlot))
            {
                EquipmentSpritesMessage.SendToAll(inventorySlot.Owner, (int)inventorySlot.equipSlot, null);
            }
        }
        inventorySlot.Item = null;
    }
Exemplo n.º 5
0
 public void NotifyPlayer(GameObject recipient, bool clothItems = false)
 {
     if (!clothItems)
     {
         PlayerCustomisationMessage.SendTo(gameObject, recipient, ThisCharacter);
     }
     else
     {
         for (int i = 0; i < characterSprites.Length; i++)
         {
             var clothItem = characterSprites[i];
             EquipmentSpritesMessage.SendTo(gameObject, i, recipient, clothItem.GameObjectReference, true, true);
         }
     }
 }
Exemplo n.º 6
0
 public void SetReference(int index, GameObject _Item)
 {
     EquipmentSpritesMessage.SendToAll(gameObject, index, _Item);
 }
Exemplo n.º 7
0
 public void SetReference(int index, int reference)
 {
     EquipmentSpritesMessage.SendToAll(gameObject, index, reference);
 }
Exemplo n.º 8
0
 public void ServerPerformInteraction(HandActivate interaction)
 {
     ToggleState(interaction.Performer.WorldPosServer());
     EquipmentSpritesMessage.SendToAll(interaction.Performer, (int)interaction.HandSlot.equipSlot, gameObject);
 }