public MeeplePositionedImage( Class<? extends Meeple> meepleType, FeaturePointer fp, ImmutablePoint offset, Image sourceImage, boolean bridgePlacement) { super(fp.getPosition(), offset, sourceImage); this.meepleType = meepleType; location = fp.getLocation(); this.bridgePlacement = bridgePlacement; }
// TODO path from Theme public String getExtraDecoration(Class<? extends Meeple> type, FeaturePointer fp) { if (Follower.class.isAssignableFrom(type) && fp.getLocation().isFarmLocation()) { return "farm.png"; } if (fp.getLocation() == Location.TOWER) { if (BigFollower.class.isAssignableFrom(type)) { return "big_tower.png"; } else { return "tower.png"; } } return null; }
private MeeplePositionedImage createMeepleImage( Class<? extends Meeple> type, Color c, FeaturePointer fp) { Feature feature = getGame().getBoard().get(fp); ImmutablePoint offset = getClient() .getResourceManager() .getMeeplePlacement(feature.getTile(), type, fp.getLocation()); Image image = getClient().getFigureTheme().getFigureImage(type, c, getExtraDecoration(type, fp)); if (fp.getLocation() == Location.ABBOT) { image = rotate(image, 90); } return new MeeplePositionedImage(type, fp, offset, image, feature instanceof Bridge); }
private void rearrangeMeeples(FeaturePointer fp) { int order = 0; // small followers first for (MeeplePositionedImage mi : images) { if (mi.location == fp.getLocation() && mi.position.equals(fp.getPosition())) { if (mi.meepleType.equals(SmallFollower.class)) { mi.order = order++; } } } // others on top for (MeeplePositionedImage mi : images) { if (mi.location == fp.getLocation() && mi.position.equals(fp.getPosition())) { if (!mi.meepleType.equals(SmallFollower.class)) { mi.order = order++; } } } }
public boolean match(Class<? extends Meeple> meepleType, FeaturePointer fp) { if (!meepleType.equals(this.meepleType)) return false; if (location != fp.getLocation()) return false; if (!position.equals(fp.getPosition())) return false; return true; }