Пример #1
0
        /// <summary>
        /// Format a string from a currencies list Bundle.
        /// </summary>
        /// <param name="currenciesBundle">List of currencies under the Bundle format.</param>
        private string CurrenciesToString(Bundle currenciesBundle)
        {
            // Get currencies as a Dictionary and instantiate a StringBuilder
            Dictionary <string, Bundle> currencies = currenciesBundle.AsDictionary();
            StringBuilder finalString = new StringBuilder();

            bool comma = false;

            // Append each currency to the formated string
            foreach (KeyValuePair <string, Bundle> currency in currencies)
            {
                if (comma)
                {
                    finalString.Append(", ");
                }
                else
                {
                    comma = true;
                }

                finalString.Append(string.Format(currencyFormat, currency.Key, currency.Value.ToString()));
            }

            // Return the final built string
            return(finalString.ToString());
        }
Пример #2
0
 /// <summary>
 /// What to do if any DisplayBalance request succeeded.
 /// </summary>
 /// <param name="currentBalance">List of current logged in gamer's currencies and their amounts under the Bundle format.</param>
 private static void DisplayBalance_OnSuccess(Bundle currentBalance)
 {
     TransactionHandler.Instance.FillTransactionPanel(currentBalance.AsDictionary());
 }