Resolved #2844 - Can now immediately move units in Desktop with right-click
This commit is contained in:
parent
a6b89b9885
commit
6d7903eb93
2 changed files with 20 additions and 0 deletions
|
@ -1,12 +1,14 @@
|
|||
package com.unciv.ui.worldscreen
|
||||
|
||||
import com.badlogic.gdx.Gdx
|
||||
import com.badlogic.gdx.Input
|
||||
import com.badlogic.gdx.graphics.Color
|
||||
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.FloatAction
|
||||
import com.badlogic.gdx.scenes.scene2d.ui.Table
|
||||
import com.badlogic.gdx.scenes.scene2d.utils.ClickListener
|
||||
import com.unciv.Constants
|
||||
import com.unciv.UncivGame
|
||||
import com.unciv.logic.automation.BattleHelper
|
||||
|
@ -47,6 +49,23 @@ class WorldMapHolder(internal val worldScreen: WorldScreen, internal val tileMap
|
|||
onTileClicked(tileGroup.tileInfo)
|
||||
}
|
||||
tileGroup.onClick { onTileClicked(tileGroup.tileInfo) }
|
||||
|
||||
// Right mouse click listener
|
||||
tileGroup.addListener(object : ClickListener() {
|
||||
init {
|
||||
button = Input.Buttons.RIGHT
|
||||
}
|
||||
override fun clicked(event: InputEvent?, x: Float, y: Float) {
|
||||
val unit = worldScreen.bottomUnitTable.selectedUnit
|
||||
if (unit == null) return
|
||||
thread {
|
||||
val canUnitReachTile = unit.movement.canReach(tileGroup.tileInfo)
|
||||
if (canUnitReachTile) {
|
||||
UnitContextMenu(this@WorldMapHolder, unit, tileGroup.tileInfo).onMoveButtonClick()
|
||||
}
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
actor = allTiles
|
||||
|
|
|
@ -518,6 +518,7 @@ Unless otherwise specified, all the following are from [the Noun Project](https:
|
|||
* [Puppet](https://thenounproject.com/search/?q=puppet&i=285735) By Ben Davis for puppeted cities
|
||||
* [City](https://thenounproject.com/search/?q=city&i=1765370) By Muhajir ila Robbi in the Icon center
|
||||
* [Lock](https://thenounproject.com/search/?q=lock&i=3217613) by Vadim Solomakhin for locked tiles
|
||||
* [Turn](https://thenounproject.com/search/?q=turn&i=2829863) by Adrien Coquet for the 'Turn' icon
|
||||
|
||||
## Main menu
|
||||
|
||||
|
|
Loading…
Reference in a new issue