Example #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;

        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();
        });
    }
Example #2
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);
    }
Example #3
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);
    }