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"
minSdkVersion 14
targetSdkVersion 26
versionCode 139
versionName "2.8.7"
versionCode 140
versionName "2.8.8"
}
buildTypes {
release {

View file

@ -17,7 +17,7 @@ class TradeLogic(val ourCivilization:CivilizationInfo, val otherCivilization: Ci
fun getAvailableOffers(civInfo: CivilizationInfo, otherCivilization: CivilizationInfo): TradeOffersList {
val offers = TradeOffersList()
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 }) {
val resourceTradeType = if(entry.key.resourceType== ResourceType.Luxury) TradeType.Luxury_Resource
else TradeType.Strategic_Resource
@ -26,18 +26,18 @@ class TradeLogic(val ourCivilization:CivilizationInfo, val otherCivilization: Ci
for(entry in civInfo.tech.techsResearched
.filterNot { otherCivilization.tech.isResearched(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 per turn".tr(), TradeType.Gold_Per_Turn, 30, civInfo.getStatsForNextTurn().gold.toInt()))
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() }
.filter { !otherCivilization.diplomacy.containsKey(it.civName)
&& it != otherCivilization && !it.isBarbarianCivilization() }
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

View file

@ -1,6 +1,6 @@
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

View file

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

View file

@ -65,6 +65,7 @@ class WorldTileGroup(tileInfo: TileInfo) : TileGroup(tileInfo) {
cityButton?.toFront()
civilianUnitImage?.toFront()
militaryUnitImage?.toFront()
fogImage.toFront()
}
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.TradeType
import com.unciv.ui.utils.CameraStageBaseScreen
import com.unciv.ui.utils.onClick
import com.unciv.ui.utils.disable
import com.unciv.ui.utils.onClick
import com.unciv.ui.utils.tr
import kotlin.math.min
@ -24,7 +24,7 @@ class OffersList(val offers: TradeOffersList, val correspondingOffers: TradeOffe
table.clear()
for(offer in offers.sortedBy { it.type }) {
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()
val tb = TextButton(buttonText, CameraStageBaseScreen.skin)
val amountPerClick =