Tech coloration issues

This commit is contained in:
Yair Morgenstern
2019-09-09 23:06:17 +03:00
parent a8663dda91
commit 7454b57e4d
5 changed files with 16 additions and 13 deletions

View File

@ -23,6 +23,7 @@ class Constants{
val unitActionSleep = "Sleep"
val unitActionAutomation = "automation"
val unitActionExplore = "Explore"
val futureTech = "Future Tech"
}
}

View File

@ -174,7 +174,7 @@ class NextTurnAutomation{
val tech: Technology
if (researchableTechs.isEmpty()) { // no non-researched techs available, go for future tech
civInfo.tech.techsToResearch.add("Future Tech")
civInfo.tech.techsToResearch.add(Constants.futureTech)
return
}

View File

@ -2,6 +2,7 @@ package com.unciv.logic.civilization
import com.badlogic.gdx.graphics.Color
import com.unciv.Constants
import com.unciv.logic.map.RoadStatus
import com.unciv.models.gamebasics.GameBasics
import com.unciv.models.gamebasics.tech.Technology
@ -86,7 +87,7 @@ class TechManager {
val techNameToCheck = checkPrerequisites.pop()
// future tech can have been researched even when we're researching it,
// so...if we skip it we'll end up with 0 techs in the "required techs", which will mean that we don't have annything to research. Yeah.
if (techNameToCheck!="Future Tech" &&
if (techNameToCheck!=Constants.futureTech &&
(isResearched(techNameToCheck) || prerequisites.contains(techNameToCheck)) )
continue //no need to add or check prerequisites
val techToCheck = GameBasics.Technologies[techNameToCheck]
@ -116,7 +117,7 @@ class TechManager {
}
fun addTechnology(techName:String) {
if(techName!="Future Tech")
if(techName!= Constants.futureTech)
techsToResearch.remove(techName)
val previousEra = civInfo.getEra()

View File

@ -4,6 +4,7 @@ import com.badlogic.gdx.Gdx
import com.badlogic.gdx.graphics.Color
import com.badlogic.gdx.scenes.scene2d.ui.Label
import com.badlogic.gdx.scenes.scene2d.ui.ScrollPane
import com.unciv.Constants
import com.unciv.UnCivGame
import com.unciv.logic.civilization.CivilizationInfo
import com.unciv.logic.civilization.TechManager
@ -121,14 +122,14 @@ class TechPickerScreen(internal val civInfo: CivilizationInfo, centerOnTech: Tec
private fun setButtonsInfo() {
for (techName in techNameToButton.keys) {
val techButton = techNameToButton[techName]!!
when {
civTech.isResearched(techName) && techName!="Future Tech" -> techButton.color = researchedTechColor
tempTechsToResearch.isNotEmpty() && tempTechsToResearch.first() == techName -> techButton.color = currentTechColor
tempTechsToResearch.contains(techName) -> techButton.color = queuedTechColor
else -> techButton.color = Color.BLACK
techButton.color = when {
civTech.isResearched(techName) && techName != Constants.futureTech -> researchedTechColor
// if we're here to pick a free tech, show the current tech like the rest of the researchables so it'll be obvious what we can pick
tempTechsToResearch.firstOrNull() == techName && !isFreeTechPick -> currentTechColor
researchableTechs.contains(techName) && !civTech.isResearched(techName) -> researchableTechColor
tempTechsToResearch.contains(techName) -> queuedTechColor
else -> Color.BLACK
}
//the tech that can be selected to research immediately should be always researchableTechColor, it's very good when we pick a free tech.
if (researchableTechs.contains(techName)&&!civTech.isResearched(techName)) techButton.color = researchableTechColor
var text = techName.tr()
@ -140,7 +141,7 @@ class TechPickerScreen(internal val civInfo: CivilizationInfo, centerOnTech: Tec
text += " (" + tempTechsToResearch.indexOf(techName) + ")"
}
if (!civTech.isResearched(techName) || techName=="Future Tech")
if (!civTech.isResearched(techName) || techName== Constants.futureTech)
text += "\r\n" + turnsToTech[techName] + " {turns}".tr()
techButton.text.setText(text)
@ -166,7 +167,7 @@ class TechPickerScreen(internal val civInfo: CivilizationInfo, centerOnTech: Tec
return
}
if (civTech.isResearched(tech.name) && tech.name != "Future Tech") {
if (civTech.isResearched(tech.name) && tech.name != Constants.futureTech) {
rightSideButton.setText("Pick a tech".tr())
rightSideButton.disable()
setButtonsInfo()

View File

@ -246,7 +246,7 @@ class WorldScreen(val viewingCiv:CivilizationInfo) : CameraStageBaseScreen() {
val researchableTechs = GameBasics.Technologies.values.filter { !civInfo.tech.isResearched(it.name) && civInfo.tech.canBeResearched(it.name) }
if (civInfo.tech.currentTechnology() == null && researchableTechs.isEmpty())
civInfo.tech.techsToResearch.add("Future Tech")
civInfo.tech.techsToResearch.add(Constants.futureTech)
if (civInfo.tech.currentTechnology() == null) {
val buttonPic = Table()