private void AddButton(ItemClass addItem)//may add a list variable when sort list is added later { GameObject newButton = itemButtonPool.GetObject(); newButton.transform.SetParent(contentPanel); newButton.GetComponent <RectTransform>().localScale = Vector3.one; newButton.GetComponent <ItemButtonScript>().SetUpButton(addItem, this); }
public void AddButton(ItemClass addItem) { GameObject newButton = itemButtonPool.GetObject(); newButton.transform.SetParent(contentPanel); newButton.GetComponent <RectTransform>().localScale = Vector3.one; newButton.GetComponent <ItemButtonScript>().SetUpButton(addItem, this); currentButtonList.Add(newButton); }
private void SpawnStoredItem() { GameObject newItem = itemEquipPool.GetObject(); newItem.GetComponent <ItemScript>().SetItemObject(item); ItemScript.SetSelectedItem(newItem); invenManager.selectedButton = this.gameObject; GetComponent <CanvasGroup>().alpha = 0.5f; }
private void AddEntities() { pair.Clear(); for (int i = 0; i < itemList.Count; ++i) { LivingThing currentItem = itemList[i]; GameObject newItem = entityObject.GetObject(); newItem.transform.SetParent(contentPanel); EntityInfo element = newItem.GetComponent <EntityInfo>(); element.Setup(currentItem); pair.Add(new KeyValuePair <string, GameObject>(currentItem.getName(), newItem)); } }
private void SpawnOrAddItem(ItemClass passedItem) { if (willAddToList == false) //spawn item on mouse { GameObject itemObject = itemEquipPool.GetObject(); itemObject.GetComponent <ItemScript>().SetItemObject(passedItem); ItemScript.SetSelectedItem(itemObject); } else// add to list directly { sortManager.AddItemToList(passedItem); Debug.Log("Item added to list"); } }
private void SpawnStoredItem() { if (ItemScript.selectedItem != null) //selecting another button when already a selected button { invenManager.selectedButton.GetComponent <CanvasGroup>().alpha = 1f; listManager.itemEquipPool.ReturnObject(ItemScript.selectedItem); } GameObject newItem = itemEquipPool.GetObject(); newItem.GetComponent <ItemScript>().item = item; newItem.GetComponent <ItemScript>().SetItemEquipSize(item.size); newItem.GetComponent <Image>().sprite = iconSprite; newItem.transform.SetParent(GameObject.FindGameObjectWithTag("DragParent").transform); newItem.GetComponent <RectTransform>().localScale = Vector3.one; ItemScript.SetSelectedItem(newItem); invenManager.selectedButton = this.gameObject; GetComponent <CanvasGroup>().alpha = 0.5f; }
public void OnDeselect(BaseEventData eventData) { string lastInput = EntityScrollList.SearchField.text; if (!elementSet.Contains(lastInput) && lastInput != "") { if (objList.GetSize() == HISTORY) { GameObject retVal = objList.PollLast(); elementSet.Remove(lastAdded); objectPool.ReturnObject(retVal); } elementSet.Add(lastInput); lastAdded = lastInput; GameObject obj = objectPool.GetObject(); obj.transform.SetParent(contentPanel); SearchedElementInfo element = obj.GetComponent <SearchedElementInfo>(); element.Setup(lastInput); objList.OfferFirst(obj); } }