Example #1
0
        public override void TakeDecision()
        {
            SubPhases.DecisionSubPhase subphase = (Phases.CurrentSubPhase as SubPhases.DecisionSubPhase);
            subphase.ShowDecisionWindowUI();

            if (subphase.IsForced)
            {
                GameCommand command = SubPhases.DecisionSubPhase.GenerateDecisionCommand(subphase.GetDecisions().First().Name);
                GameMode.CurrentGameMode.ExecuteCommand(command);
            }
        }
Example #2
0
        private void StartSelectTemplateSubphase()
        {
            selectedPlanningAction = null;

            TractorBeamDirectionDecisionSubPhase selectTractorDirection = (TractorBeamDirectionDecisionSubPhase)Phases.StartTemporarySubPhaseNew(
                Name,
                typeof(TractorBeamDirectionDecisionSubPhase),
                Triggers.FinishTrigger
                );

            if (canBoost)
            {
                selectTractorDirection.AddDecision(
                    "Straight",
                    delegate {
                    selectedPlanningAction = PerfromStraightTemplatePlanning;
                    DecisionSubPhase.ConfirmDecision();
                },
                    isCentered: true
                    );
            }

            selectTractorDirection.AddDecision("Left", delegate {
                selectedPlanningAction = PerfromLeftBrTemplatePlanning;
                DecisionSubPhase.ConfirmDecision();
            });

            selectTractorDirection.AddDecision("Right", delegate {
                selectedPlanningAction = PerfromRightBrTemplatePlanning;
                DecisionSubPhase.ConfirmDecision();
            });

            selectTractorDirection.DescriptionShort = "Tractor beam";
            selectTractorDirection.DescriptionLong  = "Select direction for " + TheShip.PilotInfo.PilotName;

            selectTractorDirection.DefaultDecisionName = selectTractorDirection.GetDecisions().First().Name;
            selectTractorDirection.RequiredPlayer      = Assigner.PlayerNo;
            selectTractorDirection.ShowSkipButton      = true;

            selectTractorDirection.Start();
        }
Example #3
0
        private void StartSelectTemplateDecision(object sender, System.EventArgs e)
        {
            SelectBoostTemplateDecisionSubPhase selectBoostTemplateDecisionSubPhase = (SelectBoostTemplateDecisionSubPhase)Phases.StartTemporarySubPhaseNew(
                "Select boost template decision",
                typeof(SelectBoostTemplateDecisionSubPhase),
                Triggers.FinishTrigger
                );

            foreach (var move in AvailableBoostMoves)
            {
                ActionColor color = ActionColor.White;
                if (move.IsRed)
                {
                    color = ActionColor.Red;
                }
                else if (move.IsPurple)
                {
                    color = ActionColor.Purple;
                }

                selectBoostTemplateDecisionSubPhase.AddDecision(
                    move.Name,
                    delegate {
                    SelectTemplate(move);
                    DecisionSubPhase.ConfirmDecision();
                },
                    color: color,
                    isCentered: move.Template == ActionsHolder.BoostTemplates.Straight1
                    );
            }

            selectBoostTemplateDecisionSubPhase.DescriptionShort = "Select boost direction";

            selectBoostTemplateDecisionSubPhase.DefaultDecisionName = "Straight 1";

            selectBoostTemplateDecisionSubPhase.RequiredPlayer = TheShip.Owner.PlayerNo;

            selectBoostTemplateDecisionSubPhase.Start();
        }
Example #4
0
        private void TrySelectPosition(TallonRollHelper tallonRollHelper, int direction)
        {
            UI.HideNextButton();

            Selection.ThisShip.SetPosition(tallonRollHelper.GetPosition(direction));

            DecisionSubPhase.ResetInput();

            if (tallonRollHelper.IsPositionAllowed[direction])
            {
                UI.ShowNextButton();
            }
            else
            {
                Messages.ShowError("This position is not available");
            }

            if (Selection.ThisShip.Owner is Players.GenericAiPlayer)
            {
                UI.CallClickNextPhase();
            }
        }
