new world ui to where it should be

This commit is contained in:
minjaesong
2021-10-26 19:20:48 +09:00
parent 08518fff06
commit ee2019e7dd
4 changed files with 14 additions and 7 deletions

Binary file not shown.

View File

@@ -5,6 +5,7 @@ import com.badlogic.gdx.graphics.Camera
import com.badlogic.gdx.graphics.Color
import com.badlogic.gdx.graphics.g2d.SpriteBatch
import net.torvald.terrarum.*
import net.torvald.terrarum.App.printdbg
import net.torvald.terrarum.App.printdbgerr
import net.torvald.terrarum.serialise.WriteConfig
import net.torvald.terrarum.ui.Toolkit
@@ -39,13 +40,17 @@ open class UIRemoCon(val parent: TitleScreen, treeRepresentation: QNDTreeNode<St
init {
remoConTray = generateNewRemoCon(currentRemoConContents)
treeRepresentation.traversePreorder { node, _ ->
registerUIclasses(treeRepresentation)
}
private fun registerUIclasses(tree: QNDTreeNode<String>) {
tree.traversePreorder { node, _ ->
val splittedNodeName = node.data?.split(yamlSep)
if (splittedNodeName?.size == 2 && node.data != null) {
try {
val attachedClass = loadClass(splittedNodeName[1]) // check existance
screenNames[node.data!!] = splittedNodeName[1]
val attachedClass = loadClass(splittedNodeName[1]) // check existence
screenNames[node.data!!] = splittedNodeName[1] // actual loading will by dynamic as some UIs need to be re-initialised as they're called
}
catch (e: java.lang.ClassNotFoundException) {
printdbgerr(this, "class '${splittedNodeName[1]}' was not found, skipping")
@@ -128,6 +133,7 @@ open class UIRemoCon(val parent: TitleScreen, treeRepresentation: QNDTreeNode<St
openUI?.setAsClose()
openUI?.dispose()
printdbg(this, "$currentlySelectedRemoConItem has screen: ${screenNames.containsKey(currentlySelectedRemoConItem)}")
screenNames[currentlySelectedRemoConItem]?.let {
val ui = loadClass(it)
ui.setPosition(0,0)
@@ -164,6 +170,8 @@ open class UIRemoCon(val parent: TitleScreen, treeRepresentation: QNDTreeNode<St
currentRemoConContents = newCurrentRemoConContents
}
registerUIclasses(newCurrentRemoConContents)
currentlySelectedRemoConItem = newCurrentRemoConContents.data
}

View File

@@ -17,7 +17,6 @@ object UITitleRemoConYaml {
- MENU_LABEL_GRAPHICS : net.torvald.terrarum.modulebasegame.ui.GraphicsControlPanel
- MENU_OPTIONS_CONTROLS : net.torvald.terrarum.modulebasegame.ui.UIKeyboardControlPanel
- MENU_LABEL_LANGUAGE : net.torvald.terrarum.modulebasegame.ui.UITitleLanguage
- TEST : net.torvald.terrarum.modulebasegame.ui.UINewWorld
- MENU_MODULES : net.torvald.terrarum.ModOptionsHost
- MENU_LABEL_RETURN+WRITETOCONFIG
- MENU_LABEL_CREDITS

Binary file not shown.