Added tech icons for ancient & classical technologies
24
Credits.md
@ -201,3 +201,27 @@ All the following are from [the Noun Project](https://thenounproject.com) licenc
|
|||||||
* [City](https://thenounproject.com/search/?q=city&i=571332) By Felix Westphal
|
* [City](https://thenounproject.com/search/?q=city&i=571332) By Felix Westphal
|
||||||
* [Fire](https://thenounproject.com/search/?q=Fire&i=96564) By Lloyd Humphreys
|
* [Fire](https://thenounproject.com/search/?q=Fire&i=96564) By Lloyd Humphreys
|
||||||
* [Sleep](https://thenounproject.com/search/?q=sleep&i=1760085) By Saeful Muslim
|
* [Sleep](https://thenounproject.com/search/?q=sleep&i=1760085) By Saeful Muslim
|
||||||
|
|
||||||
|
## Technologies
|
||||||
|
|
||||||
|
### Ancient
|
||||||
|
|
||||||
|
* [Agriculture](https://thenounproject.com/term/agriculture/4221/) By OCHA Visual Information Unit
|
||||||
|
* [Jug](https://thenounproject.com/term/jug/869999/) By Vladimir Belochkin
|
||||||
|
* [Archery](https://thenounproject.com/term/archery/213836/) By icon 54
|
||||||
|
* [Mining](https://thenounproject.com/term/mining/1400713/) By art shop
|
||||||
|
* [Sundial](https://thenounproject.com/term/sundial/239627/) By Bonegolem
|
||||||
|
* [Cuneiform](https://thenounproject.com/term/cuneiform/86669/) By Michael Wohlwend
|
||||||
|
* [Trap](https://thenounproject.com/term/trap/130049/) By Sergey Demushkin
|
||||||
|
* [innovative](https://thenounproject.com/term/innovative/30219/) By Matt Brooks
|
||||||
|
* [Bricks](https://thenounproject.com/term/bricks/1018659/) By Vaibhav Radhakrishnan
|
||||||
|
* [Mallet](https://thenounproject.com/term/mallet/1306669/) By Ben Avery
|
||||||
|
|
||||||
|
## Classical
|
||||||
|
* [Horse Riding](https://thenounproject.com/term/horse-riding/583093/) By Hea Poh Lin
|
||||||
|
* [Abacus](https://thenounproject.com/term/abacus/1943303/) By Yo! Baba
|
||||||
|
* [Arch](https://thenounproject.com/term/arch/1174168/) By Andrejs Kirma
|
||||||
|
* [Brain](https://thenounproject.com/term/brain/64073/) By Tony Gines
|
||||||
|
* [Coins](https://thenounproject.com/term/coins/1806100/) By Adrien Coquet
|
||||||
|
* [Engineering Blueprint](https://thenounproject.com/term/engineering-blueprint/1588543/) By Sachin Modgekar
|
||||||
|
* [Metalworking](https://thenounproject.com/term/metalworking/1561383/) By Symbolon
|
BIN
android/Images/TechIcons/Agriculture.png
Normal file
After Width: | Height: | Size: 4.3 KiB |
BIN
android/Images/TechIcons/Animal Husbandry.png
Normal file
After Width: | Height: | Size: 1.3 KiB |
BIN
android/Images/TechIcons/Archery.png
Normal file
After Width: | Height: | Size: 1.9 KiB |
BIN
android/Images/TechIcons/Bronze Working.png
Normal file
After Width: | Height: | Size: 1.3 KiB |
BIN
android/Images/TechIcons/Calendar.png
Normal file
After Width: | Height: | Size: 2.9 KiB |
BIN
android/Images/TechIcons/Construction.png
Normal file
After Width: | Height: | Size: 1.0 KiB |
BIN
android/Images/TechIcons/Currency.png
Normal file
After Width: | Height: | Size: 3.1 KiB |
BIN
android/Images/TechIcons/Engineering.png
Normal file
After Width: | Height: | Size: 1.8 KiB |
BIN
android/Images/TechIcons/Horseback Riding.png
Normal file
After Width: | Height: | Size: 2.2 KiB |
BIN
android/Images/TechIcons/Iron Working.png
Normal file
After Width: | Height: | Size: 1.6 KiB |
BIN
android/Images/TechIcons/Masonry.png
Normal file
After Width: | Height: | Size: 542 B |
BIN
android/Images/TechIcons/Mathematics.png
Normal file
After Width: | Height: | Size: 1.9 KiB |
BIN
android/Images/TechIcons/Mining.png
Normal file
After Width: | Height: | Size: 2.8 KiB |
BIN
android/Images/TechIcons/Philosophy.png
Normal file
After Width: | Height: | Size: 1.5 KiB |
BIN
android/Images/TechIcons/Pottery.png
Normal file
After Width: | Height: | Size: 3.0 KiB |
BIN
android/Images/TechIcons/The Wheel.png
Normal file
After Width: | Height: | Size: 2.5 KiB |
BIN
android/Images/TechIcons/Trapping.png
Normal file
After Width: | Height: | Size: 2.4 KiB |
BIN
android/Images/TechIcons/Writing.png
Normal file
After Width: | Height: | Size: 1.9 KiB |
Before Width: | Height: | Size: 767 KiB After Width: | Height: | Size: 802 KiB |
@ -21,8 +21,8 @@ android {
|
|||||||
applicationId "com.unciv.game"
|
applicationId "com.unciv.game"
|
||||||
minSdkVersion 14
|
minSdkVersion 14
|
||||||
targetSdkVersion 26
|
targetSdkVersion 26
|
||||||
versionCode 140
|
versionCode 141
|
||||||
versionName "2.8.8"
|
versionName "2.8.9"
|
||||||
}
|
}
|
||||||
buildTypes {
|
buildTypes {
|
||||||
release {
|
release {
|
||||||
|
@ -2,21 +2,18 @@ package com.unciv.ui.pickerscreens
|
|||||||
|
|
||||||
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.TextButton
|
import com.badlogic.gdx.scenes.scene2d.ui.Table
|
||||||
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
|
||||||
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
|
||||||
import com.unciv.ui.utils.CameraStageBaseScreen
|
import com.unciv.ui.utils.*
|
||||||
import com.unciv.ui.utils.onClick
|
|
||||||
import com.unciv.ui.utils.disable
|
|
||||||
import com.unciv.ui.utils.tr
|
|
||||||
import java.util.*
|
import java.util.*
|
||||||
|
|
||||||
class TechPickerScreen(internal val civInfo: CivilizationInfo) : PickerScreen() {
|
class TechPickerScreen(internal val civInfo: CivilizationInfo) : PickerScreen() {
|
||||||
|
|
||||||
private var techNameToButton = HashMap<String, TextButton>()
|
private var techNameToButton = HashMap<String, TechButton>()
|
||||||
private var isFreeTechPick: Boolean = false
|
private var isFreeTechPick: Boolean = false
|
||||||
private var selectedTech: Technology? = null
|
private var selectedTech: Technology? = null
|
||||||
private var civTech: TechManager = civInfo.tech
|
private var civTech: TechManager = civInfo.tech
|
||||||
@ -25,13 +22,31 @@ class TechPickerScreen(internal val civInfo: CivilizationInfo) : PickerScreen()
|
|||||||
// All these are to counter performance problems when updating buttons for all techs.
|
// All these are to counter performance problems when updating buttons for all techs.
|
||||||
private var researchableTechs = GameBasics.Technologies.keys
|
private var researchableTechs = GameBasics.Technologies.keys
|
||||||
.filter { civTech.canBeResearched(it) }.toHashSet()
|
.filter { civTech.canBeResearched(it) }.toHashSet()
|
||||||
private val lightBlue = Color.BLUE.cpy().lerp(Color.WHITE, 0.3f)
|
|
||||||
|
private val currentTechColor = colorFromRGB(7,46,43)
|
||||||
|
private val researchedTechColor = colorFromRGB(133,112,39)
|
||||||
|
private val researchableTechColor = colorFromRGB(28,170,0)
|
||||||
|
private val queuedTechColor = colorFromRGB(39,114,154)
|
||||||
|
|
||||||
|
|
||||||
private val turnsToTech = GameBasics.Technologies.values.associateBy ({ it.name },{civTech.turnsToTech(it.name)})
|
private val turnsToTech = GameBasics.Technologies.values.associateBy ({ it.name },{civTech.turnsToTech(it.name)})
|
||||||
|
|
||||||
constructor(freeTechPick: Boolean, civInfo: CivilizationInfo) : this(civInfo) {
|
constructor(freeTechPick: Boolean, civInfo: CivilizationInfo) : this(civInfo) {
|
||||||
isFreeTechPick = freeTechPick
|
isFreeTechPick = freeTechPick
|
||||||
}
|
}
|
||||||
|
|
||||||
|
class TechButton(techName:String) : Table(skin) {
|
||||||
|
val text=Label("",skin).setFontColor(Color.WHITE)
|
||||||
|
init {
|
||||||
|
defaults().pad(10f)
|
||||||
|
background = ImageGetter.getDrawable("OtherIcons/civTableBackground.png")
|
||||||
|
if(ImageGetter.techIconExists(techName))
|
||||||
|
add(ImageGetter.getTechIcon(techName)).size(40f)
|
||||||
|
add(text)
|
||||||
|
pack()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
init {
|
init {
|
||||||
onBackButtonClicked { UnCivGame.Current.setWorldScreen(); dispose() }
|
onBackButtonClicked { UnCivGame.Current.setWorldScreen(); dispose() }
|
||||||
|
|
||||||
@ -57,7 +72,8 @@ class TechPickerScreen(internal val civInfo: CivilizationInfo) : PickerScreen()
|
|||||||
topTable.add() // empty cell
|
topTable.add() // empty cell
|
||||||
|
|
||||||
else {
|
else {
|
||||||
val TB = TextButton("", CameraStageBaseScreen.skin)
|
val TB = TechButton(tech.name)
|
||||||
|
|
||||||
techNameToButton[tech.name] = TB
|
techNameToButton[tech.name] = TB
|
||||||
TB.onClick {
|
TB.onClick {
|
||||||
selectTechnology(tech)
|
selectTechnology(tech)
|
||||||
@ -91,9 +107,10 @@ class TechPickerScreen(internal val civInfo: CivilizationInfo) : PickerScreen()
|
|||||||
for (techName in techNameToButton.keys) {
|
for (techName in techNameToButton.keys) {
|
||||||
val TB = techNameToButton[techName]!!
|
val TB = techNameToButton[techName]!!
|
||||||
when {
|
when {
|
||||||
civTech.isResearched(techName) && techName!="Future Tech" -> TB.color = Color.GREEN
|
civTech.isResearched(techName) && techName!="Future Tech" -> TB.color = researchedTechColor
|
||||||
techsToResearch.contains(techName) -> TB.color = lightBlue
|
techsToResearch.isNotEmpty() && techsToResearch.first() == techName -> TB.color = currentTechColor
|
||||||
researchableTechs.contains(techName) -> TB.color = Color.WHITE
|
techsToResearch.contains(techName) -> TB.color = queuedTechColor
|
||||||
|
researchableTechs.contains(techName) -> TB.color = researchableTechColor
|
||||||
else -> TB.color = Color.BLACK
|
else -> TB.color = Color.BLACK
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -110,7 +127,7 @@ class TechPickerScreen(internal val civInfo: CivilizationInfo) : PickerScreen()
|
|||||||
if (!civTech.isResearched(techName) || techName=="Future Tech")
|
if (!civTech.isResearched(techName) || techName=="Future Tech")
|
||||||
text += "\r\n" + turnsToTech[techName] + " {turns}".tr()
|
text += "\r\n" + turnsToTech[techName] + " {turns}".tr()
|
||||||
|
|
||||||
TB.setText(text)
|
TB.text.setText(text)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -52,6 +52,14 @@ object ImageGetter {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fun techIconExists(techName:String): Boolean {
|
||||||
|
return atlas.findRegion("TechIcons/$techName")!=null
|
||||||
|
}
|
||||||
|
|
||||||
|
fun getTechIcon(techName: String): Image {
|
||||||
|
return getImage("TechIcons/$techName")
|
||||||
|
}
|
||||||
|
|
||||||
fun getStatIcon(statName: String): Image {
|
fun getStatIcon(statName: String): Image {
|
||||||
return ImageGetter.getImage("StatIcons/$statName")
|
return ImageGetter.getImage("StatIcons/$statName")
|
||||||
.apply { setSize(20f,20f)}
|
.apply { setSize(20f,20f)}
|
||||||
|
@ -3,6 +3,7 @@ package com.unciv.ui.worldscreen
|
|||||||
import com.badlogic.gdx.Gdx
|
import com.badlogic.gdx.Gdx
|
||||||
import com.badlogic.gdx.graphics.Color
|
import com.badlogic.gdx.graphics.Color
|
||||||
import com.badlogic.gdx.math.Vector2
|
import com.badlogic.gdx.math.Vector2
|
||||||
|
import com.badlogic.gdx.scenes.scene2d.ui.Label
|
||||||
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
|
||||||
@ -30,7 +31,7 @@ class WorldScreen : CameraStageBaseScreen() {
|
|||||||
val bottomBar = WorldScreenBottomBar(this)
|
val bottomBar = WorldScreenBottomBar(this)
|
||||||
val unitActionsTable = UnitActionsTable(this)
|
val unitActionsTable = UnitActionsTable(this)
|
||||||
|
|
||||||
private val techButton = TextButton("", CameraStageBaseScreen.skin).apply { color= Color.BLUE }
|
private val techButton = Table().apply { background=ImageGetter.getDrawable("OtherIcons/civTableBackground.png").tint(colorFromRGB(7,46,43)); defaults().pad(10f) }
|
||||||
val diplomacyButtonWrapper = Table()
|
val diplomacyButtonWrapper = Table()
|
||||||
private val nextTurnButton = createNextTurnButton()
|
private val nextTurnButton = createNextTurnButton()
|
||||||
|
|
||||||
@ -160,11 +161,17 @@ class WorldScreen : CameraStageBaseScreen() {
|
|||||||
private fun updateTechButton(civInfo: CivilizationInfo) {
|
private fun updateTechButton(civInfo: CivilizationInfo) {
|
||||||
techButton.isVisible = civInfo.cities.isNotEmpty()
|
techButton.isVisible = civInfo.cities.isNotEmpty()
|
||||||
|
|
||||||
|
techButton.clearChildren()
|
||||||
if (civInfo.tech.currentTechnology() == null)
|
if (civInfo.tech.currentTechnology() == null)
|
||||||
techButton.setText("{Pick a tech}!".tr())
|
techButton.add(Label("{Pick a tech}!".tr(),skin).setFontColor(Color.WHITE).setFont(22))
|
||||||
else
|
else {
|
||||||
techButton.setText(civInfo.tech.currentTechnology()!!.tr() + "\r\n"
|
val tech = civInfo.tech.currentTechnology()!!
|
||||||
+ civInfo.tech.turnsToTech(civInfo.tech.currentTechnology()!!) + " {turns}".tr())
|
if(ImageGetter.techIconExists(tech))
|
||||||
|
techButton.add(ImageGetter.getTechIcon(tech)).size(30f)
|
||||||
|
techButton.add(Label(tech.tr() + "\r\n"
|
||||||
|
+ civInfo.tech.turnsToTech(tech) + " {turns}".tr(),skin)
|
||||||
|
.setFontColor(Color.WHITE).setFont(22))
|
||||||
|
}
|
||||||
|
|
||||||
techButton.setSize(techButton.prefWidth, techButton.prefHeight)
|
techButton.setSize(techButton.prefWidth, techButton.prefHeight)
|
||||||
techButton.setPosition(10f, topBar.y - techButton.height - 5f)
|
techButton.setPosition(10f, topBar.y - techButton.height - 5f)
|
||||||
|