language menu to highlight current language on startup

This commit is contained in:
minjaesong
2021-09-15 18:46:45 +09:00
parent 4ac3df0d85
commit 35e2b6a0a9
2 changed files with 22 additions and 12 deletions

View File

@@ -8,7 +8,6 @@ import net.torvald.terrarum.Second
import net.torvald.terrarum.langpack.Lang
import net.torvald.terrarum.ui.UICanvas
import net.torvald.terrarum.ui.UIItemTextButtonList
import kotlin.math.roundToInt
class UITitleLanguage : UICanvas() {
@@ -77,6 +76,18 @@ class UITitleLanguage : UICanvas() {
textArea1.deselect()
}
// highlight initial
textArea1.buttons.forEachIndexed { index, it ->
if (it.labelText == Lang["MENU_LANGUAGE_THIS"]) {
textArea1.select(index)
}
}
textArea2.buttons.forEachIndexed { index, it ->
if (it.labelText == Lang["MENU_LANGUAGE_THIS"]) {
textArea2.select(index)
}
}
}
override fun updateUI(delta: Float) {