mirror of
https://github.com/yairm210/Unciv.git
synced 2025-07-27 08:09:21 +07:00
Unit pixel images are now opt-in
This commit is contained in:
@ -19,6 +19,7 @@ class GameSettings {
|
|||||||
var autoAssignCityProduction: Boolean = true
|
var autoAssignCityProduction: Boolean = true
|
||||||
var autoBuildingRoads: Boolean = true
|
var autoBuildingRoads: Boolean = true
|
||||||
var showMinimap: Boolean = true
|
var showMinimap: Boolean = true
|
||||||
|
var showPixelUnits: Boolean = false
|
||||||
|
|
||||||
var userName:String=""
|
var userName:String=""
|
||||||
var userId = ""
|
var userId = ""
|
||||||
|
@ -30,36 +30,37 @@ open class TileGroup(var tileInfo: TileInfo, var tileSetStrings:TileSetStrings)
|
|||||||
Circle, Crosshair, Fog layer
|
Circle, Crosshair, Fog layer
|
||||||
City name
|
City name
|
||||||
*/
|
*/
|
||||||
val baseLayerGroup = Group().apply { isTransform=false; setSize(groupSize,groupSize) }
|
val baseLayerGroup = Group().apply { isTransform = false; setSize(groupSize, groupSize) }
|
||||||
protected var tileBaseImage :Image= ImageGetter.getImage(tileSetStrings.hexagon)
|
protected var tileBaseImage: Image = ImageGetter.getImage(tileSetStrings.hexagon)
|
||||||
var currentTileBaseImageLocation = ""
|
var currentTileBaseImageLocation = ""
|
||||||
protected var baseTerrainOverlayImage: Image? = null
|
protected var baseTerrainOverlayImage: Image? = null
|
||||||
protected var baseTerrain:String=""
|
protected var baseTerrain: String = ""
|
||||||
|
|
||||||
val terrainFeatureLayerGroup = Group().apply { isTransform=false; setSize(groupSize,groupSize) }
|
val terrainFeatureLayerGroup = Group().apply { isTransform = false; setSize(groupSize, groupSize) }
|
||||||
protected var terrainFeatureOverlayImage: Image? = null
|
protected var terrainFeatureOverlayImage: Image? = null
|
||||||
protected var terrainFeature:String?=null
|
protected var terrainFeature: String? = null
|
||||||
protected var cityImage: Image? = null
|
protected var cityImage: Image? = null
|
||||||
|
|
||||||
protected var pixelMilitaryUnitImageLocation=""
|
protected var pixelMilitaryUnitImageLocation = ""
|
||||||
protected var pixelMilitaryUnitImage: Image? = null
|
protected var pixelMilitaryUnitImage: Image? = null
|
||||||
|
protected var pixelCivilianUnitImageLocation = ""
|
||||||
protected var pixelCivilianUnitImage: Image? = null
|
protected var pixelCivilianUnitImage: Image? = null
|
||||||
|
|
||||||
val miscLayerGroup = Group().apply { isTransform=false; setSize(groupSize,groupSize) }
|
val miscLayerGroup = Group().apply { isTransform = false; setSize(groupSize, groupSize) }
|
||||||
var resourceImage: Actor? = null
|
var resourceImage: Actor? = null
|
||||||
var resource:String?=null
|
var resource: String? = null
|
||||||
var improvementImage: Actor? = null
|
var improvementImage: Actor? = null
|
||||||
var populationImage: Image? = null //reuse for acquire icon
|
var populationImage: Image? = null //reuse for acquire icon
|
||||||
private val roadImages = HashMap<TileInfo, RoadImage>()
|
private val roadImages = HashMap<TileInfo, RoadImage>()
|
||||||
private val borderImages = HashMap<TileInfo, List<Image>>() // map of neighboring tile to border images
|
private val borderImages = HashMap<TileInfo, List<Image>>() // map of neighboring tile to border images
|
||||||
|
|
||||||
val unitLayerGroup = Group().apply { isTransform=false; setSize(groupSize,groupSize);touchable=Touchable.disabled }
|
val unitLayerGroup = Group().apply { isTransform = false; setSize(groupSize, groupSize);touchable = Touchable.disabled }
|
||||||
protected var civilianUnitImage: UnitGroup? = null
|
protected var civilianUnitImage: UnitGroup? = null
|
||||||
protected var militaryUnitImage: UnitGroup? = null
|
protected var militaryUnitImage: UnitGroup? = null
|
||||||
|
|
||||||
val cityButtonLayerGroup = Group().apply { isTransform=true; setSize(groupSize,groupSize);touchable=Touchable.childrenOnly }
|
val cityButtonLayerGroup = Group().apply { isTransform = true; setSize(groupSize, groupSize);touchable = Touchable.childrenOnly }
|
||||||
|
|
||||||
val circleCrosshairFogLayerGroup = Group().apply { isTransform=false; setSize(groupSize,groupSize) }
|
val circleCrosshairFogLayerGroup = Group().apply { isTransform = false; setSize(groupSize, groupSize) }
|
||||||
private val circleImage = ImageGetter.getCircle() // for blue and red circles on the tile
|
private val circleImage = ImageGetter.getCircle() // for blue and red circles on the tile
|
||||||
private val crosshairImage = ImageGetter.getImage("OtherIcons/Crosshair") // for when a unit is targete
|
private val crosshairImage = ImageGetter.getImage("OtherIcons/Crosshair") // for when a unit is targete
|
||||||
protected val fogImage = ImageGetter.getImage(tileSetStrings.crosshatchHexagon)
|
protected val fogImage = ImageGetter.getImage(tileSetStrings.crosshatchHexagon)
|
||||||
@ -87,7 +88,7 @@ open class TileGroup(var tileInfo: TileInfo, var tileSetStrings:TileSetStrings)
|
|||||||
addCircleImage()
|
addCircleImage()
|
||||||
addFogImage(groupSize)
|
addFogImage(groupSize)
|
||||||
addCrosshairImage()
|
addCrosshairImage()
|
||||||
isTransform=false // performance helper - nothing here is rotated or scaled
|
isTransform = false // performance helper - nothing here is rotated or scaled
|
||||||
}
|
}
|
||||||
|
|
||||||
//region init functions
|
//region init functions
|
||||||
@ -123,38 +124,38 @@ open class TileGroup(var tileInfo: TileInfo, var tileSetStrings:TileSetStrings)
|
|||||||
}
|
}
|
||||||
|
|
||||||
fun getTileBaseImageLocation(isRevealed: Boolean): String {
|
fun getTileBaseImageLocation(isRevealed: Boolean): String {
|
||||||
if(!isRevealed) return tileSetStrings.hexagon
|
if (!isRevealed) return tileSetStrings.hexagon
|
||||||
if(tileInfo.isCityCenter()){
|
if (tileInfo.isCityCenter()) {
|
||||||
val terrainAndCity = tileSetStrings.getCityTile(tileInfo.baseTerrain)
|
val terrainAndCity = tileSetStrings.getCityTile(tileInfo.baseTerrain)
|
||||||
if(ImageGetter.imageExists(terrainAndCity))
|
if (ImageGetter.imageExists(terrainAndCity))
|
||||||
return terrainAndCity
|
return terrainAndCity
|
||||||
if(ImageGetter.imageExists(tileSetStrings.cityTile))
|
if (ImageGetter.imageExists(tileSetStrings.cityTile))
|
||||||
return tileSetStrings.cityTile
|
return tileSetStrings.cityTile
|
||||||
}
|
}
|
||||||
val baseTerrainTileLocation = tileSetStrings.getBaseTerrainTile(tileInfo.baseTerrain)
|
val baseTerrainTileLocation = tileSetStrings.getBaseTerrainTile(tileInfo.baseTerrain)
|
||||||
if(tileInfo.terrainFeature!=null){
|
if (tileInfo.terrainFeature != null) {
|
||||||
val baseTerrainAndFeatureTileLocation = "$baseTerrainTileLocation+${tileInfo.terrainFeature}"
|
val baseTerrainAndFeatureTileLocation = "$baseTerrainTileLocation+${tileInfo.terrainFeature}"
|
||||||
if(ImageGetter.imageExists(baseTerrainAndFeatureTileLocation))
|
if (ImageGetter.imageExists(baseTerrainAndFeatureTileLocation))
|
||||||
return baseTerrainAndFeatureTileLocation
|
return baseTerrainAndFeatureTileLocation
|
||||||
}
|
}
|
||||||
|
|
||||||
if(ImageGetter.imageExists(baseTerrainTileLocation)) return baseTerrainTileLocation
|
if (ImageGetter.imageExists(baseTerrainTileLocation)) return baseTerrainTileLocation
|
||||||
return tileSetStrings.hexagon
|
return tileSetStrings.hexagon
|
||||||
}
|
}
|
||||||
|
|
||||||
// Used for both the underlying tile and unit overlays, perhaps for other things in the future
|
// Used for both the underlying tile and unit overlays, perhaps for other things in the future
|
||||||
// Parent should already be set when calling
|
// Parent should already be set when calling
|
||||||
fun setHexagonImageSize(hexagonImage:Image){
|
fun setHexagonImageSize(hexagonImage: Image) {
|
||||||
val imageScale = groupSize * 1.5f / hexagonImage.width
|
val imageScale = groupSize * 1.5f / hexagonImage.width
|
||||||
// Using "scale" can get really confusing when positioning, how about no
|
// Using "scale" can get really confusing when positioning, how about no
|
||||||
hexagonImage.setSize(hexagonImage.width*imageScale, hexagonImage.height*imageScale)
|
hexagonImage.setSize(hexagonImage.width * imageScale, hexagonImage.height * imageScale)
|
||||||
hexagonImage.centerX(hexagonImage.parent)
|
hexagonImage.centerX(hexagonImage.parent)
|
||||||
hexagonImage.y = -groupSize/6
|
hexagonImage.y = -groupSize / 6
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun updateTileImage(isRevealed: Boolean) {
|
private fun updateTileImage(isRevealed: Boolean) {
|
||||||
val tileBaseImageLocation = getTileBaseImageLocation(isRevealed)
|
val tileBaseImageLocation = getTileBaseImageLocation(isRevealed)
|
||||||
if(tileBaseImageLocation==currentTileBaseImageLocation) return
|
if (tileBaseImageLocation == currentTileBaseImageLocation) return
|
||||||
|
|
||||||
tileBaseImage.remove()
|
tileBaseImage.remove()
|
||||||
tileBaseImage = ImageGetter.getImage(tileBaseImageLocation)
|
tileBaseImage = ImageGetter.getImage(tileBaseImageLocation)
|
||||||
@ -165,7 +166,7 @@ open class TileGroup(var tileInfo: TileInfo, var tileSetStrings:TileSetStrings)
|
|||||||
tileBaseImage.toBack()
|
tileBaseImage.toBack()
|
||||||
}
|
}
|
||||||
|
|
||||||
fun addAcquirableIcon(){
|
fun addAcquirableIcon() {
|
||||||
populationImage = ImageGetter.getStatIcon("Acquire")
|
populationImage = ImageGetter.getStatIcon("Acquire")
|
||||||
populationImage!!.run {
|
populationImage!!.run {
|
||||||
color = Color.GREEN.cpy().lerp(Color.BLACK, 0.5f)
|
color = Color.GREEN.cpy().lerp(Color.BLACK, 0.5f)
|
||||||
@ -177,8 +178,7 @@ open class TileGroup(var tileInfo: TileInfo, var tileSetStrings:TileSetStrings)
|
|||||||
}
|
}
|
||||||
|
|
||||||
fun addPopulationIcon() {
|
fun addPopulationIcon() {
|
||||||
this.
|
this.populationImage = ImageGetter.getStatIcon("Population")
|
||||||
populationImage = ImageGetter.getStatIcon("Population")
|
|
||||||
populationImage!!.run {
|
populationImage!!.run {
|
||||||
color = Color.GREEN.cpy().lerp(Color.BLACK, 0.5f)
|
color = Color.GREEN.cpy().lerp(Color.BLACK, 0.5f)
|
||||||
setSize(20f, 20f)
|
setSize(20f, 20f)
|
||||||
@ -202,16 +202,16 @@ open class TileGroup(var tileInfo: TileInfo, var tileSetStrings:TileSetStrings)
|
|||||||
fun isViewable(viewingCiv: CivilizationInfo) = showEntireMap
|
fun isViewable(viewingCiv: CivilizationInfo) = showEntireMap
|
||||||
|| viewingCiv.viewableTiles.contains(tileInfo)
|
|| viewingCiv.viewableTiles.contains(tileInfo)
|
||||||
|
|
||||||
open fun update(viewingCiv:CivilizationInfo?=null, showResourcesAndImprovements: Boolean=true) {
|
open fun update(viewingCiv: CivilizationInfo? = null, showResourcesAndImprovements: Boolean = true) {
|
||||||
hideCircle()
|
hideCircle()
|
||||||
if (viewingCiv!=null && !showEntireMap
|
if (viewingCiv != null && !showEntireMap
|
||||||
&& !viewingCiv.exploredTiles.contains(tileInfo.position)) {
|
&& !viewingCiv.exploredTiles.contains(tileInfo.position)) {
|
||||||
tileBaseImage.color = Color.DARK_GRAY
|
tileBaseImage.color = Color.DARK_GRAY
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
val tileIsViewable = viewingCiv==null || isViewable(viewingCiv)
|
val tileIsViewable = viewingCiv == null || isViewable(viewingCiv)
|
||||||
val showMilitaryUnit = viewingCiv==null || showMilitaryUnit(viewingCiv)
|
val showMilitaryUnit = viewingCiv == null || showMilitaryUnit(viewingCiv)
|
||||||
|
|
||||||
updateTileImage(true)
|
updateTileImage(true)
|
||||||
updateTerrainBaseImage()
|
updateTerrainBaseImage()
|
||||||
@ -241,9 +241,9 @@ open class TileGroup(var tileInfo: TileInfo, var tileSetStrings:TileSetStrings)
|
|||||||
if (tileInfo.baseTerrain == baseTerrain) return
|
if (tileInfo.baseTerrain == baseTerrain) return
|
||||||
baseTerrain = tileInfo.baseTerrain
|
baseTerrain = tileInfo.baseTerrain
|
||||||
|
|
||||||
if(baseTerrainOverlayImage!=null){
|
if (baseTerrainOverlayImage != null) {
|
||||||
baseTerrainOverlayImage!!.remove()
|
baseTerrainOverlayImage!!.remove()
|
||||||
baseTerrainOverlayImage=null
|
baseTerrainOverlayImage = null
|
||||||
}
|
}
|
||||||
|
|
||||||
val imagePath = tileSetStrings.getBaseTerrainOverlay(baseTerrain)
|
val imagePath = tileSetStrings.getBaseTerrainOverlay(baseTerrain)
|
||||||
@ -260,7 +260,7 @@ open class TileGroup(var tileInfo: TileInfo, var tileSetStrings:TileSetStrings)
|
|||||||
private fun updateCityImage() {
|
private fun updateCityImage() {
|
||||||
if (cityImage == null && tileInfo.isCityCenter()) {
|
if (cityImage == null && tileInfo.isCityCenter()) {
|
||||||
val cityOverlayLocation = tileSetStrings.cityOverlay
|
val cityOverlayLocation = tileSetStrings.cityOverlay
|
||||||
if(!ImageGetter.imageExists(cityOverlayLocation)) // have a city tile, don't need an overlay
|
if (!ImageGetter.imageExists(cityOverlayLocation)) // have a city tile, don't need an overlay
|
||||||
return
|
return
|
||||||
|
|
||||||
cityImage = ImageGetter.getImage(cityOverlayLocation)
|
cityImage = ImageGetter.getImage(cityOverlayLocation)
|
||||||
@ -334,7 +334,7 @@ open class TileGroup(var tileInfo: TileInfo, var tileSetStrings:TileSetStrings)
|
|||||||
}
|
}
|
||||||
|
|
||||||
private fun updateRoadImages() {
|
private fun updateRoadImages() {
|
||||||
if(forMapEditorIcon) return
|
if (forMapEditorIcon) return
|
||||||
for (neighbor in tileInfo.neighbors) {
|
for (neighbor in tileInfo.neighbors) {
|
||||||
if (!roadImages.containsKey(neighbor)) roadImages[neighbor] = RoadImage()
|
if (!roadImages.containsKey(neighbor)) roadImages[neighbor] = RoadImage()
|
||||||
val roadImage = roadImages[neighbor]!!
|
val roadImage = roadImages[neighbor]!!
|
||||||
@ -388,12 +388,12 @@ open class TileGroup(var tileInfo: TileInfo, var tileSetStrings:TileSetStrings)
|
|||||||
private fun updateTerrainFeatureImage() {
|
private fun updateTerrainFeatureImage() {
|
||||||
if (tileInfo.terrainFeature != terrainFeature) {
|
if (tileInfo.terrainFeature != terrainFeature) {
|
||||||
terrainFeature = tileInfo.terrainFeature
|
terrainFeature = tileInfo.terrainFeature
|
||||||
if(terrainFeatureOverlayImage!=null) terrainFeatureOverlayImage!!.remove()
|
if (terrainFeatureOverlayImage != null) terrainFeatureOverlayImage!!.remove()
|
||||||
terrainFeatureOverlayImage = null
|
terrainFeatureOverlayImage = null
|
||||||
|
|
||||||
if(terrainFeature!=null) {
|
if (terrainFeature != null) {
|
||||||
val terrainFeatureOverlayLocation = tileSetStrings.getTerrainFeatureOverlay(terrainFeature!!)
|
val terrainFeatureOverlayLocation = tileSetStrings.getTerrainFeatureOverlay(terrainFeature!!)
|
||||||
if(!ImageGetter.imageExists(terrainFeatureOverlayLocation)) return
|
if (!ImageGetter.imageExists(terrainFeatureOverlayLocation)) return
|
||||||
terrainFeatureOverlayImage = ImageGetter.getImage(terrainFeatureOverlayLocation)
|
terrainFeatureOverlayImage = ImageGetter.getImage(terrainFeatureOverlayLocation)
|
||||||
terrainFeatureLayerGroup.addActor(terrainFeatureOverlayImage)
|
terrainFeatureLayerGroup.addActor(terrainFeatureOverlayImage)
|
||||||
terrainFeatureOverlayImage!!.run {
|
terrainFeatureOverlayImage!!.run {
|
||||||
@ -409,54 +409,58 @@ open class TileGroup(var tileInfo: TileInfo, var tileSetStrings:TileSetStrings)
|
|||||||
var newImageLocation = ""
|
var newImageLocation = ""
|
||||||
|
|
||||||
if (tileInfo.militaryUnit != null && showMilitaryUnit) {
|
if (tileInfo.militaryUnit != null && showMilitaryUnit) {
|
||||||
val unitType = tileInfo.militaryUnit!!.type
|
val unitType = tileInfo.militaryUnit!!.type
|
||||||
val specificUnitIconLocation = tileSetStrings.unitsLocation+tileInfo.militaryUnit!!.name
|
val specificUnitIconLocation = tileSetStrings.unitsLocation + tileInfo.militaryUnit!!.name
|
||||||
if(ImageGetter.imageExists(specificUnitIconLocation))
|
newImageLocation = when {
|
||||||
newImageLocation = specificUnitIconLocation
|
!UnCivGame.Current.settings.showPixelUnits -> ""
|
||||||
else if(unitType == UnitType.Mounted) newImageLocation = tileSetStrings.unitsLocation+"Horseman"
|
ImageGetter.imageExists(specificUnitIconLocation) -> specificUnitIconLocation
|
||||||
else if(unitType == UnitType.Ranged) newImageLocation = tileSetStrings.unitsLocation+"Archer"
|
unitType == UnitType.Mounted -> tileSetStrings.unitsLocation + "Horseman"
|
||||||
else if(unitType == UnitType.Armor) newImageLocation = tileSetStrings.unitsLocation+"Tank"
|
unitType == UnitType.Ranged -> tileSetStrings.unitsLocation + "Archer"
|
||||||
else if(unitType == UnitType.Siege) newImageLocation = tileSetStrings.unitsLocation+"Catapult"
|
unitType == UnitType.Armor -> tileSetStrings.unitsLocation + "Tank"
|
||||||
else if (unitType.isLandUnit() && ImageGetter.imageExists(tileSetStrings.landUnit))
|
unitType == UnitType.Siege -> tileSetStrings.unitsLocation + "Catapult"
|
||||||
newImageLocation = tileSetStrings.landUnit
|
unitType.isLandUnit() && ImageGetter.imageExists(tileSetStrings.landUnit) -> tileSetStrings.landUnit
|
||||||
else if (unitType.isWaterUnit() && ImageGetter.imageExists(tileSetStrings.waterUnit))
|
unitType.isWaterUnit() && ImageGetter.imageExists(tileSetStrings.waterUnit) -> tileSetStrings.waterUnit
|
||||||
newImageLocation = tileSetStrings.waterUnit
|
else -> ""
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if(pixelMilitaryUnitImageLocation != newImageLocation){
|
if (pixelMilitaryUnitImageLocation != newImageLocation) {
|
||||||
pixelMilitaryUnitImage?.remove()
|
pixelMilitaryUnitImage?.remove()
|
||||||
pixelMilitaryUnitImage = null
|
pixelMilitaryUnitImage = null
|
||||||
pixelMilitaryUnitImageLocation = newImageLocation
|
pixelMilitaryUnitImageLocation = newImageLocation
|
||||||
|
|
||||||
if(newImageLocation!=""){
|
if (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.
|
||||||
pixelMilitaryUnitImage=pixelUnitImage
|
pixelMilitaryUnitImage = pixelUnitImage
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
fun updatePixelCivilianUnit(tileIsViewable: Boolean) {
|
||||||
|
var newImageLocation = ""
|
||||||
|
|
||||||
|
if (tileInfo.civilianUnit != null && tileIsViewable) {
|
||||||
|
val specificUnitIconLocation = tileSetStrings.unitsLocation + tileInfo.civilianUnit!!.name
|
||||||
|
newImageLocation = when {
|
||||||
|
!UnCivGame.Current.settings.showPixelUnits -> ""
|
||||||
|
ImageGetter.imageExists(specificUnitIconLocation) -> specificUnitIconLocation
|
||||||
|
else -> ""
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
if (pixelCivilianUnitImageLocation != newImageLocation) {
|
||||||
|
pixelCivilianUnitImage?.remove()
|
||||||
|
pixelCivilianUnitImage = null
|
||||||
|
pixelCivilianUnitImageLocation = newImageLocation
|
||||||
|
|
||||||
fun updatePixelCivilianUnit(tileIsViewable: Boolean) {
|
if (newImageLocation != "") {
|
||||||
if (tileInfo.civilianUnit==null || !tileIsViewable) {
|
val pixelUnitImage = ImageGetter.getImage(newImageLocation)
|
||||||
if (pixelCivilianUnitImage != null) {
|
terrainFeatureLayerGroup.addActor(pixelUnitImage)
|
||||||
pixelCivilianUnitImage!!.remove()
|
setHexagonImageSize(pixelUnitImage)// Treat this as A TILE, which gets overlayed on the base tile.
|
||||||
pixelCivilianUnitImage = null
|
pixelCivilianUnitImage = pixelUnitImage
|
||||||
}
|
|
||||||
} else {
|
|
||||||
if (pixelCivilianUnitImage == null) {
|
|
||||||
var imageLocation = ""
|
|
||||||
val specificUnitIconLocation = tileSetStrings.unitsLocation+tileInfo.civilianUnit!!.name
|
|
||||||
if(ImageGetter.imageExists(specificUnitIconLocation))
|
|
||||||
imageLocation = specificUnitIconLocation
|
|
||||||
|
|
||||||
if (imageLocation != "") {
|
|
||||||
val pixelUnitImage = ImageGetter.getImage(imageLocation)
|
|
||||||
terrainFeatureLayerGroup.addActor(pixelUnitImage)
|
|
||||||
setHexagonImageSize(pixelUnitImage)// Treat this as A TILE, which gets overlayed on the base tile.
|
|
||||||
pixelCivilianUnitImage=pixelUnitImage
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -483,10 +487,10 @@ open class TileGroup(var tileInfo: TileInfo, var tileSetStrings:TileSetStrings)
|
|||||||
}
|
}
|
||||||
|
|
||||||
private fun updateResourceImage(showResourcesAndImprovements: Boolean) {
|
private fun updateResourceImage(showResourcesAndImprovements: Boolean) {
|
||||||
if(resource!=tileInfo.resource){
|
if (resource != tileInfo.resource) {
|
||||||
resource=tileInfo.resource
|
resource = tileInfo.resource
|
||||||
if (resourceImage != null) resourceImage!!.remove()
|
if (resourceImage != null) resourceImage!!.remove()
|
||||||
if (resource==null) resourceImage=null
|
if (resource == null) resourceImage = null
|
||||||
else {
|
else {
|
||||||
resourceImage = ImageGetter.getResourceImage(tileInfo.resource!!, 20f)
|
resourceImage = ImageGetter.getResourceImage(tileInfo.resource!!, 20f)
|
||||||
resourceImage!!.center(this)
|
resourceImage!!.center(this)
|
||||||
@ -498,7 +502,7 @@ open class TileGroup(var tileInfo: TileInfo, var tileSetStrings:TileSetStrings)
|
|||||||
|
|
||||||
if (resourceImage != null) { // This could happen on any turn, since resources need certain techs to reveal them
|
if (resourceImage != null) { // This could happen on any turn, since resources need certain techs to reveal them
|
||||||
val shouldDisplayResource =
|
val shouldDisplayResource =
|
||||||
if(showEntireMap) tileInfo.resource!=null
|
if (showEntireMap) tileInfo.resource != null
|
||||||
else showResourcesAndImprovements
|
else showResourcesAndImprovements
|
||||||
&& tileInfo.hasViewableResource(UnCivGame.Current.worldScreen.viewingCiv)
|
&& tileInfo.hasViewableResource(UnCivGame.Current.worldScreen.viewingCiv)
|
||||||
resourceImage!!.isVisible = shouldDisplayResource
|
resourceImage!!.isVisible = shouldDisplayResource
|
||||||
@ -513,9 +517,9 @@ open class TileGroup(var tileInfo: TileInfo, var tileSetStrings:TileSetStrings)
|
|||||||
|
|
||||||
if (unit != null && isViewable) { // Tile is visible
|
if (unit != null && isViewable) { // Tile is visible
|
||||||
newImage = UnitGroup(unit, 25f)
|
newImage = UnitGroup(unit, 25f)
|
||||||
if(oldUnitGroup?.blackSpinningCircle != null){
|
if (oldUnitGroup?.blackSpinningCircle != null) {
|
||||||
newImage.blackSpinningCircle = ImageGetter.getCircle()
|
newImage.blackSpinningCircle = ImageGetter.getCircle()
|
||||||
.apply { rotation= oldUnitGroup.blackSpinningCircle!!.rotation}
|
.apply { rotation = oldUnitGroup.blackSpinningCircle!!.rotation }
|
||||||
}
|
}
|
||||||
unitLayerGroup.addActor(newImage)
|
unitLayerGroup.addActor(newImage)
|
||||||
newImage.center(this)
|
newImage.center(this)
|
||||||
@ -532,7 +536,7 @@ open class TileGroup(var tileInfo: TileInfo, var tileSetStrings:TileSetStrings)
|
|||||||
|
|
||||||
fun showCircle(color: Color, alpha: Float = 0.3f) {
|
fun showCircle(color: Color, alpha: Float = 0.3f) {
|
||||||
circleImage.isVisible = true
|
circleImage.isVisible = true
|
||||||
circleImage.color = color.cpy().apply { a=alpha }
|
circleImage.color = color.cpy().apply { a = alpha }
|
||||||
}
|
}
|
||||||
|
|
||||||
fun hideCircle() {
|
fun hideCircle() {
|
||||||
|
@ -201,8 +201,9 @@ object ImageGetter {
|
|||||||
fun getProgressBarVertical(width:Float,height:Float,percentComplete:Float,progressColor:Color,backgroundColor:Color): Table {
|
fun getProgressBarVertical(width:Float,height:Float,percentComplete:Float,progressColor:Color,backgroundColor:Color): Table {
|
||||||
val advancementGroup = Table()
|
val advancementGroup = Table()
|
||||||
val completionHeight = height * percentComplete
|
val completionHeight = height * percentComplete
|
||||||
advancementGroup.add(getImage(whiteDotLocation).apply { color = backgroundColor }).width(width).height(height-completionHeight).row()
|
advancementGroup.add(getImage(whiteDotLocation).apply { color = backgroundColor })
|
||||||
advancementGroup.add(getImage(whiteDotLocation).apply { color= progressColor}).width(width).height(completionHeight)
|
.size(width, height - completionHeight).row()
|
||||||
|
advancementGroup.add(getImage(whiteDotLocation).apply { color = progressColor }).size(width, completionHeight)
|
||||||
advancementGroup.pack()
|
advancementGroup.pack()
|
||||||
return advancementGroup
|
return advancementGroup
|
||||||
}
|
}
|
||||||
@ -217,14 +218,14 @@ object ImageGetter {
|
|||||||
healthPercent > 1 / 3f -> Color.ORANGE
|
healthPercent > 1 / 3f -> Color.ORANGE
|
||||||
else -> Color.RED
|
else -> Color.RED
|
||||||
}
|
}
|
||||||
healthBar.add(healthPartOfBar).width(healthBarSize * healthPercent).height(5f)
|
healthBar.add(healthPartOfBar).size(healthBarSize * healthPercent, 5f)
|
||||||
|
|
||||||
val emptyPartOfBar = getDot(Color.BLACK)
|
val emptyPartOfBar = getDot(Color.BLACK)
|
||||||
healthBar.add(emptyPartOfBar).width(healthBarSize * (1 - healthPercent)).height(5f)
|
healthBar.add(emptyPartOfBar).size(healthBarSize * (1 - healthPercent), 5f)
|
||||||
|
|
||||||
healthBar.pad(1f)
|
healthBar.pad(1f)
|
||||||
healthBar.pack()
|
healthBar.pack()
|
||||||
healthBar.background= getBackground(Color.BLACK)
|
healthBar.background = getBackground(Color.BLACK)
|
||||||
return healthBar
|
return healthBar
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -45,7 +45,7 @@ class WorldScreenOptionsTable(val worldScreen:WorldScreen) : PopupTable(worldScr
|
|||||||
clear()
|
clear()
|
||||||
|
|
||||||
val innerTable = PopupTable(screen) // cheating, to get the old code to fit inside a Scroll =)
|
val innerTable = PopupTable(screen) // cheating, to get the old code to fit inside a Scroll =)
|
||||||
innerTable.background=null
|
innerTable.background = null
|
||||||
innerTable.add("Worked tiles".toLabel())
|
innerTable.add("Worked tiles".toLabel())
|
||||||
if (settings.showWorkedTiles) innerTable.addButton("Hide") { settings.showWorkedTiles = false; update() }
|
if (settings.showWorkedTiles) innerTable.addButton("Hide") { settings.showWorkedTiles = false; update() }
|
||||||
else innerTable.addButton("Show") { settings.showWorkedTiles = true; update() }
|
else innerTable.addButton("Show") { settings.showWorkedTiles = true; update() }
|
||||||
@ -56,39 +56,45 @@ class WorldScreenOptionsTable(val worldScreen:WorldScreen) : PopupTable(worldScr
|
|||||||
else innerTable.addButton("Show") { settings.showResourcesAndImprovements = true; update() }
|
else innerTable.addButton("Show") { settings.showResourcesAndImprovements = true; update() }
|
||||||
|
|
||||||
innerTable.add("Check for idle units".toLabel())
|
innerTable.add("Check for idle units".toLabel())
|
||||||
innerTable.addButton(if(settings.checkForDueUnits) "Yes".tr() else "No".tr()) {
|
innerTable.addButton(if (settings.checkForDueUnits) "Yes".tr() else "No".tr()) {
|
||||||
settings.checkForDueUnits = !settings.checkForDueUnits
|
settings.checkForDueUnits = !settings.checkForDueUnits
|
||||||
update()
|
update()
|
||||||
}
|
}
|
||||||
|
|
||||||
innerTable.add("Move units with a single tap".toLabel())
|
innerTable.add("Move units with a single tap".toLabel())
|
||||||
innerTable.addButton(if(settings.singleTapMove) "Yes".tr() else "No".tr()) {
|
innerTable.addButton(if (settings.singleTapMove) "Yes".tr() else "No".tr()) {
|
||||||
settings.singleTapMove = !settings.singleTapMove
|
settings.singleTapMove = !settings.singleTapMove
|
||||||
update()
|
update()
|
||||||
}
|
}
|
||||||
|
|
||||||
innerTable.add("Show tutorials".toLabel())
|
innerTable.add("Show tutorials".toLabel())
|
||||||
innerTable.addButton(if(settings.showTutorials) "Yes".tr() else "No".tr()) {
|
innerTable.addButton(if (settings.showTutorials) "Yes".tr() else "No".tr()) {
|
||||||
settings.showTutorials= !settings.showTutorials
|
settings.showTutorials = !settings.showTutorials
|
||||||
update()
|
update()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
innerTable.add("Auto-assign city production".toLabel())
|
innerTable.add("Auto-assign city production".toLabel())
|
||||||
innerTable.addButton(if(settings.autoAssignCityProduction) "Yes".tr() else "No".tr()) {
|
innerTable.addButton(if (settings.autoAssignCityProduction) "Yes".tr() else "No".tr()) {
|
||||||
settings.autoAssignCityProduction= !settings.autoAssignCityProduction
|
settings.autoAssignCityProduction = !settings.autoAssignCityProduction
|
||||||
update()
|
update()
|
||||||
}
|
}
|
||||||
|
|
||||||
innerTable.add("Auto-build roads".toLabel())
|
innerTable.add("Auto-build roads".toLabel())
|
||||||
innerTable.addButton(if(settings.autoBuildingRoads) "Yes".tr() else "No".tr()) {
|
innerTable.addButton(if (settings.autoBuildingRoads) "Yes".tr() else "No".tr()) {
|
||||||
settings.autoBuildingRoads= !settings.autoBuildingRoads
|
settings.autoBuildingRoads = !settings.autoBuildingRoads
|
||||||
update()
|
update()
|
||||||
}
|
}
|
||||||
|
|
||||||
innerTable.add("Show minimap".toLabel())
|
innerTable.add("Show minimap".toLabel())
|
||||||
innerTable.addButton(if(settings.showMinimap) "Yes".tr() else "No".tr()) {
|
innerTable.addButton(if (settings.showMinimap) "Yes".tr() else "No".tr()) {
|
||||||
settings.showMinimap= !settings.showMinimap
|
settings.showMinimap = !settings.showMinimap
|
||||||
|
update()
|
||||||
|
}
|
||||||
|
|
||||||
|
innerTable.add("Show pixel units".toLabel())
|
||||||
|
innerTable.addButton(if (settings.showPixelUnits) "Yes".tr() else "No".tr()) {
|
||||||
|
settings.showPixelUnits = !settings.showPixelUnits
|
||||||
update()
|
update()
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -109,17 +115,17 @@ class WorldScreenOptionsTable(val worldScreen:WorldScreen) : PopupTable(worldScr
|
|||||||
|
|
||||||
addUsernameAndId(innerTable)
|
addUsernameAndId(innerTable)
|
||||||
|
|
||||||
val scrollPane = ScrollPane(innerTable,skin)
|
val scrollPane = ScrollPane(innerTable, skin)
|
||||||
scrollPane.setOverscroll(false,false)
|
scrollPane.setOverscroll(false, false)
|
||||||
scrollPane.fadeScrollBars=false
|
scrollPane.fadeScrollBars = false
|
||||||
scrollPane.setScrollingDisabled(true,false)
|
scrollPane.setScrollingDisabled(true, false)
|
||||||
add(scrollPane).maxHeight(screen.stage.height*0.6f).row()
|
add(scrollPane).maxHeight(screen.stage.height * 0.6f).row()
|
||||||
|
|
||||||
addCloseButton()
|
addCloseButton()
|
||||||
|
|
||||||
pack() // Needed to show the background.
|
pack() // Needed to show the background.
|
||||||
center(UnCivGame.Current.worldScreen.stage)
|
center(UnCivGame.Current.worldScreen.stage)
|
||||||
UnCivGame.Current.worldScreen.shouldUpdate=true
|
UnCivGame.Current.worldScreen.shouldUpdate = true
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun addUsernameAndId(innerTable: PopupTable) {
|
private fun addUsernameAndId(innerTable: PopupTable) {
|
||||||
|
Reference in New Issue
Block a user