public void init(ITMItem aItem) { _itemRef = aItem; itemTitle.text = aItem.Name(); itemDescription.text = aItem.Description(); if(aItem.SoftCost()>0) { itemCost.text = aItem.SoftCost().ToString(); bagIcon.spriteName = "terracoins"; } else { itemCost.text = aItem.HardCost().ToString(); bagIcon.spriteName = "terradollars"; } /* UISprite newSprite = aItem.Sprite(); if(newSprite!=null) { Destroy (itemSprite); itemSprite = newSprite; newSprite.transform.parent = currentParent; newSprite.transform.localScale = currentScale; newSprite.transform.position = new Vector3(0f,0f,0f); newSprite.transform.localPosition = new Vector3(0f,0f,0f); newSprite.depth = currentSpriteOrder; }*/ itemTexture.mainTexture = aItem.texture(); amountOwned.text = PlayerMain.REF.amountOwned(aItem).ToString(); }
public void initButton(ITMItem aItem) { itemTitle.text = aItem.Name(); _item = aItem; active = true; if(itemBagLabel==null) { itemBagLabel = this.transform.FindChild("Price Container").FindChild("TerraCoinImg").gameObject.GetComponent<UISprite>(); } if(itemCost==null) { itemCost = this.transform.FindChild("Price Container").FindChild("TerraCoinValue").gameObject.GetComponent<UILabel>(); } itemSprite = this.GetComponentInChildren<UITexture>(); itemSprite.mainTexture = aItem.texture(); if(aItem.SoftCost()>0) { itemCost.text = aItem.SoftCost().ToString(); itemBagLabel.spriteName = "terracoins"; } else { itemCost.text = aItem.HardCost().ToString(); itemBagLabel.spriteName = "terradollars"; } }