mirror of
https://github.com/yairm210/Unciv.git
synced 2025-09-29 06:51:30 -04:00
update
This commit is contained in:
parent
b6bae3de2b
commit
64c98a27ea
@ -1,6 +1,7 @@
|
|||||||
package com.unciv.ui
|
package com.unciv.ui
|
||||||
|
|
||||||
import com.badlogic.gdx.graphics.Color
|
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.Table
|
||||||
import com.badlogic.gdx.scenes.scene2d.ui.TextButton
|
import com.badlogic.gdx.scenes.scene2d.ui.TextButton
|
||||||
import com.unciv.UnCivGame
|
import com.unciv.UnCivGame
|
||||||
@ -10,10 +11,10 @@ import com.unciv.models.gamebasics.VictoryType
|
|||||||
import com.unciv.models.gamebasics.tr
|
import com.unciv.models.gamebasics.tr
|
||||||
import com.unciv.ui.newgamescreen.NewGameScreen
|
import com.unciv.ui.newgamescreen.NewGameScreen
|
||||||
import com.unciv.ui.pickerscreens.PickerScreen
|
import com.unciv.ui.pickerscreens.PickerScreen
|
||||||
import com.unciv.ui.utils.addSeparator
|
import com.unciv.ui.pickerscreens.PolicyPickerScreen
|
||||||
import com.unciv.ui.utils.enable
|
import com.unciv.ui.pickerscreens.TechPickerScreen
|
||||||
import com.unciv.ui.utils.onClick
|
import com.unciv.ui.utils.*
|
||||||
import com.unciv.ui.utils.toLabel
|
import com.unciv.ui.worldscreen.WorldScreen
|
||||||
|
|
||||||
class VictoryScreen : PickerScreen() {
|
class VictoryScreen : PickerScreen() {
|
||||||
|
|
||||||
@ -199,7 +200,12 @@ class VictoryScreen : PickerScreen() {
|
|||||||
.sortedByDescending { it.branchesCompleted }
|
.sortedByDescending { it.branchesCompleted }
|
||||||
|
|
||||||
for (entry in civsToBranchesCompleted) {
|
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)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return policyVictoryColumn
|
return policyVictoryColumn
|
||||||
}
|
}
|
||||||
@ -217,7 +223,12 @@ class VictoryScreen : PickerScreen() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
for (entry in civsToPartsRemaining) {
|
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)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return scientificVictoryColumn
|
return scientificVictoryColumn
|
||||||
}
|
}
|
||||||
|
@ -13,8 +13,8 @@ import com.unciv.ui.utils.*
|
|||||||
import com.unciv.ui.worldscreen.WorldScreen
|
import com.unciv.ui.worldscreen.WorldScreen
|
||||||
|
|
||||||
|
|
||||||
class PolicyPickerScreen(val worldScreen: WorldScreen) : PickerScreen() {
|
class PolicyPickerScreen(val worldScreen: WorldScreen,civInfo: CivilizationInfo=worldScreen.viewingCiv) : PickerScreen() {
|
||||||
internal val viewingCiv: CivilizationInfo = worldScreen.viewingCiv
|
internal val viewingCiv: CivilizationInfo = civInfo
|
||||||
private var pickedPolicy: Policy? = null
|
private var pickedPolicy: Policy? = null
|
||||||
|
|
||||||
init {
|
init {
|
||||||
|
@ -7,12 +7,10 @@ import com.badlogic.gdx.scenes.scene2d.ui.Table
|
|||||||
import com.badlogic.gdx.utils.Align
|
import com.badlogic.gdx.utils.Align
|
||||||
import com.unciv.logic.civilization.TechManager
|
import com.unciv.logic.civilization.TechManager
|
||||||
import com.unciv.models.gamebasics.GameBasics
|
import com.unciv.models.gamebasics.GameBasics
|
||||||
import com.unciv.ui.utils.CameraStageBaseScreen
|
import com.unciv.ui.utils.*
|
||||||
import com.unciv.ui.utils.ImageGetter
|
import com.unciv.ui.worldscreen.WorldScreen
|
||||||
import com.unciv.ui.utils.setFontColor
|
|
||||||
import com.unciv.ui.utils.surroundWithCircle
|
|
||||||
|
|
||||||
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) }
|
val text= Label("", skin).setFontColor(Color.WHITE).apply { setAlignment(Align.center) }
|
||||||
init {
|
init {
|
||||||
touchable = Touchable.enabled
|
touchable = Touchable.enabled
|
||||||
@ -28,7 +26,10 @@ class TechButton(techName:String, val techManager: TechManager) : Table(CameraSt
|
|||||||
val percentComplete = (techCost-remainingTech)/techCost.toFloat()
|
val percentComplete = (techCost-remainingTech)/techCost.toFloat()
|
||||||
add(ImageGetter.getProgressBarVertical(2f, 50f, percentComplete, Color.BLUE, Color.WHITE))
|
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
|
// here we add little images of what the tech gives you
|
||||||
val techEnabledIcons = Table()
|
val techEnabledIcons = Table()
|
||||||
@ -66,7 +67,8 @@ class TechButton(techName:String, val techManager: TechManager) : Table(CameraSt
|
|||||||
techEnabledIcons.add(ImageGetter.getImage("OtherIcons/Star")
|
techEnabledIcons.add(ImageGetter.getImage("OtherIcons/Star")
|
||||||
.apply { color= Color.BLACK }.surroundWithCircle(30f))
|
.apply { color= Color.BLACK }.surroundWithCircle(30f))
|
||||||
|
|
||||||
rightSide.add(techEnabledIcons)
|
if (isWorldScreen) rightSide.add(techEnabledIcons)
|
||||||
|
else rightSide.add(techEnabledIcons).width(150f)
|
||||||
|
|
||||||
add(rightSide)
|
add(rightSide)
|
||||||
pack()
|
pack()
|
||||||
|
@ -69,7 +69,7 @@ class TechPickerScreen(internal val civInfo: CivilizationInfo, centerOnTech: Tec
|
|||||||
topTable.add() // empty cell
|
topTable.add() // empty cell
|
||||||
|
|
||||||
else {
|
else {
|
||||||
val techButton = TechButton(tech.name,civTech)
|
val techButton = TechButton(tech.name,civTech,false)
|
||||||
|
|
||||||
techNameToButton[tech.name] = techButton
|
techNameToButton[tech.name] = techButton
|
||||||
techButton.onClick { selectTechnology(tech) }
|
techButton.onClick { selectTechnology(tech) }
|
||||||
|
@ -185,7 +185,18 @@ object ImageGetter {
|
|||||||
}
|
}
|
||||||
|
|
||||||
fun getTechIconGroup(techName: String): Group {
|
fun getTechIconGroup(techName: String): Group {
|
||||||
return getImage("TechIcons/$techName").surroundWithCircle(60f)
|
var COLOR= Color.WHITE
|
||||||
|
when(GameBasics.Technologies[techName]!!.era().name){
|
||||||
|
"Ancient"-> COLOR= Color.FIREBRICK
|
||||||
|
"Classical"-> COLOR= Color.VIOLET
|
||||||
|
"Medieval"-> COLOR= Color.TAN
|
||||||
|
"Renaissance"-> COLOR= Color.BROWN
|
||||||
|
"Industrial"-> COLOR= Color.CHARTREUSE
|
||||||
|
"Modern"-> COLOR= Color.GOLD
|
||||||
|
"Information"-> COLOR= Color.CORAL
|
||||||
|
"Future"-> COLOR= Color.CYAN
|
||||||
|
}
|
||||||
|
return getImage("TechIcons/$techName").surroundWithCircle(60f).apply { this.circle.color= COLOR }
|
||||||
}
|
}
|
||||||
|
|
||||||
fun getProgressBarVertical(width:Float,height:Float,percentComplete:Float,progressColor:Color,backgroundColor:Color): Table {
|
fun getProgressBarVertical(width:Float,height:Float,percentComplete:Float,progressColor:Color,backgroundColor:Color): Table {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user