Improvement building no longer generates notification
Roads that turn to railroads now change color, and railroads are gray to help them stand out against the background Map now contains a 50px padding from the edge
This commit is contained in:
parent
74f1b6837b
commit
08735d8e99
4 changed files with 25 additions and 40 deletions
|
@ -21,7 +21,7 @@ android {
|
|||
applicationId "com.unciv.game"
|
||||
minSdkVersion 9
|
||||
targetSdkVersion 25
|
||||
versionCode 15
|
||||
versionCode 16
|
||||
versionName "0.9"
|
||||
}
|
||||
buildTypes {
|
||||
|
|
|
@ -37,23 +37,6 @@ public class MapUnit{
|
|||
else if(tile.improvementInProgress.equals("Road")) tile.roadStatus = RoadStatus.Road;
|
||||
else if(tile.improvementInProgress.equals("Railroad")) tile.roadStatus = RoadStatus.Railroad;
|
||||
else tile.improvement = tile.improvementInProgress;
|
||||
|
||||
String notification = tile.improvementInProgress+" has been completed";
|
||||
if(tile.workingCity!=null) notification+=" for "+tile.getCity().name;
|
||||
else {
|
||||
for (int i = 1; i < 3; i++) {
|
||||
LinqCollection<TileInfo> tilesWithCity = CivilizationInfo.current().tileMap.getTilesInDistance(tile.position, i).where(new Predicate<TileInfo>() {
|
||||
@Override
|
||||
public boolean evaluate(TileInfo arg0) {
|
||||
return arg0.isCityCenter();
|
||||
}
|
||||
});
|
||||
if(tilesWithCity.isEmpty()) continue;
|
||||
notification+=" near "+tilesWithCity.get(0).workingCity;
|
||||
break;
|
||||
}
|
||||
}
|
||||
CivilizationInfo.current().notifications.add(notification+"!");
|
||||
tile.improvementInProgress = null;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -107,28 +107,29 @@ public class TileGroup extends Group {
|
|||
}
|
||||
|
||||
if(tileInfo.roadStatus != RoadStatus.None){
|
||||
for (TileInfo neighbor : CivilizationInfo.current().tileMap.getTilesInDistance(tileInfo.position,1)) {
|
||||
if (neighbor == tileInfo || neighbor.roadStatus == RoadStatus.None) continue;
|
||||
if (roadImages.containsKey(neighbor.position.toString())) continue;
|
||||
for (TileInfo neighbor : CivilizationInfo.current().tileMap.getTilesAtDistance(tileInfo.position,1)) {
|
||||
if (neighbor.roadStatus == RoadStatus.None) continue;
|
||||
if (!roadImages.containsKey(neighbor.position.toString())) {
|
||||
Image image = ImageGetter.getImage(ImageGetter.WhiteDot);
|
||||
roadImages.put(neighbor.position.toString(), image);
|
||||
|
||||
Vector2 relativeHexPosition = tileInfo.position.cpy().sub(neighbor.position);
|
||||
Vector2 relativeWorldPosition = HexMath.Hex2WorldCoords(relativeHexPosition);
|
||||
|
||||
// This is some crazy voodoo magic so I'll explain.
|
||||
image.moveBy(25, 25); // Move road to center of tile
|
||||
// in addTiles, we set the position of groups by relative world position *0.8*groupSize, where groupSize = 50
|
||||
// Here, we want to have the roads start HALFWAY THERE and extend towards the tiles, so we give them a position of 0.8*25.
|
||||
image.moveBy(-relativeWorldPosition.x * 0.8f * 25, -relativeWorldPosition.y * 0.8f * 25);
|
||||
image.setSize(10, 2);
|
||||
addActor(image);
|
||||
image.setOrigin(0, 1); // This is so that the rotation is calculated from the middle of the road and not the edge
|
||||
image.setRotation((float) (180 / Math.PI * Math.atan2(relativeWorldPosition.y, relativeWorldPosition.x)));
|
||||
}
|
||||
|
||||
Image image = ImageGetter.getImage(ImageGetter.WhiteDot);
|
||||
if(tileInfo.roadStatus == RoadStatus.Railroad && neighbor.roadStatus == RoadStatus.Railroad)
|
||||
image.setColor(Color.BLACK); // railroad
|
||||
else image.setColor(Color.BROWN); // road
|
||||
roadImages.put(neighbor.position.toString(), image);
|
||||
|
||||
Vector2 relativeHexPosition = tileInfo.position.cpy().sub(neighbor.position);
|
||||
Vector2 relativeWorldPosition = HexMath.Hex2WorldCoords(relativeHexPosition);
|
||||
|
||||
// This is some crazy voodoo magic so I'll explain.
|
||||
image.moveBy(25, 25); // Move road to center of tile
|
||||
// in addTiles, we set the position of groups by relative world position *0.8*groupSize, where groupSize = 50
|
||||
// Here, we want to have the roads start HALFWAY THERE and extend towards the tiles, so we give them a position of 0.8*25.
|
||||
image.moveBy(-relativeWorldPosition.x * 0.8f * 25, -relativeWorldPosition.y * 0.8f * 25);
|
||||
image.setSize(10, 2);
|
||||
addActor(image);
|
||||
image.setOrigin(0, 1); // This is so that the rotation is calculated from the middle of the road and not the edge
|
||||
image.setRotation((float) (180 / Math.PI * Math.atan2(relativeWorldPosition.y, relativeWorldPosition.x)));
|
||||
roadImages.get(neighbor.position.toString()).setColor(Color.GRAY); // railroad
|
||||
else roadImages.get(neighbor.position.toString()).setColor(Color.BROWN); // road
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -132,6 +132,7 @@ public class WorldScreen extends CameraStageBaseScreen {
|
|||
for (String notification : game.civInfo.notifications) {
|
||||
Label label = new Label(notification, skin);
|
||||
label.setColor(Color.WHITE);
|
||||
label.setFontScale(0.9f);
|
||||
notificationsTable.add(label).pad(10).fill();
|
||||
notificationsTable.row();
|
||||
}
|
||||
|
@ -346,12 +347,12 @@ public class WorldScreen extends CameraStageBaseScreen {
|
|||
}
|
||||
|
||||
for (TileGroup group : tileGroups.linqValues()) {
|
||||
group.moveBy(-bottomX, -bottomY);
|
||||
group.moveBy(-bottomX+50, -bottomY+50);
|
||||
}
|
||||
|
||||
// allTiles.setPosition(-bottomX,-bottomY); // there are tiles "below the zero",
|
||||
// so we zero out the starting position of the whole board so they will be displayed as well
|
||||
allTiles.setSize(topX - bottomX, topY - bottomY);
|
||||
allTiles.setSize(100 + topX - bottomX, 100 + topY - bottomY);
|
||||
|
||||
|
||||
scrollPane = new ScrollPane(allTiles);
|
||||
|
|
Loading…
Reference in a new issue