world portal wip

This commit is contained in:
minjaesong
2023-05-28 18:41:21 +09:00
parent a3ecd4a4f4
commit ef6f39632d
11 changed files with 121 additions and 33 deletions

View File

@@ -14,4 +14,6 @@ id;classname
258;net.torvald.terrarum.modulebasegame.gameitems.ItemSwingingDoorBirch 258;net.torvald.terrarum.modulebasegame.gameitems.ItemSwingingDoorBirch
259;net.torvald.terrarum.modulebasegame.gameitems.ItemSwingingDoorRosewood 259;net.torvald.terrarum.modulebasegame.gameitems.ItemSwingingDoorRosewood
320;net.torvald.terrarum.modulebasegame.gameitems.ItemWorldPortal
999999;net.torvald.terrarum.modulebasegame.gameitems.ItemTapestry 999999;net.torvald.terrarum.modulebasegame.gameitems.ItemTapestry
1 id classname
14 259 net.torvald.terrarum.modulebasegame.gameitems.ItemSwingingDoorRosewood
15 999999 320 net.torvald.terrarum.modulebasegame.gameitems.ItemTapestry net.torvald.terrarum.modulebasegame.gameitems.ItemWorldPortal
16 999999 net.torvald.terrarum.modulebasegame.gameitems.ItemTapestry
17
18
19

Binary file not shown.

View File

@@ -0,0 +1,40 @@
package net.torvald.terrarum.modulebasegame.gameactors
import net.torvald.terrarum.gameactors.AVKey
import net.torvald.terrarum.langpack.Lang
import net.torvald.terrarum.modulebasegame.gameitems.FixtureItemBase
import net.torvald.terrarum.modulebasegame.ui.UIWorldPortal
import net.torvald.terrarumsansbitmap.gdx.TextureRegionPack
/**
* Created by minjaesong on 2023-05-28.
*/
class FixtureWorldPortal : FixtureBase {
constructor() : super(
BlockBox(BlockBox.NO_COLLISION, 5, 2),
nameFun = { Lang["ITEM_WORLD_PORTAL"] },
mainUI = UIWorldPortal()
) {
// TODO do something with (mainUI as UIWorldPortal).***
}
init {
val itemImage = FixtureItemBase.getItemImageFromSheet("basegame", "sprites/fixtures/portal_device.tga", 80, 32)
density = 2900.0
setHitboxDimension(80, 32, 0, 0)
makeNewSprite(TextureRegionPack(itemImage.texture, 80, 32)).let {
it.setRowsAndFrames(1,1)
}
actorValue[AVKey.BASEMASS] = FixtureLogicSignalEmitter.MASS
}
override fun reload() {
super.reload()
// TODO do something with (mainUI as UIWorldPortal).***
}
}

View File

