mirror of
https://github.com/yairm210/Unciv.git
synced 2025-03-09 20:29:50 +07:00
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:
parent
17333ec0d3
commit
80b470e867
@ -49,7 +49,7 @@ class NewGameScreen(previousScreen:CameraStageBaseScreen, _gameSetupInfo: GameSe
|
||||
setDefaultCloseAction(previousScreen)
|
||||
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()
|
||||
topTable.addSeparatorVertical()
|
||||
topTable.add(ScrollPane(mapOptionsTable).apply { setOverscroll(false, false) })
|
||||
|
@ -35,7 +35,6 @@ import java.util.*
|
||||
*/
|
||||
class PlayerPickerTable(val previousScreen: IPreviousScreen, var gameParameters: GameParameters): Table() {
|
||||
val playerListTable = Table()
|
||||
val nationsPopupWidth = previousScreen.stage.width / 2f
|
||||
val civBlocksWidth = previousScreen.stage.width / 3
|
||||
|
||||
/** Locks player table for editing, used during new game creation with scenario.*/
|
||||
@ -50,7 +49,7 @@ class PlayerPickerTable(val previousScreen: IPreviousScreen, var gameParameters:
|
||||
|
||||
top()
|
||||
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()
|
||||
}
|
||||
|
||||
@ -72,10 +71,10 @@ class PlayerPickerTable(val previousScreen: IPreviousScreen, var gameParameters:
|
||||
for (player in gameParameters.players) {
|
||||
playerListTable.add(getPlayerTable(player)).width(civBlocksWidth).padBottom(20f).row()
|
||||
}
|
||||
if (gameParameters.players.count() < gameBasics.nations.values.count { it.isMajorCiv() }
|
||||
&& !locked) {
|
||||
playerListTable.add("+".toLabel(Color.BLACK, 30).apply { this.setAlignment(Align.center) }
|
||||
.surroundWithCircle(50f).onClick {
|
||||
if (!locked && gameParameters.players.size < gameBasics.nations.values.count { it.isMajorCiv() }) {
|
||||
val addPlayerButton = "+".toLabel(Color.BLACK, 30).apply { this.setAlignment(Align.center) }
|
||||
.surroundWithCircle(50f)
|
||||
.onClick {
|
||||
var player = Player()
|
||||
// no random mode - add first not spectator civ if still available
|
||||
if (noRandom) {
|
||||
@ -86,7 +85,8 @@ class PlayerPickerTable(val previousScreen: IPreviousScreen, var gameParameters:
|
||||
}
|
||||
gameParameters.players.add(player)
|
||||
update()
|
||||
}).pad(10f)
|
||||
}
|
||||
playerListTable.add(addPlayerButton).pad(10f)
|
||||
}
|
||||
// can enable start game when more than 1 active player
|
||||
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)
|
||||
playerIdTextfield.messageText = "Please input Player ID!".tr()
|
||||
playerTable.add(playerIdTextfield).colspan(2).fillX().pad(5f)
|
||||
var errorLabel = "✘".toLabel(Color.RED)
|
||||
val errorLabel = "✘".toLabel(Color.RED)
|
||||
playerTable.add(errorLabel).pad(5f).row()
|
||||
|
||||
fun onPlayerIdTextUpdated() {
|
||||
@ -275,7 +275,7 @@ class PlayerPickerTable(val previousScreen: IPreviousScreen, var gameParameters:
|
||||
* @return [ArrayList] of available [Nation]s
|
||||
*/
|
||||
private fun getAvailablePlayerCivs(): ArrayList<Nation> {
|
||||
var nations = ArrayList<Nation>()
|
||||
val nations = ArrayList<Nation>()
|
||||
for (nation in previousScreen.ruleset.nations.values
|
||||
.filter { it.isMajorCiv() || it.isSpectator() }) {
|
||||
if (gameParameters.players.any { it.chosenCiv == nation.name })
|
||||
|
@ -200,8 +200,8 @@ class DiplomacyScreen(val viewingCiv:CivilizationInfo):CameraStageBaseScreen() {
|
||||
val description = assignedQuest.getDescription()
|
||||
|
||||
questTable.add(title.toLabel(fontSize = 24)).row()
|
||||
questTable.add(description.toLabel().apply { setWrap(true); setAlignment(Align.center) })
|
||||
.width(rightSideTable.width - 50f).row()
|
||||
questTable.add(description.toLabel().apply { wrap = true; setAlignment(Align.center) })
|
||||
.width(stage.width/2).row()
|
||||
if (quest.duration > 0)
|
||||
questTable.add("[${remainingTurns}] turns remaining".toLabel()).row()
|
||||
|
||||
|
@ -52,7 +52,7 @@ internal object DesktopLauncher {
|
||||
|
||||
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)
|
||||
|
||||
LwjglApplication(game, config)
|
||||
@ -163,10 +163,10 @@ internal object DesktopLauncher {
|
||||
|
||||
private fun packImagesIfOutdated(settings: TexturePacker.Settings, input: String, output: String, packFileName: String) {
|
||||
fun File.listTree(): Sequence<File> = when {
|
||||
this.isFile -> sequenceOf(this)
|
||||
this.isDirectory -> this.listFiles().asSequence().flatMap { it.listTree() }
|
||||
else -> sequenceOf()
|
||||
}
|
||||
this.isFile -> sequenceOf(this)
|
||||
this.isDirectory -> this.listFiles().asSequence().flatMap { it.listTree() }
|
||||
else -> sequenceOf()
|
||||
}
|
||||
|
||||
val atlasFile = File("$output${File.separator}$packFileName.atlas")
|
||||
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) {
|
||||
try {
|
||||
updateRpc(game)
|
||||
} catch (ex: Exception){}
|
||||
} catch (ex: Exception) {
|
||||
}
|
||||
}
|
||||
} catch (ex: Exception) {
|
||||
println("Could not initialize Discord")
|
||||
@ -195,12 +196,12 @@ internal object DesktopLauncher {
|
||||
}
|
||||
|
||||
private fun updateRpc(game: UncivGame) {
|
||||
if(!game.isInitialized) return
|
||||
if (!game.isInitialized) return
|
||||
val presence = DiscordRichPresence()
|
||||
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.largeImageText ="Turn".tr()+" " + currentPlayerCiv.gameInfo.turns
|
||||
presence.largeImageText = "Turn".tr() + " " + currentPlayerCiv.gameInfo.turns
|
||||
DiscordRPC.INSTANCE.Discord_UpdatePresence(presence)
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user