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; } }
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(); }); }
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); }
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); }); }
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)); }
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); }
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(); }); }
private void UseSnapShotRestriction(GenericShip ship, ActionsList.GenericAction action, ref bool canBeUsed) { Messages.ShowErrorToHuman("SnapShot: Unable to modify dice."); canBeUsed = false; }
private void UseDiceModificationRestriction(GenericAction action, ref bool canBeUsed) { Messages.ShowInfoToHuman("Accuracy corrector: All dice modifications are disabled"); canBeUsed = false; }