private void drawButtongroup(float bottom, OriginalImageLink imageLink, EMovableType type) { UIPanel icon = new UIPanel(); icon.setBackground(imageLink); LabeledButton convert1 = new LabeledButton(Labels.getString("convert_1_to_" + type), new ConvertAction(type, (short) 1)); LabeledButton convertall = new LabeledButton(Labels.getString("convert_all_to_" + type), new ConvertAction(type, Short.MAX_VALUE)); panel.addChild(icon, .1f, bottom, .3f, bottom + .2f); panel.addChild(convert1, .3f, bottom + .1f, .9f, bottom + .2f); panel.addChild(convertall, .3f, bottom, .9f, bottom + .1f); }
private void sendConvertAction(ConvertAction action) { final List<ISelectable> convertables = new LinkedList<>(); switch (action.getTargetType()) { case BEARER: for (final ISelectable curr : currentSelection) { if (currType == EMovableType.PIONEER) { convertables.add(curr); if (convertables.size() >= action.getAmount()) { break; if (currType == EMovableType.BEARER) { convertables.add(curr); if (convertables.size() >= action.getAmount()) { break; System.out.println("WARNING: can't handle convert to this movable type: " + action.getTargetType()); return; taskScheduler.scheduleTask(new ConvertGuiTask(playerId, getIDsOfIterable(convertables), action.getTargetType()));
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); } }