mirror of
https://github.com/yairm210/Unciv.git
synced 2025-09-27 22:06:05 -04:00
Resolved #3317 - mod management screen displays properly again
3.11.9-patch2
This commit is contained in:
parent
b5c9fb79bf
commit
315a55f972
@ -3,8 +3,8 @@ package com.unciv.build
|
|||||||
object BuildConfig {
|
object BuildConfig {
|
||||||
const val kotlinVersion = "1.3.71"
|
const val kotlinVersion = "1.3.71"
|
||||||
const val appName = "Unciv"
|
const val appName = "Unciv"
|
||||||
const val appCodeNumber = 493
|
const val appCodeNumber = 494
|
||||||
const val appVersion = "3.11.9-patch1"
|
const val appVersion = "3.11.9-patch2"
|
||||||
|
|
||||||
const val gdxVersion = "1.9.12"
|
const val gdxVersion = "1.9.12"
|
||||||
const val roboVMVersion = "2.3.1"
|
const val roboVMVersion = "2.3.1"
|
||||||
|
@ -20,9 +20,9 @@ class ModManagementScreen: PickerScreen() {
|
|||||||
|
|
||||||
init {
|
init {
|
||||||
setDefaultCloseAction(MainMenuScreen())
|
setDefaultCloseAction(MainMenuScreen())
|
||||||
refresh()
|
refreshModTable()
|
||||||
|
|
||||||
topTable.add(ScrollPane(modTable)).height(topTable.height).pad(10f)
|
topTable.add(ScrollPane(modTable)).height(scrollPane.height).pad(10f)
|
||||||
|
|
||||||
downloadTable.add(getDownloadButton()).row()
|
downloadTable.add(getDownloadButton()).row()
|
||||||
|
|
||||||
@ -30,7 +30,6 @@ class ModManagementScreen: PickerScreen() {
|
|||||||
val repoList: ArrayList<Github.Repo>
|
val repoList: ArrayList<Github.Repo>
|
||||||
try {
|
try {
|
||||||
repoList = Github.tryGetGithubReposWithTopic()
|
repoList = Github.tryGetGithubReposWithTopic()
|
||||||
|
|
||||||
} catch (ex: Exception) {
|
} catch (ex: Exception) {
|
||||||
Gdx.app.postRunnable {
|
Gdx.app.postRunnable {
|
||||||
ToastPopup("Could not download mod list", this)
|
ToastPopup("Could not download mod list", this)
|
||||||
@ -57,10 +56,12 @@ class ModManagementScreen: PickerScreen() {
|
|||||||
}
|
}
|
||||||
downloadTable.add(downloadButton).row()
|
downloadTable.add(downloadButton).row()
|
||||||
}
|
}
|
||||||
|
downloadTable.pack()
|
||||||
|
(downloadTable.parent as ScrollPane).actor = downloadTable
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
topTable.add(ScrollPane(downloadTable)).height(topTable.height)
|
topTable.add(ScrollPane(downloadTable)).height(scrollPane.height)//.size(downloadTable.width, topTable.height)
|
||||||
}
|
}
|
||||||
|
|
||||||
fun getDownloadButton(): TextButton {
|
fun getDownloadButton(): TextButton {
|
||||||
@ -69,13 +70,13 @@ class ModManagementScreen: PickerScreen() {
|
|||||||
val popup = Popup(this)
|
val popup = Popup(this)
|
||||||
val textArea = TextArea("https://github.com/...",skin)
|
val textArea = TextArea("https://github.com/...",skin)
|
||||||
popup.add(textArea).width(stage.width/2).row()
|
popup.add(textArea).width(stage.width/2).row()
|
||||||
val downloadButton = "Download".toTextButton()
|
val actualDownloadButton = "Download".toTextButton()
|
||||||
downloadButton.onClick {
|
actualDownloadButton.onClick {
|
||||||
downloadButton.setText("Downloading...".tr())
|
actualDownloadButton.setText("Downloading...".tr())
|
||||||
downloadButton.disable()
|
actualDownloadButton.disable()
|
||||||
downloadMod(textArea.text) { popup.close() }
|
downloadMod(textArea.text) { popup.close() }
|
||||||
}
|
}
|
||||||
popup.add(downloadButton).row()
|
popup.add(actualDownloadButton).row()
|
||||||
popup.addCloseButton()
|
popup.addCloseButton()
|
||||||
popup.open()
|
popup.open()
|
||||||
}
|
}
|
||||||
@ -90,7 +91,7 @@ class ModManagementScreen: PickerScreen() {
|
|||||||
Gdx.app.postRunnable {
|
Gdx.app.postRunnable {
|
||||||
ToastPopup("Downloaded!", this)
|
ToastPopup("Downloaded!", this)
|
||||||
RulesetCache.loadRulesets()
|
RulesetCache.loadRulesets()
|
||||||
refresh()
|
refreshModTable()
|
||||||
}
|
}
|
||||||
} catch (ex:Exception){
|
} catch (ex:Exception){
|
||||||
Gdx.app.postRunnable {
|
Gdx.app.postRunnable {
|
||||||
@ -103,7 +104,7 @@ class ModManagementScreen: PickerScreen() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fun refresh(){
|
fun refreshModTable(){
|
||||||
modTable.clear()
|
modTable.clear()
|
||||||
val currentMods = RulesetCache.values.filter { it.name != "" }
|
val currentMods = RulesetCache.values.filter { it.name != "" }
|
||||||
for (mod in currentMods) {
|
for (mod in currentMods) {
|
||||||
@ -126,6 +127,6 @@ class ModManagementScreen: PickerScreen() {
|
|||||||
if(modFileHandle.isDirectory) modFileHandle.deleteDirectory()
|
if(modFileHandle.isDirectory) modFileHandle.deleteDirectory()
|
||||||
else modFileHandle.delete()
|
else modFileHandle.delete()
|
||||||
RulesetCache.loadRulesets()
|
RulesetCache.loadRulesets()
|
||||||
refresh()
|
refreshModTable()
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -46,14 +46,14 @@ open class CameraStageBaseScreen : Screen {
|
|||||||
stage.addListener(
|
stage.addListener(
|
||||||
object : InputListener() {
|
object : InputListener() {
|
||||||
override fun keyTyped(event: InputEvent?, character: Char): Boolean {
|
override fun keyTyped(event: InputEvent?, character: Char): Boolean {
|
||||||
if (character.toLowerCase() in keyPressDispatcher && !hasOpenPopups()) {
|
if (character.toLowerCase() !in keyPressDispatcher || hasOpenPopups())
|
||||||
//try-catch mainly for debugging. Breakpoints in the vicinity can make the event fire twice in rapid succession, second time the context can be invalid
|
return super.keyTyped(event, character)
|
||||||
try {
|
|
||||||
keyPressDispatcher[character.toLowerCase()]?.invoke()
|
//try-catch mainly for debugging. Breakpoints in the vicinity can make the event fire twice in rapid succession, second time the context can be invalid
|
||||||
} catch (ex: Exception) {}
|
try {
|
||||||
return true
|
keyPressDispatcher[character.toLowerCase()]?.invoke()
|
||||||
}
|
} catch (ex: Exception) {}
|
||||||
return super.keyTyped(event, character)
|
return true
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user