mirror of
https://github.com/curioustorvald/Terrarum.git
synced 2026-06-10 18:44:05 +09:00
buildingmaker resurrection wip
This commit is contained in:
@@ -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))
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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()
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user