Ejemplo n.º 1
0
    //this method will close and reset the inventory item grid
    public void CloseAndResetInventoryUIGrid()
    {
        string slotName = "";

        for (int i = 0; (i < 15); i++)
        {
            slotName = ("Slot" + i.ToString());
            inventorySlots.transform.Find(slotName).gameObject.GetComponent <Image>().enabled             = false;
            inventorySlots.transform.Find(slotName).gameObject.GetComponent <Button>().enabled            = false;
            inventorySlots.transform.Find(slotName).Find("Text").gameObject.GetComponent <Text>().enabled = false;
        }

        //cleaning up information Grid Contents
        informationGrid.transform.Find("ItemName").gameObject.GetComponent <Text>().text        = "";
        informationGrid.transform.Find("ItemAmount").gameObject.GetComponent <Text>().text      = "";
        informationGrid.transform.Find("ItemDescription").gameObject.GetComponent <Text>().text = "";
        informationGrid.transform.Find("ItemDescription").gameObject.GetComponent <Text>().text = "";
        informationGrid.transform.Find("AmountHeader").gameObject.GetComponent <Text>().enabled = false;

        //Disabling view Camera
        informationGrid.transform.Find("ItemView").gameObject.GetComponent <RawImage>().enabled = false;

        if (currentlyViewed != null)
        {
            Destroy(currentlyViewed);
        }

        if (playerInventoryReference != null)
        {
            playerInventoryReference.cleanUpEmptyItems();
        }
    }