//Find the color based on the quality of the item Color FindColor(ItemClass item) { uGUIInventory inventory = GameObject.FindGameObjectWithTag("Inventory").GetComponent <uGUIInventory>(); if (item.itemQuality == ItemQuality.Junk) { return(inventory.junkColor); } else if (item.itemQuality == ItemQuality.Legendary) { return(inventory.legendaryColor); } else if (item.itemQuality == ItemQuality.Magical) { return(inventory.magicColor); } else if (item.itemQuality == ItemQuality.Normal) { return(inventory.normalColor); } else if (item.itemQuality == ItemQuality.Rare) { return(inventory.rareColor); } else if (item.itemQuality == ItemQuality.Set) { return(inventory.setColor); } return(Color.clear); }
// Use this for initialization void Start() { player = GameObject.FindGameObjectWithTag("Player").GetComponent <Player>(); inventory = GameObject.FindGameObjectWithTag("Inventory").GetComponent <uGUIInventory>(); messageManager = GameObject.FindGameObjectWithTag("MessageManager").GetComponent <uGUIMessageManager>(); ResetItems(); avaliableGoldText.text = player.money.ToString(); OpenCloseMerchant(false); }
// Use this for initialization public void Start() { //Initialize the values inventory = GameObject.FindGameObjectWithTag("Inventory").GetComponent <uGUIInventory>(); splitSize = 1; slider.minValue = 1; slider.maxValue = inventory.itemToSplit.item.stackSize - 1; slider.value = splitSize; inputfield.text = splitSize.ToString(); slider.value = slider.minValue; }
// Use this for initialization void Start() { inventory = GameObject.FindGameObjectWithTag("Inventory").GetComponent <uGUIInventory>(); merchant = GameObject.FindGameObjectWithTag("Merchant").GetComponent <uGUIMerchant>(); }
void Start() { lookAt = GetComponentInChildren <LabelLookAt>(); inventory = GameObject.FindGameObjectWithTag("Inventory").GetComponent <uGUIInventory>(); OnMouseExit(); }
// Use this fork initialization void Start() { inventory = GameObject.FindGameObjectWithTag("Inventory").GetComponent <uGUIInventory>(); }
// Use this for initialization void Start() { inventory = GameObject.FindGameObjectWithTag("Inventory").GetComponent <uGUIInventory>(); itemIcon = transform.Find("ItemIcon").GetComponent <Image>(); }
// Use this for initialization void Start() { //Find the player player = GameObject.FindGameObjectWithTag("Player").GetComponent <Player>(); //Find the inventory inventory = GameObject.FindGameObjectWithTag("Inventory").GetComponent <uGUIInventory>(); craftingTabs = new List <uGUICraftingTab>(); selectedItem = new CraftedItem(); //Run through all the craft item IDs for (int i = 0; i < craftAbleItemIDs.Count; i++) { //Find the item in the item database CraftedItem item = database.FindCraftItem(craftAbleItemIDs[i]); //If there is already any crafting tabs if (craftingTabs.Count > 0) { int counter = 0; //Run through all the crafting tabs for (int j = 0; j < craftingTabs.Count; j++) { //If the item base type is = to the tabtype of the crafting tab then add the item to the list if (craftingTabs[j].tabType == item.baseType) { if (craftingTabs[j].items == null) { craftingTabs[j].items = new List <CraftedItem>(); } craftingTabs[j].items.Add(item); counter++; } //If we're at the end of the list and there's no tab with the current item type already //Instantiate the tab and add the item to the list of items in the tab if (j == craftingTabs.Count - 1 && counter == 0) { GameObject tempTab = Instantiate(tabPrefab) as GameObject; uGUICraftingTab tab = tempTab.AddComponent <uGUICraftingTab>(); tab.transform.SetParent(tabsObj.transform); tab.GetComponent <RectTransform>().localScale = Vector3.one; tab.tabType = item.baseType; if (tab.tabType == CraftingTabType.armor) { tab.GetComponent <Image>().sprite = armorTab; } else if (tab.tabType == CraftingTabType.weapon) { tab.GetComponent <Image>().sprite = weaponTab; } craftingTabs.Add(tab); tabsObj.GetComponent <RectTransform>().sizeDelta = new Vector3(tabWidth, tabHeight * craftingTabs.Count); } } } //There isn't any tabs //Instantiate the tab and add the item else { GameObject tempTab = Instantiate(tabPrefab) as GameObject; uGUICraftingTab tab = tempTab.AddComponent <uGUICraftingTab>(); tab.transform.SetParent(tabsObj.transform); tab.GetComponent <RectTransform>().localScale = Vector3.one; tab.tabType = item.baseType; if (tab.tabType == CraftingTabType.armor) { tab.GetComponent <Image>().sprite = armorTab; } else if (tab.tabType == CraftingTabType.weapon) { tab.GetComponent <Image>().sprite = weaponTab; } craftingTabs.Add(tab); craftingTabs[craftingTabs.IndexOf(tab)].items = new List <CraftedItem>(); craftingTabs[craftingTabs.IndexOf(tab)].items.Add(item); tabsObj.GetComponent <RectTransform>().sizeDelta = new Vector3(tabWidth, tabHeight * craftingTabs.Count); } } //Set the current selected tab to the first instance of the tabs selectedTab = craftingTabs[0]; //Set the color of all the tabs to inactive for (int i = 0; i < craftingTabs.Count; i++) { craftingTabs[i].GetComponent <Image>().color = tabInactiveColor; } //Set the selected tabs color to active selectedTab.GetComponent <Image>().color = tabActiveColor; //Run through all the items in the selected tab and instantiate them for (int i = 0; i < selectedTab.items.Count; i++) { uGUICraftingButton item = Instantiate(craftingItemPrefab) as uGUICraftingButton; item.transform.SetParent(scrollContent.transform); item.transform.localScale = Vector3.one; selectedTab.items[i].button = item; if (!string.IsNullOrEmpty(selectedTab.items[i].ID)) { item.item = database.FindCraftItem(int.Parse(selectedTab.items[i].ID)); } item.transform.name = i.ToString(); } //Close the crafting window OpenCloseWindow(false); }
// Use this for initialization public void Start() { player = GameObject.FindGameObjectWithTag("Player").GetComponent <Player>(); messageManager = GameObject.FindGameObjectWithTag("MessageManager").GetComponent <uGUIMessageManager>(); inventory = GameObject.FindGameObjectWithTag("Inventory").GetComponent <uGUIInventory>(); }