示例#1
0
 public Guess(IGuessInfo guessInfo, IChainDTO chain)
 {
     this.Contributor = guessInfo.Contributor;
     this.Content = guessInfo.Content;
     this.Type = guessInfo.Type;
     this.Chain = chain;
 }
示例#2
0
 public void AddGuess(IGuessInfo guessInfo)
 {
     if (HasPlayerContributedGuess(guessInfo.Contributor))
     {
         string message = String.Format(
             "{0} has already contributed a guess to the chain", Maybe.From(guessInfo.Contributor).
                                                                                     Select(c => c.Name).Value);
         throw new ChainLockedException(message);
     }
     if (guessInfo.Contributor.Id != this.LockedBy.Id)
     {
         throw new ChainLockedException(GetLockedMessage());
     }
     this.Guesses.Add(this.GuessFactory.MakeGuess(guessInfo));
     if (Guesses.Count == MaximumLength)
     {
         this.OnMaximumChainLengthReached();
     }
 }
示例#3
0
 public void AddGuess(IGuessInfo guess)
 {
     PlayerPendingActions[guess.Contributor].Execute(guess);
 }
 public void Execute(IGuessInfo guess)
 {
     this.InPlayChain.AddGuess(guess);
     this.Release(guess.Contributor);
 }
示例#5
0
 public InPlayChain(IGuessInfo guessInfo)
 {
     this.GuessFactory = new GuessFactory(this);
     this.Guesses = new List<IGuessDTO> { this.GuessFactory.MakeGuess(guessInfo) };
 }
示例#6
0
 public void CreateNew(IGuessInfo guess)
 {
     var chain = new InPlayChain(guess);
     chain.MaximumChainLengthReached += chain_MaximumChainLengthReached;
     this.Chains.Add(chain);
 }
示例#7
0
 public IGuessDTO MakeGuess(IGuessInfo guessInfo)
 {
     return new Guess(guessInfo, this.chain);
 }
 public void Execute(IGuessInfo guess)
 {
     this.ChainList.CreateNew(guess);
     this.Release(guess.Contributor);
 }