@Override public Action getAction(float relativeX, float relativeY) { int step = (int) (relativeX * NUMBER_OF_BUTTONS) - 1; if (step >= 0) { return getActionForStep(step); } else { return new Action(EActionType.ASK_SET_DOCK); } } }
@Override public void eventDataChanged(GOEvent event) { Action action = getActionForDraw((GODrawEvent) event); if (action != null && action.getActionType() == EActionType.PAN_TO) { minimap.getContext().scrollTo( ((PointAction) action).getPosition()); } }
@Override public Action getActionFor(UIPoint position, boolean selecting) { float relativex = (float) position.getX() / this.uiBase.getPosition().getWidth(); float relativey = (float) position.getY() / this.uiBase.getPosition().getHeight(); Action action; if (minimap != null && relativey > layoutProperties.MAIN_PANEL_TOP && getMinimapOffset(position.getY()) < position.getX()) { action = getForMinimap(relativex, relativey, selecting); startMapPosition = null; // to prevent it from jumping back. } else { action = uiBase.getAction(relativex, relativey); } if (action != null && action.getActionType() == EActionType.CHANGE_PANEL) { mainPanel.setContent(((ChangePanelAction) action).getContent()); return null; } else { return action; } }
public SelectPointMessage(String message) { super(message, null, null, Labels.getString("abort"), new Action(EActionType.ABORT)); }
public SimpleActionButton(EActionType actionType, ImageLink image, ImageLink active) { super(new Action(actionType), image, active, Labels.getName(actionType)); }
System.out.println(keyCode); if ("F12".equalsIgnoreCase(keyCode)) { return new Action(EActionType.FAST_FORWARD); } else if ("P".equalsIgnoreCase(keyCode) || "PAUSE".equalsIgnoreCase(keyCode)) { return new Action(EActionType.SPEED_TOGGLE_PAUSE); } else if ("BACK".equalsIgnoreCase(keyCode)) { return new Action(EActionType.BACK); } else if ("+".equals(keyCode) || "]".equals(keyCode)) { return new Action(EActionType.SPEED_FASTER); } else if ("-".equals(keyCode) || "/".equals(keyCode)) { return new Action(EActionType.SPEED_SLOWER); } else if (" ".equals(keyCode) || "space".equalsIgnoreCase(keyCode)) { return new Action(EActionType.SHOW_MESSAGE); } else if ("d".equalsIgnoreCase(keyCode)) { return new Action(EActionType.DEBUG_ACTION); } else if ("s".equalsIgnoreCase(keyCode)) { return new Action(EActionType.STOP_WORKING); } else if ("e".equalsIgnoreCase(keyCode)) { return new Action(EActionType.TOGGLE_DEBUG); } else if ("o".equalsIgnoreCase(keyCode)) { return new Action(EActionType.TOGGLE_ORIGINAL_GRAPHICS); } else if ("q".equalsIgnoreCase(keyCode)) { return new Action(EActionType.EXIT); } else if ("w".equalsIgnoreCase(keyCode)) { return new Action(EActionType.TOGGLE_FOG_OF_WAR); } else if ("z".equalsIgnoreCase(keyCode)) { return new Action(EActionType.SHOW_SELECTION);
public SoilderSelectionContent(ISelectionSet selection) { panel = new UIPanel(); addRowsToPanel(panel, selection, soildertypes); UIPanel kill = new LabeledButton(Labels.getString("kill"), new Action(EActionType.DESTROY)); UIPanel stop = new LabeledButton(Labels.getString("stop"), new Action(EActionType.STOP_WORKING)); panel.addChild(kill, .1f, .1f, .5f, .2f); panel.addChild(stop, .5f, .1f, .9f, .2f); }
@Override public IAction catchAction(IAction action) { if (action.getActionType() == EActionType.ABORT) { return new Action(EActionType.DESELECT); } return super.catchAction(action); } }
public ShipSelectionContent(ISelectionSet selection) { panel = new UIPanel(); addRowsToPanel(panel, selection, shiptypes); UIPanel kill = new LabeledButton(Labels.getString("kill"), new Action(EActionType.DESTROY)); UIPanel unload = new LabeledButton(Labels.getString("unload"), new Action(EActionType.UNLOAD_FERRIES)); panel.addChild(kill, .1f, .3f, .9f, .4f); panel.addChild(unload, .1f, .1f, .9f, .2f); }
@Override public void contentHiding(ActionFireable actionFireable, AbstractContentProvider nextContent) { if (!nextContent.isForSelection()) { // TODO: Replace with a deselect-all-action actionFireable.fireAction(new Action(EActionType.DESELECT)); } super.contentHiding(actionFireable, nextContent); }
public SpecialistSelectionContent(ISelectionSet selection) { panel = new UIPanel(); SoilderSelectionContent.addRowsToPanel(panel, selection, specialists); UIPanel stop = new LabeledButton(Labels.getString("stop"), new Action(EActionType.STOP_WORKING)); UIPanel work = new LabeledButton(Labels.getString("work"), new Action( EActionType.START_WORKING)); panel.addChild(stop, .1f, .1f, .5f, .2f); panel.addChild(work, .5f, .1f, .9f, .2f); if (selection.getMovableCount(EMovableType.PIONEER) > 0) { UIPanel convert = new LabeledButton(Labels.getString("convert_all_to_BEARER"), new ConvertAction(EMovableType.BEARER, Short.MAX_VALUE)); panel.addChild(convert, .1f, .2f, .9f, .3f); } }
@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); } }