Added initial mod management screen
Changed turn icon to hourglass, per the change in the Discord poll
This commit is contained in:
parent
3fdcbeeef6
commit
353b6e71f8
11 changed files with 516 additions and 447 deletions
Binary file not shown.
Before Width: | Height: | Size: 2 KiB After Width: | Height: | Size: 1.4 KiB |
BIN
android/Images/EmojiIcons/TurnOld.png
Normal file
BIN
android/Images/EmojiIcons/TurnOld.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 2 KiB |
File diff suppressed because it is too large
Load diff
Binary file not shown.
Before Width: | Height: | Size: 482 KiB After Width: | Height: | Size: 481 KiB |
|
@ -18,6 +18,7 @@ import com.unciv.ui.MultiplayerScreen
|
|||
import com.unciv.ui.mapeditor.*
|
||||
import com.unciv.ui.newgamescreen.GameSetupInfo
|
||||
import com.unciv.ui.newgamescreen.NewGameScreen
|
||||
import com.unciv.ui.pickerscreens.ModManagementScreen
|
||||
import com.unciv.ui.saves.LoadGameScreen
|
||||
import com.unciv.ui.utils.*
|
||||
import kotlin.concurrent.thread
|
||||
|
@ -95,15 +96,17 @@ class MainMenuScreen: CameraStageBaseScreen() {
|
|||
|
||||
val multiplayerTable = getTableBlock("Multiplayer", "OtherIcons/Multiplayer")
|
||||
{ game.setScreen(MultiplayerScreen(this)) }
|
||||
column1.add(multiplayerTable).row()
|
||||
column2.add(multiplayerTable).row()
|
||||
|
||||
val mapEditorScreenTable = getTableBlock("Map editor", "OtherIcons/MapEditor")
|
||||
{ if(stage.actors.none { it is MapEditorMainScreenPopup }) MapEditorMainScreenPopup(this) }
|
||||
column1.add(mapEditorScreenTable).row()
|
||||
{ if(stage.actors.none { it is MapEditorMainScreenPopup }) MapEditorMainScreenPopup(this) }
|
||||
column2.add(mapEditorScreenTable).row()
|
||||
|
||||
// val modsTable = getTableBlock("Mods", "OtherIcons/Mods")
|
||||
// { if(stage.actors.none { it is MapEditorMainScreenPopup }) MapEditorMainScreenPopup(this) }
|
||||
// column2.add(modEditorTable).row()
|
||||
if(game.settings.showModManager) {
|
||||
val modsTable = getTableBlock("Mods", "OtherIcons/Mods")
|
||||
{ game.setScreen(ModManagementScreen()) }
|
||||
column2.add(modsTable).row()
|
||||
}
|
||||
|
||||
|
||||
val table=Table().apply { defaults().pad(10f) }
|
||||
|
|
|
@ -34,10 +34,8 @@ class GameSettings {
|
|||
var orderTradeOffersByAmount = true
|
||||
var windowState = WindowState()
|
||||
var isFreshlyCreated = false
|
||||
var minimapSize = 20
|
||||
var minimapSquare = false
|
||||
var extendedMapEditor = false
|
||||
var spectatorMode = false
|
||||
var showModManager = false
|
||||
|
||||
init {
|
||||
// 26 = Android Oreo. Versions below may display permanent icon in notification bar.
|
||||
|
|
|
@ -17,6 +17,7 @@ import com.unciv.models.ruleset.tile.TileResource
|
|||
import com.unciv.models.ruleset.unit.BaseUnit
|
||||
import com.unciv.models.ruleset.unit.Promotion
|
||||
import com.unciv.models.stats.INamed
|
||||
import java.lang.StringBuilder
|
||||
import kotlin.collections.set
|
||||
|
||||
object ModOptionsConstants {
|
||||
|
@ -183,6 +184,17 @@ class Ruleset {
|
|||
}
|
||||
|
||||
fun getEraNumber(era:String) = getEras().indexOf(era)
|
||||
fun getSummary(): String {
|
||||
val stringList = ArrayList<String>()
|
||||
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")
|
||||
stringList += ""
|
||||
return stringList.joinToString()
|
||||
}
|
||||
}
|
||||
|
||||
/** Loading mods is expensive, so let's only do it once and
|
||||
|
@ -190,6 +202,7 @@ class Ruleset {
|
|||
* */
|
||||
object RulesetCache :HashMap<String,Ruleset>() {
|
||||
fun loadRulesets(consoleMode:Boolean=false) {
|
||||
clear()
|
||||
for (ruleset in BaseRuleset.values()) {
|
||||
val fileName = "jsons/${ruleset.fullName}"
|
||||
val fileHandle = if (consoleMode) FileHandle(fileName)
|
||||
|
|
|
@ -276,8 +276,6 @@ class PlayerPickerTable(val previousScreen: IPreviousScreen, var gameParameters:
|
|||
.filter { it.isMajorCiv() || it.isSpectator() }) {
|
||||
if (gameParameters.players.any { it.chosenCiv == nation.name })
|
||||
continue
|
||||
if (!UncivGame.Current.settings.spectatorMode && nation.isSpectator())
|
||||
continue
|
||||
nations.add(nation)
|
||||
}
|
||||
return nations
|
||||
|
|
|
@ -45,4 +45,5 @@ class GreatPersonPickerScreen(val civInfo:CivilizationInfo) : PickerScreen() {
|
|||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
49
core/src/com/unciv/ui/pickerscreens/ModManagementScreen.kt
Normal file
49
core/src/com/unciv/ui/pickerscreens/ModManagementScreen.kt
Normal file
|
@ -0,0 +1,49 @@
|
|||
package com.unciv.ui.pickerscreens
|
||||
|
||||
import com.badlogic.gdx.Gdx
|
||||
import com.badlogic.gdx.scenes.scene2d.ui.Table
|
||||
import com.badlogic.gdx.scenes.scene2d.utils.ClickListener
|
||||
import com.unciv.MainMenuScreen
|
||||
import com.unciv.models.ruleset.Ruleset
|
||||
import com.unciv.models.ruleset.RulesetCache
|
||||
import com.unciv.models.translations.tr
|
||||
import com.unciv.ui.utils.*
|
||||
|
||||
class ModManagementScreen: PickerScreen() {
|
||||
|
||||
val modTable = Table().apply { defaults().pad(10f) }
|
||||
|
||||
init {
|
||||
setDefaultCloseAction(MainMenuScreen())
|
||||
refresh()
|
||||
|
||||
topTable.add(modTable)
|
||||
}
|
||||
|
||||
fun refresh(){
|
||||
modTable.clear()
|
||||
val currentMods = RulesetCache.values.filter { it.name != "" }
|
||||
for (mod in currentMods) {
|
||||
val button = mod.name.toTextButton().onClick {
|
||||
rightSideButton.setText("Delete [${mod.name}]".tr())
|
||||
rightSideButton.enable()
|
||||
descriptionLabel.setText(mod.getSummary())
|
||||
rightSideButton.listeners.filter { it != rightSideButton.clickListener }
|
||||
.forEach { rightSideButton.removeListener(it) }
|
||||
rightSideButton.onClick {
|
||||
YesNoPopup("Are you SURE you want to delete this mod?",
|
||||
{ deleteMod(mod) }, this).open()
|
||||
}
|
||||
}
|
||||
modTable.add(button).row()
|
||||
}
|
||||
}
|
||||
|
||||
fun deleteMod(mod: Ruleset){
|
||||
val modFileHandle = Gdx.files.local("mods").child(mod.name)
|
||||
if(modFileHandle.isDirectory) modFileHandle.deleteDirectory()
|
||||
else modFileHandle.delete()
|
||||
RulesetCache.loadRulesets()
|
||||
refresh()
|
||||
}
|
||||
}
|
|
@ -119,7 +119,7 @@ class WorldScreenOptionsPopup(val worldScreen:WorldScreen) : Popup(worldScreen)
|
|||
addHeader("Other options")
|
||||
|
||||
addYesNoRow("Extended map editor", settings.extendedMapEditor) { settings.extendedMapEditor = it }
|
||||
addYesNoRow("Experimental spectator mode", settings.spectatorMode) { settings.spectatorMode = it }
|
||||
addYesNoRow("Experimental mod manager", settings.showModManager) { settings.showModManager = it }
|
||||
|
||||
addSoundEffectsVolumeSlider()
|
||||
addMusicVolumeSlider()
|
||||
|
|
Loading…
Reference in a new issue