Addd basis for tech progress bar

This commit is contained in:
Yair Morgenstern
2018-10-01 23:50:37 +03:00
parent 8c7e8437ec
commit 47a61ccb29
2 changed files with 10 additions and 3 deletions

View File

@ -44,9 +44,10 @@ class TechManager {
else return 0
}
fun remainingScienceToTech(techName: String) = costOfTech(techName) - researchOfTech(techName)
fun turnsToTech(techName: String): Int {
val remainingScience = costOfTech(techName) - researchOfTech(techName)
return Math.ceil( remainingScience.toDouble()
return Math.ceil( remainingScienceToTech(techName).toDouble()
/ civInfo.getStatsForNextTurn().science).toInt()
}

View File

@ -3,6 +3,7 @@ package com.unciv.ui.worldscreen
import com.badlogic.gdx.Gdx
import com.badlogic.gdx.graphics.Color
import com.badlogic.gdx.math.Vector2
import com.badlogic.gdx.scenes.scene2d.Group
import com.badlogic.gdx.scenes.scene2d.ui.Label
import com.badlogic.gdx.scenes.scene2d.ui.Table
import com.badlogic.gdx.scenes.scene2d.ui.TextButton
@ -166,8 +167,13 @@ class WorldScreen : CameraStageBaseScreen() {
techButton.add(Label("{Pick a tech}!".tr(),skin).setFontColor(Color.WHITE).setFont(22))
else {
val tech = civInfo.tech.currentTechnology()!!
val height = 30f
if(ImageGetter.techIconExists(tech))
techButton.add(ImageGetter.getTechIcon(tech)).size(30f)
techButton.add(ImageGetter.getTechIcon(tech)).size(height)
val advancementGroup = Group()
val percentageComplete = civInfo.tech.costOfTech(tech) / civInfo.tech.costOfTech(tech).toFloat()
// todo
techButton.add()
techButton.add(Label(tech.tr() + "\r\n"
+ civInfo.tech.turnsToTech(tech) + " {turns}".tr(),skin)
.setFontColor(Color.WHITE).setFont(22))