mirror of
https://github.com/yairm210/Unciv.git
synced 2025-09-26 13:27:22 -04:00
Fix NPE in Nation selection & editor mods popup (#7144)
This commit is contained in:
parent
dc16bba983
commit
4da1d442e4
@ -131,7 +131,7 @@ class MapEditorModsTab(
|
|||||||
add(inc.toLabel()).row()
|
add(inc.toLabel()).row()
|
||||||
}
|
}
|
||||||
add(ScrollPane(incompatibilityTable)).colspan(2)
|
add(ScrollPane(incompatibilityTable)).colspan(2)
|
||||||
.maxHeight(stage.height * 0.8f).row()
|
.maxHeight(stageToShowOn.height * 0.8f).row()
|
||||||
addGoodSizedLabel("Change map to fit selected ruleset?", 24).colspan(2).row()
|
addGoodSizedLabel("Change map to fit selected ruleset?", 24).colspan(2).row()
|
||||||
addButtonInRow(Constants.yes, 'y') {
|
addButtonInRow(Constants.yes, 'y') {
|
||||||
onOK()
|
onOK()
|
||||||
|
@ -344,7 +344,7 @@ private class NationPickerPopup(
|
|||||||
private val ruleset = previousScreen.ruleset
|
private val ruleset = previousScreen.ruleset
|
||||||
// This Popup's body has two halves of same size, either side by side or arranged vertically
|
// This Popup's body has two halves of same size, either side by side or arranged vertically
|
||||||
// depending on screen proportions - determine height for one of those
|
// depending on screen proportions - determine height for one of those
|
||||||
private val partHeight = stage.height * (if (stage.isNarrowerThan4to3()) 0.45f else 0.8f)
|
private val partHeight = stageToShowOn.height * (if (stageToShowOn.isNarrowerThan4to3()) 0.45f else 0.8f)
|
||||||
private val civBlocksWidth = playerPicker.civBlocksWidth
|
private val civBlocksWidth = playerPicker.civBlocksWidth
|
||||||
private val nationListTable = Table()
|
private val nationListTable = Table()
|
||||||
private val nationListScroll = ScrollPane(nationListTable)
|
private val nationListScroll = ScrollPane(nationListTable)
|
||||||
@ -356,7 +356,7 @@ private class NationPickerPopup(
|
|||||||
nationListScroll.setOverscroll(false, false)
|
nationListScroll.setOverscroll(false, false)
|
||||||
add(nationListScroll).size( civBlocksWidth + 10f, partHeight )
|
add(nationListScroll).size( civBlocksWidth + 10f, partHeight )
|
||||||
// +10, because the nation table has a 5f pad, for a total of +10f
|
// +10, because the nation table has a 5f pad, for a total of +10f
|
||||||
if (stage.isNarrowerThan4to3()) row()
|
if (stageToShowOn.isNarrowerThan4to3()) row()
|
||||||
nationDetailsScroll.setOverscroll(false, false)
|
nationDetailsScroll.setOverscroll(false, false)
|
||||||
add(nationDetailsScroll).size(civBlocksWidth + 10f, partHeight) // Same here, see above
|
add(nationDetailsScroll).size(civBlocksWidth + 10f, partHeight) // Same here, see above
|
||||||
|
|
||||||
|
@ -154,7 +154,7 @@ private fun addMultiplayerServerOptions(
|
|||||||
}).colspan(2).row()
|
}).colspan(2).row()
|
||||||
|
|
||||||
tab.add(connectionToServerButton.onClick {
|
tab.add(connectionToServerButton.onClick {
|
||||||
val popup = Popup(optionsPopup.stage).apply {
|
val popup = Popup(optionsPopup.stageToShowOn).apply {
|
||||||
addGoodSizedLabel("Awaiting response...").row()
|
addGoodSizedLabel("Awaiting response...").row()
|
||||||
}
|
}
|
||||||
popup.open(true)
|
popup.open(true)
|
||||||
|
@ -11,7 +11,7 @@ import kotlinx.coroutines.delay
|
|||||||
* This is an unobtrusive popup which will close itself after a given amount of time.
|
* This is an unobtrusive popup which will close itself after a given amount of time.
|
||||||
* Default time is two seconds (in milliseconds)
|
* Default time is two seconds (in milliseconds)
|
||||||
*/
|
*/
|
||||||
class ToastPopup (message: String, stage: Stage, val time: Long = 2000) : Popup(stage){
|
class ToastPopup (message: String, stageToShowOn: Stage, val time: Long = 2000) : Popup(stageToShowOn){
|
||||||
|
|
||||||
constructor(message: String, screen: BaseScreen, time: Long = 2000) : this(message, screen.stage, time)
|
constructor(message: String, screen: BaseScreen, time: Long = 2000) : this(message, screen.stage, time)
|
||||||
|
|
||||||
@ -24,7 +24,7 @@ class ToastPopup (message: String, stage: Stage, val time: Long = 2000) : Popup(
|
|||||||
open()
|
open()
|
||||||
//move it to the top so its not in the middle of the screen
|
//move it to the top so its not in the middle of the screen
|
||||||
//have to be done after open() because open() centers the popup
|
//have to be done after open() because open() centers the popup
|
||||||
y = stage.height - (height + 20f)
|
y = stageToShowOn.height - (height + 20f)
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun startTimer(){
|
private fun startTimer(){
|
||||||
|
@ -17,10 +17,10 @@ import com.unciv.ui.utils.extensions.toLabel
|
|||||||
*/
|
*/
|
||||||
open class YesNoPopup(
|
open class YesNoPopup(
|
||||||
question: String,
|
question: String,
|
||||||
stage: Stage,
|
stageToShowOn: Stage,
|
||||||
restoreDefault: () -> Unit = {},
|
restoreDefault: () -> Unit = {},
|
||||||
action: () -> Unit
|
action: () -> Unit
|
||||||
) : Popup(stage) {
|
) : Popup(stageToShowOn) {
|
||||||
|
|
||||||
constructor(
|
constructor(
|
||||||
question: String,
|
question: String,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user