mirror of
https://github.com/yairm210/Unciv.git
synced 2025-09-29 23:10:39 -04:00
Can no longer pick policies in multiplayer when it's someone elses turn
This commit is contained in:
parent
faa90dd269
commit
d3a6417996
@ -1111,7 +1111,7 @@
|
|||||||
Italian:"67% di probabilità di ottenere 25 Oro e reclutare un'unità barbara da un accampamento catturato. -25% mantenimento delle unità terrestri."
|
Italian:"67% di probabilità di ottenere 25 Oro e reclutare un'unità barbara da un accampamento catturato. -25% mantenimento delle unità terrestri."
|
||||||
French:"67% de chance de gagner 25 or et d'enroler une unité barbare lors de la prise d'un campement barbare. -25% de coût de maintenance pour les unités terrestres."
|
French:"67% de chance de gagner 25 or et d'enroler une unité barbare lors de la prise d'un campement barbare. -25% de coût de maintenance pour les unités terrestres."
|
||||||
Simplified_Chinese:"击败蛮族营地中的蛮族单位有67%几率得到25金钱并使其加入,陆上单位维护费-25%"
|
Simplified_Chinese:"击败蛮族营地中的蛮族单位有67%几率得到25金钱并使其加入,陆上单位维护费-25%"
|
||||||
Russian:"Шанс 67% получить 25 Золото и варварский юнит из захваченного лагеря. -25% к стоимости содержания наземных юнитов.
|
Russian:"Шанс 67% получить 25 Золото и варварский юнит из захваченного лагеря. -25% к стоимости содержания наземных юнитов."
|
||||||
}
|
}
|
||||||
|
|
||||||
"India":{
|
"India":{
|
||||||
|
@ -21,8 +21,8 @@ android {
|
|||||||
applicationId "com.unciv.app"
|
applicationId "com.unciv.app"
|
||||||
minSdkVersion 14
|
minSdkVersion 14
|
||||||
targetSdkVersion 29
|
targetSdkVersion 29
|
||||||
versionCode 294
|
versionCode 295
|
||||||
versionName "3.0.1"
|
versionName "3.0.2"
|
||||||
}
|
}
|
||||||
|
|
||||||
// Had to add this crap for Travis to build, it wanted to sign the app
|
// Had to add this crap for Travis to build, it wanted to sign the app
|
||||||
|
@ -10,14 +10,15 @@ import com.unciv.models.gamebasics.GameBasics
|
|||||||
import com.unciv.models.gamebasics.Policy
|
import com.unciv.models.gamebasics.Policy
|
||||||
import com.unciv.models.gamebasics.tr
|
import com.unciv.models.gamebasics.tr
|
||||||
import com.unciv.ui.utils.*
|
import com.unciv.ui.utils.*
|
||||||
|
import com.unciv.ui.worldscreen.WorldScreen
|
||||||
|
|
||||||
|
|
||||||
class PolicyPickerScreen(internal val civInfo: CivilizationInfo) : PickerScreen() {
|
class PolicyPickerScreen(val worldScreen: WorldScreen) : PickerScreen() {
|
||||||
|
internal val viewingCiv: CivilizationInfo = worldScreen.viewingCiv
|
||||||
private var pickedPolicy: Policy? = null
|
private var pickedPolicy: Policy? = null
|
||||||
|
|
||||||
init {
|
init {
|
||||||
val policies = civInfo.policies
|
val policies = viewingCiv.policies
|
||||||
displayTutorials("PolicyPickerScreen")
|
displayTutorials("PolicyPickerScreen")
|
||||||
|
|
||||||
rightSideButton.setText("{Adopt policy}\r\n(".tr() + policies.storedCulture + "/" + policies.getCultureNeededForNextPolicy() + ")")
|
rightSideButton.setText("{Adopt policy}\r\n(".tr() + policies.storedCulture + "/" + policies.getCultureNeededForNextPolicy() + ")")
|
||||||
@ -30,14 +31,14 @@ class PolicyPickerScreen(internal val civInfo: CivilizationInfo) : PickerScreen(
|
|||||||
else onBackButtonClicked { UnCivGame.Current.setWorldScreen() }
|
else onBackButtonClicked { UnCivGame.Current.setWorldScreen() }
|
||||||
|
|
||||||
rightSideButton.onClick("policy") {
|
rightSideButton.onClick("policy") {
|
||||||
civInfo.policies.adopt(pickedPolicy!!)
|
viewingCiv.policies.adopt(pickedPolicy!!)
|
||||||
|
|
||||||
// If we've moved to another screen in the meantime (great person pick, victory screen) ignore this
|
// If we've moved to another screen in the meantime (great person pick, victory screen) ignore this
|
||||||
if(game.screen !is PolicyPickerScreen || !policies.canAdoptPolicy()){
|
if(game.screen !is PolicyPickerScreen || !policies.canAdoptPolicy()){
|
||||||
game.setWorldScreen()
|
game.setWorldScreen()
|
||||||
dispose()
|
dispose()
|
||||||
}
|
}
|
||||||
else game.screen = PolicyPickerScreen(civInfo) // update policies
|
else game.screen = PolicyPickerScreen(worldScreen) // update policies
|
||||||
}
|
}
|
||||||
if(!UnCivGame.Current.worldScreen.isPlayersTurn)
|
if(!UnCivGame.Current.worldScreen.isPlayersTurn)
|
||||||
rightSideButton.disable()
|
rightSideButton.disable()
|
||||||
@ -78,10 +79,11 @@ class PolicyPickerScreen(internal val civInfo: CivilizationInfo) : PickerScreen(
|
|||||||
}
|
}
|
||||||
|
|
||||||
private fun pickPolicy(policy: Policy) {
|
private fun pickPolicy(policy: Policy) {
|
||||||
if (civInfo.policies.isAdopted(policy.name)
|
if (!worldScreen.isPlayersTurn
|
||||||
|
|| viewingCiv.policies.isAdopted(policy.name)
|
||||||
|| policy.name.endsWith("Complete")
|
|| policy.name.endsWith("Complete")
|
||||||
|| !civInfo.policies.isAdoptable(policy)
|
|| !viewingCiv.policies.isAdoptable(policy)
|
||||||
|| !civInfo.policies.canAdoptPolicy()) {
|
|| !viewingCiv.policies.canAdoptPolicy()) {
|
||||||
rightSideButton.disable()
|
rightSideButton.disable()
|
||||||
} else {
|
} else {
|
||||||
rightSideButton.enable()
|
rightSideButton.enable()
|
||||||
@ -106,9 +108,9 @@ class PolicyPickerScreen(internal val civInfo: CivilizationInfo) : PickerScreen(
|
|||||||
policyButton = TextButton(policy.name.tr(), skin)
|
policyButton = TextButton(policy.name.tr(), skin)
|
||||||
}
|
}
|
||||||
|
|
||||||
if (civInfo.policies.isAdopted(policy.name)) { // existing
|
if (viewingCiv.policies.isAdopted(policy.name)) { // existing
|
||||||
policyButton.color = Color.GREEN
|
policyButton.color = Color.GREEN
|
||||||
} else if (!civInfo.policies.isAdoptable(policy))
|
} else if (!viewingCiv.policies.isAdoptable(policy))
|
||||||
// non-available
|
// non-available
|
||||||
{
|
{
|
||||||
policyButton.color = Color.GRAY
|
policyButton.color = Color.GRAY
|
||||||
|
@ -75,7 +75,7 @@ class WorldScreen(val viewingCiv:CivilizationInfo) : CameraStageBaseScreen() {
|
|||||||
if(viewingCiv.policies.adoptedPolicies.isNotEmpty() || viewingCiv.policies.canAdoptPolicy()) {
|
if(viewingCiv.policies.adoptedPolicies.isNotEmpty() || viewingCiv.policies.canAdoptPolicy()) {
|
||||||
val policyScreenButton = Button(skin)
|
val policyScreenButton = Button(skin)
|
||||||
policyScreenButton.add(ImageGetter.getImage("PolicyIcons/Constitution")).size(30f).pad(15f)
|
policyScreenButton.add(ImageGetter.getImage("PolicyIcons/Constitution")).size(30f).pad(15f)
|
||||||
policyScreenButton.onClick { game.screen = PolicyPickerScreen(viewingCiv) }
|
policyScreenButton.onClick { game.screen = PolicyPickerScreen(this) }
|
||||||
techPolicyandVictoryHolder.add(policyScreenButton).pad(10f)
|
techPolicyandVictoryHolder.add(policyScreenButton).pad(10f)
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -186,7 +186,7 @@ class WorldScreen(val viewingCiv:CivilizationInfo) : CameraStageBaseScreen() {
|
|||||||
if(!isSomethingOpen) {
|
if(!isSomethingOpen) {
|
||||||
when {
|
when {
|
||||||
!gameInfo.oneMoreTurnMode && gameInfo.civilizations.any { it.victoryManager.hasWon() } -> game.screen = VictoryScreen()
|
!gameInfo.oneMoreTurnMode && gameInfo.civilizations.any { it.victoryManager.hasWon() } -> game.screen = VictoryScreen()
|
||||||
viewingCiv.policies.freePolicies > 0 -> game.screen = PolicyPickerScreen(viewingCiv)
|
viewingCiv.policies.freePolicies > 0 -> game.screen = PolicyPickerScreen(this)
|
||||||
viewingCiv.greatPeople.freeGreatPeople > 0 -> game.screen = GreatPersonPickerScreen()
|
viewingCiv.greatPeople.freeGreatPeople > 0 -> game.screen = GreatPersonPickerScreen()
|
||||||
viewingCiv.tradeRequests.isNotEmpty() -> TradePopup(this)
|
viewingCiv.tradeRequests.isNotEmpty() -> TradePopup(this)
|
||||||
viewingCiv.popupAlerts.any() -> AlertPopup(this, viewingCiv.popupAlerts.first())
|
viewingCiv.popupAlerts.any() -> AlertPopup(this, viewingCiv.popupAlerts.first())
|
||||||
@ -298,7 +298,7 @@ class WorldScreen(val viewingCiv:CivilizationInfo) : CameraStageBaseScreen() {
|
|||||||
game.screen = TechPickerScreen(viewingCiv.tech.freeTechs != 0, viewingCiv)
|
game.screen = TechPickerScreen(viewingCiv.tech.freeTechs != 0, viewingCiv)
|
||||||
return@onClick
|
return@onClick
|
||||||
} else if (viewingCiv.policies.shouldOpenPolicyPicker) {
|
} else if (viewingCiv.policies.shouldOpenPolicyPicker) {
|
||||||
game.screen = PolicyPickerScreen(viewingCiv)
|
game.screen = PolicyPickerScreen(this)
|
||||||
viewingCiv.policies.shouldOpenPolicyPicker = false
|
viewingCiv.policies.shouldOpenPolicyPicker = false
|
||||||
return@onClick
|
return@onClick
|
||||||
}
|
}
|
||||||
|
@ -105,7 +105,7 @@ class WorldScreenMenuTable(val worldScreen: WorldScreen) : PopupTable(worldScree
|
|||||||
return@addButton
|
return@addButton
|
||||||
}
|
}
|
||||||
try {
|
try {
|
||||||
val game = OnlineMultiplayer().tryDownloadGame(gameId)
|
val game = OnlineMultiplayer().tryDownloadGame(gameId.trim())
|
||||||
UnCivGame.Current.loadGame(game)
|
UnCivGame.Current.loadGame(game)
|
||||||
} catch (ex: Exception) {
|
} catch (ex: Exception) {
|
||||||
badGameIdLabel.setText("Could not download game!".tr())
|
badGameIdLabel.setText("Could not download game!".tr())
|
||||||
|
Loading…
x
Reference in New Issue
Block a user