public void AddItem(int itemId, KeyItemType itemType)
    {
        /* To avoid passing lots of pointless banana, an id and a type will be passed.
         * Depending on what that type is will depend on the prefab to use for that item
         * in the actual inventory. So somewhere there should be a sort of DB that'll map
         * the type of the item to the assigned inventory prefab. For now I'll just stick
         * it in here. Naturally.
         * The pickup in the meantime is long gone having transfered its id to the inventory.
         */
        if (HasItem(itemId))
        {
            return;
        }

        // So we create a new instance of a key item type to hold on to.
        var itemToAdd = new UIInventoryItem()
        {
            ItemType   = itemType,
            Id         = itemId,
            ItemSprite = GetPrefab(itemType)
        };

        for (int i = 0; i < items.Length; i++)
        {
            if (items[i] == null)
            {
                items[i]              = itemToAdd;
                itemImages[i].sprite  = itemToAdd.ItemSprite;
                itemImages[i].enabled = true;
                return;
            }
        }
    }
Exemplo n.º 2
0
    public void AddItem(InventoryItem item)
    {
        UIInventoryItem uiItem = Instantiate(config.UIInventoryItemPrefab);

        uiItem.Init(item);
        items.Add(uiItem);
        uiItem.SetParent(inventoryItemParent);
    }
    public void ItemAdded(ItemClass item)
    {
        // Instantiate blank item panel
        UIInventoryItem blankItem = Instantiate(itemPanel);

        // Show passed item's info on panel
        blankItem.ShowItem(item);
        blankItem.transform.SetParent(scrollViewItems);
    }
Exemplo n.º 4
0
 public void SelectUIItem(UIInventoryItem item)
 {
     if (selectedItem != null)
     {
         selectedItem.SetParent(inventoryItemParent);
     }
     item.SetParent(currentItemParent);
     selectedItem = item;
 }
 void Start()
 {
     playerController = player.GetComponent <PlayerController>();
     // Assign prefab to itemPanel
     itemPanel = Resources.Load <UIInventoryItem>("UI/itemContainer");
     // Inventory panel inactive on start
     inventoryPanel.gameObject.SetActive(false);
     wornInventoryPanel.gameObject.SetActive(false);
     UIManager.OnItemAddedToInventory += ItemAdded;
 }
Exemplo n.º 6
0
    public void SetGridId(int id, int num = 1)
    {
        gridID = id;
        info   = ObjectsInfo._instance.GetObjectInfoById(id);
        UIInventoryItem item = GetComponentInChildren <UIInventoryItem>();

        item.SetSpriteName(id, info.icon_name);
        numLabel.enabled = true;
        itemNum          = num;
        numLabel.text    = itemNum.ToString();
    }
Exemplo n.º 7
0
        public void SellToDealer(UIInventoryItem item, int count, Closure onSuccess)
        {
            var src = playerItems[item.ID];

            if (count > src.Amount)
            {
                return;
            }
            var equip = (src.Cargo?.Equipment ?? src.Include.Equipment);

            if (equip.Good.Ini.Combinable)
            {
                ShipTradeItem dst = null;
                if (src.Cargo != null)
                {
                    dst = dealerItems.FirstOrDefault(x => x.Cargo == src.Cargo);
                }
                else if (src.Include != null)
                {
                    dst = dealerItems.FirstOrDefault(x => x.Cargo == src.Cargo);
                }
                if (dst != null)
                {
                    dst = new ShipTradeItem()
                    {
                        Cargo     = src.Cargo,
                        Hardpoint = null,
                        Show      = true,
                        Include   = src.Include
                    };
                    dealerItems.Add(dst);
                }
                dst.Amount += count;
            }
            else
            {
                dealerItems.Add(new ShipTradeItem()
                {
                    Amount    = 1,
                    Cargo     = src.Cargo,
                    Hardpoint = null,
                    Show      = true,
                    Include   = src.Include
                });
            }
            src.Amount -= count;
            if (src.Amount <= 0)
            {
                playerItems.Remove(src);
            }
            onSuccess.Call();
        }
Exemplo n.º 8
0
    private GameObject FindInventoryGameObjectAssociatedWithSelectedPrefab(GameObject selectedPrefab)
    {
        GameObject inventoryGameObejctAssociatedWithSelectedPrefab = null;

        foreach (UIOnSelection UIInventoryItem in _UIInventoryItems)
        {
            if (UIInventoryItem.GetInventoryItemPrefab().GetComponent <Tile>().tileType == selectedPrefab.GetComponent <Tile>().tileType)
            {
                inventoryGameObejctAssociatedWithSelectedPrefab = UIInventoryItem.gameObject;
            }
        }
        return(inventoryGameObejctAssociatedWithSelectedPrefab);
    }
