예제 #1
0
 private void RestrictActionEffectsToForceOnly(Ship.GenericShip ship, ActionsList.GenericAction action, ref bool data)
 {
     if (Combat.AttackStep == CombatStep.Attack && Combat.Attacker.ShipId == Host.ShipId && !(action is ForceAction))
     {
         data = false;
     }
 }
예제 #2
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);
        }

        //TODO: Re-generate list instead
        diceModification.ActionEffect(delegate {
            HideDiceModificationButtons();
            ShowDiceModificationButtons();
        });
    }
예제 #3
0
    private static void CreateDiceModificationsButton(ActionsList.GenericAction actionEffect, Vector3 position)
    {
        GameObject prefab    = (GameObject)Resources.Load("Prefabs/GenericButton", typeof(GameObject));
        GameObject newButton = MonoBehaviour.Instantiate(prefab, GameObject.Find("UI/CombatDiceResultsPanel").transform.Find("DiceModificationsPanel"));

        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;
            if (!actionEffect.IsOpposite)
            {
                Selection.ActiveShip = (AttackStep == CombatStep.Attack) ? Attacker : Defender;
                Selection.ActiveShip.AddAlreadyExecutedActionEffect(actionEffect);
            }
            else
            {
                Selection.ActiveShip = (AttackStep == CombatStep.Attack) ? Defender : Attacker;
                Selection.ActiveShip.AddAlreadyExecutedOppositeActionEffect(actionEffect);
            }
            actionEffect.ActionEffect(delegate { });
        });
        Tooltips.AddTooltip(newButton, actionEffect.ImageUrl);
        newButton.GetComponent <Button>().interactable = true;
        newButton.SetActive(true);
    }
예제 #4
0
 private void FinishTractorBeamMovement(ActionsList.GenericAction action)
 {
     TheShip.CallActionIsTaken(action, delegate {
         // ^ CallActionIsTaken to support interaction with black one, etc
         Rules.AsteroidHit.CheckDamage(TheShip);
         Triggers.ResolveTriggers(TriggerTypes.OnMovementFinish, Next);
     });
 }
예제 #5
0
    private static void CreateDiceModificationsButton(ActionsList.GenericAction actionEffect, Vector3 position)
    {
        GameObject prefab    = (GameObject)Resources.Load("Prefabs/GenericButton", typeof(GameObject));
        GameObject newButton = MonoBehaviour.Instantiate(prefab, GameObject.Find("UI/CombatDiceResultsPanel").transform.Find("DiceModificationsPanel"));

        newButton.name = "Button" + actionEffect.EffectName;
        newButton.transform.GetComponentInChildren <Text>().text = actionEffect.EffectName;
        newButton.GetComponent <RectTransform>().position        = position;
        newButton.GetComponent <Button>().onClick.AddListener(
            delegate { GameMode.CurrentGameMode.UseDiceModification(actionEffect.EffectName); }
            );
        Tooltips.AddTooltip(newButton, actionEffect.ImageUrl);
        newButton.GetComponent <Button>().interactable = true;

        newButton.SetActive(Selection.ActiveShip.Owner.GetType() == typeof(Players.HumanPlayer));
    }
예제 #6
0
파일: Combat.cs 프로젝트: keldren/FlyCasual
    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);
    }
예제 #7
0
        private void PerformMultiCoordinateEffect(GenericShip targetShip)
        {
            Selection.ChangeActiveShip(targetShip);
            GenericAction currentAction = ActionsHolder.CurrentAction;

            Triggers.RegisterTrigger(
                new Trigger()
            {
                Name         = "Coordinate",
                TriggerOwner = Selection.ThisShip.Owner.PlayerNo,
                TriggerType  = TriggerTypes.OnFreeActionPlanned,
                EventHandler = delegate { PerformFreeAction(targetShip); }
            }
                );

            MovementTemplates.ReturnRangeRuler();

            Triggers.ResolveTriggers(TriggerTypes.OnFreeActionPlanned, (System.Action) delegate {
                Selection.ChangeActiveShip(CoordinateActionData.CoordinateProvider);
                CoordinateActionData.CoordinateProvider.OnCoordinateTargetIsSelected -= PrepareToRememberChosenAction;
                ActionsHolder.CurrentAction = currentAction;
                Triggers.FinishTrigger();
            });
        }
예제 #8
0
 private void UseSnapShotRestriction(GenericShip ship, ActionsList.GenericAction action, ref bool canBeUsed)
 {
     Messages.ShowErrorToHuman("SnapShot: Unable to modify dice.");
     canBeUsed = false;
 }
예제 #9
0
 private void UseDiceModificationRestriction(GenericAction action, ref bool canBeUsed)
 {
     Messages.ShowInfoToHuman("Accuracy corrector: All dice modifications are disabled");
     canBeUsed = false;
 }