mirror of
https://github.com/yairm210/Unciv.git
synced 2025-09-28 06:16:37 -04:00
Resolved #3424 - Added blink on event location
This commit is contained in:
parent
44af4869d4
commit
78535252c2
@ -100,7 +100,7 @@ open class TileGroup(var tileInfo: TileInfo, var tileSetStrings:TileSetStrings)
|
|||||||
touchable = Touchable.childrenOnly; setOrigin(Align.center) }
|
touchable = Touchable.childrenOnly; setOrigin(Align.center) }
|
||||||
|
|
||||||
val circleCrosshairFogLayerGroup = ActionlessGroup().apply { isTransform = false; setSize(groupSize, groupSize) }
|
val circleCrosshairFogLayerGroup = ActionlessGroup().apply { isTransform = false; setSize(groupSize, groupSize) }
|
||||||
private val circleImage = ImageGetter.getCircle() // for blue and red circles on the tile
|
val circleImage = ImageGetter.getCircle() // for blue and red circles on the tile
|
||||||
private val crosshairImage = ImageGetter.getImage("OtherIcons/Crosshair") // for when a unit is targete
|
private val crosshairImage = ImageGetter.getImage("OtherIcons/Crosshair") // for when a unit is targete
|
||||||
protected val fogImage = ImageGetter.getImage(tileSetStrings.crosshatchHexagon)
|
protected val fogImage = ImageGetter.getImage(tileSetStrings.crosshatchHexagon)
|
||||||
|
|
||||||
|
@ -8,6 +8,7 @@ import com.badlogic.gdx.graphics.g2d.Batch
|
|||||||
import com.badlogic.gdx.math.Interpolation
|
import com.badlogic.gdx.math.Interpolation
|
||||||
import com.badlogic.gdx.math.Vector2
|
import com.badlogic.gdx.math.Vector2
|
||||||
import com.badlogic.gdx.scenes.scene2d.*
|
import com.badlogic.gdx.scenes.scene2d.*
|
||||||
|
import com.badlogic.gdx.scenes.scene2d.actions.Actions
|
||||||
import com.badlogic.gdx.scenes.scene2d.actions.FloatAction
|
import com.badlogic.gdx.scenes.scene2d.actions.FloatAction
|
||||||
import com.badlogic.gdx.scenes.scene2d.ui.Table
|
import com.badlogic.gdx.scenes.scene2d.ui.Table
|
||||||
import com.badlogic.gdx.scenes.scene2d.utils.ClickListener
|
import com.badlogic.gdx.scenes.scene2d.utils.ClickListener
|
||||||
@ -423,7 +424,7 @@ class WorldMapHolder(internal val worldScreen: WorldScreen, internal val tileMap
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
var blinkAction:Action? = null
|
||||||
fun setCenterPosition(vector: Vector2, immediately: Boolean = false, selectUnit: Boolean = true) {
|
fun setCenterPosition(vector: Vector2, immediately: Boolean = false, selectUnit: Boolean = true) {
|
||||||
val tileGroup = tileGroups.values.firstOrNull { it.tileInfo.position == vector } ?: return
|
val tileGroup = tileGroups.values.firstOrNull { it.tileInfo.position == vector } ?: return
|
||||||
selectedTile = tileGroup.tileInfo
|
selectedTile = tileGroup.tileInfo
|
||||||
@ -444,8 +445,7 @@ class WorldMapHolder(internal val worldScreen: WorldScreen, internal val tileMap
|
|||||||
scrollX = finalScrollX
|
scrollX = finalScrollX
|
||||||
scrollY = finalScrollY
|
scrollY = finalScrollY
|
||||||
updateVisualScroll()
|
updateVisualScroll()
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
val action = object : FloatAction(0f, 1f, 0.4f) {
|
val action = object : FloatAction(0f, 1f, 0.4f) {
|
||||||
override fun update(percent: Float) {
|
override fun update(percent: Float) {
|
||||||
scrollX = finalScrollX * percent + originalScrollX * (1 - percent)
|
scrollX = finalScrollX * percent + originalScrollX * (1 - percent)
|
||||||
@ -457,6 +457,15 @@ class WorldMapHolder(internal val worldScreen: WorldScreen, internal val tileMap
|
|||||||
addAction(action)
|
addAction(action)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
removeAction(blinkAction) // so we don't have multiple blinks at once
|
||||||
|
blinkAction = Actions.repeat(3, Actions.sequence(
|
||||||
|
Actions.run { tileGroup.circleImage.isVisible = false },
|
||||||
|
Actions.delay(.3f),
|
||||||
|
Actions.run { tileGroup.circleImage.isVisible = true },
|
||||||
|
Actions.delay(.3f)
|
||||||
|
))
|
||||||
|
addAction(blinkAction) // Don't set it on the group because it's an actionlss group
|
||||||
|
|
||||||
worldScreen.shouldUpdate = true
|
worldScreen.shouldUpdate = true
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user