mirror of
https://github.com/curioustorvald/Terrarum.git
synced 2026-06-12 03:24:06 +09:00
crafting guide wip and stash for next version
This commit is contained in:
Binary file not shown.
@@ -6,5 +6,5 @@ entrypoint=net.torvald.terrarum.musicplayer.EntryPoint
|
|||||||
releasedate=2024-02-10
|
releasedate=2024-02-10
|
||||||
version=1.0.0
|
version=1.0.0
|
||||||
jar=MusicPlayer.jar
|
jar=MusicPlayer.jar
|
||||||
jarhash=9991cb83bfaf8b110a92dcc7565f057e0959025e24f02502fb8e61fe2086ead7
|
jarhash=c8896ce5b2aa79057e1324a701c1c5bd4099a8a651f044a120ad700cedfbb16e
|
||||||
dependency=basegame 0.4.0
|
dependency=basegame 0.4.0
|
||||||
|
|||||||
@@ -100,7 +100,6 @@ class UIBuildingMakerBlockChooser(val parent: BuildingMaker): UICanvas() {
|
|||||||
height = TILESREGION_SIZE,
|
height = TILESREGION_SIZE,
|
||||||
highlightCol = Color.WHITE,
|
highlightCol = Color.WHITE,
|
||||||
activeCol = Color.WHITE,
|
activeCol = Color.WHITE,
|
||||||
backgroundCol = Color(0)
|
|
||||||
)
|
)
|
||||||
val paletteItem2 = UIItemImageButton(
|
val paletteItem2 = UIItemImageButton(
|
||||||
this, ItemCodex.getItemImage(prop.id)!!,
|
this, ItemCodex.getItemImage(prop.id)!!,
|
||||||
@@ -112,7 +111,6 @@ class UIBuildingMakerBlockChooser(val parent: BuildingMaker): UICanvas() {
|
|||||||
highlightCol = Color.WHITE,
|
highlightCol = Color.WHITE,
|
||||||
activeCol = WALL_OVERLAY_COLOUR,
|
activeCol = WALL_OVERLAY_COLOUR,
|
||||||
inactiveCol = WALL_OVERLAY_COLOUR,
|
inactiveCol = WALL_OVERLAY_COLOUR,
|
||||||
backgroundCol = Color(0)
|
|
||||||
)
|
)
|
||||||
|
|
||||||
paletteItem.clickOnceListener = { _, _ -> parent.setPencilColour(prop.id) }
|
paletteItem.clickOnceListener = { _, _ -> parent.setPencilColour(prop.id) }
|
||||||
|
|||||||
@@ -58,9 +58,6 @@ class UIBuildingMakerPenMenu(val parent: BuildingMaker): UICanvas() {
|
|||||||
|
|
||||||
UIItemImageButton(
|
UIItemImageButton(
|
||||||
this, toolIcons.get(it, 0),
|
this, toolIcons.get(it, 0),
|
||||||
backgroundCol = Color(0),
|
|
||||||
highlightBackCol = Color(0),
|
|
||||||
activeBackCol = Color(0),
|
|
||||||
initialX = newvec.x.roundToInt(),
|
initialX = newvec.x.roundToInt(),
|
||||||
initialY = newvec.y.roundToInt(),
|
initialY = newvec.y.roundToInt(),
|
||||||
width = ICON_SIZE, height = ICON_SIZE,
|
width = ICON_SIZE, height = ICON_SIZE,
|
||||||
|
|||||||
@@ -91,8 +91,11 @@ class UICrafting(val full: UIInventoryFull?) : UICanvas(
|
|||||||
}}
|
}}
|
||||||
}
|
}
|
||||||
|
|
||||||
private val itemListCraftable: UIItemCraftingCandidateGrid // might be changed to something else
|
private val catIcons = CommonResourcePool.getAsTextureRegionPack("inventory_category")
|
||||||
private val itemListIngredients: UIItemInventoryItemGrid // this one is definitely not to be changed
|
|
||||||
|
|
||||||
|
internal val itemListCraftable: UIItemCraftingCandidateGrid // might be changed to something else
|
||||||
|
internal val itemListIngredients: UIItemInventoryItemGrid // this one is definitely not to be changed
|
||||||
private val buttonCraft: UIItemTextButton
|
private val buttonCraft: UIItemTextButton
|
||||||
private val spinnerCraftCount: UIItemSpinner
|
private val spinnerCraftCount: UIItemSpinner
|
||||||
|
|
||||||
@@ -311,11 +314,40 @@ class UICrafting(val full: UIInventoryFull?) : UICanvas(
|
|||||||
|
|
||||||
handler.allowESCtoClose = true
|
handler.allowESCtoClose = true
|
||||||
|
|
||||||
|
|
||||||
|
val menuButtonTechView = UIItemImageButton(
|
||||||
|
this, catIcons.get(20, 1),
|
||||||
|
initialX = itemListCraftable.navRemoCon.posX + 12,
|
||||||
|
initialY = itemListCraftable.navRemoCon.getIconPosY(-2) - 8,
|
||||||
|
highlightable = true
|
||||||
|
).also {
|
||||||
|
it.clickOnceListener = { _, _ ->
|
||||||
|
full?.transitionPanel?.setLeftUIto(1)
|
||||||
|
full?.transitionPanel?.uis?.get(0)?.show()
|
||||||
|
it.highlighted = false
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
val menuButtonCraft = UIItemImageButton(
|
||||||
|
this, catIcons.get(19, 1),
|
||||||
|
initialX = itemListCraftable.navRemoCon.posX + 12,
|
||||||
|
initialY = itemListCraftable.navRemoCon.getIconPosY(-1) - 8,
|
||||||
|
activeCol = Toolkit.Theme.COL_SELECTED,
|
||||||
|
inactiveCol = Toolkit.Theme.COL_SELECTED,
|
||||||
|
highlightable = true
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
addUIitem(itemListCraftable)
|
addUIitem(itemListCraftable)
|
||||||
addUIitem(itemListIngredients)
|
addUIitem(itemListIngredients)
|
||||||
addUIitem(playerThings)
|
addUIitem(playerThings)
|
||||||
addUIitem(spinnerCraftCount)
|
addUIitem(spinnerCraftCount)
|
||||||
addUIitem(buttonCraft)
|
addUIitem(buttonCraft)
|
||||||
|
// temporarily disabled for 0.4 release
|
||||||
|
if (TerrarumAppConfiguration.VERSION_RAW >= 0x0000_000005_000000) {
|
||||||
|
addUIitem(menuButtonCraft)
|
||||||
|
addUIitem(menuButtonTechView)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun filterPlayerListUsing(recipe: CraftingCodex.CraftingRecipe?) {
|
private fun filterPlayerListUsing(recipe: CraftingCodex.CraftingRecipe?) {
|
||||||
|
|||||||
@@ -246,17 +246,18 @@ class UIInventoryFull(
|
|||||||
|
|
||||||
|
|
||||||
// private val transitionalMinimap = UIInventoryMinimap(this)
|
// private val transitionalMinimap = UIInventoryMinimap(this)
|
||||||
private val transitionalCraftingUI = UICrafting(this)
|
internal val transitionalCraftingUI = UICrafting(this)
|
||||||
private val transitionalItemCells = UIInventoryCells(this)
|
internal val transitionalTechTreeViewUI = UITechView(this)
|
||||||
private val transitionalEscMenu = UIInventoryEscMenu(this)
|
internal val transitionalItemCells = UIInventoryCells(this)
|
||||||
private val transitionPanel = UIItemHorizontalFadeSlide(
|
internal val transitionalEscMenu = UIInventoryEscMenu(this)
|
||||||
|
val transitionPanel = UIItemHorizontalFadeSlide(
|
||||||
this,
|
this,
|
||||||
(width - internalWidth) / 2,
|
(width - internalWidth) / 2,
|
||||||
INVENTORY_CELLS_OFFSET_Y(),
|
INVENTORY_CELLS_OFFSET_Y(),
|
||||||
width,
|
width,
|
||||||
App.scr.height,
|
App.scr.height,
|
||||||
1f,
|
1f,
|
||||||
listOf(transitionalCraftingUI),
|
listOf(transitionalCraftingUI, transitionalTechTreeViewUI),
|
||||||
listOf(transitionalItemCells),
|
listOf(transitionalItemCells),
|
||||||
listOf(transitionalEscMenu)
|
listOf(transitionalEscMenu)
|
||||||
)
|
)
|
||||||
@@ -319,6 +320,7 @@ class UIInventoryFull(
|
|||||||
transitionPanel.forcePosition(0)
|
transitionPanel.forcePosition(0)
|
||||||
catBar.setSelectedPanel(0)
|
catBar.setSelectedPanel(0)
|
||||||
transitionalCraftingUI.resetUI()
|
transitionalCraftingUI.resetUI()
|
||||||
|
transitionalTechTreeViewUI.resetUI()
|
||||||
it.setAsOpen()
|
it.setAsOpen()
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -387,7 +389,7 @@ class UIInventoryFull(
|
|||||||
|
|
||||||
override fun doOpening(delta: Float) {
|
override fun doOpening(delta: Float) {
|
||||||
super.doOpening(delta)
|
super.doOpening(delta)
|
||||||
transitionPanel.uis.forEach { it.opacity = FastMath.pow(opacity, 0.5f) }
|
transitionPanel.allUIs.forEach { it.opacity = FastMath.pow(opacity, 0.5f) }
|
||||||
INGAME.pause()
|
INGAME.pause()
|
||||||
INGAME.setTooltipMessage(null)
|
INGAME.setTooltipMessage(null)
|
||||||
|
|
||||||
@@ -399,7 +401,7 @@ class UIInventoryFull(
|
|||||||
|
|
||||||
override fun doClosing(delta: Float) {
|
override fun doClosing(delta: Float) {
|
||||||
super.doClosing(delta)
|
super.doClosing(delta)
|
||||||
transitionPanel.uis.forEach { it.opacity = FastMath.pow(opacity, 0.5f) }
|
transitionPanel.allUIs.forEach { it.opacity = FastMath.pow(opacity, 0.5f) }
|
||||||
INGAME.resume()
|
INGAME.resume()
|
||||||
INGAME.setTooltipMessage(null)
|
INGAME.setTooltipMessage(null)
|
||||||
|
|
||||||
@@ -415,14 +417,14 @@ class UIInventoryFull(
|
|||||||
|
|
||||||
override fun endOpening(delta: Float) {
|
override fun endOpening(delta: Float) {
|
||||||
super.endOpening(delta)
|
super.endOpening(delta)
|
||||||
transitionPanel.uis.forEach { it.opacity = FastMath.pow(opacity, 0.5f) }
|
transitionPanel.allUIs.forEach { it.opacity = 1f }
|
||||||
|
|
||||||
shouldIFadeIn = null
|
shouldIFadeIn = null
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun endClosing(delta: Float) {
|
override fun endClosing(delta: Float) {
|
||||||
super.endClosing(delta)
|
super.endClosing(delta)
|
||||||
transitionPanel.uis.forEach { it.opacity = FastMath.pow(opacity, 0.5f) }
|
transitionPanel.allUIs.forEach { it.opacity = 0f }
|
||||||
INGAME.setTooltipMessage(null) // required!
|
INGAME.setTooltipMessage(null) // required!
|
||||||
// MinimapComposer.revalidateAll()
|
// MinimapComposer.revalidateAll()
|
||||||
|
|
||||||
|
|||||||
@@ -34,8 +34,12 @@ class UIItemListNavBarVertical(
|
|||||||
const val LIST_TO_CONTROL_GAP = 12
|
const val LIST_TO_CONTROL_GAP = 12
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun getIconPosY(index: Int) =
|
fun getIconPosY(index: Int) =
|
||||||
posY + 26 * index
|
if (index >= 0)
|
||||||
|
posY + 26 * index
|
||||||
|
else
|
||||||
|
(posY + height) + (26 * index)
|
||||||
|
|
||||||
private val catIcons = CommonResourcePool.getAsTextureRegionPack("inventory_category")
|
private val catIcons = CommonResourcePool.getAsTextureRegionPack("inventory_category")
|
||||||
private val iconPosX = posX + LIST_TO_CONTROL_GAP
|
private val iconPosX = posX + LIST_TO_CONTROL_GAP
|
||||||
|
|
||||||
@@ -43,11 +47,6 @@ class UIItemListNavBarVertical(
|
|||||||
UIItemImageButton(
|
UIItemImageButton(
|
||||||
parentUI,
|
parentUI,
|
||||||
catIcons.get(index + 14, 0),
|
catIcons.get(index + 14, 0),
|
||||||
backgroundCol = Color(0),
|
|
||||||
activeBackCol = Color(0),
|
|
||||||
highlightBackCol = Color(0),
|
|
||||||
activeBackBlendMode = BlendMode.NORMAL,
|
|
||||||
activeCol = Toolkit.Theme.COL_MOUSE_UP,
|
|
||||||
initialX = iconPosX,
|
initialX = iconPosX,
|
||||||
initialY = getIconPosY(index),
|
initialY = getIconPosY(index),
|
||||||
highlightable = true
|
highlightable = true
|
||||||
@@ -57,10 +56,6 @@ class UIItemListNavBarVertical(
|
|||||||
val scrollUpButton = UIItemImageButton(
|
val scrollUpButton = UIItemImageButton(
|
||||||
parentUI,
|
parentUI,
|
||||||
catIcons.get(18, 0),
|
catIcons.get(18, 0),
|
||||||
backgroundCol = Color(0),
|
|
||||||
activeBackCol = Color(0),
|
|
||||||
activeBackBlendMode = BlendMode.NORMAL,
|
|
||||||
activeCol = Toolkit.Theme.COL_MOUSE_UP,
|
|
||||||
initialX = iconPosX,
|
initialX = iconPosX,
|
||||||
initialY = getIconPosY(2 - (!hasGridModeButtons).toInt(1)),
|
initialY = getIconPosY(2 - (!hasGridModeButtons).toInt(1)),
|
||||||
highlightable = false
|
highlightable = false
|
||||||
@@ -69,10 +64,6 @@ class UIItemListNavBarVertical(
|
|||||||
val scrollDownButton = UIItemImageButton(
|
val scrollDownButton = UIItemImageButton(
|
||||||
parentUI,
|
parentUI,
|
||||||
catIcons.get(19, 0),
|
catIcons.get(19, 0),
|
||||||
backgroundCol = Color(0),
|
|
||||||
activeBackCol = Color(0),
|
|
||||||
activeBackBlendMode = BlendMode.NORMAL,
|
|
||||||
activeCol = Toolkit.Theme.COL_MOUSE_UP,
|
|
||||||
initialX = iconPosX,
|
initialX = iconPosX,
|
||||||
initialY = getIconPosY(3 - (!hasGridModeButtons).toInt(1)),
|
initialY = getIconPosY(3 - (!hasGridModeButtons).toInt(1)),
|
||||||
highlightable = false
|
highlightable = false
|
||||||
|
|||||||
@@ -401,37 +401,37 @@ class UIItemControlPaletteBaloon(val parent: UIKeyboardControlPanel, initialX: I
|
|||||||
// TEXT IS MANUALLY PRINTED ON render() !!
|
// TEXT IS MANUALLY PRINTED ON render() !!
|
||||||
private val iconButtons = arrayOf(
|
private val iconButtons = arrayOf(
|
||||||
// left up right down
|
// left up right down
|
||||||
UIItemImageButton(parent, Keebsym.LEFT, initialX = col0 - 34, initialY = initialY + 43, highlightable = false, backgroundCol = Color(0), activeBackCol = Color(0), highlightBackCol = Color(0)),
|
UIItemImageButton(parent, Keebsym.LEFT, initialX = col0 - 34, initialY = initialY + 43, highlightable = false),
|
||||||
UIItemImageButton(parent, Keebsym.UP, initialX = col0, initialY = initialY + 26, highlightable = false, backgroundCol = Color(0), activeBackCol = Color(0), highlightBackCol = Color(0)),
|
UIItemImageButton(parent, Keebsym.UP, initialX = col0, initialY = initialY + 26, highlightable = false),
|
||||||
UIItemImageButton(parent, Keebsym.DOWN, initialX = col0, initialY = initialY + 60, highlightable = false, backgroundCol = Color(0), activeBackCol = Color(0), highlightBackCol = Color(0)),
|
UIItemImageButton(parent, Keebsym.DOWN, initialX = col0, initialY = initialY + 60, highlightable = false),
|
||||||
UIItemImageButton(parent, Keebsym.RIGHT, initialX = col0 + 34, initialY = initialY + 43, highlightable = false, backgroundCol = Color(0), activeBackCol = Color(0), highlightBackCol = Color(0)),
|
UIItemImageButton(parent, Keebsym.RIGHT, initialX = col0 + 34, initialY = initialY + 43, highlightable = false),
|
||||||
|
|
||||||
// jump
|
// jump
|
||||||
UIItemImageButton(parent, Keebsym.JUMP, initialX = col1, initialY = initialY + 43, highlightable = false, backgroundCol = Color(0), activeBackCol = Color(0), highlightBackCol = Color(0)),
|
UIItemImageButton(parent, Keebsym.JUMP, initialX = col1, initialY = initialY + 43, highlightable = false),
|
||||||
|
|
||||||
// inventory
|
// inventory
|
||||||
UIItemImageButton(parent, Keebsym.INVENTORY, initialX = col0, initialY = row1, highlightable = false, backgroundCol = Color(0), activeBackCol = Color(0), highlightBackCol = Color(0)),
|
UIItemImageButton(parent, Keebsym.INVENTORY, initialX = col0, initialY = row1, highlightable = false),
|
||||||
// crafting
|
// crafting
|
||||||
UIItemImageButton(parent, Keebsym.CRAFTING, initialX = col0, initialY = row2, highlightable = false, backgroundCol = Color(0), activeBackCol = Color(0), highlightBackCol = Color(0)),
|
UIItemImageButton(parent, Keebsym.CRAFTING, initialX = col0, initialY = row2, highlightable = false),
|
||||||
// hook
|
// hook
|
||||||
UIItemImageButton(parent, Keebsym.HOOK, initialX = col0, initialY = row3, highlightable = false, backgroundCol = Color(0), activeBackCol = Color(0), highlightBackCol = Color(0)),
|
UIItemImageButton(parent, Keebsym.HOOK, initialX = col0, initialY = row3, highlightable = false),
|
||||||
// quicksel
|
// quicksel
|
||||||
UIItemImageButton(parent, Keebsym.PIE, initialX = col0, initialY = row4, highlightable = false, backgroundCol = Color(0), activeBackCol = Color(0), highlightBackCol = Color(0)),
|
UIItemImageButton(parent, Keebsym.PIE, initialX = col0, initialY = row4, highlightable = false),
|
||||||
|
|
||||||
// zoom
|
// zoom
|
||||||
UIItemImageButton(parent, Keebsym.ZOOM, initialX = col1, initialY = row1, highlightable = false, backgroundCol = Color(0), activeBackCol = Color(0), highlightBackCol = Color(0)),
|
UIItemImageButton(parent, Keebsym.ZOOM, initialX = col1, initialY = row1, highlightable = false),
|
||||||
// IME
|
// IME
|
||||||
UIItemImageButton(parent, Keebsym.IME(), initialX = col1, initialY = row2, highlightable = false, backgroundCol = Color(0), activeBackCol = Color(0), highlightBackCol = Color(0)),
|
UIItemImageButton(parent, Keebsym.IME(), initialX = col1, initialY = row2, highlightable = false),
|
||||||
// system menu
|
// system menu
|
||||||
UIItemImageButton(parent, Keebsym.MENU, initialX = col1, initialY = row3, highlightable = false, backgroundCol = Color(0), activeBackCol = Color(0), highlightBackCol = Color(0)),
|
UIItemImageButton(parent, Keebsym.MENU, initialX = col1, initialY = row3, highlightable = false),
|
||||||
// toss item
|
// toss item
|
||||||
UIItemImageButton(parent, Keebsym.DISCARD, initialX = col1, initialY = row4, highlightable = false, backgroundCol = Color(0), activeBackCol = Color(0), highlightBackCol = Color(0)),
|
UIItemImageButton(parent, Keebsym.DISCARD, initialX = col1, initialY = row4, highlightable = false),
|
||||||
|
|
||||||
)
|
)
|
||||||
|
|
||||||
// close button is just for the cosmetics; the uiitem closes when you click anywhere on the UI
|
// close button is just for the cosmetics; the uiitem closes when you click anywhere on the UI
|
||||||
private val closeButton2 = UIItemImageButton(parent, Keebsym.CLOSE, initialX = initialX + width - 20, initialY = initialY, highlightable = false, backgroundCol = Color(0), activeBackCol = Color(0), highlightBackCol = Color(0))
|
private val closeButton2 = UIItemImageButton(parent, Keebsym.CLOSE, initialX = initialX + width - 20, initialY = initialY, highlightable = false)
|
||||||
private val closeButton1 = UIItemImageButton(parent, Keebsym.CLOSE, initialX = initialX + 1, initialY = initialY, highlightable = false, backgroundCol = Color(0), activeBackCol = Color(0), highlightBackCol = Color(0))
|
private val closeButton1 = UIItemImageButton(parent, Keebsym.CLOSE, initialX = initialX + 1, initialY = initialY, highlightable = false)
|
||||||
|
|
||||||
// indices must correspond with what's on the UIItemControlPaletteBaloon.iconButtons
|
// indices must correspond with what's on the UIItemControlPaletteBaloon.iconButtons
|
||||||
companion object {
|
companion object {
|
||||||
|
|||||||
144
src/net/torvald/terrarum/modulebasegame/ui/UITechView.kt
Normal file
144
src/net/torvald/terrarum/modulebasegame/ui/UITechView.kt
Normal file
@@ -0,0 +1,144 @@
|
|||||||
|
package net.torvald.terrarum.modulebasegame.ui
|
||||||
|
|
||||||
|
import com.badlogic.gdx.graphics.Color
|
||||||
|
import com.badlogic.gdx.graphics.OrthographicCamera
|
||||||
|
import com.badlogic.gdx.graphics.g2d.SpriteBatch
|
||||||
|
import net.torvald.terrarum.*
|
||||||
|
import net.torvald.terrarum.langpack.Lang
|
||||||
|
import net.torvald.terrarum.ui.Toolkit
|
||||||
|
import net.torvald.terrarum.ui.UICanvas
|
||||||
|
import net.torvald.terrarum.ui.UIItemImageButton
|
||||||
|
import net.torvald.terrarum.ui.UIItemInventoryElemSimple
|
||||||
|
import net.torvald.unicode.getKeycapPC
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Created by minjaesong on 2024-02-18.
|
||||||
|
*/
|
||||||
|
class UITechView(val full: UIInventoryFull?, private val colourTheme: InventoryCellColourTheme = UIItemInventoryCellCommonRes.defaultInventoryCellTheme,
|
||||||
|
) : UICanvas(
|
||||||
|
toggleKeyLiteral = if (full == null) "control_key_inventory" else null,
|
||||||
|
toggleButtonLiteral = if (full == null) "control_gamepad_start" else null
|
||||||
|
) {
|
||||||
|
|
||||||
|
override var width = Toolkit.drawWidth
|
||||||
|
override var height = App.scr.height
|
||||||
|
|
||||||
|
private val verticalCells = UIInventoryFull.CELLS_VRT
|
||||||
|
private val halfSlotOffset = (UIItemInventoryElemSimple.height + UIItemInventoryItemGrid.listGap) / 2
|
||||||
|
|
||||||
|
private val posX0 = UIInventoryFull.INVENTORY_CELLS_OFFSET_X() + UIItemInventoryElemSimple.height + UIItemInventoryItemGrid.listGap - halfSlotOffset
|
||||||
|
private val posY0 = UIInventoryFull.INVENTORY_CELLS_OFFSET_Y()
|
||||||
|
|
||||||
|
private val posX1 = posX0 - UIItemListNavBarVertical.LIST_TO_CONTROL_GAP - UIItemListNavBarVertical.WIDTH - 4
|
||||||
|
private val posY1 = posY0
|
||||||
|
|
||||||
|
// private val navbarX = posX1 + UIItemListNavBarVertical.LIST_TO_CONTROL_GAP
|
||||||
|
// private val navbarY = posY1
|
||||||
|
private val navbarX = full!!.transitionalCraftingUI.itemListCraftable.navRemoCon.posX + 12
|
||||||
|
private val navbarY = full!!.transitionalCraftingUI.itemListCraftable.navRemoCon.posY - 8
|
||||||
|
private val navbarWidth = UIItemListNavBarVertical.WIDTH
|
||||||
|
private val navbarHeight = full!!.transitionalCraftingUI.itemListCraftable.height
|
||||||
|
|
||||||
|
private val panelX = 32 + navbarX
|
||||||
|
private val panelY = navbarY
|
||||||
|
private val panelWidth = 720
|
||||||
|
private val panelHeight = navbarHeight
|
||||||
|
|
||||||
|
private val catIcons = CommonResourcePool.getAsTextureRegionPack("inventory_category")
|
||||||
|
|
||||||
|
private val menuButtonTechView = UIItemImageButton(
|
||||||
|
this, catIcons.get(20, 1),
|
||||||
|
initialX = navbarX,
|
||||||
|
initialY = getIconPosY(-2),
|
||||||
|
activeCol = Toolkit.Theme.COL_SELECTED,
|
||||||
|
inactiveCol = Toolkit.Theme.COL_SELECTED,
|
||||||
|
highlightable = false
|
||||||
|
)
|
||||||
|
private val menuButtonCraft = UIItemImageButton(
|
||||||
|
this, catIcons.get(19, 1),
|
||||||
|
initialX = navbarX,
|
||||||
|
initialY = getIconPosY(-1),
|
||||||
|
highlightable = true
|
||||||
|
).also {
|
||||||
|
it.clickOnceListener = { _, _ ->
|
||||||
|
full?.transitionPanel?.setLeftUIto(0)
|
||||||
|
full?.transitionPanel?.uis?.get(0)?.show()
|
||||||
|
it.highlighted = false
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
fun getIconPosY(index: Int) =
|
||||||
|
if (index >= 0)
|
||||||
|
posY1 + 26 * index
|
||||||
|
else
|
||||||
|
(posY1 + navbarHeight) + (26 * index)
|
||||||
|
|
||||||
|
init {
|
||||||
|
addUIitem(menuButtonCraft)
|
||||||
|
addUIitem(menuButtonTechView)
|
||||||
|
}
|
||||||
|
private val thisOffsetX = UIInventoryFull.INVENTORY_CELLS_OFFSET_X() + UIItemInventoryElemSimple.height + UIItemInventoryItemGrid.listGap - halfSlotOffset
|
||||||
|
|
||||||
|
override fun renderImpl(frameDelta: Float, batch: SpriteBatch, camera: OrthographicCamera) {
|
||||||
|
// draw fake navbar //
|
||||||
|
// draw the tray
|
||||||
|
batch.color = Toolkit.Theme.COL_CELL_FILL
|
||||||
|
Toolkit.fillArea(batch, navbarX - 4, navbarY, navbarWidth, navbarHeight)
|
||||||
|
// cell border
|
||||||
|
batch.color = colourTheme.cellHighlightNormalCol
|
||||||
|
Toolkit.drawBoxBorder(batch, navbarX - 4, navbarY, navbarWidth, navbarHeight)
|
||||||
|
|
||||||
|
|
||||||
|
// draw window //
|
||||||
|
batch.color = Toolkit.Theme.COL_CELL_FILL
|
||||||
|
Toolkit.fillArea(batch, panelX, panelY, panelWidth, panelHeight)
|
||||||
|
// cell border
|
||||||
|
batch.color = colourTheme.cellHighlightNormalCol
|
||||||
|
Toolkit.drawBoxBorder(batch, panelX, panelY, panelWidth, panelHeight)
|
||||||
|
|
||||||
|
|
||||||
|
uiItems.forEach { it.render(frameDelta, batch, camera) }
|
||||||
|
|
||||||
|
// control hints
|
||||||
|
val controlHintXPos = thisOffsetX + 2f
|
||||||
|
blendNormalStraightAlpha(batch)
|
||||||
|
batch.color = Color.WHITE
|
||||||
|
App.fontGame.draw(batch, controlHelp, controlHintXPos, UIInventoryFull.yEnd - 20)
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
private val controlHelp: String
|
||||||
|
get() = if (App.environment == RunningEnvironment.PC)
|
||||||
|
"${getKeycapPC(ControlPresets.getKey("control_key_inventory"))} ${Lang["GAME_ACTION_CLOSE"]}"
|
||||||
|
else
|
||||||
|
"${App.gamepadLabelStart} ${Lang["GAME_ACTION_CLOSE"]}\u3000 " +
|
||||||
|
"${App.gamepadLabelLEFTRIGHT} ${Lang["GAME_OBJECTIVE_MULTIPLIER"]}\u3000 " +
|
||||||
|
"${App.gamepadLabelWest} ${Lang["GAME_ACTION_CRAFT"]}"
|
||||||
|
|
||||||
|
|
||||||
|
override fun updateImpl(delta: Float) {
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun doOpening(delta: Float) {
|
||||||
|
handler.opacity = 1f
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun doClosing(delta: Float) {
|
||||||
|
handler.opacity = 1f
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun endOpening(delta: Float) {
|
||||||
|
handler.opacity = 1f
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun endClosing(delta: Float) {
|
||||||
|
handler.opacity = 1f
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun dispose() {
|
||||||
|
}
|
||||||
|
|
||||||
|
fun resetUI() {
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -63,10 +63,6 @@ class UIItemCatBar(
|
|||||||
object : UIItemImageButton(
|
object : UIItemImageButton(
|
||||||
inventoryUI,
|
inventoryUI,
|
||||||
catIcons.get(iconIndexX, iconIndexY),
|
catIcons.get(iconIndexX, iconIndexY),
|
||||||
activeBackCol = Color(0),
|
|
||||||
backgroundCol = Color(0),
|
|
||||||
highlightBackCol = Color(0),
|
|
||||||
activeBackBlendMode = BlendMode.NORMAL,
|
|
||||||
initialX = posX + iconPosX,
|
initialX = posX + iconPosX,
|
||||||
initialY = posY + iconPosY,
|
initialY = posY + iconPosY,
|
||||||
highlightable = true
|
highlightable = true
|
||||||
@@ -105,10 +101,6 @@ class UIItemCatBar(
|
|||||||
UIItemImageButton(
|
UIItemImageButton(
|
||||||
inventoryUI,
|
inventoryUI,
|
||||||
iconIndex[index],
|
iconIndex[index],
|
||||||
activeBackCol = Color(0),
|
|
||||||
backgroundCol = Color(0),
|
|
||||||
highlightBackCol = Color(0),
|
|
||||||
activeBackBlendMode = BlendMode.NORMAL,
|
|
||||||
initialX = iconPosX,
|
initialX = iconPosX,
|
||||||
initialY = posY + iconPosY,
|
initialY = posY + iconPosY,
|
||||||
inactiveCol = if (index == 0 || index == 3) Color.WHITE else Color(0xffffff7f.toInt()),
|
inactiveCol = if (index == 0 || index == 3) Color.WHITE else Color(0xffffff7f.toInt()),
|
||||||
|
|||||||
@@ -37,6 +37,7 @@ class UIItemHorizontalFadeSlide(
|
|||||||
private var rightUI: UICanvas = uisOnRight.firstOrNull() ?: NullUI
|
private var rightUI: UICanvas = uisOnRight.firstOrNull() ?: NullUI
|
||||||
|
|
||||||
override val uis: List<UICanvas>; get() = listOf(leftUI, centreUI, rightUI)
|
override val uis: List<UICanvas>; get() = listOf(leftUI, centreUI, rightUI)
|
||||||
|
val allUIs : List<UICanvas>; get() = uisOnLeft + uisOnCentre + uisOnRight
|
||||||
|
|
||||||
fun setLeftUIto(index: Int) {
|
fun setLeftUIto(index: Int) {
|
||||||
leftUI = uisOnLeft[index]
|
leftUI = uisOnLeft[index]
|
||||||
@@ -50,38 +51,61 @@ class UIItemHorizontalFadeSlide(
|
|||||||
|
|
||||||
init {
|
init {
|
||||||
// re-position the uis according to the initial choice of currentPosition
|
// re-position the uis according to the initial choice of currentPosition
|
||||||
uisOnLeft.forEachIndexed { index, it ->
|
uisOnLeft.forEach {
|
||||||
it.posX = getOffX(0)
|
it.posX = getOffX(0)
|
||||||
it.initialX = getOffX(0)
|
it.initialX = getOffX(0)
|
||||||
|
it.opacity = getOpacity(0)
|
||||||
it.posY = 0
|
it.posY = 0
|
||||||
it.initialY = 0
|
it.initialY = 0
|
||||||
it.opacity = getOpacity(0)
|
|
||||||
}
|
}
|
||||||
uisOnCentre.forEachIndexed { index, it ->
|
uisOnCentre.forEach {
|
||||||
it.posX = getOffX(1)
|
it.posX = getOffX(1)
|
||||||
it.initialX = getOffX(1)
|
it.initialX = getOffX(1)
|
||||||
|
it.opacity = getOpacity(1)
|
||||||
it.posY = 0
|
it.posY = 0
|
||||||
it.initialY = 0
|
it.initialY = 0
|
||||||
it.opacity = getOpacity(1)
|
|
||||||
}
|
}
|
||||||
uisOnRight.forEachIndexed { index, it ->
|
uisOnRight.forEach {
|
||||||
it.posX = getOffX(2)
|
it.posX = getOffX(2)
|
||||||
it.initialX = getOffX(2)
|
it.initialX = getOffX(2)
|
||||||
|
it.opacity = getOpacity(2)
|
||||||
it.posY = 0
|
it.posY = 0
|
||||||
it.initialY = 0
|
it.initialY = 0
|
||||||
it.opacity = getOpacity(2)
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun onTransition(currentPosition: Float, uis: List<UICanvas>) {
|
override fun onTransition(currentPosition: Float) {
|
||||||
uis.forEachIndexed { index, it ->
|
uisOnLeft.forEach {
|
||||||
it.posX = getOffX(index)
|
it.posX = getOffX(0)
|
||||||
|
it.opacity = getOpacity(0)
|
||||||
it.posY = it.initialY
|
it.posY = it.initialY
|
||||||
it.opacity = getOpacity(index)
|
|
||||||
}
|
}
|
||||||
|
uisOnCentre.forEach {
|
||||||
|
it.posX = getOffX(1)
|
||||||
|
it.opacity = getOpacity(1)
|
||||||
|
it.posY = it.initialY
|
||||||
|
}
|
||||||
|
uisOnRight.forEach {
|
||||||
|
it.posX = getOffX(2)
|
||||||
|
it.opacity = getOpacity(2)
|
||||||
|
it.posY = it.initialY
|
||||||
|
}
|
||||||
|
|
||||||
INGAME.setTooltipMessage(null)
|
INGAME.setTooltipMessage(null)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
override fun show() {
|
||||||
|
uisOnLeft.forEach { it.show() }
|
||||||
|
uisOnCentre.forEach { it.show() }
|
||||||
|
uisOnRight.forEach { it.show() }
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun hide() {
|
||||||
|
uisOnLeft.forEach { it.hide() }
|
||||||
|
uisOnCentre.forEach { it.hide() }
|
||||||
|
uisOnRight.forEach { it.hide() }
|
||||||
|
}
|
||||||
|
|
||||||
override fun dispose() {
|
override fun dispose() {
|
||||||
uisOnLeft.forEach { it.tryDispose() }
|
uisOnLeft.forEach { it.tryDispose() }
|
||||||
uisOnCentre.forEach { it.tryDispose() }
|
uisOnCentre.forEach { it.tryDispose() }
|
||||||
|
|||||||
@@ -19,18 +19,18 @@ open class UIItemImageButton(
|
|||||||
/** Colour when mouse is over */
|
/** Colour when mouse is over */
|
||||||
val activeCol: Color = Toolkit.Theme.COL_MOUSE_UP,
|
val activeCol: Color = Toolkit.Theme.COL_MOUSE_UP,
|
||||||
/** Colour when mouse is over */
|
/** Colour when mouse is over */
|
||||||
val activeBackCol: Color = UIItemTextButtonList.DEFAULT_BACKGROUND_ACTIVECOL,
|
val activeBackCol: Color = Color(0),//UIItemTextButtonList.DEFAULT_BACKGROUND_ACTIVECOL,
|
||||||
/** Colour when mouse is over */
|
/** Colour when mouse is over */
|
||||||
val activeBackBlendMode: String = BlendMode.NORMAL,
|
val activeBackBlendMode: String = BlendMode.NORMAL,
|
||||||
/** Colour when clicked/selected */
|
/** Colour when clicked/selected */
|
||||||
val highlightCol: Color = Toolkit.Theme.COL_SELECTED,
|
val highlightCol: Color = Toolkit.Theme.COL_SELECTED,
|
||||||
/** Colour when clicked/selected */
|
/** Colour when clicked/selected */
|
||||||
val highlightBackCol: Color = UIItemTextButtonList.DEFAULT_BACKGROUND_HIGHLIGHTCOL,
|
val highlightBackCol: Color = Color(0),//UIItemTextButtonList.DEFAULT_BACKGROUND_HIGHLIGHTCOL,
|
||||||
/** Colour when clicked/selected */
|
/** Colour when clicked/selected */
|
||||||
val highlightBackBlendMode: String = BlendMode.NORMAL,
|
val highlightBackBlendMode: String = BlendMode.NORMAL,
|
||||||
/** Colour on normal status */
|
/** Colour on normal status */
|
||||||
val inactiveCol: Color = Toolkit.Theme.COL_LIST_DEFAULT,
|
val inactiveCol: Color = Toolkit.Theme.COL_LIST_DEFAULT,
|
||||||
val backgroundCol: Color = UIItemTextButtonList.DEFAULT_BACKGROUNDCOL,
|
val backgroundCol: Color = Color(0),//UIItemTextButtonList.DEFAULT_BACKGROUNDCOL,
|
||||||
val backgroundBlendMode: String = BlendMode.NORMAL,
|
val backgroundBlendMode: String = BlendMode.NORMAL,
|
||||||
|
|
||||||
initialX: Int,
|
initialX: Int,
|
||||||
|
|||||||
@@ -46,7 +46,7 @@ open class UIItemTransitionContainer(
|
|||||||
transitionRequested = false
|
transitionRequested = false
|
||||||
transitionTimer = 0f
|
transitionTimer = 0f
|
||||||
currentPosition = target.toFloat()
|
currentPosition = target.toFloat()
|
||||||
onTransition(currentPosition, uis)
|
onTransition(currentPosition)
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun update(delta: Float) {
|
override fun update(delta: Float) {
|
||||||
@@ -54,7 +54,7 @@ open class UIItemTransitionContainer(
|
|||||||
uis.forEachIndexed { index, ui -> if (timeToUpdate(index)) ui.update(delta) }
|
uis.forEachIndexed { index, ui -> if (timeToUpdate(index)) ui.update(delta) }
|
||||||
}
|
}
|
||||||
|
|
||||||
open fun onTransition(currentPosition: Float, uis: List<UICanvas>) {}
|
open fun onTransition(currentPosition: Float) {}
|
||||||
|
|
||||||
open val currentUI: UICanvas
|
open val currentUI: UICanvas
|
||||||
get() = uis[currentPosition.roundToInt()]
|
get() = uis[currentPosition.roundToInt()]
|
||||||
@@ -78,7 +78,7 @@ open class UIItemTransitionContainer(
|
|||||||
currentPosition = transitionReqTarget
|
currentPosition = transitionReqTarget
|
||||||
}
|
}
|
||||||
|
|
||||||
onTransition(currentPosition, uis)
|
onTransition(currentPosition)
|
||||||
}
|
}
|
||||||
|
|
||||||
uis.forEachIndexed { index, ui ->
|
uis.forEachIndexed { index, ui ->
|
||||||
|
|||||||
Reference in New Issue
Block a user