buildingmaker resurrection wip

This commit is contained in:
minjaesong
2023-10-14 18:42:06 +09:00
parent 3c79586410
commit 228c9b8127
6 changed files with 53 additions and 28 deletions

View File

@@ -43,19 +43,28 @@ class UIBuildingMakerBlockChooser(val parent: BuildingMaker): UICanvas() {
// TODO scrolling of the palette, as the old method flat out won't work with The Flattening
private val tabs = UIItemTextButtonList(
this, 36, arrayOf("Terrain", "Wall", "Wire"),
0, 0, textAreaWidth = MENUBAR_SIZE, width = MENUBAR_SIZE,
defaultSelection = 0
this, 36, arrayOf("Terrain", "Wall", "Wire"),
0, 0, textAreaWidth = MENUBAR_SIZE, width = MENUBAR_SIZE,
defaultSelection = 0,
backgroundCol = UIItemTextButtonList.DEFAULT_BACKGROUNDCOL
)
private val closeButton = UIItemTextButtonList(
this, 36, arrayOf("Close"),
0, this.height - UIItemTextButtonList.DEFAULT_LINE_HEIGHT,
width = MENUBAR_SIZE, textAreaWidth = MENUBAR_SIZE
this, 36, arrayOf("Close"),
0, this.height - UIItemTextButtonList.DEFAULT_LINE_HEIGHT,
width = MENUBAR_SIZE, textAreaWidth = MENUBAR_SIZE,
backgroundCol = UIItemTextButtonList.DEFAULT_BACKGROUNDCOL
)
init {
BlockCodex.getAll().forEachIndexed { index, prop ->
BlockCodex.getAll().filter {
(try {
ItemCodex.getItemImage(it.id)
}
catch (e: NullPointerException) {
null
}) != null
}.forEachIndexed { index, prop ->
val paletteItem = UIItemImageButton(
this, ItemCodex.getItemImage(prop.id)!!,
initialX = MENUBAR_SIZE + (index % 16) * TILESREGION_SIZE,
@@ -128,9 +137,15 @@ class UIBuildingMakerBlockChooser(val parent: BuildingMaker): UICanvas() {
}
override fun renderUI(batch: SpriteBatch, camera: OrthographicCamera) {
palette.forEach { it.render(batch, camera) }
blendNormalStraightAlpha(batch)
// background
batch.color = DEFAULT_BACKGROUNDCOL
Toolkit.fillArea(batch, 0, 0, width, height)
palette.forEach { it.render(batch, camera) }
// gaps between tabs and close button
batch.color = DEFAULT_BACKGROUNDCOL
Toolkit.fillArea(batch, 0f, tabs.height.toFloat(), MENUBAR_SIZE.toFloat(), height.toFloat() - (tabs.height + closeButton.height))

View File

@@ -13,7 +13,7 @@ import net.torvald.terrarum.ui.UICanvas
/**
* Created by minjaesong on 2018-12-08.
*/
class UIProxyNewBuildingMaker : UICanvas() {
class UIProxyNewBuildingMaker(val remoCon: UIRemoCon) : UICanvas() {
override var width: Int = 0
override var height: Int = 0

View File

@@ -1,5 +1,6 @@
package net.torvald.terrarum.modulebasegame.ui
import net.torvald.terrarum.App
import net.torvald.terrarum.Yaml
@@ -32,6 +33,10 @@ object UITitleRemoConYaml {
- MENU_LABEL_QUIT
"""
val menuBaseDev = """
- MENU_MODE_BUILDINGMAKER : net.torvald.terrarum.modulebasegame.ui.UIProxyNewBuildingMaker
""" + menuBase
val menuWithSavefile = """
- MENU_LABEL_CONTINUE : net.torvald.terrarum.modulebasegame.ui.UIProxyLoadLatestSave
"""
@@ -57,6 +62,6 @@ object UITitleRemoConYaml {
operator fun invoke(hasSave: Boolean) =
// Yaml((if (hasSave) menuWithSavefile else menuNewGame) + menuBase).parse()
Yaml(menuBase).parse()
Yaml(if (App.IS_DEVELOPMENT_BUILD) menuBaseDev else menuBase).parse()
}