Beispiel #1
0
        private IEnumerator CheckAwailiblePositions()
        {
            TallonRollHelper tallonRollHelper = new TallonRollHelper(Selection.ThisShip);

            yield return(tallonRollHelper.CheckPositions());

            bool isAnyPositionAvailable = tallonRollHelper.IsPositionAllowed.Values.Any(n => n == true);

            if (isAnyPositionAvailable)
            {
                TallonRollShiftSubPhase subPhase = Phases.StartTemporarySubPhaseNew <TallonRollShiftSubPhase>(
                    "Tallon Roll Shift",
                    delegate { Phases.FinishSubPhase(typeof(TallonRollSubPhase)); }
                    );

                subPhase.AddDecision("Forward", delegate { TrySelectPosition(tallonRollHelper, 1); }, isCentered: true);
                subPhase.AddDecision("Center", delegate { TrySelectPosition(tallonRollHelper, 0); }, isCentered: true);
                subPhase.AddDecision("Backward", delegate { TrySelectPosition(tallonRollHelper, -1); }, isCentered: true);

                subPhase.DescriptionShort = "Select final position";

                subPhase.DecisionOwner         = Selection.ThisShip.Owner;
                subPhase.DefaultDecisionName   = "Center";
                subPhase.OnNextButtonIsPressed = FinishTallonRoll;

                subPhase.Start();
            }
            else
            {
                Messages.ShowError("Tallon Roll: No available positions");
            }
        }
Beispiel #2
0
        private void EndTallonRollRotation()
        {
            PositionAfterRotation = Selection.ThisShip.GetPosition();

            TallonRollShiftSubPhase subPhase = Phases.StartTemporarySubPhaseNew <TallonRollShiftSubPhase>(
                "Tallon Roll Shift",
                delegate { Phases.FinishSubPhase(typeof(TallonRollSubPhase)); }
                );

            subPhase.AddDecision("Forward", delegate { ConfirmDecision(1); }, isCentered: true);
            subPhase.AddDecision("Center", delegate { ConfirmDecision(0); }, isCentered: true);
            subPhase.AddDecision("Backwards", delegate { ConfirmDecision(-1); }, isCentered: true);

            subPhase.DescriptionShort = "Select final position";

            subPhase.DecisionOwner         = Selection.ThisShip.Owner;
            subPhase.DefaultDecisionName   = "Center";
            subPhase.OnNextButtonIsPressed = FinishTallonRoll;

            subPhase.Start();
        }