Example #5
0
        public override void DoDefault()
        {
            GameCommand command = DecisionSubPhase.GenerateDecisionCommand(DefaultDecisionName);

            GameMode.CurrentGameMode.ExecuteCommand(command);
        }
        protected virtual void GenerateSelectTemplateDecisions(DecisionSubPhase subphase)
        {
            // Straight templates
            foreach (ManeuverTemplate template in AvailableRepositionTemplates)
            {
                if (template.Bearing == ManeuverBearing.Straight)
                {
                    subphase.AddDecision(
                        "Left " + template.NameNoDirection,
                        (EventHandler) delegate {
                        SelectTemplate(template, Direction.Left);
                        DecisionSubPhase.ConfirmDecision();
                    }
                        );

                    subphase.AddDecision(
                        "Right " + template.NameNoDirection,
                        (EventHandler) delegate {
                        SelectTemplate(template, Direction.Right);
                        DecisionSubPhase.ConfirmDecision();
                    }
                        );
                }
            }

            // Bank templates
            ManeuverTemplate bankLeft  = AvailableRepositionTemplates.FirstOrDefault(n => n.Bearing == ManeuverBearing.Bank && n.Direction == ManeuverDirection.Left);
            ManeuverTemplate bankRight = AvailableRepositionTemplates.FirstOrDefault(n => n.Bearing == ManeuverBearing.Bank && n.Direction == ManeuverDirection.Right);

            if (bankLeft != null && bankRight != null)
            {
                subphase.AddDecision(
                    "Left " + bankRight.NameNoDirection + " Forward",
                    (EventHandler) delegate
                {
                    SelectTemplate(bankRight, Direction.Left, Direction.Top);
                    DecisionSubPhase.ConfirmDecision();
                }
                    );

                subphase.AddDecision(
                    "Right " + bankLeft.NameNoDirection + " Forward",
                    (EventHandler) delegate
                {
                    SelectTemplate(bankLeft, Direction.Right, Direction.Top);
                    DecisionSubPhase.ConfirmDecision();
                }
                    );

                subphase.AddDecision(
                    "Left " + bankLeft.NameNoDirection + " Backwards",
                    (EventHandler) delegate
                {
                    SelectTemplate(bankLeft, Direction.Left, Direction.Bottom);
                    DecisionSubPhase.ConfirmDecision();
                }
                    );

                subphase.AddDecision(
                    "Right " + bankRight.NameNoDirection + " Backwards",
                    (EventHandler) delegate
                {
                    SelectTemplate(bankRight, Direction.Right, Direction.Bottom);
                    DecisionSubPhase.ConfirmDecision();
                }
                    );
            }
        }
Example #7
0
        protected void StartSelectTemplateSubphase(object sender, System.EventArgs e)
        {
            BarrelRollDirectionDecisionSubPhase selectBarrelRollTemplate = (BarrelRollDirectionDecisionSubPhase)Phases.StartTemporarySubPhaseNew(
                Name,
                typeof(BarrelRollDirectionDecisionSubPhase),
                Triggers.FinishTrigger
                );

            foreach (var template in availableTemplates)
            {
                switch (template)
                {
                case Actions.BarrelRollTemplates.Straight1:
                    selectBarrelRollTemplate.AddDecision("Left Straight 1", delegate { SelectTemplate(Actions.BarrelRollTemplateVariants.Straight1Left); DecisionSubPhase.ConfirmDecision(); });
                    selectBarrelRollTemplate.AddDecision("Right Straight 1", delegate { SelectTemplate(Actions.BarrelRollTemplateVariants.Straight1Right); DecisionSubPhase.ConfirmDecision(); });
                    break;

                case Actions.BarrelRollTemplates.Bank1:
                    selectBarrelRollTemplate.AddDecision("Left Bank 1 Forward", delegate { SelectTemplate(Actions.BarrelRollTemplateVariants.Bank1LeftForward); DecisionSubPhase.ConfirmDecision(); });
                    selectBarrelRollTemplate.AddDecision("Right Bank 1 Forward", delegate { SelectTemplate(Actions.BarrelRollTemplateVariants.Bank1RightForward); DecisionSubPhase.ConfirmDecision(); });
                    selectBarrelRollTemplate.AddDecision("Left Bank 1 Backwards", delegate { SelectTemplate(Actions.BarrelRollTemplateVariants.Bank1LeftBackwards); DecisionSubPhase.ConfirmDecision(); });
                    selectBarrelRollTemplate.AddDecision("Right Bank 1 Backwards", delegate { SelectTemplate(Actions.BarrelRollTemplateVariants.Bank1RightBackwards); DecisionSubPhase.ConfirmDecision(); });
                    break;

                case Actions.BarrelRollTemplates.Straight2:
                    selectBarrelRollTemplate.AddDecision("Left Straight 2", delegate { SelectTemplate(Actions.BarrelRollTemplateVariants.Straight2Left); DecisionSubPhase.ConfirmDecision(); });
                    selectBarrelRollTemplate.AddDecision("Right Straight 2", delegate { SelectTemplate(Actions.BarrelRollTemplateVariants.Straight2Right); DecisionSubPhase.ConfirmDecision(); });
                    break;

                default:
                    break;
                }
            }

            selectBarrelRollTemplate.InfoText = "Barrel Roll: Select template and direction";

            selectBarrelRollTemplate.DefaultDecisionName = selectBarrelRollTemplate.GetDecisions().First().Name;

            selectBarrelRollTemplate.RequiredPlayer = Controller.PlayerNo;

            selectBarrelRollTemplate.Start();
        }
