mirror of
https://github.com/yairm210/Unciv.git
synced 2025-09-28 14:24:43 -04:00
Tech coloration issues
This commit is contained in:
parent
a8663dda91
commit
7454b57e4d
@ -23,6 +23,7 @@ class Constants{
|
|||||||
val unitActionSleep = "Sleep"
|
val unitActionSleep = "Sleep"
|
||||||
val unitActionAutomation = "automation"
|
val unitActionAutomation = "automation"
|
||||||
val unitActionExplore = "Explore"
|
val unitActionExplore = "Explore"
|
||||||
|
val futureTech = "Future Tech"
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -174,7 +174,7 @@ class NextTurnAutomation{
|
|||||||
|
|
||||||
val tech: Technology
|
val tech: Technology
|
||||||
if (researchableTechs.isEmpty()) { // no non-researched techs available, go for future tech
|
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
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2,6 +2,7 @@ package com.unciv.logic.civilization
|
|||||||
|
|
||||||
|
|
||||||
import com.badlogic.gdx.graphics.Color
|
import com.badlogic.gdx.graphics.Color
|
||||||
|
import com.unciv.Constants
|
||||||
import com.unciv.logic.map.RoadStatus
|
import com.unciv.logic.map.RoadStatus
|
||||||
import com.unciv.models.gamebasics.GameBasics
|
import com.unciv.models.gamebasics.GameBasics
|
||||||
import com.unciv.models.gamebasics.tech.Technology
|
import com.unciv.models.gamebasics.tech.Technology
|
||||||
@ -86,7 +87,7 @@ class TechManager {
|
|||||||
val techNameToCheck = checkPrerequisites.pop()
|
val techNameToCheck = checkPrerequisites.pop()
|
||||||
// future tech can have been researched even when we're researching it,
|
// 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.
|
// 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)) )
|
(isResearched(techNameToCheck) || prerequisites.contains(techNameToCheck)) )
|
||||||
continue //no need to add or check prerequisites
|
continue //no need to add or check prerequisites
|
||||||
val techToCheck = GameBasics.Technologies[techNameToCheck]
|
val techToCheck = GameBasics.Technologies[techNameToCheck]
|
||||||
@ -116,7 +117,7 @@ class TechManager {
|
|||||||
}
|
}
|
||||||
|
|
||||||
fun addTechnology(techName:String) {
|
fun addTechnology(techName:String) {
|
||||||
if(techName!="Future Tech")
|
if(techName!= Constants.futureTech)
|
||||||
techsToResearch.remove(techName)
|
techsToResearch.remove(techName)
|
||||||
|
|
||||||
val previousEra = civInfo.getEra()
|
val previousEra = civInfo.getEra()
|
||||||
|
@ -4,6 +4,7 @@ import com.badlogic.gdx.Gdx
|
|||||||
import com.badlogic.gdx.graphics.Color
|
import com.badlogic.gdx.graphics.Color
|
||||||
import com.badlogic.gdx.scenes.scene2d.ui.Label
|
import com.badlogic.gdx.scenes.scene2d.ui.Label
|
||||||
import com.badlogic.gdx.scenes.scene2d.ui.ScrollPane
|
import com.badlogic.gdx.scenes.scene2d.ui.ScrollPane
|
||||||
|
import com.unciv.Constants
|
||||||
import com.unciv.UnCivGame
|
import com.unciv.UnCivGame
|
||||||
import com.unciv.logic.civilization.CivilizationInfo
|
import com.unciv.logic.civilization.CivilizationInfo
|
||||||
import com.unciv.logic.civilization.TechManager
|
import com.unciv.logic.civilization.TechManager
|
||||||
@ -121,14 +122,14 @@ class TechPickerScreen(internal val civInfo: CivilizationInfo, centerOnTech: Tec
|
|||||||
private fun setButtonsInfo() {
|
private fun setButtonsInfo() {
|
||||||
for (techName in techNameToButton.keys) {
|
for (techName in techNameToButton.keys) {
|
||||||
val techButton = techNameToButton[techName]!!
|
val techButton = techNameToButton[techName]!!
|
||||||
when {
|
techButton.color = when {
|
||||||
civTech.isResearched(techName) && techName!="Future Tech" -> techButton.color = researchedTechColor
|
civTech.isResearched(techName) && techName != Constants.futureTech -> researchedTechColor
|
||||||
tempTechsToResearch.isNotEmpty() && tempTechsToResearch.first() == techName -> techButton.color = currentTechColor
|
// 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.contains(techName) -> techButton.color = queuedTechColor
|
tempTechsToResearch.firstOrNull() == techName && !isFreeTechPick -> currentTechColor
|
||||||
else -> techButton.color = Color.BLACK
|
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()
|
var text = techName.tr()
|
||||||
|
|
||||||
@ -140,7 +141,7 @@ class TechPickerScreen(internal val civInfo: CivilizationInfo, centerOnTech: Tec
|
|||||||
text += " (" + tempTechsToResearch.indexOf(techName) + ")"
|
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()
|
text += "\r\n" + turnsToTech[techName] + " {turns}".tr()
|
||||||
|
|
||||||
techButton.text.setText(text)
|
techButton.text.setText(text)
|
||||||
@ -166,7 +167,7 @@ class TechPickerScreen(internal val civInfo: CivilizationInfo, centerOnTech: Tec
|
|||||||
return
|
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.setText("Pick a tech".tr())
|
||||||
rightSideButton.disable()
|
rightSideButton.disable()
|
||||||
setButtonsInfo()
|
setButtonsInfo()
|
||||||
|
@ -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) }
|
val researchableTechs = GameBasics.Technologies.values.filter { !civInfo.tech.isResearched(it.name) && civInfo.tech.canBeResearched(it.name) }
|
||||||
if (civInfo.tech.currentTechnology() == null && researchableTechs.isEmpty())
|
if (civInfo.tech.currentTechnology() == null && researchableTechs.isEmpty())
|
||||||
civInfo.tech.techsToResearch.add("Future Tech")
|
civInfo.tech.techsToResearch.add(Constants.futureTech)
|
||||||
|
|
||||||
if (civInfo.tech.currentTechnology() == null) {
|
if (civInfo.tech.currentTechnology() == null) {
|
||||||
val buttonPic = Table()
|
val buttonPic = Table()
|
||||||
|
Loading…
x
Reference in New Issue
Block a user