public Equipment(string ID) { Item tem_Item = null; foreach (Item tem in GameValue.Items.GetArray()) { if (tem.ID == ID) { tem_Item = tem; break; } } Name = tem_Item.Name; Additives = tem_Item.Additives; Tybe = EquipmentName.GetEquipmentTybe(Additives.GetAdditive(0).Value); this.ID = ID; }
private void But_TakeOffEquipment_Click(object sender, EventArgs e) { int index = 0; foreach (RadioButton tem in rad_Equipments) { if (tem.Checked) { break; } index++; } PlayerValue.Items.Add(new Item(PlayerValue.Player.Equipments.GetEquipment(EquipmentName.GetEquipmentTybe(index)).ID, 1)); PlayerValue.Player.Equipments.DeleteEquipment(EquipmentName.GetEquipmentTybe(index)); PlayerEquipmentReFresh(); rad_Equipments[index].Checked = false; PlayerBagReFresh(); }
private void Rad_Equipments_Click(object sender, EventArgs e) { int index = 0; foreach (RadioButton tem in rad_Equipments) { if (tem == sender) { break; } index++; } if (rad_Equipments[index].Checked) { if (PlayerValue.Player.Equipments.GetEquipment(EquipmentName.GetEquipmentTybe(index)) == null) { but_TakeOffEquipment.Visible = false; lab_EquipmentInfo.Text = EquipmentName.Text[index] + "\r\n" + "未装备"; } else { but_TakeOffEquipment.Visible = true; string tem_str = EquipmentName.Text[index] + "\r\n" + PlayerValue.Player.Equipments.GetEquipment(EquipmentName.GetEquipmentTybe(index)).Name + "\r\n"; for (int i = 0; i < 6; i++) { int value = PlayerValue.Player.Equipments.GetEquipment(EquipmentName.GetEquipmentTybe(index)). GetAdditive(AttributeName.GetAttributeValue(i)); if (value != 0) { tem_str += AttributeName.GetAttributeName(AttributeName.GetAttributeValue(i)) + Function.GetValueSymbol(value) + "\r\n"; } } lab_EquipmentInfo.Text = tem_str; } } else { lab_EquipmentInfo.Text = ""; but_TakeOffEquipment.Visible = false; } }
private void PlayerEquipmentReFresh() //刷新玩家装备界面 { Player player = PlayerValue.Player; int index = 0; foreach (Equipment tem in player.Equipments.GetArray()) { if (tem != null) { rad_Equipments[index].Text = EquipmentName.Text[index] + ":" + "\r\n" + player.Equipments.GetEquipment(EquipmentName.GetEquipmentTybe(index)).Name; } else { rad_Equipments[index].Text = EquipmentName.Text[index] + ":" + "\r\n" + "未装备"; } index++; } }