Fog is now done using crosshatching - maybe it looks better, hard for me to tell.

This commit is contained in:
Yair Morgenstern 2018-09-23 15:27:38 +03:00
parent 895331e3f2
commit fdd9481535
10 changed files with 285 additions and 268 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 39 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 41 KiB

File diff suppressed because it is too large Load Diff

Binary file not shown.

Before

Width:  |  Height:  |  Size: 642 KiB

After

Width:  |  Height:  |  Size: 767 KiB

View File

@ -21,8 +21,8 @@ android {
applicationId "com.unciv.game" applicationId "com.unciv.game"
minSdkVersion 14 minSdkVersion 14
targetSdkVersion 26 targetSdkVersion 26
versionCode 139 versionCode 140
versionName "2.8.7" versionName "2.8.8"
} }
buildTypes { buildTypes {
release { release {

View File

@ -17,7 +17,7 @@ class TradeLogic(val ourCivilization:CivilizationInfo, val otherCivilization: Ci
fun getAvailableOffers(civInfo: CivilizationInfo, otherCivilization: CivilizationInfo): TradeOffersList { fun getAvailableOffers(civInfo: CivilizationInfo, otherCivilization: CivilizationInfo): TradeOffersList {
val offers = TradeOffersList() val offers = TradeOffersList()
if(civInfo.isAtWarWith(otherCivilization)) if(civInfo.isAtWarWith(otherCivilization))
offers.add(TradeOffer("Peace Treaty", TradeType.Treaty, 20, 0)) offers.add(TradeOffer("Peace Treaty", TradeType.Treaty, 20))
for(entry in civInfo.getCivResources().filterNot { it.key.resourceType == ResourceType.Bonus }) { for(entry in civInfo.getCivResources().filterNot { it.key.resourceType == ResourceType.Bonus }) {
val resourceTradeType = if(entry.key.resourceType== ResourceType.Luxury) TradeType.Luxury_Resource val resourceTradeType = if(entry.key.resourceType== ResourceType.Luxury) TradeType.Luxury_Resource
else TradeType.Strategic_Resource else TradeType.Strategic_Resource
@ -26,18 +26,18 @@ class TradeLogic(val ourCivilization:CivilizationInfo, val otherCivilization: Ci
for(entry in civInfo.tech.techsResearched for(entry in civInfo.tech.techsResearched
.filterNot { otherCivilization.tech.isResearched(it) } .filterNot { otherCivilization.tech.isResearched(it) }
.filter { otherCivilization.tech.canBeResearched(it) }){ .filter { otherCivilization.tech.canBeResearched(it) }){
offers.add(TradeOffer(entry, TradeType.Technology, 0, 1)) offers.add(TradeOffer(entry, TradeType.Technology, 0))
} }
offers.add(TradeOffer("Gold".tr(), TradeType.Gold, 0, civInfo.gold)) offers.add(TradeOffer("Gold".tr(), TradeType.Gold, 0, civInfo.gold))
offers.add(TradeOffer("Gold per turn".tr(), TradeType.Gold_Per_Turn, 30, civInfo.getStatsForNextTurn().gold.toInt())) offers.add(TradeOffer("Gold per turn".tr(), TradeType.Gold_Per_Turn, 30, civInfo.getStatsForNextTurn().gold.toInt()))
for(city in civInfo.cities.filterNot { it.isCapital() }) for(city in civInfo.cities.filterNot { it.isCapital() })
offers.add(TradeOffer(city.name, TradeType.City, 0, 1)) offers.add(TradeOffer(city.name, TradeType.City, 0))
val civsWeKnowAndTheyDont = civInfo.diplomacy.values.map { it.otherCiv() } val civsWeKnowAndTheyDont = civInfo.diplomacy.values.map { it.otherCiv() }
.filter { !otherCivilization.diplomacy.containsKey(it.civName) .filter { !otherCivilization.diplomacy.containsKey(it.civName)
&& it != otherCivilization && !it.isBarbarianCivilization() } && it != otherCivilization && !it.isBarbarianCivilization() }
for(thirdCiv in civsWeKnowAndTheyDont){ for(thirdCiv in civsWeKnowAndTheyDont){
offers.add(TradeOffer("Introduction to " + thirdCiv.civName, TradeType.Introduction, 0,1)) offers.add(TradeOffer("Introduction to " + thirdCiv.civName, TradeType.Introduction, 0))
} }
return offers return offers

View File

@ -1,6 +1,6 @@
package com.unciv.logic.trade package com.unciv.logic.trade
data class TradeOffer(var name:String, var type: TradeType, var duration:Int, var amount:Int) { data class TradeOffer(var name:String, var type: TradeType, var duration:Int, var amount:Int=1) {
constructor() : this("", TradeType.Gold,0,0) // so that the json deserializer can work constructor() : this("", TradeType.Gold,0,0) // so that the json deserializer can work

View File

@ -30,7 +30,7 @@ open class TileGroup(var tileInfo: TileInfo) : Group() {
protected var militaryUnitImage: Group? = null protected var militaryUnitImage: Group? = null
private val circleImage = ImageGetter.getImage("OtherIcons/Circle.png") // for blue and red circles on the tile private val circleImage = ImageGetter.getImage("OtherIcons/Circle.png") // for blue and red circles on the tile
private val crosshairImage = ImageGetter.getImage("OtherIcons/Crosshair.png") // for blue and red circles on the tile private val crosshairImage = ImageGetter.getImage("OtherIcons/Crosshair.png") // for blue and red circles on the tile
private val fogImage = ImageGetter.getImage("TerrainIcons/Fog.png") protected val fogImage = ImageGetter.getImage("TerrainIcons/CrosshatchHexagon")
var yieldGroup = YieldGroup() var yieldGroup = YieldGroup()
class RoadImage { class RoadImage {
@ -43,7 +43,7 @@ open class TileGroup(var tileInfo: TileInfo) : Group() {
this.setSize(groupSize, groupSize) this.setSize(groupSize, groupSize)
addHexagon(groupSize) addHexagon(groupSize)
addCircleImage() addCircleImage()
addFogImage() addFogImage(groupSize)
addCrosshairImage() addCrosshairImage()
isTransform = false isTransform = false
} }
@ -56,11 +56,12 @@ open class TileGroup(var tileInfo: TileInfo) : Group() {
circleImage.isVisible = false circleImage.isVisible = false
} }
private fun addFogImage() { private fun addFogImage(groupSize: Float) {
fogImage.width = 70f val imageScale = groupSize * 1.5f / fogImage.width
fogImage.height = 70f fogImage.setScale(imageScale)
fogImage.setOrigin(Align.center)
fogImage.center(this) fogImage.center(this)
fogImage.color = Color.WHITE.cpy().apply { a = 0.5f } fogImage.color = Color.WHITE.cpy().apply { a = 0.2f }
addActor(fogImage) addActor(fogImage)
} }
@ -87,6 +88,7 @@ open class TileGroup(var tileInfo: TileInfo) : Group() {
} }
fun addPopulationIcon() { fun addPopulationIcon() {
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)

View File

@ -65,6 +65,7 @@ class WorldTileGroup(tileInfo: TileInfo) : TileGroup(tileInfo) {
cityButton?.toFront() cityButton?.toFront()
civilianUnitImage?.toFront() civilianUnitImage?.toFront()
militaryUnitImage?.toFront() militaryUnitImage?.toFront()
fogImage.toFront()
} }
private fun updateCityButton(city: CityInfo?, viewable: Boolean) { private fun updateCityButton(city: CityInfo?, viewable: Boolean) {

View File

@ -6,8 +6,8 @@ import com.badlogic.gdx.scenes.scene2d.ui.TextButton
import com.unciv.logic.trade.TradeOffersList import com.unciv.logic.trade.TradeOffersList
import com.unciv.logic.trade.TradeType import com.unciv.logic.trade.TradeType
import com.unciv.ui.utils.CameraStageBaseScreen import com.unciv.ui.utils.CameraStageBaseScreen
import com.unciv.ui.utils.onClick
import com.unciv.ui.utils.disable import com.unciv.ui.utils.disable
import com.unciv.ui.utils.onClick
import com.unciv.ui.utils.tr import com.unciv.ui.utils.tr
import kotlin.math.min import kotlin.math.min
@ -24,7 +24,7 @@ class OffersList(val offers: TradeOffersList, val correspondingOffers: TradeOffe
table.clear() table.clear()
for(offer in offers.sortedBy { it.type }) { for(offer in offers.sortedBy { it.type }) {
var buttonText = offer.name.tr() var buttonText = offer.name.tr()
if(offer.type !in listOf(TradeType.Technology, TradeType.City, TradeType.Introduction)) buttonText+=" ("+offer.amount+")" if(offer.type !in listOf(TradeType.Technology, TradeType.City, TradeType.Introduction, TradeType.Treaty)) buttonText+=" ("+offer.amount+")"
if(offer.duration>1) buttonText+="\n"+offer.duration+" {turns}".tr() if(offer.duration>1) buttonText+="\n"+offer.duration+" {turns}".tr()
val tb = TextButton(buttonText, CameraStageBaseScreen.skin) val tb = TextButton(buttonText, CameraStageBaseScreen.skin)
val amountPerClick = val amountPerClick =