Removed all opening of screens from within game logic, put in the WorldScreen login instead, so that the rendering screen remains the same (OpenGL context problems)
This commit is contained in:
parent
6d059fb6ed
commit
335b7dc1e3
5 changed files with 6 additions and 16 deletions
|
@ -30,7 +30,7 @@ class CivilizationInfo {
|
|||
var tech = TechManager()
|
||||
var policies = PolicyManager()
|
||||
var goldenAges = GoldenAgeManager()
|
||||
private var greatPeople = GreatPersonManager()
|
||||
var greatPeople = GreatPersonManager()
|
||||
var scienceVictory = ScienceVictoryManager()
|
||||
|
||||
var cities = ArrayList<CityInfo>()
|
||||
|
|
|
@ -5,6 +5,7 @@ import com.unciv.models.stats.Stats
|
|||
class GreatPersonManager {
|
||||
private var pointsForNextGreatPerson = 100
|
||||
private val greatPersonPoints = Stats()
|
||||
var freeGreatPeople=0
|
||||
|
||||
fun getNewGreatPerson(): String? {
|
||||
var greatPerson: String? = null
|
||||
|
|
|
@ -1,10 +1,7 @@
|
|||
package com.unciv.logic.civilization
|
||||
|
||||
import com.unciv.UnCivGame
|
||||
import com.unciv.models.gamebasics.GameBasics
|
||||
import com.unciv.models.gamebasics.Policy
|
||||
import com.unciv.ui.VictoryScreen
|
||||
import com.unciv.ui.pickerscreens.GreatPersonPickerScreen
|
||||
import com.unciv.ui.utils.getRandom
|
||||
|
||||
|
||||
|
@ -55,8 +52,6 @@ class PolicyManager {
|
|||
if (branch.policies.count { isAdopted(it.name) } == branch.policies.size - 1) { // All done apart from branch completion
|
||||
adopt(branch.policies.last(), true) // add branch completion!
|
||||
}
|
||||
} else {
|
||||
UnCivGame.Current.screen = VictoryScreen()
|
||||
}
|
||||
|
||||
when (policy.name) {
|
||||
|
@ -69,7 +64,7 @@ class PolicyManager {
|
|||
city.cityConstructions.addCultureBuilding()
|
||||
"Free Religion" -> freePolicies++
|
||||
"Liberty Complete" -> {
|
||||
if (civInfo.isPlayerCivilization()) UnCivGame.Current.screen = GreatPersonPickerScreen() // screw the victory screen!
|
||||
if (civInfo.isPlayerCivilization()) civInfo.greatPeople.freeGreatPeople++
|
||||
else civInfo.addGreatPerson(GameBasics.Units.keys.filter { it.startsWith("Great") }.getRandom())
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,12 +1,9 @@
|
|||
package com.unciv.models.gamebasics
|
||||
|
||||
import com.unciv.UnCivGame
|
||||
import com.unciv.logic.city.CityConstructions
|
||||
import com.unciv.logic.city.IConstruction
|
||||
import com.unciv.models.stats.NamedStats
|
||||
import com.unciv.models.stats.Stats
|
||||
import com.unciv.ui.VictoryScreen
|
||||
import com.unciv.ui.pickerscreens.PolicyPickerScreen
|
||||
|
||||
class Building : NamedStats(), IConstruction{
|
||||
private var baseDescription: String? = null
|
||||
|
@ -189,7 +186,6 @@ class Building : NamedStats(), IConstruction{
|
|||
|
||||
if (unique == "Spaceship part") {
|
||||
civInfo.scienceVictory.currentParts.add(name, 1)
|
||||
UnCivGame.Current.screen = VictoryScreen()
|
||||
return
|
||||
}
|
||||
construction.builtBuildings.add(name)
|
||||
|
@ -197,9 +193,6 @@ class Building : NamedStats(), IConstruction{
|
|||
if (providesFreeBuilding != null && !construction.builtBuildings.contains(providesFreeBuilding!!))
|
||||
construction.builtBuildings.add(providesFreeBuilding!!)
|
||||
when (unique) {
|
||||
"Enables construction of Spaceship parts" ->
|
||||
if(construction.cityInfo.civInfo.isPlayerCivilization())
|
||||
UnCivGame.Current.screen = VictoryScreen()
|
||||
"Empire enters golden age" -> civInfo.goldenAges.enterGoldenAge()
|
||||
"Free Great Artist Appears" -> civInfo.addGreatPerson("Great Artist")
|
||||
"Worker construction increased 25%, provides 2 free workers" -> {
|
||||
|
@ -208,8 +201,6 @@ class Building : NamedStats(), IConstruction{
|
|||
}
|
||||
"Free Social Policy" -> {
|
||||
civInfo.policies.freePolicies++
|
||||
if(construction.cityInfo.civInfo.isPlayerCivilization())
|
||||
UnCivGame.Current.screen = PolicyPickerScreen(civInfo)
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -75,6 +75,9 @@ class WorldScreen : CameraStageBaseScreen() {
|
|||
notificationsScroll.width = stage.width/3
|
||||
notificationsScroll.setPosition(stage.width - notificationsScroll.width - 5f,
|
||||
nextTurnButton.y - notificationsScroll.height - 5f)
|
||||
|
||||
if(civInfo.policies.freePolicies>0) game.screen = PolicyPickerScreen(civInfo)
|
||||
else if(civInfo.greatPeople.freeGreatPeople>0) game.screen = GreatPersonPickerScreen()
|
||||
}
|
||||
|
||||
private fun updateTechButton() {
|
||||
|
|
Loading…
Reference in a new issue