public override bool MouseUp(int x, int y)
{
if (_selectionShowing && !_equipmentSelection.MouseUp(x, y))
{
//Clicked outside the window, close the window
_selectionShowing = false;
return true;
}
if (_fleetSpecsShowing && !_fleetSpecsWindow.MouseUp(x, y))
{
//Clicked outside the window, didn't scrap, so close window
_fleetSpecsShowing = false;
if (CloseWindow != null)
{
CloseWindow();
}
return true;
}
for (int i = 0; i < _shipSizeButtons.Length; i++)
{
if (_shipSizeButtons[i].MouseUp(x, y))
{
_shipDesign.Size = i;
_shipDesign.UpdateEngineNumber();
RefreshAll();
return true;
}
}
if (_prevShipStyleButton.MouseUp(x, y))
{
_shipDesign.WhichStyle--;
if (_shipDesign.WhichStyle < 0)
{
_shipDesign.WhichStyle = 5;
}
RefreshShipSprite();
return true;
}
if (_nextShipStyleButton.MouseUp(x, y))
{
_shipDesign.WhichStyle++;
if (_shipDesign.WhichStyle > 5)
{
_shipDesign.WhichStyle = 0;
}
RefreshShipSprite();
return true;
}
if (_armorButton.MouseUp(x, y))
{
_selectionShowing = true;
_equipmentSelection.LoadEquipments(_shipDesign, EquipmentType.ARMOR, 0, _availableArmorTechs, _techLevels, _spacePerPower, _costPerPower);
_equipmentSelection.OnSelectEquipment = OnSelectArmor;
return true;
}
if (_computerButton.MouseUp(x, y))
{
_selectionShowing = true;
_equipmentSelection.LoadEquipments(_shipDesign, EquipmentType.COMPUTER, 0, _availableComputerTechs, _techLevels, _spacePerPower, _costPerPower);
_equipmentSelection.OnSelectEquipment = OnSelectComputer;
return true;
}
if (_shieldButton.MouseUp(x, y))
{
_selectionShowing = true;
_equipmentSelection.LoadEquipments(_shipDesign, EquipmentType.SHIELD, 0, _availableShieldTechs, _techLevels, _spacePerPower, _costPerPower);
_equipmentSelection.OnSelectEquipment = OnSelectShield;
return true;
}
if (_ECMButton.MouseUp(x, y))
{
_selectionShowing = true;
_equipmentSelection.LoadEquipments(_shipDesign, EquipmentType.COMPUTER, 0, _availableECMTechs, _techLevels, _spacePerPower, _costPerPower);
_equipmentSelection.OnSelectEquipment = OnSelectECM;
return true;
}
if (_engineButton.MouseUp(x, y))
{
_selectionShowing = true;
_equipmentSelection.LoadEquipments(_shipDesign, EquipmentType.ENGINE, 0, _availableEngineTechs, _techLevels, _spacePerPower, _costPerPower);
_equipmentSelection.OnSelectEquipment = OnSelectEngine;
return true;
}
if (_maneuverButton.MouseUp(x, y))
{
_selectionShowing = true;
_equipmentSelection.LoadEquipments(_shipDesign, EquipmentType.MANEUVER, _shipDesign.ManeuverSpeed, _techLevels, _spacePerPower, _costPerPower);
return true;
}
for (int i = 0; i < _weaponButtons.Length; i++)
{
if (_weaponButtons[i].MouseUp(x, y))
{
_selectionShowing = true;
_equipmentSelection.LoadEquipments(_shipDesign, EquipmentType.WEAPON, i, _availableWeaponTechs, _techLevels, _spacePerPower, _costPerPower);
_equipmentSelection.OnSelectEquipment = OnSelectWeapon;
return true;
}
if (_weaponCounts[i].MouseUp(x, y))
{
_shipDesign.Weapons[i] = new KeyValuePair<Equipment, int>(_shipDesign.Weapons[i].Key, _weaponCounts[i].Value);
RefreshWeapons();
RefreshStats();
RefreshValidButtons();
}
}
for (int i = 0; i < _specialButtons.Length; i++)
{
if (_specialButtons[i].MouseUp(x, y))
{
_selectionShowing = true;
_equipmentSelection.LoadEquipments(_shipDesign, EquipmentType.SPECIAL, i, _availableSpecialTechs, _techLevels, _spacePerPower, _costPerPower);
_equipmentSelection.OnSelectEquipment = OnSelectSpecial;
return true;
}
}
if (_clearButton.MouseUp(x, y))
{
_shipDesign.Clear(_availableArmorTechs, _availableEngineTechs);
RefreshAll();
return true;
}
if (_confirmButton.MouseUp(x, y))
{
if (_gameMain.EmpireManager.CurrentEmpire.FleetManager.CurrentDesigns.Count < 6)
{
//Easy peasy, just add the current ship design
_gameMain.EmpireManager.CurrentEmpire.FleetManager.AddShipDesign(_shipDesign);
if (CloseWindow != null)
{
CloseWindow();
}
}
else
{
//Gotta show the UI for scrapping a ship design
_fleetSpecsShowing = true;
_fleetSpecsWindow.LoadDesigns();
}
return true;
}
if (_nameField.MouseUp(x, y))
{
return true;
}
if (!base.MouseUp(x, y))
{
if (CloseWindow != null)
{
CloseWindow();
return true;
}
}
return false;
}