private void setEquipment(MMX.HumanEquipment item, int index) { if (index <= 2) { currentHuman.equipments.setWeapon(item as MMX.HumanWeaponEquipment, index); } else { currentHuman.equipments.setArmor(item as MMX.HumanArmorEquipment, (MMX.HumanArmorEquipmentType)(index - 3)); } refreshEquipment(); }
public void selectedButtonChanged() { if (selectButtonPanel.getButtonActive()) { currentSelectedGameObject.GetComponent <ButtonController>().clickEvent(); } else if (equipmentPanel.getButtonActive()) { var index = currentSelectedGameObject.GetComponent <ButtonController>().siblingButtonIndex; MMX.HumanEquipment item = null; if (index <= 2) { item = currentHuman.equipments.weapons[index]; } else { if (currentHuman.equipments.armors.ContainsKey((MMX.HumanArmorEquipmentType)(index - 3))) { item = currentHuman.equipments.armors[(MMX.HumanArmorEquipmentType)(index - 3)]; } } if (item == null) { leftPanelFields.IntroducePanel.GetComponent <UnityEngine.CanvasGroup>().alpha = 0; return; } else { this.leftPanelFields.ItemNameText.text = item.name; if (item is MMX.HumanWeaponEquipment) { leftPanelFields.WeaponPanel.SetActive(true); leftPanelFields.ArmorPanel.SetActive(false); this.leftPanelFields.ItemDescriptionText.text = "武器"; var weaponItem = item as MMX.HumanWeaponEquipment; this.leftPanelFields.DamageText.text = "攻击力: " + weaponItem.attack; this.leftPanelFields.RangeText.text = "范围: " + weaponItem.attackRangeType.getName(); this.leftPanelFields.PropertyText.text = "属性: " + weaponItem.attackProperty.getName(); UnityEngine.UI.LayoutRebuilder.ForceRebuildLayoutImmediate(leftPanelFields.IntroducePanel.GetComponent <RectTransform>()); } else { leftPanelFields.WeaponPanel.SetActive(false); leftPanelFields.ArmorPanel.SetActive(true); var armorItem = item as MMX.HumanArmorEquipment; this.leftPanelFields.ItemDescriptionText.text = armorItem.type.getName(); this.leftPanelFields.ArmorDamageText.text = "攻击力: " + armorItem.attack; this.leftPanelFields.DefenseText.text = "防御力: " + armorItem.defense; this.leftPanelFields.VelocityText.text = "速度值: " + armorItem.speed; this.leftPanelFields.MachoText.text = "男人味: " + armorItem.manliness; leftPanelFields.propertyTexts[0].text = "" + armorItem.fireResistance; leftPanelFields.propertyTexts[1].text = "" + armorItem.iceResistance; leftPanelFields.propertyTexts[2].text = "" + armorItem.electricResistance; leftPanelFields.propertyTexts[3].text = "" + armorItem.sonicResistance; leftPanelFields.propertyTexts[4].text = "" + armorItem.gasResistance; leftPanelFields.propertyTexts[5].text = "" + armorItem.laserResistance; UnityEngine.UI.LayoutRebuilder.ForceRebuildLayoutImmediate(leftPanelFields.IntroducePanel.GetComponent <RectTransform>()); } leftPanelFields.IntroducePanel.GetComponent <UnityEngine.CanvasGroup>().alpha = 1; } } }