public static void CreateAskBombDropSubPhase(GenericShip ship) { Selection.ChangeActiveShip("ShipId:" + ship.ShipId); BombDecisionSubPhase selectBombToDrop = (BombDecisionSubPhase)Phases.StartTemporarySubPhaseNew( "Select bomb to drop", typeof(BombDecisionSubPhase), CheckSelectedBomb ); foreach (var timedBombInstalled in GetBombsToDrop(Selection.ThisShip)) { selectBombToDrop.AddDecision( timedBombInstalled.UpgradeInfo.Name, delegate { SelectBomb(timedBombInstalled); } ); } selectBombToDrop.AddDecision( "None", delegate { SelectBomb(null); } ); selectBombToDrop.InfoText = "Select bomb to drop"; selectBombToDrop.DefaultDecisionName = "None"; selectBombToDrop.RequiredPlayer = Selection.ThisShip.Owner.PlayerNo; selectBombToDrop.Start(); }
private static void AskWhatBombToDrop(object sender, EventArgs e) { Selection.ChangeActiveShip("ShipId:" + (sender as GenericShip).ShipId); BombDecisionSubPhase selectBombToDrop = (BombDecisionSubPhase)Phases.StartTemporarySubPhaseNew( "Select bomb to drop", typeof(BombDecisionSubPhase), CheckSelectedBomb ); foreach (var timedBombInstalled in GetTimedBombsInstalled(Selection.ThisShip)) { selectBombToDrop.AddDecision( timedBombInstalled.Name, delegate { SelectBomb(timedBombInstalled); } ); } selectBombToDrop.AddDecision( "None", delegate { SelectBomb(null); } ); selectBombToDrop.InfoText = "Select bomb to drop"; selectBombToDrop.DefaultDecisionName = "None"; selectBombToDrop.RequiredPlayer = Selection.ThisShip.Owner.PlayerNo; selectBombToDrop.Start(); }
public static void CreateAskBombDropSubPhase(GenericShip ship, UpgradeSubType subType = UpgradeSubType.None, Type type = null, bool onlyDrop = false) { Selection.ChangeActiveShip("ShipId:" + ship.ShipId); BombDecisionSubPhase selectBombToDrop = (BombDecisionSubPhase)Phases.StartTemporarySubPhaseNew( "Select a device to drop", typeof(BombDecisionSubPhase), delegate { DropSelectedDevice(onlyDrop); } ); selectBombToDrop.DefaultDecisionName = "None"; foreach (GenericUpgrade deviceInstalled in GetBombsToDrop(Selection.ThisShip, subType, type)) { selectBombToDrop.AddDecision( deviceInstalled.UpgradeInfo.Name, delegate { SelectBomb(deviceInstalled); } ); if (type != null && deviceInstalled.GetType() == type) { selectBombToDrop.DefaultDecisionName = deviceInstalled.UpgradeInfo.Name; } } selectBombToDrop.IsForced = selectBombToDrop.DefaultDecisionName != "None"; if (CheckBombDropCanBeSkipped()) { selectBombToDrop.AddDecision( "None", delegate { SelectBomb(null); } ); } selectBombToDrop.DescriptionShort = "Select a device to drop"; selectBombToDrop.RequiredPlayer = Selection.ThisShip.Owner.PlayerNo; selectBombToDrop.Start(); }