@Override public void onRoundStarted(RoundStartedEvent event) { currentRound = event.getRound(); currentTurn = 0; recordmanager.writeTurn(event.getStartSnapshot(), currentRound, currentTurn); }
public void onRoundStarted(final RoundStartedEvent event) { if (event.getRound() == 0) { getRobotButtonsPanel().removeAll(); final List<IRobotSnapshot> robots = Arrays.asList(event.getStartSnapshot().getRobots()); dialogManager.trim(robots); int maxEnergy = 0; for (IRobotSnapshot robot : robots) { if (maxEnergy < robot.getEnergy()) { maxEnergy = (int) robot.getEnergy(); } } if (maxEnergy == 0) { maxEnergy = 1; } for (int index = 0; index < robots.size(); index++) { final IRobotSnapshot robot = robots.get(index); final boolean attach = index < RobotDialogManager.MAX_PRE_ATTACHED; final RobotButton button = net.sf.robocode.core.Container.createComponent(RobotButton.class); button.setup(robot.getName(), maxEnergy, index, robot.getContestantIndex(), robot.getTeamIndex(), attach); button.setText(robot.getShortName()); addRobotButton(button); } getRobotButtonsPanel().repaint(); } }