Minor Scenarios UX improvements (#11466)

* Give "Scenarios" its own icon

* A little more wiki info on the console

* Minor ScenarioScreen UX improvements
This commit is contained in:
SomeTroglodyte
2024-04-15 22:55:25 +02:00
committed by GitHub
parent 12adc0d65a
commit 8ef90cbaf1
9 changed files with 160 additions and 121 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.4 KiB

View File

@ -41,105 +41,105 @@ CityStateIcons/Religious
index: -1 index: -1
EmojiIcons/Automate EmojiIcons/Automate
rotate: false rotate: false
xy: 1123, 1622 xy: 1347, 1753
size: 50, 50 size: 50, 50
orig: 50, 50 orig: 50, 50
offset: 0, 0 offset: 0, 0
index: -1 index: -1
EmojiIcons/Culture EmojiIcons/Culture
rotate: false rotate: false
xy: 1388, 1753 xy: 1521, 1753
size: 50, 50 size: 50, 50
orig: 50, 50 orig: 50, 50
offset: 0, 0 offset: 0, 0
index: -1 index: -1
EmojiIcons/Death EmojiIcons/Death
rotate: false rotate: false
xy: 1446, 1753 xy: 1579, 1753
size: 50, 50 size: 50, 50
orig: 50, 50 orig: 50, 50
offset: 0, 0 offset: 0, 0
index: -1 index: -1
EmojiIcons/Faith EmojiIcons/Faith
rotate: false rotate: false
xy: 1504, 1753 xy: 1637, 1753
size: 50, 50 size: 50, 50
orig: 50, 50 orig: 50, 50
offset: 0, 0 offset: 0, 0
index: -1 index: -1
EmojiIcons/Food EmojiIcons/Food
rotate: false rotate: false
xy: 1562, 1753 xy: 1695, 1753
size: 50, 50 size: 50, 50
orig: 50, 50 orig: 50, 50
offset: 0, 0 offset: 0, 0
index: -1 index: -1
EmojiIcons/Gold EmojiIcons/Gold
rotate: false rotate: false
xy: 1678, 1753 xy: 1811, 1753
size: 50, 50 size: 50, 50
orig: 50, 50 orig: 50, 50
offset: 0, 0 offset: 0, 0
index: -1 index: -1
EmojiIcons/Great Artist EmojiIcons/Great Artist
rotate: false rotate: false
xy: 1736, 1753 xy: 1869, 1753
size: 50, 50 size: 50, 50
orig: 50, 50 orig: 50, 50
offset: 0, 0 offset: 0, 0
index: -1 index: -1
EmojiIcons/Great Engineer EmojiIcons/Great Engineer
rotate: false rotate: false
xy: 1794, 1753 xy: 1231, 1695
size: 50, 50 size: 50, 50
orig: 50, 50 orig: 50, 50
offset: 0, 0 offset: 0, 0
index: -1 index: -1
EmojiIcons/Great General EmojiIcons/Great General
rotate: false rotate: false
xy: 1852, 1753 xy: 1289, 1695
size: 50, 50 size: 50, 50
orig: 50, 50 orig: 50, 50
offset: 0, 0 offset: 0, 0
index: -1 index: -1
EmojiIcons/Great Merchant EmojiIcons/Great Merchant
rotate: false rotate: false
xy: 1910, 1753 xy: 1347, 1695
size: 50, 50 size: 50, 50
orig: 50, 50 orig: 50, 50
offset: 0, 0 offset: 0, 0
index: -1 index: -1
EmojiIcons/Great Scientist EmojiIcons/Great Scientist
rotate: false rotate: false
xy: 946, 1536 xy: 1405, 1695
size: 50, 50 size: 50, 50
orig: 50, 50 orig: 50, 50
offset: 0, 0 offset: 0, 0
index: -1 index: -1
EmojiIcons/Happiness EmojiIcons/Happiness
rotate: false rotate: false
xy: 946, 1478 xy: 1463, 1695
size: 50, 50 size: 50, 50
orig: 50, 50 orig: 50, 50
offset: 0, 0 offset: 0, 0
index: -1 index: -1
EmojiIcons/Production EmojiIcons/Production
rotate: false rotate: false
xy: 1297, 1637 xy: 946, 1536
size: 50, 50 size: 50, 50
orig: 50, 50 orig: 50, 50
offset: 0, 0 offset: 0, 0
index: -1 index: -1
EmojiIcons/Science EmojiIcons/Science
rotate: false rotate: false
xy: 1413, 1695 xy: 1214, 1637
size: 50, 50 size: 50, 50
orig: 50, 50 orig: 50, 50
offset: 0, 0 offset: 0, 0
index: -1 index: -1
EmojiIcons/Turn EmojiIcons/Turn
rotate: false rotate: false
xy: 1471, 1695 xy: 1330, 1637
size: 50, 50 size: 50, 50
orig: 50, 50 orig: 50, 50
offset: 0, 0 offset: 0, 0
@ -384,14 +384,14 @@ ImprovementIcons/Road
index: -1 index: -1
ImprovementIcons/Terrace farm ImprovementIcons/Terrace farm
rotate: false rotate: false
xy: 1108, 1811 xy: 1216, 1811
size: 100, 100 size: 100, 100
orig: 100, 100 orig: 100, 100
offset: 0, 0 offset: 0, 0
index: -1 index: -1
ImprovementIcons/Trading post ImprovementIcons/Trading post
rotate: false rotate: false
xy: 1324, 1811 xy: 1432, 1811
size: 100, 100 size: 100, 100
orig: 100, 100 orig: 100, 100
offset: 0, 0 offset: 0, 0
@ -431,27 +431,6 @@ StatIcons/Faith
orig: 100, 100 orig: 100, 100
offset: 0, 0 offset: 0, 0
index: -1 index: -1
NotificationIcons/Loading
rotate: false
xy: 220, 451
size: 100, 100
orig: 100, 100
offset: 0, 0
index: -1
NotificationIcons/Working
rotate: false
xy: 220, 451
size: 100, 100
orig: 100, 100
offset: 0, 0
index: -1
OtherIcons/Loading
rotate: false
xy: 220, 451
size: 100, 100
orig: 100, 100
offset: 0, 0
index: -1
NotificationIcons/PickConstruction NotificationIcons/PickConstruction
rotate: false rotate: false
xy: 436, 683 xy: 436, 683
@ -468,7 +447,7 @@ StatIcons/Production
index: -1 index: -1
NotificationIcons/PickPolicy NotificationIcons/PickPolicy
rotate: false rotate: false
xy: 298, 1320 xy: 2009, 1986
size: 33, 33 size: 33, 33
orig: 33, 33 orig: 33, 33
offset: 0, 0 offset: 0, 0
@ -496,42 +475,42 @@ OtherIcons/AirSweep
index: -1 index: -1
OtherIcons/Aircraft OtherIcons/Aircraft
rotate: false rotate: false
xy: 1123, 1680 xy: 1231, 1753
size: 50, 50 size: 50, 50
orig: 50, 50 orig: 50, 50
offset: 0, 0 offset: 0, 0
index: -1 index: -1
OtherIcons/ArrowRight OtherIcons/ArrowRight
rotate: false rotate: false
xy: 1214, 1753 xy: 1289, 1753
size: 50, 50 size: 50, 50
orig: 50, 50 orig: 50, 50
offset: 0, 0 offset: 0, 0
index: -1 index: -1
NotificationIcons/MoveAutomatedUnits NotificationIcons/MoveAutomatedUnits
rotate: false rotate: false
xy: 1214, 1753 xy: 1289, 1753
size: 50, 50 size: 50, 50
orig: 50, 50 orig: 50, 50
offset: 0, 0 offset: 0, 0
index: -1 index: -1
NotificationIcons/NextUnit NotificationIcons/NextUnit
rotate: false rotate: false
xy: 1214, 1753 xy: 1289, 1753
size: 50, 50 size: 50, 50
orig: 50, 50 orig: 50, 50
offset: 0, 0 offset: 0, 0
index: -1 index: -1
StatIcons/Movement StatIcons/Movement
rotate: false rotate: false
xy: 1214, 1753 xy: 1289, 1753
size: 50, 50 size: 50, 50
orig: 50, 50 orig: 50, 50
offset: 0, 0 offset: 0, 0
index: -1 index: -1
OtherIcons/BackArrow OtherIcons/BackArrow
rotate: false rotate: false
xy: 1272, 1753 xy: 1405, 1753
size: 50, 50 size: 50, 50
orig: 50, 50 orig: 50, 50
offset: 0, 0 offset: 0, 0
@ -559,7 +538,7 @@ OtherIcons/Blockade
index: -1 index: -1
OtherIcons/Camera OtherIcons/Camera
rotate: false rotate: false
xy: 946, 1387 xy: 298, 1328
size: 25, 25 size: 25, 25
orig: 25, 25 orig: 25, 25
offset: 0, 0 offset: 0, 0
@ -601,7 +580,7 @@ OtherIcons/Cities
index: -1 index: -1
OtherIcons/CityState OtherIcons/CityState
rotate: false rotate: false
xy: 1330, 1753 xy: 1463, 1753
size: 50, 50 size: 50, 50
orig: 50, 50 orig: 50, 50
offset: 0, 0 offset: 0, 0
@ -664,7 +643,7 @@ OtherIcons/Fire
index: -1 index: -1
OtherIcons/ForwardArrow OtherIcons/ForwardArrow
rotate: false rotate: false
xy: 1620, 1753 xy: 1753, 1753
size: 50, 50 size: 50, 50
orig: 50, 50 orig: 50, 50
offset: 0, 0 offset: 0, 0
@ -685,7 +664,7 @@ OtherIcons/HexagonOutline
index: -1 index: -1
OtherIcons/Improvements OtherIcons/Improvements
rotate: false rotate: false
xy: 946, 1420 xy: 1521, 1695
size: 50, 50 size: 50, 50
orig: 50, 50 orig: 50, 50
offset: 0, 0 offset: 0, 0
@ -711,9 +690,30 @@ OtherIcons/Load
orig: 100, 100 orig: 100, 100
offset: 0, 0 offset: 0, 0
index: -1 index: -1
OtherIcons/Loading
rotate: false
xy: 220, 451
size: 100, 100
orig: 100, 100
offset: 0, 0
index: -1
NotificationIcons/Loading
rotate: false
xy: 220, 451
size: 100, 100
orig: 100, 100
offset: 0, 0
index: -1
NotificationIcons/Working
rotate: false
xy: 220, 451
size: 100, 100
orig: 100, 100
offset: 0, 0
index: -1
OtherIcons/LockSmall OtherIcons/LockSmall
rotate: false rotate: false
xy: 1972, 1803 xy: 1637, 1695
size: 50, 50 size: 50, 50
orig: 50, 50 orig: 50, 50
offset: 0, 0 offset: 0, 0
@ -755,7 +755,7 @@ OtherIcons/NationSwap
index: -1 index: -1
OtherIcons/Nations OtherIcons/Nations
rotate: false rotate: false
xy: 1239, 1637 xy: 1927, 1753
size: 50, 50 size: 50, 50
orig: 50, 50 orig: 50, 50
offset: 0, 0 offset: 0, 0
@ -783,7 +783,7 @@ OtherIcons/Options
index: -1 index: -1
OtherIcons/Pause OtherIcons/Pause
rotate: false rotate: false
xy: 1297, 1695 xy: 1927, 1695
size: 50, 50 size: 50, 50
orig: 50, 50 orig: 50, 50
offset: 0, 0 offset: 0, 0
@ -886,79 +886,86 @@ OtherIcons/Resume
orig: 100, 100 orig: 100, 100
offset: 0, 0 offset: 0, 0
index: -1 index: -1
OtherIcons/Search OtherIcons/Scenarios
rotate: false rotate: false
xy: 760, 794 xy: 760, 794
size: 100, 100 size: 100, 100
orig: 100, 100 orig: 100, 100
offset: 0, 0 offset: 0, 0
index: -1 index: -1
OtherIcons/SecretOptions OtherIcons/Search
rotate: false rotate: false
xy: 760, 686 xy: 760, 686
size: 100, 100 size: 100, 100
orig: 100, 100 orig: 100, 100
offset: 0, 0 offset: 0, 0
index: -1 index: -1
OtherIcons/Settings OtherIcons/SecretOptions
rotate: false rotate: false
xy: 760, 578 xy: 760, 578
size: 100, 100 size: 100, 100
orig: 100, 100 orig: 100, 100
offset: 0, 0 offset: 0, 0
index: -1 index: -1
OtherIcons/Settings
rotate: false
xy: 760, 470
size: 100, 100
orig: 100, 100
offset: 0, 0
index: -1
OtherIcons/Shield OtherIcons/Shield
rotate: false rotate: false
xy: 760, 362 xy: 760, 254
size: 100, 100 size: 100, 100
orig: 100, 100 orig: 100, 100
offset: 0, 0 offset: 0, 0
index: -1 index: -1
OtherIcons/Sleep OtherIcons/Sleep
rotate: false rotate: false
xy: 760, 38 xy: 784, 1796
size: 100, 100 size: 100, 100
orig: 100, 100 orig: 100, 100
offset: 0, 0 offset: 0, 0
index: -1 index: -1
OtherIcons/Speaker OtherIcons/Speaker
rotate: false rotate: false
xy: 784, 1796 xy: 799, 1688
size: 100, 100 size: 100, 100
orig: 100, 100 orig: 100, 100
offset: 0, 0 offset: 0, 0
index: -1 index: -1
OtherIcons/Spy OtherIcons/Spy
rotate: false rotate: false
xy: 838, 1472 xy: 838, 1364
size: 100, 100 size: 100, 100
orig: 100, 100 orig: 100, 100
offset: 0, 0 offset: 0, 0
index: -1 index: -1
OtherIcons/Spy_White OtherIcons/Spy_White
rotate: false rotate: false
xy: 838, 1364 xy: 898, 1256
size: 100, 100 size: 100, 100
orig: 100, 100 orig: 100, 100
offset: 0, 0 offset: 0, 0
index: -1 index: -1
OtherIcons/Star OtherIcons/Star
rotate: false rotate: false
xy: 898, 1262 xy: 898, 1154
size: 100, 94 size: 100, 94
orig: 100, 94 orig: 100, 94
offset: 0, 0 offset: 0, 0
index: -1 index: -1
OtherIcons/Swap OtherIcons/Swap
rotate: false rotate: false
xy: 1000, 1811 xy: 1108, 1811
size: 100, 100 size: 100, 100
orig: 100, 100 orig: 100, 100
offset: 0, 0 offset: 0, 0
index: -1 index: -1
OtherIcons/Timer OtherIcons/Timer
rotate: false rotate: false
xy: 1216, 1811 xy: 1324, 1811
size: 100, 100 size: 100, 100
orig: 100, 100 orig: 100, 100
offset: 0, 0 offset: 0, 0
@ -972,35 +979,35 @@ OtherIcons/Triangle
index: -1 index: -1
OtherIcons/Turn right OtherIcons/Turn right
rotate: false rotate: false
xy: 1540, 1811 xy: 1648, 1811
size: 100, 100 size: 100, 100
orig: 100, 100 orig: 100, 100
offset: 0, 0 offset: 0, 0
index: -1 index: -1
OtherIcons/Tyrannosaurus OtherIcons/Tyrannosaurus
rotate: false rotate: false
xy: 1648, 1811 xy: 1756, 1811
size: 100, 100 size: 100, 100
orig: 100, 100 orig: 100, 100
offset: 0, 0 offset: 0, 0
index: -1 index: -1
OtherIcons/WLTKD OtherIcons/WLTKD
rotate: false rotate: false
xy: 1123, 1738 xy: 1123, 1630
size: 83, 65 size: 83, 65
orig: 83, 65 orig: 83, 65
offset: 0, 0 offset: 0, 0
index: -1 index: -1
OtherIcons/Wait OtherIcons/Wait
rotate: false rotate: false
xy: 1864, 1811 xy: 907, 1702
size: 100, 100 size: 100, 100
orig: 100, 100 orig: 100, 100
offset: 0, 0 offset: 0, 0
index: -1 index: -1
OtherIcons/Wonders OtherIcons/Wonders
rotate: false rotate: false
xy: 1015, 1595 xy: 1123, 1703
size: 100, 100 size: 100, 100
orig: 100, 100 orig: 100, 100
offset: 0, 0 offset: 0, 0
@ -1182,77 +1189,77 @@ ResourceIcons/Salt
index: -1 index: -1
ResourceIcons/Sheep ResourceIcons/Sheep
rotate: false rotate: false
xy: 760, 470 xy: 760, 362
size: 100, 100 size: 100, 100
orig: 100, 100 orig: 100, 100
offset: 0, 0 offset: 0, 0
index: -1 index: -1
ResourceIcons/Silk ResourceIcons/Silk
rotate: false rotate: false
xy: 760, 254 xy: 760, 146
size: 100, 100 size: 100, 100
orig: 100, 100 orig: 100, 100
offset: 0, 0 offset: 0, 0
index: -1 index: -1
ResourceIcons/Silver ResourceIcons/Silver
rotate: false rotate: false
xy: 760, 146 xy: 760, 38
size: 100, 100 size: 100, 100
orig: 100, 100 orig: 100, 100
offset: 0, 0 offset: 0, 0
index: -1 index: -1
ResourceIcons/Spices ResourceIcons/Spices
rotate: false rotate: false
xy: 799, 1580 xy: 838, 1472
size: 100, 100 size: 100, 100
orig: 100, 100 orig: 100, 100
offset: 0, 0 offset: 0, 0
index: -1 index: -1
ResourceIcons/Stone ResourceIcons/Stone
rotate: false rotate: false
xy: 898, 1154 xy: 892, 1810
size: 100, 100 size: 100, 100
orig: 100, 100 orig: 100, 100
offset: 0, 0 offset: 0, 0
index: -1 index: -1
ResourceIcons/Sugar ResourceIcons/Sugar
rotate: false rotate: false
xy: 892, 1810 xy: 1000, 1811
size: 100, 100 size: 100, 100
orig: 100, 100 orig: 100, 100
offset: 0, 0 offset: 0, 0
index: -1 index: -1
ResourceIcons/Truffles ResourceIcons/Truffles
rotate: false rotate: false
xy: 1432, 1811 xy: 1540, 1811
size: 100, 100 size: 100, 100
orig: 100, 100 orig: 100, 100
offset: 0, 0 offset: 0, 0
index: -1 index: -1
ResourceIcons/Uranium ResourceIcons/Uranium
rotate: false rotate: false
xy: 1756, 1811 xy: 1864, 1811
size: 100, 100 size: 100, 100
orig: 100, 100 orig: 100, 100
offset: 0, 0 offset: 0, 0
index: -1 index: -1
ResourceIcons/Whales ResourceIcons/Whales
rotate: false rotate: false
xy: 907, 1702 xy: 907, 1594
size: 100, 100 size: 100, 100
orig: 100, 100 orig: 100, 100
offset: 0, 0 offset: 0, 0
index: -1 index: -1
ResourceIcons/Wheat ResourceIcons/Wheat
rotate: false rotate: false
xy: 907, 1594 xy: 1015, 1703
size: 100, 100 size: 100, 100
orig: 100, 100 orig: 100, 100
offset: 0, 0 offset: 0, 0
index: -1 index: -1
ResourceIcons/Wine ResourceIcons/Wine
rotate: false rotate: false
xy: 1015, 1703 xy: 1015, 1595
size: 100, 100 size: 100, 100
orig: 100, 100 orig: 100, 100
offset: 0, 0 offset: 0, 0
@ -1301,7 +1308,7 @@ StatIcons/Happiness
index: -1 index: -1
StatIcons/InterceptRange StatIcons/InterceptRange
rotate: false rotate: false
xy: 1972, 1861 xy: 1579, 1695
size: 50, 50 size: 50, 50
orig: 50, 50 orig: 50, 50
offset: 0, 0 offset: 0, 0
@ -1329,14 +1336,14 @@ TileIcons/Worked
index: -1 index: -1
StatIcons/Range StatIcons/Range
rotate: false rotate: false
xy: 1355, 1695 xy: 946, 1478
size: 50, 50 size: 50, 50
orig: 50, 50 orig: 50, 50
offset: 0, 0 offset: 0, 0
index: -1 index: -1
StatIcons/RangedStrength StatIcons/RangedStrength
rotate: false rotate: false
xy: 1355, 1637 xy: 946, 1420
size: 50, 50 size: 50, 50
orig: 50, 50 orig: 50, 50
offset: 0, 0 offset: 0, 0
@ -1357,14 +1364,14 @@ StatIcons/Resistance
index: -1 index: -1
StatIcons/Specialist StatIcons/Specialist
rotate: false rotate: false
xy: 799, 1688 xy: 799, 1580
size: 100, 100 size: 100, 100
orig: 100, 100 orig: 100, 100
offset: 0, 0 offset: 0, 0
index: -1 index: -1
StatIcons/Strength StatIcons/Strength
rotate: false rotate: false
xy: 1413, 1637 xy: 1272, 1637
size: 50, 50 size: 50, 50
orig: 50, 50 orig: 50, 50
offset: 0, 0 offset: 0, 0
@ -1399,28 +1406,28 @@ TileIcons/Locked
index: -1 index: -1
TileIcons/MapOverlayToggleMovement TileIcons/MapOverlayToggleMovement
rotate: false rotate: false
xy: 1968, 1745 xy: 1695, 1695
size: 50, 50 size: 50, 50
orig: 50, 50 orig: 50, 50
offset: 0, 0 offset: 0, 0
index: -1 index: -1
TileIcons/MapOverlayToggleResources TileIcons/MapOverlayToggleResources
rotate: false rotate: false
xy: 1181, 1680 xy: 1753, 1695
size: 50, 50 size: 50, 50
orig: 50, 50 orig: 50, 50
offset: 0, 0 offset: 0, 0
index: -1 index: -1
TileIcons/MapOverlayToggleWorkedTiles TileIcons/MapOverlayToggleWorkedTiles
rotate: false rotate: false
xy: 1181, 1622 xy: 1811, 1695
size: 50, 50 size: 50, 50
orig: 50, 50 orig: 50, 50
offset: 0, 0 offset: 0, 0
index: -1 index: -1
TileIcons/MapOverlayToggleYields TileIcons/MapOverlayToggleYields
rotate: false rotate: false
xy: 1239, 1695 xy: 1869, 1695
size: 50, 50 size: 50, 50
orig: 50, 50 orig: 50, 50
offset: 0, 0 offset: 0, 0

Binary file not shown.

Before

Width:  |  Height:  |  Size: 534 KiB

After

Width:  |  Height:  |  Size: 536 KiB

View File

@ -1869,6 +1869,8 @@ Stars ↓ =
Status ↓ = Status ↓ =
Scenarios = Scenarios =
Error loading scenario: =
Choose scenario =
# Uniques that are relevant to more than one type of game object # Uniques that are relevant to more than one type of game object

View File

@ -167,7 +167,7 @@ class MainMenuScreen: BaseScreen(), RecreateOnResize {
column2.add(modsTable).row() column2.add(modsTable).row()
if (game.files.getScenarioFiles().any()){ if (game.files.getScenarioFiles().any()){
val scenarioTable = getMenuButton("Scenarios", "OtherIcons/Mods", KeyboardBinding.Scenarios) val scenarioTable = getMenuButton("Scenarios", "OtherIcons/Scenarios", KeyboardBinding.Scenarios)
{ game.pushScreen(ScenarioScreen()) } { game.pushScreen(ScenarioScreen()) }
column2.add(scenarioTable).row() column2.add(scenarioTable).row()
} }

View File

@ -1,45 +1,65 @@
package com.unciv.ui.screens.mainmenuscreen package com.unciv.ui.screens.mainmenuscreen
import com.badlogic.gdx.files.FileHandle import com.badlogic.gdx.files.FileHandle
import com.unciv.logic.UncivShowableException
import com.unciv.models.translations.tr import com.unciv.models.translations.tr
import com.unciv.ui.components.extensions.enable import com.unciv.ui.components.extensions.enable
import com.unciv.ui.components.extensions.toTextButton import com.unciv.ui.components.input.KeyCharAndCode
import com.unciv.ui.components.input.onClick import com.unciv.ui.components.input.keyShortcuts
import com.unciv.ui.components.input.onActivation
import com.unciv.ui.components.input.onDoubleClick
import com.unciv.ui.popups.ToastPopup
import com.unciv.ui.screens.pickerscreens.PickerScreen import com.unciv.ui.screens.pickerscreens.PickerScreen
import com.unciv.ui.screens.savescreens.VerticalFileListScrollPane
import com.unciv.utils.Concurrency import com.unciv.utils.Concurrency
import com.unciv.utils.launchOnGLThread
class ScenarioScreen: PickerScreen() { class ScenarioScreen: PickerScreen(disableScroll = true) {
private val scenarioScrollPane = VerticalFileListScrollPane()
private var scenarioToLoad: FileHandle? = null private var scenarioToLoad: FileHandle? = null
init { /** Caches the mod names while the getScenarioFiles Sequence is iterated */
val scenarioFiles = game.files.getScenarioFiles() private val sourceMods = mutableMapOf<FileHandle, String>()
rightSideButton.setText("Choose scenario")
topTable.defaults().pad(5f)
Concurrency.run {
for ((file, mod) in scenarioFiles) {
try {
val scenarioPreview = game.files.loadGamePreviewFromFile(file)
Concurrency.runOnGLThread {
topTable.add(file.name().toTextButton().onClick {
descriptionLabel.setText("Mod: [${mod.name}]".tr())
scenarioToLoad = file
rightSideButton.setText(file.name())
rightSideButton.enable()
}).row()
}
} catch (ex: Exception) { } // invalid, couldn't even load preview, probably invalid json
}
}
rightSideButton.onClick { init {
if (scenarioToLoad != null) scenarioScrollPane.onChange(::selectScenario)
Concurrency.run { scenarioScrollPane.onDoubleClick(action = ::loadSelectedScenario)
val scenario = game.files.loadScenario(scenarioToLoad!!) topTable.defaults().pad(5f)
game.loadGame(scenario) topTable.add(scenarioScrollPane).grow().row()
}
} rightSideButton.setText("Choose scenario")
rightSideButton.onActivation(::loadSelectedScenario)
rightSideButton.keyShortcuts.add(KeyCharAndCode.RETURN)
setDefaultCloseAction() setDefaultCloseAction()
scenarioScrollPane.update(
game.files.getScenarioFiles().map {
sourceMods[it.first] = it.second.name
it.first
}
)
}
private fun selectScenario(file: FileHandle) {
descriptionLabel.setText(sourceMods[file]?.let { "Mod: [$it]".tr() })
scenarioToLoad = file
rightSideButton.setText(file.name())
rightSideButton.enable()
}
private fun loadSelectedScenario() {
val file = scenarioToLoad ?: return
Concurrency.run("LoadScenario") {
try {
val scenario = game.files.loadScenario(file)
game.loadGame(scenario)
} catch (ex: UncivShowableException) {
launchOnGLThread {
ToastPopup("{Error loading scenario:}\n{${ex.message}}", this@ScenarioScreen)
}
}
}
} }
} }

View File

@ -21,7 +21,6 @@ import com.unciv.utils.launchOnGLThread
/** A widget holding TextButtons vertically in a Table contained in a ScrollPane, with methods to /** A widget holding TextButtons vertically in a Table contained in a ScrollPane, with methods to
* hold file names and FileHandle's in those buttons. Used to display existing saves in the Load and Save game dialogs. * hold file names and FileHandle's in those buttons. Used to display existing saves in the Load and Save game dialogs.
* *
* @param shorcutScreen optionally pass in a [BaseScreen] where global keyboard shorcuts should be installed.
* @param existingSavesTable exists here for coder convenience. No need to touch. * @param existingSavesTable exists here for coder convenience. No need to touch.
*/ */
class VerticalFileListScrollPane( class VerticalFileListScrollPane(

View File

@ -748,7 +748,8 @@ Unless otherwise specified, all the following are from [the Noun Project](https:
- [Go back](https://thenounproject.com/icon/go%20back-1901947) by Salvia Santos for Resume - [Go back](https://thenounproject.com/icon/go%20back-1901947) by Salvia Santos for Resume
- [Multiplayer](https://thenounproject.com/icon/multiplayer-1215652) by Roy Charles - [Multiplayer](https://thenounproject.com/icon/multiplayer-1215652) by Roy Charles
- [Options](https://thenounproject.com/icon/options-866090) By Thengakola - [Options](https://thenounproject.com/icon/options-866090) By Thengakola
- [Package](https://thenounproject.com/icon/package-1886048) by shashank singh - [Package](https://thenounproject.com/icon/package-1886048) by shashank singh for Mods
- [scenario planning](https://thenounproject.com/icon/scenario-6569968) by nicolas for Scenarios
## Sound credits ## Sound credits

View File

@ -17,5 +17,15 @@ To create a scenario:
To open the console, click the `` button on your keyboard. To open the console, click the `` button on your keyboard.
To see available commands, click enter. This works for subcommands as well (e.g. when you entered `tile`) To see available commands, click enter. This works for subcommands as well (e.g. when you entered `tile`).
The console has autocompletion:
* Enter a partial command, subcommand or argument and hit Tab...
* When the entered part, compared from the start, matches exactly one of the possible options, that option is completed and a space added for the next subcommand or parameter.
* When no option matches, nothing happens.
* When two or more options match, the possibilities are displayed, and the longest common substring is entered for you (e.g. you enter 'c', Tab: commands 'city' or 'civ' match, the console partially completes 'ci' for you).
* When you haven't yet entered a partial text (console input is empty or ends in a space), autocompletion will display all options.
Some commands operate on a tile or unit you need to select on the map before opening the console.
The console does intentionally not follow all rules defined by the ruleset - e.g. it allows Farms on hills without fresh water or the Mobility promotion on a Worker. Any unexpected consequences are your responsibility.