private void RefreshWeapons()
{
for (int i = 0; i < _shipDesign.Weapons.Length; i++)
{
var weapon = _shipDesign.Weapons[i];
if (weapon.Key == null)
{
_weaponButtons[i].SetText("No Weapon");
_weaponCounts[i].SetValue(1);
_weaponCounts[i].Enabled = false;
_weaponDescriptions[i].SetText(string.Empty);
}
else
{
_weaponButtons[i].SetText(weapon.Key.DisplayName);
_weaponCounts[i].SetValue(weapon.Value);
_weaponCounts[i].Enabled = true;
string description = string.Empty;
if (weapon.Key.Technology.WeaponType == Technology.MISSILE_WEAPON)
{
description = string.Format("Damage: {0} Range: {1} ", weapon.Key.GetMaxDamage(), weapon.Key.GetRange());
}
else
{
description = string.Format("Damage: {0}-{1} Range: {2} ", weapon.Key.GetMinDamage(), weapon.Key.GetMaxDamage(), weapon.Key.GetRange());
}
if (weapon.Key.Technology.WeaponType == Technology.MISSILE_WEAPON)
{
description += string.Format("{0} Shots ", weapon.Key.UseSecondary ? 5 : 2);
}
else if (weapon.Key.Technology.NumberOfShots > 0)
{
description += string.Format("{0} Shots ", weapon.Key.Technology.NumberOfShots);
}
if (weapon.Key.Technology.Streaming)
{
description += "Streaming, ";
}
if (weapon.Key.Technology.ShieldPiercing)
{
description += "Piercing, ";
}
if (weapon.Key.Technology.Enveloping)
{
description += "Enveloping, ";
}
if (weapon.Key.Technology.Dissipating)
{
description += "Dissipating, ";
}
if (weapon.Key.Technology.TargetingBonus > 0)
{
description += string.Format("{0} To Hit ", weapon.Key.Technology.TargetingBonus);
}
description = description.Trim().TrimEnd(new[] { ',' });
_weaponDescriptions[i].SetText(description);
}
}
}