Exemplo n.º 9
0
    void AddToUI(InventoryItem lootItem, int index = -1)
    {
        Vector2 position;

        if (index == -1)
        {
            position = new Vector2(0f, -62.5f - ownedItems.Count * uiInventoryItemPrefab.GetComponent <RectTransform>().sizeDelta.y);
        }
        else
        {
            position = new Vector2(0f, -62.5f - index * uiInventoryItemPrefab.GetComponent <RectTransform>().sizeDelta.y);
        }
        UIInventoryItem item = Instantiate(uiInventoryItemPrefab);

        item.Init(lootItem, position, inventoryContainer);
        uiOwnedItems.Add(item);
    }
Exemplo n.º 10
0
 public void ProcessMount(UIInventoryItem item, Closure onsuccess)
 {
     if (item.Hardpoint != null)
     {
         playerItems[item.ID].Hardpoint = null;
         onsuccess.Call("unmount");
     }
     else
     {
         var x  = playerItems[item.ID];
         var eq = (x.Cargo?.Equipment ?? x.Include.Equipment);
         var hp = FirstAvailableHardpoint(eq.HpType);
         if (hp != null)
         {
             playerItems[item.ID].Hardpoint = hp;
             onsuccess.Call("mount");
         }
     }
 }
Exemplo n.º 11
0
    void UpdateItemInInventory(ItemStack itemToUpdate, bool removeItem)
    {
        if (_availableItemSlots == null)
        {
            _availableItemSlots = new List <UIInventoryItem>();
        }

        if (removeItem)
        {
            if (_availableItemSlots.Exists(o => o.currentItem == itemToUpdate))
            {
                int index = _availableItemSlots.FindIndex(o => o.currentItem == itemToUpdate);
                _availableItemSlots[index].SetInactiveItem();
            }
        }
        else
        {
            int index = 0;

            //if the item has already been created
            if (_availableItemSlots.Exists(o => o.currentItem == itemToUpdate))
            {
                index = _availableItemSlots.FindIndex(o => o.currentItem == itemToUpdate);
            }
            //if the item needs to be created
            else
            {
                //if the new item needs to be instantiated
                if (_currentInventory.Items.Count > _availableItemSlots.Count)
                {
                    UIInventoryItem instantiatedPrefab = Instantiate(_itemPrefab, _contentParent.transform) as UIInventoryItem;
                    _availableItemSlots.Add(instantiatedPrefab);
                }

                //find the last instantiated game object not used
                index = _currentInventory.Items.Count;
            }

            bool isSelected = selectedItemId == index;
            _availableItemSlots[index].SetItem(itemToUpdate, isSelected);
        }
    }
Exemplo n.º 12
0
    private void Awake()
    {
        InventoryManager.Instance.curPop = this;

        for (int i = 0; i < InventoryManager.maxSlot; i++)
        {
            GameObject      obj    = Instantiate(itemPrefab, grid.transform);
            UIInventoryItem script = obj.GetComponent <UIInventoryItem>();

            if (InventoryManager.Instance.itemDataDict.ContainsKey(i) == true)
            {
                script.SetData(i, InventoryManager.Instance.itemDataDict[i]);
            }
            else
            {
                script.SetData(i, null); //빈칸
            }

            items[i] = script;
        }
        //테스트코드
        StartCoroutine(TestCode());
    }
