Exemplo n.º 1
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;

        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 { ReGenerateListOfButtons(diceModification.DiceModificationTiming); });
    }
    public void UseDiceModification(string diceModificationName)
    {
        Tooltips.EndTooltip();

        if (AvailableDiceModifications.ContainsKey(diceModificationName))
        {
            GenericAction diceModification = AvailableDiceModifications[diceModificationName];

            Selection.ActiveShip.AddAlreadyUsedDiceModification(diceModification);

            diceModification.ActionEffect(
                delegate {
                Combat.CurrentDiceRoll.MarkAsModifiedBy(diceModification.HostShip.Owner.PlayerNo);
                Combat.DiceModifications.RefreshButtonsList();
                ReplaysManager.ExecuteWithDelay(Combat.DiceModifications.AskPlayerToContinue);
            }
                );
        }
        else if (diceModificationName == "OK")
        {
            HideAllButtons();
            ReplaysManager.ExecuteWithDelay(ConfirmDiceResults);
        }
        else
        {
            Messages.ShowError("ERROR: Dice Modification is not found: " + diceModificationName);
        }
    }
Exemplo n.º 3
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);
            });
        });
    }