Esempio n. 1
0
    public void UpdateEffortManaIcons()
    {
        List <Mana.MANATYPE> lstManaAllocatedForEffort = Mana.ManaToListOfTypes(manaToSpendOnEffort);

        int iManaIcon       = manaToPay.GetTotalColouredMana();
        int jEffortPaidWith = 0;
        int nManaToSpend    = manaToSpend.GetTotalMana();
        int nManaToPay      = manaToPay.GetTotalMana();


        //First, add icons for all paid-for effort
        for (; iManaIcon < nManaToSpend; iManaIcon++, jEffortPaidWith++)
        {
            if (iManaIcon == lstgoManaIcons.Count)
            {
                //If we're trying to update an icon we haven't spawned yet, then spawn it instead
                AddManaIcon(Mana.MANATYPE.EFFORT, true, lstManaAllocatedForEffort[jEffortPaidWith]);
            }
            else
            {
                //If we've already spawned an icon for this position, just update that icon
                ReplaceManaIcon(iManaIcon, Mana.MANATYPE.EFFORT, true, lstManaAllocatedForEffort[jEffortPaidWith]);
            }
        }

        //Then, add any icons for unpaid effort
        for (; iManaIcon < nManaToPay; iManaIcon++, jEffortPaidWith++)
        {
            //Note that we'll only ever reach here if nManaToSpend <= iManaIcon < nManaToPay so there must be some amount
            // of the cost that has not been paid.
            ReplaceManaIcon(iManaIcon, Mana.MANATYPE.EFFORT, false);
        }

        //Next, remove any icons that aren't needed
        int nGoManaIcons = lstgoManaIcons.Count;

        for (; iManaIcon < nGoManaIcons; iManaIcon++)
        {
            DestroyManaIcon();
        }

        // Finally, potentially add a special icon for prompting the player to pay more for X if they want to
        SpawnXIconIfNeeded();
    }