OptionsPopup with two experimental switches: Spectator mode, Extended Map editor. (#2834)

This commit is contained in:
Alexander Korolyov 2020-07-12 11:59:32 +02:00 committed by GitHub
parent 438a4dbaff
commit c51879cc5f
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
15 changed files with 81 additions and 87 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.3 KiB

View file

@ -433,49 +433,49 @@ BuildingIcons/Opera House
index: -1
BuildingIcons/Oxford University
rotate: false
xy: 1430, 186
xy: 716, 173
size: 100, 100
orig: 100, 100
offset: 0, 0
index: -1
BuildingIcons/Palace
rotate: false
xy: 716, 173
xy: 818, 172
size: 100, 100
orig: 100, 100
offset: 0, 0
index: -1
BuildingIcons/Paper Maker
rotate: false
xy: 206, 116
xy: 308, 116
size: 100, 100
orig: 100, 100
offset: 0, 0
index: -1
BuildingIcons/Pentagon
rotate: false
xy: 614, 116
xy: 1532, 106
size: 100, 100
orig: 100, 100
offset: 0, 0
index: -1
BuildingIcons/Porcelain Tower
rotate: false
xy: 1226, 84
xy: 1430, 84
size: 100, 100
orig: 100, 100
offset: 0, 0
index: -1
BuildingIcons/Public School
rotate: false
xy: 818, 70
xy: 206, 14
size: 100, 100
orig: 100, 100
offset: 0, 0
index: -1
BuildingIcons/Research Lab
rotate: false
xy: 1940, 4
xy: 2, 2
size: 100, 100
orig: 100, 100
offset: 0, 0
@ -748,35 +748,35 @@ ImprovementIcons/Oil well
index: -1
ImprovementIcons/Pasture
rotate: false
xy: 410, 116
xy: 512, 116
size: 100, 100
orig: 100, 100
offset: 0, 0
index: -1
ImprovementIcons/Plantation
rotate: false
xy: 920, 84
xy: 1022, 84
size: 100, 100
orig: 100, 100
offset: 0, 0
index: -1
ImprovementIcons/Quarry
rotate: false
xy: 308, 14
xy: 410, 14
size: 100, 100
orig: 100, 100
offset: 0, 0
index: -1
ImprovementIcons/Railroad
rotate: false
xy: 1532, 4
xy: 1634, 4
size: 100, 100
orig: 100, 100
offset: 0, 0
index: -1
TileSets/Default/Railroad
rotate: false
xy: 1532, 4
xy: 1634, 4
size: 100, 100
orig: 100, 100
offset: 0, 0
@ -902,14 +902,14 @@ NationIcons/Mongolia
index: -1
NationIcons/Persia
rotate: false
xy: 1634, 106
xy: 1736, 106
size: 100, 100
orig: 100, 100
offset: 0, 0
index: -1
NationIcons/Polynesia
rotate: false
xy: 1124, 84
xy: 1226, 84
size: 100, 100
orig: 100, 100
offset: 0, 0
@ -1005,30 +1005,37 @@ OtherIcons/New
orig: 100, 100
offset: 0, 0
index: -1
OtherIcons/Options
rotate: false
xy: 1430, 186
size: 100, 100
orig: 100, 100
offset: 0, 0
index: -1
OtherIcons/Pentagon
rotate: false
xy: 1532, 106
xy: 1634, 106
size: 100, 100
orig: 100, 100
offset: 0, 0
index: -1
OtherIcons/Pillage
rotate: false
xy: 104, 88
xy: 920, 84
size: 100, 100
orig: 100, 100
offset: 0, 0
index: -1
OtherIcons/Puppet
rotate: false
xy: 206, 14
xy: 308, 14
size: 100, 100
orig: 100, 100
offset: 0, 0
index: -1
OtherIcons/Quickstart
rotate: false
xy: 410, 14
xy: 512, 14
size: 100, 100
orig: 100, 100
offset: 0, 0
@ -1168,7 +1175,7 @@ ResourceIcons/Oil
index: -1
ResourceIcons/Pearls
rotate: false
xy: 512, 116
xy: 614, 116
size: 100, 100
orig: 100, 100
offset: 0, 0
@ -1236,13 +1243,6 @@ StatIcons/Production
orig: 200, 200
offset: 0, 0
index: -1
StatIcons/Resistance
rotate: false
xy: 2, 2
size: 100, 100
orig: 100, 100
offset: 0, 0
index: -1
StatIcons/Science
rotate: false
xy: 1541, 1642
@ -1609,84 +1609,84 @@ TechIcons/Optics
index: -1
TechIcons/Particle Physics
rotate: false
xy: 308, 116
xy: 410, 116
size: 100, 100
orig: 100, 100
offset: 0, 0
index: -1
TechIcons/Pharmaceuticals
rotate: false
xy: 1838, 106
xy: 1940, 106
size: 100, 100
orig: 100, 100
offset: 0, 0
index: -1
TechIcons/Philosophy
rotate: false
xy: 1940, 106
xy: 2, 104
size: 100, 100
orig: 100, 100
offset: 0, 0
index: -1
TechIcons/Physics
rotate: false
xy: 2, 104
xy: 1328, 90
size: 100, 100
orig: 100, 100
offset: 0, 0
index: -1
TechIcons/Plastics
rotate: false
xy: 1022, 84
xy: 1124, 84
size: 100, 100
orig: 100, 100
offset: 0, 0
index: -1
TechIcons/Pottery
rotate: false
xy: 1430, 84
xy: 716, 71
size: 100, 100
orig: 100, 100
offset: 0, 0
index: -1
TechIcons/Printing Press
rotate: false
xy: 716, 71
xy: 818, 70
size: 100, 100
orig: 100, 100
offset: 0, 0
index: -1
TechIcons/Radar
rotate: false
xy: 512, 14
xy: 614, 14
size: 100, 100
orig: 100, 100
offset: 0, 0
index: -1
TechIcons/Radio
rotate: false
xy: 614, 14
xy: 1532, 4
size: 100, 100
orig: 100, 100
offset: 0, 0
index: -1
TechIcons/Railroad
rotate: false
xy: 1634, 4
xy: 1736, 4
size: 100, 100
orig: 100, 100
offset: 0, 0
index: -1
TechIcons/Refrigeration
rotate: false
xy: 1736, 4
xy: 1838, 4
size: 100, 100
orig: 100, 100
offset: 0, 0
index: -1
TechIcons/Replaceable Parts
rotate: false
xy: 1838, 4
xy: 1940, 4
size: 100, 100
orig: 100, 100
offset: 0, 0
@ -2274,21 +2274,21 @@ UnitIcons/Nuclear Missile
index: -1
UnitIcons/Panzer
rotate: false
xy: 818, 172
xy: 206, 116
size: 100, 100
orig: 100, 100
offset: 0, 0
index: -1
UnitIcons/Persian Immortal
rotate: false
xy: 1736, 106
xy: 1838, 106
size: 100, 100
orig: 100, 100
offset: 0, 0
index: -1
UnitIcons/Pikeman
rotate: false
xy: 1328, 90
xy: 104, 88
size: 100, 100
orig: 100, 100
offset: 0, 0
@ -2301,35 +2301,35 @@ filter: MipMapLinearLinear,MipMapLinearLinear
repeat: none
BuildingIcons/SS Booster
rotate: false
xy: 308, 922
xy: 2, 514
size: 100, 100
orig: 100, 100
offset: 0, 0
index: -1
BuildingIcons/SS Cockpit
rotate: false
xy: 2, 514
xy: 104, 616
size: 100, 100
orig: 100, 100
offset: 0, 0
index: -1
BuildingIcons/SS Engine
rotate: false
xy: 104, 616
xy: 206, 718
size: 100, 100
orig: 100, 100
offset: 0, 0
index: -1
BuildingIcons/SS Stasis Chamber
rotate: false
xy: 206, 718
xy: 308, 820
size: 100, 100
orig: 100, 100
offset: 0, 0
index: -1
BuildingIcons/Satrap's Court
rotate: false
xy: 104, 514
xy: 206, 616
size: 100, 100
orig: 100, 100
offset: 0, 0
@ -2525,7 +2525,7 @@ BuildingIcons/Workshop
index: -1
ImprovementIcons/Road
rotate: false
xy: 2, 718
xy: 104, 820
size: 100, 100
orig: 100, 100
offset: 0, 0
@ -2546,14 +2546,14 @@ ImprovementIcons/Trading post
index: -1
NationIcons/Rome
rotate: false
xy: 104, 718
xy: 206, 820
size: 100, 100
orig: 100, 100
offset: 0, 0
index: -1
NationIcons/Russia
rotate: false
xy: 206, 820
xy: 308, 922
size: 100, 100
orig: 100, 100
offset: 0, 0
@ -2609,19 +2609,12 @@ OtherIcons/Down
index: -1
OtherIcons/Resume
rotate: false
xy: 2, 922
xy: 2, 820
size: 100, 100
orig: 100, 100
offset: 0, 0
index: -1
OtherIcons/Scenario
rotate: false
xy: 206, 616
size: 100, 100
orig: 100, 100
offset: 0, 0
index: -1
OtherIcons/Scenario_old
rotate: false
xy: 308, 718
size: 100, 100
@ -3041,6 +3034,13 @@ StatIcons/RangedStrength
orig: 50, 50
offset: 0, 0
index: -1
StatIcons/Resistance
rotate: false
xy: 2, 922
size: 100, 100
orig: 100, 100
offset: 0, 0
index: -1
StatIcons/Specialist
rotate: false
xy: 206, 310
@ -3050,35 +3050,35 @@ StatIcons/Specialist
index: -1
TechIcons/Rifling
rotate: false
xy: 104, 922
xy: 2, 718
size: 100, 100
orig: 100, 100
offset: 0, 0
index: -1
TechIcons/Robotics
rotate: false
xy: 104, 820
xy: 206, 922
size: 100, 100
orig: 100, 100
offset: 0, 0
index: -1
TechIcons/Rocketry
rotate: false
xy: 2, 616
xy: 104, 718
size: 100, 100
orig: 100, 100
offset: 0, 0
index: -1
TechIcons/Sailing
rotate: false
xy: 308, 820
xy: 410, 922
size: 100, 100
orig: 100, 100
offset: 0, 0
index: -1
TechIcons/Satellites
rotate: false
xy: 2, 412
xy: 104, 514
size: 100, 100
orig: 100, 100
offset: 0, 0
@ -4821,21 +4821,21 @@ TileSets/FantasyHex/Units/Work Boats
index: -1
UnitIcons/Rifleman
rotate: false
xy: 2, 820
xy: 104, 922
size: 100, 100
orig: 100, 100
offset: 0, 0
index: -1
UnitIcons/Rocket Artillery
rotate: false
xy: 206, 922
xy: 2, 616
size: 100, 100
orig: 100, 100
offset: 0, 0
index: -1
UnitIcons/Samurai
rotate: false
xy: 410, 922
xy: 2, 412
size: 100, 100
orig: 100, 100
offset: 0, 0

Binary file not shown.

Before

Width:  |  Height:  |  Size: 878 KiB

After

Width:  |  Height:  |  Size: 872 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 455 KiB

After

Width:  |  Height:  |  Size: 460 KiB

View file

@ -145,7 +145,7 @@ class MainMenuScreen: CameraStageBaseScreen() {
loadMapButton.background = tableBackground
mapEditorPopup.add(loadMapButton).row()
if (UncivGame.Current.scenarioDebugSwitch) {
if (UncivGame.Current.settings.extendedMapEditor) {
val loadScenarioButton = getTableBlock("Load scenario", "OtherIcons/Scenario") {
val loadScenarioScreen = LoadScenarioScreen(null)
loadScenarioScreen.closeButton.isVisible = true

View file

@ -58,9 +58,6 @@ class UncivGame(parameters: UncivGameParameters) : Game() {
/** Console log battles
*/
val alertBattle = false
/** Debug new Scenario functionality
*/
val scenarioDebugSwitch = false
lateinit var worldScreen: WorldScreen

View file

@ -36,6 +36,8 @@ class GameSettings {
var isFreshlyCreated = false
var minimapSize = 20
var minimapSquare = false
var extendedMapEditor = false
var spectatorMode = false
init {
// 26 = Android Oreo. Versions below may display permanent icon in notification bar.

View file

@ -36,7 +36,7 @@ class MapEditorMenuPopup(var mapEditorScreen: MapEditorScreen): Popup(mapEditorS
addCopyMapAsTextButton()
addLoadMapButton()
addUploadMapButton()
if (UncivGame.Current.scenarioDebugSwitch) {
if (UncivGame.Current.settings.extendedMapEditor) {
addScenarioButton()
addSaveScenarioButton()
addLoadScenarioButton()

View file

@ -60,7 +60,7 @@ class TileEditorOptionsTable(val mapEditorScreen: MapEditorScreen): Table(Camera
tabPickerTable.add(improvementsButton)
// debug Scenario mode
if (UncivGame.Current.scenarioDebugSwitch && mapEditorScreen.hasScenario()) {
if (UncivGame.Current.settings.extendedMapEditor && mapEditorScreen.hasScenario()) {
val unitsButton = "Units".toTextButton().onClick { setUnits() }
tabPickerTable.add(unitsButton)
}
@ -163,7 +163,7 @@ class TileEditorOptionsTable(val mapEditorScreen: MapEditorScreen): Table(Camera
val nationTable = Table()
if (UncivGame.Current.scenarioDebugSwitch) {
if (UncivGame.Current.settings.extendedMapEditor) {
/** new scenario/improvements functionality
* We shouldn't be able to edit random players or spectators
* */

View file

@ -29,7 +29,7 @@ class MapOptionsTable(val newGameScreen: NewGameScreen): Table() {
add("{Map Type}:".toLabel())
val mapTypes = arrayListOf("Generated")
if (MapSaver.getMaps().isNotEmpty()) mapTypes.add(MapType.custom)
if (MapSaver.getScenarios().isNotEmpty() && UncivGame.Current.scenarioDebugSwitch) mapTypes.add(MapType.scenario)
if (MapSaver.getScenarios().isNotEmpty() && UncivGame.Current.settings.extendedMapEditor) mapTypes.add(MapType.scenario)
val mapTypeSelectBox = TranslatedSelectBox(mapTypes, "Generated", CameraStageBaseScreen.skin)
val mapFileSelectBox = getMapFileSelectBox()

View file

@ -21,8 +21,6 @@ import kotlin.concurrent.thread
class GameSetupInfo(var gameId:String, var gameParameters: GameParameters, var mapParameters: MapParameters) {
// var ruleset = RulesetCache.getComplexRuleset(gameParameters.mods)
constructor() : this("", GameParameters(), MapParameters())
constructor(gameInfo: GameInfo) : this("", gameInfo.gameParameters.clone(), gameInfo.tileMap.mapParameters)
constructor(gameParameters: GameParameters, mapParameters: MapParameters) : this("", gameParameters, mapParameters)
@ -63,14 +61,6 @@ class NewGameScreen(previousScreen:CameraStageBaseScreen, _gameSetupInfo: GameSe
return@onClick
}
if (gameSetupInfo.gameParameters.players.count { it.chosenCiv == Constants.spectator } > 1) {
val noMoreSpectatorsPopup = Popup(this)
noMoreSpectatorsPopup.addGoodSizedLabel("Sorry! No more than one spectator for the moment".tr()).row()
noMoreSpectatorsPopup.addCloseButton()
noMoreSpectatorsPopup.open()
return@onClick
}
if (gameSetupInfo.gameParameters.isOnlineMultiplayer) {
for (player in gameSetupInfo.gameParameters.players.filter { it.playerType == PlayerType.Human }) {
try {

View file

@ -25,7 +25,7 @@ import kotlin.reflect.typeOf
/**
* This [Table] is used to pick or edit players information for new game/scenario creation.
* Could be inserted to [NewGameScreen], [GameParametersScreen] or any other [Screen]
* which provides [GameSetupInfo] for ruleset and updates.
* which provides [GameSetupInfo] and [Ruleset].
* Upon player changes updates property [gameParameters]. Also updates available nations when mod changes.
* In case it is used in map editor, as a part of [GameParametersScreen], additionally tries to
* update units/starting location on the [previousScreen] when player deleted or
@ -273,8 +273,10 @@ class PlayerPickerTable(val previousScreen: IPreviousScreen, var gameParameters:
private fun getAvailablePlayerCivs(): ArrayList<Nation> {
var nations = ArrayList<Nation>()
for (nation in previousScreen.ruleset.nations.values
.filter { it.isMajorCiv() }) {
if (gameParameters.players.any { it.chosenCiv == nation.name && it.chosenCiv != Constants.spectator})
.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)
}

View file

@ -118,6 +118,9 @@ 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 }
addSoundEffectsVolumeSlider()
addMusicVolumeSlider()
addTranslationGeneration()

View file

@ -526,6 +526,7 @@ Unless otherwise specified, all the following are from [the Noun Project](https:
* [New](https://thenounproject.com/search/?q=new&i=1886943) by Alice Design for New Game
* [Go back](https://thenounproject.com/search/?q=go%20back&i=1901947) by Salvia Santos for Resume
* [Multiplayer](https://thenounproject.com/search/?q=multiplayer&i=1215652) by Roy Charles
* [Options](https://thenounproject.com/search/?q=options&i=866090) By Thengakola
# Sound credits

View file

@ -43,7 +43,6 @@ class BasicTests {
&& !game.viewEntireMapForDebug
&& game.simulateUntilTurnForDebug <= 0
&& !game.simulateUntilWin
&& !game.scenarioDebugSwitch
&& !game.consoleMode
)
}