mirror of
https://github.com/curioustorvald/Terrarum.git
synced 2026-03-08 04:41:51 +09:00
wider module info cells
This commit is contained in:
4
.idea/artifacts/ModuleComputers.xml
generated
4
.idea/artifacts/ModuleComputers.xml
generated
@@ -5,6 +5,10 @@
|
||||
<element id="module-output" name="ModuleComputers" />
|
||||
<element id="extracted-dir" path="$PROJECT_DIR$/ModuleComputers/lib/TerrarumTSVM.jar" path-in-jar="/" />
|
||||
<element id="extracted-dir" path="$PROJECT_DIR$/ModuleComputers/lib/TerranVirtualDisk.jar" path-in-jar="/" />
|
||||
<element id="extracted-dir" path="$PROJECT_DIR$/lib/kotlinx-coroutines-core-1.4.1.jar" path-in-jar="/" />
|
||||
<element id="extracted-dir" path="$PROJECT_DIR$/lib/kotlin-stdlib-1.4.0.jar" path-in-jar="/" />
|
||||
<element id="extracted-dir" path="$PROJECT_DIR$/lib/annotations-13.0.jar" path-in-jar="/" />
|
||||
<element id="extracted-dir" path="$PROJECT_DIR$/lib/kotlin-stdlib-common-1.4.0.jar" path-in-jar="/" />
|
||||
</root>
|
||||
</artifact>
|
||||
</component>
|
||||
@@ -44,17 +44,26 @@ class ItemWearableWorldRadar(originalID: String) : GameItem(originalID) {
|
||||
VMProgramRom(ModMgr.getGdxFile("dwarventech", "bios/pipboot.rom").path()),
|
||||
VMProgramRom(ModMgr.getGdxFile("dwarventech", "bios/pipcode.bas").path())
|
||||
))
|
||||
private val vmRunner: VMRunner
|
||||
private val coroutineJob: Job
|
||||
private val ui = WearableWorldRadarUI(vm)
|
||||
|
||||
// FIXME initialise computer stuff when the Item is first used, not when it's registered by the Modmgr
|
||||
init {
|
||||
super.equipPosition = EquipPosition.HAND_GRIP
|
||||
}
|
||||
|
||||
private var booted = false
|
||||
private var disposed = false
|
||||
private lateinit var vmRunner: VMRunner
|
||||
private lateinit var coroutineJob: Job
|
||||
|
||||
init {
|
||||
App.disposables.add(ui)
|
||||
}
|
||||
|
||||
private fun boot() {
|
||||
vm.getIO().blockTransferPorts[1].attachDevice(WorldRadar())
|
||||
vm.peripheralTable[1] = PeripheralEntry(
|
||||
ExtDisp(vm, 160, 140), 32768, 1, 0
|
||||
ExtDisp(vm, 160, 140), 32768, 1, 0
|
||||
)
|
||||
|
||||
// MMIO stops working when somethingStream is not defined
|
||||
@@ -68,20 +77,32 @@ class ItemWearableWorldRadar(originalID: String) : GameItem(originalID) {
|
||||
}
|
||||
|
||||
INGAME.disposables.add(Disposable {
|
||||
closeVM()
|
||||
})
|
||||
booted = true
|
||||
}
|
||||
|
||||
private fun closeVM() {
|
||||
if (!disposed) {
|
||||
vmRunner.close()
|
||||
coroutineJob.cancel("item disposal")
|
||||
vm.dispose()
|
||||
})
|
||||
App.disposables.add(ui)
|
||||
|
||||
}
|
||||
disposed = true
|
||||
booted = false
|
||||
}
|
||||
|
||||
override fun effectWhileEquipped(actor: ActorWithBody, delta: Float) {
|
||||
if (!booted) {
|
||||
booted = true
|
||||
boot()
|
||||
}
|
||||
(Terrarum.ingame!! as TerrarumIngame).wearableDeviceUI = ui
|
||||
}
|
||||
|
||||
override fun effectOnUnequip(actor: ActorWithBody, delta: Float) {
|
||||
(Terrarum.ingame!! as TerrarumIngame).wearableDeviceUI = null
|
||||
closeVM()
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -350,6 +350,7 @@ object ModMgr {
|
||||
FileSystems.getDefault().getPath("$modDirExternal/$module/$path").toFile()
|
||||
}
|
||||
fun hasFile(module: String, path: String): Boolean {
|
||||
if (!moduleInfo.containsKey(module)) return false
|
||||
return getFile(module, path).exists()
|
||||
}
|
||||
fun getFiles(module: String, path: String): Array<File> {
|
||||
|
||||
@@ -87,7 +87,7 @@ class NoModuleDefaultTitlescreen(batch: FlippingSpriteBatch) : IngameInstance(ba
|
||||
App.fontGame.draw(it, pathText, pathButtonX, pathButtonY)
|
||||
}
|
||||
|
||||
if (Gdx.input.isKeyPressed(Keys.ESCAPE)) gamemode = 1
|
||||
// if (Gdx.input.isKeyPressed(Keys.ESCAPE)) gamemode = 1
|
||||
}
|
||||
else if (gamemode == 1) {
|
||||
|
||||
|
||||
@@ -16,8 +16,8 @@ import net.torvald.terrarum.ui.UICanvas
|
||||
import net.torvald.terrarum.ui.UIItemModuleInfoCell
|
||||
import kotlin.math.roundToInt
|
||||
|
||||
val MODULEINFO_CELL_WIDTH = 480
|
||||
val MODULEINFO_CELL_HEIGHT = 48
|
||||
val MODULEINFO_CELL_WIDTH = 540
|
||||
val MODULEINFO_CELL_HEIGHT = 24*3
|
||||
|
||||
/**
|
||||
* Created by minjaesong on 2017-08-01.
|
||||
|
||||
@@ -38,6 +38,7 @@ class UIItemModuleInfoCell(
|
||||
private val modVer = modProp.version
|
||||
private val modDate = modProp.releaseDate
|
||||
private val modAuthor = modProp.author
|
||||
private val modDesc = modProp.description
|
||||
|
||||
init {
|
||||
modIcon.flip(false, false)
|
||||
@@ -56,40 +57,42 @@ class UIItemModuleInfoCell(
|
||||
private val ccZero2 = App.fontGame.toColorCode(12,12,12)
|
||||
private val ccNum = App.fontGame.toColorCode(15,14,6)
|
||||
private val ccNum2 = App.fontGame.toColorCode(12,11,4)
|
||||
private val ccDesc = App.fontGame.toColorCode(13,13,13)
|
||||
|
||||
override fun render(batch: SpriteBatch, camera: Camera) {
|
||||
blendNormal(batch)
|
||||
|
||||
batch.color = Toolkit.Theme.COL_CELL_FILL
|
||||
Toolkit.fillArea(batch, initialX, initialY, 32, 48)
|
||||
Toolkit.fillArea(batch, initialX + 35, initialY, 48, 48)
|
||||
Toolkit.fillArea(batch, initialX + 86, initialY, width - 86, 48)
|
||||
Toolkit.fillArea(batch, initialX, initialY, 32, height)
|
||||
Toolkit.fillArea(batch, initialX + 35, initialY, 48, height)
|
||||
Toolkit.fillArea(batch, initialX + 86, initialY, width - 86, height)
|
||||
|
||||
batch.color = Toolkit.Theme.COL_INACTIVE
|
||||
Toolkit.drawBoxBorder(batch, initialX - 1, initialY - 1, width + 2, height + 2)
|
||||
Toolkit.fillArea(batch, initialX + 33, initialY, 1, 48)
|
||||
Toolkit.fillArea(batch, initialX + 84, initialY, 1, 48)
|
||||
Toolkit.fillArea(batch, initialX + 33, initialY, 1, height)
|
||||
Toolkit.fillArea(batch, initialX + 84, initialY, 1, height)
|
||||
|
||||
if (order < 9)
|
||||
App.fontSmallNumbers.draw(batch, "${order+1}", initialX + 13f, initialY + 18f)
|
||||
App.fontSmallNumbers.draw(batch, "${order+1}", initialX + 13f, initialY + 18f + 12f)
|
||||
else if (order < 99)
|
||||
App.fontSmallNumbers.draw(batch, "${order+1}", initialX + 9f, initialY + 18f)
|
||||
App.fontSmallNumbers.draw(batch, "${order+1}", initialX + 9f, initialY + 18f + 12f)
|
||||
else
|
||||
App.fontSmallNumbers.draw(batch, "${order+1}", initialX + 6f, initialY + 18f)
|
||||
App.fontSmallNumbers.draw(batch, "${order+1}", initialX + 6f, initialY + 18f + 12f)
|
||||
|
||||
batch.color = Color.WHITE
|
||||
if (modErrored) {
|
||||
batch.shader = App.shaderGhastlyWhite
|
||||
batch.color = Color.LIGHT_GRAY
|
||||
}
|
||||
batch.draw(modIcon, initialX + 35f, initialY.toFloat())
|
||||
batch.draw(modIcon, initialX + 35f, initialY + 12f)
|
||||
batch.shader = null
|
||||
batch.color = Color.WHITE
|
||||
App.fontGame.draw(batch, "$ccZero${modName.toUpperCase()}$ccNum $modVer", initialX + 86f + 6f, initialY + 2f)
|
||||
App.fontGame.draw(batch, "$ccZero2$modAuthor$ccNum2 $modDate", initialX + 86f + 6f, initialY + 26f)
|
||||
App.fontGame.draw(batch, "$ccZero${modName.toUpperCase()}$ccNum $modVer", initialX + 86f + 3f, initialY + 2f)
|
||||
App.fontGame.draw(batch, "$ccDesc$modDesc", initialX + 86f + 3f, initialY + 26f)
|
||||
App.fontGame.draw(batch, "$ccZero2$modAuthor$ccNum2 $modDate", initialX + 86f + 3f, initialY + 50f)
|
||||
|
||||
if (modErrored) {
|
||||
batch.draw(CommonResourcePool.getAsTextureRegion("basegame_errored_icon32"), initialX + width - 40f, initialY + 8f)
|
||||
batch.draw(CommonResourcePool.getAsTextureRegion("basegame_errored_icon32"), initialX + width - 40f, initialY + 8f + 12f)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user