Exemple #1
0
    private static void SyncInventoryImpl(BinaryReader reader)
    {
        int             characterId = reader.ReadInt32();
        Character       c           = CharactersManager.Instance.GetPlayer(characterId);
        ItemContainerId inventoryId = (ItemContainerId)reader.ReadByte();
        ushort          count       = reader.ReadUInt16();

        if (inventoryId == ItemContainerId.SHOP)
        {
            c = CharactersManager.Instance.GetLocalPlayer();
        }

        c.itemContainers[inventoryId].Clear();

        for (int i = 0; i < count; i++)
        {
            ushort slot   = reader.ReadUInt16();
            int    itemId = reader.ReadInt32();

            c.SetItem(inventoryId, slot, itemId);
        }

        c.RefreshInventory(inventoryId);

        if (inventoryId == ItemContainerId.SHOP && count != 0)
        {
            UIVendor.Instance.GetComponent <UIPanel>().Activate();
        }
    }
Exemple #2
0
    public void SetItem(ItemContainerId invId, ushort slot, int itemId)
    {
        var ic = itemContainers[invId];

        ic.items[slot] = new ItemInstance()
        {
            id = itemId
        };
    }
Exemple #3
0
 public void RefreshInventory(ItemContainerId inventoryId)
 {
     itemContainers[inventoryId].Refresh();
 }