@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); } } }
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 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); }
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); } }
@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); } }