Esempio n. 1
0
        /// <summary>
        /// Adds the purchase.
        /// </summary>
        /// <param name="category">The category.</param>
        /// <param name="item">The item.</param>
        /// <param name="price">The price.</param>
        public static void RegisterPurchase(BalanceCategory category, string item, Price price)
        {
            var result = new BalanceItem
            {
                Category = category,
                Item     = item,
                IsProfit = false
            };

            switch (price.Resource)
            {
            case Resource.Gold:
                result.Gold = price.Ammount;
                break;

            case Resource.Crystals:
                result.Cristal = price.Ammount;
                break;

            default:
                throw new ArgumentOutOfRangeException();
            }
            AppCore.LogAccountant.Info(string.Format("Произведена покупка {0}", item), result);
            ObjectProvider.Instance.AddBalanceItem(result);
        }
Esempio n. 2
0
 /// <summary>
 /// Registers the balance item.
 /// </summary>
 /// <param name="item">The item.</param>
 public static void RegisterBalanceItem(BalanceItem item)
 {
     if (item.IsProfit)
     {
         AppCore.LogAccountant.Info(string.Format("Доходы {0}", item), item);
     }
     else
     {
         AppCore.LogAccountant.Info(string.Format("Расходы {0}", item), item);
     }
     ObjectProvider.Instance.AddBalanceItem(item);
 }
Esempio n. 3
0
        /// <summary>
        /// Adds the profit.
        /// </summary>
        /// <param name="category">The category.</param>
        /// <param name="item">The item.</param>
        /// <param name="gold">The gold.</param>
        /// <param name="cristals">The cristals.</param>
        public static void RegisterProfit(BalanceCategory category, string item, int gold, int cristals)
        {
            var result = new BalanceItem
            {
                Category = category,
                Item     = item,
                Gold     = gold,
                Cristal  = cristals,
                IsProfit = true
            };

            AppCore.LogAccountant.Info(string.Format("Получена прибыль {0}", item), result);
            ObjectProvider.Instance.AddBalanceItem(result);
        }
Esempio n. 4
0
        /// <summary>
        /// Adds the profit.
        /// </summary>
        /// <param name="category">The category.</param>
        /// <param name="item">The item.</param>
        /// <param name="benefit">The benefit.</param>
        public static void RegisterProfit(BalanceCategory category, string item, CristalBenefit benefit)
        {
            var result = new BalanceItem
            {
                Category    = category,
                Item        = item,
                Gold        = 0,
                Cristal     = benefit.Cristals,
                SmallTicket = benefit.SmallTicket,
                BigTicket   = benefit.BigTicket,
                IsProfit    = true
            };

            AppCore.LogAccountant.Info(string.Format("Получена прибыль {0}", item), result);
            ObjectProvider.Instance.AddBalanceItem(result);
        }