public bool AddMove(string matchId, string playerId, string moveValue) { Match match = Matches[matchId]; IPlayer player = match.Player1.Id == playerId ? match.Player1 : match.Player2; Game game; if (CurrentGames.ContainsKey(matchId) && CurrentGames[matchId] != null) { game = CurrentGames[matchId]; } else { game = new Game(match); CurrentGames[matchId] = game; } IMoves move = MovesFactory.CreateMovesFromType(MoveType); move.SetValue(moveValue); if (game.AddMove(player, move)) { match.AddNewGame(game); CurrentGames[matchId] = null; return(true); } return(false); }
public static IMoves CreateMovesFromType(Types.MOVE_TYPES moveType, string value) { IMoves moves = CreateMovesFromType(moveType); moves.SetValue(value); return(moves); }