Пример #1
0
        /// @param item
        ///     The item to multiply
        /// @param quantity
        ///     The quantity to multiply by
        ///
        /// @return The multiplied currency
        ///
        public static CurrencyItem Multiply(this CurrencyItem item, int quantity)
        {
            var currency = item.Clone();

            if (currency != null)
            {
                currency.m_value *= quantity;
            }
            return(currency);
        }
Пример #2
0
        /// @param item
        ///     The item to clone
        ///
        /// @return The cloned currency
        ///
        public static CurrencyItem Clone(this CurrencyItem item)
        {
            var currency = new CurrencyItem();

            if (item != null)
            {
                currency.m_currencyID = item.m_currencyID;
                currency.m_value      = item.m_value;
            }
            return(currency);
        }
Пример #3
0
        /// @param list
        ///     The list to append to
        /// @param item
        ///     The item to append
        ///
        public static void Append(this List <CurrencyItem> list, CurrencyItem newItem)
        {
            if (list == null)
            {
                list = new List <CurrencyItem>();
            }

            foreach (var item in list)
            {
                if (item.m_currencyID == newItem.m_currencyID)
                {
                    item.m_value += newItem.m_value;
                    return;
                }
            }

            list.Add(new CurrencyItem(newItem));
        }
Пример #4
0
 /// @param item
 ///     The currency item to withdraw
 ///
 public void Withdraw(CurrencyItem item)
 {
     Withdraw(item.m_currencyID, item.m_value);
 }
Пример #5
0
 /// @param currency
 ///     The currency to set as pending
 ///
 public void SetPending(CurrencyItem currency)
 {
     SetPending(currency.m_currencyID, currency.m_value);
 }
Пример #6
0
 /// Adds a delayed currency. Pending currencies need to be added after a deposit / withdraw.
 /// Remember to Flush the pending currencies when needed.
 ///
 /// @param currency
 ///     The currency to add as pending
 ///
 public void AddPending(CurrencyItem currency)
 {
     AddPending(currency.m_currencyID, currency.m_value);
 }
Пример #7
0
 /// @param currency
 ///     The currency to deposit
 ///
 public void Deposit(CurrencyItem currency)
 {
     Deposit(currency.m_currencyID, currency.m_value);
 }
Пример #8
0
 /// @param currencyItem
 ///     The currency Item we are checking
 ///
 /// @return Whether the user can afford the currency
 ///
 public bool CanAfford(CurrencyItem currencyItem)
 {
     return(CanAfford(currencyItem.m_currencyID, currencyItem.m_value));
 }
Пример #9
0
 /// @param currencyItem
 ///     the currency item to copy
 ///
 public CurrencyItem(CurrencyItem currencyItem)
 {
     m_currencyID = currencyItem.m_currencyID;
     m_value      = currencyItem.m_value;
 }