mirror of
https://github.com/yairm210/Unciv.git
synced 2025-07-04 15:27:50 +07:00
Rename: Changed CameraStageBaseScreen to BaseScreen
This commit is contained in:
@ -25,7 +25,7 @@ import com.unciv.ui.utils.*
|
||||
import com.unciv.ui.utils.UncivTooltip.Companion.addTooltip
|
||||
import kotlin.concurrent.thread
|
||||
|
||||
class MainMenuScreen: CameraStageBaseScreen() {
|
||||
class MainMenuScreen: BaseScreen() {
|
||||
private val autosave = "Autosave"
|
||||
private val backgroundTable = Table().apply { background=ImageGetter.getBackground(Color.WHITE) }
|
||||
private val singleColumn = isCrampedPortrait()
|
||||
|
@ -95,7 +95,7 @@ class UncivGame(parameters: UncivGameParameters) : Game() {
|
||||
settings.tileSet = "FantasyHex"
|
||||
}
|
||||
|
||||
CameraStageBaseScreen.setSkin() // needs to come AFTER the Texture reset, since the buttons depend on it
|
||||
BaseScreen.setSkin() // needs to come AFTER the Texture reset, since the buttons depend on it
|
||||
|
||||
Gdx.graphics.isContinuousRendering = settings.continuousRendering
|
||||
|
||||
@ -140,7 +140,7 @@ class UncivGame(parameters: UncivGameParameters) : Game() {
|
||||
}
|
||||
}
|
||||
|
||||
fun setScreen(screen: CameraStageBaseScreen) {
|
||||
fun setScreen(screen: BaseScreen) {
|
||||
Gdx.input.inputProcessor = screen.stage
|
||||
super.setScreen(screen)
|
||||
}
|
||||
@ -199,7 +199,7 @@ class UncivGame(parameters: UncivGameParameters) : Game() {
|
||||
}
|
||||
}
|
||||
|
||||
private class LoadingScreen : CameraStageBaseScreen() {
|
||||
private class LoadingScreen : BaseScreen() {
|
||||
init {
|
||||
val happinessImage = ImageGetter.getExternalImage("LoadScreen.png")
|
||||
happinessImage.center(stage)
|
||||
|
@ -33,7 +33,7 @@ class CityConstructionsTable(private val cityScreen: CityScreen) {
|
||||
private var preferredBuyStat = Stat.Gold // Used for keyboard buy
|
||||
var improvementBuildingToConstruct: Building? = null
|
||||
|
||||
private val upperTable = Table(CameraStageBaseScreen.skin)
|
||||
private val upperTable = Table(BaseScreen.skin)
|
||||
private val showCityInfoTableButton = "Show stats drilldown".toTextButton()
|
||||
private val constructionsQueueScrollPane: ScrollPane
|
||||
private val constructionsQueueTable = Table()
|
||||
|
@ -13,7 +13,7 @@ import com.unciv.ui.utils.*
|
||||
import java.text.DecimalFormat
|
||||
import com.unciv.ui.utils.AutoScrollPane as ScrollPane
|
||||
|
||||
class CityInfoTable(private val cityScreen: CityScreen) : Table(CameraStageBaseScreen.skin) {
|
||||
class CityInfoTable(private val cityScreen: CityScreen) : Table(BaseScreen.skin) {
|
||||
private val pad = 10f
|
||||
|
||||
private val showConstructionsTableButton = "Show construction queue".toTextButton()
|
||||
|
@ -9,7 +9,7 @@ import com.unciv.ui.utils.*
|
||||
class CityReligionInfoTable(
|
||||
private val religionManager: CityInfoReligionManager,
|
||||
showMajority: Boolean = false
|
||||
) : Table(CameraStageBaseScreen.skin) {
|
||||
) : Table(BaseScreen.skin) {
|
||||
private val gameInfo = religionManager.cityInfo.civInfo.gameInfo
|
||||
|
||||
init {
|
||||
|
@ -18,7 +18,7 @@ class CityScreen(
|
||||
internal val city: CityInfo,
|
||||
var selectedConstruction: IConstruction? = null,
|
||||
var selectedTile: TileInfo? = null
|
||||
): CameraStageBaseScreen() {
|
||||
): BaseScreen() {
|
||||
companion object {
|
||||
/** Distance from stage edges to floating widgets */
|
||||
const val posFromEdge = 5f
|
||||
|
@ -7,7 +7,7 @@ import com.badlogic.gdx.utils.Align
|
||||
import com.unciv.UncivGame
|
||||
import com.unciv.ui.utils.*
|
||||
|
||||
class SpecialistAllocationTable(val cityScreen: CityScreen): Table(CameraStageBaseScreen.skin){
|
||||
class SpecialistAllocationTable(val cityScreen: CityScreen): Table(BaseScreen.skin){
|
||||
val cityInfo = cityScreen.city
|
||||
|
||||
fun update() {
|
||||
|
@ -26,7 +26,7 @@ class CivilopediaScreen(
|
||||
val ruleset: Ruleset
|
||||
, category: CivilopediaCategories = CivilopediaCategories.Tutorial
|
||||
, link: String = ""
|
||||
) : CameraStageBaseScreen() {
|
||||
) : BaseScreen() {
|
||||
|
||||
/** Container collecting data per Civilopedia entry
|
||||
* @param name From [Ruleset] object [INamed.name]
|
||||
|
@ -233,7 +233,7 @@ class FormattedLine (
|
||||
*/
|
||||
fun render(labelWidth: Float, iconDisplay: IconDisplay = IconDisplay.All): Actor {
|
||||
if (extraImage.isNotEmpty()) {
|
||||
val table = Table(CameraStageBaseScreen.skin)
|
||||
val table = Table(BaseScreen.skin)
|
||||
try {
|
||||
val image = when {
|
||||
ImageGetter.imageExists(extraImage) ->
|
||||
@ -260,7 +260,7 @@ class FormattedLine (
|
||||
}
|
||||
val labelColor = if(starred) defaultColor else displayColor
|
||||
|
||||
val table = Table(CameraStageBaseScreen.skin)
|
||||
val table = Table(BaseScreen.skin)
|
||||
var iconCount = 0
|
||||
val iconSize = max(minIconSize, fontSize * 1.5f)
|
||||
if (linkType != LinkType.None && iconDisplay == IconDisplay.All) {
|
||||
@ -367,7 +367,7 @@ object MarkupRenderer {
|
||||
iconDisplay: FormattedLine.IconDisplay = FormattedLine.IconDisplay.All,
|
||||
linkAction: ((id: String) -> Unit)? = null
|
||||
): Table {
|
||||
val skin = CameraStageBaseScreen.skin
|
||||
val skin = BaseScreen.skin
|
||||
val table = Table(skin).apply { defaults().pad(padding).align(Align.left) }
|
||||
for (line in lines) {
|
||||
if (line.isEmpty()) {
|
||||
|
@ -51,7 +51,7 @@ class MapEditorMenuPopup(var mapEditorScreen: MapEditorScreen): Popup(mapEditorS
|
||||
ImageGetter.setNewRuleset(ruleset)
|
||||
}
|
||||
|
||||
val combinedTable = Table(CameraStageBaseScreen.skin)
|
||||
val combinedTable = Table(BaseScreen.skin)
|
||||
|
||||
val baseRulesetSelectionBox = getBaseRulesetSelectBox()
|
||||
if (baseRulesetSelectionBox != null) {
|
||||
@ -108,7 +108,7 @@ class MapEditorMenuPopup(var mapEditorScreen: MapEditorScreen): Popup(mapEditorS
|
||||
if (sortedBaseRulesets.size < 2) return null
|
||||
|
||||
rulesetSelectionBox.add("{Base Ruleset}:".toLabel()).left()
|
||||
val selectBox = TranslatedSelectBox(sortedBaseRulesets, mapParameters.baseRuleset, CameraStageBaseScreen.skin)
|
||||
val selectBox = TranslatedSelectBox(sortedBaseRulesets, mapParameters.baseRuleset, BaseScreen.skin)
|
||||
|
||||
val onChange = onChange@{ newBaseRuleset: String ->
|
||||
val previousSelection = mapParameters.baseRuleset
|
||||
|
@ -19,7 +19,7 @@ import com.unciv.ui.tilegroups.TileGroup
|
||||
import com.unciv.ui.tilegroups.TileSetStrings
|
||||
import com.unciv.ui.utils.*
|
||||
|
||||
class MapEditorOptionsTable(val mapEditorScreen: MapEditorScreen): Table(CameraStageBaseScreen.skin) {
|
||||
class MapEditorOptionsTable(val mapEditorScreen: MapEditorScreen): Table(BaseScreen.skin) {
|
||||
private val tileSetLocation = "TileSets/" + UncivGame.Current.settings.tileSet + "/"
|
||||
|
||||
var tileAction: (TileInfo) -> Unit = {}
|
||||
|
@ -18,7 +18,7 @@ import com.unciv.models.metadata.GameSetupInfo
|
||||
import com.unciv.models.translations.tr
|
||||
import com.unciv.ui.utils.*
|
||||
|
||||
class MapEditorScreen(): CameraStageBaseScreen() {
|
||||
class MapEditorScreen(): BaseScreen() {
|
||||
var mapName = ""
|
||||
var tileMap = TileMap()
|
||||
var ruleset = Ruleset().apply { add(RulesetCache.getBaseRuleset()) }
|
||||
|
@ -85,7 +85,7 @@ class NewMapScreen(val mapParameters: MapParameters = getDefaultParameters()) :
|
||||
val message = mapParameters.mapSize.fixUndesiredSizes(mapParameters.worldWrap)
|
||||
if (message != null) {
|
||||
Gdx.app.postRunnable {
|
||||
ToastPopup( message, UncivGame.Current.screen as CameraStageBaseScreen, 4000 )
|
||||
ToastPopup( message, UncivGame.Current.screen as BaseScreen, 4000 )
|
||||
with (mapParameters.mapSize) {
|
||||
mapParametersTable.customMapSizeRadius.text = radius.toString()
|
||||
mapParametersTable.customMapWidth.text = width.toString()
|
||||
|
@ -17,7 +17,7 @@ import com.unciv.ui.utils.*
|
||||
import kotlin.concurrent.thread
|
||||
import com.unciv.ui.utils.AutoScrollPane as ScrollPane
|
||||
|
||||
class SaveAndLoadMapScreen(mapToSave: TileMap?, save:Boolean = false, previousScreen: CameraStageBaseScreen)
|
||||
class SaveAndLoadMapScreen(mapToSave: TileMap?, save:Boolean = false, previousScreen: BaseScreen)
|
||||
: PickerScreen(disableScroll = true) {
|
||||
private var chosenMap: FileHandle? = null
|
||||
val deleteButton = "Delete map".toTextButton()
|
||||
|
@ -13,7 +13,7 @@ import java.util.concurrent.ConcurrentHashMap
|
||||
import kotlin.concurrent.thread
|
||||
import com.unciv.ui.utils.AutoScrollPane as ScrollPane
|
||||
|
||||
class MultiplayerScreen(previousScreen: CameraStageBaseScreen) : PickerScreen() {
|
||||
class MultiplayerScreen(previousScreen: BaseScreen) : PickerScreen() {
|
||||
|
||||
private lateinit var selectedGameFile: FileHandle
|
||||
|
||||
|
@ -17,7 +17,7 @@ class GameOptionsTable(
|
||||
val previousScreen: IPreviousScreen,
|
||||
val isPortrait: Boolean = false,
|
||||
val updatePlayerPickerTable:(desiredCiv:String)->Unit
|
||||
) : Table(CameraStageBaseScreen.skin) {
|
||||
) : Table(BaseScreen.skin) {
|
||||
var gameParameters = previousScreen.gameSetupInfo.gameParameters
|
||||
val ruleset = previousScreen.ruleset
|
||||
var locked = false
|
||||
@ -132,7 +132,7 @@ class GameOptionsTable(
|
||||
|
||||
private fun Table.addSelectBox(text: String, values: Collection<String>, initialState: String, onChange: (newValue: String) -> String?) {
|
||||
add(text.toLabel()).left()
|
||||
val selectBox = TranslatedSelectBox(values, initialState, CameraStageBaseScreen.skin)
|
||||
val selectBox = TranslatedSelectBox(values, initialState, BaseScreen.skin)
|
||||
selectBox.isDisabled = locked
|
||||
selectBox.onChange {
|
||||
val changedValue = onChange(selectBox.selected.value)
|
||||
@ -163,7 +163,7 @@ class GameOptionsTable(
|
||||
val baseRulesetErrors = RulesetCache[newBaseRuleset]!!.checkModLinks()
|
||||
if (baseRulesetErrors.isError()) {
|
||||
val toastMessage = "The mod you selected is incorrectly defined!".tr() + "\n\n${baseRulesetErrors.getErrorText()}"
|
||||
ToastPopup(toastMessage, previousScreen as CameraStageBaseScreen, 5000L)
|
||||
ToastPopup(toastMessage, previousScreen as BaseScreen, 5000L)
|
||||
return@addSelectBox previousSelection
|
||||
}
|
||||
|
||||
@ -178,14 +178,14 @@ class GameOptionsTable(
|
||||
reloadRuleset()
|
||||
val toastMessage =
|
||||
"This base ruleset is not compatible with the previously selected\nextension mods. They have been disabled.".tr()
|
||||
ToastPopup(toastMessage, previousScreen as CameraStageBaseScreen, 5000L)
|
||||
ToastPopup(toastMessage, previousScreen as BaseScreen, 5000L)
|
||||
|
||||
modCheckboxes!!.disableAllCheckboxes()
|
||||
} else if (modLinkErrors.isWarnUser()) {
|
||||
val toastMessage =
|
||||
"{The mod combination you selected has problems.}\n{You can play it, but don't expect everything to work!}".tr() +
|
||||
"\n\n${modLinkErrors.getErrorText()}"
|
||||
ToastPopup(toastMessage, previousScreen as CameraStageBaseScreen, 5000L)
|
||||
ToastPopup(toastMessage, previousScreen as BaseScreen, 5000L)
|
||||
}
|
||||
|
||||
modCheckboxes!!.setBaseRuleset(newBaseRuleset)
|
||||
@ -244,7 +244,7 @@ class GameOptionsTable(
|
||||
}
|
||||
|
||||
fun getModCheckboxes(isPortrait: Boolean = false): ModCheckboxTable {
|
||||
return ModCheckboxTable(gameParameters.mods, gameParameters.baseRuleset, previousScreen as CameraStageBaseScreen, isPortrait) {
|
||||
return ModCheckboxTable(gameParameters.mods, gameParameters.baseRuleset, previousScreen as BaseScreen, isPortrait) {
|
||||
onChooseMod(it)
|
||||
}
|
||||
}
|
||||
|
@ -10,7 +10,7 @@ import com.unciv.logic.UncivShowableException
|
||||
import com.unciv.logic.map.MapType
|
||||
import com.unciv.logic.map.TileMap
|
||||
import com.unciv.models.ruleset.RulesetCache
|
||||
import com.unciv.ui.utils.CameraStageBaseScreen
|
||||
import com.unciv.ui.utils.BaseScreen
|
||||
import com.unciv.ui.utils.Popup
|
||||
import com.unciv.ui.utils.onChange
|
||||
import com.unciv.ui.utils.toLabel
|
||||
@ -42,7 +42,7 @@ class MapOptionsTable(private val newGameScreen: NewGameScreen): Table() {
|
||||
private fun addMapTypeSelection() {
|
||||
val mapTypes = arrayListOf("Generated")
|
||||
if (mapFilesSequence.any()) mapTypes.add(MapType.custom)
|
||||
mapTypeSelectBox = TranslatedSelectBox(mapTypes, "Generated", CameraStageBaseScreen.skin)
|
||||
mapTypeSelectBox = TranslatedSelectBox(mapTypes, "Generated", BaseScreen.skin)
|
||||
|
||||
savedMapOptionsTable.defaults().pad(5f)
|
||||
savedMapOptionsTable.add("{Map file}:".toLabel()).left()
|
||||
@ -84,7 +84,7 @@ class MapOptionsTable(private val newGameScreen: NewGameScreen): Table() {
|
||||
}
|
||||
|
||||
private fun createMapFileSelectBox(): SelectBox<FileHandleWrapper> {
|
||||
val mapFileSelectBox = SelectBox<FileHandleWrapper>(CameraStageBaseScreen.skin)
|
||||
val mapFileSelectBox = SelectBox<FileHandleWrapper>(BaseScreen.skin)
|
||||
mapFileSelectBox.onChange {
|
||||
val mapFile = mapFileSelectBox.selected.fileHandle
|
||||
val map: TileMap
|
||||
|
@ -42,7 +42,7 @@ class MapParametersTable(
|
||||
private val advancedSliders = HashMap<UncivSlider, ()->Float>()
|
||||
|
||||
init {
|
||||
skin = CameraStageBaseScreen.skin
|
||||
skin = BaseScreen.skin
|
||||
defaults().pad(5f, 10f)
|
||||
addMapShapeSelectBox()
|
||||
addMapTypeSelectBox()
|
||||
|
@ -12,7 +12,7 @@ import com.unciv.ui.utils.*
|
||||
class ModCheckboxTable(
|
||||
private val mods: LinkedHashSet<String>,
|
||||
private var baseRuleset: String,
|
||||
private val screen: CameraStageBaseScreen,
|
||||
private val screen: BaseScreen,
|
||||
isPortrait: Boolean = false,
|
||||
onUpdate: (String) -> Unit
|
||||
): Table(){
|
||||
|
@ -14,7 +14,7 @@ import com.unciv.ui.utils.*
|
||||
|
||||
// The ruleset also acts as a secondary parameter to determine if this is the right or self side of the player picker
|
||||
class NationTable(val nation: Nation, width: Float, minHeight: Float, ruleset: Ruleset? = null)
|
||||
: Table(CameraStageBaseScreen.skin) {
|
||||
: Table(BaseScreen.skin) {
|
||||
val innerTable = Table()
|
||||
|
||||
init {
|
||||
|
@ -22,7 +22,7 @@ import com.unciv.ui.utils.AutoScrollPane as ScrollPane
|
||||
|
||||
|
||||
class NewGameScreen(
|
||||
private val previousScreen: CameraStageBaseScreen,
|
||||
private val previousScreen: BaseScreen,
|
||||
_gameSetupInfo: GameSetupInfo? = null
|
||||
): IPreviousScreen, PickerScreen() {
|
||||
|
||||
@ -110,7 +110,7 @@ class NewGameScreen(
|
||||
val message = mapSize.fixUndesiredSizes(gameSetupInfo.mapParameters.worldWrap)
|
||||
if (message != null) {
|
||||
Gdx.app.postRunnable {
|
||||
ToastPopup( message, UncivGame.Current.screen as CameraStageBaseScreen, 4000 )
|
||||
ToastPopup( message, UncivGame.Current.screen as BaseScreen, 4000 )
|
||||
with (mapOptionsTable.generatedMapOptionsTable) {
|
||||
customMapSizeRadius.text = mapSize.radius.toString()
|
||||
customMapWidth.text = mapSize.width.toString()
|
||||
|
@ -27,13 +27,13 @@ import java.util.*
|
||||
|
||||
/**
|
||||
* This [Table] is used to pick or edit players information for new game creation.
|
||||
* Could be inserted to [NewGameScreen], [GameParametersScreen] or any other [Screen][CameraStageBaseScreen]
|
||||
* Could be inserted to [NewGameScreen], [GameParametersScreen] or any other [Screen][BaseScreen]
|
||||
* which provides [GameSetupInfo] and [Ruleset].
|
||||
* Upon player changes updates property [gameParameters]. Also updates available nations when mod changes.
|
||||
* In case it is used in map editor, as a part of [GameParametersScreen], additionally tries to
|
||||
* update units/starting location on the [previousScreen] when player deleted or
|
||||
* switched nation.
|
||||
* @param previousScreen A [Screen][CameraStageBaseScreen] where the player table is inserted, should provide [GameSetupInfo] as property, updated when a player is added/deleted/changed
|
||||
* @param previousScreen A [Screen][BaseScreen] where the player table is inserted, should provide [GameSetupInfo] as property, updated when a player is added/deleted/changed
|
||||
* @param gameParameters contains info about number of players.
|
||||
* @param blockWidth sets a width for the Civ "blocks". If too small a third of the stage is used.
|
||||
*/
|
||||
@ -157,7 +157,7 @@ class PlayerPickerTable(
|
||||
}
|
||||
if (gameParameters.isOnlineMultiplayer && player.playerType == PlayerType.Human) {
|
||||
|
||||
val playerIdTextField = TextField(player.playerId, CameraStageBaseScreen.skin)
|
||||
val playerIdTextField = TextField(player.playerId, BaseScreen.skin)
|
||||
playerIdTextField.messageText = "Please input Player ID!".tr()
|
||||
playerTable.add(playerIdTextField).colspan(2).fillX().pad(5f)
|
||||
val errorLabel = "✘".toLabel(Color.RED)
|
||||
@ -244,7 +244,7 @@ class PlayerPickerTable(
|
||||
private class NationPickerPopup(
|
||||
private val playerPicker: PlayerPickerTable,
|
||||
private val player: Player
|
||||
) : Popup(playerPicker.previousScreen as CameraStageBaseScreen) {
|
||||
) : Popup(playerPicker.previousScreen as BaseScreen) {
|
||||
companion object {
|
||||
// These are used for the Close/OK buttons in the lower left/right corners:
|
||||
const val buttonsCircleSize = 70f
|
||||
|
@ -135,7 +135,7 @@ class CityOverviewTable(private val viewingPlayer: CivilizationInfo, private val
|
||||
|
||||
val constructionCells: MutableList<Cell<Label>> = mutableListOf()
|
||||
for (city in cityList) {
|
||||
val button = Button(city.name.toLabel(), CameraStageBaseScreen.skin)
|
||||
val button = Button(city.name.toLabel(), BaseScreen.skin)
|
||||
button.onClick {
|
||||
overviewScreen.game.setScreen(CityScreen(city))
|
||||
}
|
||||
|
@ -13,7 +13,7 @@ import com.unciv.ui.utils.KeyPressDispatcher.Companion.keyboardAvailable
|
||||
import com.unciv.ui.utils.UncivTooltip.Companion.addTooltip
|
||||
import com.unciv.ui.utils.AutoScrollPane as ScrollPane
|
||||
|
||||
class EmpireOverviewScreen(private var viewingPlayer:CivilizationInfo, defaultPage: String = "") : CameraStageBaseScreen(){
|
||||
class EmpireOverviewScreen(private var viewingPlayer:CivilizationInfo, defaultPage: String = "") : BaseScreen(){
|
||||
private val topTable = Table().apply { defaults().pad(10f) }
|
||||
private val centerTable = Table().apply { defaults().pad(5f) }
|
||||
|
||||
|
@ -25,13 +25,13 @@ class ReligionOverviewTable(
|
||||
|
||||
val gameInfo = viewingPlayer.gameInfo
|
||||
|
||||
private val civStatsTable = Table(CameraStageBaseScreen.skin)
|
||||
private val civStatsTable = Table(BaseScreen.skin)
|
||||
|
||||
private val religionsTable = Table(CameraStageBaseScreen.skin)
|
||||
private val topButtons = Table(CameraStageBaseScreen.skin)
|
||||
private val religionsTable = Table(BaseScreen.skin)
|
||||
private val topButtons = Table(BaseScreen.skin)
|
||||
private val topButtonLabel = "Click an icon to see the stats of this religion".toLabel()
|
||||
private val statsTable = Table(CameraStageBaseScreen.skin)
|
||||
private val beliefsTable = Table(CameraStageBaseScreen.skin)
|
||||
private val statsTable = Table(BaseScreen.skin)
|
||||
private val beliefsTable = Table(BaseScreen.skin)
|
||||
private var selectedReligion: String? = null
|
||||
|
||||
init {
|
||||
@ -79,11 +79,11 @@ class ReligionOverviewTable(
|
||||
ImageGetter.getNationIndicator(gameInfo.getCivilization(religion.foundingCivName).nation, 60f)
|
||||
else
|
||||
ImageGetter.getRandomNationIndicator(60f)
|
||||
button = Button(image, CameraStageBaseScreen.skin)
|
||||
button = Button(image, BaseScreen.skin)
|
||||
} else {
|
||||
button = Button(
|
||||
ImageGetter.getCircledReligionIcon(religion.getIconName(), 60f),
|
||||
CameraStageBaseScreen.skin
|
||||
BaseScreen.skin
|
||||
)
|
||||
}
|
||||
|
||||
|
@ -25,9 +25,9 @@ class StatsOverviewTable (
|
||||
}
|
||||
|
||||
private fun getHappinessTable(): Table {
|
||||
val happinessTable = Table(CameraStageBaseScreen.skin)
|
||||
val happinessTable = Table(BaseScreen.skin)
|
||||
happinessTable.defaults().pad(5f)
|
||||
val happinessHeader = Table(CameraStageBaseScreen.skin)
|
||||
val happinessHeader = Table(BaseScreen.skin)
|
||||
happinessHeader.add(ImageGetter.getStatIcon("Happiness")).pad(5f,0f,5f,12f).size(20f)
|
||||
happinessHeader.add("Happiness".toLabel(fontSize = 24)).padTop(5f)
|
||||
happinessTable.add(happinessHeader).colspan(2).row()
|
||||
@ -46,9 +46,9 @@ class StatsOverviewTable (
|
||||
}
|
||||
|
||||
private fun getGoldTable(): Table {
|
||||
val goldTable = Table(CameraStageBaseScreen.skin)
|
||||
val goldTable = Table(BaseScreen.skin)
|
||||
goldTable.defaults().pad(5f)
|
||||
val goldHeader = Table(CameraStageBaseScreen.skin)
|
||||
val goldHeader = Table(BaseScreen.skin)
|
||||
goldHeader.add(ImageGetter.getStatIcon("Gold")).pad(5f, 0f, 5f, 12f).size(20f)
|
||||
goldHeader.add("Gold".toLabel(fontSize = 24)).padTop(5f)
|
||||
goldTable.add(goldHeader).colspan(2).row()
|
||||
@ -67,7 +67,7 @@ class StatsOverviewTable (
|
||||
goldTable.addSeparator()
|
||||
val sliderTable = Table()
|
||||
sliderTable.add("Convert gold to science".toLabel()).row()
|
||||
val slider = Slider(0f, 1f, 0.1f, false, CameraStageBaseScreen.skin)
|
||||
val slider = Slider(0f, 1f, 0.1f, false, BaseScreen.skin)
|
||||
slider.value = viewingPlayer.tech.goldPercentConvertedToScience
|
||||
|
||||
slider.onChange {
|
||||
@ -84,9 +84,9 @@ class StatsOverviewTable (
|
||||
}
|
||||
|
||||
private fun getScienceTable(): Table {
|
||||
val scienceTable = Table(CameraStageBaseScreen.skin)
|
||||
val scienceTable = Table(BaseScreen.skin)
|
||||
scienceTable.defaults().pad(5f)
|
||||
val scienceHeader = Table(CameraStageBaseScreen.skin)
|
||||
val scienceHeader = Table(BaseScreen.skin)
|
||||
scienceHeader.add(ImageGetter.getStatIcon("Science")).pad(5f,0f,5f,12f).size(20f)
|
||||
scienceHeader.add("Science".toLabel(fontSize = 24)).padTop(5f)
|
||||
scienceTable.add(scienceHeader).colspan(2).row()
|
||||
@ -104,10 +104,10 @@ class StatsOverviewTable (
|
||||
}
|
||||
|
||||
private fun getGreatPeopleTable(): Table {
|
||||
val greatPeopleTable = Table(CameraStageBaseScreen.skin)
|
||||
val greatPeopleTable = Table(BaseScreen.skin)
|
||||
|
||||
greatPeopleTable.defaults().pad(5f)
|
||||
val greatPeopleHeader = Table(CameraStageBaseScreen.skin)
|
||||
val greatPeopleHeader = Table(BaseScreen.skin)
|
||||
val greatPeopleIcon = ImageGetter.getStatIcon("Specialist")
|
||||
greatPeopleIcon.color = Color.ROYAL
|
||||
greatPeopleHeader.add(greatPeopleIcon).padRight(12f).size(30f)
|
||||
|
@ -4,7 +4,7 @@ import com.badlogic.gdx.scenes.scene2d.ui.Table
|
||||
import com.unciv.logic.civilization.CivilizationInfo
|
||||
import com.unciv.logic.trade.Trade
|
||||
import com.unciv.logic.trade.TradeOffersList
|
||||
import com.unciv.ui.utils.CameraStageBaseScreen
|
||||
import com.unciv.ui.utils.BaseScreen
|
||||
import com.unciv.ui.utils.ImageGetter
|
||||
import com.unciv.ui.utils.addSeparator
|
||||
import com.unciv.ui.utils.toLabel
|
||||
@ -35,7 +35,7 @@ class TradesOverviewTable (
|
||||
}
|
||||
|
||||
private fun createTradeTable(trade: Trade, otherCiv: CivilizationInfo): Table {
|
||||
val generalTable = Table(CameraStageBaseScreen.skin)
|
||||
val generalTable = Table(BaseScreen.skin)
|
||||
generalTable.add(createOffersTable(viewingPlayer, trade.ourOffers, trade.theirOffers.size)).minWidth(overviewScreen.stage.width/4).fillY()
|
||||
generalTable.add(createOffersTable(otherCiv, trade.theirOffers, trade.ourOffers.size)).minWidth(overviewScreen.stage.width/4).fillY()
|
||||
return generalTable
|
||||
|
@ -17,7 +17,7 @@ import kotlin.math.abs
|
||||
class UnitOverviewTable(
|
||||
private val viewingPlayer: CivilizationInfo,
|
||||
private val overviewScreen: EmpireOverviewScreen
|
||||
) : Table(CameraStageBaseScreen.skin) {
|
||||
) : Table(BaseScreen.skin) {
|
||||
|
||||
init {
|
||||
add(getUnitSupplyTable()).top().padRight(25f)
|
||||
@ -26,7 +26,7 @@ class UnitOverviewTable(
|
||||
}
|
||||
|
||||
private fun getUnitSupplyTable(): Table {
|
||||
val unitSupplyTable = Table(CameraStageBaseScreen.skin)
|
||||
val unitSupplyTable = Table(BaseScreen.skin)
|
||||
unitSupplyTable.defaults().pad(5f)
|
||||
unitSupplyTable.apply {
|
||||
add("Unit Supply".tr()).colspan(2).center().row()
|
||||
@ -62,7 +62,7 @@ class UnitOverviewTable(
|
||||
|
||||
private fun getUnitListTable(): Table {
|
||||
val game = overviewScreen.game
|
||||
val unitListTable = Table(CameraStageBaseScreen.skin)
|
||||
val unitListTable = Table(BaseScreen.skin)
|
||||
unitListTable.defaults().pad(5f)
|
||||
unitListTable.apply {
|
||||
add("Name".tr())
|
||||
|
@ -60,7 +60,7 @@ class ModManagementOptions(private val modManagementScreen: ModManagementScreen)
|
||||
}
|
||||
}
|
||||
|
||||
private val textField = TextField("", CameraStageBaseScreen.skin)
|
||||
private val textField = TextField("", BaseScreen.skin)
|
||||
fun getFilterText(): String = textField.text
|
||||
val filterAction: ()->Unit
|
||||
|
||||
@ -82,7 +82,7 @@ class ModManagementOptions(private val modManagementScreen: ModManagementScreen)
|
||||
sortInstalledSelect = TranslatedSelectBox(
|
||||
SortType.values().filter { sort -> sort != SortType.Stars }.map { sort -> sort.label },
|
||||
sortInstalled.label,
|
||||
CameraStageBaseScreen.skin
|
||||
BaseScreen.skin
|
||||
)
|
||||
sortInstalledSelect.onChange {
|
||||
sortInstalled = SortType.fromSelectBox(sortInstalledSelect)
|
||||
@ -92,7 +92,7 @@ class ModManagementOptions(private val modManagementScreen: ModManagementScreen)
|
||||
sortOnlineSelect = TranslatedSelectBox(
|
||||
SortType.values().map { sort -> sort.label },
|
||||
sortOnline.label,
|
||||
CameraStageBaseScreen.skin
|
||||
BaseScreen.skin
|
||||
)
|
||||
sortOnlineSelect.onChange {
|
||||
sortOnline = SortType.fromSelectBox(sortOnlineSelect)
|
||||
|
@ -6,7 +6,7 @@ import com.unciv.UncivGame
|
||||
import com.unciv.ui.utils.*
|
||||
import com.unciv.ui.utils.AutoScrollPane as ScrollPane
|
||||
|
||||
open class PickerScreen(disableScroll: Boolean = false) : CameraStageBaseScreen() {
|
||||
open class PickerScreen(disableScroll: Boolean = false) : BaseScreen() {
|
||||
/** The close button on the lower left of [bottomTable], see [setDefaultCloseAction] */
|
||||
protected var closeButton: TextButton = Constants.close.toTextButton()
|
||||
/** A scrollable wrapped Label you can use to show descriptions in the [bottomTable], starts empty */
|
||||
@ -63,7 +63,7 @@ open class PickerScreen(disableScroll: Boolean = false) : CameraStageBaseScreen(
|
||||
* Initializes the [Close button][closeButton]'s action (and the Back/ESC handler)
|
||||
* to return to the [previousScreen] if specified, or else to the world screen.
|
||||
*/
|
||||
fun setDefaultCloseAction(previousScreen: CameraStageBaseScreen?=null) {
|
||||
fun setDefaultCloseAction(previousScreen: BaseScreen?=null) {
|
||||
val closeAction = {
|
||||
if (previousScreen != null) game.setScreen(previousScreen)
|
||||
else game.setWorldScreen()
|
||||
|
@ -7,7 +7,7 @@ import com.badlogic.gdx.utils.Align
|
||||
import com.unciv.logic.civilization.TechManager
|
||||
import com.unciv.ui.utils.*
|
||||
|
||||
class TechButton(techName:String, private val techManager: TechManager, isWorldScreen: Boolean = true) : Table(CameraStageBaseScreen.skin) {
|
||||
class TechButton(techName:String, private val techManager: TechManager, isWorldScreen: Boolean = true) : Table(BaseScreen.skin) {
|
||||
val text = "".toLabel().apply { setAlignment(Align.center) }
|
||||
|
||||
init {
|
||||
|
@ -20,7 +20,7 @@ import java.util.concurrent.CancellationException
|
||||
import kotlin.concurrent.thread
|
||||
import com.unciv.ui.utils.AutoScrollPane as ScrollPane
|
||||
|
||||
class LoadGameScreen(previousScreen:CameraStageBaseScreen) : PickerScreen(disableScroll = true) {
|
||||
class LoadGameScreen(previousScreen:BaseScreen) : PickerScreen(disableScroll = true) {
|
||||
lateinit var selectedSave: String
|
||||
private val copySavedGameToClipboardButton = "Copy saved game to clipboard".toTextButton()
|
||||
private val saveTable = Table()
|
||||
|
@ -23,7 +23,7 @@ import com.unciv.ui.utils.*
|
||||
import kotlin.math.max
|
||||
import kotlin.math.min
|
||||
|
||||
class CityButton(val city: CityInfo, private val tileGroup: WorldTileGroup): Table(CameraStageBaseScreen.skin){
|
||||
class CityButton(val city: CityInfo, private val tileGroup: WorldTileGroup): Table(BaseScreen.skin){
|
||||
val worldScreen = tileGroup.worldScreen
|
||||
val uncivGame = worldScreen.game
|
||||
|
||||
|
@ -32,7 +32,7 @@ import kotlin.math.floor
|
||||
import kotlin.math.roundToInt
|
||||
import com.unciv.ui.utils.AutoScrollPane as ScrollPane
|
||||
|
||||
class DiplomacyScreen(val viewingCiv:CivilizationInfo): CameraStageBaseScreen() {
|
||||
class DiplomacyScreen(val viewingCiv:CivilizationInfo): BaseScreen() {
|
||||
|
||||
private val leftSideTable = Table().apply { defaults().pad(10f) }
|
||||
private val rightSideTable = Table()
|
||||
|
@ -3,7 +3,7 @@ package com.unciv.ui.trade
|
||||
import com.badlogic.gdx.scenes.scene2d.ui.Table
|
||||
import com.badlogic.gdx.utils.Align
|
||||
import com.unciv.logic.civilization.CivilizationInfo
|
||||
import com.unciv.ui.utils.CameraStageBaseScreen
|
||||
import com.unciv.ui.utils.BaseScreen
|
||||
import com.unciv.ui.utils.ImageGetter
|
||||
import com.unciv.ui.utils.toLabel
|
||||
|
||||
@ -17,7 +17,7 @@ import com.unciv.ui.utils.toLabel
|
||||
class LeaderIntroTable (
|
||||
civInfo: CivilizationInfo,
|
||||
hello: String = ""
|
||||
): Table(CameraStageBaseScreen.skin) {
|
||||
): Table(BaseScreen.skin) {
|
||||
/**
|
||||
* Build either a Table(icon, leaderName <br> hello) or
|
||||
* a Table(Portrait, Table(leaderName, icon <br> hello))
|
||||
|
@ -10,7 +10,7 @@ import com.unciv.models.translations.tr
|
||||
import com.unciv.ui.utils.*
|
||||
|
||||
/** This is the class that holds the 4 columns of the offers (ours/theirs/ offered/available) in trade */
|
||||
class OfferColumnsTable(private val tradeLogic: TradeLogic, val screen: DiplomacyScreen, val onChange: () -> Unit): Table(CameraStageBaseScreen.skin) {
|
||||
class OfferColumnsTable(private val tradeLogic: TradeLogic, val screen: DiplomacyScreen, val onChange: () -> Unit): Table(BaseScreen.skin) {
|
||||
|
||||
private fun addOffer(offer: TradeOffer, offerList: TradeOffersList, correspondingOfferList: TradeOffersList) {
|
||||
offerList.add(offer.copy())
|
||||
|
@ -23,7 +23,7 @@ class OffersListScroll(
|
||||
private val persistenceID: String,
|
||||
private val onOfferClicked: (TradeOffer) -> Unit
|
||||
) : ScrollPane(null) {
|
||||
val table = Table(CameraStageBaseScreen.skin).apply { defaults().pad(5f) }
|
||||
val table = Table(BaseScreen.skin).apply { defaults().pad(5f) }
|
||||
|
||||
|
||||
private val expanderTabs = HashMap<TradeType, ExpanderTab>()
|
||||
|
@ -7,7 +7,7 @@ import com.unciv.logic.trade.TradeRequest
|
||||
import com.unciv.models.translations.tr
|
||||
import com.unciv.ui.utils.*
|
||||
|
||||
class TradeTable(val otherCivilization: CivilizationInfo, stage: DiplomacyScreen): Table(CameraStageBaseScreen.skin) {
|
||||
class TradeTable(val otherCivilization: CivilizationInfo, stage: DiplomacyScreen): Table(BaseScreen.skin) {
|
||||
val currentPlayerCiv = otherCivilization.gameInfo.getCurrentPlayerCivilization()
|
||||
var tradeLogic = TradeLogic(currentPlayerCiv,otherCivilization)
|
||||
var offerColumnsTable = OfferColumnsTable(tradeLogic, stage) { onChange() }
|
||||
|
@ -7,9 +7,9 @@ import com.unciv.models.Tutorial
|
||||
import com.unciv.models.stats.INamed
|
||||
import com.unciv.ui.civilopedia.FormattedLine
|
||||
import com.unciv.ui.civilopedia.SimpleCivilopediaText
|
||||
import com.unciv.ui.utils.CameraStageBaseScreen
|
||||
import com.unciv.ui.utils.BaseScreen
|
||||
|
||||
class TutorialController(screen: CameraStageBaseScreen) {
|
||||
class TutorialController(screen: BaseScreen) {
|
||||
|
||||
private val tutorialQueue = mutableSetOf<Tutorial>()
|
||||
private var isTutorialShowing = false
|
||||
|
@ -8,7 +8,7 @@ import com.unciv.ui.utils.*
|
||||
|
||||
data class TutorialForRender(val tutorial: Tutorial, val texts: Array<String>)
|
||||
|
||||
class TutorialRender(private val screen: CameraStageBaseScreen) {
|
||||
class TutorialRender(private val screen: BaseScreen) {
|
||||
|
||||
fun showTutorial(tutorial: TutorialForRender, closeAction: () -> Unit) {
|
||||
showDialog(tutorial.tutorial.name, tutorial.texts, closeAction)
|
||||
|
@ -18,7 +18,7 @@ import com.badlogic.gdx.scenes.scene2d.ui.TextField
|
||||
*/
|
||||
|
||||
class AskNumberPopup(
|
||||
screen: CameraStageBaseScreen,
|
||||
screen: BaseScreen,
|
||||
label: String = "Please enter a number",
|
||||
icon: IconCircleGroup = ImageGetter.getImage("OtherIcons/Pencil").apply { this.color = Color.BLACK }.surroundWithCircle(80f),
|
||||
defaultText: String = "",
|
||||
|
@ -16,7 +16,7 @@ import com.badlogic.gdx.scenes.scene2d.ui.TextField
|
||||
* Gets the text the user inputted as a parameter.
|
||||
*/
|
||||
class AskTextPopup(
|
||||
screen: CameraStageBaseScreen,
|
||||
screen: BaseScreen,
|
||||
label: String = "Please enter some text",
|
||||
icon: IconCircleGroup = ImageGetter.getImage("OtherIcons/Pencil").apply { this.color = Color.BLACK }.surroundWithCircle(80f),
|
||||
defaultText: String = "",
|
||||
|
@ -18,7 +18,7 @@ import com.unciv.ui.worldscreen.WorldScreen
|
||||
import com.unciv.ui.worldscreen.mainmenu.OptionsPopup
|
||||
import kotlin.concurrent.thread
|
||||
|
||||
open class CameraStageBaseScreen : Screen {
|
||||
open class BaseScreen : Screen {
|
||||
|
||||
val game: UncivGame = UncivGame.Current
|
||||
val stage: Stage
|
||||
@ -129,7 +129,7 @@ open class CameraStageBaseScreen : Screen {
|
||||
thread(name="WaitForRotation") {
|
||||
var waited = 0
|
||||
while (true) {
|
||||
val newScreen = (UncivGame.Current.screen as? CameraStageBaseScreen)
|
||||
val newScreen = (UncivGame.Current.screen as? BaseScreen)
|
||||
if (waited >= 10000 || newScreen!=null && !newScreen.isPortrait() ) {
|
||||
Gdx.app.postRunnable { OptionsPopup(newScreen ?: this).open(true) }
|
||||
break
|
@ -33,7 +33,7 @@ class ExpanderTab(
|
||||
private val persistenceID: String? = null,
|
||||
private val onChange: (() -> Unit)? = null,
|
||||
initContent: ((Table) -> Unit)? = null
|
||||
): Table(CameraStageBaseScreen.skin) {
|
||||
): Table(BaseScreen.skin) {
|
||||
private companion object {
|
||||
const val arrowSize = 18f
|
||||
const val arrowImage = "OtherIcons/BackArrow"
|
||||
|
@ -95,7 +95,7 @@ fun Actor.addBorder(size:Float, color: Color, expandCell:Boolean = false): Table
|
||||
|
||||
/** get background Image for a new separator */
|
||||
private fun getSeparatorImage(color: Color) = ImageGetter.getDot(
|
||||
if (color.a != 0f) color else CameraStageBaseScreen.skin.get("color", Color::class.java) //0x334d80
|
||||
if (color.a != 0f) color else BaseScreen.skin.get("color", Color::class.java) //0x334d80
|
||||
)
|
||||
|
||||
/**
|
||||
@ -182,10 +182,10 @@ fun Int.toPercent() = toFloat().toPercent()
|
||||
fun Float.toPercent() = 1 + this/100
|
||||
|
||||
/** Translate a [String] and make a [TextButton] widget from it */
|
||||
fun String.toTextButton() = TextButton(this.tr(), CameraStageBaseScreen.skin)
|
||||
fun String.toTextButton() = TextButton(this.tr(), BaseScreen.skin)
|
||||
|
||||
/** Translate a [String] and make a [Label] widget from it */
|
||||
fun String.toLabel() = Label(this.tr(), CameraStageBaseScreen.skin)
|
||||
fun String.toLabel() = Label(this.tr(), BaseScreen.skin)
|
||||
/** Make a [Label] widget containing this [Int] as text */
|
||||
fun Int.toLabel() = this.toString().toLabel()
|
||||
|
||||
@ -193,7 +193,7 @@ fun Int.toLabel() = this.toString().toLabel()
|
||||
fun String.toLabel(fontColor: Color = Color.WHITE, fontSize: Int = 18): Label {
|
||||
// We don't want to use setFontSize and setFontColor because they set the font,
|
||||
// which means we need to rebuild the font cache which means more memory allocation.
|
||||
var labelStyle = CameraStageBaseScreen.skin.get(Label.LabelStyle::class.java)
|
||||
var labelStyle = BaseScreen.skin.get(Label.LabelStyle::class.java)
|
||||
if(fontColor != Color.WHITE || fontSize != 18) { // if we want the default we don't need to create another style
|
||||
labelStyle = Label.LabelStyle(labelStyle) // clone this to another
|
||||
labelStyle.fontColor = fontColor
|
||||
@ -207,7 +207,7 @@ fun String.toLabel(fontColor: Color = Color.WHITE, fontSize: Int = 18): Label {
|
||||
* @param changeAction A callback to call on change, with a boolean lambda parameter containing the current [isChecked][CheckBox.isChecked].
|
||||
*/
|
||||
fun String.toCheckBox(startsOutChecked: Boolean = false, changeAction: ((Boolean)->Unit)? = null)
|
||||
= CheckBox(this.tr(), CameraStageBaseScreen.skin).apply {
|
||||
= CheckBox(this.tr(), BaseScreen.skin).apply {
|
||||
isChecked = startsOutChecked
|
||||
if (changeAction != null) onChange {
|
||||
changeAction(isChecked)
|
||||
|
@ -67,7 +67,7 @@ object MayaCalendar {
|
||||
}
|
||||
|
||||
// User interface to explain changed year display
|
||||
fun openPopup(previousScreen: CameraStageBaseScreen, civInfo: CivilizationInfo, year: Int) {
|
||||
fun openPopup(previousScreen: BaseScreen, civInfo: CivilizationInfo, year: Int) {
|
||||
Popup(previousScreen).apply {
|
||||
name = "MayaCalendar"
|
||||
addGoodSizedLabel("The Mayan Long Count", 24).apply {
|
||||
|
@ -11,13 +11,13 @@ import com.unciv.Constants
|
||||
* Base class for all Popups, i.e. Tables that get rendered in the middle of a screen and on top of everything else
|
||||
*/
|
||||
@Suppress("MemberVisibilityCanBePrivate")
|
||||
open class Popup(val screen: CameraStageBaseScreen): Table(CameraStageBaseScreen.skin) {
|
||||
open class Popup(val screen: BaseScreen): Table(BaseScreen.skin) {
|
||||
// This exists to differentiate the actual popup (the inner table)
|
||||
// from the 'screen blocking' part of the popup (which covers the entire screen)
|
||||
val innerTable = Table(CameraStageBaseScreen.skin)
|
||||
val innerTable = Table(BaseScreen.skin)
|
||||
|
||||
/** The [KeyPressDispatcher] for the popup - Key handlers from the parent screen are inactive
|
||||
* while the popup is active through the [hasOpenPopups][CameraStageBaseScreen.hasOpenPopups] mechanism.
|
||||
* while the popup is active through the [hasOpenPopups][BaseScreen.hasOpenPopups] mechanism.
|
||||
* @see [KeyPressDispatcher.install]
|
||||
*/
|
||||
val keyPressDispatcher = KeyPressDispatcher(this.javaClass.simpleName)
|
||||
@ -198,25 +198,25 @@ open class Popup(val screen: CameraStageBaseScreen): Table(CameraStageBaseScreen
|
||||
* Checks if there are visible [Popup]s.
|
||||
* @return `true` if any were found.
|
||||
*/
|
||||
fun CameraStageBaseScreen.hasOpenPopups(): Boolean = stage.actors.any { it is Popup && it.isVisible }
|
||||
fun BaseScreen.hasOpenPopups(): Boolean = stage.actors.any { it is Popup && it.isVisible }
|
||||
|
||||
/**
|
||||
* Counts number of visible[Popup]s.
|
||||
*
|
||||
* Used for key dispatcher precedence.
|
||||
*/
|
||||
fun CameraStageBaseScreen.countOpenPopups() = stage.actors.count { it is Popup && it.isVisible }
|
||||
fun BaseScreen.countOpenPopups() = stage.actors.count { it is Popup && it.isVisible }
|
||||
|
||||
/** Closes all [Popup]s. */
|
||||
fun CameraStageBaseScreen.closeAllPopups() = popups.forEach { it.close() }
|
||||
fun BaseScreen.closeAllPopups() = popups.forEach { it.close() }
|
||||
|
||||
/**
|
||||
* Closes the topmost visible [Popup].
|
||||
* @return The [name][Popup.name] of the closed [Popup] if any popup was closed and if it had a name.
|
||||
*/
|
||||
fun CameraStageBaseScreen.closeOneVisiblePopup() = popups.lastOrNull { it.isVisible }?.apply { close() }?.name
|
||||
fun BaseScreen.closeOneVisiblePopup() = popups.lastOrNull { it.isVisible }?.apply { close() }?.name
|
||||
|
||||
/** @return A [List] of currently active or pending [Popup] screens. */
|
||||
val CameraStageBaseScreen.popups: List<Popup>
|
||||
val BaseScreen.popups: List<Popup>
|
||||
get() = stage.actors.filterIsInstance<Popup>()
|
||||
|
||||
|
@ -53,7 +53,7 @@ class TabbedPager(
|
||||
var scrollX = 0f
|
||||
var scrollY = 0f
|
||||
|
||||
var button: Button = Button(CameraStageBaseScreen.skin)
|
||||
var button: Button = Button(BaseScreen.skin)
|
||||
var buttonX = 0f
|
||||
var buttonW = 0f
|
||||
}
|
||||
@ -73,7 +73,7 @@ class TabbedPager(
|
||||
var activePage = -1
|
||||
private set
|
||||
|
||||
private val header = Table(CameraStageBaseScreen.skin)
|
||||
private val header = Table(BaseScreen.skin)
|
||||
private val headerScroll = AutoScrollPane(header)
|
||||
private var headerHeight = 0f
|
||||
|
||||
@ -279,8 +279,8 @@ class TabbedPager(
|
||||
* is shown to ensure proper popup stacking.
|
||||
*/
|
||||
fun askForPassword(secretHashCode: Int = 0) {
|
||||
class PassPopup(screen: CameraStageBaseScreen, unlockAction: ()->Unit, lockAction: ()->Unit) : Popup(screen) {
|
||||
val passEntry = TextField("", CameraStageBaseScreen.skin)
|
||||
class PassPopup(screen: BaseScreen, unlockAction: ()->Unit, lockAction: ()->Unit) : Popup(screen) {
|
||||
val passEntry = TextField("", BaseScreen.skin)
|
||||
init {
|
||||
passEntry.isPasswordMode = true
|
||||
add(passEntry).row()
|
||||
@ -294,7 +294,7 @@ class TabbedPager(
|
||||
if (!UncivGame.isCurrentInitialized() || askPasswordLock || deferredSecretPages.isEmpty()) return
|
||||
askPasswordLock = true // race condition: Popup closes _first_, then deferredSecretPages is emptied -> parent shows and calls us again
|
||||
|
||||
PassPopup(UncivGame.Current.screen as CameraStageBaseScreen, {
|
||||
PassPopup(UncivGame.Current.screen as BaseScreen, {
|
||||
addDeferredSecrets()
|
||||
}, {
|
||||
deferredSecretPages.clear()
|
||||
|
@ -8,7 +8,7 @@ import kotlin.concurrent.thread
|
||||
* This is an unobtrusive popup which will close itself after a given amount of time.
|
||||
* Default time is two seconds (in milliseconds)
|
||||
*/
|
||||
class ToastPopup (message: String, screen: CameraStageBaseScreen, val time: Long = 2000) : Popup(screen){
|
||||
class ToastPopup (message: String, screen: BaseScreen, val time: Long = 2000) : Popup(screen){
|
||||
init {
|
||||
//Make this popup unobtrusive
|
||||
setFillParent(false)
|
||||
|
@ -38,7 +38,7 @@ class UncivSlider (
|
||||
sound: UncivSound = UncivSound.Slider,
|
||||
private val getTipText: ((Float) -> String)? = null,
|
||||
onChange: ((Float) -> Unit)? = null
|
||||
): Table(CameraStageBaseScreen.skin) {
|
||||
): Table(BaseScreen.skin) {
|
||||
// constants for geometry tuning
|
||||
companion object {
|
||||
const val plusMinusFontSize = 18
|
||||
@ -49,7 +49,7 @@ class UncivSlider (
|
||||
}
|
||||
|
||||
// component widgets
|
||||
private val slider = Slider(min, max, step, vertical, CameraStageBaseScreen.skin)
|
||||
private val slider = Slider(min, max, step, vertical, BaseScreen.skin)
|
||||
private val minusButton: IconCircleGroup?
|
||||
private val plusButton: IconCircleGroup?
|
||||
private val tipLabel = "".toLabel(Color.LIGHT_GRAY)
|
||||
|
@ -16,7 +16,7 @@ class WrappableLabel(
|
||||
private val expectedWidth: Float,
|
||||
fontColor: Color = Color.WHITE,
|
||||
fontSize: Int = 18
|
||||
) : Label(text.tr(), CameraStageBaseScreen.skin) {
|
||||
) : Label(text.tr(), BaseScreen.skin) {
|
||||
private var _measuredWidth = 0f
|
||||
|
||||
init {
|
||||
|
@ -12,10 +12,10 @@ import com.unciv.UncivGame
|
||||
* @param restoreDefault A lambda to execute when "No" is chosen
|
||||
*/
|
||||
open class YesNoPopup (
|
||||
question: String,
|
||||
action: ()->Unit,
|
||||
screen: CameraStageBaseScreen = UncivGame.Current.worldScreen,
|
||||
restoreDefault: ()->Unit = {}
|
||||
question: String,
|
||||
action: ()->Unit,
|
||||
screen: BaseScreen = UncivGame.Current.worldScreen,
|
||||
restoreDefault: ()->Unit = {}
|
||||
) : Popup(screen) {
|
||||
|
||||
/** The [Label][com.badlogic.gdx.scenes.scene2d.ui.Label] created for parameter `question` for optional layout tweaking */
|
||||
@ -31,7 +31,7 @@ open class YesNoPopup (
|
||||
}
|
||||
|
||||
/** Shortcut to open a [YesNoPopup] with the exit game question */
|
||||
class ExitGamePopup(screen: CameraStageBaseScreen, force: Boolean = false)
|
||||
class ExitGamePopup(screen: BaseScreen, force: Boolean = false)
|
||||
: YesNoPopup (
|
||||
question = "Do you want to exit the game?",
|
||||
action = { Gdx.app.exit() },
|
||||
|
@ -5,12 +5,12 @@ import com.badlogic.gdx.scenes.scene2d.Touchable
|
||||
import com.badlogic.gdx.scenes.scene2d.ui.Table
|
||||
import com.unciv.logic.GameInfo
|
||||
import com.unciv.logic.civilization.CivilizationInfo
|
||||
import com.unciv.ui.utils.CameraStageBaseScreen
|
||||
import com.unciv.ui.utils.BaseScreen
|
||||
import com.unciv.ui.utils.ImageGetter
|
||||
import com.unciv.ui.utils.onClick
|
||||
import com.unciv.ui.utils.toLabel
|
||||
|
||||
class PlayerReadyScreen(gameInfo: GameInfo, currentPlayerCiv: CivilizationInfo) : CameraStageBaseScreen(){
|
||||
class PlayerReadyScreen(gameInfo: GameInfo, currentPlayerCiv: CivilizationInfo) : BaseScreen(){
|
||||
init {
|
||||
val table= Table()
|
||||
table.touchable= Touchable.enabled
|
||||
|
@ -46,14 +46,14 @@ import kotlin.concurrent.timer
|
||||
* Unciv's world screen
|
||||
* @param gameInfo The game state the screen should represent
|
||||
* @param viewingCiv The currently active [civilization][CivilizationInfo]
|
||||
* @property shouldUpdate When set, causes the screen to update in the next [render][CameraStageBaseScreen.render] event
|
||||
* @property shouldUpdate When set, causes the screen to update in the next [render][BaseScreen.render] event
|
||||
* @property isPlayersTurn (readonly) Indicates it's the player's ([viewingCiv]) turn
|
||||
* @property selectedCiv Selected civilization, used in spectator and replay mode, equals viewingCiv in ordinary games
|
||||
* @property canChangeState (readonly) `true` when it's the player's turn unless he is a spectator
|
||||
* @property mapHolder A [MinimapHolder] instance
|
||||
* @property bottomUnitTable Bottom left widget holding information about a selected unit or city
|
||||
*/
|
||||
class WorldScreen(val gameInfo: GameInfo, val viewingCiv:CivilizationInfo) : CameraStageBaseScreen() {
|
||||
class WorldScreen(val gameInfo: GameInfo, val viewingCiv:CivilizationInfo) : BaseScreen() {
|
||||
|
||||
var isPlayersTurn = viewingCiv == gameInfo.currentPlayerCiv
|
||||
private set // only this class is allowed to make changes
|
||||
|
@ -168,13 +168,13 @@ class WorldScreenTopBar(val worldScreen: WorldScreen) : Table() {
|
||||
}
|
||||
|
||||
private fun getOverviewButton(): Table {
|
||||
val rightTable = Table(CameraStageBaseScreen.skin).apply{ defaults().pad(10f) }
|
||||
val rightTable = Table(BaseScreen.skin).apply{ defaults().pad(10f) }
|
||||
|
||||
val unitSupplyImage = ImageGetter.getImage("OtherIcons/ExclamationMark")
|
||||
.apply { color = Color.FIREBRICK }
|
||||
.onClick { worldScreen.game.setScreen(EmpireOverviewScreen(worldScreen.selectedCiv, "Units")) }
|
||||
|
||||
val overviewButton = Button(CameraStageBaseScreen.skin)
|
||||
val overviewButton = Button(BaseScreen.skin)
|
||||
overviewButton.add("Overview".toLabel()).pad(10f)
|
||||
overviewButton.addTooltip('e')
|
||||
overviewButton.onClick { worldScreen.game.setScreen(EmpireOverviewScreen(worldScreen.selectedCiv)) }
|
||||
|
@ -23,7 +23,7 @@ class BattleTable(val worldScreen: WorldScreen): Table() {
|
||||
|
||||
init {
|
||||
isVisible = false
|
||||
skin = CameraStageBaseScreen.skin
|
||||
skin = BaseScreen.skin
|
||||
background = ImageGetter.getBackground(ImageGetter.getBlue())
|
||||
|
||||
defaults().pad(5f)
|
||||
|
@ -9,11 +9,11 @@ import com.unciv.logic.map.TileInfo
|
||||
import com.unciv.ui.civilopedia.CivilopediaScreen
|
||||
import com.unciv.ui.civilopedia.FormattedLine.IconDisplay
|
||||
import com.unciv.ui.civilopedia.MarkupRenderer
|
||||
import com.unciv.ui.utils.CameraStageBaseScreen
|
||||
import com.unciv.ui.utils.BaseScreen
|
||||
import com.unciv.ui.utils.ImageGetter
|
||||
import com.unciv.ui.utils.toLabel
|
||||
|
||||
class TileInfoTable(private val viewingCiv :CivilizationInfo) : Table(CameraStageBaseScreen.skin) {
|
||||
class TileInfoTable(private val viewingCiv :CivilizationInfo) : Table(BaseScreen.skin) {
|
||||
init {
|
||||
background = ImageGetter.getBackground(ImageGetter.getBlue().lerp(Color.BLACK, 0.5f))
|
||||
}
|
||||
|
@ -36,7 +36,7 @@ import com.badlogic.gdx.utils.Array as GdxArray
|
||||
* @param previousScreen The caller - note if this is a [WorldScreen] or [MainMenuScreen] they will be rebuilt when major options change.
|
||||
*/
|
||||
//region Fields
|
||||
class OptionsPopup(val previousScreen: CameraStageBaseScreen) : Popup(previousScreen) {
|
||||
class OptionsPopup(val previousScreen: BaseScreen) : Popup(previousScreen) {
|
||||
private val settings = previousScreen.game.settings
|
||||
private val tabs: TabbedPager
|
||||
private val resolutionArray = com.badlogic.gdx.utils.Array(arrayOf("750x500", "900x600", "1050x700", "1200x800", "1500x1000"))
|
||||
@ -109,7 +109,7 @@ class OptionsPopup(val previousScreen: CameraStageBaseScreen) : Popup(previousSc
|
||||
} else if (previousScreen is MainMenuScreen) {
|
||||
previousScreen.game.setScreen(MainMenuScreen())
|
||||
}
|
||||
(previousScreen.game.screen as CameraStageBaseScreen).openOptionsPopup()
|
||||
(previousScreen.game.screen as BaseScreen).openOptionsPopup()
|
||||
}
|
||||
|
||||
//region Page builders
|
||||
@ -128,7 +128,7 @@ class OptionsPopup(val previousScreen: CameraStageBaseScreen) : Popup(previousSc
|
||||
return MarkupRenderer.render(lines.toList()).pad(20f)
|
||||
}
|
||||
|
||||
private fun getLanguageTab() = Table(CameraStageBaseScreen.skin).apply {
|
||||
private fun getLanguageTab() = Table(BaseScreen.skin).apply {
|
||||
val languageTables = this.addLanguageTables(tabs.prefWidth * 0.9f - 10f)
|
||||
|
||||
var chosenLanguage = settings.language
|
||||
@ -153,7 +153,7 @@ class OptionsPopup(val previousScreen: CameraStageBaseScreen) : Popup(previousSc
|
||||
}
|
||||
}
|
||||
|
||||
private fun getDisplayTab() = Table(CameraStageBaseScreen.skin).apply {
|
||||
private fun getDisplayTab() = Table(BaseScreen.skin).apply {
|
||||
pad(10f)
|
||||
defaults().pad(2.5f)
|
||||
|
||||
@ -182,7 +182,7 @@ class OptionsPopup(val previousScreen: CameraStageBaseScreen) : Popup(previousSc
|
||||
add(continuousRenderingLabel).colspan(2).padTop(10f).row()
|
||||
}
|
||||
|
||||
private fun getGamePlayTab() = Table(CameraStageBaseScreen.skin).apply {
|
||||
private fun getGamePlayTab() = Table(BaseScreen.skin).apply {
|
||||
pad(10f)
|
||||
defaults().pad(5f)
|
||||
addYesNoRow("Check for idle units", settings.checkForDueUnits, true) { settings.checkForDueUnits = it }
|
||||
@ -201,7 +201,7 @@ class OptionsPopup(val previousScreen: CameraStageBaseScreen) : Popup(previousSc
|
||||
addYesNoRow("Order trade offers by amount", settings.orderTradeOffersByAmount) { settings.orderTradeOffersByAmount = it }
|
||||
}
|
||||
|
||||
private fun getSoundTab() = Table(CameraStageBaseScreen.skin).apply {
|
||||
private fun getSoundTab() = Table(BaseScreen.skin).apply {
|
||||
pad(10f)
|
||||
defaults().pad(5f)
|
||||
|
||||
@ -216,7 +216,7 @@ class OptionsPopup(val previousScreen: CameraStageBaseScreen) : Popup(previousSc
|
||||
}
|
||||
}
|
||||
|
||||
private fun getMultiplayerTab(): Table = Table(CameraStageBaseScreen.skin).apply {
|
||||
private fun getMultiplayerTab(): Table = Table(BaseScreen.skin).apply {
|
||||
pad(10f)
|
||||
defaults().pad(5f)
|
||||
|
||||
@ -234,7 +234,7 @@ class OptionsPopup(val previousScreen: CameraStageBaseScreen) : Popup(previousSc
|
||||
}
|
||||
}
|
||||
|
||||
private fun getAdvancedTab() = Table(CameraStageBaseScreen.skin).apply {
|
||||
private fun getAdvancedTab() = Table(BaseScreen.skin).apply {
|
||||
pad(10f)
|
||||
defaults().pad(5f)
|
||||
|
||||
@ -258,7 +258,7 @@ class OptionsPopup(val previousScreen: CameraStageBaseScreen) : Popup(previousSc
|
||||
addSetUserId()
|
||||
}
|
||||
|
||||
private fun getModCheckTab() = Table(CameraStageBaseScreen.skin).apply {
|
||||
private fun getModCheckTab() = Table(BaseScreen.skin).apply {
|
||||
defaults().pad(10f).align(Align.top)
|
||||
modCheckCheckBox = "Check extension mods based on vanilla".toCheckBox {
|
||||
runModChecker(it)
|
||||
@ -302,9 +302,9 @@ class OptionsPopup(val previousScreen: CameraStageBaseScreen) : Popup(previousSc
|
||||
// Instead, some manual work needs to be put in.
|
||||
val resultTable = Table().apply { defaults().align(Align.left) }
|
||||
for (line in lines) {
|
||||
val label = if (line.starred) Label(line.text+"\n", CameraStageBaseScreen.skin)
|
||||
val label = if (line.starred) Label(line.text+"\n", BaseScreen.skin)
|
||||
.apply { setFontScale(22 / Fonts.ORIGINAL_FONT_SIZE) }
|
||||
else Label(line.text+"\n", CameraStageBaseScreen.skin)
|
||||
else Label(line.text+"\n", BaseScreen.skin)
|
||||
.apply { if (line.color != "") color = Color.valueOf(line.color) }
|
||||
label.wrap = true
|
||||
resultTable.add(label).width(stage.width/2).row()
|
||||
@ -315,7 +315,7 @@ class OptionsPopup(val previousScreen: CameraStageBaseScreen) : Popup(previousSc
|
||||
}
|
||||
}
|
||||
|
||||
private fun getDebugTab() = Table(CameraStageBaseScreen.skin).apply {
|
||||
private fun getDebugTab() = Table(BaseScreen.skin).apply {
|
||||
pad(10f)
|
||||
defaults().pad(5f)
|
||||
|
||||
@ -334,8 +334,8 @@ class OptionsPopup(val previousScreen: CameraStageBaseScreen) : Popup(previousSc
|
||||
add("Save maps compressed".toCheckBox(MapSaver.saveZipped) {
|
||||
MapSaver.saveZipped = it
|
||||
}).row()
|
||||
add("Gdx Scene2D debug".toCheckBox(CameraStageBaseScreen.enableSceneDebug) {
|
||||
CameraStageBaseScreen.enableSceneDebug = it
|
||||
add("Gdx Scene2D debug".toCheckBox(BaseScreen.enableSceneDebug) {
|
||||
BaseScreen.enableSceneDebug = it
|
||||
}).row()
|
||||
}
|
||||
|
||||
@ -589,7 +589,7 @@ class OptionsPopup(val previousScreen: CameraStageBaseScreen) : Popup(previousSc
|
||||
add(WrappableLabel(text, wrapWidth).apply { wrap = true })
|
||||
.left().fillX()
|
||||
.maxWidth(wrapWidth)
|
||||
val button = YesNoButton(initialValue, CameraStageBaseScreen.skin) {
|
||||
val button = YesNoButton(initialValue, BaseScreen.skin) {
|
||||
action(it)
|
||||
settings.save()
|
||||
if (updateWorld && previousScreen is WorldScreen)
|
||||
|
@ -29,7 +29,7 @@ class UnitActionsTable(val worldScreen: WorldScreen) : Table() {
|
||||
// If peripheral keyboard not detected, hotkeys will not be displayed
|
||||
val key = if (keyboardAvailable) unitAction.type.key else KeyCharAndCode.UNKNOWN
|
||||
|
||||
val actionButton = Button(CameraStageBaseScreen.skin)
|
||||
val actionButton = Button(BaseScreen.skin)
|
||||
actionButton.add(icon).size(20f).pad(5f)
|
||||
val fontColor = if (unitAction.isCurrentAction) Color.YELLOW else Color.WHITE
|
||||
actionButton.add(unitAction.title.toLabel(fontColor)).pad(5f)
|
||||
|
@ -27,7 +27,7 @@ class UnitTable(val worldScreen: WorldScreen) : Table(){
|
||||
private val unitNameLabel = "".toLabel()
|
||||
private val unitIconNameGroup = Table()
|
||||
private val promotionsTable = Table()
|
||||
private val unitDescriptionTable = Table(CameraStageBaseScreen.skin)
|
||||
private val unitDescriptionTable = Table(BaseScreen.skin)
|
||||
|
||||
val selectedUnit : MapUnit?
|
||||
get() = selectedUnits.firstOrNull()
|
||||
|
Reference in New Issue
Block a user