mirror of
https://github.com/yairm210/Unciv.git
synced 2025-09-28 14:24:43 -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) }
|
||||
|
||||
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
|
||||
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.Vector2
|
||||
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.ui.Table
|
||||
import com.badlogic.gdx.scenes.scene2d.utils.ClickListener
|
||||
@ -423,11 +424,11 @@ class WorldMapHolder(internal val worldScreen: WorldScreen, internal val tileMap
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
var blinkAction:Action? = null
|
||||
fun setCenterPosition(vector: Vector2, immediately: Boolean = false, selectUnit: Boolean = true) {
|
||||
val tileGroup = tileGroups.values.firstOrNull { it.tileInfo.position == vector } ?: return
|
||||
selectedTile = tileGroup.tileInfo
|
||||
if(selectUnit)
|
||||
if (selectUnit)
|
||||
worldScreen.bottomUnitTable.tileSelected(selectedTile!!)
|
||||
|
||||
val originalScrollX = scrollX
|
||||
@ -440,12 +441,11 @@ class WorldMapHolder(internal val worldScreen: WorldScreen, internal val tileMap
|
||||
// Here it's the same, only the Y axis is inverted - when at 0 we're at the top, not bottom - so we invert it back.
|
||||
val finalScrollY = maxY - (tileGroup.y + tileGroup.width / 2 - height / 2)
|
||||
|
||||
if(immediately){
|
||||
if (immediately) {
|
||||
scrollX = finalScrollX
|
||||
scrollY = finalScrollY
|
||||
updateVisualScroll()
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
val action = object : FloatAction(0f, 1f, 0.4f) {
|
||||
override fun update(percent: Float) {
|
||||
scrollX = finalScrollX * percent + originalScrollX * (1 - percent)
|
||||
@ -457,7 +457,16 @@ class WorldMapHolder(internal val worldScreen: WorldScreen, internal val tileMap
|
||||
addAction(action)
|
||||
}
|
||||
|
||||
worldScreen.shouldUpdate=true
|
||||
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
|
||||
}
|
||||
|
||||
override fun zoom(zoomScale:Float) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user