Пример #1
0
	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();
	}
Пример #2
0
		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";
			}
		}
Пример #3
0
		public void setFutureMove(ITMItem aItem) {
			
			SelectedMoveData moveData = new SelectedMoveData(aItem);
			
			if(_futureMoveInfo!=null) {
				_futureMoveInfo.cleanUp();
				_futureMoveInfo =null;
			}
			_futureMoveInfo = new MoveQueueItem(aItem,this);
			if(onMoveSet!=null) {
				Debug.Log("Setting Future Move From Item: "+aItem.Name());
				onMoveSet(this as BattleMonster,this._futureMoveInfo.moveData,false);
			}
			
		}
Пример #4
0
		public void addToInventory(ITMItem aItem) {
			if(aItem!=null) {
			for(int i = 0;i<_myItems.size;i++) {
				if(_myItems[i].item.Name()==aItem.Name()) {
					_myItems[i].count++;
					
					saveInventory();
					return;
				}
			}
				InventoryItem item = new InventoryItem();
				item.count = 1;
				item.item = aItem;
				_myItems.Add(item);
				
				saveInventory();
			}
			
		}