mirror of
https://github.com/curioustorvald/Terrarum.git
synced 2026-03-07 12:21:52 +09:00
message notificator bug fixed where it would only work properly for first time
Former-commit-id: 640b113cb242ec572f17654feaa8b9be52c333c3
This commit is contained in:
@@ -10,8 +10,7 @@ import org.newdawn.slick.SlickException
|
||||
/**
|
||||
* Created by minjaesong on 16-01-23.
|
||||
*/
|
||||
class Notification @Throws(SlickException::class)
|
||||
constructor() : UICanvas {
|
||||
class Notification : UICanvas {
|
||||
|
||||
private val SHOWUP_MAX = 15000
|
||||
|
||||
@@ -26,7 +25,7 @@ constructor() : UICanvas {
|
||||
)
|
||||
private var displayTimer = 0
|
||||
|
||||
internal var message: Array<String> = Array(MessageWindow.MESSAGES_DISPLAY, { i -> ""})
|
||||
internal var message: Array<String> = Array(MessageWindow.MESSAGES_DISPLAY, { "" })
|
||||
|
||||
override var openCloseTime: Int = MessageWindow.OPEN_CLOSE_TIME
|
||||
|
||||
@@ -39,8 +38,10 @@ constructor() : UICanvas {
|
||||
if (handler!!.isOpened)
|
||||
displayTimer += delta
|
||||
|
||||
if (displayTimer >= visibleTime)
|
||||
if (displayTimer >= visibleTime) {
|
||||
handler!!.setAsClose()
|
||||
displayTimer = 0
|
||||
}
|
||||
}
|
||||
|
||||
override fun render(gc: GameContainer, g: Graphics) {
|
||||
@@ -48,23 +49,19 @@ constructor() : UICanvas {
|
||||
}
|
||||
|
||||
override fun doOpening(gc: GameContainer, delta: Int) {
|
||||
handler!!.opacity = FastMath.interpolateLinear(handler!!.openCloseCounter.toFloat() / openCloseTime.toFloat(),
|
||||
0f, 1f
|
||||
)
|
||||
UICanvas.doOpeningFade(handler, openCloseTime)
|
||||
}
|
||||
|
||||
override fun doClosing(gc: GameContainer, delta: Int) {
|
||||
handler!!.opacity = FastMath.interpolateLinear(handler!!.openCloseCounter.toFloat() / openCloseTime.toFloat(),
|
||||
1f, 0f
|
||||
)
|
||||
UICanvas.doClosingFade(handler, openCloseTime)
|
||||
}
|
||||
|
||||
override fun endOpening(gc: GameContainer, delta: Int) {
|
||||
handler!!.opacity = 1f
|
||||
UICanvas.endOpeningFade(handler)
|
||||
}
|
||||
|
||||
override fun endClosing(gc: GameContainer, delta: Int) {
|
||||
handler!!.opacity = 0f
|
||||
UICanvas.endClosingFade(handler)
|
||||
}
|
||||
|
||||
override fun processInput(gc: GameContainer, delta: Int, input: Input) {
|
||||
|
||||
Reference in New Issue
Block a user