diff --git a/android/src/com/unciv/app/AndroidLauncher.java b/android/src/com/unciv/app/AndroidLauncher.java index 7341b59a..883e2f04 100644 --- a/android/src/com/unciv/app/AndroidLauncher.java +++ b/android/src/com/unciv/app/AndroidLauncher.java @@ -4,7 +4,7 @@ import android.os.Bundle; import com.badlogic.gdx.backends.android.AndroidApplication; import com.badlogic.gdx.backends.android.AndroidApplicationConfiguration; -import com.unciv.UnCivGame; +import com.unciv.UncivGame; public class AndroidLauncher extends AndroidApplication { @Override @@ -15,6 +15,6 @@ public class AndroidLauncher extends AndroidApplication { config.useImmersiveMode=true; - initialize(new UnCivGame(version), config); + initialize(new UncivGame(version), config); } } diff --git a/core/src/com/unciv/UnCivGame.kt b/core/src/com/unciv/UncivGame.kt similarity index 97% rename from core/src/com/unciv/UnCivGame.kt rename to core/src/com/unciv/UncivGame.kt index 05a59cbf..95f572f2 100644 --- a/core/src/com/unciv/UnCivGame.kt +++ b/core/src/com/unciv/UncivGame.kt @@ -18,7 +18,7 @@ import com.unciv.ui.worldscreen.WorldScreen import java.util.* import kotlin.concurrent.thread -class UnCivGame(val version: String) : Game() { +class UncivGame(val version: String) : Game() { var gameInfo: GameInfo = GameInfo() lateinit var settings : GameSettings /** @@ -125,6 +125,6 @@ class UnCivGame(val version: String) : Game() { } companion object { - lateinit var Current: UnCivGame + lateinit var Current: UncivGame } } \ No newline at end of file diff --git a/core/src/com/unciv/logic/GameInfo.kt b/core/src/com/unciv/logic/GameInfo.kt index 56090deb..7885c48c 100644 --- a/core/src/com/unciv/logic/GameInfo.kt +++ b/core/src/com/unciv/logic/GameInfo.kt @@ -2,7 +2,7 @@ package com.unciv.logic import com.badlogic.gdx.graphics.Color import com.unciv.Constants -import com.unciv.UnCivGame +import com.unciv.UncivGame import com.unciv.logic.automation.NextTurnAutomation import com.unciv.logic.city.CityConstructions import com.unciv.logic.civilization.CivilizationInfo @@ -47,7 +47,7 @@ class GameInfo { fun getPlayerToViewAs(): CivilizationInfo { if (!gameParameters.isOnlineMultiplayer) return currentPlayerCiv // non-online, play as human player - val userId = UnCivGame.Current.settings.userId + val userId = UncivGame.Current.settings.userId if (civilizations.any { it.playerId == userId}) return civilizations.first { it.playerId == userId } else return getBarbarianCivilization()// you aren't anyone. How did you even get this game? Can you spectate? } diff --git a/core/src/com/unciv/logic/automation/ConstructionAutomation.kt b/core/src/com/unciv/logic/automation/ConstructionAutomation.kt index 86970ba5..adb9cfa6 100644 --- a/core/src/com/unciv/logic/automation/ConstructionAutomation.kt +++ b/core/src/com/unciv/logic/automation/ConstructionAutomation.kt @@ -2,7 +2,7 @@ package com.unciv.logic.automation import com.badlogic.gdx.graphics.Color import com.unciv.Constants -import com.unciv.UnCivGame +import com.unciv.UncivGame import com.unciv.logic.city.CityConstructions import com.unciv.logic.city.SpecialConstruction import com.unciv.logic.civilization.CityAction @@ -45,7 +45,7 @@ class ConstructionAutomation(val cityConstructions: CityConstructions){ } fun chooseNextConstruction() { - if (!UnCivGame.Current.settings.autoAssignCityProduction + if (!UncivGame.Current.settings.autoAssignCityProduction && civInfo.playerType== PlayerType.Human && !cityInfo.isPuppet) return if (cityConstructions.getCurrentConstruction() !is SpecialConstruction) return // don't want to be stuck on these forever diff --git a/core/src/com/unciv/logic/automation/SpecificUnitAutomation.kt b/core/src/com/unciv/logic/automation/SpecificUnitAutomation.kt index 90993073..7956bb8d 100644 --- a/core/src/com/unciv/logic/automation/SpecificUnitAutomation.kt +++ b/core/src/com/unciv/logic/automation/SpecificUnitAutomation.kt @@ -1,6 +1,6 @@ package com.unciv.logic.automation -import com.unciv.UnCivGame +import com.unciv.UncivGame import com.unciv.logic.battle.MapUnitCombatant import com.unciv.logic.civilization.CivilizationInfo import com.unciv.logic.civilization.GreatPersonManager @@ -27,7 +27,7 @@ class SpecificUnitAutomation{ if (closestReachableResource != null) { unit.movement.headTowards(closestReachableResource) if (unit.currentMovement > 0 && unit.currentTile == closestReachableResource) { - val createImprovementAction = UnitActions().getUnitActions(unit, UnCivGame.Current.worldScreen) + val createImprovementAction = UnitActions().getUnitActions(unit, UncivGame.Current.worldScreen) .firstOrNull { it.name.startsWith("Create") } // could be either fishing boats or oil well if (createImprovementAction != null) return createImprovementAction.action() // unit is already gone, can't "Explore" @@ -133,11 +133,11 @@ class SpecificUnitAutomation{ throw Exception("City within distance") if (unit.getTile() == bestCityLocation) - UnitActions().getUnitActions(unit, UnCivGame.Current.worldScreen).first { it.name == "Found city" }.action() + UnitActions().getUnitActions(unit, UncivGame.Current.worldScreen).first { it.name == "Found city" }.action() else { unit.movement.headTowards(bestCityLocation) if (unit.currentMovement > 0 && unit.getTile() == bestCityLocation) - UnitActions().getUnitActions(unit, UnCivGame.Current.worldScreen).first { it.name == "Found city" }.action() + UnitActions().getUnitActions(unit, UncivGame.Current.worldScreen).first { it.name == "Found city" }.action() } } @@ -171,7 +171,7 @@ class SpecificUnitAutomation{ unit.movement.headTowards(chosenTile) if(unit.currentTile==chosenTile && unit.currentMovement>0) - UnitActions().getUnitActions(unit, UnCivGame.Current.worldScreen) + UnitActions().getUnitActions(unit, UncivGame.Current.worldScreen) .first { it.name.startsWith("Create") }.action() return } diff --git a/core/src/com/unciv/logic/automation/UnitAutomation.kt b/core/src/com/unciv/logic/automation/UnitAutomation.kt index 0c61a56d..fb7ab9dd 100644 --- a/core/src/com/unciv/logic/automation/UnitAutomation.kt +++ b/core/src/com/unciv/logic/automation/UnitAutomation.kt @@ -2,7 +2,7 @@ package com.unciv.logic.automation import com.badlogic.gdx.graphics.Color import com.unciv.Constants -import com.unciv.UnCivGame +import com.unciv.UncivGame import com.unciv.logic.battle.* import com.unciv.logic.city.CityInfo import com.unciv.logic.civilization.GreatPersonManager @@ -45,7 +45,7 @@ class UnitAutomation{ return SpecificUnitAutomation().automateGreatPerson(unit) } - val unitActions = UnitActions().getUnitActions(unit,UnCivGame.Current.worldScreen) + val unitActions = UnitActions().getUnitActions(unit,UncivGame.Current.worldScreen) var unitDistanceToTiles = unit.movement.getDistanceToTiles() if(unit.civInfo.isBarbarian() && @@ -156,7 +156,7 @@ class UnitAutomation{ if (unit.getTile()!=tileToPillage) unit.movement.moveToTile(tileToPillage) - UnitActions().getUnitActions(unit, UnCivGame.Current.worldScreen) + UnitActions().getUnitActions(unit, UncivGame.Current.worldScreen) .first { it.name == "Pillage" }.action() return true } diff --git a/core/src/com/unciv/logic/automation/WorkerAutomation.kt b/core/src/com/unciv/logic/automation/WorkerAutomation.kt index 7b8b5ab5..08e23d43 100644 --- a/core/src/com/unciv/logic/automation/WorkerAutomation.kt +++ b/core/src/com/unciv/logic/automation/WorkerAutomation.kt @@ -2,7 +2,7 @@ package com.unciv.logic.automation import com.badlogic.gdx.graphics.Color import com.unciv.Constants -import com.unciv.UnCivGame +import com.unciv.UncivGame import com.unciv.logic.civilization.CivilizationInfo import com.unciv.logic.map.BFS import com.unciv.logic.map.MapUnit @@ -68,7 +68,7 @@ class WorkerAutomation(val unit: MapUnit) { private fun tryConnectingCities(unit: MapUnit):Boolean { // returns whether we actually did anything //Player can choose not to auto-build roads & railroads. - if (unit.civInfo.isPlayerCivilization() && !UnCivGame.Current.settings.autoBuildingRoads) + if (unit.civInfo.isPlayerCivilization() && !UncivGame.Current.settings.autoBuildingRoads) return false val targetRoad = unit.civInfo.tech.getBestRoadAvailable() diff --git a/core/src/com/unciv/logic/city/CityInfo.kt b/core/src/com/unciv/logic/city/CityInfo.kt index 84c9a81d..56c0a89d 100644 --- a/core/src/com/unciv/logic/city/CityInfo.kt +++ b/core/src/com/unciv/logic/city/CityInfo.kt @@ -3,7 +3,7 @@ package com.unciv.logic.city import com.badlogic.gdx.graphics.Color import com.badlogic.gdx.math.Vector2 import com.unciv.Constants -import com.unciv.UnCivGame +import com.unciv.UncivGame import com.unciv.logic.civilization.AlertType import com.unciv.logic.civilization.CivilizationInfo import com.unciv.logic.civilization.PopupAlert @@ -326,7 +326,7 @@ class CityInfo { isPuppet=false cityStats.update() - UnCivGame.Current.worldScreen.shouldUpdate=true + UncivGame.Current.worldScreen.shouldUpdate=true } /** This happens when we either puppet OR annex, basically whenever we conquer a city and don't liberate it */ @@ -392,7 +392,7 @@ class CityInfo { if(foundingCiv.cities.size == 1) cityConstructions.addBuilding("Palace") // Resurrection! isPuppet = false cityStats.update() - UnCivGame.Current.worldScreen.shouldUpdate=true + UncivGame.Current.worldScreen.shouldUpdate=true } private fun diplomaticRepercussionsForLiberatingCity(conqueringCiv: CivilizationInfo) { diff --git a/core/src/com/unciv/logic/city/CityStats.kt b/core/src/com/unciv/logic/city/CityStats.kt index 8a0b29c4..bcf6b5b9 100644 --- a/core/src/com/unciv/logic/city/CityStats.kt +++ b/core/src/com/unciv/logic/city/CityStats.kt @@ -1,7 +1,7 @@ package com.unciv.logic.city import com.unciv.Constants -import com.unciv.UnCivGame +import com.unciv.UncivGame import com.unciv.logic.civilization.CityStateType import com.unciv.logic.civilization.diplomacy.RelationshipLevel import com.unciv.logic.map.BFS @@ -382,7 +382,7 @@ class CityStats { newStatPercentBonusList["National ability"]=getStatPercentBonusesFromNationUnique() newStatPercentBonusList["Puppet City"]=getStatPercentBonusesFromPuppetCity() - if(UnCivGame.Current.superchargedForDebug) { + if(UncivGame.Current.superchargedForDebug) { val stats = Stats() for(stat in Stat.values()) stats.add(stat,10000f) newStatPercentBonusList["Supercharged"] = stats diff --git a/core/src/com/unciv/logic/civilization/CivilizationInfo.kt b/core/src/com/unciv/logic/civilization/CivilizationInfo.kt index 3cf9ac0a..60ccda0b 100644 --- a/core/src/com/unciv/logic/civilization/CivilizationInfo.kt +++ b/core/src/com/unciv/logic/civilization/CivilizationInfo.kt @@ -4,7 +4,7 @@ import com.badlogic.gdx.Gdx import com.badlogic.gdx.graphics.Color import com.badlogic.gdx.math.Vector2 import com.unciv.Constants -import com.unciv.UnCivGame +import com.unciv.UncivGame import com.unciv.logic.GameInfo import com.unciv.logic.automation.NextTurnAutomation import com.unciv.logic.city.CityInfo @@ -111,7 +111,7 @@ class CivilizationInfo { } fun getTranslatedNation(): Nation { - val language = UnCivGame.Current.settings.language.replace(" ","_") + val language = UncivGame.Current.settings.language.replace(" ","_") if(!Gdx.files.internal("jsons/Nations/Nations_$language.json").exists()) return nation val translatedNation = GameBasics.getFromJson(Array::class.java, "Nations/Nations_$language") .firstOrNull { it.name==civName} @@ -209,7 +209,7 @@ class CivilizationInfo { fun getDueUnits() = getCivUnits().filter { it.due && it.isIdle() } - fun shouldGoToDueUnit() = UnCivGame.Current.settings.checkForDueUnits && getDueUnits().isNotEmpty() + fun shouldGoToDueUnit() = UncivGame.Current.settings.checkForDueUnits && getDueUnits().isNotEmpty() fun getNextDueUnit(): MapUnit? { val dueUnits = getDueUnits() diff --git a/core/src/com/unciv/logic/civilization/TechManager.kt b/core/src/com/unciv/logic/civilization/TechManager.kt index ac1faf88..d930f5f8 100644 --- a/core/src/com/unciv/logic/civilization/TechManager.kt +++ b/core/src/com/unciv/logic/civilization/TechManager.kt @@ -3,7 +3,7 @@ package com.unciv.logic.civilization import com.badlogic.gdx.graphics.Color import com.unciv.Constants -import com.unciv.UnCivGame +import com.unciv.UncivGame import com.unciv.logic.map.RoadStatus import com.unciv.models.gamebasics.GameBasics import com.unciv.models.gamebasics.tech.Technology @@ -47,7 +47,7 @@ class TechManager { techCost *= civInfo.getDifficulty().researchCostModifier techCost *= civInfo.gameInfo.gameParameters.gameSpeed.getModifier() val techsResearchedKnownCivs = civInfo.getKnownCivs().count { it.isMajorCiv() && it.tech.isResearched(techName) } - val undefeatedCivs = UnCivGame.Current.gameInfo.civilizations.count { it.isMajorCiv() && !it.isDefeated() } + val undefeatedCivs = UncivGame.Current.gameInfo.civilizations.count { it.isMajorCiv() && !it.isDefeated() } // https://forums.civfanatics.com/threads/the-mechanics-of-overflow-inflation.517970/ techCost /= 1 + techsResearchedKnownCivs / undefeatedCivs.toFloat() * 0.3f // http://www.civclub.net/bbs/forum.php?mod=viewthread&tid=123976 diff --git a/core/src/com/unciv/logic/map/TileInfo.kt b/core/src/com/unciv/logic/map/TileInfo.kt index 72ab92ad..f483ce44 100644 --- a/core/src/com/unciv/logic/map/TileInfo.kt +++ b/core/src/com/unciv/logic/map/TileInfo.kt @@ -2,7 +2,7 @@ package com.unciv.logic.map import com.badlogic.gdx.math.Vector2 import com.unciv.Constants -import com.unciv.UnCivGame +import com.unciv.UncivGame import com.unciv.logic.city.CityInfo import com.unciv.logic.civilization.CivilizationInfo import com.unciv.models.gamebasics.GameBasics @@ -270,15 +270,15 @@ open class TileInfo { override fun toString(): String { val lineList = ArrayList() // more readable than StringBuilder, with same performance for our use-case - val isViewableToPlayer = UnCivGame.Current.viewEntireMapForDebug - || UnCivGame.Current.gameInfo.getCurrentPlayerCivilization().viewableTiles.contains(this) + val isViewableToPlayer = UncivGame.Current.viewEntireMapForDebug + || UncivGame.Current.gameInfo.getCurrentPlayerCivilization().viewableTiles.contains(this) if (isCityCenter()) { val city = getCity()!! var cityString = city.name if(isViewableToPlayer) cityString += " ("+city.health+")" lineList += cityString - if(UnCivGame.Current.viewEntireMapForDebug || city.civInfo.isCurrentPlayer()) + if(UncivGame.Current.viewEntireMapForDebug || city.civInfo.isCurrentPlayer()) lineList += city.cityConstructions.getProductionForTileInfo() } lineList += baseTerrain.tr() diff --git a/core/src/com/unciv/models/gamebasics/Translations.kt b/core/src/com/unciv/models/gamebasics/Translations.kt index b6a0b524..a229b824 100644 --- a/core/src/com/unciv/models/gamebasics/Translations.kt +++ b/core/src/com/unciv/models/gamebasics/Translations.kt @@ -1,7 +1,7 @@ package com.unciv.models.gamebasics import com.badlogic.gdx.utils.JsonReader -import com.unciv.UnCivGame +import com.unciv.UncivGame import java.util.* class TranslationEntry(val entry:String) : HashMap(){ @@ -58,7 +58,7 @@ class Translations : HashMap(){ if(regexResult==null) return unique.tr() else{ var separatorCharacter = " " - if (UnCivGame.Current.settings.language=="Simplified_Chinese")separatorCharacter = "" + if (UncivGame.Current.settings.language=="Simplified_Chinese")separatorCharacter = "" val start = regexResult.groups[1]!!.value+" vs ["+regexResult.groups[2]!!.value+"]" val translatedUnique = start.tr() + separatorCharacter + regexResult.groups[3]!!.value+"%" return translatedUnique @@ -94,7 +94,7 @@ fun String.tr(): String { .firstOrNull { translationStringWithSquareBracketsOnly == it.entryWithShortenedSquareBrackets } if(translationEntry==null || - !translationEntry.containsKey(UnCivGame.Current.settings.language)){ + !translationEntry.containsKey(UncivGame.Current.settings.language)){ // Translation placeholder doesn't exist for this language, default to English return this.replace(eitherSquareBraceRegex,"") } @@ -104,7 +104,7 @@ fun String.tr(): String { if(termsInMessage.size!=termsInTranslationPlaceholder.size) throw Exception("Message $this has a different number of terms than the placeholder $translationEntry!") - var languageSpecificPlaceholder = translationEntry[UnCivGame.Current.settings.language]!! + var languageSpecificPlaceholder = translationEntry[UncivGame.Current.settings.language]!! for(i in termsInMessage.indices){ languageSpecificPlaceholder = languageSpecificPlaceholder.replace(termsInTranslationPlaceholder[i], termsInMessage[i].tr()) } @@ -115,6 +115,6 @@ fun String.tr(): String { return Regex("\\{(.*?)\\}").replace(this) { it.groups[1]!!.value.tr() } } - val translation = GameBasics.Translations.get(this, UnCivGame.Current.settings.language) // single word + val translation = GameBasics.Translations.get(this, UncivGame.Current.settings.language) // single word return translation } diff --git a/core/src/com/unciv/models/gamebasics/tech/Technology.kt b/core/src/com/unciv/models/gamebasics/tech/Technology.kt index 62e96b22..6ed0b693 100644 --- a/core/src/com/unciv/models/gamebasics/tech/Technology.kt +++ b/core/src/com/unciv/models/gamebasics/tech/Technology.kt @@ -1,6 +1,6 @@ package com.unciv.models.gamebasics.tech -import com.unciv.UnCivGame +import com.unciv.UncivGame import com.unciv.logic.civilization.CivilizationInfo import com.unciv.models.gamebasics.Building import com.unciv.models.gamebasics.GameBasics @@ -32,7 +32,7 @@ class Technology { lineList += impimpString.tr() } - val viewingCiv = UnCivGame.Current.worldScreen.viewingCiv + val viewingCiv = UncivGame.Current.worldScreen.viewingCiv val enabledUnits = getEnabledUnits(viewingCiv) if (enabledUnits.isNotEmpty()) { lineList += "{Units enabled}: " @@ -74,7 +74,7 @@ class Technology { val replacedBuildings = enabledBuildings.mapNotNull { it.replaces } enabledBuildings = enabledBuildings.filter { it.name !in replacedBuildings } - if (!UnCivGame.Current.settings.nuclearWeaponEnabled) + if (!UncivGame.Current.settings.nuclearWeaponEnabled) enabledBuildings=enabledBuildings.filterNot { it.name=="Manhattan Project" } return enabledBuildings @@ -88,7 +88,7 @@ class Technology { val replacedUnits = enabledUnits.mapNotNull { it.replaces } enabledUnits = enabledUnits.filter { it.name !in replacedUnits } - if (!UnCivGame.Current.settings.nuclearWeaponEnabled) + if (!UncivGame.Current.settings.nuclearWeaponEnabled) enabledUnits=enabledUnits.filterNot { it.uniques.contains("Requires Manhattan Project") } diff --git a/core/src/com/unciv/models/gamebasics/unit/BaseUnit.kt b/core/src/com/unciv/models/gamebasics/unit/BaseUnit.kt index 0dec49ae..f9e584fe 100644 --- a/core/src/com/unciv/models/gamebasics/unit/BaseUnit.kt +++ b/core/src/com/unciv/models/gamebasics/unit/BaseUnit.kt @@ -1,7 +1,7 @@ package com.unciv.models.gamebasics.unit import com.unciv.Constants -import com.unciv.UnCivGame +import com.unciv.UncivGame import com.unciv.logic.city.CityConstructions import com.unciv.logic.city.IConstruction import com.unciv.logic.civilization.CivilizationInfo @@ -132,7 +132,7 @@ class BaseUnit : INamed, IConstruction { if (obsoleteTech!=null && civInfo.tech.isResearched(obsoleteTech!!)) return "Obsolete by $obsoleteTech" if (uniqueTo!=null && uniqueTo!=civInfo.civName) return "Unique to $uniqueTo" if (GameBasics.Units.values.any { it.uniqueTo==civInfo.civName && it.replaces==name }) return "Our unique unit replaces this" - if (!UnCivGame.Current.settings.nuclearWeaponEnabled + if (!UncivGame.Current.settings.nuclearWeaponEnabled && (name == "Manhattan Project" || uniques.contains("Requires Manhattan Project"))) return "Disabled by setting" if (uniques.contains("Requires Manhattan Project") && !civInfo.containsBuildingUnique("Enables nuclear weapon")) return "Requires Manhattan Project" diff --git a/core/src/com/unciv/ui/CivilopediaScreen.kt b/core/src/com/unciv/ui/CivilopediaScreen.kt index 714556f2..5aae1da6 100644 --- a/core/src/com/unciv/ui/CivilopediaScreen.kt +++ b/core/src/com/unciv/ui/CivilopediaScreen.kt @@ -3,7 +3,7 @@ package com.unciv.ui import com.badlogic.gdx.Gdx import com.badlogic.gdx.scenes.scene2d.Actor import com.badlogic.gdx.scenes.scene2d.ui.* -import com.unciv.UnCivGame +import com.unciv.UncivGame import com.unciv.models.gamebasics.GameBasics import com.unciv.models.gamebasics.tr import com.unciv.ui.utils.* @@ -46,7 +46,7 @@ class CivilopediaScreen : CameraStageBaseScreen() { } init { - onBackButtonClicked { UnCivGame.Current.setWorldScreen() } + onBackButtonClicked { UncivGame.Current.setWorldScreen() } val buttonTable = Table() buttonTable.pad(15f) val entryTable = Table() @@ -67,7 +67,7 @@ class CivilopediaScreen : CameraStageBaseScreen() { - val language = UnCivGame.Current.settings.language.replace(" ","_") + val language = UncivGame.Current.settings.language.replace(" ","_") val basicHelpFileName = if(Gdx.files.internal("jsons/BasicHelp/BasicHelp_$language.json").exists())"BasicHelp/BasicHelp_$language" else "BasicHelp/BasicHelp" @@ -94,7 +94,7 @@ class CivilopediaScreen : CameraStageBaseScreen() { categoryToEntries["Tutorials"] = Tutorials().getTutorialsOfLanguage("English").keys .filter { !it.startsWith("_") } .map { CivilopediaEntry(it.replace("_"," "), - Tutorials().getTutorials(it, UnCivGame.Current.settings.language) + Tutorials().getTutorials(it, UncivGame.Current.settings.language) .joinToString("\n\n")) } for (category in categoryToEntries.keys) { diff --git a/core/src/com/unciv/ui/EmpireOverviewScreen.kt b/core/src/com/unciv/ui/EmpireOverviewScreen.kt index 9f51da38..819ca3e1 100644 --- a/core/src/com/unciv/ui/EmpireOverviewScreen.kt +++ b/core/src/com/unciv/ui/EmpireOverviewScreen.kt @@ -5,7 +5,7 @@ import com.badlogic.gdx.scenes.scene2d.Actor import com.badlogic.gdx.scenes.scene2d.Group import com.badlogic.gdx.scenes.scene2d.ui.* import com.badlogic.gdx.utils.Align -import com.unciv.UnCivGame +import com.unciv.UncivGame import com.unciv.logic.HexMath import com.unciv.logic.civilization.CivilizationInfo import com.unciv.logic.civilization.diplomacy.DiplomaticStatus @@ -19,15 +19,15 @@ import kotlin.math.roundToInt class EmpireOverviewScreen : CameraStageBaseScreen(){ - val currentPlayerCivInfo = UnCivGame.Current.gameInfo.getCurrentPlayerCivilization() + val currentPlayerCivInfo = UncivGame.Current.gameInfo.getCurrentPlayerCivilization() init { - onBackButtonClicked { UnCivGame.Current.setWorldScreen() } + onBackButtonClicked { UncivGame.Current.setWorldScreen() } val topTable = Table().apply { defaults().pad(10f) } val centerTable=Table().apply { defaults().pad(20f) } val closeButton = TextButton("Close".tr(), skin) - closeButton.onClick { UnCivGame.Current.setWorldScreen() } + closeButton.onClick { UncivGame.Current.setWorldScreen() } closeButton.y = stage.height - closeButton.height - 5 topTable.add(closeButton) @@ -245,8 +245,8 @@ class EmpireOverviewScreen : CameraStageBaseScreen(){ for (city in currentPlayerCivInfo.cities.sortedBy { it.name }) { val button = Button(Label(city.name, skin), skin) button.onClick { - UnCivGame.Current.setWorldScreen() - UnCivGame.Current.worldScreen.tileMapHolder.setCenterPosition(city.ccenterTile.position) + UncivGame.Current.setWorldScreen() + UncivGame.Current.worldScreen.tileMapHolder.setCenterPosition(city.ccenterTile.position) } cityInfoTableDetails.add(button) cityInfoTableDetails.add(city.cityConstructions.getCityProductionTextForCityButton()).actor!!.setAlignment(Align.left) @@ -308,8 +308,8 @@ class EmpireOverviewScreen : CameraStageBaseScreen(){ val baseUnit = unit.baseUnit() val button = TextButton(unit.name.tr(), skin) button.onClick { - UnCivGame.Current.setWorldScreen() - UnCivGame.Current.worldScreen.tileMapHolder.setCenterPosition(unit.currentTile.position) + UncivGame.Current.setWorldScreen() + UncivGame.Current.worldScreen.tileMapHolder.setCenterPosition(unit.currentTile.position) } table.add(button).left() val mapUnitAction = unit.mapUnitAction @@ -414,7 +414,7 @@ class EmpireOverviewScreen : CameraStageBaseScreen(){ civGroup.add(ImageGetter.getImage("OtherIcons/DisbandUnit")).size(30f) backgroundColor = Color.LIGHT_GRAY labelColor = Color.BLACK - } else if (currentPlayer==civ || UnCivGame.Current.viewEntireMapForDebug || currentPlayer.knows(civ)) { + } else if (currentPlayer==civ || UncivGame.Current.viewEntireMapForDebug || currentPlayer.knows(civ)) { civGroup.add(ImageGetter.getNationIndicator(civ.nation, 30f)) backgroundColor = civ.nation.getOuterColor() labelColor = civ.nation.getInnerColor() diff --git a/core/src/com/unciv/ui/LanguagePickerScreen.kt b/core/src/com/unciv/ui/LanguagePickerScreen.kt index 87d2bc36..e05762a9 100644 --- a/core/src/com/unciv/ui/LanguagePickerScreen.kt +++ b/core/src/com/unciv/ui/LanguagePickerScreen.kt @@ -5,7 +5,7 @@ import com.badlogic.gdx.scenes.scene2d.Touchable import com.badlogic.gdx.scenes.scene2d.ui.Label import com.badlogic.gdx.scenes.scene2d.ui.Skin import com.badlogic.gdx.scenes.scene2d.ui.Table -import com.unciv.UnCivGame +import com.unciv.UncivGame import com.unciv.models.gamebasics.GameBasics import com.unciv.models.gamebasics.tr import com.unciv.ui.pickerscreens.PickerScreen @@ -81,10 +81,10 @@ class LanguagePickerScreen: PickerScreen(){ } fun pickLanguage(){ - UnCivGame.Current.settings.language = chosenLanguage - UnCivGame.Current.settings.save() + UncivGame.Current.settings.language = chosenLanguage + UncivGame.Current.settings.save() resetFonts() - UnCivGame.Current.startNewGame() + UncivGame.Current.startNewGame() dispose() } } \ No newline at end of file diff --git a/core/src/com/unciv/ui/VictoryScreen.kt b/core/src/com/unciv/ui/VictoryScreen.kt index 7908e556..b93571eb 100644 --- a/core/src/com/unciv/ui/VictoryScreen.kt +++ b/core/src/com/unciv/ui/VictoryScreen.kt @@ -4,7 +4,7 @@ import com.badlogic.gdx.graphics.Color import com.badlogic.gdx.scenes.scene2d.Touchable import com.badlogic.gdx.scenes.scene2d.ui.Table import com.badlogic.gdx.scenes.scene2d.ui.TextButton -import com.unciv.UnCivGame +import com.unciv.UncivGame import com.unciv.logic.civilization.CivilizationInfo import com.unciv.models.gamebasics.GameBasics import com.unciv.models.gamebasics.VictoryType @@ -20,7 +20,7 @@ import com.unciv.ui.utils.toLabel class VictoryScreen : PickerScreen() { - val playerCivInfo = UnCivGame.Current.gameInfo.getCurrentPlayerCivilization() + val playerCivInfo = UncivGame.Current.gameInfo.getCurrentPlayerCivilization() val victoryTypes = playerCivInfo.gameInfo.gameParameters.victoryTypes val scientificVictoryEnabled = victoryTypes.contains(VictoryType.Scientific) val culturalVictoryEnabled = victoryTypes.contains(VictoryType.Cultural) @@ -88,13 +88,13 @@ class VictoryScreen : PickerScreen() { rightSideButton.isVisible = true rightSideButton.enable() rightSideButton.onClick { - UnCivGame.Current.setScreen(NewGameScreen()) + UncivGame.Current.setScreen(NewGameScreen()) } closeButton.setText("One more turn...!".tr()) closeButton.onClick { playerCivInfo.gameInfo.oneMoreTurnMode = true - UnCivGame.Current.setWorldScreen() + UncivGame.Current.setWorldScreen() } } @@ -206,7 +206,7 @@ class VictoryScreen : PickerScreen() { policyVictoryColumn.add(civToBranchesHaveCompleted).row() civToBranchesHaveCompleted.touchable= Touchable.enabled civToBranchesHaveCompleted.onClick { - game.setScreen(PolicyPickerScreen(UnCivGame.Current.worldScreen,entry.civ, false)) + game.setScreen(PolicyPickerScreen(UncivGame.Current.worldScreen,entry.civ, false)) dispose() } } diff --git a/core/src/com/unciv/ui/cityscreen/CityInfoTable.kt b/core/src/com/unciv/ui/cityscreen/CityInfoTable.kt index ac270094..dc6b0092 100644 --- a/core/src/com/unciv/ui/cityscreen/CityInfoTable.kt +++ b/core/src/com/unciv/ui/cityscreen/CityInfoTable.kt @@ -7,7 +7,7 @@ import com.badlogic.gdx.scenes.scene2d.ui.Skin import com.badlogic.gdx.scenes.scene2d.ui.Table import com.badlogic.gdx.scenes.scene2d.ui.TextButton import com.badlogic.gdx.utils.Align -import com.unciv.UnCivGame +import com.unciv.UncivGame import com.unciv.logic.city.CityInfo import com.unciv.logic.civilization.GreatPersonManager import com.unciv.models.gamebasics.Building @@ -84,7 +84,7 @@ class CityInfoTable(private val cityScreen: CityScreen) : Table(CameraStageBaseS }, cityScreen) } if(cityScreen.city.hasSoldBuildingThisTurn || sellAmount > cityScreen.city.civInfo.gold - || !UnCivGame.Current.worldScreen.isPlayersTurn) + || !UncivGame.Current.worldScreen.isPlayersTurn) sellBuildingButton.disable() } wonderDetailsTable.addSeparator() @@ -235,7 +235,7 @@ class CityInfoTable(private val cityScreen: CityScreen) : Table(CameraStageBaseS cityInfo.cityStats.update() cityScreen.update() } - if(!UnCivGame.Current.worldScreen.isPlayersTurn) unassignButton.disable() + if(!UncivGame.Current.worldScreen.isPlayersTurn) unassignButton.disable() specialistPickerTable.add(unassignButton) } else specialistPickerTable.add() @@ -253,7 +253,7 @@ class CityInfoTable(private val cityScreen: CityScreen) : Table(CameraStageBaseS cityInfo.cityStats.update() cityScreen.update() } - if (cityInfo.population.getFreePopulation() == 0 || !UnCivGame.Current.worldScreen.isPlayersTurn) + if (cityInfo.population.getFreePopulation() == 0 || !UncivGame.Current.worldScreen.isPlayersTurn) assignButton.disable() specialistPickerTable.add(assignButton) } else specialistPickerTable.add() diff --git a/core/src/com/unciv/ui/cityscreen/CityScreen.kt b/core/src/com/unciv/ui/cityscreen/CityScreen.kt index 799d5358..0c343306 100644 --- a/core/src/com/unciv/ui/cityscreen/CityScreen.kt +++ b/core/src/com/unciv/ui/cityscreen/CityScreen.kt @@ -7,7 +7,7 @@ import com.badlogic.gdx.scenes.scene2d.ui.Table import com.badlogic.gdx.scenes.scene2d.ui.TextButton import com.badlogic.gdx.utils.Align import com.unciv.Constants -import com.unciv.UnCivGame +import com.unciv.UncivGame import com.unciv.logic.HexMath import com.unciv.logic.city.CityInfo import com.unciv.logic.map.TileInfo @@ -182,14 +182,14 @@ class CityScreen(internal val city: CityInfo) : CameraStageBaseScreen() { val razeCityButton = TextButton("Raze city".tr(), skin) razeCityButton.labelCell.pad(10f) razeCityButton.onClick { city.isBeingRazed=true; update() } - if(!UnCivGame.Current.worldScreen.isPlayersTurn) razeCityButton.disable() + if(!UncivGame.Current.worldScreen.isPlayersTurn) razeCityButton.disable() razeCityButtonHolder.add(razeCityButton).colspan(cityPickerTable.columns) } else { val stopRazingCityButton = TextButton("Stop razing city".tr(), skin) stopRazingCityButton.labelCell.pad(10f) stopRazingCityButton.onClick { city.isBeingRazed=false; update() } - if(!UnCivGame.Current.worldScreen.isPlayersTurn) stopRazingCityButton.disable() + if(!UncivGame.Current.worldScreen.isPlayersTurn) stopRazingCityButton.disable() razeCityButtonHolder.add(stopRazingCityButton).colspan(cityPickerTable.columns) } razeCityButtonHolder.pack() @@ -213,7 +213,7 @@ class CityScreen(internal val city: CityInfo) : CameraStageBaseScreen() { tileGroup.onClick { if (!city.isPuppet) { selectedTile = tileInfo - if (tileGroup.isWorkable && UnCivGame.Current.worldScreen.isPlayersTurn) { + if (tileGroup.isWorkable && UncivGame.Current.worldScreen.isPlayersTurn) { if (!tileInfo.isWorked() && city.population.getFreePopulation() > 0) city.workedTiles.add(tileInfo.position) else if (tileInfo.isWorked()) city.workedTiles.remove(tileInfo.position) diff --git a/core/src/com/unciv/ui/cityscreen/CityScreenTileTable.kt b/core/src/com/unciv/ui/cityscreen/CityScreenTileTable.kt index 7e42f03c..7152f23e 100644 --- a/core/src/com/unciv/ui/cityscreen/CityScreenTileTable.kt +++ b/core/src/com/unciv/ui/cityscreen/CityScreenTileTable.kt @@ -4,7 +4,7 @@ import com.badlogic.gdx.graphics.Color import com.badlogic.gdx.scenes.scene2d.ui.Label import com.badlogic.gdx.scenes.scene2d.ui.Table import com.badlogic.gdx.scenes.scene2d.ui.TextButton -import com.unciv.UnCivGame +import com.unciv.UncivGame import com.unciv.logic.city.CityInfo import com.unciv.logic.map.TileInfo import com.unciv.models.gamebasics.tr @@ -51,9 +51,9 @@ class CityScreenTileTable(val city: CityInfo): Table(){ val buyTileButton = TextButton("Buy for [$goldCostOfTile] gold".tr(), CameraStageBaseScreen.skin) buyTileButton.onClick("coin") { city.expansion.buyTile(selectedTile) - UnCivGame.Current.setScreen(CityScreen(city)) + UncivGame.Current.setScreen(CityScreen(city)) } - if(goldCostOfTile>city.civInfo.gold || city.isPuppet || !UnCivGame.Current.worldScreen.isPlayersTurn) + if(goldCostOfTile>city.civInfo.gold || city.isPuppet || !UncivGame.Current.worldScreen.isPlayersTurn) buyTileButton.disable() innerTable.add(buyTileButton) @@ -62,7 +62,7 @@ class CityScreenTileTable(val city: CityInfo): Table(){ val acquireTileButton = TextButton("Acquire".tr(), CameraStageBaseScreen.skin) acquireTileButton.onClick { city.expansion.takeOwnership(selectedTile) - UnCivGame.Current.setScreen(CityScreen(city)) + UncivGame.Current.setScreen(CityScreen(city)) } innerTable.add(acquireTileButton) } diff --git a/core/src/com/unciv/ui/cityscreen/ConstructionsTable.kt b/core/src/com/unciv/ui/cityscreen/ConstructionsTable.kt index 86bc45fb..1a119a67 100644 --- a/core/src/com/unciv/ui/cityscreen/ConstructionsTable.kt +++ b/core/src/com/unciv/ui/cityscreen/ConstructionsTable.kt @@ -6,7 +6,7 @@ import com.badlogic.gdx.scenes.scene2d.ui.ScrollPane import com.badlogic.gdx.scenes.scene2d.ui.Table import com.badlogic.gdx.scenes.scene2d.ui.TextButton import com.badlogic.gdx.utils.Align -import com.unciv.UnCivGame +import com.unciv.UncivGame import com.unciv.logic.city.CityInfo import com.unciv.logic.city.SpecialConstruction import com.unciv.models.gamebasics.Building @@ -48,7 +48,7 @@ class ConstructionsTable(val cityScreen: CityScreen) : Table(CameraStageBaseScre pickProductionButton.add(ImageGetter.getConstructionImage(construction).surroundWithCircle(40f)).padRight(10f) pickProductionButton.add(buttonText.toLabel()) - if(rejectionReason=="" && UnCivGame.Current.worldScreen.isPlayersTurn) { // no rejection reason means we can build it! + if(rejectionReason=="" && UncivGame.Current.worldScreen.isPlayersTurn) { // no rejection reason means we can build it! pickProductionButton.onClick { if (!cityScreen.city.isPuppet) { lastConstruction = cityScreen.city.cityConstructions.currentConstruction diff --git a/core/src/com/unciv/ui/mapeditor/MapEditorOptionsTable.kt b/core/src/com/unciv/ui/mapeditor/MapEditorOptionsTable.kt index f6dbe291..a5ec98da 100644 --- a/core/src/com/unciv/ui/mapeditor/MapEditorOptionsTable.kt +++ b/core/src/com/unciv/ui/mapeditor/MapEditorOptionsTable.kt @@ -7,7 +7,7 @@ import com.badlogic.gdx.scenes.scene2d.ui.TextButton import com.badlogic.gdx.scenes.scene2d.ui.TextField import com.badlogic.gdx.utils.Json import com.unciv.Constants -import com.unciv.UnCivGame +import com.unciv.UncivGame import com.unciv.logic.MapSaver import com.unciv.logic.map.RoadStatus import com.unciv.models.gamebasics.tr @@ -45,7 +45,7 @@ class MapEditorOptionsTable(mapEditorScreen: MapEditorScreen): PopupTable(mapEdi val saveMapButton = TextButton("Save map".tr(), skin) saveMapButton.onClick { MapSaver().saveMap(mapEditorScreen.mapName,mapEditorScreen.tileMap) - UnCivGame.Current.setWorldScreen() + UncivGame.Current.setWorldScreen() } add(saveMapButton).row() @@ -59,7 +59,7 @@ class MapEditorOptionsTable(mapEditorScreen: MapEditorScreen): PopupTable(mapEdi val loadMapButton = TextButton("Load map".tr(), skin) loadMapButton.onClick { - UnCivGame.Current.setScreen(LoadMapScreen(mapEditorScreen.tileMap)) + UncivGame.Current.setScreen(LoadMapScreen(mapEditorScreen.tileMap)) } add(loadMapButton).row() @@ -93,7 +93,7 @@ class MapEditorOptionsTable(mapEditorScreen: MapEditorScreen): PopupTable(mapEdi add(downloadMapButton).row() val exitMapEditorButton = TextButton("Exit map editor".tr(), skin) - exitMapEditorButton.onClick { UnCivGame.Current.setWorldScreen(); mapEditorScreen.dispose() } + exitMapEditorButton.onClick { UncivGame.Current.setWorldScreen(); mapEditorScreen.dispose() } add(exitMapEditorButton ).row() val closeOptionsButton = TextButton("Close".tr(), skin) @@ -118,7 +118,7 @@ class MapDownloadTable(mapEditorScreen: MapEditorScreen):PopupTable(mapEditorScr val decodedMapJson = Gzip.unzip(mapJsonGzipped) val mapObject = MapSaver().mapFromJson(decodedMapJson) MapSaver().saveMap(downloadableMap.name, mapObject) - UnCivGame.Current.setScreen(MapEditorScreen(mapObject)) + UncivGame.Current.setScreen(MapEditorScreen(mapObject)) } catch(ex:Exception){ val couldNotDownloadMapPopup = PopupTable(screen) diff --git a/core/src/com/unciv/ui/mapeditor/TileEditorOptionsTable.kt b/core/src/com/unciv/ui/mapeditor/TileEditorOptionsTable.kt index 1eab44f6..3196ab7f 100644 --- a/core/src/com/unciv/ui/mapeditor/TileEditorOptionsTable.kt +++ b/core/src/com/unciv/ui/mapeditor/TileEditorOptionsTable.kt @@ -7,7 +7,7 @@ import com.badlogic.gdx.scenes.scene2d.ui.ScrollPane import com.badlogic.gdx.scenes.scene2d.ui.Table import com.badlogic.gdx.scenes.scene2d.ui.TextButton import com.unciv.Constants -import com.unciv.UnCivGame +import com.unciv.UncivGame import com.unciv.logic.map.RoadStatus import com.unciv.logic.map.TileInfo import com.unciv.models.gamebasics.GameBasics @@ -21,7 +21,7 @@ import com.unciv.ui.tilegroups.TileSetStrings import com.unciv.ui.utils.* class TileEditorOptionsTable(val mapEditorScreen: MapEditorScreen): Table(CameraStageBaseScreen.skin){ - val tileSetLocation = "TileSets/"+ UnCivGame.Current.settings.tileSet +"/" + val tileSetLocation = "TileSets/"+ UncivGame.Current.settings.tileSet +"/" var clearTerrainFeature=false var selectedTerrain : Terrain?=null diff --git a/core/src/com/unciv/ui/newgamescreen/NewGameScreen.kt b/core/src/com/unciv/ui/newgamescreen/NewGameScreen.kt index bbda2490..f8c6ffcb 100644 --- a/core/src/com/unciv/ui/newgamescreen/NewGameScreen.kt +++ b/core/src/com/unciv/ui/newgamescreen/NewGameScreen.kt @@ -4,7 +4,7 @@ import com.badlogic.gdx.Gdx import com.badlogic.gdx.scenes.scene2d.ui.SelectBox import com.badlogic.gdx.scenes.scene2d.ui.Skin import com.badlogic.gdx.utils.Array -import com.unciv.UnCivGame +import com.unciv.UncivGame import com.unciv.logic.GameInfo import com.unciv.logic.GameSaver import com.unciv.logic.GameStarter @@ -22,7 +22,7 @@ import kotlin.concurrent.thread class NewGameScreen: PickerScreen(){ - val newGameParameters= UnCivGame.Current.gameInfo.gameParameters + val newGameParameters= UncivGame.Current.gameInfo.gameParameters init { setDefaultCloseAction() diff --git a/core/src/com/unciv/ui/newgamescreen/PlayerPickerTable.kt b/core/src/com/unciv/ui/newgamescreen/PlayerPickerTable.kt index ef38da45..20670abc 100644 --- a/core/src/com/unciv/ui/newgamescreen/PlayerPickerTable.kt +++ b/core/src/com/unciv/ui/newgamescreen/PlayerPickerTable.kt @@ -8,7 +8,7 @@ import com.badlogic.gdx.scenes.scene2d.ui.Table import com.badlogic.gdx.scenes.scene2d.ui.TextButton import com.badlogic.gdx.scenes.scene2d.ui.TextField import com.badlogic.gdx.utils.Align -import com.unciv.UnCivGame +import com.unciv.UncivGame import com.unciv.logic.civilization.PlayerType import com.unciv.models.gamebasics.GameBasics import com.unciv.models.gamebasics.tr @@ -80,7 +80,7 @@ class PlayerPickerTable(val newGameScreen: NewGameScreen, val newGameParameters: playerIdTable.row() - val currentUserId = UnCivGame.Current.settings.userId + val currentUserId = UncivGame.Current.settings.userId val setCurrentUserButton = TextButton("Set current user".tr(), CameraStageBaseScreen.skin) setCurrentUserButton.onClick { playerIdTextfield.text = currentUserId diff --git a/core/src/com/unciv/ui/pickerscreens/GreatPersonPickerScreen.kt b/core/src/com/unciv/ui/pickerscreens/GreatPersonPickerScreen.kt index 92579dda..889e87d3 100644 --- a/core/src/com/unciv/ui/pickerscreens/GreatPersonPickerScreen.kt +++ b/core/src/com/unciv/ui/pickerscreens/GreatPersonPickerScreen.kt @@ -1,7 +1,7 @@ package com.unciv.ui.pickerscreens import com.badlogic.gdx.scenes.scene2d.ui.Button -import com.unciv.UnCivGame +import com.unciv.UncivGame import com.unciv.logic.civilization.GreatPersonManager import com.unciv.models.gamebasics.GameBasics import com.unciv.models.gamebasics.tr @@ -35,10 +35,10 @@ class GreatPersonPickerScreen : PickerScreen() { } rightSideButton.onClick("choir") { - val currentPlayerCiv = UnCivGame.Current.gameInfo.getCurrentPlayerCivilization() + val currentPlayerCiv = UncivGame.Current.gameInfo.getCurrentPlayerCivilization() currentPlayerCiv.placeUnitNearTile(currentPlayerCiv.cities[0].location, theChosenOne!!.name) currentPlayerCiv.greatPeople.freeGreatPeople-- - UnCivGame.Current.setWorldScreen() + UncivGame.Current.setWorldScreen() } } diff --git a/core/src/com/unciv/ui/pickerscreens/PickerScreen.kt b/core/src/com/unciv/ui/pickerscreens/PickerScreen.kt index 84015ba7..325bda55 100644 --- a/core/src/com/unciv/ui/pickerscreens/PickerScreen.kt +++ b/core/src/com/unciv/ui/pickerscreens/PickerScreen.kt @@ -1,7 +1,7 @@ package com.unciv.ui.pickerscreens import com.badlogic.gdx.scenes.scene2d.ui.* -import com.unciv.UnCivGame +import com.unciv.UncivGame import com.unciv.models.gamebasics.tr import com.unciv.ui.utils.* @@ -51,7 +51,7 @@ open class PickerScreen : CameraStageBaseScreen() { } protected fun pick(rightButtonText: String) { - if(UnCivGame.Current.worldScreen.isPlayersTurn) rightSideButton.enable() + if(UncivGame.Current.worldScreen.isPlayersTurn) rightSideButton.enable() rightSideButton.setText(rightButtonText) } } \ No newline at end of file diff --git a/core/src/com/unciv/ui/pickerscreens/PolicyPickerScreen.kt b/core/src/com/unciv/ui/pickerscreens/PolicyPickerScreen.kt index c5b11bc6..811c0ec5 100644 --- a/core/src/com/unciv/ui/pickerscreens/PolicyPickerScreen.kt +++ b/core/src/com/unciv/ui/pickerscreens/PolicyPickerScreen.kt @@ -4,7 +4,7 @@ import com.badlogic.gdx.graphics.Color import com.badlogic.gdx.scenes.scene2d.ui.Button import com.badlogic.gdx.scenes.scene2d.ui.Table import com.badlogic.gdx.scenes.scene2d.ui.TextButton -import com.unciv.UnCivGame +import com.unciv.UncivGame import com.unciv.logic.civilization.CivilizationInfo import com.unciv.models.gamebasics.GameBasics import com.unciv.models.gamebasics.Policy @@ -28,7 +28,7 @@ class PolicyPickerScreen(val worldScreen: WorldScreen, civInfo: CivilizationInfo rightSideButton.setText("Adopt free policy".tr()) closeButton.disable() } - else onBackButtonClicked { UnCivGame.Current.setWorldScreen() } + else onBackButtonClicked { UncivGame.Current.setWorldScreen() } rightSideButton.onClick("policy") { viewingCiv.policies.adopt(pickedPolicy!!) @@ -40,7 +40,7 @@ class PolicyPickerScreen(val worldScreen: WorldScreen, civInfo: CivilizationInfo } else game.setScreen(PolicyPickerScreen(worldScreen)) // update policies } - if(!UnCivGame.Current.worldScreen.isPlayersTurn) + if(!UncivGame.Current.worldScreen.isPlayersTurn) rightSideButton.disable() if (!switchfromWorldScreen){ rightSideButton.apply { diff --git a/core/src/com/unciv/ui/pickerscreens/PromotionPickerScreen.kt b/core/src/com/unciv/ui/pickerscreens/PromotionPickerScreen.kt index f31c2251..c49d1173 100644 --- a/core/src/com/unciv/ui/pickerscreens/PromotionPickerScreen.kt +++ b/core/src/com/unciv/ui/pickerscreens/PromotionPickerScreen.kt @@ -6,7 +6,7 @@ import com.badlogic.gdx.scenes.scene2d.ui.Button import com.badlogic.gdx.scenes.scene2d.ui.Table import com.badlogic.gdx.scenes.scene2d.ui.VerticalGroup import com.badlogic.gdx.utils.Align -import com.unciv.UnCivGame +import com.unciv.UncivGame import com.unciv.logic.map.MapUnit import com.unciv.models.gamebasics.GameBasics import com.unciv.models.gamebasics.Translations @@ -27,7 +27,7 @@ class PromotionPickerScreen(val mapUnit: MapUnit) : PickerScreen() { } init { - onBackButtonClicked { UnCivGame.Current.setWorldScreen() } + onBackButtonClicked { UncivGame.Current.setWorldScreen() } setDefaultCloseAction() diff --git a/core/src/com/unciv/ui/pickerscreens/TechPickerScreen.kt b/core/src/com/unciv/ui/pickerscreens/TechPickerScreen.kt index 56cab314..e15fc615 100644 --- a/core/src/com/unciv/ui/pickerscreens/TechPickerScreen.kt +++ b/core/src/com/unciv/ui/pickerscreens/TechPickerScreen.kt @@ -4,9 +4,8 @@ import com.badlogic.gdx.Gdx import com.badlogic.gdx.graphics.Color import com.badlogic.gdx.math.Vector2 import com.badlogic.gdx.scenes.scene2d.ui.Image -import com.badlogic.gdx.scenes.scene2d.ui.ScrollPane import com.unciv.Constants -import com.unciv.UnCivGame +import com.unciv.UncivGame import com.unciv.logic.civilization.CivilizationInfo import com.unciv.logic.civilization.TechManager import com.unciv.models.gamebasics.GameBasics @@ -43,7 +42,7 @@ class TechPickerScreen(internal val civInfo: CivilizationInfo, switchfromWorldSc init { setDefaultCloseAction() - onBackButtonClicked { UnCivGame.Current.setWorldScreen() } + onBackButtonClicked { UncivGame.Current.setWorldScreen() } scrollPane.setOverscroll(false,false) tempTechsToResearch = ArrayList(civTech.techsToResearch) diff --git a/core/src/com/unciv/ui/saves/LoadGameScreen.kt b/core/src/com/unciv/ui/saves/LoadGameScreen.kt index b504a91a..86aa54c0 100644 --- a/core/src/com/unciv/ui/saves/LoadGameScreen.kt +++ b/core/src/com/unciv/ui/saves/LoadGameScreen.kt @@ -8,7 +8,7 @@ import com.badlogic.gdx.scenes.scene2d.ui.ScrollPane import com.badlogic.gdx.scenes.scene2d.ui.Table import com.badlogic.gdx.scenes.scene2d.ui.TextButton import com.badlogic.gdx.scenes.scene2d.utils.ChangeListener -import com.unciv.UnCivGame +import com.unciv.UncivGame import com.unciv.logic.GameSaver import com.unciv.models.gamebasics.tr import com.unciv.ui.pickerscreens.PickerScreen @@ -39,7 +39,7 @@ class LoadGameScreen : PickerScreen() { rightSideButton.onClick { try { - UnCivGame.Current.loadGame(selectedSave) + UncivGame.Current.loadGame(selectedSave) } catch (ex:Exception){ val cantLoadGamePopup = PopupTable(this) @@ -64,7 +64,7 @@ class LoadGameScreen : PickerScreen() { val clipboardContentsString = Gdx.app.clipboard.contents.trim() val decoded = Gzip.unzip(clipboardContentsString) val loadedGame = GameSaver().gameInfoFromString(decoded) - UnCivGame.Current.loadGame(loadedGame) + UncivGame.Current.loadGame(loadedGame) } catch (ex: Exception) { errorLabel.setText("Could not load game from clipboard!".tr()) ex.printStackTrace() @@ -75,7 +75,7 @@ class LoadGameScreen : PickerScreen() { deleteSaveButton.onClick { GameSaver().deleteSave(selectedSave) - UnCivGame.Current.setScreen(LoadGameScreen()) + UncivGame.Current.setScreen(LoadGameScreen()) } deleteSaveButton.disable() rightSideTable.add(deleteSaveButton).row() diff --git a/core/src/com/unciv/ui/saves/LoadMapScreen.kt b/core/src/com/unciv/ui/saves/LoadMapScreen.kt index 7299c8ed..d2fa96b8 100644 --- a/core/src/com/unciv/ui/saves/LoadMapScreen.kt +++ b/core/src/com/unciv/ui/saves/LoadMapScreen.kt @@ -5,7 +5,7 @@ import com.badlogic.gdx.graphics.Color import com.badlogic.gdx.scenes.scene2d.ui.ScrollPane import com.badlogic.gdx.scenes.scene2d.ui.Table import com.badlogic.gdx.scenes.scene2d.ui.TextButton -import com.unciv.UnCivGame +import com.unciv.UncivGame import com.unciv.logic.MapSaver import com.unciv.logic.map.TileMap import com.unciv.models.gamebasics.tr @@ -21,7 +21,7 @@ class LoadMapScreen(previousMap: TileMap) : PickerScreen(){ init { rightSideButton.setText("Load map".tr()) rightSideButton.onClick { - UnCivGame.Current.setScreen(MapEditorScreen(chosenMap)) + UncivGame.Current.setScreen(MapEditorScreen(chosenMap)) dispose() } @@ -46,7 +46,7 @@ class LoadMapScreen(previousMap: TileMap) : PickerScreen(){ val clipboardContentsString = Gdx.app.clipboard.contents.trim() val decoded = Gzip.unzip(clipboardContentsString) val loadedMap = MapSaver().mapFromJson(decoded) - UnCivGame.Current.setScreen(MapEditorScreen(loadedMap)) + UncivGame.Current.setScreen(MapEditorScreen(loadedMap)) } catch (ex:Exception){ couldNotLoadMapLabel.isVisible=true @@ -58,7 +58,7 @@ class LoadMapScreen(previousMap: TileMap) : PickerScreen(){ deleteMapButton.onClick { YesNoPopupTable("Are you sure you want to delete this map?", { MapSaver().deleteMap(chosenMap) - UnCivGame.Current.setScreen(LoadMapScreen(previousMap)) + UncivGame.Current.setScreen(LoadMapScreen(previousMap)) }, this) } deleteMapButton.disable() @@ -66,6 +66,6 @@ class LoadMapScreen(previousMap: TileMap) : PickerScreen(){ rightSideTable.add(deleteMapButton).row() topTable.add(rightSideTable) - closeButton.onClick { UnCivGame.Current.setScreen(MapEditorScreen(previousMap)) } + closeButton.onClick { UncivGame.Current.setScreen(MapEditorScreen(previousMap)) } } } \ No newline at end of file diff --git a/core/src/com/unciv/ui/saves/SaveGameScreen.kt b/core/src/com/unciv/ui/saves/SaveGameScreen.kt index 93873480..84bca42e 100644 --- a/core/src/com/unciv/ui/saves/SaveGameScreen.kt +++ b/core/src/com/unciv/ui/saves/SaveGameScreen.kt @@ -5,7 +5,7 @@ import com.badlogic.gdx.scenes.scene2d.Actor import com.badlogic.gdx.scenes.scene2d.ui.* import com.badlogic.gdx.scenes.scene2d.utils.ChangeListener import com.badlogic.gdx.utils.Json -import com.unciv.UnCivGame +import com.unciv.UncivGame import com.unciv.logic.GameSaver import com.unciv.models.gamebasics.tr import com.unciv.ui.pickerscreens.PickerScreen @@ -55,8 +55,8 @@ class SaveGameScreen : PickerScreen() { rightSideButton.setText("Save game".tr()) rightSideButton.onClick { - GameSaver().saveGame(UnCivGame.Current.gameInfo, textField.text) - UnCivGame.Current.setWorldScreen() + GameSaver().saveGame(UncivGame.Current.gameInfo, textField.text) + UncivGame.Current.setWorldScreen() } rightSideButton.enable() } diff --git a/core/src/com/unciv/ui/tilegroups/CityButton.kt b/core/src/com/unciv/ui/tilegroups/CityButton.kt index b3aa901f..02030fca 100644 --- a/core/src/com/unciv/ui/tilegroups/CityButton.kt +++ b/core/src/com/unciv/ui/tilegroups/CityButton.kt @@ -8,7 +8,7 @@ import com.badlogic.gdx.scenes.scene2d.actions.Actions import com.badlogic.gdx.scenes.scene2d.ui.Skin import com.badlogic.gdx.scenes.scene2d.ui.Table import com.badlogic.gdx.utils.Align -import com.unciv.UnCivGame +import com.unciv.UncivGame import com.unciv.logic.city.CityConstructions import com.unciv.logic.city.CityInfo import com.unciv.logic.city.SpecialConstruction @@ -55,12 +55,12 @@ class CityButton(val city: CityInfo, internal val tileGroup: WorldTileGroup, ski add(airUnitTable).row() } - private fun belongsToViewingCiv() = city.civInfo == UnCivGame.Current.worldScreen.viewingCiv + private fun belongsToViewingCiv() = city.civInfo == UncivGame.Current.worldScreen.viewingCiv private fun setButtonActions() { val unitTable = tileGroup.worldScreen.bottomUnitTable - if (UnCivGame.Current.viewEntireMapForDebug || belongsToViewingCiv()) { + if (UncivGame.Current.viewEntireMapForDebug || belongsToViewingCiv()) { // So you can click anywhere on the button to go to the city touchable = Touchable.childrenOnly @@ -70,7 +70,7 @@ class CityButton(val city: CityInfo, internal val tileGroup: WorldTileGroup, ski // second tap on the button will go to the city screen onClick { if (isButtonMoved) { - UnCivGame.Current.setScreen(CityScreen(city)) + UncivGame.Current.setScreen(CityScreen(city)) } else { moveButtonDown() if (unitTable.selectedUnit == null || unitTable.selectedUnit!!.currentMovement == 0f) @@ -129,7 +129,7 @@ class CityButton(val city: CityInfo, internal val tileGroup: WorldTileGroup, ski iconTable.add(label).pad(10f) // sufficient horizontal padding .fillY() // provide full-height clicking area - if (UnCivGame.Current.viewEntireMapForDebug || belongsToViewingCiv()) + if (UncivGame.Current.viewEntireMapForDebug || belongsToViewingCiv()) iconTable.add(getConstructionGroup(city.cityConstructions)).padRight(10f).padLeft(10f) else if (city.civInfo.isMajorCiv()) { val nationIcon = ImageGetter.getNationIcon(city.civInfo.nation.name) diff --git a/core/src/com/unciv/ui/tilegroups/TileGroup.kt b/core/src/com/unciv/ui/tilegroups/TileGroup.kt index ceab4fdf..6035aad5 100644 --- a/core/src/com/unciv/ui/tilegroups/TileGroup.kt +++ b/core/src/com/unciv/ui/tilegroups/TileGroup.kt @@ -6,7 +6,7 @@ import com.badlogic.gdx.scenes.scene2d.Group import com.badlogic.gdx.scenes.scene2d.Touchable import com.badlogic.gdx.scenes.scene2d.ui.Image import com.badlogic.gdx.utils.Align -import com.unciv.UnCivGame +import com.unciv.UncivGame import com.unciv.logic.HexMath import com.unciv.logic.civilization.CivilizationInfo import com.unciv.logic.map.RoadStatus @@ -72,7 +72,7 @@ open class TileGroup(var tileInfo: TileInfo, var tileSetStrings:TileSetStrings) protected val fogImage = ImageGetter.getImage(tileSetStrings.crosshatchHexagon) - var showEntireMap = UnCivGame.Current.viewEntireMapForDebug + var showEntireMap = UncivGame.Current.viewEntireMapForDebug var forMapEditorIcon = false class RoadImage { @@ -140,7 +140,7 @@ open class TileGroup(var tileInfo: TileInfo, var tileSetStrings:TileSetStrings) if (ImageGetter.imageExists(tileSetStrings.cityTile)) return listOf(tileSetStrings.cityTile) } - val shouldShowImprovement = tileInfo.improvement!=null && UnCivGame.Current.settings.showPixelImprovements + val shouldShowImprovement = tileInfo.improvement!=null && UncivGame.Current.settings.showPixelImprovements val baseTerrainTileLocation = tileSetStrings.getTile(tileInfo.baseTerrain) if (tileInfo.terrainFeature != null) { val baseTerrainAndFeatureTileLocation = "$baseTerrainTileLocation+${tileInfo.terrainFeature}" @@ -419,7 +419,7 @@ open class TileGroup(var tileInfo: TileInfo, var tileSetStrings:TileSetStrings) val unitType = militaryUnit.type val specificUnitIconLocation = tileSetStrings.unitsLocation + militaryUnit.name newImageLocation = when { - !UnCivGame.Current.settings.showPixelUnits -> "" + !UncivGame.Current.settings.showPixelUnits -> "" ImageGetter.imageExists(specificUnitIconLocation) -> specificUnitIconLocation militaryUnit.baseUnit.replaces!=null && @@ -457,7 +457,7 @@ open class TileGroup(var tileInfo: TileInfo, var tileSetStrings:TileSetStrings) if (tileInfo.civilianUnit != null && tileIsViewable) { val specificUnitIconLocation = tileSetStrings.unitsLocation + tileInfo.civilianUnit!!.name newImageLocation = when { - !UnCivGame.Current.settings.showPixelUnits -> "" + !UncivGame.Current.settings.showPixelUnits -> "" ImageGetter.imageExists(specificUnitIconLocation) -> specificUnitIconLocation else -> "" } diff --git a/core/src/com/unciv/ui/tilegroups/TileGroupIcons.kt b/core/src/com/unciv/ui/tilegroups/TileGroupIcons.kt index f0d6235e..79ec28f0 100644 --- a/core/src/com/unciv/ui/tilegroups/TileGroupIcons.kt +++ b/core/src/com/unciv/ui/tilegroups/TileGroupIcons.kt @@ -3,7 +3,7 @@ package com.unciv.ui.tilegroups import com.badlogic.gdx.graphics.Color import com.badlogic.gdx.scenes.scene2d.Actor import com.badlogic.gdx.scenes.scene2d.ui.Image -import com.unciv.UnCivGame +import com.unciv.UncivGame import com.unciv.logic.map.MapUnit import com.unciv.ui.utils.ImageGetter import com.unciv.ui.utils.UnitGroup @@ -60,7 +60,7 @@ class TileGroupIcons(val tileGroup: TileGroup){ // Instead of fading out the entire unit with its background, we just fade out its central icon, // that way it remains much more visible on the map - if (!unit.isIdle() && unit.civInfo == UnCivGame.Current.worldScreen.viewingCiv) + if (!unit.isIdle() && unit.civInfo == UncivGame.Current.worldScreen.viewingCiv) newImage.unitBaseImage.color.a = 0.5f } return newImage @@ -106,7 +106,7 @@ class TileGroupIcons(val tileGroup: TileGroup){ val shouldDisplayResource = if (tileGroup.showEntireMap) tileGroup.tileInfo.resource != null else showResourcesAndImprovements - && tileGroup.tileInfo.hasViewableResource(UnCivGame.Current.worldScreen.viewingCiv) + && tileGroup.tileInfo.hasViewableResource(UncivGame.Current.worldScreen.viewingCiv) tileGroup.resourceImage!!.isVisible = shouldDisplayResource } } diff --git a/core/src/com/unciv/ui/tilegroups/TileSetStrings.kt b/core/src/com/unciv/ui/tilegroups/TileSetStrings.kt index 90eec912..fdbbe6f0 100644 --- a/core/src/com/unciv/ui/tilegroups/TileSetStrings.kt +++ b/core/src/com/unciv/ui/tilegroups/TileSetStrings.kt @@ -1,11 +1,11 @@ package com.unciv.ui.tilegroups -import com.unciv.UnCivGame +import com.unciv.UncivGame class TileSetStrings { // this is so that when we have 100s of TileGroups, they won't all individually come up with all these strings themselves, // it gets pretty memory-intensive (10s of MBs which is a lot for lower-end phones) - val tileSetLocation = "TileSets/"+ UnCivGame.Current.settings.tileSet +"/" + val tileSetLocation = "TileSets/"+ UncivGame.Current.settings.tileSet +"/" val hexagon = tileSetLocation+"Hexagon" val crosshatchHexagon = tileSetLocation+"CrosshatchHexagon" diff --git a/core/src/com/unciv/ui/tilegroups/WorldTileGroup.kt b/core/src/com/unciv/ui/tilegroups/WorldTileGroup.kt index b88d26b7..26f436ed 100644 --- a/core/src/com/unciv/ui/tilegroups/WorldTileGroup.kt +++ b/core/src/com/unciv/ui/tilegroups/WorldTileGroup.kt @@ -1,6 +1,6 @@ package com.unciv.ui.tilegroups -import com.unciv.UnCivGame +import com.unciv.UncivGame import com.unciv.logic.city.CityInfo import com.unciv.logic.civilization.CivilizationInfo import com.unciv.logic.map.MapUnit @@ -26,16 +26,16 @@ class WorldTileGroup(internal val worldScreen: WorldScreen, tileInfo: TileInfo, icons.removePopulationIcon() val tileIsViewable = isViewable(viewingCiv) - if (tileIsViewable && tileInfo.isWorked() && UnCivGame.Current.settings.showWorkedTiles + if (tileIsViewable && tileInfo.isWorked() && UncivGame.Current.settings.showWorkedTiles && city!!.civInfo.isPlayerCivilization()) icons.addPopulationIcon() val currentPlayerCiv = worldScreen.viewingCiv - if (UnCivGame.Current.viewEntireMapForDebug + if (UncivGame.Current.viewEntireMapForDebug || currentPlayerCiv.exploredTiles.contains(tileInfo.position)) - updateCityButton(city, tileIsViewable || UnCivGame.Current.viewEntireMapForDebug) // needs to be before the update so the units will be above the city button + updateCityButton(city, tileIsViewable || UncivGame.Current.viewEntireMapForDebug) // needs to be before the update so the units will be above the city button - super.update(viewingCiv, UnCivGame.Current.settings.showResourcesAndImprovements) + super.update(viewingCiv, UncivGame.Current.settings.showResourcesAndImprovements) } diff --git a/core/src/com/unciv/ui/trade/DiplomacyScreen.kt b/core/src/com/unciv/ui/trade/DiplomacyScreen.kt index fbf8a1ba..df48d087 100644 --- a/core/src/com/unciv/ui/trade/DiplomacyScreen.kt +++ b/core/src/com/unciv/ui/trade/DiplomacyScreen.kt @@ -6,7 +6,7 @@ import com.badlogic.gdx.scenes.scene2d.ui.SplitPane import com.badlogic.gdx.scenes.scene2d.ui.Table import com.badlogic.gdx.scenes.scene2d.ui.TextButton import com.unciv.Constants -import com.unciv.UnCivGame +import com.unciv.UncivGame import com.unciv.logic.civilization.AlertType import com.unciv.logic.civilization.CityStateType import com.unciv.logic.civilization.CivilizationInfo @@ -28,10 +28,10 @@ class DiplomacyScreen(val viewingCiv:CivilizationInfo):CameraStageBaseScreen() { val leftSideTable = Table().apply { defaults().pad(10f) } val rightSideTable = Table() - fun isNotPlayersTurn() = !UnCivGame.Current.worldScreen.isPlayersTurn + fun isNotPlayersTurn() = !UncivGame.Current.worldScreen.isPlayersTurn init { - onBackButtonClicked { UnCivGame.Current.setWorldScreen() } + onBackButtonClicked { UncivGame.Current.setWorldScreen() } val splitPane = SplitPane(ScrollPane(leftSideTable), rightSideTable, false, skin) splitPane.splitAmount = 0.2f @@ -42,7 +42,7 @@ class DiplomacyScreen(val viewingCiv:CivilizationInfo):CameraStageBaseScreen() { val closeButton = TextButton("Close".tr(), skin) - closeButton.onClick { UnCivGame.Current.setWorldScreen() } + closeButton.onClick { UncivGame.Current.setWorldScreen() } closeButton.label.setFontSize(24) closeButton.labelCell.pad(10f) closeButton.pack() @@ -53,7 +53,7 @@ class DiplomacyScreen(val viewingCiv:CivilizationInfo):CameraStageBaseScreen() { private fun updateLeftSideTable() { leftSideTable.clear() - for (civ in UnCivGame.Current.gameInfo.civilizations + for (civ in UncivGame.Current.gameInfo.civilizations .filterNot { it.isDefeated() || it == viewingCiv || it.isBarbarian() }) { if (!viewingCiv.knows(civ)) continue diff --git a/core/src/com/unciv/ui/utils/CameraStageBaseScreen.kt b/core/src/com/unciv/ui/utils/CameraStageBaseScreen.kt index e0b808ae..5467482c 100644 --- a/core/src/com/unciv/ui/utils/CameraStageBaseScreen.kt +++ b/core/src/com/unciv/ui/utils/CameraStageBaseScreen.kt @@ -11,12 +11,12 @@ import com.badlogic.gdx.scenes.scene2d.* import com.badlogic.gdx.scenes.scene2d.ui.* import com.badlogic.gdx.scenes.scene2d.utils.ClickListener import com.badlogic.gdx.utils.viewport.ExtendViewport -import com.unciv.UnCivGame +import com.unciv.UncivGame import com.unciv.models.gamebasics.tr open class CameraStageBaseScreen : Screen { - var game: UnCivGame = UnCivGame.Current + var game: UncivGame = UncivGame.Current var stage: Stage var tutorials = Tutorials() var hasPopupOpen = false diff --git a/core/src/com/unciv/ui/utils/Fonts.kt b/core/src/com/unciv/ui/utils/Fonts.kt index 4c72f081..9bd1a065 100644 --- a/core/src/com/unciv/ui/utils/Fonts.kt +++ b/core/src/com/unciv/ui/utils/Fonts.kt @@ -2,7 +2,7 @@ package com.unciv.ui.utils import com.badlogic.gdx.Gdx import com.badlogic.gdx.graphics.g2d.BitmapFont -import com.unciv.UnCivGame +import com.unciv.UncivGame import com.unciv.models.gamebasics.GameBasics import core.java.nativefont.NativeFont import core.java.nativefont.NativeFontPaint @@ -47,7 +47,7 @@ class Fonts { } fun getFont(size: Int): BitmapFont { - val language = UnCivGame.Current.settings.language + val language = UncivGame.Current.settings.language val fontForLanguage ="Nativefont" val isUniqueFont = language.contains("Chinese") || language == "Korean" val keyForFont = if(!isUniqueFont) "$fontForLanguage $size" else "$fontForLanguage $size $language" diff --git a/core/src/com/unciv/ui/utils/Sounds.kt b/core/src/com/unciv/ui/utils/Sounds.kt index c0a837d4..e757db14 100644 --- a/core/src/com/unciv/ui/utils/Sounds.kt +++ b/core/src/com/unciv/ui/utils/Sounds.kt @@ -2,7 +2,7 @@ package com.unciv.ui.utils import com.badlogic.gdx.Gdx import com.badlogic.gdx.audio.Sound -import com.unciv.UnCivGame +import com.unciv.UncivGame object Sounds{ val soundMap = HashMap() @@ -15,6 +15,6 @@ object Sounds{ fun play(name:String){ - get(name).play(UnCivGame.Current.settings.soundEffectsVolume) + get(name).play(UncivGame.Current.settings.soundEffectsVolume) } } \ No newline at end of file diff --git a/core/src/com/unciv/ui/utils/Tutorials.kt b/core/src/com/unciv/ui/utils/Tutorials.kt index 19e27c83..7dadf180 100644 --- a/core/src/com/unciv/ui/utils/Tutorials.kt +++ b/core/src/com/unciv/ui/utils/Tutorials.kt @@ -8,7 +8,7 @@ import com.badlogic.gdx.scenes.scene2d.ui.Table import com.badlogic.gdx.scenes.scene2d.ui.TextButton import com.badlogic.gdx.utils.Align import com.badlogic.gdx.utils.Array -import com.unciv.UnCivGame +import com.unciv.UncivGame import com.unciv.models.gamebasics.GameBasics import com.unciv.models.gamebasics.tr import java.util.* @@ -26,13 +26,13 @@ class Tutorials{ fun displayTutorials(name: String, stage: Stage) { - if (!UnCivGame.Current.settings.showTutorials) return - if (UnCivGame.Current.settings.tutorialsShown.contains(name)) return + if (!UncivGame.Current.settings.showTutorials) return + if (UncivGame.Current.settings.tutorialsShown.contains(name)) return if(tutorialTexts.any { it.name==name }) return // currently showing var texts: ArrayList try { - texts = getTutorials(name, UnCivGame.Current.settings.language) + texts = getTutorials(name, UncivGame.Current.settings.language) } catch (ex: Exception) { texts = ArrayList().apply { add("Could not find matching tutorial!") } } @@ -80,9 +80,9 @@ class Tutorials{ button.onClick { tutorialTable.remove() - if(!UnCivGame.Current.settings.tutorialsShown.contains(currentTutorial.name)) { - UnCivGame.Current.settings.tutorialsShown.add(currentTutorial.name) - UnCivGame.Current.settings.save() + if(!UncivGame.Current.settings.tutorialsShown.contains(currentTutorial.name)) { + UncivGame.Current.settings.tutorialsShown.add(currentTutorial.name) + UncivGame.Current.settings.save() } if (!tutorialTexts.isEmpty()) displayTutorial(stage) diff --git a/core/src/com/unciv/ui/worldscreen/Minimap.kt b/core/src/com/unciv/ui/worldscreen/Minimap.kt index d2cf09e5..7d43d5d1 100644 --- a/core/src/com/unciv/ui/worldscreen/Minimap.kt +++ b/core/src/com/unciv/ui/worldscreen/Minimap.kt @@ -8,7 +8,7 @@ import com.badlogic.gdx.scenes.scene2d.ui.Image import com.badlogic.gdx.scenes.scene2d.ui.ScrollPane import com.badlogic.gdx.scenes.scene2d.ui.Table import com.badlogic.gdx.utils.Align -import com.unciv.UnCivGame +import com.unciv.UncivGame import com.unciv.logic.HexMath import com.unciv.logic.civilization.CivilizationInfo import com.unciv.logic.map.TileInfo @@ -75,7 +75,7 @@ class Minimap(val tileMapHolder: TileMapHolder) : ScrollPane(null){ fun update(cloneCivilization: CivilizationInfo) { for(tileInfo in tileMapHolder.tileMap.values) { val hex = tileImages[tileInfo]!! - if (!(UnCivGame.Current.viewEntireMapForDebug || cloneCivilization.exploredTiles.contains(tileInfo.position))) + if (!(UncivGame.Current.viewEntireMapForDebug || cloneCivilization.exploredTiles.contains(tileInfo.position))) hex.color = Color.DARK_GRAY else if (tileInfo.isCityCenter() && !tileInfo.isWater) hex.color = tileInfo.getOwner()!!.nation.getInnerColor() @@ -112,7 +112,7 @@ class MinimapHolder(tileMapHolder: TileMapHolder): Table(){ fun getToggleIcons():Table{ val toggleIconTable=Table() - val settings = UnCivGame.Current.settings + val settings = UncivGame.Current.settings val populationImage = ImageGetter.getStatIcon("Population").surroundWithCircle(40f) populationImage.circle.color = Color.BLACK @@ -138,7 +138,7 @@ class MinimapHolder(tileMapHolder: TileMapHolder): Table(){ } fun update(civInfo:CivilizationInfo){ - isVisible = UnCivGame.Current.settings.showMinimap + isVisible = UncivGame.Current.settings.showMinimap minimap.update(civInfo) } } \ No newline at end of file diff --git a/core/src/com/unciv/ui/worldscreen/PlayerReadyScreen.kt b/core/src/com/unciv/ui/worldscreen/PlayerReadyScreen.kt index 265025ae..8d8ce487 100644 --- a/core/src/com/unciv/ui/worldscreen/PlayerReadyScreen.kt +++ b/core/src/com/unciv/ui/worldscreen/PlayerReadyScreen.kt @@ -2,7 +2,7 @@ package com.unciv.ui.worldscreen import com.badlogic.gdx.scenes.scene2d.Touchable import com.badlogic.gdx.scenes.scene2d.ui.Table -import com.unciv.UnCivGame +import com.unciv.UncivGame import com.unciv.logic.civilization.CivilizationInfo import com.unciv.ui.utils.CameraStageBaseScreen import com.unciv.ui.utils.ImageGetter @@ -18,8 +18,8 @@ class PlayerReadyScreen(currentPlayerCiv: CivilizationInfo) : CameraStageBaseScr table.add("[$currentPlayerCiv] ready?".toLabel(currentPlayerCiv.nation.getInnerColor(),24)) table.onClick { - UnCivGame.Current.worldScreen = WorldScreen(currentPlayerCiv) - UnCivGame.Current.setWorldScreen() + UncivGame.Current.worldScreen = WorldScreen(currentPlayerCiv) + UncivGame.Current.setWorldScreen() } table.setFillParent(true) stage.addActor(table) diff --git a/core/src/com/unciv/ui/worldscreen/TileMapHolder.kt b/core/src/com/unciv/ui/worldscreen/TileMapHolder.kt index 34899c01..b432f31a 100644 --- a/core/src/com/unciv/ui/worldscreen/TileMapHolder.kt +++ b/core/src/com/unciv/ui/worldscreen/TileMapHolder.kt @@ -11,7 +11,7 @@ import com.badlogic.gdx.scenes.scene2d.ui.Table import com.badlogic.gdx.scenes.scene2d.utils.ActorGestureListener import com.badlogic.gdx.scenes.scene2d.utils.ClickListener import com.unciv.Constants -import com.unciv.UnCivGame +import com.unciv.UncivGame import com.unciv.logic.automation.UnitAutomation import com.unciv.logic.city.CityInfo import com.unciv.logic.civilization.CivilizationInfo @@ -179,7 +179,7 @@ class TileMapHolder(internal val worldScreen: WorldScreen, internal val tileMap: else selectedUnit.movement.getShortestPath(tileInfo).size // this is what takes the most time, tbh Gdx.app.postRunnable { - if(UnCivGame.Current.settings.singleTapMove && turnsToGetThere==1) { + if(UncivGame.Current.settings.singleTapMove && turnsToGetThere==1) { // single turn instant move selectedUnit.movement.headTowards(tileInfo) worldScreen.bottomUnitTable.selectedUnit = selectedUnit // keep moved unit selected @@ -331,14 +331,14 @@ class TileMapHolder(internal val worldScreen: WorldScreen, internal val tileMap: for (tile: TileInfo in tilesInMoveRange) if (unit.movement.canMoveTo(tile)) tileGroups[tile]!!.showCircle(Color.WHITE, - if (UnCivGame.Current.settings.singleTapMove || isAirUnit) 0.7f else 0.3f) + if (UncivGame.Current.settings.singleTapMove || isAirUnit) 0.7f else 0.3f) val unitType = unit.type val attackableTiles: List = if (unitType.isCivilian()) listOf() else { val tiles = UnitAutomation().getAttackableEnemies(unit, unit.movement.getDistanceToTiles()).map { it.tileToAttack } - tiles.filter { (UnCivGame.Current.viewEntireMapForDebug || playerViewableTilePositions.contains(it.position)) } + tiles.filter { (UncivGame.Current.viewEntireMapForDebug || playerViewableTilePositions.contains(it.position)) } } for (attackableTile in attackableTiles) { @@ -360,7 +360,7 @@ class TileMapHolder(internal val worldScreen: WorldScreen, internal val tileMap: private fun updateTilegroupsForSelectedCity(city: CityInfo, playerViewableTilePositions: HashSet) { val attackableTiles: List = UnitAutomation().getBombardTargets(city) - .filter { (UnCivGame.Current.viewEntireMapForDebug || playerViewableTilePositions.contains(it.position)) } + .filter { (UncivGame.Current.viewEntireMapForDebug || playerViewableTilePositions.contains(it.position)) } for (attackableTile in attackableTiles) { tileGroups[attackableTile]!!.showCircle(colorFromRGB(237, 41, 57)) tileGroups[attackableTile]!!.showCrosshair() diff --git a/core/src/com/unciv/ui/worldscreen/WorldScreen.kt b/core/src/com/unciv/ui/worldscreen/WorldScreen.kt index d263945d..765b69ea 100644 --- a/core/src/com/unciv/ui/worldscreen/WorldScreen.kt +++ b/core/src/com/unciv/ui/worldscreen/WorldScreen.kt @@ -9,7 +9,7 @@ import com.badlogic.gdx.scenes.scene2d.ui.Button import com.badlogic.gdx.scenes.scene2d.ui.Table import com.badlogic.gdx.scenes.scene2d.ui.TextButton import com.unciv.Constants -import com.unciv.UnCivGame +import com.unciv.UncivGame import com.unciv.logic.GameSaver import com.unciv.logic.civilization.CivilizationInfo import com.unciv.logic.civilization.diplomacy.DiplomaticStatus @@ -163,7 +163,7 @@ class WorldScreen(val viewingCiv:CivilizationInfo) : CameraStageBaseScreen() { bottomUnitTable.update() bottomTileInfoTable.updateTileTable(tileMapHolder.selectedTile!!) bottomTileInfoTable.x=stage.width-bottomTileInfoTable.width - bottomTileInfoTable.y=if(UnCivGame.Current.settings.showMinimap)minimapWrapper.height else 0f + bottomTileInfoTable.y=if(UncivGame.Current.settings.showMinimap)minimapWrapper.height else 0f battleTable.update() minimapWrapper.update(viewingCiv) @@ -202,11 +202,11 @@ class WorldScreen(val viewingCiv:CivilizationInfo) : CameraStageBaseScreen() { } private fun displayTutorialsOnUpdate() { - if (UnCivGame.Current.settings.hasCrashedRecently) { + if (UncivGame.Current.settings.hasCrashedRecently) { displayTutorials("_GameCrashed") - UnCivGame.Current.settings.tutorialsShown.remove("_GameCrashed") - UnCivGame.Current.settings.hasCrashedRecently = false - UnCivGame.Current.settings.save() + UncivGame.Current.settings.tutorialsShown.remove("_GameCrashed") + UncivGame.Current.settings.hasCrashedRecently = false + UncivGame.Current.settings.save() } if (bottomUnitTable.selectedUnit != null) displayTutorials("Unit_Selected") @@ -214,10 +214,10 @@ class WorldScreen(val viewingCiv:CivilizationInfo) : CameraStageBaseScreen() { displayTutorials("_City_Founded") displayTutorials("First_Steps") } - if (UnCivGame.Current.settings.tutorialsShown.contains("Cities")) displayTutorials("Next_Turn") + if (UncivGame.Current.settings.tutorialsShown.contains("Cities")) displayTutorials("Next_Turn") - if (!UnCivGame.Current.settings.tutorialsShown.contains("_EnemyCityNeedsConqueringWithMeleeUnit")) { + if (!UncivGame.Current.settings.tutorialsShown.contains("_EnemyCityNeedsConqueringWithMeleeUnit")) { for (enemyCity in viewingCiv.diplomacy.values.filter { it.diplomaticStatus == DiplomaticStatus.War } .map { it.otherCiv() }.flatMap { it.cities }) { if (enemyCity.health == 1 && enemyCity.getCenterTile().getTilesInDistance(2) @@ -242,7 +242,7 @@ class WorldScreen(val viewingCiv:CivilizationInfo) : CameraStageBaseScreen() { .any()) { displayTutorials("_OtherCivEncountered") val btn = TextButton("Diplomacy".tr(), skin) - btn.onClick { UnCivGame.Current.setScreen(DiplomacyScreen(viewingCiv)) } + btn.onClick { UncivGame.Current.setScreen(DiplomacyScreen(viewingCiv)) } btn.label.setFontSize(30) btn.labelCell.pad(10f) diplomacyButtonWrapper.add(btn) @@ -370,7 +370,7 @@ class WorldScreen(val viewingCiv:CivilizationInfo) : CameraStageBaseScreen() { if (gameInfoClone.currentPlayerCiv.civName != viewingCiv.civName && !gameInfoClone.gameParameters.isOnlineMultiplayer) - UnCivGame.Current.setScreen(PlayerReadyScreen(gameInfoClone.getCurrentPlayerCivilization())) + UncivGame.Current.setScreen(PlayerReadyScreen(gameInfoClone.getCurrentPlayerCivilization())) else { createNewWorldScreen() } @@ -429,7 +429,7 @@ class WorldScreen(val viewingCiv:CivilizationInfo) : CameraStageBaseScreen() { } private fun showTutorialsOnNextTurn(){ - val shownTutorials = UnCivGame.Current.settings.tutorialsShown + val shownTutorials = UncivGame.Current.settings.tutorialsShown displayTutorials("Slow_Start") if("_BarbarianEncountered" !in shownTutorials && viewingCiv.viewableTiles.any { it.getUnits().any { unit -> unit.civInfo.isBarbarian() } }) @@ -438,7 +438,7 @@ class WorldScreen(val viewingCiv:CivilizationInfo) : CameraStageBaseScreen() { if(viewingCiv.getHappiness() < 5) displayTutorials("Happiness") if(viewingCiv.getHappiness() < 0) displayTutorials("Unhappiness") if(viewingCiv.goldenAges.isGoldenAge()) displayTutorials("Golden_Age") - if(gameInfo.turns >= 50 && UnCivGame.Current.settings.checkForDueUnits) displayTutorials("Idle_Units") + if(gameInfo.turns >= 50 && UncivGame.Current.settings.checkForDueUnits) displayTutorials("Idle_Units") if(gameInfo.turns >= 100) displayTutorials("Contact_Me") val resources = viewingCiv.getCivResources() if(resources.any { it.resource.resourceType==ResourceType.Luxury }) displayTutorials("Luxury_Resource") diff --git a/core/src/com/unciv/ui/worldscreen/WorldScreenTopBar.kt b/core/src/com/unciv/ui/worldscreen/WorldScreenTopBar.kt index 67238e0a..2e28bf07 100644 --- a/core/src/com/unciv/ui/worldscreen/WorldScreenTopBar.kt +++ b/core/src/com/unciv/ui/worldscreen/WorldScreenTopBar.kt @@ -7,7 +7,7 @@ import com.badlogic.gdx.scenes.scene2d.ui.Image import com.badlogic.gdx.scenes.scene2d.ui.Label import com.badlogic.gdx.scenes.scene2d.ui.Table import com.badlogic.gdx.scenes.scene2d.ui.TextButton -import com.unciv.UnCivGame +import com.unciv.UncivGame import com.unciv.logic.civilization.CivilizationInfo import com.unciv.models.gamebasics.GameBasics import com.unciv.models.gamebasics.tile.ResourceType @@ -49,7 +49,7 @@ class WorldScreenTopBar(val screen: WorldScreen) : Table() { val overviewButton = TextButton("Overview".tr(),CameraStageBaseScreen.skin) overviewButton.labelCell.pad(10f) overviewButton.pack() - overviewButton.onClick { UnCivGame.Current.setScreen(EmpireOverviewScreen()) } + overviewButton.onClick { UncivGame.Current.setScreen(EmpireOverviewScreen()) } overviewButton.center(this) overviewButton.x = screen.stage.width-overviewButton.width-10 addActor(overviewButton) diff --git a/core/src/com/unciv/ui/worldscreen/bottombar/BattleTable.kt b/core/src/com/unciv/ui/worldscreen/bottombar/BattleTable.kt index fad40942..a885207f 100644 --- a/core/src/com/unciv/ui/worldscreen/bottombar/BattleTable.kt +++ b/core/src/com/unciv/ui/worldscreen/bottombar/BattleTable.kt @@ -8,7 +8,7 @@ import com.badlogic.gdx.scenes.scene2d.ui.Image import com.badlogic.gdx.scenes.scene2d.ui.Label import com.badlogic.gdx.scenes.scene2d.ui.Table import com.badlogic.gdx.scenes.scene2d.ui.TextButton -import com.unciv.UnCivGame +import com.unciv.UncivGame import com.unciv.logic.automation.UnitAutomation import com.unciv.logic.battle.* import com.unciv.models.gamebasics.tr @@ -56,7 +56,7 @@ class BattleTable(val worldScreen: WorldScreen): Table() { if(defender==null || defender.getCivInfo()==worldScreen.viewingCiv - || !(UnCivGame.Current.viewEntireMapForDebug + || !(UncivGame.Current.viewEntireMapForDebug || attacker.getCivInfo().exploredTiles.contains(selectedTile.position))) { hide() return diff --git a/core/src/com/unciv/ui/worldscreen/bottombar/TileInfoTable.kt b/core/src/com/unciv/ui/worldscreen/bottombar/TileInfoTable.kt index c2e22885..70707d51 100644 --- a/core/src/com/unciv/ui/worldscreen/bottombar/TileInfoTable.kt +++ b/core/src/com/unciv/ui/worldscreen/bottombar/TileInfoTable.kt @@ -4,7 +4,7 @@ import com.badlogic.gdx.graphics.Color import com.badlogic.gdx.scenes.scene2d.ui.Label import com.badlogic.gdx.scenes.scene2d.ui.Table import com.badlogic.gdx.utils.Align -import com.unciv.UnCivGame +import com.unciv.UncivGame import com.unciv.logic.map.TileInfo import com.unciv.ui.utils.CameraStageBaseScreen import com.unciv.ui.utils.ImageGetter @@ -20,7 +20,7 @@ class TileInfoTable(private val worldScreen: WorldScreen) : Table(CameraStageBas clearChildren() val civInfo = worldScreen.viewingCiv - if (UnCivGame.Current.viewEntireMapForDebug || civInfo.exploredTiles.contains(tile.position)) { + if (UncivGame.Current.viewEntireMapForDebug || civInfo.exploredTiles.contains(tile.position)) { add(getStatsTable(tile)) add(tile.toString().toLabel()).colspan(2).pad(10f) } diff --git a/core/src/com/unciv/ui/worldscreen/optionstable/WorldScreenMenuTable.kt b/core/src/com/unciv/ui/worldscreen/optionstable/WorldScreenMenuTable.kt index 558b6fbc..841a27cc 100644 --- a/core/src/com/unciv/ui/worldscreen/optionstable/WorldScreenMenuTable.kt +++ b/core/src/com/unciv/ui/worldscreen/optionstable/WorldScreenMenuTable.kt @@ -2,7 +2,7 @@ package com.unciv.ui.worldscreen.optionstable import com.badlogic.gdx.Gdx import com.badlogic.gdx.graphics.Color -import com.unciv.UnCivGame +import com.unciv.UncivGame import com.unciv.logic.map.RoadStatus import com.unciv.models.gamebasics.tr import com.unciv.ui.CivilopediaScreen @@ -34,41 +34,41 @@ class WorldScreenMenuTable(val worldScreen: WorldScreen) : PopupTable(worldScree tile.turnsToImprovement=0 tile.roadStatus=RoadStatus.None } - UnCivGame.Current.setScreen(MapEditorScreen(tileMapClone)) + UncivGame.Current.setScreen(MapEditorScreen(tileMapClone)) remove() }.size(width,height) addSeparator() addSquareButton("Civilopedia".tr()){ - UnCivGame.Current.setScreen(CivilopediaScreen()) + UncivGame.Current.setScreen(CivilopediaScreen()) remove() }.size(width,height) addSeparator() addSquareButton("Load game".tr()){ - UnCivGame.Current.setScreen(LoadGameScreen()) + UncivGame.Current.setScreen(LoadGameScreen()) remove() }.size(width,height) addSeparator() addSquareButton("Save game".tr()) { - UnCivGame.Current.setScreen(SaveGameScreen()) + UncivGame.Current.setScreen(SaveGameScreen()) remove() }.size(width,height) addSeparator() - addSquareButton("Start new game".tr()){ UnCivGame.Current.setScreen(NewGameScreen()) }.size(width,height) + addSquareButton("Start new game".tr()){ UncivGame.Current.setScreen(NewGameScreen()) }.size(width,height) addSeparator() addSquareButton("Multiplayer".tr()) { openMultiplayerPopup() }.size(width,height) addSeparator() - addSquareButton("Victory status".tr()) { UnCivGame.Current.setScreen(VictoryScreen()) }.size(width,height) + addSquareButton("Victory status".tr()) { UncivGame.Current.setScreen(VictoryScreen()) }.size(width,height) addSeparator() addSquareButton("Options".tr()){ - UnCivGame.Current.worldScreen.stage.addActor(WorldScreenOptionsTable(worldScreen)) + UncivGame.Current.worldScreen.stage.addActor(WorldScreenOptionsTable(worldScreen)) remove() }.size(width,height) addSeparator() @@ -96,7 +96,7 @@ class WorldScreenMenuTable(val worldScreen: WorldScreen) : PopupTable(worldScree multiplayerPopup.addGoodSizedLabel("To create a multiplayer game, check the 'multiplayer' toggle in the New Game screen, and for each human player insert that player's user ID.").row() multiplayerPopup.addGoodSizedLabel("You can assign your own user ID there easily, and other players can copy their user IDs here and send them to you for you to include them in the game.").row() - multiplayerPopup.addButton("Copy User ID"){ Gdx.app.clipboard.contents = UnCivGame.Current.settings.userId }.row() + multiplayerPopup.addButton("Copy User ID"){ Gdx.app.clipboard.contents = UncivGame.Current.settings.userId }.row() multiplayerPopup.addGoodSizedLabel("Once you've created your game, enter this screen again to copy the Game ID and send it to the other players.").row() @@ -119,7 +119,7 @@ class WorldScreenMenuTable(val worldScreen: WorldScreen) : PopupTable(worldScree } try { val game = OnlineMultiplayer().tryDownloadGame(gameId.trim()) - UnCivGame.Current.loadGame(game) + UncivGame.Current.loadGame(game) } catch (ex: Exception) { badGameIdLabel.setText("Could not download game!".tr()) badGameIdLabel.isVisible = true diff --git a/core/src/com/unciv/ui/worldscreen/optionstable/WorldScreenOptionsTable.kt b/core/src/com/unciv/ui/worldscreen/optionstable/WorldScreenOptionsTable.kt index f4be8cc5..7a3645f9 100644 --- a/core/src/com/unciv/ui/worldscreen/optionstable/WorldScreenOptionsTable.kt +++ b/core/src/com/unciv/ui/worldscreen/optionstable/WorldScreenOptionsTable.kt @@ -6,7 +6,7 @@ import com.badlogic.gdx.scenes.scene2d.Actor import com.badlogic.gdx.scenes.scene2d.ui.* import com.badlogic.gdx.scenes.scene2d.utils.ChangeListener import com.badlogic.gdx.utils.Array -import com.unciv.UnCivGame +import com.unciv.UncivGame import com.unciv.models.gamebasics.GameBasics import com.unciv.models.gamebasics.tr import com.unciv.ui.utils.* @@ -36,7 +36,7 @@ class WorldScreenOptionsTable(val worldScreen:WorldScreen) : PopupTable(worldScr fun update() { - val settings = UnCivGame.Current.settings + val settings = UncivGame.Current.settings settings.save() clear() @@ -122,7 +122,7 @@ class WorldScreenOptionsTable(val worldScreen:WorldScreen) : PopupTable(worldScr addMusicVolumeSlider(innerTable) innerTable.add("Version".toLabel()) - innerTable.add(UnCivGame.Current.version.toLabel()).row() + innerTable.add(UncivGame.Current.version.toLabel()).row() val scrollPane = ScrollPane(innerTable, skin) @@ -134,8 +134,8 @@ class WorldScreenOptionsTable(val worldScreen:WorldScreen) : PopupTable(worldScr addCloseButton() pack() // Needed to show the background. - center(UnCivGame.Current.worldScreen.stage) - UnCivGame.Current.worldScreen.shouldUpdate = true + center(UncivGame.Current.worldScreen.stage) + UncivGame.Current.worldScreen.shouldUpdate = true } @@ -143,11 +143,11 @@ class WorldScreenOptionsTable(val worldScreen:WorldScreen) : PopupTable(worldScr innerTable.add("Sound effects volume".tr()) val soundEffectsVolumeSlider = Slider(0f, 1.0f, 0.1f, false, skin) - soundEffectsVolumeSlider.value = UnCivGame.Current.settings.soundEffectsVolume + soundEffectsVolumeSlider.value = UncivGame.Current.settings.soundEffectsVolume soundEffectsVolumeSlider.addListener(object : ChangeListener() { override fun changed(event: ChangeEvent?, actor: Actor?) { - UnCivGame.Current.settings.soundEffectsVolume = soundEffectsVolumeSlider.value - UnCivGame.Current.settings.save() + UncivGame.Current.settings.soundEffectsVolume = soundEffectsVolumeSlider.value + UncivGame.Current.settings.save() Sounds.play("click") } }) @@ -155,17 +155,17 @@ class WorldScreenOptionsTable(val worldScreen:WorldScreen) : PopupTable(worldScr } private fun addMusicVolumeSlider(innerTable: PopupTable) { - val musicLocation =Gdx.files.local(UnCivGame.Current.musicLocation) + val musicLocation =Gdx.files.local(UncivGame.Current.musicLocation) if(musicLocation.exists()) { innerTable.add("Music volume".tr()) val musicVolumeSlider = Slider(0f, 1.0f, 0.1f, false, skin) - musicVolumeSlider.value = UnCivGame.Current.settings.musicVolume + musicVolumeSlider.value = UncivGame.Current.settings.musicVolume musicVolumeSlider.addListener(object : ChangeListener() { override fun changed(event: ChangeEvent?, actor: Actor?) { - UnCivGame.Current.settings.musicVolume = musicVolumeSlider.value - UnCivGame.Current.settings.save() - UnCivGame.Current.music?.volume = 0.4f * musicVolumeSlider.value + UncivGame.Current.settings.musicVolume = musicVolumeSlider.value + UncivGame.Current.settings.save() + UncivGame.Current.music?.volume = 0.4f * musicVolumeSlider.value } }) innerTable.add(musicVolumeSlider).row() @@ -186,7 +186,7 @@ class WorldScreenOptionsTable(val worldScreen:WorldScreen) : PopupTable(worldScr val file = DropBox().downloadFile("/Music/thatched-villagers.mp3") musicLocation.write(file, false) update() - UnCivGame.Current.startMusic() + UncivGame.Current.startMusic() } catch (ex: Exception) { errorTable.clear() errorTable.add("Could not download music!".toLabel(Color.RED)) @@ -203,16 +203,16 @@ class WorldScreenOptionsTable(val worldScreen:WorldScreen) : PopupTable(worldScr val resolutionArray = Array() resolutionArray.addAll("750x500","900x600", "1050x700", "1200x800", "1500x1000") resolutionSelectBox.items = resolutionArray - resolutionSelectBox.selected = UnCivGame.Current.settings.resolution + resolutionSelectBox.selected = UncivGame.Current.settings.resolution innerTable.add(resolutionSelectBox).pad(10f).row() resolutionSelectBox.addListener(object : ChangeListener() { override fun changed(event: ChangeEvent?, actor: Actor?) { - UnCivGame.Current.settings.resolution = resolutionSelectBox.selected - UnCivGame.Current.settings.save() - UnCivGame.Current.worldScreen = WorldScreen(worldScreen.viewingCiv) - UnCivGame.Current.setWorldScreen() - WorldScreenOptionsTable(UnCivGame.Current.worldScreen) + UncivGame.Current.settings.resolution = resolutionSelectBox.selected + UncivGame.Current.settings.save() + UncivGame.Current.worldScreen = WorldScreen(worldScreen.viewingCiv) + UncivGame.Current.setWorldScreen() + WorldScreenOptionsTable(UncivGame.Current.worldScreen) } }) } @@ -226,16 +226,16 @@ class WorldScreenOptionsTable(val worldScreen:WorldScreen) : PopupTable(worldScr .map { it.name.split("/")[1] }.distinct() for(tileset in tileSets) tileSetArray.add(tileset) tileSetSelectBox.items = tileSetArray - tileSetSelectBox.selected = UnCivGame.Current.settings.tileSet + tileSetSelectBox.selected = UncivGame.Current.settings.tileSet innerTable.add(tileSetSelectBox).pad(10f).row() tileSetSelectBox.addListener(object : ChangeListener() { override fun changed(event: ChangeEvent?, actor: Actor?) { - UnCivGame.Current.settings.tileSet = tileSetSelectBox.selected - UnCivGame.Current.settings.save() - UnCivGame.Current.worldScreen = WorldScreen(worldScreen.viewingCiv) - UnCivGame.Current.setWorldScreen() - WorldScreenOptionsTable(UnCivGame.Current.worldScreen) + UncivGame.Current.settings.tileSet = tileSetSelectBox.selected + UncivGame.Current.settings.save() + UncivGame.Current.worldScreen = WorldScreen(worldScreen.viewingCiv) + UncivGame.Current.setWorldScreen() + WorldScreenOptionsTable(UncivGame.Current.worldScreen) } }) } @@ -247,14 +247,14 @@ class WorldScreenOptionsTable(val worldScreen:WorldScreen) : PopupTable(worldScr val autosaveTurnsArray = Array() autosaveTurnsArray.addAll(1,2,5,10) autosaveTurnsSelectBox.items = autosaveTurnsArray - autosaveTurnsSelectBox.selected = UnCivGame.Current.settings.turnsBetweenAutosaves + autosaveTurnsSelectBox.selected = UncivGame.Current.settings.turnsBetweenAutosaves innerTable.add(autosaveTurnsSelectBox).pad(10f).row() autosaveTurnsSelectBox.addListener(object : ChangeListener() { override fun changed(event: ChangeEvent?, actor: Actor?) { - UnCivGame.Current.settings.turnsBetweenAutosaves= autosaveTurnsSelectBox.selected - UnCivGame.Current.settings.save() + UncivGame.Current.settings.turnsBetweenAutosaves= autosaveTurnsSelectBox.selected + UncivGame.Current.settings.save() update() } }) @@ -267,7 +267,7 @@ class WorldScreenOptionsTable(val worldScreen:WorldScreen) : PopupTable(worldScr GameBasics.Translations.getLanguages().map { Language(it) }.sortedByDescending { it.percentComplete } .forEach { languageArray.add(it) } languageSelectBox.items = languageArray - val matchingLanguage = languageArray.firstOrNull { it.language == UnCivGame.Current.settings.language } + val matchingLanguage = languageArray.firstOrNull { it.language == UncivGame.Current.settings.language } languageSelectBox.selected = if (matchingLanguage != null) matchingLanguage else languageArray.first() innerTable.add(languageSelectBox).pad(10f).row() @@ -276,7 +276,7 @@ class WorldScreenOptionsTable(val worldScreen:WorldScreen) : PopupTable(worldScr // Sometimes the "changed" is triggered even when we didn't choose something that isn't the selectedLanguage = languageSelectBox.selected.language - if(selectedLanguage!=UnCivGame.Current.settings.language ) + if(selectedLanguage!=UncivGame.Current.settings.language ) selectLanguage() } }) @@ -285,7 +285,7 @@ class WorldScreenOptionsTable(val worldScreen:WorldScreen) : PopupTable(worldScr innerTable.add("Missing translations:".toLabel()).pad(5f).colspan(2).row() val missingTextSelectBox = SelectBox(skin) val missingTextArray = Array() - val currentLanguage = UnCivGame.Current.settings.language + val currentLanguage = UncivGame.Current.settings.language GameBasics.Translations.filter { !it.value.containsKey(currentLanguage) }.forEach { missingTextArray.add(it.key) } missingTextSelectBox.items = missingTextArray missingTextSelectBox.selected = "Untranslated texts" @@ -295,11 +295,11 @@ class WorldScreenOptionsTable(val worldScreen:WorldScreen) : PopupTable(worldScr } fun selectLanguage(){ - UnCivGame.Current.settings.language = selectedLanguage - UnCivGame.Current.settings.save() + UncivGame.Current.settings.language = selectedLanguage + UncivGame.Current.settings.save() CameraStageBaseScreen.resetFonts() // to load chinese characters if necessary - UnCivGame.Current.worldScreen = WorldScreen(worldScreen.viewingCiv) - UnCivGame.Current.setWorldScreen() - WorldScreenOptionsTable(UnCivGame.Current.worldScreen) + UncivGame.Current.worldScreen = WorldScreen(worldScreen.viewingCiv) + UncivGame.Current.setWorldScreen() + WorldScreenOptionsTable(UncivGame.Current.worldScreen) } } diff --git a/core/src/com/unciv/ui/worldscreen/optionstable/YesNoPopupTable.kt b/core/src/com/unciv/ui/worldscreen/optionstable/YesNoPopupTable.kt index 5ac9c103..9fcca804 100644 --- a/core/src/com/unciv/ui/worldscreen/optionstable/YesNoPopupTable.kt +++ b/core/src/com/unciv/ui/worldscreen/optionstable/YesNoPopupTable.kt @@ -1,14 +1,14 @@ package com.unciv.ui.worldscreen.optionstable import com.badlogic.gdx.scenes.scene2d.ui.TextButton -import com.unciv.UnCivGame +import com.unciv.UncivGame import com.unciv.models.gamebasics.tr import com.unciv.ui.utils.CameraStageBaseScreen import com.unciv.ui.utils.onClick import com.unciv.ui.utils.toLabel class YesNoPopupTable(question:String, action:()->Unit, - screen: CameraStageBaseScreen = UnCivGame.Current.worldScreen, restoredefault:()->Unit = {}) : PopupTable(screen){ + screen: CameraStageBaseScreen = UncivGame.Current.worldScreen, restoredefault:()->Unit = {}) : PopupTable(screen){ init{ if(!screen.hasPopupOpen) { screen.hasPopupOpen=true diff --git a/core/src/com/unciv/ui/worldscreen/unit/UnitActions.kt b/core/src/com/unciv/ui/worldscreen/unit/UnitActions.kt index 31a807f6..6b3089b4 100644 --- a/core/src/com/unciv/ui/worldscreen/unit/UnitActions.kt +++ b/core/src/com/unciv/ui/worldscreen/unit/UnitActions.kt @@ -2,7 +2,7 @@ package com.unciv.ui.worldscreen.unit import com.badlogic.gdx.graphics.Color import com.unciv.Constants -import com.unciv.UnCivGame +import com.unciv.UncivGame import com.unciv.logic.automation.UnitAutomation import com.unciv.logic.automation.WorkerAutomation import com.unciv.logic.map.MapUnit @@ -72,7 +72,7 @@ class UnitActions { if(!unit.type.isCivilian() && unit.promotions.canBePromoted()) { // promotion does not consume movement points, so we can do it always actionList += UnitAction("Promote", true) { - UnCivGame.Current.setScreen(PromotionPickerScreen(unit)) + UncivGame.Current.setScreen(PromotionPickerScreen(unit)) }.sound("promote") } diff --git a/core/src/com/unciv/ui/worldscreen/unit/UnitActionsTable.kt b/core/src/com/unciv/ui/worldscreen/unit/UnitActionsTable.kt index 3c5c6ca9..8fe8ca1e 100644 --- a/core/src/com/unciv/ui/worldscreen/unit/UnitActionsTable.kt +++ b/core/src/com/unciv/ui/worldscreen/unit/UnitActionsTable.kt @@ -6,7 +6,7 @@ import com.badlogic.gdx.scenes.scene2d.Touchable import com.badlogic.gdx.scenes.scene2d.ui.Button import com.badlogic.gdx.scenes.scene2d.ui.Table import com.unciv.Constants -import com.unciv.UnCivGame +import com.unciv.UncivGame import com.unciv.logic.map.MapUnit import com.unciv.ui.utils.* import com.unciv.ui.worldscreen.WorldScreen @@ -70,7 +70,7 @@ class UnitActionsTable(val worldScreen: WorldScreen) : Table(){ val fontColor = if(unitAction.currentAction) Color.YELLOW else Color.WHITE actionButton.add(unitAction.title.toLabel(fontColor)).pad(5f) actionButton.pack() - actionButton.onClick(unitAction.sound) { unitAction.action(); UnCivGame.Current.worldScreen.shouldUpdate=true } + actionButton.onClick(unitAction.sound) { unitAction.action(); UncivGame.Current.worldScreen.shouldUpdate=true } if (!unitAction.canAct) actionButton.disable() return actionButton } diff --git a/desktop/src/com/unciv/app/desktop/DesktopLauncher.kt b/desktop/src/com/unciv/app/desktop/DesktopLauncher.kt index da34f5e4..5da3965b 100644 --- a/desktop/src/com/unciv/app/desktop/DesktopLauncher.kt +++ b/desktop/src/com/unciv/app/desktop/DesktopLauncher.kt @@ -8,7 +8,7 @@ import com.badlogic.gdx.backends.lwjgl.LwjglApplication import com.badlogic.gdx.backends.lwjgl.LwjglApplicationConfiguration import com.badlogic.gdx.graphics.Texture import com.badlogic.gdx.tools.texturepacker.TexturePacker -import com.unciv.UnCivGame +import com.unciv.UncivGame import com.unciv.models.gamebasics.tr import java.io.File import kotlin.concurrent.thread @@ -23,7 +23,7 @@ internal object DesktopLauncher { config.addIcon("ExtraImages/Icon.png", Files.FileType.Internal) config.title = "Unciv" - val game = UnCivGame("Desktop") + val game = UncivGame("Desktop") tryActivateDiscord(game) @@ -47,7 +47,7 @@ internal object DesktopLauncher { TexturePacker.process(settings, "../Images", ".", "game") } - private fun tryActivateDiscord(game: UnCivGame) { + private fun tryActivateDiscord(game: UncivGame) { try { val handlers = DiscordEventHandlers() DiscordRPC.INSTANCE.Discord_Initialize("647066573147996161", handlers, true, null) @@ -65,7 +65,7 @@ internal object DesktopLauncher { } } - fun updateRpc(game: UnCivGame) { + fun updateRpc(game: UncivGame) { if(!game.isInitialized) return val presence = DiscordRichPresence() val currentPlayerCiv = game.gameInfo.getCurrentPlayerCivilization() diff --git a/ios/src/com/unciv/app/IOSLauncher.java b/ios/src/com/unciv/app/IOSLauncher.java index e30fb35a..de09d695 100644 --- a/ios/src/com/unciv/app/IOSLauncher.java +++ b/ios/src/com/unciv/app/IOSLauncher.java @@ -10,7 +10,7 @@ class IOSLauncher extends IOSApplication.Delegate { @Override protected IOSApplication createApplication() { IOSApplicationConfiguration config = new IOSApplicationConfiguration(); - return new IOSApplication(new com.unciv.UnCivGame("IOS"), config); + return new IOSApplication(new com.unciv.UncivGame("IOS"), config); } public static void main(String[] argv) { diff --git a/tests/src/de/tomgrill/gdxtesting/examples/BasicTests.kt b/tests/src/de/tomgrill/gdxtesting/examples/BasicTests.kt index 4614f62d..34edea6b 100644 --- a/tests/src/de/tomgrill/gdxtesting/examples/BasicTests.kt +++ b/tests/src/de/tomgrill/gdxtesting/examples/BasicTests.kt @@ -3,7 +3,7 @@ package de.tomgrill.gdxtesting.examples import com.badlogic.gdx.Gdx -import com.unciv.UnCivGame +import com.unciv.UncivGame import com.unciv.models.gamebasics.GameBasics import com.unciv.ui.mapeditor.MapEditorScreen import de.tomgrill.gdxtesting.GdxTestRunner @@ -28,7 +28,7 @@ class BasicTests { @Test fun canOpenMapEditorScreen() { - UnCivGame.Current.setScreen(MapEditorScreen(UnCivGame.Current.gameInfo.tileMap)) + UncivGame.Current.setScreen(MapEditorScreen(UncivGame.Current.gameInfo.tileMap)) assertTrue("This test will only pass when we can open the map editor screen", GameBasics.Buildings.size > 0) }