Long tech descriptions are now scrollable

This commit is contained in:
Yair Morgenstern 2020-12-19 20:53:48 +02:00
parent e3f1c33654
commit d56433857b

View File

@ -1,12 +1,12 @@
package com.unciv.ui.worldscreen package com.unciv.ui.worldscreen
import com.badlogic.gdx.scenes.scene2d.ui.ScrollPane
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.Constants import com.unciv.Constants
import com.unciv.logic.civilization.AlertType import com.unciv.logic.civilization.AlertType
import com.unciv.logic.civilization.CivilizationInfo import com.unciv.logic.civilization.CivilizationInfo
import com.unciv.logic.civilization.PopupAlert import com.unciv.logic.civilization.PopupAlert
import com.unciv.models.translations.tr
import com.unciv.ui.utils.* import com.unciv.ui.utils.*
class AlertPopup(val worldScreen: WorldScreen, val popupAlert: PopupAlert): Popup(worldScreen) { class AlertPopup(val worldScreen: WorldScreen, val popupAlert: PopupAlert): Popup(worldScreen) {
@ -154,10 +154,10 @@ class AlertPopup(val worldScreen: WorldScreen, val popupAlert: PopupAlert): Popu
addGoodSizedLabel(wonder.name) addGoodSizedLabel(wonder.name)
addSeparator() addSeparator()
val centerTable = Table() val centerTable = Table()
centerTable.add(wonder.quote.toLabel().apply { setWrap(true) }).width(worldScreen.stage.width/3) centerTable.add(wonder.quote.toLabel().apply { wrap = true }).width(worldScreen.stage.width / 3)
centerTable.add(ImageGetter.getConstructionImage(wonder.name).surroundWithCircle(100f)).pad(20f) centerTable.add(ImageGetter.getConstructionImage(wonder.name).surroundWithCircle(100f)).pad(20f)
centerTable.add(wonder.getShortDescription(worldScreen.gameInfo.ruleSet) centerTable.add(wonder.getShortDescription(worldScreen.gameInfo.ruleSet)
.toLabel().apply { setWrap(true) }).width(worldScreen.stage.width/3) .toLabel().apply { wrap = true }).width(worldScreen.stage.width / 3)
add(centerTable).row() add(centerTable).row()
add(getCloseButton(Constants.close)) add(getCloseButton(Constants.close))
} }
@ -167,9 +167,10 @@ class AlertPopup(val worldScreen: WorldScreen, val popupAlert: PopupAlert): Popu
addGoodSizedLabel(tech.name) addGoodSizedLabel(tech.name)
addSeparator() addSeparator()
val centerTable = Table() val centerTable = Table()
centerTable.add(tech.quote.toLabel().apply { setWrap(true) }).width(worldScreen.stage.width/3) centerTable.add(tech.quote.toLabel().apply { wrap = true }).width(worldScreen.stage.width / 3)
centerTable.add(ImageGetter.getTechIconGroup(tech.name, 100f)).pad(20f) centerTable.add(ImageGetter.getTechIconGroup(tech.name, 100f)).pad(20f)
centerTable.add(tech.getDescription(gameBasics).toLabel().apply { setWrap(true) }).width(worldScreen.stage.width/3) val descriptionScroll = ScrollPane(tech.getDescription(gameBasics).toLabel().apply { wrap = true })
centerTable.add(descriptionScroll).width(worldScreen.stage.width / 3).maxHeight(worldScreen.stage.height / 2)
add(centerTable).row() add(centerTable).row()
add(getCloseButton(Constants.close)) add(getCloseButton(Constants.close))
} }