Exemple #1
0
    /// <summary>
    ///
    /// Button click event for adding the upgrades in the to add list to the deck being edited
    ///
    /// </summary>
    public void AddSelectedUpgrades()
    {
        var deckData = GameManager.instance.deckManager.AddUpgradesToPlayerDeck(selectedDeck.Id.Value, upgradesToAdd);

        if (deckListUI != null)
        {
            //Refreshes the active deck in the list with the deck information
            deckListUI.RefreshActiveDeckDetails(deckData);
        }
        if (campaignManagerUI != null)
        {
            campaignManagerUI.RefreshPlayerDetails();

            var numToReserveMultiplier = 2;
            var numToReserve           = upgradesToAdd.Where(x => x.UpgradeTag == UpgradeTags.ReserveForces).Count() * numToReserveMultiplier;

            campaignManagerUI.RefreshPlayerDetails();

            if (numToReserve > 0)
            {
                campaignManagerUI.OpenReserveForces(numToReserve);
            }
        }

        //Empties the upgrade to add list
        RefreshUpgradeList(upgradesToAddArea);
        RefreshAvailableUpgrades();
        upgradesToAdd = new List <UpgradeData>();

        upgradeCostTracker = new Dictionary <UpgradeData, int>();
        RefreshHonourPoints();
    }
Exemple #2
0
    /// <summary>
    ///
    /// Button click event for adding the selected cards to deck
    ///
    /// </summary>
    public void AddCardsToDeck()
    {
        if (deckListUI != null)
        {
            var updatedDeck = GameManager.instance.deckManager.AddCardsToPlayerDeck(deckListUI.DeckEditId.Value, cardsSelected);

            deckListUI.RefreshActiveDeckDetails(updatedDeck);
            RefreshLootGenerator();
        }
        else if (campaignManagerUI != null)
        {
            GameManager.instance.deckManager.AddCardsToPlayerDeck(campaignManagerUI.loadedDeck.Id.Value, cardsSelected);

            campaignManagerUI.AddLootCards();
            gameObject.SetActive(false);
        }
    }
Exemple #3
0
    /// <summary>
    ///
    /// Function handler for click events
    ///
    /// </summary>
    public void OnPointerClick(PointerEventData eventData)
    {
        //Right clicking on a card always shows the card detail display
        if (eventData.button == PointerEventData.InputButton.Right)
        {
            cardDisplay.DisplayCardDetail();
        }

        //Left clicking functionality varies depending on which part of the library you are in
        if (eventData.button == PointerEventData.InputButton.Left && (deckListUI != null && deckListUI.DeckEditMode || campaignManagerUI != null))
        {
            //If the loot generator UI is null, this means the card is in the library display, and as such, the card just needs to be added to the deck
            if (lootGeneratorUI == null)
            {
                var updatedDeck = GameManager.instance.deckManager.AddCardToPlayerDeck(deckListUI.DeckEditId.Value, cardDisplay.card.CardData);
                deckListUI.RefreshActiveDeckDetails(updatedDeck);
            }
            //If there is a loot generator, this means the card is being selected on the loot generator panel
            else
            {
                //Variance depending on if the card is selected already or not
                if (!isSelected)
                {
                    //Cannot select more than the maximum number of cards in the loot generator
                    if (!lootGeneratorUI.FullCardsSelected)
                    {
                        lootGeneratorUI.SelectLootCard(cardDisplay.card.CardData);
                        isSelected = true;
                        cardSelectionBorder.SetActive(true);
                    }
                }
                else
                {
                    lootGeneratorUI.RemoveLootCard(cardDisplay.card.CardData);
                    isSelected = false;
                    cardSelectionBorder.SetActive(false);
                }
            }
        }
    }
    /// <summary>
    ///
    /// Handler for clicking on the object
    ///
    /// </summary>
    public void OnPointerClick(PointerEventData eventData)
    {
        //Right click always shows the card detail display
        if (eventData.button == PointerEventData.InputButton.Right)
        {
            GameManager.instance.uiManager.ActivateCardDetail(cardData);
        }

        if (eventData.button == PointerEventData.InputButton.Left)
        {
            //Left click removes the card from the player deck
            if (deckListUI != null && deckListUI.DeckEditMode)
            {
                var updatedDeck = GameManager.instance.deckManager.RemoveCardFromPlayerDeck(deckId.Value, cardData);
                deckListUI.RefreshActiveDeckDetails(updatedDeck);
            }

            if (reserveForcesUI != null)
            {
                reserveForcesUI.SwitchCardState(cardData, isReserved);
            }
        }
    }