mirror of
https://github.com/curioustorvald/Terrarum.git
synced 2026-06-14 04:24:05 +09:00
message notificator bug fixed where it would only work properly for first time
Former-commit-id: 640b113cb242ec572f17654feaa8b9be52c333c3
This commit is contained in:
@@ -38,7 +38,7 @@ constructor(override var width: Int, isBlackVariant: Boolean) : UICanvas {
|
|||||||
else {
|
else {
|
||||||
segmentLeft = Image("./assets/graphics/gui/message_black_left.tga")
|
segmentLeft = Image("./assets/graphics/gui/message_black_left.tga")
|
||||||
segmentRight = Image("./assets/graphics/gui/message_black_right.tga")
|
segmentRight = Image("./assets/graphics/gui/message_black_right.tga")
|
||||||
segmentBody = Image("./assets/graphics/gui/message_black_body.tga")
|
segmentBody = Image("./assets/graphics/gui/message_black_body.tga") // keep width=2 or greater; no width 1 !!
|
||||||
}
|
}
|
||||||
uiFont = GameFontImpl()
|
uiFont = GameFontImpl()
|
||||||
height = segmentLeft!!.height
|
height = segmentLeft!!.height
|
||||||
|
|||||||
@@ -10,8 +10,7 @@ import org.newdawn.slick.SlickException
|
|||||||
/**
|
/**
|
||||||
* Created by minjaesong on 16-01-23.
|
* Created by minjaesong on 16-01-23.
|
||||||
*/
|
*/
|
||||||
class Notification @Throws(SlickException::class)
|
class Notification : UICanvas {
|
||||||
constructor() : UICanvas {
|
|
||||||
|
|
||||||
private val SHOWUP_MAX = 15000
|
private val SHOWUP_MAX = 15000
|
||||||
|
|
||||||
@@ -26,7 +25,7 @@ constructor() : UICanvas {
|
|||||||
)
|
)
|
||||||
private var displayTimer = 0
|
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
|
override var openCloseTime: Int = MessageWindow.OPEN_CLOSE_TIME
|
||||||
|
|
||||||
@@ -39,8 +38,10 @@ constructor() : UICanvas {
|
|||||||
if (handler!!.isOpened)
|
if (handler!!.isOpened)
|
||||||
displayTimer += delta
|
displayTimer += delta
|
||||||
|
|
||||||
if (displayTimer >= visibleTime)
|
if (displayTimer >= visibleTime) {
|
||||||
handler!!.setAsClose()
|
handler!!.setAsClose()
|
||||||
|
displayTimer = 0
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun render(gc: GameContainer, g: Graphics) {
|
override fun render(gc: GameContainer, g: Graphics) {
|
||||||
@@ -48,23 +49,19 @@ constructor() : UICanvas {
|
|||||||
}
|
}
|
||||||
|
|
||||||
override fun doOpening(gc: GameContainer, delta: Int) {
|
override fun doOpening(gc: GameContainer, delta: Int) {
|
||||||
handler!!.opacity = FastMath.interpolateLinear(handler!!.openCloseCounter.toFloat() / openCloseTime.toFloat(),
|
UICanvas.doOpeningFade(handler, openCloseTime)
|
||||||
0f, 1f
|
|
||||||
)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun doClosing(gc: GameContainer, delta: Int) {
|
override fun doClosing(gc: GameContainer, delta: Int) {
|
||||||
handler!!.opacity = FastMath.interpolateLinear(handler!!.openCloseCounter.toFloat() / openCloseTime.toFloat(),
|
UICanvas.doClosingFade(handler, openCloseTime)
|
||||||
1f, 0f
|
|
||||||
)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun endOpening(gc: GameContainer, delta: Int) {
|
override fun endOpening(gc: GameContainer, delta: Int) {
|
||||||
handler!!.opacity = 1f
|
UICanvas.endOpeningFade(handler)
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun endClosing(gc: GameContainer, delta: Int) {
|
override fun endClosing(gc: GameContainer, delta: Int) {
|
||||||
handler!!.opacity = 0f
|
UICanvas.endClosingFade(handler)
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun processInput(gc: GameContainer, delta: Int, input: Input) {
|
override fun processInput(gc: GameContainer, delta: Int, input: Input) {
|
||||||
|
|||||||
Reference in New Issue
Block a user