Exemple #1
0
    // TAKE ACTION TRIGGERS

    public static void TakeAction(GenericAction action)
    {
        var ship = Selection.ThisShip;

        Tooltips.EndTooltip();
        UI.HideSkipButton();
        ship.AddAlreadyExecutedAction(action);
        CurrentAction = action;
        action.ActionTake();
    }
Exemple #2
0
        private void UseColonelJendonAbility(char letter)
        {
            Tooltips.EndTooltip();

            SelectTargetForAbility(
                SelectColonelJendonAbilityTarget,
                FilterAbilityTargets,
                GetAiAbilityPriority,
                HostShip.Owner.PlayerNo
                );
        }
Exemple #3
0
        public void PerformAttackWithWeapon(IShipWeapon weapon)
        {
            Tooltips.EndTooltip();
            Messages.ShowInfo("Attacking with " + weapon.Name);

            Combat.ChosenWeapon = weapon;
            Combat.ShotInfo     = new ShotInfo(Selection.ThisShip, Selection.AnotherShip, Combat.ChosenWeapon);

            Phases.FinishSubPhase(typeof(WeaponSelectionDecisionSubPhase));
            CallBack();
        }
Exemple #4
0
        public static void ConfirmDecision()
        {
            Tooltips.EndTooltip();
            UI.HideSkipButton();

            Action callBack = Phases.CurrentSubPhase.CallBack;

            Phases.FinishSubPhase(Phases.CurrentSubPhase.GetType());
            Phases.CurrentSubPhase.Resume();
            callBack();
        }
Exemple #5
0
        public void PerformAttackWithWeapon(IShipWeapon weapon)
        {
            Tooltips.EndTooltip();

            Combat.ChosenWeapon = weapon;

            Messages.ShowInfo("Attack with " + weapon.Name);

            Phases.FinishSubPhase(typeof(WeaponSelectionDecisionSubPhase));
            CallBack();
        }
Exemple #6
0
        private void UseColonelJendonAbility(char letter)
        {
            Tooltips.EndTooltip();

            SelectTargetForAbility(
                SelectColonelJendonAbilityTarget,
                new List <TargetTypes> {
                TargetTypes.OtherFriendly
            },
                new UnityEngine.Vector2(1, 1)
                );
        }
Exemple #7
0
        public override void PerformAction()
        {
            List <ActionsList.GenericAction> availableActions = Selection.ThisShip.GetAvailableActionsList();

            foreach (var action in availableActions)
            {
                (Phases.CurrentSubPhase as SubPhases.DecisionSubPhase).AddDecision(action.Name, delegate {
                    Tooltips.EndTooltip();
                    Game.UI.HideNextButton();
                    Selection.ThisShip.AddAlreadyExecutedAction(action);
                    action.ActionTake();
                });
            }
        }
Exemple #8
0
        private void UseColonelJendonAbility(char letter)
        {
            Tooltips.EndTooltip();

            SelectTargetForAbility(
                SelectColonelJendonAbilityTarget,
                FilterAbilityTargets,
                GetAiAbilityPriority,
                HostShip.Owner.PlayerNo,
                HostShip.PilotInfo.PilotName,
                "Choose a ship to assign to it one of your Blue Target Lock tokens if it does not have a Blue Target Lock token",
                HostShip
                );
        }
Exemple #9
0
        public void ShowActionDecisionPanel()
        {
            List <ActionsList.GenericAction> availableActions = Selection.ThisShip.GetAvailableFreeActionsList();

            foreach (var action in availableActions)
            {
                AddDecision(action.Name, delegate {
                    Tooltips.EndTooltip();
                    Game.UI.HideSkipButton();
                    Selection.ThisShip.AddAlreadyExecutedAction(action);
                    action.ActionTake();
                });
                AddTooltip(action.Name, action.ImageUrl);
            }
        }
Exemple #10
0
        private void UseColonelJendonAbility(char letter)
        {
            Tooltips.EndTooltip();

            SelectTargetForAbility(
                SelectColonelJendonAbilityTarget,
                FilterAbilityTargets,
                GetAiAbilityPriority,
                HostShip.Owner.PlayerNo,
                true,
                DecisionSubPhase.ConfirmDecision,
                HostShip.PilotName,
                "Choose a ship to assign to it one of your Blue Target Lock tokens if it does not have a Blue Target Lock token.",
                HostShip.ImageUrl
                );
        }
Exemple #11
0
    public static void UseDiceModification(string diceModificationName)
    {
        Phases.CurrentSubPhase.IsReadyForCommands = false;

        Tooltips.EndTooltip();

        GameObject DiceModificationButton = GameObject.Find("UI/CombatDiceResultsPanel").transform.Find("DiceModificationsPanel").Find("Button" + diceModificationName).gameObject;

        DiceModificationButton.GetComponent <Button>().interactable = false;

        GenericAction diceModification = AvailableDecisions[diceModificationName];

        switch (diceModification.DiceModificationTiming)
        {
        case DiceModificationTimingType.Normal:
        case DiceModificationTimingType.AfterRolled:
            Selection.ActiveShip = (AttackStep == CombatStep.Attack) ? Attacker : Defender;
            break;

        case DiceModificationTimingType.Opposite:
            Selection.ActiveShip = (AttackStep == CombatStep.Attack) ? Defender : Attacker;
            break;

        case DiceModificationTimingType.CompareResults:
            Selection.ActiveShip = Attacker;
            break;

        default:
            break;
        }

        Selection.ActiveShip.AddAlreadyUsedDiceModification(diceModification);

        diceModification.ActionEffect(delegate {
            if (!Combat.CurrentDiceRoll.ModifiedBy.Contains(diceModification.HostShip.Owner.PlayerNo))
            {
                Combat.CurrentDiceRoll.ModifiedBy.Add(diceModification.HostShip.Owner.PlayerNo);
            }
            ReplaysManager.ExecuteWithDelay(delegate {
                //make sure UI/CombatDiceResultsPanel is available again
                GameObject.Find("UI").transform.Find("CombatDiceResultsPanel").gameObject.SetActive(true);
                ReGenerateListOfButtons(diceModification.DiceModificationTiming);
            });
        });
    }
