Beispiel #1
0
        public void AddPlayer(PlayerTradable player)
        {
            var validators
                = new List <IValidator> {
                TradeOfferValidatorFactory.OfferCannotHavePlayer(this, player),
                ClubValidatorFactory.ClubMustHavePlayer(this.Club, player)
                };

            if (!ValidationHelper.ValidateProcess(validators))
            {
                return;
            }

            this.Players.Add(player);
        }
Beispiel #2
0
        public void ExchangePlayer(TradeOffer offer1, TradeOffer offer2)
        {
            var validators
                = new List <IValidator> {
                TradeOfferValidatorFactory.OffersMinPlayer(offer1, offer2, this.MinPlayerTrade),
                TradeOfferValidatorFactory.OffersMaxPlayer(offer1, offer2, this.MaxPlayerTrade),
                TradeOfferValidatorFactory.OffersCannotContainsMoney(offer1, offer2)
                };

            if (!ValidationHelper.ValidateProcess(validators))
            {
                return;
            }

            this.ProcessTrade(offer1, offer2);
        }
Beispiel #3
0
        public void Trade(TradeOffer offer1, TradeOffer offer2)
        {
            var validators
                = new List <IValidator> {
                TradeOfferValidatorFactory.OffersContainsAtLeastPlayer(offer1, offer2),
                TradeOfferValidatorFactory.OffersContainAtLeastMoney(offer1, offer2),
                TransferMarketValidatorFactory.RangePriceTrade(offer1, offer2, this.TradePercent)
                };

            if (!ValidationHelper.ValidateProcess(validators))
            {
                return;
            }

            this.ProcessTrade(offer1, offer2);
        }