mirror of
https://github.com/yairm210/Unciv.git
synced 2025-09-29 06:51:30 -04:00
Resolved #2844 - Can now immediately move units in Desktop with right-click
This commit is contained in:
parent
a6b89b9885
commit
6d7903eb93
@ -1,12 +1,14 @@
|
|||||||
package com.unciv.ui.worldscreen
|
package com.unciv.ui.worldscreen
|
||||||
|
|
||||||
import com.badlogic.gdx.Gdx
|
import com.badlogic.gdx.Gdx
|
||||||
|
import com.badlogic.gdx.Input
|
||||||
import com.badlogic.gdx.graphics.Color
|
import com.badlogic.gdx.graphics.Color
|
||||||
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.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.unciv.Constants
|
import com.unciv.Constants
|
||||||
import com.unciv.UncivGame
|
import com.unciv.UncivGame
|
||||||
import com.unciv.logic.automation.BattleHelper
|
import com.unciv.logic.automation.BattleHelper
|
||||||
@ -47,6 +49,23 @@ class WorldMapHolder(internal val worldScreen: WorldScreen, internal val tileMap
|
|||||||
onTileClicked(tileGroup.tileInfo)
|
onTileClicked(tileGroup.tileInfo)
|
||||||
}
|
}
|
||||||
tileGroup.onClick { 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
|
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
|
* [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
|
* [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
|
* [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
|
## Main menu
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user