Пример #1
0
        public Game(string startWord, PlayerBase startPlayer)
            : this()
        {
            Contract.Requires(string.IsNullOrEmpty(startWord));

              this.Id = Guid.NewGuid();
              this.GameGrid = new Collection<Cell>();
              this.PlayerLogs = new Collection<PlayerLog>();
              this.Players = new ObservableCollection<PlayerBase>();
              this.Players.CollectionChanged += this.Players_CollectionChanged;
              this.StartTime = DateTime.Now;
              this.StartWord = startWord.ToUpper(System.Globalization.CultureInfo.InvariantCulture);
              this.Players.Add(startPlayer);
              this.StartPlayer = startPlayer;
              this.CurrentPlayer = this.StartPlayer;
              this.InitGameGrid();
        }
Пример #2
0
 public Game StartNewGame(int wordLength, PlayerBase player)
 {
     var game = new Game(this.GetStartWord(wordLength), player);
       this.Games.Add(game);
       return game;
 }
Пример #3
0
        public void AddWord(PlayerBase player, GridWord word)
        {
            Contract.Requires(player == this.CurrentPlayer);

              var log = this.PlayerLogs.Single(l => l.Player == player);
              log.GridWords.Add(word);
              this.MoveToNextPlayer();
        }
Пример #4
0
 public PlayerLog(PlayerBase player)
     : this()
 {
     this.Player = player;
       this.GridWords = new Collection<GridWord>();
 }