public GameLobbyInformationDto CreateLobby(string userId, string lobbyName, string password = null) { var pushygame = new PushyGame(userId); var newLobby = new GameLobby <PushyGame>(pushygame, lobbyName, userId, Context.ConnectionId, GameType.PUSHY, 2, password); _gameScope.AddLobby(newLobby); return(newLobby.ToDto(this._userService)); }
public void MoveBox() { var game = new PushyGame("awd"); var gameStr = game.ToString(); Console.WriteLine(gameStr); DoMove(game, PushyMoveDirection.Down); DoMove(game, PushyMoveDirection.Down); DoMove(game, PushyMoveDirection.Right); DoMove(game, PushyMoveDirection.Down); DoMove(game, PushyMoveDirection.Left); DoMove(game, PushyMoveDirection.Left); DoMove(game, PushyMoveDirection.Left); DoMove(game, PushyMoveDirection.Left); DoMove(game, PushyMoveDirection.Left); }
private bool DoMove(PushyGame game, PushyMoveDirection dir) { var fieldCopy = game.Field.Copy(); var figData = fieldCopy.GetFigureData("awd"); var success = fieldCopy.TryMove(figData.Figure, figData.X, figData.Y, (PushyMoveDirection)dir); if (success) { game.Field = fieldCopy; } game.Field.TryMove(figData.Figure, figData.X, figData.Y, (PushyMoveDirection)dir); var gameStr = game.ToString(); Console.WriteLine(gameStr); return(true); }