public void Close() { gameObject.SetActive(false); it = null; itui = null; eitem = null; }
void Awake() { helmSprite = transform.Find("HeadSprite").GetComponent <KnapsackRoleEquipItem>(); clothSprite = transform.Find("ClothSprite").GetComponent <KnapsackRoleEquipItem>(); weaponSprite = transform.Find("WeaponSprite").GetComponent <KnapsackRoleEquipItem>(); shoesSprite = transform.Find("ShoesSprite").GetComponent <KnapsackRoleEquipItem>(); necklaceSprite = transform.Find("NecklaceSprite").GetComponent <KnapsackRoleEquipItem>(); braceletSprite = transform.Find("BraceletSprite").GetComponent <KnapsackRoleEquipItem>(); ringSprite = transform.Find("RingSprite").GetComponent <KnapsackRoleEquipItem>(); wingSprite = transform.Find("WingSprite").GetComponent <KnapsackRoleEquipItem>(); expSlider = transform.Find("ExpSlider").GetComponent <UISlider>(); hpLabel = transform.Find("HpLabel/Label").GetComponent <UILabel>(); damageLabel = transform.Find("DamageLabel/Label").GetComponent <UILabel>(); expLabel = expSlider.transform.Find("Label").GetComponent <UILabel>(); }
public void Show(InventoryItem it, InventoryItemUI itui, KnapsackRoleEquipItem eitem, bool isleft = true) { if (it == null) { return; } if (gameObject.active == false) { //Debug.Log("false"); gameObject.active = true; } this.it = it; this.itui = itui; this.isLeft = isleft; this.eitem = eitem; Vector3 pos = transform.localPosition; //Debug.Log(isleft); if (isleft) { //transform.localPosition = new Vector3(-Mathf.Abs(pos.x), pos.y, pos.z); transform.localPosition = new Vector3(0, pos.y, pos.z); equipBtnLabel.text = "装备"; } else { //Debug.Log(-Mathf.Abs(pos.x)); transform.localPosition = new Vector3(320, pos.y, pos.z); equipBtnLabel.text = "卸下"; } iconSprite.spriteName = this.it.Inventory.Icon; nameLabel.text = this.it.Inventory.Name; qualityLabel.text = this.it.Inventory.Quality.ToString(); damageLabel.text = this.it.Inventory.Damage.ToString(); hpLabel.text = this.it.Inventory.ApplyValue.ToString(); levlLabel.text = this.it.Level.ToString(); powerLabel.text = this.it.Inventory.Power.ToString(); desLabel.text = this.it.Inventory.Des; }
// public void OnInventoryClick(object[] o) { //Debug.Log("OnEquipClick"); InventoryItem it = o[0] as InventoryItem; bool isLeft = (bool)(o[1]); //Debug.Log(isLeft); InventoryItemUI itui = null; KnapsackRoleEquipItem eit = null; if (it.Inventory.InventoryTYPE == InventoryType.Equip) { if (isLeft) { itui = o[2] as InventoryItemUI; } else { eit = o[2] as KnapsackRoleEquipItem; } equipPopup.Show(it, itui, eit, isLeft); inventoryPopup.Close(); } else { itui = o[2] as InventoryItemUI; inventoryPopup.Show(it, itui); equipPopup.Close(); } //可以出售的情况 if (isLeft == true) { EnableSellBtn(); this.itui = o[2] as InventoryItemUI; sellPriceLabel.text = (this.itui.it.Inventory.Price * this.itui.it.Count).ToString(); } }