@Override public int getFile() { return getFile(); } }
@Override public int length() { return sequence.getLength(); }
public TabButton(AbstractContentProvider content, int file, int image, int activeImage, String description) { this(content, new OriginalImageLink(EImageLinkType.GUI, file, image, 0), new OriginalImageLink(EImageLinkType.GUI, file, activeImage, 0), description); }
/** * Converts a given name to an image link. * <p> * Names can either be direct names of the png files or they can have the for "original_<file>_<type>_<sequence * * @param name * The name. * @param imageIndex * The index in the sequence. * @return The image link for that image, no matter if it exists or not. */ public static ImageLink fromName(String name, int imageIndex) { Matcher matcher = ORIGINAL_LINK.matcher(name); if (matcher.matches()) { EImageLinkType type = EImageLinkType.valueOf(matcher.group(ORIGINAL_LINK_TYPE)); int file = Integer.parseInt(matcher.group(ORIGINAL_LINK_FILE)); int sequence = Integer.parseInt(matcher.group(ORIGINAL_LINK_SEQUENCE)); return new OriginalImageLink(type, file, sequence, imageIndex); } else { return new DirectImageLink(name + "." + imageIndex); } }
private static OriginalImageLink getOriginalImageLink(Attributes attributes) { int file = Integer.parseInt(attributes.getValue("file")); int sequence = Integer.parseInt(attributes.getValue("sequence")); String imageStr = attributes.getValue("image"); int image = imageStr != null ? Integer.parseInt(imageStr) : 0; EImageLinkType type = EImageLinkType.valueOf(attributes.getValue("type")); return new OriginalImageLink(type, file, sequence, image); }
/** * Gets the n-th image in this sequence, starting by 0. If the parameter is bigger than the length of the sequence or less than 0, the result is * undefined. * * @param index * The relative index in this sequence. * @return The image link to that image. */ public ImageLink getImageLink(int index) { if (index >= length || index < 0) { throw new IllegalArgumentException(); } return ImageLink.fromName(name, first + index); } }
@Override public Image getImage(int index, Supplier<String> name) { return imageProvider.getImage(sequence.getImageLink(index)); }
@Override public int getSequence() { return getSequence(); }
@Override public EImageLinkType getType() { return getType(); }
@Override public String getName() { return String.format(Locale.ENGLISH, "original_%d_%s_%d", file, type.toString(), sequence); }
DotColor(int imageIndex) { image = new OriginalImageLink(EImageLinkType.SETTLER, 4, 6, imageIndex); }
private void drawGotoMarker() { long timeDifference = System.currentTimeMillis() - scrollMarkerTime; if (timeDifference > GOTO_MARK_TIME) { scrollMarker = null; } else { ImageLink image = GOTO_ANIMATION.getImageLink(timeDifference < GOTO_MARK_TIME / 2 ? 0 : 1); objectDrawer.drawGotoMarker(scrollMarker, ImageProvider.getInstance().getImage(image)); } }
EMaterialType(short stackIndex, int guiFile, int guiBase, boolean droppable, int defaultPrioIdx, boolean distributionConfigurable) { this.stackIndex = stackIndex; this.defaultPrioIdx = defaultPrioIdx; this.distributionConfigurable = distributionConfigurable; this.ordinal = (byte) super.ordinal(); this.droppable = droppable; imageLink = new OriginalImageLink(EImageLinkType.GUI, guiFile, guiBase, 0); }
private void addThieves(float bottom) { OriginalImageLink imageLink = new OriginalImageLink(EImageLinkType.GUI, 14, 183, 0); drawButtongroup(bottom, imageLink, EMovableType.THIEF); }
private void addGeologists(float bottom) { OriginalImageLink imageLink = new OriginalImageLink(EImageLinkType.GUI, 14, 186, 0); drawButtongroup(bottom, imageLink, EMovableType.GEOLOGIST); }
public void setSelected(boolean selected) { this.selected.setBackground(selected ? new OriginalImageLink(EImageLinkType.GUI, 3, 339) : null); } }
private void addPioneers(float bottom) { OriginalImageLink imageLink = new OriginalImageLink(EImageLinkType.GUI, 14, 204, 0); drawButtongroup(bottom, imageLink, EMovableType.PIONEER); }
private void drawShipLink(int imageFile, int sequence, EDirection direction, GLDrawContext gl, float viewX, float viewY, Color color, float shade) { ImageLink shipLink = new OriginalImageLink(EImageLinkType.SETTLER, imageFile, sequence, direction.ordinal); Image image = imageProvider.getImage(shipLink); image.drawAt(gl, viewX, viewY, 0, color, shade); }
private void drawDonkey(int x, int y, IMapObject object, float color) { int i = (getAnimationStep(x, y) / 20) % 6; Image image = imageProvider.getImage(new OriginalImageLink(EImageLinkType.SETTLER, 6, 17, 72 + i)); draw(image, x, y, 0, getColor(object), color); }