Example #8
0
 private void SelectTemplate(string templateName)
 {
     SelectedBoostHelper = templateName;
     DecisionSubPhase.ConfirmDecision();
 }
Example #9
0
 private void FinishTallonRoll()
 {
     DecisionSubPhase.ConfirmDecision();
 }
Example #10
0
 private void CancelSkip(object sender, EventArgs e)
 {
     DecisionSubPhase.ConfirmDecisionNoCallback();
     Next();
 }
Example #11
0
 private void ConfirmSkip(object sender, EventArgs e)
 {
     DecisionSubPhase.ConfirmDecisionNoCallback();
     SkipCombatByShipsWithCurrentInitiative();
 }
Example #12
0
 private void SelectTemplate(string selectedTemplate)
 {
     ShowBombAndDropHelper(selectedTemplate);
     DecisionSubPhase.ConfirmDecision();
 }
 public virtual void DoCustomFinishDecision()
 {
     DecisionSubPhase.ConfirmDecision();
 }
        protected void StartSelectTemplateSubphase(object sender, System.EventArgs e)
        {
            DecloakDirectionDecisionSubPhase selectDecloakTemplate = (DecloakDirectionDecisionSubPhase)Phases.StartTemporarySubPhaseNew(
                Name,
                typeof(DecloakDirectionDecisionSubPhase),
                Triggers.FinishTrigger
                );

            foreach (var template in availableTemplates)
            {
                switch (template)
                {
                case ActionsHolder.DecloakTemplates.Straight2:
                    selectDecloakTemplate.AddDecision("Forward Straight 2", (EventHandler) delegate { SelectTemplate(ActionsHolder.DecloakTemplateVariants.Straight2Forward); DecisionSubPhase.ConfirmDecision(); }, isCentered: true);
                    selectDecloakTemplate.AddDecision("Left Straight 2", (EventHandler) delegate { SelectTemplate(ActionsHolder.DecloakTemplateVariants.Straight2Left); DecisionSubPhase.ConfirmDecision(); });
                    selectDecloakTemplate.AddDecision("Right Straight 2", (EventHandler) delegate { SelectTemplate(ActionsHolder.DecloakTemplateVariants.Straight2Right); DecisionSubPhase.ConfirmDecision(); });
                    break;

                case ActionsHolder.DecloakTemplates.Bank2:
                    selectDecloakTemplate.AddDecision("Forward Bank 2 Left", (EventHandler) delegate { SelectTemplate(ActionsHolder.DecloakTemplateVariants.Bank2ForwardLeft); DecisionSubPhase.ConfirmDecision(); });
                    selectDecloakTemplate.AddDecision("Forward Bank 2 Right", (EventHandler) delegate { SelectTemplate(ActionsHolder.DecloakTemplateVariants.Bank2ForwardRight); DecisionSubPhase.ConfirmDecision(); });
                    selectDecloakTemplate.AddDecision("Left Bank 2 Forward", (EventHandler) delegate { SelectTemplate(ActionsHolder.DecloakTemplateVariants.Bank2LeftForward); DecisionSubPhase.ConfirmDecision(); });
                    selectDecloakTemplate.AddDecision("Right Bank 2 Forward", (EventHandler) delegate { SelectTemplate(ActionsHolder.DecloakTemplateVariants.Bank2RightForward); DecisionSubPhase.ConfirmDecision(); });
                    selectDecloakTemplate.AddDecision("Left Bank 2 Backwards", (EventHandler) delegate { SelectTemplate(ActionsHolder.DecloakTemplateVariants.Bank2LeftBackwards); DecisionSubPhase.ConfirmDecision(); });
                    selectDecloakTemplate.AddDecision("Right Bank 2 Backwards", (EventHandler) delegate { SelectTemplate(ActionsHolder.DecloakTemplateVariants.Bank2RightBackwards); DecisionSubPhase.ConfirmDecision(); });
                    break;

                default:
                    break;
                }
            }

            selectDecloakTemplate.InfoText = "Decloak: Select template and direction";

            selectDecloakTemplate.DefaultDecisionName = selectDecloakTemplate.GetDecisions().First().Name;

            selectDecloakTemplate.RequiredPlayer = Selection.ThisShip.Owner.PlayerNo;

            selectDecloakTemplate.Start();
        }