Пример #1
0
 protected DecisionModel(ISpaceBeansDecision decision, Textures textures)
 {
     this.decision = decision;
     var trader = decision.Trader;
     cardsInHand = CreateCardsFromBeans(trader.BeansInHand, textures, index => LeftMargin + (CardOffsetX * (index + 1)), index => TopMargin);
     cardsInRevealed = CreateCardsFromBeans(trader.RevealedCollection, textures, index => LeftMargin + CardOffsetX, index => TopMargin + (CardOffsetY * (index + 2)));
     cardsInHidden = CreateCardsFromBeans(trader.HiddenCollection, textures, index => LeftMargin + CardOffsetX + CollectionOffsetX, index => TopMargin + (CardOffsetY * (index + 2)));
     deck = new RectangleSprite(new Rectangle(LeftMargin, TopMargin, CardWidth, CardHeight), textures.CardBack);
     revealedCollection = new CollectionSprite(new Rectangle(LeftMargin + CardOffsetX, TopMargin + CardOffsetY, CollectionWidth, CardHeight), textures.White);
     hiddenCollection = new CollectionSprite(new Rectangle(LeftMargin + CardOffsetX + CollectionOffsetX, TopMargin + CardOffsetY, CollectionWidth, CardHeight), textures.Black);
     var passableDecision = decision as PassableDecision;
     if(null != passableDecision && passableDecision.CanPass()) {
         passSprite = new RectangleSprite(new Rectangle(LeftMargin, TopMargin + CardOffsetY, CardWidth, 20), textures.Pass);
         OnSelected(passSprite, s => {
             passableDecision.Pass();
             return true;
         });
     }
     selectableTexture = textures.White;
 }
Пример #2
0
 private IDecisionModel CreateModelForDecision(ISpaceBeansDecision decision)
 {
     if(decision is DrawDecision)
     {
         return new DrawDecisionModel((DrawDecision)decision, textures);
     } else if(decision is SellDecision)
     {
         return new SellDecisionModel((SellDecision)decision, textures);
     } else if(decision is BuyDecision)
     {
         return new BuyDecisionModel((BuyDecision)decision, textures);
     }
     return null;
 }
Пример #3
0
 public override void MakeDecision(ISpaceBeansDecision decision)
 {
     ForEachUntil(GetDecisionMakers(), m => m.MakeDecision(decision));
 }
Пример #4
0
 public override void MakeDecision(ISpaceBeansDecision decision)
 {
     Console.Clear();
     Console.WriteLine("Waiting for {0}...", GetName());
     ((Decision)decision).WaitUntilComplete();
 }