mirror of
https://github.com/yairm210/Unciv.git
synced 2025-07-21 05:09:25 +07:00
Constructions requiring missing resources once again shown in city construction choices
This commit is contained in:
@ -9,7 +9,7 @@ interface IConstruction : INamed {
|
||||
fun getProductionCost(civInfo: CivilizationInfo): Int
|
||||
fun getGoldCost(civInfo: CivilizationInfo): Int
|
||||
fun isBuildable(construction: CityConstructions): Boolean
|
||||
fun shouldBeDisplayed(construction: CityConstructions): Boolean
|
||||
fun shouldBeDisplayed(cityConstructions: CityConstructions): Boolean
|
||||
fun postBuildEvent(construction: CityConstructions, wasBought: Boolean = false): Boolean // Yes I'm hilarious.
|
||||
fun getResource(): String?
|
||||
fun canBePurchased(): Boolean
|
||||
@ -18,8 +18,8 @@ interface IConstruction : INamed {
|
||||
|
||||
|
||||
open class PerpetualConstruction(override var name: String, val description: String) : IConstruction{
|
||||
override fun shouldBeDisplayed(construction: CityConstructions): Boolean {
|
||||
return isBuildable(construction)
|
||||
override fun shouldBeDisplayed(cityConstructions: CityConstructions): Boolean {
|
||||
return isBuildable(cityConstructions)
|
||||
}
|
||||
open fun getProductionTooltip(cityInfo: CityInfo) : String
|
||||
= "\r\n${(cityInfo.cityStats.currentCityStats.production / CONVERSION_RATE).roundToInt()}/${"{turn}".tr()}"
|
||||
|
@ -118,7 +118,9 @@ class BaseUnit : INamed, IConstruction {
|
||||
|
||||
override fun shouldBeDisplayed(construction: CityConstructions): Boolean {
|
||||
val rejectionReason = getRejectionReason(construction)
|
||||
return rejectionReason=="" || rejectionReason.startsWith("Requires")
|
||||
return rejectionReason==""
|
||||
|| rejectionReason.startsWith("Requires")
|
||||
|| rejectionReason.startsWith("Consumes")
|
||||
}
|
||||
|
||||
fun getRejectionReason(construction: CityConstructions): String {
|
||||
|
@ -1,5 +1,6 @@
|
||||
package com.unciv.ui.worldscreen
|
||||
|
||||
import com.badlogic.gdx.Application
|
||||
import com.badlogic.gdx.Gdx
|
||||
import com.badlogic.gdx.Input
|
||||
import com.badlogic.gdx.graphics.Color
|
||||
@ -25,6 +26,7 @@ import com.unciv.ui.tilegroups.TileSetStrings
|
||||
import com.unciv.ui.tilegroups.WorldTileGroup
|
||||
import com.unciv.ui.utils.*
|
||||
import com.unciv.ui.worldscreen.unit.UnitContextMenu
|
||||
import sun.awt.ExtendedKeyCodes
|
||||
import kotlin.concurrent.thread
|
||||
|
||||
|
||||
@ -60,14 +62,17 @@ class WorldMapHolder(internal val worldScreen: WorldScreen, internal val tileMap
|
||||
|
||||
layout() // Fit the scroll pane to the contents - otherwise, setScroll won't work!
|
||||
|
||||
addAction(Actions.forever(Actions.delay(0.05f, Actions.run {
|
||||
val amountToMove = 30/scaleX
|
||||
if(Gdx.input.isKeyPressed(Input.Keys.W)) scrollY -= amountToMove
|
||||
if(Gdx.input.isKeyPressed(Input.Keys.S)) scrollY += amountToMove
|
||||
if(Gdx.input.isKeyPressed(Input.Keys.A)) scrollX -= amountToMove
|
||||
if(Gdx.input.isKeyPressed(Input.Keys.D)) scrollX += amountToMove
|
||||
updateVisualScroll()
|
||||
})))
|
||||
// Apparently this lakes loads of CPU so restrict it as much as possible
|
||||
if(Gdx.app.type==Application.ApplicationType.Desktop) {
|
||||
addAction(Actions.forever(Actions.delay(0.05f, Actions.run {
|
||||
val amountToMove = 30 / scaleX
|
||||
if (Gdx.input.isKeyPressed(Input.Keys.W)) scrollY -= amountToMove
|
||||
if (Gdx.input.isKeyPressed(Input.Keys.S)) scrollY += amountToMove
|
||||
if (Gdx.input.isKeyPressed(Input.Keys.A)) scrollX -= amountToMove
|
||||
if (Gdx.input.isKeyPressed(Input.Keys.D)) scrollX += amountToMove
|
||||
updateVisualScroll()
|
||||
})))
|
||||
}
|
||||
}
|
||||
|
||||
private fun onTileClicked(tileInfo: TileInfo) {
|
||||
|
Reference in New Issue
Block a user