Exemplo n.º 13
0
        public UIInventoryItem[] GetPlayerGoods(string filter)
        {
            List <UIInventoryItem> inventory = new List <UIInventoryItem>();
            var filterfunc = Trader.GetFilter(filter);

            foreach (var hardpoint in selectedShip.HardpointTypes)
            {
                var ui = new UIInventoryItem()
                {
                    Hardpoint = hardpoint.Key, Price = -1
                };
                var hptype = hardpoint.Value.OrderByDescending(x => x.Class).First();
                switch (filter.ToLowerInvariant())
                {
                case "commodity":
                case "ammo":
                    continue;

                case "weapons":
                    if (hptype.Category != HpCategory.Weapon)
                    {
                        continue;
                    }
                    break;

                case "internal":
                    if (hptype.Category != HpCategory.Internal)
                    {
                        continue;
                    }
                    break;

                case "external":
                    if (hptype.Category != HpCategory.External)
                    {
                        continue;
                    }
                    break;
                }
                ui.IdsHardpoint            = hptype.IdsName;
                ui.HpSortIndex             = hptype.SortIndex;
                ui.IdsHardpointDescription = hptype.IdsHpDescription;
                var mounted = playerItems.FirstOrDefault(x =>
                                                         hardpoint.Key.Equals(x.Hardpoint, StringComparison.OrdinalIgnoreCase));
                if (mounted != null)
                {
                    var equip = (mounted.Cargo?.Equipment ?? mounted.Include?.Equipment);
                    if (equip == null || equip.Good == null)
                    {
                        continue;
                    }
                    ui.ID        = playerItems.IndexOf(mounted);
                    ui.Count     = 1;
                    ui.Good      = equip.Good.Ini.Nickname;
                    ui.Icon      = equip.Good.Ini.ItemIcon;
                    ui.IdsInfo   = equip.IdsInfo;
                    ui.IdsName   = equip.IdsName;
                    ui.Price     = GetPrice(equip.Good);
                    ui.MountIcon = true;
                    ui.CanMount  = true;
                    if (equip is not CommodityEquipment && mounted.Cargo != null)
                    {
                        ui.Price = (ulong)(ui.Price * TradeConstants.EQUIP_RESALE_MULTIPLIER);
                    }
                }
                inventory.Add(ui);
            }
            for (int i = 0; i < playerItems.Count; i++)
            {
                var item = playerItems[i];
                if (!item.Show || item.Hardpoint != null)
                {
                    continue;
                }
                var g = (item.Cargo?.Equipment ?? item.Include.Equipment).Good;
                if (g == null)
                {
                    continue;
                }
                if (!filterfunc(g.Equipment))
                {
                    continue;
                }
                var price = GetPrice(g);
                if (g.Equipment is not CommodityEquipment && item.Cargo != null)
                {
                    price = (ulong)(price * TradeConstants.EQUIP_RESALE_MULTIPLIER);
                }
                inventory.Add(new UIInventoryItem()
                {
                    ID         = i,
                    Count      = item.Amount,
                    Icon       = g.Ini.ItemIcon,
                    Good       = g.Ini.Nickname,
                    Combinable = g.Ini.Combinable,
                    IdsInfo    = g.Equipment.IdsInfo,
                    IdsName    = g.Equipment.IdsName,
                    MountIcon  = !string.IsNullOrEmpty(g.Equipment.HpType),
                    CanMount   = CanMount(g.Equipment.HpType, null),
                    Price      = price
                });
            }
            Trader.SortGoods(session, inventory);
            return(inventory.ToArray());
        }
Exemplo n.º 14
0
 // Use this for initialization
 protected override void Awake()
 {
     base.Awake();
     Instance = this;
     sprite   = GetComponent <UISprite>();
 }
Exemplo n.º 15
0
 public void Sell(UIInventoryItem item, int count, Closure onSuccess)
 {
     onSuccess.Call();
 }
Exemplo n.º 16
0
 public void ProcessMount(UIInventoryItem item, Closure onsuccess)
 {
     onsuccess.Call("mount");
 }
