public GuiInterface(IMapInterfaceConnector connector, IGameClock clock, ITaskScheduler taskScheduler, IGuiInputGrid grid, IGameStoppable gameStoppable, byte playerId, boolean multiplayer) { this.connector = connector; this.clock = clock; this.taskScheduler = taskScheduler; this.grid = grid; this.gameStoppable = gameStoppable; this.playerId = playerId; this.multiplayer = multiplayer; this.constructionMarksCalculator = new ConstructionMarksThread(grid.getConstructionMarksGrid(), clock, playerId); this.refreshSelectionTimer = new Timer("refreshSelectionTimer"); this.refreshSelectionTimer.schedule(new TimerTask() { @Override public void run() { refreshSelection(); } }, 1000, 1000); Player player = grid.getPlayer(playerId); if (player != null) { player.setMessenger(connector); } clock.setTaskExecutor(new GuiTaskExecutor(grid, this, this.playerId)); connector.addListener(this); }
@Override public void run() { try { EBuildingType type = askType(); definition = new BuildingDefinition(type); map = new BuildingtestMap(definition); for (int x = 0; x < map.getWidth(); x++) { for (int y = 0; y < map.getHeight(); y++) { reloadColor(new ShortPoint2D(x, y)); } } IMapInterfaceConnector connector = startMapWindow(); connector.addListener(this); JPanel menu = generateMenu(); window = new JFrame("Edit " + type.toString()); window.setDefaultCloseOperation(JFrame.DO_NOTHING_ON_CLOSE); window.add(menu); window.pack(); window.setVisible(true); connector.fireAction(new Action(EActionType.TOGGLE_DEBUG)); } catch (JSettlersLookAndFeelExecption e) { throw new RuntimeException(e); } }