Esempio n. 1
0
        public int GetSelfProduction(Resource.CurrencyProducts currency)
        {
            var amount = 0;

            amount += _production.Storage[currency];
            amount += _tempProduction.Storage[currency];
            amount += _noTradeProduction.Storage[currency];

            return(amount);
        }
Esempio n. 2
0
 public void TradeRequest(PlayerDirection playerDirection, Resource.CurrencyProducts currency)
 {
     if (CurrentSession.LocalPlayerData.CanBuyCurrency(playerDirection, currency))
     {
         // TODO -- request
     }
     else
     {
         // TODO -- error
     }
 }
Esempio n. 3
0
        public void BuyCurrency(PlayerDirection playerDirection, Resource.CurrencyProducts currency)
        {
            var tradeCost = ResourcesBuyCost.GetCost(playerDirection, currency);

            // Trade process
            var trader = GetNeighborByDirection(playerDirection);

            resources.ChangeMoney(-tradeCost);
            trader.resources.EarnTempMoney(tradeCost);
            resources.EarnTempProduction(new Resource.CurrencyItem {
                Currency = currency, Amount = 1
            });

            TradeInfo.Lock(currency);
        }
Esempio n. 4
0
 public bool CanBuyCurrency(PlayerDirection playerDirection, Resource.CurrencyProducts currency)
 // Didnt trade this currency in current move
 // Has enough money
 => !TradeInfo.Check(currency) ||
 Resources.GetMoney() < ResourcesBuyCost.GetCost(playerDirection, currency);
Esempio n. 5
0
 public void Lock(Resource.CurrencyProducts currency) => _info[currency] = false;
Esempio n. 6
0
 public bool Check(Resource.CurrencyProducts currency) => _info[currency];
Esempio n. 7
0
 public void Trade(PlayerData player, PlayerDirection playerDirection, Resource.CurrencyProducts currency)
 {
     player.BuyCurrency(playerDirection, currency);
 }
Esempio n. 8
0
 public void SetCost(PlayerDirection playerDirection, Resource.CurrencyProducts currency, int cost)
 {
     _resources[playerDirection][currency] = cost;
 }
Esempio n. 9
0
 public int GetCost(PlayerDirection playerDirection, Resource.CurrencyProducts currency) =>
 _resources[playerDirection][currency];
Esempio n. 10
0
 public int GetTradeProduction(Resource.CurrencyProducts currency)
 {
     return(_production.Storage[currency]);
 }