Esempio n. 1
0
    public static void setSavedInventory(SavableInventoryData savedData)
    {
        InventoryData data = InventoryData.CreateInstance <InventoryData> ();

        data.gold = savedData.gold;
        foreach (var _slot in savedData.inventoryContent)
        {
            ItemData item = ItemFactory.Instance.MakeItem(_slot.itemStack.data);
            if (item)
            {
                ItemStack stack = new ItemStack(item, _slot.itemStack.sizeStack);
                InventoryData.InventorySlot slot = new InventoryData.InventorySlot(_slot.pos, stack);
                data.inventoryContent.Add(slot);
            }
        }
        inventoryData = data;
        if (_instance != null)
        {
            _instance.NotifyAll();
        }
    }