writing config to disk

This commit is contained in:
minjaesong
2021-09-19 15:15:42 +09:00
parent b741d463bb
commit 66e77e0a01
8 changed files with 76 additions and 6 deletions

View File

@@ -10,6 +10,7 @@ import net.torvald.terrarum.App.printdbgerr
import net.torvald.terrarum.QNDTreeNode
import net.torvald.terrarum.TitleScreen
import net.torvald.terrarum.Yaml
import net.torvald.terrarum.serialise.WriteConfig
import net.torvald.terrarum.ui.UICanvas
import net.torvald.terrarum.ui.UIItemTextButton
import net.torvald.terrarum.ui.UIItemTextButtonList
@@ -92,7 +93,13 @@ open class UIRemoCon(val parent: TitleScreen, treeRepresentation: QNDTreeNode<St
//System.exit(0)
Gdx.app.exit()
}
else if (it.labelText == "MENU_LABEL_RETURN") {
else if (it.labelText.startsWith("MENU_LABEL_RETURN")) {
val tag = it.labelText.substringAfter('+')
when (tag) {
"WRITETOCONFIG" -> WriteConfig()
}
if (currentRemoConContents.parent != null) {
remoConTray.consume()

View File

@@ -70,10 +70,12 @@ class UITitleLanguage : UICanvas() {
// attach listeners
textArea1.selectionChangeListener = { _, newSelectionIndex ->
App.GAME_LOCALE = localeList[newSelectionIndex]
App.setConfig("language", localeList[newSelectionIndex])
textArea2.deselect()
}
textArea2.selectionChangeListener = { _, newSelectionIndex ->
App.GAME_LOCALE = localeList[newSelectionIndex + localeFirstHalf.size]
App.setConfig("language", localeList[newSelectionIndex + localeFirstHalf.size])
textArea1.deselect()
}

View File

@@ -17,7 +17,7 @@ object UITitleRemoConYaml {
- MENU_OPTIONS_CONTROLS : net.torvald.terrarum.modulebasegame.ui.UIKeyboardControlPanel
- MENU_LABEL_LANGUAGE : net.torvald.terrarum.modulebasegame.ui.UITitleLanguage
- MENU_MODULES : net.torvald.terrarum.ModOptionsHost
- MENU_LABEL_RETURN
- MENU_LABEL_RETURN+WRITETOCONFIG
- MENU_LABEL_CREDITS
- MENU_LABEL_COPYRIGHT : net.torvald.terrarum.modulebasegame.ui.UITitleCredits
- MENU_CREDIT_GPL_DNT : net.torvald.terrarum.modulebasegame.ui.UITitleGPL3