Exemplo n.º 17
0
    // Use this for initialization
    public void Initialize()
    {
        if (initialized)
        {
            return;
        }

        initialized = true;

        mcRef = GameObject.Find("MasterController").GetComponent <MasterControllerScript>();

        disposableContainer = Instantiate(container);
        disposableContainer.transform.SetParent(container.transform);
        disposableContainer.transform.localScale = Vector3.one;
        disposableContainer.GetComponent <RectTransform>().sizeDelta        = Vector2.zero;
        disposableContainer.GetComponent <RectTransform>().anchoredPosition = Vector2.zero;

        disposableContainer.name = "UIDisposableContainer";


        status = UIInventoryState.root;

        UIInventoryItem item;

        powerCircleGO = new GameObject();
        powerCircleGO.transform.parent = this.gameObject.transform;
        powerCircleGO.name             = "UIInventoryPowerCircle";
        powerCircleItem                     = powerCircleGO.AddComponent <UIInventoryItem> ();
        powerCircleItem.id                  = UIInventoryClickItem.powerCircle;
        powerCircleItem.delay               = 1.25f;
        powerCircleItem.theSprite           = powerCircle;
        powerCircleItem.parent              = disposableContainer;
        powerCircleItem.inventoryController = this;
        powerCircleItem.initialize();

        alphabetGO = new GameObject();
        alphabetGO.transform.parent = this.gameObject.transform;
        alphabetGO.name             = "UIInventoryAlphabet";
        alphabetItem                     = alphabetGO.AddComponent <UIInventoryItem> ();
        alphabetItem.id                  = UIInventoryClickItem.alphabet;
        alphabetItem.delay               = 1.50f;
        alphabetItem.theSprite           = alphabet;
        alphabetItem.parent              = disposableContainer;
        alphabetItem.inventoryController = this;
        alphabetItem.initialize();

        progressGO = new GameObject();
        progressGO.transform.parent = this.gameObject.transform;
        progressGO.name             = "UIInventoryProgress";
        progressItem                     = progressGO.AddComponent <UIInventoryItem> ();
        progressItem.id                  = UIInventoryClickItem.progress;
        progressItem.delay               = 1.75f;
        progressItem.theSprite           = progress;
        progressItem.parent              = disposableContainer;
        progressItem.inventoryController = this;
        progressItem.initialize();

        backpackGO = new GameObject();
        backpackGO.transform.parent = this.gameObject.transform;
        backpackGO.name             = "UIInventoryBackpack";
        backpackItem                     = backpackGO.AddComponent <UIInventoryItem> ();
        backpackItem.id                  = UIInventoryClickItem.backpack;
        backpackItem.delay               = 2.00f;
        backpackItem.theSprite           = backpack;
        backpackItem.parent              = disposableContainer;
        backpackItem.inventoryController = this;
        backpackItem.initialize();

        backGO = new GameObject();
        backGO.transform.parent = this.gameObject.transform;
        backGO.name             = "UIInventoryBack";
        backItem                     = backGO.AddComponent <UIInventoryItem> ();
        backItem.id                  = UIInventoryClickItem.back;
        backItem.delay               = 2.25f;
        backItem.theSprite           = back;
        backItem.parent              = disposableContainer;
        backItem.inventoryController = this;
        backItem.initialize();

        back2GO = new GameObject();
        back2GO.transform.parent = this.gameObject.transform;
        back2GO.name             = "UIInventoryBack2";
        back2Item                     = back2GO.AddComponent <UIInventoryItem> ();
        back2Item.id                  = UIInventoryClickItem.back;
        back2Item.delay               = 0.25f;
        back2Item.theSprite           = back;
        back2Item.parent              = disposableContainer;
        back2Item.inventoryController = this;
        back2Item.initialize();

        shadowGO = new GameObject();
        shadowGO.transform.parent = this.gameObject.transform;
        shadowGO.name             = "UIInventoryShadow";
        shadowItem = shadowGO.AddComponent <UIInventoryItem> ();
        //backItem.id = UIInventoryClickItem.back;
        shadowItem.delay               = 0.25f;
        shadowItem.theSprite           = shadow;
        shadowItem.parent              = disposableContainer;
        shadowItem.inventoryController = this;
        shadowItem.initialize();

        questionsGO = new GameObject();
        questionsGO.transform.parent = this.gameObject.transform;
        questionsGO.name             = "UIInventoryQuestions";
        questionsItem = questionsGO.AddComponent <UIInventoryItem> ();
        //questionsItem.id = UIInventoryClickItem.back;
        questionsItem.delay               = 0.50f;
        questionsItem.theSprite           = questions;
        questionsItem.parent              = disposableContainer;
        questionsItem.inventoryController = this;
        questionsItem.initialize();

        wellsGO = new GameObject();
        wellsGO.transform.parent = this.gameObject.transform;
        wellsGO.name             = "UIInventoryWells";
        wellsItem = wellsGO.AddComponent <UIInventoryItem> ();
        //wellsItem.id = UIInventoryClickItem.back;
        wellsItem.delay               = 0.75f;
        wellsItem.theSprite           = wells;
        wellsItem.parent              = disposableContainer;
        wellsItem.inventoryController = this;
        wellsItem.initialize();

        facebookGO = new GameObject();
        facebookGO.transform.parent = this.gameObject.transform;
        facebookGO.name             = "UIInventoryFacebook";
        facebookItem                     = facebookGO.AddComponent <UIInventoryItem> ();
        facebookItem.id                  = UIInventoryClickItem.fb;
        facebookItem.delay               = 1.00f;
        facebookItem.theSprite           = facebook;
        facebookItem.parent              = disposableContainer;
        facebookItem.inventoryController = this;
        facebookItem.initialize();

        twitterGO = new GameObject();
        twitterGO.transform.parent = this.gameObject.transform;
        twitterGO.name             = "UIInventoryTwitter";
        twitterItem                     = twitterGO.AddComponent <UIInventoryItem> ();
        twitterItem.id                  = UIInventoryClickItem.twitter;
        twitterItem.delay               = 1.25f;
        twitterItem.theSprite           = twitter;
        twitterItem.parent              = disposableContainer;
        twitterItem.inventoryController = this;
        twitterItem.initialize();

        redManaGO = new GameObject();
        redManaGO.transform.parent = this.gameObject.transform;
        redManaGO.name             = "UIInventoryRedMana";
        redManaItem                     = redManaGO.AddComponent <UIInventoryItem> ();
        redManaItem.delay               = 2.00f;
        redManaItem.theSprite           = redMana;
        redManaItem.parent              = disposableContainer;
        redManaItem.inventoryController = this;
        redManaItem.initialize();
        redManaItem.disableRaycast();

        blueManaGO = new GameObject();
        blueManaGO.transform.parent = this.gameObject.transform;
        blueManaGO.name             = "UIInventoryBlueMana";
        blueManaItem                     = blueManaGO.AddComponent <UIInventoryItem> ();
        blueManaItem.delay               = 2.00f;
        blueManaItem.theSprite           = blueMana;
        blueManaItem.parent              = disposableContainer;
        blueManaItem.inventoryController = this;
        blueManaItem.initialize();
        blueManaItem.disableRaycast();


        worldMapGO = new GameObject();
        worldMapGO.transform.parent = this.gameObject.transform;
        worldMapGO.name             = "UIInventoryWorldMap";
        worldMapItem                     = worldMapGO.AddComponent <UIInventoryItem> ();
        worldMapItem.delay               = 2.00f;
        worldMapItem.id                  = UIInventoryClickItem.worldMap;
        worldMapItem.theSprite           = worldMap;
        worldMapItem.parent              = disposableContainer;
        worldMapItem.inventoryController = this;
        worldMapItem.initialize();
        worldMapItem.disableRaycast();


        shadowsTextGO = new GameObject();
        shadowsTextGO.transform.parent = this.gameObject.transform;
        shadowsTextGO.name             = "UIInventoryShadowsText";
        shadowsText       = shadowsTextGO.AddComponent <UIInventoryText> ();
        shadowsText.delay = 0.25f;
        DataStorage ds       = mcRef.getStorage();
        int         nShadows = ds.retrieveIntValue("transformedShadows");

        shadowsText.theString           = "x " + nShadows;
        shadowsText.parent              = disposableContainer;
        shadowsText.inventoryController = this;
        shadowsText.initialize();

        questionsTextGO = new GameObject();
        questionsTextGO.transform.parent = this.gameObject.transform;
        questionsTextGO.name             = "UIInventoryQuestionsText";
        questionsText       = questionsTextGO.AddComponent <UIInventoryText> ();
        questionsText.delay = 0.50f;
        int okQuestions = ds.retrieveIntValue("correctlyAnsweredQuestions");
        int nQuestions  = ds.retrieveIntValue("totalAnsweredQuestions");

        if (nQuestions > 0)
        {
            questionsText.theString = "x " + okQuestions + " (" + (((float)okQuestions) / ((float)nQuestions) * 100.0f) + "%%)";
        }
        else
        {
            questionsText.theString = "x 0";
        }
        questionsText.parent = disposableContainer;
        questionsText.inventoryController = this;
        questionsText.initialize();

        wellsTextGO = new GameObject();
        wellsTextGO.transform.parent = this.gameObject.transform;
        wellsTextGO.name             = "UIInventoryWellsText";
        wellsText       = wellsTextGO.AddComponent <UIInventoryText> ();
        wellsText.delay = 0.75f;
        int okWells = ds.retrieveIntValue("CorrectlySolvedWells");
        int nWells  = ds.retrieveIntValue("TotalWells");

        if (nWells > 0)
        {
            wellsText.theString = "x " + okWells + " (" + (((float)okWells) / ((float)nWells) * 100.0f) + ")";
        }
        else
        {
            wellsText.theString = "x 0";
        }
        wellsText.parent = disposableContainer;
        wellsText.inventoryController = this;
        wellsText.initialize();


        redManaTextGO = new GameObject();
        redManaTextGO.transform.parent = this.gameObject.transform;
        redManaTextGO.name             = "UIInventoryRedManaText";
        redManaText       = redManaTextGO.AddComponent <UIInventoryText> ();
        redManaText.delay = 0.75f;
        int redManaAmount = ds.retrieveIntValue("RedManaAmount");

        redManaText.theString           = "x " + redManaAmount;
        redManaText.parent              = disposableContainer;
        redManaText.inventoryController = this;
        redManaText.initialize();


        blueManaTextGO = new GameObject();
        blueManaTextGO.transform.parent = this.gameObject.transform;
        blueManaTextGO.name             = "UIInventoryBlueManaText";
        blueManaText       = blueManaTextGO.AddComponent <UIInventoryText> ();
        blueManaText.delay = 0.75f;
        int blueManaAmount = ds.retrieveIntValue("BlueManaAmount");

        blueManaText.theString           = "x " + blueManaAmount;
        blueManaText.parent              = disposableContainer;
        blueManaText.inventoryController = this;
        blueManaText.initialize();


        elementsCrystalGO   = new GameObject[7];
        elementsCrystalItem = new UIInventoryItem[7];
        for (int i = 0; i < 7; ++i)
        {
            elementsCrystalGO [i]        = new GameObject();
            elementsCrystalGO [i].name   = "UIInventoryElementCrystal" + i;
            elementsCrystalItem[i]       = elementsCrystalGO[i].AddComponent <UIInventoryItem> ();
            elementsCrystalItem[i].delay = 1.0f + 0.12f * i;
            bool active = ds.retrieveBoolValue("7elementsEnergy(" + i + ")Active");
            if (active)
            {
                elementsCrystalItem[i].theSprite = seventElementsEnergy[i * 2 + 1];
            }
            else
            {
                elementsCrystalItem[i].theSprite = seventElementsEnergy[i * 2];
            }
            elementsCrystalItem[i].parent = disposableContainer;
            elementsCrystalItem[i].inventoryController = this;
            elementsCrystalItem[i].initialize();
            elementsCrystalItem [i].disableRaycast();
        }

        lightBridgeKeyGO   = new GameObject[7];
        lightBridgeKeyItem = new UIInventoryItem[7];
        for (int i = 0; i < 7; ++i)
        {
            lightBridgeKeyGO [i]        = new GameObject();
            lightBridgeKeyGO [i].name   = "UIInventoryLightBridgeKey" + i;
            lightBridgeKeyItem[i]       = lightBridgeKeyGO[i].AddComponent <UIInventoryItem> ();
            lightBridgeKeyItem[i].delay = 1.88f + 0.12f * i;
            bool gotKey = ds.retrieveBoolValue("HasLightBridgeKey(" + i + ")");
            if (gotKey)
            {
                lightBridgeKeyItem [i].maxOpacity = 1.0f;
            }
            else
            {
                lightBridgeKeyItem [i].maxOpacity = 0.2f;
            }
            lightBridgeKeyItem[i].theSprite = lightBridgeKey[i];

            lightBridgeKeyItem[i].parent = disposableContainer;
            lightBridgeKeyItem[i].inventoryController = this;
            lightBridgeKeyItem[i].initialize();
            lightBridgeKeyItem [i].disableRaycast();
        }

        valuesScaleGO   = new GameObject[8];
        valuesScaleItem = new UIInventoryItem[8];
        for (int i = 0; i < 8; ++i)
        {
            valuesScaleGO [i]        = new GameObject();
            valuesScaleGO [i].name   = "UIInventoryScaleOfValues" + i;
            valuesScaleItem[i]       = valuesScaleGO[i].AddComponent <UIInventoryItem> ();
            valuesScaleItem[i].delay = 2.33f + 0.12f * i;
            int numberOfSteps = ds.retrieveIntValue("ValuesScale(" + i + ")steps");

            valuesScaleItem[i].theSprite           = scales[numberOfSteps];
            valuesScaleItem [i].id                 = UIInventoryClickItem.scale;
            valuesScaleItem [i].intId              = i;
            valuesScaleItem[i].parent              = disposableContainer;
            valuesScaleItem[i].inventoryController = this;
            valuesScaleItem[i].initialize();
            if (numberOfSteps > 0)
            {
                valuesScaleItem[i].enableRaycast();
            }
            else
            {
                valuesScaleItem[i].disableRaycast();
            }
        }

        mapGO   = new GameObject[7];
        mapItem = new UIInventoryItem[7];
        for (int i = 0; i < 7; ++i)
        {
            mapGO[i]          = new GameObject();
            mapGO [i].name    = "UIInventoryMap" + i;
            mapItem [i]       = mapGO [i].AddComponent <UIInventoryItem> ();
            mapItem [i].delay = 2.5f + 0.06f * i;
            bool gotMap = ds.retrieveBoolValue("HasLightMap(" + i + ")");
            if (gotMap)
            {
                mapItem [i].maxOpacity = 1.0f;
            }
            else
            {
                mapItem [i].maxOpacity = 0.2f;
            }
            mapItem [i].theSprite           = map;
            mapItem [i].parent              = disposableContainer;
            mapItem [i].inventoryController = this;
            mapItem [i].initialize();
            mapItem [i].disableRaycast();
        }

        pillGO                       = new GameObject();
        pillGO.name                  = "UIInventoryPill";
        pillGO.transform.parent      = this.gameObject.transform;
        pillItem                     = pillGO.AddComponent <UIInventoryItem> ();
        pillItem.theSprite           = pill;
        pillItem.parent              = disposableContainer;
        pillItem.inventoryController = this;
        pillItem.initialize();
        pillItem.disableRaycast();

        pillTextGO = new GameObject();
        pillTextGO.transform.parent = this.gameObject.transform;
        pillTextGO.name             = "UIInventoryPillText";
        pillText       = pillTextGO.AddComponent <UIInventoryText> ();
        pillText.delay = 0.75f;
        int numberOfPills = ds.retrieveIntValue("WisdomPillsAmount");

        pillText.theString           = "x " + numberOfPills;
        pillText.parent              = disposableContainer;
        pillText.inventoryController = this;
        pillText.initialize();

        rect = this.gameObject.GetComponent <RectTransform> ();

        powerCircleGO.transform.localPosition = new Vector3(-this.rect.rect.height * 0.3f, 0, 0);
        alphabetGO.transform.localPosition    = new Vector3(-this.rect.rect.height * 0.1f, 0, 0);
        progressGO.transform.localPosition    = new Vector3(this.rect.rect.height * 0.1f, 0, 0);
        backpackGO.transform.localPosition    = new Vector3(this.rect.rect.height * 0.3f, 0, 0);
        backGO.transform.localPosition        = new Vector3(-this.rect.rect.height * 0.35f, this.rect.rect.height * 0.25f, 0);
        back2GO.transform.localPosition       = new Vector3(-this.rect.rect.height * 0.60f, this.rect.rect.height * 0.33f, 0);

        shadowGO.transform.localPosition    = new Vector3(-this.rect.rect.height * 0.25f, this.rect.rect.height * 0.15f, 0);
        questionsGO.transform.localPosition = new Vector3(-this.rect.rect.height * 0.25f, -this.rect.rect.height * 0.00f, 0);
        wellsGO.transform.localPosition     = new Vector3(-this.rect.rect.height * 0.25f, -this.rect.rect.height * 0.17f, 0);
        facebookGO.transform.localPosition  = new Vector3(this.rect.rect.height * 0.22f, -this.rect.rect.height * 0.17f, 0);
        twitterGO.transform.localPosition   = new Vector3(this.rect.rect.height * 0.35f, -this.rect.rect.height * 0.17f, 0);

        redManaGO.transform.localPosition  = new Vector3(-this.rect.rect.height * 0.35f, this.rect.rect.height * 0.08f, 0);
        blueManaGO.transform.localPosition = new Vector3(this.rect.rect.height * 0.15f, this.rect.rect.height * 0.08f, 0);
        worldMapGO.transform.localPosition = new Vector3(this.rect.rect.height * 0.45f, this.rect.rect.height * 0.10f, 0);

        powerCircleGO.transform.localScale = new Vector2(this.rect.rect.height / 600.0f, this.rect.rect.height / 600.0f);
        alphabetGO.transform.localScale    = new Vector2(this.rect.rect.height / 600.0f, this.rect.rect.height / 600.0f);
        progressGO.transform.localScale    = new Vector2(this.rect.rect.height / 600.0f, this.rect.rect.height / 600.0f);
        backpackGO.transform.localScale    = new Vector2(this.rect.rect.height / 600.0f, this.rect.rect.height / 600.0f);
        backGO.transform.localScale        = new Vector2(this.rect.rect.height / 700.0f, this.rect.rect.height / 700.0f);
        back2GO.transform.localScale       = new Vector2(this.rect.rect.height / 700.0f, this.rect.rect.height / 700.0f);

        shadowGO.transform.localScale    = new Vector2(this.rect.rect.height / 1200.0f, this.rect.rect.height / 600.0f);
        questionsGO.transform.localScale = new Vector2(this.rect.rect.height / 700.0f, this.rect.rect.height / 700.0f);
        wellsGO.transform.localScale     = new Vector2(this.rect.rect.height / 700.0f, this.rect.rect.height / 700.0f);
        facebookGO.transform.localScale  = new Vector2(this.rect.rect.height / 800.0f, this.rect.rect.height / 800.0f);
        twitterGO.transform.localScale   = new Vector2(this.rect.rect.height / 800.0f, this.rect.rect.height / 800.0f);

        redManaGO.transform.localScale  = new Vector2(this.rect.rect.height / 600.0f, this.rect.rect.height / 600.0f);
        blueManaGO.transform.localScale = new Vector2(this.rect.rect.height / 600.0f, this.rect.rect.height / 600.0f);
        worldMapGO.transform.localScale = new Vector2(this.rect.rect.height / 660.0f, this.rect.rect.height / 660.0f);

        shadowsTextGO.transform.localPosition   = new Vector3(0, 0, 0);
        questionsTextGO.transform.localPosition = new Vector3(0, -this.rect.rect.height * 0.17f, 0);
        wellsTextGO.transform.localPosition     = new Vector3(0, -this.rect.rect.height * 0.35f, 0);

        redManaTextGO.transform.localPosition  = new Vector3(-this.rect.rect.height * 0.20f, this.rect.rect.height * 0.00f, 0);
        blueManaTextGO.transform.localPosition = new Vector3(this.rect.rect.height * 0.35f, this.rect.rect.height * 0.00f, 0);



        for (int i = 0; i < 7; ++i)
        {
            elementsCrystalGO [i].transform.localScale = new Vector2(this.rect.rect.height / 2400.0f,
                                                                     this.rect.rect.height / 1200.0f);
            elementsCrystalGO [i].transform.localPosition =
                new Vector3(-this.rect.rect.height * 0.45f + this.rect.rect.height * 0.07f * i,
                            this.rect.rect.height * 0.23f,
                            0);
        }
        for (int i = 0; i < 7; ++i)
        {
            lightBridgeKeyGO [i].transform.localScale = new Vector2(this.rect.rect.height / 1800.0f,
                                                                    this.rect.rect.height / 900.0f);
            lightBridgeKeyGO [i].transform.localPosition =
                new Vector3(this.rect.rect.height * 0.15f + this.rect.rect.height * 0.07f * i,
                            this.rect.rect.height * 0.23f,
                            0);
        }
        for (int i = 0; i < 8; ++i)
        {
            valuesScaleGO [i].transform.localScale = new Vector2(this.rect.rect.height / 900.0f,
                                                                 this.rect.rect.height / 900.0f);
            valuesScaleGO [i].transform.localPosition =
                new Vector3(-this.rect.rect.height * 0.45f + this.rect.rect.height * 0.12f * i,
                            -this.rect.rect.height * 0.20f,
                            0);
        }
        for (int i = 0; i < 7; ++i)
        {
            mapGO [i].transform.localScale   = new Vector2(this.rect.rect.height / 900.0f, this.rect.rect.height / 900.0f);
            mapGO[i].transform.localPosition = new Vector3(-this.rect.rect.height * 0.55f + this.rect.rect.height * 0.18f * i,
                                                           -this.rect.rect.height * 0.08f,
                                                           0);
        }

        pillGO.transform.localPosition     = new Vector3(-this.rect.rect.height * 0.07f, -this.rect.rect.height * 0.31f, 0);
        pillTextGO.transform.localPosition = new Vector3(this.rect.rect.height * 0.07f, -this.rect.rect.height * 0.38f, 0);
        pillGO.transform.localScale        = new Vector2(this.rect.rect.height / 1200.0f, this.rect.rect.height / 1200.0f);



        shadowItem.disableRaycast();
        questionsItem.disableRaycast();
        wellsItem.disableRaycast();
        facebookItem.disableRaycast();
        twitterItem.disableRaycast();

        clickedItem = UIInventoryClickItem.none;

        hide();
    }