mirror of
https://github.com/curioustorvald/Terrarum.git
synced 2026-06-12 11:34:05 +09:00
autosave notifier is working but autosave itself is not cued yet
This commit is contained in:
@@ -1,22 +1,26 @@
|
||||
package net.torvald.terrarum.ui
|
||||
|
||||
import com.badlogic.gdx.graphics.Camera
|
||||
import com.badlogic.gdx.graphics.Color
|
||||
import com.badlogic.gdx.graphics.g2d.SpriteBatch
|
||||
import net.torvald.terrarum.App
|
||||
import net.torvald.terrarum.CommonResourcePool
|
||||
import net.torvald.terrarum.langpack.Lang
|
||||
import kotlin.math.roundToInt
|
||||
|
||||
/**
|
||||
* Created by minjaesong on 2021-10-01.
|
||||
*/
|
||||
class UIAutosaveNotifier : UICanvas() {
|
||||
|
||||
override var width: Int
|
||||
get() = TODO("Not yet implemented")
|
||||
set(value) {}
|
||||
override var height: Int
|
||||
get() = TODO("Not yet implemented")
|
||||
set(value) {}
|
||||
override var openCloseTime = 0.2f
|
||||
companion object {
|
||||
const val WIDTH = 240
|
||||
const val HEIGHT = 24
|
||||
}
|
||||
|
||||
override var width = WIDTH
|
||||
override var height = HEIGHT
|
||||
override var openCloseTime = 0.12f //COMMON_OPEN_CLOSE
|
||||
|
||||
private val spinner = CommonResourcePool.getAsTextureRegionPack("inline_loading_spinner")
|
||||
private var spinnerTimer = 0f
|
||||
@@ -25,7 +29,7 @@ class UIAutosaveNotifier : UICanvas() {
|
||||
|
||||
override fun updateUI(delta: Float) {
|
||||
spinnerTimer += delta
|
||||
if (spinnerTimer > spinnerInterval) {
|
||||
while (spinnerTimer > spinnerInterval) {
|
||||
spinnerFrame = (spinnerFrame + 1) % 32
|
||||
spinnerTimer -= spinnerInterval
|
||||
}
|
||||
@@ -33,24 +37,28 @@ class UIAutosaveNotifier : UICanvas() {
|
||||
|
||||
override fun renderUI(batch: SpriteBatch, camera: Camera) {
|
||||
val spin = spinner.get(spinnerFrame % 8, spinnerFrame / 8)
|
||||
|
||||
val inlineOffsetY = if (App.GAME_LOCALE.startsWith("th")) 0f
|
||||
else if (App.GAME_LOCALE.startsWith("ko")) 0f
|
||||
else 1f
|
||||
|
||||
batch.draw(spin, posX.toFloat(), posY.toFloat())
|
||||
val offX = (App.scr.tvSafeGraphicsWidth * 1.25f).roundToInt().toFloat()
|
||||
val offY = App.scr.tvSafeGraphicsHeight + 4f
|
||||
|
||||
batch.color = Color.WHITE
|
||||
batch.draw(spin, offX, offY)
|
||||
App.fontGame.draw(batch, Lang["MENU_IO_SAVING"], offX + 30f, offY)
|
||||
}
|
||||
|
||||
override fun doOpening(delta: Float) {
|
||||
doOpeningFade(this, openCloseTime)
|
||||
}
|
||||
|
||||
override fun doClosing(delta: Float) {
|
||||
doClosingFade(this, openCloseTime)
|
||||
}
|
||||
|
||||
override fun endOpening(delta: Float) {
|
||||
endOpeningFade(this)
|
||||
}
|
||||
|
||||
override fun endClosing(delta: Float) {
|
||||
endClosingFade(this)
|
||||
}
|
||||
|
||||
override fun dispose() {
|
||||
|
||||
Reference in New Issue
Block a user