Resolved #3497 - city state quests always show correctly when diplomacy screen accessed from city button

Added some scrollbars as per #3495
This commit is contained in:
Yair Morgenstern
2021-01-03 21:37:38 +02:00
parent 17333ec0d3
commit 80b470e867
4 changed files with 22 additions and 21 deletions

View File

@ -49,7 +49,7 @@ class NewGameScreen(previousScreen:CameraStageBaseScreen, _gameSetupInfo: GameSe
setDefaultCloseAction(previousScreen) setDefaultCloseAction(previousScreen)
scrollPane.setScrollingDisabled(true, true) scrollPane.setScrollingDisabled(true, true)
topTable.add(ScrollPane(newGameOptionsTable).apply { setOverscroll(false, false) }) topTable.add(ScrollPane(newGameOptionsTable, skin).apply { setOverscroll(false, false) })
.maxHeight(topTable.parent.height).width(stage.width / 3).padTop(20f).top() .maxHeight(topTable.parent.height).width(stage.width / 3).padTop(20f).top()
topTable.addSeparatorVertical() topTable.addSeparatorVertical()
topTable.add(ScrollPane(mapOptionsTable).apply { setOverscroll(false, false) }) topTable.add(ScrollPane(mapOptionsTable).apply { setOverscroll(false, false) })

View File

@ -35,7 +35,6 @@ import java.util.*
*/ */
class PlayerPickerTable(val previousScreen: IPreviousScreen, var gameParameters: GameParameters): Table() { class PlayerPickerTable(val previousScreen: IPreviousScreen, var gameParameters: GameParameters): Table() {
val playerListTable = Table() val playerListTable = Table()
val nationsPopupWidth = previousScreen.stage.width / 2f
val civBlocksWidth = previousScreen.stage.width / 3 val civBlocksWidth = previousScreen.stage.width / 3
/** Locks player table for editing, used during new game creation with scenario.*/ /** Locks player table for editing, used during new game creation with scenario.*/
@ -50,7 +49,7 @@ class PlayerPickerTable(val previousScreen: IPreviousScreen, var gameParameters:
top() top()
add("Civilizations".toLabel(fontSize = 24)).padBottom(20f).row() add("Civilizations".toLabel(fontSize = 24)).padBottom(20f).row()
add(ScrollPane(playerListTable).apply { setOverscroll(false, false) }).width(civBlocksWidth) add(ScrollPane(playerListTable, skin).apply { setOverscroll(false, false) }).width(civBlocksWidth)
update() update()
} }
@ -72,10 +71,10 @@ class PlayerPickerTable(val previousScreen: IPreviousScreen, var gameParameters:
for (player in gameParameters.players) { for (player in gameParameters.players) {
playerListTable.add(getPlayerTable(player)).width(civBlocksWidth).padBottom(20f).row() playerListTable.add(getPlayerTable(player)).width(civBlocksWidth).padBottom(20f).row()
} }
if (gameParameters.players.count() < gameBasics.nations.values.count { it.isMajorCiv() } if (!locked && gameParameters.players.size < gameBasics.nations.values.count { it.isMajorCiv() }) {
&& !locked) { val addPlayerButton = "+".toLabel(Color.BLACK, 30).apply { this.setAlignment(Align.center) }
playerListTable.add("+".toLabel(Color.BLACK, 30).apply { this.setAlignment(Align.center) } .surroundWithCircle(50f)
.surroundWithCircle(50f).onClick { .onClick {
var player = Player() var player = Player()
// no random mode - add first not spectator civ if still available // no random mode - add first not spectator civ if still available
if (noRandom) { if (noRandom) {
@ -86,7 +85,8 @@ class PlayerPickerTable(val previousScreen: IPreviousScreen, var gameParameters:
} }
gameParameters.players.add(player) gameParameters.players.add(player)
update() update()
}).pad(10f) }
playerListTable.add(addPlayerButton).pad(10f)
} }
// can enable start game when more than 1 active player // can enable start game when more than 1 active player
previousScreen.setRightSideButtonEnabled(gameParameters.players.count { it.chosenCiv != Constants.spectator } > 1) previousScreen.setRightSideButtonEnabled(gameParameters.players.count { it.chosenCiv != Constants.spectator } > 1)
@ -152,7 +152,7 @@ class PlayerPickerTable(val previousScreen: IPreviousScreen, var gameParameters:
val playerIdTextfield = TextField(player.playerId, CameraStageBaseScreen.skin) val playerIdTextfield = TextField(player.playerId, CameraStageBaseScreen.skin)
playerIdTextfield.messageText = "Please input Player ID!".tr() playerIdTextfield.messageText = "Please input Player ID!".tr()
playerTable.add(playerIdTextfield).colspan(2).fillX().pad(5f) playerTable.add(playerIdTextfield).colspan(2).fillX().pad(5f)
var errorLabel = "".toLabel(Color.RED) val errorLabel = "".toLabel(Color.RED)
playerTable.add(errorLabel).pad(5f).row() playerTable.add(errorLabel).pad(5f).row()
fun onPlayerIdTextUpdated() { fun onPlayerIdTextUpdated() {
@ -275,7 +275,7 @@ class PlayerPickerTable(val previousScreen: IPreviousScreen, var gameParameters:
* @return [ArrayList] of available [Nation]s * @return [ArrayList] of available [Nation]s
*/ */
private fun getAvailablePlayerCivs(): ArrayList<Nation> { private fun getAvailablePlayerCivs(): ArrayList<Nation> {
var nations = ArrayList<Nation>() val nations = ArrayList<Nation>()
for (nation in previousScreen.ruleset.nations.values for (nation in previousScreen.ruleset.nations.values
.filter { it.isMajorCiv() || it.isSpectator() }) { .filter { it.isMajorCiv() || it.isSpectator() }) {
if (gameParameters.players.any { it.chosenCiv == nation.name }) if (gameParameters.players.any { it.chosenCiv == nation.name })

View File

@ -200,8 +200,8 @@ class DiplomacyScreen(val viewingCiv:CivilizationInfo):CameraStageBaseScreen() {
val description = assignedQuest.getDescription() val description = assignedQuest.getDescription()
questTable.add(title.toLabel(fontSize = 24)).row() questTable.add(title.toLabel(fontSize = 24)).row()
questTable.add(description.toLabel().apply { setWrap(true); setAlignment(Align.center) }) questTable.add(description.toLabel().apply { wrap = true; setAlignment(Align.center) })
.width(rightSideTable.width - 50f).row() .width(stage.width/2).row()
if (quest.duration > 0) if (quest.duration > 0)
questTable.add("[${remainingTurns}] turns remaining".toLabel()).row() questTable.add("[${remainingTurns}] turns remaining".toLabel()).row()

View File

@ -52,7 +52,7 @@ internal object DesktopLauncher {
val game = UncivGame(desktopParameters) val game = UncivGame(desktopParameters)
if(!RaspberryPiDetector.isRaspberryPi()) // No discord RPC for Raspberry Pi, see https://github.com/yairm210/Unciv/issues/1624 if (!RaspberryPiDetector.isRaspberryPi()) // No discord RPC for Raspberry Pi, see https://github.com/yairm210/Unciv/issues/1624
tryActivateDiscord(game) tryActivateDiscord(game)
LwjglApplication(game, config) LwjglApplication(game, config)
@ -163,10 +163,10 @@ internal object DesktopLauncher {
private fun packImagesIfOutdated(settings: TexturePacker.Settings, input: String, output: String, packFileName: String) { private fun packImagesIfOutdated(settings: TexturePacker.Settings, input: String, output: String, packFileName: String) {
fun File.listTree(): Sequence<File> = when { fun File.listTree(): Sequence<File> = when {
this.isFile -> sequenceOf(this) this.isFile -> sequenceOf(this)
this.isDirectory -> this.listFiles().asSequence().flatMap { it.listTree() } this.isDirectory -> this.listFiles().asSequence().flatMap { it.listTree() }
else -> sequenceOf() else -> sequenceOf()
} }
val atlasFile = File("$output${File.separator}$packFileName.atlas") val atlasFile = File("$output${File.separator}$packFileName.atlas")
if (atlasFile.exists() && File("$output${File.separator}$packFileName.png").exists()) { if (atlasFile.exists() && File("$output${File.separator}$packFileName.png").exists()) {
@ -187,7 +187,8 @@ internal object DesktopLauncher {
discordTimer = timer(name = "Discord", daemon = true, period = 1000) { discordTimer = timer(name = "Discord", daemon = true, period = 1000) {
try { try {
updateRpc(game) updateRpc(game)
} catch (ex: Exception){} } catch (ex: Exception) {
}
} }
} catch (ex: Exception) { } catch (ex: Exception) {
println("Could not initialize Discord") println("Could not initialize Discord")
@ -195,12 +196,12 @@ internal object DesktopLauncher {
} }
private fun updateRpc(game: UncivGame) { private fun updateRpc(game: UncivGame) {
if(!game.isInitialized) return if (!game.isInitialized) return
val presence = DiscordRichPresence() val presence = DiscordRichPresence()
val currentPlayerCiv = game.gameInfo.getCurrentPlayerCivilization() val currentPlayerCiv = game.gameInfo.getCurrentPlayerCivilization()
presence.details=currentPlayerCiv.nation.getLeaderDisplayName().tr() presence.details = currentPlayerCiv.nation.getLeaderDisplayName().tr()
presence.largeImageKey = "logo" // The actual image is uploaded to the discord app / applications webpage presence.largeImageKey = "logo" // The actual image is uploaded to the discord app / applications webpage
presence.largeImageText ="Turn".tr()+" " + currentPlayerCiv.gameInfo.turns presence.largeImageText = "Turn".tr() + " " + currentPlayerCiv.gameInfo.turns
DiscordRPC.INSTANCE.Discord_UpdatePresence(presence) DiscordRPC.INSTANCE.Discord_UpdatePresence(presence)
} }
} }