mirror of
https://github.com/yairm210/Unciv.git
synced 2025-07-07 00:41:39 +07:00
Nicer 'move unit to tile' button
This commit is contained in:
@ -362,22 +362,28 @@ class WorldMapHolder(internal val worldScreen: WorldScreen, internal val tileMap
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun getMoveHereButton(dto: MoveHereButtonDto): Group {
|
val buttonSize = 60f
|
||||||
val size = 60f
|
val smallerCircleSizes = 25f
|
||||||
val moveHereButton = Group().apply { width = size;height = size; }
|
|
||||||
moveHereButton.addActor(ImageGetter.getCircle().apply { width = size; height = size })
|
private fun getMoveHereButton(dto: MoveHereButtonDto): Group {
|
||||||
moveHereButton.addActor(ImageGetter.getStatIcon("Movement")
|
val moveHereButton = ImageGetter.getStatIcon("Movement")
|
||||||
.apply { color = Color.BLACK; width = size / 2; height = size / 2; center(moveHereButton) })
|
.apply { color = Color.BLACK; width = buttonSize / 2; height = buttonSize / 2 }
|
||||||
|
.surroundWithCircle(buttonSize-2, false)
|
||||||
|
.surroundWithCircle(buttonSize, false, Color.BLACK)
|
||||||
|
|
||||||
|
|
||||||
|
val numberCircle = dto.unitToTurnsToDestination.values.maxOrNull()!!.toString().toLabel(fontSize = 14)
|
||||||
|
.apply { setAlignment(Align.center) }
|
||||||
|
.surroundWithCircle(smallerCircleSizes-2, color = ImageGetter.getBlue().lerp(Color.BLACK, 0.3f))
|
||||||
|
.surroundWithCircle(smallerCircleSizes,false)
|
||||||
|
|
||||||
val numberCircle = ImageGetter.getCircle().apply { width = size / 2; height = size / 2;color = Color.BLUE }
|
|
||||||
moveHereButton.addActor(numberCircle)
|
moveHereButton.addActor(numberCircle)
|
||||||
|
|
||||||
moveHereButton.addActor(dto.unitToTurnsToDestination.values.maxOrNull()!!.toLabel().apply { center(numberCircle) })
|
|
||||||
val firstUnit = dto.unitToTurnsToDestination.keys.first()
|
val firstUnit = dto.unitToTurnsToDestination.keys.first()
|
||||||
val unitIcon = if (dto.unitToTurnsToDestination.size == 1) UnitGroup(firstUnit, size / 2)
|
val unitIcon = if (dto.unitToTurnsToDestination.size == 1) UnitGroup(firstUnit, smallerCircleSizes)
|
||||||
else dto.unitToTurnsToDestination.size.toString().toLabel(fontColor = firstUnit.civInfo.nation.getInnerColor()).apply { setAlignment(Align.center) }
|
else dto.unitToTurnsToDestination.size.toString().toLabel(fontColor = firstUnit.civInfo.nation.getInnerColor()).apply { setAlignment(Align.center) }
|
||||||
.surroundWithCircle(size / 2).apply { circle.color = firstUnit.civInfo.nation.getOuterColor() }
|
.surroundWithCircle(smallerCircleSizes).apply { circle.color = firstUnit.civInfo.nation.getOuterColor() }
|
||||||
unitIcon.y = size - unitIcon.height
|
unitIcon.y = buttonSize - unitIcon.height
|
||||||
moveHereButton.addActor(unitIcon)
|
moveHereButton.addActor(unitIcon)
|
||||||
|
|
||||||
val unitsThatCanMove = dto.unitToTurnsToDestination.keys.filter { it.currentMovement > 0 }
|
val unitsThatCanMove = dto.unitToTurnsToDestination.keys.filter { it.currentMovement > 0 }
|
||||||
@ -394,14 +400,13 @@ class WorldMapHolder(internal val worldScreen: WorldScreen, internal val tileMap
|
|||||||
}
|
}
|
||||||
|
|
||||||
private fun getSwapWithButton(dto: SwapWithButtonDto): Group {
|
private fun getSwapWithButton(dto: SwapWithButtonDto): Group {
|
||||||
val size = 60f
|
val swapWithButton = Group().apply { width = buttonSize;height = buttonSize; }
|
||||||
val swapWithButton = Group().apply { width = size;height = size; }
|
swapWithButton.addActor(ImageGetter.getCircle().apply { width = buttonSize; height = buttonSize })
|
||||||
swapWithButton.addActor(ImageGetter.getCircle().apply { width = size; height = size })
|
|
||||||
swapWithButton.addActor(ImageGetter.getImage("OtherIcons/Swap")
|
swapWithButton.addActor(ImageGetter.getImage("OtherIcons/Swap")
|
||||||
.apply { color = Color.BLACK; width = size / 2; height = size / 2; center(swapWithButton) })
|
.apply { color = Color.BLACK; width = buttonSize / 2; height = buttonSize / 2; center(swapWithButton) })
|
||||||
|
|
||||||
val unitIcon = UnitGroup(dto.unit, size / 2)
|
val unitIcon = UnitGroup(dto.unit, smallerCircleSizes)
|
||||||
unitIcon.y = size - unitIcon.height
|
unitIcon.y = buttonSize - unitIcon.height
|
||||||
swapWithButton.addActor(unitIcon)
|
swapWithButton.addActor(unitIcon)
|
||||||
|
|
||||||
swapWithButton.onClick(UncivSound.Silent) {
|
swapWithButton.onClick(UncivSound.Silent) {
|
||||||
|
Reference in New Issue
Block a user