mirror of https://github.com/FreeCol/freecol.git
Paints the docks/drydocks/shipyard in the colony panel.
This commit is contained in:
parent
ce92508e43
commit
8e203ac4a1
|
@ -901,12 +901,18 @@ public final class ImageLibrary {
|
|||
}
|
||||
|
||||
public BufferedImage getScaledBuildingImage(Building building) {
|
||||
if (building == null) {
|
||||
return null;
|
||||
}
|
||||
return getScaledBuildingTypeImage(building.getType(),
|
||||
building.getOwner(),
|
||||
this.scaleFactor);
|
||||
}
|
||||
|
||||
public BufferedImage getSmallBuildingImage(Building building) {
|
||||
if (building == null) {
|
||||
return null;
|
||||
}
|
||||
return getScaledBuildingTypeImage(building.getType(),
|
||||
building.getOwner(),
|
||||
this.scaleFactor * SMALL_SCALE);
|
||||
|
@ -947,12 +953,12 @@ public final class ImageLibrary {
|
|||
return this.imageCache.getScaledImage(key, this.scaleFactor, false);
|
||||
}
|
||||
|
||||
public BufferedImage getColonyDocks() {
|
||||
public BufferedImage getColonyDocksBackground() {
|
||||
final String key = "image.colony.docks.background";
|
||||
return this.imageCache.getScaledImage(key, this.scaleFactor, false);
|
||||
}
|
||||
|
||||
public BufferedImage getColonyDocksSky() {
|
||||
public BufferedImage getColonyDocksSkyBackground() {
|
||||
final String key = "image.colony.docks.sky.background";
|
||||
return this.imageCache.getScaledImage(key, this.scaleFactor, false);
|
||||
}
|
||||
|
|
|
@ -519,23 +519,37 @@ public final class ColonyPanel extends PortPanel
|
|||
|
||||
final Dimension size = getSize();
|
||||
|
||||
final BufferedImage colonyDocks = getImageLibrary().getColonyDocks();
|
||||
if (colonyDocks != null) {
|
||||
final BufferedImage colonyDocksBackground = getImageLibrary().getColonyDocksBackground();
|
||||
if (colonyDocksBackground != null) {
|
||||
final int docksBottomLeftX = inPortScroll.getX();
|
||||
final int docksBottomLeftY = inPortScroll.getY() + inPortScroll.getHeight();
|
||||
int y = docksBottomLeftY - colonyDocks.getHeight();
|
||||
g.drawImage(colonyDocks, docksBottomLeftX, y, null);
|
||||
int y = docksBottomLeftY - colonyDocksBackground.getHeight();
|
||||
g.drawImage(colonyDocksBackground, docksBottomLeftX, y, null);
|
||||
|
||||
final BufferedImage colonyDocksSky = getImageLibrary().getColonyDocksSky();
|
||||
if (colonyDocksSky != null) {
|
||||
final BufferedImage colonyDocksSkyBackground = getImageLibrary().getColonyDocksSkyBackground();
|
||||
if (colonyDocksSkyBackground != null) {
|
||||
while (y > 0) {
|
||||
y -= colonyDocksSky.getHeight();
|
||||
g.drawImage(colonyDocksSky, docksBottomLeftX, y, null);
|
||||
y -= colonyDocksSkyBackground.getHeight();
|
||||
g.drawImage(colonyDocksSkyBackground, docksBottomLeftX, y, null);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
final Building docksBuilding = colony.getBuildings()
|
||||
.stream()
|
||||
.filter(b -> b.hasAbility(Ability.PRODUCE_IN_WATER))
|
||||
.sorted(Comparator.comparing(Building::getId)) // Stable sort, but there should only be one value.
|
||||
.findFirst()
|
||||
.orElse(null);
|
||||
final BufferedImage docks = getImageLibrary().getScaledBuildingImage(docksBuilding);
|
||||
if (docks != null) {
|
||||
final int docksBottomLeftX = inPortScroll.getX();
|
||||
final int docksBottomLeftY = inPortScroll.getY() + inPortScroll.getHeight();
|
||||
final int y = docksBottomLeftY - docks.getHeight();
|
||||
g.drawImage(docks, docksBottomLeftX, y, null);
|
||||
}
|
||||
|
||||
final List<Building> defensiveBuildings = colony.getBuildings()
|
||||
.stream()
|
||||
.filter(b -> b.getType().isDefenceType())
|
||||
|
|
Loading…
Reference in New Issue