mirror of
https://github.com/yairm210/Unciv.git
synced 2025-09-27 13:55:54 -04:00
1. In PickTechScreen all the Techs have the same size. 2.The tech in different era has different color. 3.About global status in victory status screen, you can touch the icons of Civs to check its policy tree and tech tree, but close button may lead to worldscreen (#1096)
This commit is contained in:
parent
27b8cd5f1b
commit
f6009c43ca
@ -42,7 +42,7 @@ data class LocationAction(var locations: ArrayList<Vector2> = ArrayList()) : Not
|
||||
class TechAction(val techName: String = "") : NotificationAction {
|
||||
override fun execute(worldScreen: WorldScreen) {
|
||||
val tech = GameBasics.Technologies[techName]
|
||||
worldScreen.game.screen = TechPickerScreen(worldScreen.viewingCiv, tech)
|
||||
worldScreen.game.screen = TechPickerScreen(worldScreen.viewingCiv, true, tech)
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1,6 +1,7 @@
|
||||
package com.unciv.ui
|
||||
|
||||
import com.badlogic.gdx.graphics.Color
|
||||
import com.badlogic.gdx.scenes.scene2d.Touchable
|
||||
import com.badlogic.gdx.scenes.scene2d.ui.Table
|
||||
import com.badlogic.gdx.scenes.scene2d.ui.TextButton
|
||||
import com.unciv.UnCivGame
|
||||
@ -10,10 +11,10 @@ import com.unciv.models.gamebasics.VictoryType
|
||||
import com.unciv.models.gamebasics.tr
|
||||
import com.unciv.ui.newgamescreen.NewGameScreen
|
||||
import com.unciv.ui.pickerscreens.PickerScreen
|
||||
import com.unciv.ui.utils.addSeparator
|
||||
import com.unciv.ui.utils.enable
|
||||
import com.unciv.ui.utils.onClick
|
||||
import com.unciv.ui.utils.toLabel
|
||||
import com.unciv.ui.pickerscreens.PolicyPickerScreen
|
||||
import com.unciv.ui.pickerscreens.TechPickerScreen
|
||||
import com.unciv.ui.utils.*
|
||||
import com.unciv.ui.worldscreen.WorldScreen
|
||||
|
||||
class VictoryScreen : PickerScreen() {
|
||||
|
||||
@ -199,7 +200,13 @@ class VictoryScreen : PickerScreen() {
|
||||
.sortedByDescending { it.branchesCompleted }
|
||||
|
||||
for (entry in civsToBranchesCompleted) {
|
||||
policyVictoryColumn.add(EmpireOverviewScreen.getCivGroup(entry.civ, " - " + entry.branchesCompleted, playerCivInfo)).row()
|
||||
val civToBranchesHaveCompleted=EmpireOverviewScreen.getCivGroup(entry.civ, " - " + entry.branchesCompleted, playerCivInfo)
|
||||
policyVictoryColumn.add(civToBranchesHaveCompleted).row()
|
||||
civToBranchesHaveCompleted.touchable= Touchable.enabled
|
||||
civToBranchesHaveCompleted.onClick {
|
||||
game.screen = PolicyPickerScreen(UnCivGame.Current.worldScreen,entry.civ, false)
|
||||
dispose()
|
||||
}
|
||||
}
|
||||
return policyVictoryColumn
|
||||
}
|
||||
@ -217,7 +224,13 @@ class VictoryScreen : PickerScreen() {
|
||||
}
|
||||
|
||||
for (entry in civsToPartsRemaining) {
|
||||
scientificVictoryColumn.add(EmpireOverviewScreen.getCivGroup(entry.civ, " - " + entry.partsRemaining, playerCivInfo)).row()
|
||||
val civToPartsBeRemaining=(EmpireOverviewScreen.getCivGroup(entry.civ, " - " + entry.partsRemaining, playerCivInfo))
|
||||
scientificVictoryColumn.add(civToPartsBeRemaining).row()
|
||||
civToPartsBeRemaining.touchable= Touchable.enabled
|
||||
civToPartsBeRemaining.onClick {
|
||||
game.screen = TechPickerScreen(entry.civ, false)
|
||||
dispose()
|
||||
}
|
||||
}
|
||||
return scientificVictoryColumn
|
||||
}
|
||||
|
@ -13,8 +13,8 @@ import com.unciv.ui.utils.*
|
||||
import com.unciv.ui.worldscreen.WorldScreen
|
||||
|
||||
|
||||
class PolicyPickerScreen(val worldScreen: WorldScreen) : PickerScreen() {
|
||||
internal val viewingCiv: CivilizationInfo = worldScreen.viewingCiv
|
||||
class PolicyPickerScreen(val worldScreen: WorldScreen, civInfo: CivilizationInfo = worldScreen.viewingCiv, switchfromWorldScreen: Boolean = true) : PickerScreen() {
|
||||
internal val viewingCiv: CivilizationInfo = civInfo
|
||||
private var pickedPolicy: Policy? = null
|
||||
|
||||
init {
|
||||
@ -42,6 +42,12 @@ class PolicyPickerScreen(val worldScreen: WorldScreen) : PickerScreen() {
|
||||
}
|
||||
if(!UnCivGame.Current.worldScreen.isPlayersTurn)
|
||||
rightSideButton.disable()
|
||||
if (!switchfromWorldScreen){
|
||||
rightSideButton.apply {
|
||||
disable()
|
||||
setText("Policy Tree Of [${viewingCiv.civName}]".tr())
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
topTable.row().pad(30f)
|
||||
|
@ -7,12 +7,10 @@ import com.badlogic.gdx.scenes.scene2d.ui.Table
|
||||
import com.badlogic.gdx.utils.Align
|
||||
import com.unciv.logic.civilization.TechManager
|
||||
import com.unciv.models.gamebasics.GameBasics
|
||||
import com.unciv.ui.utils.CameraStageBaseScreen
|
||||
import com.unciv.ui.utils.ImageGetter
|
||||
import com.unciv.ui.utils.setFontColor
|
||||
import com.unciv.ui.utils.surroundWithCircle
|
||||
import com.unciv.ui.utils.*
|
||||
import com.unciv.ui.worldscreen.WorldScreen
|
||||
|
||||
class TechButton(techName:String, val techManager: TechManager) : Table(CameraStageBaseScreen.skin) {
|
||||
class TechButton(techName:String, val techManager: TechManager, isWorldScreen: Boolean = true) : Table(CameraStageBaseScreen.skin) {
|
||||
val text= Label("", skin).setFontColor(Color.WHITE).apply { setAlignment(Align.center) }
|
||||
init {
|
||||
touchable = Touchable.enabled
|
||||
@ -28,7 +26,10 @@ class TechButton(techName:String, val techManager: TechManager) : Table(CameraSt
|
||||
val percentComplete = (techCost-remainingTech)/techCost.toFloat()
|
||||
add(ImageGetter.getProgressBarVertical(2f, 50f, percentComplete, Color.BLUE, Color.WHITE))
|
||||
}
|
||||
rightSide.add(text).row()
|
||||
else add().width(2f)
|
||||
|
||||
if (isWorldScreen) rightSide.add(text).row()
|
||||
else rightSide.add(text).height(25f).row()
|
||||
|
||||
// here we add little images of what the tech gives you
|
||||
val techEnabledIcons = Table()
|
||||
@ -66,7 +67,8 @@ class TechButton(techName:String, val techManager: TechManager) : Table(CameraSt
|
||||
techEnabledIcons.add(ImageGetter.getImage("OtherIcons/Star")
|
||||
.apply { color= Color.BLACK }.surroundWithCircle(30f))
|
||||
|
||||
rightSide.add(techEnabledIcons)
|
||||
if (isWorldScreen) rightSide.add(techEnabledIcons)
|
||||
else rightSide.add(techEnabledIcons).width(150f)
|
||||
|
||||
add(rightSide)
|
||||
pack()
|
||||
|
@ -16,7 +16,7 @@ import java.util.*
|
||||
import kotlin.collections.HashSet
|
||||
|
||||
|
||||
class TechPickerScreen(internal val civInfo: CivilizationInfo, centerOnTech: Technology? = null) : PickerScreen() {
|
||||
class TechPickerScreen(internal val civInfo: CivilizationInfo, switchfromWorldScreen: Boolean = true, centerOnTech: Technology? = null) : PickerScreen() {
|
||||
|
||||
private var techNameToButton = HashMap<String, TechButton>()
|
||||
private var isFreeTechPick: Boolean = false
|
||||
@ -69,7 +69,7 @@ class TechPickerScreen(internal val civInfo: CivilizationInfo, centerOnTech: Tec
|
||||
topTable.add() // empty cell
|
||||
|
||||
else {
|
||||
val techButton = TechButton(tech.name,civTech)
|
||||
val techButton = TechButton(tech.name,civTech,false)
|
||||
|
||||
techNameToButton[tech.name] = techButton
|
||||
techButton.onClick { selectTechnology(tech) }
|
||||
@ -93,8 +93,13 @@ class TechPickerScreen(internal val civInfo: CivilizationInfo, centerOnTech: Tec
|
||||
}
|
||||
|
||||
setButtonsInfo()
|
||||
|
||||
rightSideButton.setText("Pick a tech".tr())
|
||||
if (!switchfromWorldScreen){
|
||||
rightSideButton.apply {
|
||||
disable()
|
||||
setText("Tech Tree Of [${civInfo.civName}]".tr())
|
||||
}
|
||||
}
|
||||
else rightSideButton.setText("Pick a tech".tr())
|
||||
rightSideButton.onClick("paper") {
|
||||
if (isFreeTechPick) civTech.getFreeTechnology(selectedTech!!.name)
|
||||
else civTech.techsToResearch = tempTechsToResearch
|
||||
@ -110,7 +115,7 @@ class TechPickerScreen(internal val civInfo: CivilizationInfo, centerOnTech: Tec
|
||||
// and possibly select it to show description,
|
||||
// which is very helpful when just discovered and clicking the notification
|
||||
val tech = if (centerOnTech != null) centerOnTech else civInfo.tech.currentTechnology()
|
||||
if (tech != null) {
|
||||
if (tech != null && switchfromWorldScreen) {
|
||||
// select only if there it doesn't mess up tempTechsToResearch
|
||||
if (civInfo.tech.isResearched(tech.name) || civInfo.tech.techsToResearch.size <= 1)
|
||||
selectTechnology(tech, true)
|
||||
@ -148,11 +153,14 @@ class TechPickerScreen(internal val civInfo: CivilizationInfo, centerOnTech: Tec
|
||||
}
|
||||
}
|
||||
|
||||
private fun selectTechnology(tech: Technology?, center: Boolean = false) {
|
||||
private fun selectTechnology(tech: Technology?, center: Boolean = false, switchfromWorldScreen: Boolean = true) {
|
||||
|
||||
selectedTech = tech
|
||||
descriptionLabel.setText(tech?.description)
|
||||
|
||||
if (!switchfromWorldScreen)
|
||||
return
|
||||
|
||||
if(tech==null)
|
||||
return
|
||||
|
||||
|
@ -185,7 +185,18 @@ object ImageGetter {
|
||||
}
|
||||
|
||||
fun getTechIconGroup(techName: String): Group {
|
||||
return getImage("TechIcons/$techName").surroundWithCircle(60f)
|
||||
var TechIconColor = Color.WHITE
|
||||
when(GameBasics.Technologies[techName]!!.era().name){
|
||||
"Ancient"-> TechIconColor = Color.FIREBRICK
|
||||
"Classical"-> TechIconColor = Color.VIOLET
|
||||
"Medieval"-> TechIconColor = Color.TAN
|
||||
"Renaissance"-> TechIconColor = Color.BROWN
|
||||
"Industrial"-> TechIconColor = Color.CHARTREUSE
|
||||
"Modern"-> TechIconColor = Color.GOLD
|
||||
"Information"-> TechIconColor = Color.CORAL
|
||||
"Future"-> TechIconColor = Color.CYAN
|
||||
}
|
||||
return getImage("TechIcons/$techName").surroundWithCircle(60f).apply{ this.circle.color = TechIconColor }
|
||||
}
|
||||
|
||||
fun getProgressBarVertical(width:Float,height:Float,percentComplete:Float,progressColor:Color,backgroundColor:Color): Table {
|
||||
|
Loading…
x
Reference in New Issue
Block a user