Example #1
0
 public void AddPlayer( Game game, string userId )
 {
     if ( !game.Players.Contains( userId ) )
     {
         game.Players.Add( userId );
         this.repository.Save<Game>( game );
     }
 }
Example #2
0
        public Game CreateGameWithScenario( User creator, string scenario, string name )
        {
            var game = new Game( name, creator.Id );
            game.Scenario = scenario;

            this.AddPlayer( game, creator.Id );

            return game;
        }
Example #3
0
        public void RemovePlayer( Game game, string userId )
        {
            if ( game.Players.Contains( userId ) )
            {
                game.Players.Remove( userId );
            }

            this.repository.Save<Game>( game );
        }
Example #4
0
        public void AddGame( Game game )
        {
            this.repository.Save<Game>( game );

            this.games.TryAdd( game.Id, game );
        }