Fixed Ecology image

World screen now also displays icons of tech results
This commit is contained in:
Yair Morgenstern
2018-11-03 19:49:05 +02:00
parent 8b12b80f34
commit 3958ed3cdb
6 changed files with 380 additions and 378 deletions

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.7 KiB

After

Width:  |  Height:  |  Size: 2.4 KiB

View File

Before

Width:  |  Height:  |  Size: 2.6 KiB

After

Width:  |  Height:  |  Size: 2.6 KiB

File diff suppressed because it is too large Load Diff

Binary file not shown.

Before

Width:  |  Height:  |  Size: 920 KiB

After

Width:  |  Height:  |  Size: 914 KiB

View File

@ -4,6 +4,7 @@ import com.badlogic.gdx.graphics.Color
import com.badlogic.gdx.scenes.scene2d.Touchable import com.badlogic.gdx.scenes.scene2d.Touchable
import com.badlogic.gdx.scenes.scene2d.ui.Label 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.utils.Align
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
@ -37,7 +38,7 @@ class TechPickerScreen(internal val civInfo: CivilizationInfo) : PickerScreen()
} }
class TechButton(techName:String, val techManager:TechManager) : Table(skin) { class TechButton(techName:String, val techManager:TechManager) : Table(skin) {
val text=Label("",skin).setFontColor(Color.WHITE) val text=Label("",skin).setFontColor(Color.WHITE).apply { setAlignment(Align.center) }
init { init {
touchable = Touchable.enabled touchable = Touchable.enabled
defaults().pad(10f) defaults().pad(10f)
@ -50,13 +51,13 @@ class TechPickerScreen(internal val civInfo: CivilizationInfo) : PickerScreen()
val remainingTech = techManager.remainingScienceToTech(techName) val remainingTech = techManager.remainingScienceToTech(techName)
if(techCost!=remainingTech){ if(techCost!=remainingTech){
val percentComplete = (techCost-remainingTech)/techCost.toFloat() val percentComplete = (techCost-remainingTech)/techCost.toFloat()
add(ImageGetter.getProgressBarVertical(2f,30f,percentComplete, Color.BLUE, Color.WHITE)) add(ImageGetter.getProgressBarVertical(2f,50f,percentComplete, Color.BLUE, Color.WHITE))
} }
rightSide.add(text).row() rightSide.add(text).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()
techEnabledIcons.defaults().pad(2.5f) techEnabledIcons.defaults().pad(5f)
for(unit in GameBasics.Units.values.filter { it.requiredTech==techName for(unit in GameBasics.Units.values.filter { it.requiredTech==techName
&& (it.uniqueTo==null || it.uniqueTo==techManager.civInfo.civName) }) && (it.uniqueTo==null || it.uniqueTo==techManager.civInfo.civName) })

View File

@ -31,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 = Table().apply { background=ImageGetter.getDrawable("OtherIcons/civTableBackground.png").tint(colorFromRGB(7,46,43)); defaults().pad(10f) } private val techButton = Table()
val diplomacyButtonWrapper = Table() val diplomacyButtonWrapper = Table()
private val nextTurnButton = createNextTurnButton() private val nextTurnButton = createNextTurnButton()
@ -170,19 +170,20 @@ class WorldScreen : CameraStageBaseScreen() {
techButton.isVisible = civInfo.cities.isNotEmpty() techButton.isVisible = civInfo.cities.isNotEmpty()
techButton.clearChildren() techButton.clearChildren()
if (civInfo.tech.currentTechnology() == null)
techButton.add(Label("{Pick a tech}!".tr(),skin).setFontColor(Color.WHITE).setFont(22)) if (civInfo.tech.currentTechnology() == null) {
val buttonPic = Table().apply { background = ImageGetter.getDrawable("OtherIcons/civTableBackground.png").tint(colorFromRGB(7, 46, 43)); defaults().pad(10f) }
buttonPic.add(Label("{Pick a tech}!".tr(), skin).setFontColor(Color.WHITE).setFont(22))
techButton.add(buttonPic)
}
else { else {
val tech = civInfo.tech.currentTechnology()!! val currentTech = civInfo.tech.currentTechnology()!!
if(ImageGetter.techIconExists(tech)) val innerButton = TechPickerScreen.TechButton(currentTech,civInfo.tech)
techButton.add(ImageGetter.getTechIconGroup(tech)) innerButton.color = colorFromRGB(7, 46, 43)
val costOfTech = civInfo.tech.costOfTech(tech).toFloat() techButton.add(innerButton)
val percentComplete = (costOfTech-civInfo.tech.remainingScienceToTech(tech)) / costOfTech val turnsToTech = civInfo.tech.turnsToTech(currentTech)
techButton.add(ImageGetter.getProgressBarVertical(2f,30f,percentComplete, Color.BLUE, Color.WHITE)) innerButton.text.setText(currentTech.tr() + "\r\n" + turnsToTech
val turnsToTech = civInfo.tech.turnsToTech(tech) + (if(turnsToTech>1) " {turns}".tr() else " {turn}".tr()))
techButton.add(Label(tech.tr() + "\r\n"
+ turnsToTech + (if(turnsToTech>1) " {turns}".tr() else " {turn}".tr()),skin)
.setFontColor(Color.WHITE).setFont(22))
} }
techButton.setSize(techButton.prefWidth, techButton.prefHeight) techButton.setSize(techButton.prefWidth, techButton.prefHeight)