mirror of
https://github.com/yairm210/Unciv.git
synced 2025-09-27 13:55:54 -04: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,16 +400,16 @@ class ModManagementScreen(
|
|||||||
refreshInstalledModTable()
|
refreshInstalledModTable()
|
||||||
showModDescription(repo.name)
|
showModDescription(repo.name)
|
||||||
unMarkUpdatedMod(repo.name)
|
unMarkUpdatedMod(repo.name)
|
||||||
|
postAction()
|
||||||
}
|
}
|
||||||
} catch (ex: Exception) {
|
} catch (ex: Exception) {
|
||||||
postCrashHandlingRunnable {
|
postCrashHandlingRunnable {
|
||||||
ToastPopup("Could not download [${repo.name}]", this)
|
ToastPopup("Could not download [${repo.name}]", this)
|
||||||
}
|
|
||||||
} finally {
|
|
||||||
postAction()
|
postAction()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/** Rewrite modOptions file for a mod we just installed to include metadata we got from the GitHub api
|
/** Rewrite modOptions file for a mod we just installed to include metadata we got from the GitHub api
|
||||||
*
|
*
|
||||||
@ -452,11 +452,10 @@ class ModManagementScreen(
|
|||||||
|
|
||||||
// offer 'permanent visual mod' toggle
|
// offer 'permanent visual mod' toggle
|
||||||
val visualMods = game.settings.visualMods
|
val visualMods = game.settings.visualMods
|
||||||
val isVisual = visualMods.contains(mod.name)
|
val isVisualMod = visualMods.contains(mod.name)
|
||||||
installedModInfo[mod.name]?.state?.isVisual = isVisual
|
installedModInfo[mod.name]!!.state.isVisual = isVisualMod
|
||||||
|
|
||||||
val visualCheckBox = "Permanent audiovisual mod".toCheckBox(isVisual) {
|
val visualCheckBox = "Permanent audiovisual mod".toCheckBox(isVisualMod) { checked ->
|
||||||
checked ->
|
|
||||||
if (checked)
|
if (checked)
|
||||||
visualMods.add(mod.name)
|
visualMods.add(mod.name)
|
||||||
else
|
else
|
||||||
@ -468,11 +467,17 @@ class ModManagementScreen(
|
|||||||
refreshInstalledModTable()
|
refreshInstalledModTable()
|
||||||
}
|
}
|
||||||
modActionTable.add(visualCheckBox).row()
|
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 */
|
/** Rebuild the left-hand column containing all installed mods */
|
||||||
internal fun refreshInstalledModTable() {
|
internal fun refreshInstalledModTable() {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user