mirror of
https://github.com/yairm210/Unciv.git
synced 2025-02-11 11:28:03 +07:00
Added button to update an installed mod from its action menu (#6005)
Much easier and more intuitive than clicking on it, then on the equivalent online mod, then 'download'
This commit is contained in:
parent
bebc2c7e21
commit
7e59e28f1c
@ -400,13 +400,13 @@ class ModManagementScreen(
|
||||
refreshInstalledModTable()
|
||||
showModDescription(repo.name)
|
||||
unMarkUpdatedMod(repo.name)
|
||||
postAction()
|
||||
}
|
||||
} catch (ex: Exception) {
|
||||
postCrashHandlingRunnable {
|
||||
ToastPopup("Could not download [${repo.name}]", this)
|
||||
postAction()
|
||||
}
|
||||
} finally {
|
||||
postAction()
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -452,11 +452,10 @@ class ModManagementScreen(
|
||||
|
||||
// offer 'permanent visual mod' toggle
|
||||
val visualMods = game.settings.visualMods
|
||||
val isVisual = visualMods.contains(mod.name)
|
||||
installedModInfo[mod.name]?.state?.isVisual = isVisual
|
||||
val isVisualMod = visualMods.contains(mod.name)
|
||||
installedModInfo[mod.name]!!.state.isVisual = isVisualMod
|
||||
|
||||
val visualCheckBox = "Permanent audiovisual mod".toCheckBox(isVisual) {
|
||||
checked ->
|
||||
val visualCheckBox = "Permanent audiovisual mod".toCheckBox(isVisualMod) { checked ->
|
||||
if (checked)
|
||||
visualMods.add(mod.name)
|
||||
else
|
||||
@ -468,12 +467,18 @@ class ModManagementScreen(
|
||||
refreshInstalledModTable()
|
||||
}
|
||||
modActionTable.add(visualCheckBox).row()
|
||||
|
||||
if (installedModInfo[mod.name]!!.state.hasUpdate) {
|
||||
val updateModTextbutton = "Update [${mod.name}]".toTextButton()
|
||||
updateModTextbutton.onClick {
|
||||
updateModTextbutton.setText("Downloading...".tr())
|
||||
val repo = onlineModInfo[mod.name]!!.repo!!
|
||||
downloadMod(repo) { refreshInstalledModActions(mod) }
|
||||
}
|
||||
modActionTable.add(updateModTextbutton)
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
|
||||
*/
|
||||
|
||||
/** Rebuild the left-hand column containing all installed mods */
|
||||
internal fun refreshInstalledModTable() {
|
||||
// pre-init if not already done - important: keep the ModUIData instances later on or
|
||||
|
Loading…
Reference in New Issue
Block a user