mirror of
https://github.com/curioustorvald/Terrarum.git
synced 2026-06-10 02:24:05 +09:00
autosave notifier is working but autosave itself is not cued yet
This commit is contained in:
@@ -35,6 +35,7 @@ import net.torvald.terrarum.realestate.LandUtil
|
|||||||
import net.torvald.terrarum.serialise.*
|
import net.torvald.terrarum.serialise.*
|
||||||
import net.torvald.terrarum.tvda.VDUtil
|
import net.torvald.terrarum.tvda.VDUtil
|
||||||
import net.torvald.terrarum.tvda.VirtualDisk
|
import net.torvald.terrarum.tvda.VirtualDisk
|
||||||
|
import net.torvald.terrarum.ui.UIAutosaveNotifier
|
||||||
import net.torvald.terrarum.ui.UICanvas
|
import net.torvald.terrarum.ui.UICanvas
|
||||||
import net.torvald.terrarum.utils.RandomWordsName
|
import net.torvald.terrarum.utils.RandomWordsName
|
||||||
import net.torvald.terrarum.weather.WeatherMixer
|
import net.torvald.terrarum.weather.WeatherMixer
|
||||||
@@ -175,7 +176,7 @@ open class TerrarumIngame(batch: SpriteBatch) : IngameInstance(batch) {
|
|||||||
|
|
||||||
private lateinit var uiBasicInfo: UICanvas
|
private lateinit var uiBasicInfo: UICanvas
|
||||||
private lateinit var uiWatchTierOne: UICanvas
|
private lateinit var uiWatchTierOne: UICanvas
|
||||||
|
lateinit var uiAutosaveNotifier: UIAutosaveNotifier
|
||||||
lateinit var uiCheatMotherfuckerNootNoot: UICheatDetected
|
lateinit var uiCheatMotherfuckerNootNoot: UICheatDetected
|
||||||
|
|
||||||
|
|
||||||
@@ -430,6 +431,7 @@ open class TerrarumIngame(batch: SpriteBatch) : IngameInstance(batch) {
|
|||||||
uiBasicInfo.setAsAlwaysVisible()
|
uiBasicInfo.setAsAlwaysVisible()
|
||||||
uiBasicInfo.setPosition((uiQuickBar.posX - uiBasicInfo.width - App.scr.tvSafeActionWidth) / 2 + App.scr.tvSafeActionWidth, uiWatchTierOne.posY)
|
uiBasicInfo.setPosition((uiQuickBar.posX - uiBasicInfo.width - App.scr.tvSafeActionWidth) / 2 + App.scr.tvSafeActionWidth, uiWatchTierOne.posY)
|
||||||
|
|
||||||
|
uiAutosaveNotifier = UIAutosaveNotifier()
|
||||||
|
|
||||||
|
|
||||||
uiCheatMotherfuckerNootNoot = UICheatDetected()
|
uiCheatMotherfuckerNootNoot = UICheatDetected()
|
||||||
@@ -450,6 +452,7 @@ open class TerrarumIngame(batch: SpriteBatch) : IngameInstance(batch) {
|
|||||||
// uiBasicInfo, // temporarily commenting out: wouldn't make sense for v 0.3 release
|
// uiBasicInfo, // temporarily commenting out: wouldn't make sense for v 0.3 release
|
||||||
uiWatchTierOne,
|
uiWatchTierOne,
|
||||||
UIScreenZoom(),
|
UIScreenZoom(),
|
||||||
|
uiAutosaveNotifier,
|
||||||
uiInventoryPlayer,
|
uiInventoryPlayer,
|
||||||
getUIFixture,
|
getUIFixture,
|
||||||
uiTooltip,
|
uiTooltip,
|
||||||
@@ -605,6 +608,14 @@ open class TerrarumIngame(batch: SpriteBatch) : IngameInstance(batch) {
|
|||||||
|
|
||||||
particlesActive = 0
|
particlesActive = 0
|
||||||
|
|
||||||
|
if (KeyToggler.isOn(Input.Keys.SLASH) && !uiAutosaveNotifier.isVisible) {
|
||||||
|
println("autosave open")
|
||||||
|
uiAutosaveNotifier.setAsOpen()
|
||||||
|
}
|
||||||
|
else if (!KeyToggler.isOn(Input.Keys.SLASH) && uiAutosaveNotifier.isOpened) {
|
||||||
|
println("autosave close")
|
||||||
|
uiAutosaveNotifier.setAsClose()
|
||||||
|
}
|
||||||
|
|
||||||
// synchronised Ingame Input Updater
|
// synchronised Ingame Input Updater
|
||||||
// will also queue up the block/wall/wire placed events
|
// will also queue up the block/wall/wire placed events
|
||||||
@@ -1126,7 +1137,6 @@ open class TerrarumIngame(batch: SpriteBatch) : IngameInstance(batch) {
|
|||||||
((App.scr.width - App.scr.tvSafeGraphicsWidth) - (uiQuickBar.posX + uiQuickBar.width) - uiWatchTierOne.width) / 2 + (uiQuickBar.posX + uiQuickBar.width),
|
((App.scr.width - App.scr.tvSafeGraphicsWidth) - (uiQuickBar.posX + uiQuickBar.width) - uiWatchTierOne.width) / 2 + (uiQuickBar.posX + uiQuickBar.width),
|
||||||
App.scr.tvSafeGraphicsHeight + 8
|
App.scr.tvSafeGraphicsHeight + 8
|
||||||
)
|
)
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -8,8 +8,10 @@ import net.torvald.getKeycapPC
|
|||||||
import net.torvald.terrarum.App
|
import net.torvald.terrarum.App
|
||||||
import net.torvald.terrarum.Terrarum
|
import net.torvald.terrarum.Terrarum
|
||||||
import net.torvald.terrarum.TerrarumScreenSize
|
import net.torvald.terrarum.TerrarumScreenSize
|
||||||
|
import net.torvald.terrarum.modulebasegame.ui.UIQuickslotBar.Companion.COMMON_OPEN_CLOSE
|
||||||
import net.torvald.terrarum.ui.Movement
|
import net.torvald.terrarum.ui.Movement
|
||||||
import net.torvald.terrarum.ui.UICanvas
|
import net.torvald.terrarum.ui.UICanvas
|
||||||
|
import kotlin.math.roundToInt
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Screen zooms in when the UI is opened; zooms out when being closed.
|
* Screen zooms in when the UI is opened; zooms out when being closed.
|
||||||
@@ -25,7 +27,7 @@ class UIScreenZoom : UICanvas(
|
|||||||
override var width = App.fontGame.getWidth(zoomText)
|
override var width = App.fontGame.getWidth(zoomText)
|
||||||
override var height = App.fontGame.lineHeight.toInt()
|
override var height = App.fontGame.lineHeight.toInt()
|
||||||
|
|
||||||
override var openCloseTime = 0.15f
|
override var openCloseTime = COMMON_OPEN_CLOSE
|
||||||
|
|
||||||
override val mouseUp = false
|
override val mouseUp = false
|
||||||
|
|
||||||
@@ -38,11 +40,10 @@ class UIScreenZoom : UICanvas(
|
|||||||
override fun renderUI(batch: SpriteBatch, camera: Camera) {
|
override fun renderUI(batch: SpriteBatch, camera: Camera) {
|
||||||
batch.color = Color.WHITE
|
batch.color = Color.WHITE
|
||||||
|
|
||||||
App.fontGame.draw(
|
val offX = (App.scr.tvSafeGraphicsWidth * 1.25f).roundToInt().toFloat()
|
||||||
batch, zoomText,
|
val offY = App.scr.height - height - App.scr.tvSafeGraphicsHeight - 4f
|
||||||
(App.scr.width * TerrarumScreenSize.TV_SAFE_GRAPHICS + 1).toInt().toFloat(),
|
|
||||||
(App.scr.height - height - App.scr.tvSafeGraphicsHeight).toFloat()
|
App.fontGame.draw(batch, zoomText, offX, offY)
|
||||||
)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun dispose() {
|
override fun dispose() {
|
||||||
|
|||||||
@@ -1,22 +1,26 @@
|
|||||||
package net.torvald.terrarum.ui
|
package net.torvald.terrarum.ui
|
||||||
|
|
||||||
import com.badlogic.gdx.graphics.Camera
|
import com.badlogic.gdx.graphics.Camera
|
||||||
|
import com.badlogic.gdx.graphics.Color
|
||||||
import com.badlogic.gdx.graphics.g2d.SpriteBatch
|
import com.badlogic.gdx.graphics.g2d.SpriteBatch
|
||||||
import net.torvald.terrarum.App
|
import net.torvald.terrarum.App
|
||||||
import net.torvald.terrarum.CommonResourcePool
|
import net.torvald.terrarum.CommonResourcePool
|
||||||
|
import net.torvald.terrarum.langpack.Lang
|
||||||
|
import kotlin.math.roundToInt
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Created by minjaesong on 2021-10-01.
|
* Created by minjaesong on 2021-10-01.
|
||||||
*/
|
*/
|
||||||
class UIAutosaveNotifier : UICanvas() {
|
class UIAutosaveNotifier : UICanvas() {
|
||||||
|
|
||||||
override var width: Int
|
companion object {
|
||||||
get() = TODO("Not yet implemented")
|
const val WIDTH = 240
|
||||||
set(value) {}
|
const val HEIGHT = 24
|
||||||
override var height: Int
|
}
|
||||||
get() = TODO("Not yet implemented")
|
|
||||||
set(value) {}
|
override var width = WIDTH
|
||||||
override var openCloseTime = 0.2f
|
override var height = HEIGHT
|
||||||
|
override var openCloseTime = 0.12f //COMMON_OPEN_CLOSE
|
||||||
|
|
||||||
private val spinner = CommonResourcePool.getAsTextureRegionPack("inline_loading_spinner")
|
private val spinner = CommonResourcePool.getAsTextureRegionPack("inline_loading_spinner")
|
||||||
private var spinnerTimer = 0f
|
private var spinnerTimer = 0f
|
||||||
@@ -25,7 +29,7 @@ class UIAutosaveNotifier : UICanvas() {
|
|||||||
|
|
||||||
override fun updateUI(delta: Float) {
|
override fun updateUI(delta: Float) {
|
||||||
spinnerTimer += delta
|
spinnerTimer += delta
|
||||||
if (spinnerTimer > spinnerInterval) {
|
while (spinnerTimer > spinnerInterval) {
|
||||||
spinnerFrame = (spinnerFrame + 1) % 32
|
spinnerFrame = (spinnerFrame + 1) % 32
|
||||||
spinnerTimer -= spinnerInterval
|
spinnerTimer -= spinnerInterval
|
||||||
}
|
}
|
||||||
@@ -33,24 +37,28 @@ class UIAutosaveNotifier : UICanvas() {
|
|||||||
|
|
||||||
override fun renderUI(batch: SpriteBatch, camera: Camera) {
|
override fun renderUI(batch: SpriteBatch, camera: Camera) {
|
||||||
val spin = spinner.get(spinnerFrame % 8, spinnerFrame / 8)
|
val spin = spinner.get(spinnerFrame % 8, spinnerFrame / 8)
|
||||||
|
val offX = (App.scr.tvSafeGraphicsWidth * 1.25f).roundToInt().toFloat()
|
||||||
val inlineOffsetY = if (App.GAME_LOCALE.startsWith("th")) 0f
|
val offY = App.scr.tvSafeGraphicsHeight + 4f
|
||||||
else if (App.GAME_LOCALE.startsWith("ko")) 0f
|
|
||||||
else 1f
|
batch.color = Color.WHITE
|
||||||
|
batch.draw(spin, offX, offY)
|
||||||
batch.draw(spin, posX.toFloat(), posY.toFloat())
|
App.fontGame.draw(batch, Lang["MENU_IO_SAVING"], offX + 30f, offY)
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun doOpening(delta: Float) {
|
override fun doOpening(delta: Float) {
|
||||||
|
doOpeningFade(this, openCloseTime)
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun doClosing(delta: Float) {
|
override fun doClosing(delta: Float) {
|
||||||
|
doClosingFade(this, openCloseTime)
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun endOpening(delta: Float) {
|
override fun endOpening(delta: Float) {
|
||||||
|
endOpeningFade(this)
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun endClosing(delta: Float) {
|
override fun endClosing(delta: Float) {
|
||||||
|
endClosingFade(this)
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun dispose() {
|
override fun dispose() {
|
||||||
|
|||||||
Reference in New Issue
Block a user