//实现父类 /// <summary> /// 初始化数据 /// </summary> void InitData() { currentInventory = null; countText = transform.Find("Count").GetComponent <Text>(); inventoryImage = transform.Find("Inventory").GetComponent <Image>(); //初始化图片隐藏 countText.gameObject.SetActive(!this.gameObject.active); inventoryImage.gameObject.SetActive(!this.gameObject.active); }
/// <summary> /// 设置当前item /// </summary> /// <param name="item"></param> public void SetCurrentInventoryItem(InventoryItem item, EquipItemUI equipItemUI) { if (item == null) { return; } this.currentInventory = item; currentEquipItemUI = equipItemUI; DisPlayEquipInfo(currentInventory); }
/// <summary> /// 设置当前item /// </summary> /// <param name="item"></param> public void SetCurrentInventoryItem(InventoryItem item, InventoryItemUI itemUI) { if (item == null) { return; } this.currentInventory = item; this.currentInventoryUI = itemUI; DisPlayInventoryInfo(currentInventory); }
//查找当前元素 /// <summary> /// 设置当前格子的物品信息 /// </summary> /// <param name="item"></param> public void SetCurrentInventory(InventoryItem item) { if (item == null) { return; } this.currentInventory = item; this.currentInventory.IsDressed = true;//表示当前装备的已经穿上的标记 isDressed = true; itemImage.gameObject.SetActive(true); itemImage.sprite = TextureAltlers.Instance.textureArray[int.Parse(currentInventory.Inventory.ICON)]; }
//查找当前元素 public void SetCurrentInventory(InventoryItem item) { currentInventory = item; inventoryImage.gameObject.SetActive(true); countText.gameObject.SetActive(true); inventoryImage.sprite = TextureAltlers.Instance.textureArray[int.Parse(currentInventory.Inventory.ICON)]; if (currentInventory.Count > 1) { countText.text = currentInventory.Count.ToString(); } else { countText.text = ""; } }
public void Clear() { currentInventory = null; itemImage.gameObject.SetActive(false); this.isDressed = false; }
public void Clear() { currentInventory = null; inventoryImage.gameObject.SetActive(false); countText.gameObject.SetActive(false); }