public void OnInventoryClick(object[] objArr) { InventoryItem it = objArr [0] as InventoryItem; bool isLeft = (bool)objArr [1]; if (it._Item._InventoryType == InventoryType.Equip) { InventoryItemUI itUI = null; BagRoleEquip bre = null; if (isLeft == true) { itUI = objArr [2] as InventoryItemUI; } else { bre = objArr[2] as BagRoleEquip; } inventoryPopup.Close(); equipPopup.Show(it, itUI, bre, isLeft); } else { InventoryItemUI itUI = objArr[2] as InventoryItemUI; equipPopup.Close(); inventoryPopup.Show(it, itUI); } if ((it._Item._InventoryType == InventoryType.Equip && isLeft == true) || it._Item._InventoryType != InventoryType.Equip) { this.it = it; EnableBtn(); } }
void Awake() { wuqiSprite = transform.Find("wuqiSprite").GetComponent <BagRoleEquip> (); shangyiSprite = transform.Find("shangyiSprite").GetComponent <BagRoleEquip> (); xiazhuangSprite = transform.Find("xiazhuangSprite").GetComponent <BagRoleEquip> (); jianjiaSprite = transform.Find("jianjiaSprite").GetComponent <BagRoleEquip> (); xieSprite = transform.Find("xieSprite").GetComponent <BagRoleEquip> (); jiezhiSprite = transform.Find("jiezhiSprite").GetComponent <BagRoleEquip> (); yaodaiSprite = transform.Find("yaodaiSprite").GetComponent <BagRoleEquip> (); zengfushuSprite = transform.Find("zengfushuSprite").GetComponent <BagRoleEquip> (); healthLabel = transform.Find("ProtoContainer/HealthLabel").GetComponent <UILabel> (); attackLabel = transform.Find("ProtoContainer/AttackLabel").GetComponent <UILabel> (); defenceLabel = transform.Find("ProtoContainer/DefenceLabel").GetComponent <UILabel> (); energyLabel = transform.Find("ProtoContainer/EnergyLabel").GetComponent <UILabel> (); resistanceLabel = transform.Find("ProtoContainer/ResistanceLabel").GetComponent <UILabel> (); healthCoverLabel = transform.Find("ProtoContainer/HealthCoverLabel").GetComponent <UILabel> (); powerLabel = transform.Find("ProtoContainer/PowerLabel").GetComponent <UILabel> (); featsLabel = transform.Find("ProtoContainer/FeatsLabel").GetComponent <UILabel> (); PlayerInfo._instance.OnPlayerInfoChanged += this.OnPlayerInfoChanged; }
public void Show(InventoryItem it, InventoryItemUI itUI, BagRoleEquip bre, bool isLeft = true) { gameObject.SetActive(true); this.it = it; this.itUI = itUI; this.bre = bre; Vector3 pos = transform.localPosition; this.isLeft = isLeft; if (isLeft) { transform.localPosition = new Vector3(-Mathf.Abs(pos.x), pos.y, pos.z); btnLabel.text = "装备"; } else { transform.localPosition = new Vector3(Mathf.Abs(pos.x), pos.y, pos.z); btnLabel.text = "卸下"; } pic_equip.spriteName = it._Item._Headpic.ToString(); describe.text = it._Item._Describe.ToString(); string _level; string _levelName = ""; //float expEx = 1; if (0 < it._Exp && it._Exp < 300) { _level = "F"; _levelName = "损坏的"; _name.color = Color.gray; //expEx += 0.0f; } else if (300 <= it._Exp && it._Exp < 500) { _level = "E"; _levelName = "破旧的"; _name.color = Color.grey; //expEx += 0.1f; } else if (500 <= it._Exp && it._Exp < 700) { _level = "D"; _levelName = "二手的"; _name.color = Color.white; //expEx += 0.2f; } else if (700 <= it._Exp && it._Exp < 1000) { _level = "C"; _levelName = "普通的"; _name.color = Color.green; //expEx += 0.35f; } else if (1000 <= it._Exp && it._Exp < 1600) { _level = "B"; _levelName = "崭新的"; _name.color = Color.cyan; //expEx += 0.5f; } else if (1600 <= it._Exp && it._Exp < 2200) { _level = "A"; _levelName = "高级的"; _name.color = Color.blue; //expEx += 0.7f; } else if (2200 <= it._Exp && it._Exp < 3000) { _level = "S"; _levelName = "极品的"; _name.color = Color.yellow; //expEx += 0.9f; } else if (3000 <= it._Exp && it._Exp < 4000) { _level = "SS"; _levelName = "卓越的"; _name.color = Color.magenta; //expEx += 1.2f; } else if (4000 <= it._Exp && it._Exp < 6000) { _level = "SSS"; _levelName = "史诗的"; _name.color = Color.red; //expEx += 1.6f; } else if (6000 <= it._Exp) { _level = "Z"; _levelName = "泰斗的"; _name.color = Color.Lerp(Color.yellow, Color.red, 0.5f); //expEx += 2.0f; } else { _level = "F"; if (it._Item._InventoryType != InventoryType.Equip) { _name.color = Color.white; } else { _levelName = "损坏的"; _name.color = Color.gray; } //expEx += 0.0f; } level.text = _level.ToString(); if (it._Item._InventoryType == InventoryType.Equip) { _name.text = "+" + it._Strengthen.ToString() + " " + _levelName + " " + it._Item._Name.ToString(); } else { _name.text = it._Item._Name.ToString(); } MakePrototypes.MakeEquipProto(it, InventoryManager._instance.inventoryDic); proto.text = "\n攻击力:" + it.Attack + "\n" + "\n防御力:" + it.Defence + "\n" + "\n生命值:" + it.Health + "\n" + "\n抗性:" + it.Resistance + "\n" + "\n生命恢复:" + it.HealthCover + "\n"; powerLabel.text = MakePrototypes.GetEquipPower(it).ToString(); feats.text = it._Feats.ToString(); }