mirror of
https://github.com/yairm210/Unciv.git
synced 2025-09-27 22:06:05 -04:00
Added river rendering, river effects not implemented yet
This commit is contained in:
parent
e71bc978b9
commit
397d9ccec3
@ -35,6 +35,10 @@ open class TileInfo {
|
|||||||
var roadStatus = RoadStatus.None
|
var roadStatus = RoadStatus.None
|
||||||
var turnsToImprovement: Int = 0
|
var turnsToImprovement: Int = 0
|
||||||
|
|
||||||
|
var hasBottomRightRiver = false
|
||||||
|
var hasBottomRiver = false
|
||||||
|
var hasBottomLeftRiver = false
|
||||||
|
|
||||||
fun clone(): TileInfo {
|
fun clone(): TileInfo {
|
||||||
val toReturn = TileInfo()
|
val toReturn = TileInfo()
|
||||||
if(militaryUnit!=null) toReturn.militaryUnit=militaryUnit!!.clone()
|
if(militaryUnit!=null) toReturn.militaryUnit=militaryUnit!!.clone()
|
||||||
|
@ -31,6 +31,10 @@ class TileEditorOptionsTable(val mapEditorScreen: MapEditorScreen): Table(Camera
|
|||||||
var clearImprovement=false
|
var clearImprovement=false
|
||||||
var selectedImprovement:TileImprovement?=null
|
var selectedImprovement:TileImprovement?=null
|
||||||
|
|
||||||
|
var toggleBottomRightRiver=false
|
||||||
|
var toggleBottomRiver=false
|
||||||
|
var toggleBottomLeftRiver=false
|
||||||
|
|
||||||
val editorPickTable = Table()
|
val editorPickTable = Table()
|
||||||
|
|
||||||
private var currentHex: Actor = Group()
|
private var currentHex: Actor = Group()
|
||||||
|
@ -182,6 +182,7 @@ open class TileGroup(var tileInfo: TileInfo, var tileSetStrings:TileSetStrings)
|
|||||||
val showMilitaryUnit = viewingCiv == null || showMilitaryUnit(viewingCiv)
|
val showMilitaryUnit = viewingCiv == null || showMilitaryUnit(viewingCiv)
|
||||||
|
|
||||||
updateTileImage(true)
|
updateTileImage(true)
|
||||||
|
updateRivers(tileInfo.hasBottomRightRiver, tileInfo.hasBottomRiver, tileInfo.hasBottomLeftRiver)
|
||||||
updateTerrainBaseImage()
|
updateTerrainBaseImage()
|
||||||
updateTerrainFeatureImage()
|
updateTerrainFeatureImage()
|
||||||
|
|
||||||
@ -398,7 +399,7 @@ open class TileGroup(var tileInfo: TileInfo, var tileSetStrings:TileSetStrings)
|
|||||||
pixelMilitaryUnitImage = null
|
pixelMilitaryUnitImage = null
|
||||||
pixelMilitaryUnitImageLocation = newImageLocation
|
pixelMilitaryUnitImageLocation = newImageLocation
|
||||||
|
|
||||||
if (newImageLocation != "") {
|
if (newImageLocation != "" && ImageGetter.imageExists(newImageLocation)) {
|
||||||
val pixelUnitImage = ImageGetter.getImage(newImageLocation)
|
val pixelUnitImage = ImageGetter.getImage(newImageLocation)
|
||||||
terrainFeatureLayerGroup.addActor(pixelUnitImage)
|
terrainFeatureLayerGroup.addActor(pixelUnitImage)
|
||||||
setHexagonImageSize(pixelUnitImage)// Treat this as A TILE, which gets overlayed on the base tile.
|
setHexagonImageSize(pixelUnitImage)// Treat this as A TILE, which gets overlayed on the base tile.
|
||||||
@ -425,7 +426,7 @@ open class TileGroup(var tileInfo: TileInfo, var tileSetStrings:TileSetStrings)
|
|||||||
pixelCivilianUnitImage = null
|
pixelCivilianUnitImage = null
|
||||||
pixelCivilianUnitImageLocation = newImageLocation
|
pixelCivilianUnitImageLocation = newImageLocation
|
||||||
|
|
||||||
if (newImageLocation != "") {
|
if (newImageLocation != "" && ImageGetter.imageExists(newImageLocation)) {
|
||||||
val pixelUnitImage = ImageGetter.getImage(newImageLocation)
|
val pixelUnitImage = ImageGetter.getImage(newImageLocation)
|
||||||
terrainFeatureLayerGroup.addActor(pixelUnitImage)
|
terrainFeatureLayerGroup.addActor(pixelUnitImage)
|
||||||
setHexagonImageSize(pixelUnitImage)// Treat this as A TILE, which gets overlayed on the base tile.
|
setHexagonImageSize(pixelUnitImage)// Treat this as A TILE, which gets overlayed on the base tile.
|
||||||
@ -435,6 +436,30 @@ open class TileGroup(var tileInfo: TileInfo, var tileSetStrings:TileSetStrings)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
var bottomRightRiverImage :Image?=null
|
||||||
|
var bottomRiverImage :Image?=null
|
||||||
|
var bottomLeftRiverImage :Image?=null
|
||||||
|
|
||||||
|
fun updateRivers(displayBottomRight:Boolean,displayBottom:Boolean,displayBottomLeft:Boolean){
|
||||||
|
bottomRightRiverImage = updateRiver(bottomRightRiverImage,displayBottomRight,tileSetStrings.bottomRightRiver)
|
||||||
|
bottomRiverImage = updateRiver(bottomRiverImage, displayBottom, tileSetStrings.bottomRiver)
|
||||||
|
bottomLeftRiverImage = updateRiver(bottomLeftRiverImage,displayBottomLeft,tileSetStrings.bottomLeftRiver)
|
||||||
|
}
|
||||||
|
|
||||||
|
fun updateRiver(currentImage:Image?, shouldDisplay:Boolean,imageName:String): Image? {
|
||||||
|
if(!shouldDisplay){
|
||||||
|
currentImage?.remove()
|
||||||
|
return null
|
||||||
|
}
|
||||||
|
else{
|
||||||
|
if(currentImage!=null) return currentImage
|
||||||
|
if(!ImageGetter.imageExists(imageName)) return null // Old "Default" tileset gets no rivers.
|
||||||
|
val newImage = ImageGetter.getImage(imageName)
|
||||||
|
baseLayerGroup.addActor(newImage)
|
||||||
|
setHexagonImageSize(newImage)
|
||||||
|
return newImage
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
fun showCircle(color: Color, alpha: Float = 0.3f) {
|
fun showCircle(color: Color, alpha: Float = 0.3f) {
|
||||||
circleImage.isVisible = true
|
circleImage.isVisible = true
|
||||||
@ -444,4 +469,4 @@ open class TileGroup(var tileInfo: TileInfo, var tileSetStrings:TileSetStrings)
|
|||||||
fun hideCircle() {
|
fun hideCircle() {
|
||||||
circleImage.isVisible = false
|
circleImage.isVisible = false
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -14,6 +14,9 @@ class TileSetStrings {
|
|||||||
|
|
||||||
val tilesLocation = tileSetLocation+"Tiles/"
|
val tilesLocation = tileSetLocation+"Tiles/"
|
||||||
val cityTile = tilesLocation+"City"
|
val cityTile = tilesLocation+"City"
|
||||||
|
val bottomRightRiver = tilesLocation+"River-BottomRight"
|
||||||
|
val bottomRiver = tilesLocation+"River-Bottom"
|
||||||
|
val bottomLeftRiver = tilesLocation+"River-BottomLeft"
|
||||||
|
|
||||||
val unitsLocation = tileSetLocation+"Units/"
|
val unitsLocation = tileSetLocation+"Units/"
|
||||||
val landUnit = unitsLocation+"LandUnit"
|
val landUnit = unitsLocation+"LandUnit"
|
||||||
|
Loading…
x
Reference in New Issue
Block a user