diff --git a/assets/locales/de/terrarum.json b/assets/locales/de/terrarum.json index 254c560e9..f3696c5fd 100644 --- a/assets/locales/de/terrarum.json +++ b/assets/locales/de/terrarum.json @@ -4,5 +4,6 @@ "COPYRIGHT_GNU_GPL_3": "Verteilt unter GNU GPL 3", "APP_WARNING_HEALTH_AND_SAFETY": "WARNUNG-GESUNDHEIT UND SICHERHEIT", "MENU_LABEL_PRESS_START_SYMBOL": "Drücke >", - "MENU_MODULES" : "Modulen" + "MENU_MODULES" : "Modulen", + "GAME_ACTION_MOVE_VERB" : "Verschieben" } \ No newline at end of file diff --git a/assets/locales/en/terrarum.json b/assets/locales/en/terrarum.json index f547916bf..f2f736644 100644 --- a/assets/locales/en/terrarum.json +++ b/assets/locales/en/terrarum.json @@ -5,5 +5,7 @@ "APP_WARNING_HEALTH_AND_SAFETY": "WARNING-HEALTH AND SAFETY", "MENU_LABEL_PRESS_START_SYMBOL": "Press >", "MENU_MODULES" : "Modules", - "MENU_CREDIT_GPL_DNT" : "GPL" + "MENU_CREDIT_GPL_DNT" : "GPL", + "GAME_ACTION_MOVE_VERB" : "Move", + "GAME_ACTION_ZOOM" : "Zoom" } \ No newline at end of file diff --git a/assets/locales/es/terrarum.json b/assets/locales/es/terrarum.json index a2c85738b..00ee571aa 100644 --- a/assets/locales/es/terrarum.json +++ b/assets/locales/es/terrarum.json @@ -4,5 +4,6 @@ "COPYRIGHT_GNU_GPL_3": "Distribuido bajo GNU GPL 3", "APP_WARNING_HEALTH_AND_SAFETY": "ADVERTENCIA-SALUD Y SEGURIDAD", "MENU_LABEL_PRESS_START_SYMBOL": "Pulsa >", - "MENU_MODULES" : "Módulos" + "MENU_MODULES" : "Módulos", + "GAME_ACTION_MOVE_VERB" : "Mover" } \ No newline at end of file diff --git a/assets/locales/frFR/terrarum.json b/assets/locales/frFR/terrarum.json index 36e3f45a8..9ed62b05c 100644 --- a/assets/locales/frFR/terrarum.json +++ b/assets/locales/frFR/terrarum.json @@ -4,5 +4,7 @@ "COPYRIGHT_GNU_GPL_3": "Distribué sous GNU GPL 3", "APP_WARNING_HEALTH_AND_SAFETY": "ATTENTION-SANTÉ ET SÉCURITÉ", "MENU_LABEL_PRESS_START_SYMBOL": "Appuyez sur >", - "MENU_MODULES" : "Modules" + "MENU_MODULES" : "Modules", + "GAME_ACTION_MOVE_VERB" : "Déplacer", + "GAME_ACTION_ZOOM" : "Agrandir" } \ No newline at end of file diff --git a/assets/locales/jaJP/terrarum.json b/assets/locales/jaJP/terrarum.json index 47f10e367..e5506d489 100644 --- a/assets/locales/jaJP/terrarum.json +++ b/assets/locales/jaJP/terrarum.json @@ -4,5 +4,6 @@ "COPYRIGHT_GNU_GPL_3": "GNU GPL 3で配布", "APP_WARNING_HEALTH_AND_SAFETY": "警告ー健康と安全のために", "MENU_LABEL_PRESS_START_SYMBOL": "> ボタンを押す", - "MENU_MODULES" : "モジュール" + "MENU_MODULES" : "モジュール", + "GAME_ACTION_MOVE_VERB" : "移動する" } \ No newline at end of file diff --git a/assets/locales/koKR/terrarum.json b/assets/locales/koKR/terrarum.json index e83db8b7c..ca9781fb1 100644 --- a/assets/locales/koKR/terrarum.json +++ b/assets/locales/koKR/terrarum.json @@ -4,5 +4,7 @@ "COPYRIGHT_GNU_GPL_3": "GNU GPL 3에 따라 배포됨", "APP_WARNING_HEALTH_AND_SAFETY": "경고—건강과 안전을 위하여", "MENU_LABEL_PRESS_START_SYMBOL": ">을 누르세요", - "MENU_MODULES" : "모듈" + "MENU_MODULES" : "모듈", + "GAME_ACTION_MOVE_VERB" : "이동하기", + "GAME_ACTION_ZOOM" : "확대·축소" } \ No newline at end of file diff --git a/assets/locales/zhCN/terrarum.json b/assets/locales/zhCN/terrarum.json index 3da1bdf77..35739114b 100644 --- a/assets/locales/zhCN/terrarum.json +++ b/assets/locales/zhCN/terrarum.json @@ -8,5 +8,6 @@ "APP_CHINESE_HEALTHY_GAME_MSG_3": "适度游戏益脑 过度游戏伤身", "APP_CHINESE_HEALTHY_GAME_MSG_4": "合理安排时间 享受健康生活", "MENU_LABEL_PRESS_START_SYMBOL": "按下 >", - "MENU_MODULES" : "模块" + "MENU_MODULES" : "模块", + "GAME_ACTION_MOVE_VERB" : "移动" } \ No newline at end of file diff --git a/assets/locales/zhTW/terrarum.json b/assets/locales/zhTW/terrarum.json index 998690670..cc8385863 100644 --- a/assets/locales/zhTW/terrarum.json +++ b/assets/locales/zhTW/terrarum.json @@ -4,5 +4,6 @@ "COPYRIGHT_GNU_GPL_3": "分佈在GNU GPL 3下", "APP_WARNING_HEALTH_AND_SAFETY": "警告ー健康和安全", "MENU_LABEL_PRESS_START_SYMBOL": "按下 >", - "MENU_MODULES" : "模塊" + "MENU_MODULES" : "模塊", + "GAME_ACTION_MOVE_VERB" : "移動" } \ No newline at end of file diff --git a/src/net/torvald/terrarum/App.java b/src/net/torvald/terrarum/App.java index 765fa61e3..6b9a3a432 100644 --- a/src/net/torvald/terrarum/App.java +++ b/src/net/torvald/terrarum/App.java @@ -944,11 +944,6 @@ public class App implements ApplicationListener { operationSystem = "SOLARIS"; defaultDir = System.getProperty("user.home") + "/.Terrarum"; } - /*else if (System.getProperty("java.runtime.name").toUpperCase().contains("ANDROID")) { - operationSystem = "ANDROID"; - defaultDir = System.getProperty("user.home") + "/.Terrarum"; - environment = RunningEnvironment.MOBILE; - }*/ else { operationSystem = "UNKNOWN"; defaultDir = System.getProperty("user.home") + "/.Terrarum"; diff --git a/src/net/torvald/terrarum/modulebasegame/ui/UIKeyboardControlPanel.kt b/src/net/torvald/terrarum/modulebasegame/ui/UIKeyboardControlPanel.kt index 59fa3a808..c9c659e2b 100644 --- a/src/net/torvald/terrarum/modulebasegame/ui/UIKeyboardControlPanel.kt +++ b/src/net/torvald/terrarum/modulebasegame/ui/UIKeyboardControlPanel.kt @@ -9,10 +9,7 @@ import com.badlogic.gdx.graphics.g2d.TextureRegion import net.torvald.terrarum.App import net.torvald.terrarum.CommonResourcePool import net.torvald.terrarum.langpack.Lang -import net.torvald.terrarum.ui.Toolkit -import net.torvald.terrarum.ui.UICanvas -import net.torvald.terrarum.ui.UIItem -import net.torvald.terrarum.ui.UIItemTextButton +import net.torvald.terrarum.ui.* import net.torvald.terrarumsansbitmap.gdx.TextureRegionPack /** @@ -132,7 +129,11 @@ class UIKeyboardControlPanel : UICanvas() { init { keycaps.values.forEach { addUIitem(it) } + updateKeycaps() + } + private fun updateKeycaps() { + keycaps.values.forEach { it.symbolControl = null } // read config and put icons keycaps[App.getConfigInt("control_key_up")]?.symbolControl = symbolUp keycaps[App.getConfigInt("control_key_left")]?.symbolControl = symbolLeft @@ -142,7 +143,7 @@ class UIKeyboardControlPanel : UICanvas() { keycaps[App.getConfigInt("control_key_jump")]?.symbolControl = symbolJump keycaps[App.getConfigInt("control_key_zoom")]?.symbolControl = symbolZoom keycaps[App.getConfigInt("control_key_inventory")]?.symbolControl = symbolInventory - keycaps[App.getConfigInt("control_key_movementaux")]?.symbolControl = symbolGrapplingHook +// keycaps[App.getConfigInt("control_key_movementaux")]?.symbolControl = symbolGrapplingHook keycaps[App.getConfigInt("control_key_gamemenu")]?.symbolControl = symbolGamemenu } @@ -188,6 +189,16 @@ class UIKeyboardControlPanel : UICanvas() { } + fun setControlOf(key: Int, control: Int) { + println("control: $control") + println("config-key: ${UIItemControlPaletteBaloon.indexToConfigKey[control]}") + App.setConfig(UIItemControlPaletteBaloon.indexToConfigKey[control]!!, key) + println("keyboard-key: $key ${Input.Keys.toString(key)}") + println("after: ${App.getConfigInt(UIItemControlPaletteBaloon.indexToConfigKey[control]!!)} ${Input.Keys.toString(App.getConfigInt(UIItemControlPaletteBaloon.indexToConfigKey[control]!!))}") + + updateKeycaps() + } + override fun doOpening(delta: Float) { } @@ -290,23 +301,72 @@ class UIItemKeycap( class UIItemControlPaletteBaloon(val parent: UIKeyboardControlPanel, initialX: Int, initialY: Int) : UIItem(parent, initialX, initialY) { override val width = 480 - override val height = 240 + override val height = 260 override fun dispose() {} + private val icons = CommonResourcePool.getAsTextureRegionPack("inventory_category") + + private val iconButtons = arrayOf( + // left up right down + UIItemImageButton(parent, icons.get(0,2), initialX = initialX + 30, initialY = initialY + 40, highlightable = false, backgroundCol = Color(0), activeBackCol = Color(0), highlightBackCol = Color(0)), + UIItemImageButton(parent, icons.get(1,2), initialX = initialX + 60, initialY = initialY + 20, highlightable = false, backgroundCol = Color(0), activeBackCol = Color(0), highlightBackCol = Color(0)), + UIItemImageButton(parent, icons.get(2,2), initialX = initialX + 90, initialY = initialY + 40, highlightable = false, backgroundCol = Color(0), activeBackCol = Color(0), highlightBackCol = Color(0)), + UIItemImageButton(parent, icons.get(3,2), initialX = initialX + 60, initialY = initialY + 60, highlightable = false, backgroundCol = Color(0), activeBackCol = Color(0), highlightBackCol = Color(0)), + // jump + UIItemImageButton(parent, icons.get(4,2), initialX = initialX + 30, initialY = initialY + 100, highlightable = false, backgroundCol = Color(0), activeBackCol = Color(0), highlightBackCol = Color(0)), + // inventory + UIItemImageButton(parent, icons.get(9,0), initialX = initialX + 30, initialY = initialY + 140, highlightable = false, backgroundCol = Color(0), activeBackCol = Color(0), highlightBackCol = Color(0)), + // zoom + UIItemImageButton(parent, icons.get(5,2), initialX = initialX + 30, initialY = initialY + 180, highlightable = false, backgroundCol = Color(0), activeBackCol = Color(0), highlightBackCol = Color(0)), + // system menu + UIItemImageButton(parent, icons.get(6,2), initialX = initialX + 30, initialY = initialY + 220, highlightable = false, backgroundCol = Color(0), activeBackCol = Color(0), highlightBackCol = Color(0)), + ) + + companion object { + val indexToConfigKey = hashMapOf( + 0 to "control_key_left", + 1 to "control_key_up", + 2 to "control_key_right", + 3 to "control_key_down", + 4 to "control_key_junp", + 5 to "control_key_inventory", + 6 to "control_key_zoom", + 7 to "control_key_gamemenu" + ) + } override fun render(batch: SpriteBatch, camera: Camera) { super.render(batch, camera) Toolkit.drawBaloon(batch, posX.toFloat(), posY.toFloat(), width.toFloat(), height.toFloat()) + + iconButtons.forEach { it.render(batch, camera) } + + // texts + batch.color = Color.WHITE + App.fontGame.draw(batch, Lang["GAME_ACTION_MOVE_VERB"], posX + 130f, posY + 40f) + App.fontGame.draw(batch, Lang["GAME_ACTION_JUMP"], posX + 70f, posY + 100f) + App.fontGame.draw(batch, Lang["GAME_INVENTORY"], posX + 70f, posY + 140f) + App.fontGame.draw(batch, Lang["GAME_ACTION_ZOOM"], posX + 70f, posY + 180f) + App.fontGame.draw(batch, Lang["MENU_LABEL_MENU"], posX + 70f, posY + 220f) } + private var selected = -1 + override fun update(delta: Float) { super.update(delta) // unlatches mouse + iconButtons.forEachIndexed { index, it -> + it.update(delta) + if (it.mousePushed) { + selected = index + } + } // close if (!mouseLatched && mousePushed) { mouseLatched = true + parent.setControlOf(parent.keycapClicked, selected) parent.keycapClicked = -13372 } }