From 23f9d157a446eebe634681e34f2db7302f80bf1c Mon Sep 17 00:00:00 2001 From: Yair Morgenstern Date: Tue, 26 Jun 2018 08:19:41 +0300 Subject: [PATCH] Organized files --- core/src/com/unciv/{ui => }/GameSettings.kt | 2 +- core/src/com/unciv/UnCivGame.kt | 1 - core/src/com/unciv/logic/GameSaver.kt | 4 ++-- core/src/com/unciv/logic/battle/Battle.kt | 3 +-- core/src/com/unciv/logic/city/CityInfo.kt | 2 +- .../com/unciv/logic/civilization/CivilizationInfo.kt | 4 ++-- .../logic/civilization/ScienceVictoryManager.kt | 2 +- core/src/com/unciv/logic/civilization/TechManager.kt | 2 +- core/src/com/unciv/logic/map/TileInfo.kt | 2 +- core/src/com/unciv/models/{linq => }/Counter.java | 2 +- core/src/com/unciv/models/gamebasics/Building.kt | 1 + core/src/com/unciv/models/gamebasics/GameBasics.kt | 2 ++ core/src/com/unciv/models/gamebasics/PolicyBranch.kt | 4 +++- .../unciv/models/gamebasics/{ => tech}/TechColumn.kt | 12 +----------- core/src/com/unciv/models/gamebasics/tech/TechEra.kt | 12 ++++++++++++ .../unciv/models/gamebasics/{ => tech}/Technology.kt | 4 +++- .../com/unciv/ui/pickerscreens/TechPickerScreen.kt | 4 ++-- 17 files changed, 35 insertions(+), 28 deletions(-) rename core/src/com/unciv/{ui => }/GameSettings.kt (98%) rename core/src/com/unciv/models/{linq => }/Counter.java (96%) rename core/src/com/unciv/models/gamebasics/{ => tech}/TechColumn.kt (57%) create mode 100644 core/src/com/unciv/models/gamebasics/tech/TechEra.kt rename core/src/com/unciv/models/gamebasics/{ => tech}/Technology.kt (95%) diff --git a/core/src/com/unciv/ui/GameSettings.kt b/core/src/com/unciv/GameSettings.kt similarity index 98% rename from core/src/com/unciv/ui/GameSettings.kt rename to core/src/com/unciv/GameSettings.kt index 383d7f4139..1f993828ae 100644 --- a/core/src/com/unciv/ui/GameSettings.kt +++ b/core/src/com/unciv/GameSettings.kt @@ -1,4 +1,4 @@ -package com.unciv.ui +package com.unciv class GameSettings : LinkedHashMap() { diff --git a/core/src/com/unciv/UnCivGame.kt b/core/src/com/unciv/UnCivGame.kt index 2691ea575f..97f33c7701 100644 --- a/core/src/com/unciv/UnCivGame.kt +++ b/core/src/com/unciv/UnCivGame.kt @@ -5,7 +5,6 @@ import com.badlogic.gdx.Gdx import com.unciv.logic.GameInfo import com.unciv.logic.GameSaver import com.unciv.models.gamebasics.GameBasics -import com.unciv.ui.GameSettings import com.unciv.ui.worldscreen.WorldScreen class UnCivGame : Game() { diff --git a/core/src/com/unciv/logic/GameSaver.kt b/core/src/com/unciv/logic/GameSaver.kt index a4e90756e2..fbc0d34cfe 100644 --- a/core/src/com/unciv/logic/GameSaver.kt +++ b/core/src/com/unciv/logic/GameSaver.kt @@ -3,7 +3,7 @@ package com.unciv.logic import com.badlogic.gdx.Gdx import com.badlogic.gdx.files.FileHandle import com.badlogic.gdx.utils.Json -import com.unciv.ui.GameSettings +import com.unciv.GameSettings class GameSaver { private val saveFilesFolder = "SaveFiles" @@ -34,7 +34,7 @@ class GameSaver { return Gdx.files.local("GameSettings.json") } - fun getGeneralSettings():GameSettings{ + fun getGeneralSettings(): GameSettings { val settingsFile = getGeneralSettingsFile() if(!settingsFile.exists()) return GameSettings() return Json().fromJson(GameSettings::class.java, settingsFile) diff --git a/core/src/com/unciv/logic/battle/Battle.kt b/core/src/com/unciv/logic/battle/Battle.kt index e3a602dbae..f49a91777c 100644 --- a/core/src/com/unciv/logic/battle/Battle.kt +++ b/core/src/com/unciv/logic/battle/Battle.kt @@ -153,5 +153,4 @@ class Battle(val gameInfo:GameInfo=UnCivGame.Current.gameInfo) { capturedUnit.civInfo = attacker.getCivilization() capturedUnit.owner = capturedUnit.civInfo.civName } -} - +} \ No newline at end of file diff --git a/core/src/com/unciv/logic/city/CityInfo.kt b/core/src/com/unciv/logic/city/CityInfo.kt index 52ed6251cc..0c779cecab 100644 --- a/core/src/com/unciv/logic/city/CityInfo.kt +++ b/core/src/com/unciv/logic/city/CityInfo.kt @@ -9,7 +9,7 @@ import com.unciv.logic.map.TileMap import com.unciv.models.gamebasics.GameBasics import com.unciv.models.gamebasics.tile.ResourceType import com.unciv.models.gamebasics.tile.TileResource -import com.unciv.models.linq.Counter +import com.unciv.models.Counter import com.unciv.models.stats.Stats import kotlin.math.min diff --git a/core/src/com/unciv/logic/civilization/CivilizationInfo.kt b/core/src/com/unciv/logic/civilization/CivilizationInfo.kt index 5cf74f6758..6da4bb47d8 100644 --- a/core/src/com/unciv/logic/civilization/CivilizationInfo.kt +++ b/core/src/com/unciv/logic/civilization/CivilizationInfo.kt @@ -9,10 +9,10 @@ import com.unciv.logic.map.RoadStatus import com.unciv.logic.map.TileInfo import com.unciv.models.gamebasics.Civilization import com.unciv.models.gamebasics.GameBasics -import com.unciv.models.gamebasics.TechEra +import com.unciv.models.gamebasics.tech.TechEra import com.unciv.models.gamebasics.tile.ResourceType import com.unciv.models.gamebasics.tile.TileResource -import com.unciv.models.linq.Counter +import com.unciv.models.Counter import com.unciv.models.stats.Stats import com.unciv.ui.utils.getRandom import kotlin.math.max diff --git a/core/src/com/unciv/logic/civilization/ScienceVictoryManager.kt b/core/src/com/unciv/logic/civilization/ScienceVictoryManager.kt index 2c21a32c57..3fae5d6d64 100644 --- a/core/src/com/unciv/logic/civilization/ScienceVictoryManager.kt +++ b/core/src/com/unciv/logic/civilization/ScienceVictoryManager.kt @@ -1,6 +1,6 @@ package com.unciv.logic.civilization -import com.unciv.models.linq.Counter +import com.unciv.models.Counter class ScienceVictoryManager { diff --git a/core/src/com/unciv/logic/civilization/TechManager.kt b/core/src/com/unciv/logic/civilization/TechManager.kt index 87d87d1b41..e6f61a2290 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.models.gamebasics.GameBasics -import com.unciv.models.gamebasics.Technology +import com.unciv.models.gamebasics.tech.Technology import com.unciv.models.gamebasics.unit.Unit import com.unciv.ui.utils.tr import java.util.* diff --git a/core/src/com/unciv/logic/map/TileInfo.kt b/core/src/com/unciv/logic/map/TileInfo.kt index 76338db56d..896ac8f82b 100644 --- a/core/src/com/unciv/logic/map/TileInfo.kt +++ b/core/src/com/unciv/logic/map/TileInfo.kt @@ -112,7 +112,7 @@ open class TileInfo { if (improvement.improvingTech != null && observingCiv.tech.isResearched(improvement.improvingTech!!)) stats.add(improvement.improvingTechStats!!) // eg Chemistry for mines if (improvement.name == "Trading post" && city != null && city.civInfo.policies.isAdopted("Free Thought")) stats.science += 1f - if (listOf("Academy", "Landmark", "Manufactory", "Customs House").contains(improvement.name) && observingCiv.policies.isAdopted("Freedom Complete")) + if (improvement.name in listOf("Academy", "Landmark", "Manufactory", "Customs house") && observingCiv.policies.isAdopted("Freedom Complete")) stats.add(improvement) // again, for the double effect } diff --git a/core/src/com/unciv/models/linq/Counter.java b/core/src/com/unciv/models/Counter.java similarity index 96% rename from core/src/com/unciv/models/linq/Counter.java rename to core/src/com/unciv/models/Counter.java index 759684f204..3e23b005fa 100644 --- a/core/src/com/unciv/models/linq/Counter.java +++ b/core/src/com/unciv/models/Counter.java @@ -1,4 +1,4 @@ -package com.unciv.models.linq; +package com.unciv.models; import java.util.LinkedHashMap; diff --git a/core/src/com/unciv/models/gamebasics/Building.kt b/core/src/com/unciv/models/gamebasics/Building.kt index 3987e34a2f..b12a0cc734 100644 --- a/core/src/com/unciv/models/gamebasics/Building.kt +++ b/core/src/com/unciv/models/gamebasics/Building.kt @@ -2,6 +2,7 @@ package com.unciv.models.gamebasics import com.unciv.logic.city.CityConstructions import com.unciv.logic.city.IConstruction +import com.unciv.models.gamebasics.tech.Technology import com.unciv.models.stats.NamedStats import com.unciv.models.stats.Stats import com.unciv.ui.utils.tr diff --git a/core/src/com/unciv/models/gamebasics/GameBasics.kt b/core/src/com/unciv/models/gamebasics/GameBasics.kt index caaa660bce..e52446a273 100644 --- a/core/src/com/unciv/models/gamebasics/GameBasics.kt +++ b/core/src/com/unciv/models/gamebasics/GameBasics.kt @@ -2,6 +2,8 @@ package com.unciv.models.gamebasics import com.badlogic.gdx.Gdx import com.badlogic.gdx.utils.Json +import com.unciv.models.gamebasics.tech.TechColumn +import com.unciv.models.gamebasics.tech.Technology import com.unciv.models.gamebasics.tile.Terrain import com.unciv.models.gamebasics.tile.TileImprovement import com.unciv.models.gamebasics.tile.TileResource diff --git a/core/src/com/unciv/models/gamebasics/PolicyBranch.kt b/core/src/com/unciv/models/gamebasics/PolicyBranch.kt index 027bccdbfa..ac0ad94c72 100644 --- a/core/src/com/unciv/models/gamebasics/PolicyBranch.kt +++ b/core/src/com/unciv/models/gamebasics/PolicyBranch.kt @@ -1,6 +1,8 @@ package com.unciv.models.gamebasics +import com.unciv.models.gamebasics.tech.TechEra + class PolicyBranch : Policy() { var policies: ArrayList = arrayListOf() - lateinit var era:TechEra + lateinit var era: TechEra } diff --git a/core/src/com/unciv/models/gamebasics/TechColumn.kt b/core/src/com/unciv/models/gamebasics/tech/TechColumn.kt similarity index 57% rename from core/src/com/unciv/models/gamebasics/TechColumn.kt rename to core/src/com/unciv/models/gamebasics/tech/TechColumn.kt index 764056d9ba..dc62f42591 100644 --- a/core/src/com/unciv/models/gamebasics/TechColumn.kt +++ b/core/src/com/unciv/models/gamebasics/tech/TechColumn.kt @@ -1,4 +1,4 @@ -package com.unciv.models.gamebasics +package com.unciv.models.gamebasics.tech import java.util.* @@ -12,13 +12,3 @@ class TechColumn { } -enum class TechEra{ - Ancient, - Classical, - Medieval, - Renaissance, - Industrial, - Modern, - Information, - Future -} \ No newline at end of file diff --git a/core/src/com/unciv/models/gamebasics/tech/TechEra.kt b/core/src/com/unciv/models/gamebasics/tech/TechEra.kt new file mode 100644 index 0000000000..181b8255ad --- /dev/null +++ b/core/src/com/unciv/models/gamebasics/tech/TechEra.kt @@ -0,0 +1,12 @@ +package com.unciv.models.gamebasics.tech + +enum class TechEra{ + Ancient, + Classical, + Medieval, + Renaissance, + Industrial, + Modern, + Information, + Future +} \ No newline at end of file diff --git a/core/src/com/unciv/models/gamebasics/Technology.kt b/core/src/com/unciv/models/gamebasics/tech/Technology.kt similarity index 95% rename from core/src/com/unciv/models/gamebasics/Technology.kt rename to core/src/com/unciv/models/gamebasics/tech/Technology.kt index f6a1fe88f1..f267d5f681 100644 --- a/core/src/com/unciv/models/gamebasics/Technology.kt +++ b/core/src/com/unciv/models/gamebasics/tech/Technology.kt @@ -1,6 +1,8 @@ -package com.unciv.models.gamebasics +package com.unciv.models.gamebasics.tech import com.unciv.UnCivGame +import com.unciv.models.gamebasics.GameBasics +import com.unciv.models.gamebasics.ICivilopedia import com.unciv.ui.utils.tr import java.util.* diff --git a/core/src/com/unciv/ui/pickerscreens/TechPickerScreen.kt b/core/src/com/unciv/ui/pickerscreens/TechPickerScreen.kt index 85b106ffa6..4258304e13 100644 --- a/core/src/com/unciv/ui/pickerscreens/TechPickerScreen.kt +++ b/core/src/com/unciv/ui/pickerscreens/TechPickerScreen.kt @@ -6,7 +6,7 @@ import com.badlogic.gdx.scenes.scene2d.ui.TextButton import com.unciv.logic.civilization.CivilizationInfo import com.unciv.logic.civilization.TechManager import com.unciv.models.gamebasics.GameBasics -import com.unciv.models.gamebasics.Technology +import com.unciv.models.gamebasics.tech.Technology import com.unciv.ui.utils.CameraStageBaseScreen import com.unciv.ui.utils.addClickListener import com.unciv.ui.utils.disable @@ -60,7 +60,7 @@ class TechPickerScreen(internal val civInfo: CivilizationInfo) : PickerScreen() selectTechnology(tech) } topTable.add(TB) - if(eras[j].text.toString()=="") eras[j].setText(tech.era().toString()) + if(eras[j].text.toString()=="") eras[j].setText(tech.era().toString().tr()) } } }