Selected unit stays selected when single-tap moved into a tile with another unit

This commit is contained in:
Yair Morgenstern
2020-12-07 20:08:58 +02:00
parent 2c35cc98de
commit 3e6955d0d9
3 changed files with 22 additions and 26 deletions

View File

@ -1235,21 +1235,6 @@
"upgradesTo": "Helicopter Gunship",
"uniques": ["Bonus vs Armor 100%"]
},
{
// "Hovering unit" unique gives ability to get into impassable tiles - and only that (no vision bonus or flying over ocean)
// Unit embarks like any other ground unit and has penalty for attacking over river or from embarked state
// "Unable to capture cities"
"name": "Helicopter Gunship",
"unitType": "Melee",
"movement": 6,
"strength": 60,
"cost": 425,
"requiredTech": "Computers",
"requiredResource": "Aluminum",
"uniques": ["Bonus vs Armor 100%", "No defensive terrain bonus", "Can move after attacking", "All tiles cost 1 movement",
"Can pass through impassable tiles", "Unable to capture cities"],
"attackSound": "shot"
},
{
"name": "Rocket Artillery",
"unitType": "Siege",
@ -1297,6 +1282,20 @@
"attackSound": "shot"
// 65 strength, 3 movement, requiredTech "Rocketry" in expansions
},
{
// "Hovering unit" unique gives ability to get into impassable tiles - and only that (no vision bonus or flying over ocean)
// Unit embarks like any other ground unit and has penalty for attacking over river or from embarked state
"name": "Helicopter Gunship",
"unitType": "Melee",
"movement": 6,
"strength": 60,
"cost": 425,
"requiredTech": "Computers",
"requiredResource": "Aluminum",
"uniques": ["Bonus vs Armor 100%", "No defensive terrain bonus", "Can move after attacking", "All tiles cost 1 movement",
"Can pass through impassable tiles", "Unable to capture cities"],
"attackSound": "shot"
},
{
"name": "Jet Fighter",
"unitType": "Fighter",

View File

@ -107,9 +107,9 @@ class PolicyPickerScreen(val worldScreen: WorldScreen, civInfo: CivilizationInfo
if (!policy.name.endsWith("Complete")) {
if (policy.requires!!.isNotEmpty())
policyText += "{Requires} ".tr() + policy.requires!!.joinToString { it.tr() }
policyText += "Requires [" + policy.requires!!.joinToString { it.tr() }+"]"
else
policyText += ("{Unlocked at} {" + policy.branch.era + "}").tr()
policyText += "{Unlocked at} {" + policy.branch.era + "}"
}
descriptionLabel.setText(policyText.joinToString("\r\n") { it.tr() })
}
@ -123,13 +123,10 @@ class PolicyPickerScreen(val worldScreen: WorldScreen, civInfo: CivilizationInfo
policyButton = policy.name.toTextButton()
}
if (viewingCiv.policies.isAdopted(policy.name)) { // existing
policyButton.color = Color.GREEN
} else if (!viewingCiv.policies.isAdoptable(policy))
// non-available
{
policyButton.color = Color.GRAY
}
if (viewingCiv.policies.isAdopted(policy.name)) policyButton.color = Color.GREEN // existing
else if (!viewingCiv.policies.isAdoptable(policy)) policyButton.color = Color.GRAY // non-available
policyButton.onClick { pickPolicy(policy) }
policyButton.pack()
return policyButton

View File

@ -205,14 +205,14 @@ class WorldMapHolder(internal val worldScreen: WorldScreen, internal val tileMap
}
val turnsToGetThere = unitsWhoCanMoveThere.values.max()!!
// val selectedUnit = unitsWhoCanMoveThere.keys.first()
if (UncivGame.Current.settings.singleTapMove && turnsToGetThere == 1) {
// single turn instant move
val selectedUnit = unitsWhoCanMoveThere.keys.first()
for(unit in unitsWhoCanMoveThere.keys) {
unit.movement.headTowards(tileInfo)
}
// worldScreen.bottomUnitTable.selectUnit(selectedUnit) // keep moved unit selected
worldScreen.bottomUnitTable.selectUnit(selectedUnit) // keep moved unit selected
} else {
// add "move to" button if there is a path to tileInfo
val moveHereButtonDto = MoveHereButtonDto(unitsWhoCanMoveThere, tileInfo)