mirror of
https://github.com/curioustorvald/Terrarum.git
synced 2026-03-08 12:51:51 +09:00
language menu to highlight current language on startup
This commit is contained in:
@@ -4,10 +4,10 @@ import com.badlogic.gdx.Input
|
||||
import com.badlogic.gdx.graphics.Camera
|
||||
import com.badlogic.gdx.graphics.g2d.SpriteBatch
|
||||
import net.torvald.terrarum.CommonResourcePool
|
||||
import net.torvald.terrarum.Second
|
||||
import net.torvald.terrarum.ui.UICanvas
|
||||
import net.torvald.terrarum.ui.UIItem
|
||||
import net.torvald.terrarum.ui.UIItemTextButton
|
||||
import net.torvald.terrarumsansbitmap.gdx.TextureRegionPack
|
||||
|
||||
/**
|
||||
* Created by minjaesong on 2021-09-15.
|
||||
@@ -21,37 +21,37 @@ class UIKeyboardControlPanel : UICanvas() {
|
||||
private val kbx = 61
|
||||
private val kby = 95
|
||||
|
||||
init {
|
||||
CommonResourcePool.addToLoadingList("inventory_category") {
|
||||
TextureRegionPack("./assets/graphics/gui/inventory/category.tga", 20, 20)
|
||||
}
|
||||
CommonResourcePool.loadAll()
|
||||
}
|
||||
|
||||
private val keycaps = hashMapOf(
|
||||
Input.Keys.APOSTROPHE to UIItemKeycap(this, kbx, kby, null),
|
||||
// ...
|
||||
)
|
||||
|
||||
override fun updateUI(delta: Float) {
|
||||
TODO("Not yet implemented")
|
||||
}
|
||||
|
||||
override fun renderUI(batch: SpriteBatch, camera: Camera) {
|
||||
TODO("Not yet implemented")
|
||||
}
|
||||
|
||||
override fun doOpening(delta: Float) {
|
||||
TODO("Not yet implemented")
|
||||
}
|
||||
|
||||
override fun doClosing(delta: Float) {
|
||||
TODO("Not yet implemented")
|
||||
}
|
||||
|
||||
override fun endOpening(delta: Float) {
|
||||
TODO("Not yet implemented")
|
||||
}
|
||||
|
||||
override fun endClosing(delta: Float) {
|
||||
TODO("Not yet implemented")
|
||||
}
|
||||
|
||||
override fun dispose() {
|
||||
TODO("Not yet implemented")
|
||||
}
|
||||
}
|
||||
|
||||
@@ -67,8 +67,8 @@ class UIItemKeycap(parent: UIKeyboardControlPanel, initialX: Int, initialY: Int,
|
||||
|
||||
private val labels = CommonResourcePool.getAsTextureRegionPack("inventory_category")
|
||||
|
||||
private val borderKeyForbidden = "0x000000C0"
|
||||
private val borderKeyNormal = "0xFFFFFFC0".toInt()
|
||||
private val borderKeyForbidden = 0x000000C0
|
||||
private val borderKeyNormal = 0xFFFFFFC0.toInt()
|
||||
private val borderKeyPressed = UIItemTextButton.defaultActiveCol
|
||||
|
||||
private val keycapFill = ItemSlotImageFactory.CELLCOLOUR_BLACK
|
||||
@@ -78,7 +78,6 @@ class UIItemKeycap(parent: UIKeyboardControlPanel, initialX: Int, initialY: Int,
|
||||
}
|
||||
|
||||
override fun dispose() {
|
||||
TODO("Not yet implemented")
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -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) {
|
||||
|
||||
Reference in New Issue
Block a user