Exemple #12
0
    private static void CreateDiceModificationsButton(ActionsList.GenericAction actionEffect, Vector3 position)
    {
        GameObject newButton = MonoBehaviour.Instantiate(Game.PrefabsList.GenericButton, Game.PrefabsList.DiceResultsMenu.transform);

        newButton.name = "Button" + actionEffect.EffectName;
        newButton.transform.GetComponentInChildren <Text>().text = actionEffect.EffectName;
        newButton.GetComponent <RectTransform>().position        = position;
        newButton.GetComponent <Button>().onClick.AddListener(delegate
        {
            Tooltips.EndTooltip();
            newButton.GetComponent <Button>().interactable = false;
            Selection.ThisShip.AddAlreadyExecutedActionEffect(actionEffect);
            actionEffect.ActionEffect();
        });
        Tooltips.AddTooltip(newButton, actionEffect.ImageUrl);
        newButton.GetComponent <Button>().interactable = true;
        newButton.SetActive(true);
    }
Exemple #13
0
        public void ShowActionDecisionPanel()
        {
            Selection.ThisShip.IsFreeActionSkipped = false;
            List <ActionsList.GenericAction> availableActions = Selection.ThisShip.GetAvailableFreeActionsList();

            foreach (var action in availableActions)
            {
                AddDecision(action.Name, delegate {
                    var ship = Selection.ThisShip;
                    Tooltips.EndTooltip();
                    UI.HideSkipButton();
                    ship.AddAlreadyExecutedAction(action);
                    ship.CallActionIsTaken(action);
                    action.ActionTake();
                });
                AddTooltip(action.Name, action.ImageUrl);
            }
        }
Exemple #14
0
        public void PerformTorpedoesAttack(object sender, EventArgs e)
        {
            Tooltips.EndTooltip();

            //TODO: Get upgrade correctly
            Upgrade.GenericSecondaryWeapon secondaryWeapon = null;
            foreach (var upgrade in Selection.ThisShip.InstalledUpgrades)
            {
                if (upgrade.Key == Upgrade.UpgradeSlot.Torpedoes)
                {
                    secondaryWeapon = upgrade.Value as Upgrade.GenericSecondaryWeapon;
                }
            }
            Combat.SelectWeapon(secondaryWeapon);

            Messages.ShowInfo("Attack with " + secondaryWeapon.Name);

            Phases.FinishSubPhase(typeof(WeaponSelectionDecisionSubPhase));

            Combat.TryPerformAttack();
        }
Exemple #15
0
    private static void ShowActionsButtons(List <ActionsList.GenericAction> actionList)
    {
        HideActionsButtons();

        float   offset          = 0;
        Vector3 defaultPosition = new Vector3(5, -5, 0);

        foreach (var action in actionList)
        {
            GameObject newButton = MonoBehaviour.Instantiate(Game.PrefabsList.GenericButton, Game.PrefabsList.PanelActions.transform.Find("ActionButtons").transform);
            newButton.name = "Button" + action.Name;
            newButton.transform.GetComponentInChildren <Text>().text = action.Name;
            newButton.GetComponent <RectTransform>().localPosition   = defaultPosition + new Vector3(0, -offset, 0);
            offset += 40;
            newButton.GetComponent <Button>().onClick.AddListener(delegate {
                Tooltips.EndTooltip();
                CloseActionsPanel();
                Selection.ThisShip.AddAlreadyExecutedAction(action);
                action.ActionTake();
            });
            Tooltips.AddTooltip(newButton, action.ImageUrl);
            newButton.GetComponent <Button>().interactable = true;
            newButton.SetActive(true);
        }

        Selection.ActiveShip = Selection.ThisShip;

        if (actionList.Count != 0)
        {
            Game.PrefabsList.PanelActions.GetComponent <RectTransform>().sizeDelta = new Vector2(Game.PrefabsList.PanelActions.GetComponent <RectTransform>().sizeDelta.x, offset + 80);
            Game.PrefabsList.PanelActions.SetActive(true);
        }
        else
        {
            Messages.ShowErrorToHuman("Cannot perform any actions");
            Phases.Next();
        }
    }
Exemple #16
0
    public static void UseDiceModification(string diceModificationName)
    {
        Tooltips.EndTooltip();

        GameObject DiceModificationButton = GameObject.Find("UI/CombatDiceResultsPanel").transform.Find("DiceModificationsPanel").Find("Button" + diceModificationName).gameObject;

        DiceModificationButton.GetComponent <Button>().interactable = false;

        ActionsList.GenericAction diceModification = AvailableDecisions[diceModificationName];

        if (!diceModification.IsOpposite)
        {
            Selection.ActiveShip = (AttackStep == CombatStep.Attack) ? Attacker : Defender;
            Selection.ActiveShip.AddAlreadyExecutedActionEffect(diceModification);
        }
        else
        {
            Selection.ActiveShip = (AttackStep == CombatStep.Attack) ? Defender : Attacker;
            Selection.ActiveShip.AddAlreadyExecutedOppositeActionEffect(diceModification);
        }

        diceModification.ActionEffect(delegate { ReGenerateListOfButtons(diceModification.IsOpposite); });
    }
Exemple #17
0
 public static void CallHideTooltip()
 {
     Tooltips.EndTooltip();
 }