Resolved #3035 - added nationsToRemove in modOptions

This commit is contained in:
Yair Morgenstern
2020-08-27 11:51:20 +03:00
parent 2c66b53b27
commit d2e914473a
2 changed files with 30 additions and 21 deletions

View File

@ -29,6 +29,7 @@ class ModOptions {
var techsToRemove = HashSet<String>()
var buildingsToRemove = HashSet<String>()
var unitsToRemove = HashSet<String>()
var nationsToRemove = HashSet<String>()
var uniques = HashSet<String>()
}
@ -77,6 +78,7 @@ class Ruleset {
unitPromotions.putAll(ruleset.unitPromotions)
units.putAll(ruleset.units)
for (unitToRemove in ruleset.modOptions.unitsToRemove) units.remove(unitToRemove)
for (nationToRemove in ruleset.modOptions.unitsToRemove) nations.remove(nationToRemove)
mods += ruleset.mods
}
@ -103,8 +105,8 @@ class Ruleset {
if (modOptionsFile.exists()) {
try {
modOptions = jsonParser.getFromJson(ModOptions::class.java, modOptionsFile)
} catch (ex: Exception) {
}
catch (ex:Exception){}
}
val techFile = folderHandle.child("Techs.json")
@ -186,12 +188,13 @@ class Ruleset {
fun getEraNumber(era: String) = getEras().indexOf(era)
fun getSummary(): String {
val stringList = ArrayList<String>()
if (modOptions.isBaseRuleset) stringList += "Base Ruleset\n"
if (technologies.isNotEmpty()) stringList.add(technologies.size.toString() + " Techs")
if (nations.isNotEmpty()) stringList.add(nations.size.toString() + " Nations")
if (units.isNotEmpty()) stringList.add(units.size.toString() + " Units")
if (buildings.isNotEmpty()) stringList.add(buildings.size.toString() + " Buildings")
if (tileResources.isNotEmpty()) stringList.add(tileResources.size.toString() + " Resources")
if (tileImprovements.isNotEmpty()) stringList.add(tileResources.size.toString() + " Improvements")
if (tileImprovements.isNotEmpty()) stringList.add(tileImprovements.size.toString() + " Improvements")
stringList += ""
return stringList.joinToString()
}

View File

@ -43,7 +43,13 @@ class ModManagementScreen: PickerScreen() {
removeRightSideClickListeners()
rightSideButton.enable()
rightSideButton.setText("Download [${repo.name}]".tr())
rightSideButton.onClick { downloadMod(repo.svn_url) }
rightSideButton.onClick {
rightSideButton.setText("Downloading...")
rightSideButton.disable()
downloadMod(repo.svn_url){
rightSideButton.setText("Done!".tr())
}
}
}
downloadTable.add(downloadButton).row()
}