/// <summary> /// Save list of currencies for user /// </summary> public void SaveCurrencies() { List <CurrencyData> currencyList = Currencies .Select(kvp => new CurrencyData { UserId = player.Details.Id, SeasonalType = kvp.Key, Balance = kvp.Value }) .ToList(); CurrencyDao.SaveCurrencies(currencyList); }
public CurrencyController(CurrencyDao currencyDao) { this.currencyDao = currencyDao; }
/// <summary> /// Refresh user credits from db but also override them /// </summary> public void ModifyCredits(int creditsChanged) { player.Details.Credits = CurrencyDao.SaveCredits(player.Details.Id, creditsChanged); }
/// <summary> /// Add the balance for this seasonal currency (will also accept negatives) /// </summary> public void AddBalance(SeasonalCurrencyType currencyType, int newBalance) { Currencies[currencyType] = CurrencyDao.GetCurrency(player.Details.Id, currencyType).Balance + newBalance; }
public void Load() { this.Currencies = CurrencyDao.GetCurrencies(player.Details.Id).ToDictionary(x => x.SeasonalType, x => x.Balance < 0 ? 0 : x.Balance); }
public void Setup() { _tested = new CurrencyDao(); }
public WalletLogic(IWalletDao walletDao, CurrencyDao currencyDao) { _walletDao = walletDao; _currencyDao = currencyDao; }