mirror of
https://github.com/curioustorvald/Terrarum.git
synced 2026-06-10 18:44:05 +09:00
dump (another useless message)
This commit is contained in:
@@ -115,11 +115,11 @@ class UIBasicNotifier(private val player: ActorHumanoid?) : UICanvas() {
|
||||
if (player != null) {
|
||||
val playerPos = player.hIntTilewiseHitbox
|
||||
lightLevel = (LightmapRenderer.getLight(playerPos.centeredX.toInt(), playerPos.centeredY.toInt()) ?:
|
||||
(Terrarum.ingame!! as Ingame).world.globalLight
|
||||
(Terrarum.ingame!!.world).globalLight
|
||||
)
|
||||
}
|
||||
else {
|
||||
lightLevel = (Terrarum.ingame!! as Ingame).world.globalLight
|
||||
lightLevel = (Terrarum.ingame!!.world).globalLight
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -0,0 +1,92 @@
|
||||
package net.torvald.terrarum.modulebasegame.ui
|
||||
|
||||
import com.badlogic.gdx.graphics.Camera
|
||||
import com.badlogic.gdx.graphics.g2d.SpriteBatch
|
||||
import net.torvald.terrarum.ModMgr
|
||||
import net.torvald.terrarum.Second
|
||||
import net.torvald.terrarum.ui.UICanvas
|
||||
import net.torvald.terrarum.ui.UIItemImageButton
|
||||
import net.torvald.terrarumsansbitmap.gdx.TextureRegionPack
|
||||
|
||||
class UIBuildingMakerToolbox : UICanvas() {
|
||||
|
||||
val toolsTexture = TextureRegionPack(ModMgr.getGdxFile("basegame", "gui/building_maker_toolbox.tga"), 16, 16)
|
||||
val tools = Array(toolsTexture.verticalCount, { UIItemImageButton(
|
||||
this, toolsTexture.get(0, it),
|
||||
posX = 0,
|
||||
posY = 20 * it,
|
||||
highlightable = true
|
||||
|
||||
) })
|
||||
|
||||
override var width = 16
|
||||
override var height = 20 * tools.size - 4
|
||||
override var openCloseTime = 0f
|
||||
|
||||
var selectedTool = 0; private set
|
||||
|
||||
init {
|
||||
setAsAlwaysVisible()
|
||||
tools[selectedTool].highlighted = true
|
||||
}
|
||||
|
||||
override fun updateUI(delta: Float) {
|
||||
tools.forEachIndexed { counter, it ->
|
||||
it.update(delta)
|
||||
|
||||
if (it.highlighted) selectedTool = counter
|
||||
}
|
||||
}
|
||||
|
||||
override fun renderUI(batch: SpriteBatch, camera: Camera) {
|
||||
tools.forEach { it.render(batch, camera) }
|
||||
}
|
||||
|
||||
override fun doOpening(delta: Float) { }
|
||||
|
||||
override fun doClosing(delta: Float) { }
|
||||
|
||||
override fun endOpening(delta: Float) { }
|
||||
|
||||
override fun endClosing(delta: Float) { }
|
||||
|
||||
override fun dispose() {
|
||||
toolsTexture.dispose()
|
||||
}
|
||||
|
||||
override fun mouseMoved(screenX: Int, screenY: Int): Boolean {
|
||||
return super.mouseMoved(screenX, screenY)
|
||||
}
|
||||
|
||||
override fun touchDragged(screenX: Int, screenY: Int, pointer: Int): Boolean {
|
||||
return super.touchDragged(screenX, screenY, pointer)
|
||||
}
|
||||
|
||||
override fun touchDown(screenX: Int, screenY: Int, pointer: Int, button: Int): Boolean {
|
||||
return super.touchDown(screenX, screenY, pointer, button)
|
||||
}
|
||||
|
||||
override fun touchUp(screenX: Int, screenY: Int, pointer: Int, button: Int): Boolean {
|
||||
return super.touchUp(screenX, screenY, pointer, button)
|
||||
}
|
||||
|
||||
override fun scrolled(amount: Int): Boolean {
|
||||
return super.scrolled(amount)
|
||||
}
|
||||
|
||||
override fun keyDown(keycode: Int): Boolean {
|
||||
return super.keyDown(keycode)
|
||||
}
|
||||
|
||||
override fun keyUp(keycode: Int): Boolean {
|
||||
return super.keyUp(keycode)
|
||||
}
|
||||
|
||||
override fun keyTyped(character: Char): Boolean {
|
||||
return super.keyTyped(character)
|
||||
}
|
||||
|
||||
override fun resize(width: Int, height: Int) {
|
||||
super.resize(width, height)
|
||||
}
|
||||
}
|
||||
@@ -7,7 +7,7 @@ import com.badlogic.gdx.graphics.GL20
|
||||
import com.badlogic.gdx.graphics.g2d.SpriteBatch
|
||||
import com.badlogic.gdx.graphics.glutils.ShapeRenderer
|
||||
import net.torvald.terrarum.*
|
||||
import net.torvald.terrarum.modulebasegame.gameactors.ActorWithPhysics
|
||||
import net.torvald.terrarum.gameactors.ActorWBMovable
|
||||
import net.torvald.terrarum.modulebasegame.gameactors.ActorInventory.Companion.CAPACITY_MODE_NO_ENCUMBER
|
||||
import net.torvald.terrarum.modulebasegame.gameactors.Pocketed
|
||||
import net.torvald.terrarum.Second
|
||||
@@ -91,7 +91,7 @@ class UIInventoryFull(
|
||||
UIItemInventoryEquippedView(
|
||||
this,
|
||||
actor!!.inventory,
|
||||
actor as ActorWithPhysics,
|
||||
actor as ActorWBMovable,
|
||||
internalWidth - UIItemInventoryEquippedView.width + (Terrarum.WIDTH - internalWidth) / 2,
|
||||
109 + (Terrarum.HEIGHT - internalHeight) / 2
|
||||
)
|
||||
|
||||
@@ -5,7 +5,7 @@ import com.badlogic.gdx.graphics.Color
|
||||
import com.badlogic.gdx.graphics.g2d.SpriteBatch
|
||||
import net.torvald.terrarum.*
|
||||
import net.torvald.terrarum.modulebasegame.gameactors.ActorInventory
|
||||
import net.torvald.terrarum.modulebasegame.gameactors.ActorWithPhysics
|
||||
import net.torvald.terrarum.gameactors.ActorWBMovable
|
||||
import net.torvald.terrarum.itemproperties.GameItem
|
||||
import net.torvald.terrarum.itemproperties.ItemCodex
|
||||
import net.torvald.terrarum.ui.UIItem
|
||||
@@ -16,7 +16,7 @@ import net.torvald.terrarum.ui.UIItem
|
||||
class UIItemInventoryEquippedView(
|
||||
parentUI: UIInventoryFull,
|
||||
val inventory: ActorInventory,
|
||||
val theActor: ActorWithPhysics,
|
||||
val theActor: ActorWBMovable,
|
||||
override var posX: Int,
|
||||
override var posY: Int
|
||||
) : UIItem(parentUI) {
|
||||
|
||||
@@ -5,7 +5,7 @@ import com.badlogic.gdx.graphics.Color
|
||||
import com.badlogic.gdx.graphics.g2d.SpriteBatch
|
||||
import com.jme3.math.FastMath
|
||||
import net.torvald.terrarum.Terrarum
|
||||
import net.torvald.terrarum.modulebasegame.gameactors.AVKey
|
||||
import net.torvald.terrarum.gameactors.AVKey
|
||||
import net.torvald.terrarum.Second
|
||||
import net.torvald.terrarum.itemproperties.ItemCodex
|
||||
import net.torvald.terrarum.modulebasegame.Ingame
|
||||
@@ -39,7 +39,7 @@ class UIPieMenu : UICanvas() {
|
||||
|
||||
override fun updateUI(delta: Float) {
|
||||
if (selection >= 0)
|
||||
(Terrarum.ingame!! as Ingame).player.actorValue[AVKey.__PLAYER_QUICKSLOTSEL] =
|
||||
(Terrarum.ingame!! as Ingame).playableActor.actorValue[AVKey.__PLAYER_QUICKSLOTSEL] =
|
||||
selection % slotCount
|
||||
|
||||
|
||||
@@ -83,7 +83,7 @@ class UIPieMenu : UICanvas() {
|
||||
|
||||
|
||||
// draw item
|
||||
val itemPair = (Terrarum.ingame!! as Ingame).player.inventory.getQuickBar(i)
|
||||
val itemPair = (Terrarum.ingame!! as Ingame).playableActor.inventory.getQuickBar(i)
|
||||
|
||||
if (itemPair != null) {
|
||||
val itemImage = ItemCodex.getItemImage(itemPair.item)
|
||||
|
||||
@@ -5,7 +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.Terrarum
|
||||
import net.torvald.terrarum.modulebasegame.gameactors.AVKey
|
||||
import net.torvald.terrarum.gameactors.AVKey
|
||||
import net.torvald.terrarum.Second
|
||||
import net.torvald.terrarum.gameworld.fmod
|
||||
import net.torvald.terrarum.itemproperties.ItemCodex
|
||||
@@ -28,8 +28,8 @@ class UIQuickBar : UICanvas() {
|
||||
private val startPointY = ItemSlotImageBuilder.slotImage.tileH / 2
|
||||
|
||||
private var selection: Int
|
||||
get() = (Terrarum.ingame!! as Ingame).player.actorValue.getAsInt(AVKey.__PLAYER_QUICKSLOTSEL) ?: 0
|
||||
set(value) { (Terrarum.ingame!! as Ingame).player.actorValue.set(AVKey.__PLAYER_QUICKSLOTSEL, value.fmod(SLOT_COUNT)) }
|
||||
get() = (Terrarum.ingame!! as Ingame).playableActor.actorValue.getAsInt(AVKey.__PLAYER_QUICKSLOTSEL) ?: 0
|
||||
set(value) { (Terrarum.ingame!! as Ingame).playableActor.actorValue.set(AVKey.__PLAYER_QUICKSLOTSEL, value.fmod(SLOT_COUNT)) }
|
||||
|
||||
override fun updateUI(delta: Float) {
|
||||
}
|
||||
@@ -54,7 +54,7 @@ class UIQuickBar : UICanvas() {
|
||||
)
|
||||
|
||||
// draw item
|
||||
val itemPair = (Terrarum.ingame!! as Ingame).player.inventory.getQuickBar(i)
|
||||
val itemPair = (Terrarum.ingame!! as Ingame).playableActor.inventory.getQuickBar(i)
|
||||
|
||||
if (itemPair != null) {
|
||||
val itemImage = ItemCodex.getItemImage(itemPair.item)
|
||||
|
||||
@@ -8,6 +8,7 @@ import net.torvald.terrarum.*
|
||||
import net.torvald.terrarum.modulebasegame.gameactors.ActorHumanoid
|
||||
import net.torvald.terrarum.Second
|
||||
import net.torvald.terrarum.modulebasegame.Ingame
|
||||
import net.torvald.terrarum.modulebasegame.gameworld.GameWorldExtension
|
||||
import net.torvald.terrarum.roundInt
|
||||
import net.torvald.terrarum.modulebasegame.gameworld.WorldTime
|
||||
import net.torvald.terrarum.modulebasegame.imagefont.Watch7SegMain
|
||||
@@ -40,7 +41,7 @@ class UITierOneWatch(private val player: ActorHumanoid?) : UICanvas() {
|
||||
private val lcdLitCol = Color(0x141414_ff)
|
||||
|
||||
private val worldTime: WorldTime
|
||||
get() = (Terrarum.ingame!! as Ingame).world.time
|
||||
get() = (Terrarum.ingame!!.world as GameWorldExtension).time
|
||||
|
||||
|
||||
override fun updateUI(delta: Float) {
|
||||
@@ -70,11 +71,11 @@ class UITierOneWatch(private val player: ActorHumanoid?) : UICanvas() {
|
||||
if (player != null) {
|
||||
val playerPos = player.hIntTilewiseHitbox
|
||||
lightLevel = (LightmapRenderer.getLight(playerPos.centeredX.toInt(), playerPos.centeredY.toInt()) ?:
|
||||
(Terrarum.ingame!! as Ingame).world.globalLight
|
||||
(Terrarum.ingame!!.world).globalLight
|
||||
)
|
||||
}
|
||||
else {
|
||||
lightLevel = (Terrarum.ingame!! as Ingame).world.globalLight
|
||||
lightLevel = (Terrarum.ingame!!.world).globalLight
|
||||
}
|
||||
|
||||
// backplate
|
||||
|
||||
@@ -7,6 +7,7 @@ import net.torvald.random.HQRNG
|
||||
import net.torvald.terrarum.modulebasegame.Ingame
|
||||
import net.torvald.terrarum.LoadScreen
|
||||
import net.torvald.terrarum.Terrarum
|
||||
import net.torvald.terrarum.modulebasegame.BuildingMaker
|
||||
import net.torvald.terrarum.ui.UICanvas
|
||||
import net.torvald.terrarum.ui.UIItemTextButtonList
|
||||
|
||||
@@ -14,13 +15,14 @@ class UITitleRemoConRoot : UICanvas() {
|
||||
|
||||
companion object {
|
||||
val remoConWidth = 240
|
||||
fun getRemoConHeight(menu: ArrayList<String>) = 36 * menu.size.plus(1)
|
||||
fun getRemoConHeight(menu: Array<String>) = 36 * menu.size.plus(1)
|
||||
val menubarOffY: Int; get() = Terrarum.HEIGHT / 2 - (Terrarum.fontGame.lineHeight * 1.5).toInt()
|
||||
}
|
||||
|
||||
|
||||
/** Contains STRING_IDs */
|
||||
val menuLabels = arrayOf(
|
||||
val menuLabels = arrayListOf(
|
||||
"MENU_MODE_SINGLEPLAYER",
|
||||
"MENU_OPTIONS",
|
||||
"MENU_MODULES",
|
||||
@@ -29,6 +31,15 @@ class UITitleRemoConRoot : UICanvas() {
|
||||
"MENU_LABEL_QUIT"
|
||||
)
|
||||
|
||||
init {
|
||||
if (Terrarum.getConfigBoolean("__debug")) {
|
||||
menuLabels.addAll(arrayOf(
|
||||
" Development Tools $",
|
||||
"Building Maker"
|
||||
))
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
override var width: Int = remoConWidth
|
||||
override var height: Int = getRemoConHeight(menuLabels)
|
||||
@@ -37,7 +48,7 @@ class UITitleRemoConRoot : UICanvas() {
|
||||
|
||||
private val menubar = UIItemTextButtonList(
|
||||
this,
|
||||
menuLabels,
|
||||
menuLabels.toTypedArray(),
|
||||
0, menubarOffY,
|
||||
this.width, this.height,
|
||||
textAreaWidth = this.width,
|
||||
@@ -104,6 +115,19 @@ class UITitleRemoConRoot : UICanvas() {
|
||||
remoConCredits.setAsOpen()
|
||||
}
|
||||
menubar.buttons[menuLabels.indexOf("MENU_LABEL_QUIT")].clickOnceListener = { _, _, _ -> Thread.sleep(50); System.exit(0) }
|
||||
|
||||
|
||||
if (Terrarum.getConfigBoolean("__debug")) {
|
||||
|
||||
menubar.buttons[menuLabels.indexOf("Building Maker")].clickOnceListener = { _, _, _ ->
|
||||
this.setAsClose()
|
||||
Thread.sleep(50)
|
||||
|
||||
val maker = BuildingMaker(Terrarum.batch)
|
||||
Terrarum.ingame = maker
|
||||
Terrarum.setScreen(maker)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
override fun updateUI(delta: Float) {
|
||||
|
||||
Reference in New Issue
Block a user