@@ -98,6 +98,8 @@ object PlayerBuilderSigrid {
inventory.add("item@basegame:258", 995) // doors inventory.add("item@basegame:258", 995) // doors
inventory.add("item@basegame:259", 995) // doors inventory.add("item@basegame:259", 995) // doors
inventory.add("item@basegame:320", 1) // portal
WireCodex.getAll().forEach { WireCodex.getAll().forEach {
try { try {
inventory.add(it.id, 9995) inventory.add(it.id, 9995)

View File

@@ -0,0 +1,29 @@
package net.torvald.terrarum.modulebasegame.gameitems
import com.badlogic.gdx.graphics.g2d.TextureRegion
import net.torvald.terrarum.gameitems.ItemID
import net.torvald.terrarum.modulebasegame.gameactors.FixtureTikiTorch
/**
* Created by minjaesong on 2023-05-28.
*/
class ItemWorldPortal(originalID: ItemID) : FixtureItemBase(originalID, "net.torvald.terrarum.modulebasegame.gameactors.FixtureWorldPortal") {
override var dynamicID: ItemID = originalID
override val originalName = "ITEM_WORLD_PORTAL"
override var baseMass = 6000.0
override var stackable = true
override var inventoryCategory = Category.MISC
override val isUnique = false
override val isDynamic = false
override val materialId = ""
override val itemImage: TextureRegion
get() = getItemImageFromSheet("basegame", "sprites/fixtures/portal_device.tga", 80, 32)
override var baseToolSize: Double? = baseMass
init {
equipPosition = EquipPosition.HAND_GRIP
}
}

View File

@@ -18,7 +18,10 @@ import net.torvald.terrarum.ui.UIItemHorizontalFadeSlide
* *
* Created by minjaesong on 2023-05-19. * Created by minjaesong on 2023-05-19.
*/ */
class UIWorldPortal : UICanvas() { class UIWorldPortal : UICanvas(
toggleKeyLiteral = App.getConfigInt("control_key_inventory"),
toggleButtonLiteral = App.getConfigInt("control_gamepad_start"),
) {
override var width = App.scr.width override var width = App.scr.width
override var height = App.scr.height override var height = App.scr.height
@@ -97,11 +100,13 @@ class UIWorldPortal : UICanvas() {
override fun doOpening(delta: Float) { override fun doOpening(delta: Float) {
super.doOpening(delta) super.doOpening(delta)
resetUI() resetUI()
INGAME.pause()
INGAME.setTooltipMessage(null) INGAME.setTooltipMessage(null)
} }
override fun doClosing(delta: Float) { override fun doClosing(delta: Float) {
super.doClosing(delta) super.doClosing(delta)
INGAME.resume()
INGAME.setTooltipMessage(null) INGAME.setTooltipMessage(null)
} }

View File

@@ -30,7 +30,7 @@ class UIWorldPortalListing(val full: UIWorldPortal) : UICanvas() {
private val buttonHeight = 24 private val buttonHeight = 24
private val gridGap = listGap private val gridGap = listGap
private var worldList: List<Pair<UUID, DiskSkimmer>> private val worldList = ArrayList<Pair<UUID, DiskSkimmer>>()
private var selectedWorld: DiskSkimmer? = null private var selectedWorld: DiskSkimmer? = null
@@ -70,13 +70,15 @@ class UIWorldPortalListing(val full: UIWorldPortal) : UICanvas() {
addUIitem(buttonReset) addUIitem(buttonReset)
worldList = (INGAME.actorGamer.actorValue.getAsString(AVKey.WORLD_PORTAL_DICT) ?: "").split(",").map {
it.ascii85toUUID().let { it to App.savegameWorlds[it] }
}.filter { it.second != null } as List<Pair<UUID, DiskSkimmer>>
} }
override fun show() {
worldList.clear()
worldList.addAll((INGAME.actorGamer.actorValue.getAsString(AVKey.WORLD_PORTAL_DICT) ?: "").split(",").filter { it.isNotBlank() }.map {
it.ascii85toUUID().let { it to App.savegameWorlds[it] }
}.filter { it.second != null } as List<Pair<UUID, DiskSkimmer>>)
}
override fun updateUI(delta: Float) { override fun updateUI(delta: Float) {
@@ -84,7 +86,6 @@ class UIWorldPortalListing(val full: UIWorldPortal) : UICanvas() {
override fun renderUI(batch: SpriteBatch, camera: Camera) { override fun renderUI(batch: SpriteBatch, camera: Camera) {
batch.inUse {
// draw background // // draw background //
// screencap panel // screencap panel
@@ -101,7 +102,6 @@ class UIWorldPortalListing(val full: UIWorldPortal) : UICanvas() {
uiItems.forEach { it.render(batch, camera) } uiItems.forEach { it.render(batch, camera) }
}
} }

View File

@@ -154,6 +154,7 @@ abstract class UICanvas(
*/ */
open fun doOpening(delta: Float) { open fun doOpening(delta: Float) {
handler.opacity = handler.openCloseCounter / openCloseTime handler.opacity = handler.openCloseCounter / openCloseTime
} }
/** /**

Binary file not shown.