mirror of
https://github.com/yairm210/Unciv.git
synced 2025-07-25 07:09:16 +07:00
TechPickerScreen organization
This commit is contained in:
File diff suppressed because it is too large
Load Diff
Binary file not shown.
Before Width: | Height: | Size: 872 KiB After Width: | Height: | Size: 876 KiB |
Binary file not shown.
Before Width: | Height: | Size: 281 KiB After Width: | Height: | Size: 278 KiB |
@ -42,7 +42,7 @@ data class LocationAction(var locations: ArrayList<Vector2> = ArrayList()) : Not
|
|||||||
class TechAction(val techName: String = "") : NotificationAction {
|
class TechAction(val techName: String = "") : NotificationAction {
|
||||||
override fun execute(worldScreen: WorldScreen) {
|
override fun execute(worldScreen: WorldScreen) {
|
||||||
val tech = GameBasics.Technologies[techName]
|
val tech = GameBasics.Technologies[techName]
|
||||||
worldScreen.game.setScreen(TechPickerScreen(worldScreen.viewingCiv, true, tech))
|
worldScreen.game.setScreen(TechPickerScreen(worldScreen.viewingCiv, tech))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -40,28 +40,14 @@ class TechPickerScreen(internal val civInfo: CivilizationInfo, centerOnTech: Tec
|
|||||||
isFreeTechPick = freeTechPick
|
isFreeTechPick = freeTechPick
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
init {
|
init {
|
||||||
setDefaultCloseAction()
|
setDefaultCloseAction()
|
||||||
onBackButtonClicked { UncivGame.Current.setWorldScreen() }
|
onBackButtonClicked { UncivGame.Current.setWorldScreen() }
|
||||||
scrollPane.setOverscroll(false,false)
|
scrollPane.setOverscroll(false,false)
|
||||||
tempTechsToResearch = ArrayList(civTech.techsToResearch)
|
tempTechsToResearch = ArrayList(civTech.techsToResearch)
|
||||||
|
|
||||||
val columns = GameBasics.Technologies.values.map { it.column!!.columnNumber}.max()!! +1
|
createTechTable()
|
||||||
val techMatrix = Array<Array<Technology?>>(columns) { arrayOfNulls(10) } // Divided into columns, then rows
|
|
||||||
|
|
||||||
for (technology in GameBasics.Technologies.values) {
|
|
||||||
techMatrix[technology.column!!.columnNumber][technology.row - 1] = technology
|
|
||||||
}
|
|
||||||
|
|
||||||
val erasName = arrayOf("Ancient","Classical","Medieval","Renaissance","Industrial","Modern","Information","Future")
|
|
||||||
for (i in 0..7) {
|
|
||||||
val j = if (erasName[i]!="Ancient" && erasName[i]!="Future") 2 else 3
|
|
||||||
if (i%2==0) topTable.add((erasName[i]+" era").toLabel().addBorder(2f, Color.BLUE)).fill().colspan(j)
|
|
||||||
else topTable.add((erasName[i]+" era").toLabel().addBorder(2f, Color.FIREBRICK)).fill().colspan(j)
|
|
||||||
}
|
|
||||||
|
|
||||||
// Create tech table (row by row)
|
|
||||||
createTechTable(techMatrix)
|
|
||||||
|
|
||||||
setButtonsInfo()
|
setButtonsInfo()
|
||||||
rightSideButton.setText("Pick a tech".tr())
|
rightSideButton.setText("Pick a tech".tr())
|
||||||
@ -89,7 +75,21 @@ class TechPickerScreen(internal val civInfo: CivilizationInfo, centerOnTech: Tec
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun createTechTable(techMatrix: Array<Array<Technology?>>) {
|
private fun createTechTable() {
|
||||||
|
val columns = GameBasics.Technologies.values.map { it.column!!.columnNumber}.max()!! +1
|
||||||
|
val techMatrix = Array<Array<Technology?>>(columns) { arrayOfNulls(10) } // Divided into columns, then rows
|
||||||
|
|
||||||
|
for (technology in GameBasics.Technologies.values) {
|
||||||
|
techMatrix[technology.column!!.columnNumber][technology.row - 1] = technology
|
||||||
|
}
|
||||||
|
|
||||||
|
val erasName = arrayOf("Ancient","Classical","Medieval","Renaissance","Industrial","Modern","Information","Future")
|
||||||
|
for (i in 0..7) {
|
||||||
|
val j = if (erasName[i]!="Ancient" && erasName[i]!="Future") 2 else 3
|
||||||
|
if (i%2==0) topTable.add((erasName[i]+" era").toLabel().addBorder(2f, Color.BLUE)).fill().colspan(j)
|
||||||
|
else topTable.add((erasName[i]+" era").toLabel().addBorder(2f, Color.FIREBRICK)).fill().colspan(j)
|
||||||
|
}
|
||||||
|
|
||||||
for (i in 0..9) {
|
for (i in 0..9) {
|
||||||
topTable.row().pad(5f).padRight(40f)
|
topTable.row().pad(5f).padRight(40f)
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user