public void setItemNoSort(MenuSlotItem item) { this.item = item; if (item != null) { item.GetComponent <RectTransform>().SetParent(gameObject.GetComponent <RectTransform>(), false); item.GetComponent <RectTransform>().localPosition = Vector3.zero; GetComponent <RectTransform>().ForceUpdateRectTransforms(); item.GetComponent <RectTransform>().sizeDelta = Vector2.zero; } }
public void setItem(MenuSlotItem item) { if (item == null) { //If it's a decoration slot then set the count to 0 if (this.type == SlotType.DecorationSlot) { //Make a new item for this slot uint id = this.getItem().id; MenuSlotItem newItem = newSlotItem(id, 0, false).GetComponent <MenuSlotItem>(); this.setItem(newItem); } else //If it's anything other than a decoration slot then clear it { this.item = null; } } else { this.item = item; item.GetComponent <RectTransform>().SetParent(gameObject.GetComponent <RectTransform>(), false); item.GetComponent <RectTransform>().localPosition = Vector3.zero; GetComponent <RectTransform>().ForceUpdateRectTransforms(); item.GetComponent <RectTransform>().sizeDelta = Vector2.zero; if (slotIndex == 0) { HomeBaseUIController hbuic = GetComponentInParent <HomeBaseUIController>(); hbuic.reSortFlowerList(); } prepareUpdateScale(); } if (type == SlotType.DisplaySlot) { HomeBaseUIController hbuic = GetComponentInParent <HomeBaseUIController>(); hbuic.updateFlowerDisplaySlot(this.getItem()); } }