This commit is contained in:
@@ -5,15 +5,16 @@ import java.util.List;
|
||||
|
||||
import chess.controller.CommandExecutor;
|
||||
import chess.controller.PlayerCommand;
|
||||
import chess.controller.commands.NewGameCommand;
|
||||
import chess.controller.event.GameAdaptator;
|
||||
import chess.model.Game;
|
||||
import common.Signal0;
|
||||
|
||||
public class PgnSimulator extends GameAdaptator {
|
||||
|
||||
private final CommandExecutor commandExecutor;
|
||||
private final String pgn;
|
||||
|
||||
public final Signal0 onComplete = new Signal0();
|
||||
|
||||
public PgnSimulator(CommandExecutor commandExecutor, String pgn) {
|
||||
this.commandExecutor = commandExecutor;
|
||||
this.pgn = pgn;
|
||||
@@ -23,6 +24,7 @@ public class PgnSimulator extends GameAdaptator {
|
||||
public void onGameStart() {
|
||||
List<PlayerCommand> cmds = PgnImport.importGame(this.pgn);
|
||||
this.commandExecutor.executeCommands(cmds);
|
||||
this.onComplete.emit();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user