New game wizard : Added performance information about the selected campaigns.

This commit is contained in:
Khopa 2021-01-22 23:07:17 +01:00
parent 91ac368a19
commit 097c42d1dd
23 changed files with 118 additions and 32 deletions

View File

@ -10,13 +10,13 @@ from jinja2 import Environment, FileSystemLoader, select_autoescape
from game import db
from game.settings import Settings
from game.theater.start_generator import GameGenerator, GeneratorSettings
from qt_ui.widgets.spinsliders import TenthsSpinSlider
from qt_ui.windows.newgame.QCampaignList import (
Campaign,
QCampaignList,
load_campaigns,
)
from game.theater.start_generator import GameGenerator, GeneratorSettings
jinja_env = Environment(
loader=FileSystemLoader("resources/ui/templates"),
@ -272,14 +272,21 @@ class TheaterConfiguration(QtWidgets.QWizardPage):
# Faction description
self.campaignMapDescription = QTextEdit("")
self.campaignMapDescription.setReadOnly(True)
self.campaignMapDescription.setMaximumHeight(150)
self.performanceText = QTextEdit("")
self.performanceText.setReadOnly(True)
self.performanceText.setMaximumHeight(150)
def on_campaign_selected():
template = jinja_env.get_template("campaigntemplate_EN.j2")
template_perf = jinja_env.get_template("campaign_performance_template_EN.j2")
index = campaignList.selectionModel().currentIndex().row()
campaign = campaignList.campaigns[index]
self.setField("selectedCampaign", campaign)
self.campaignMapDescription.setText(template.render({"campaign": campaign}))
self.faction_selection.setDefaultFactions(campaign)
self.performanceText.setText(template_perf.render({"performance": campaign.performance}))
campaignList.selectionModel().setCurrentIndex(campaignList.indexAt(QPoint(1, 1)), QItemSelectionModel.Rows)
campaignList.selectionModel().selectionChanged.connect(on_campaign_selected)
@ -292,11 +299,6 @@ class TheaterConfiguration(QtWidgets.QWizardPage):
mapSettingsLayout = QtWidgets.QGridLayout()
mapSettingsLayout.addWidget(QtWidgets.QLabel("Invert Map"), 0, 0)
mapSettingsLayout.addWidget(invertMap, 0, 1)
#mapSettingsLayout.addWidget(QtWidgets.QLabel("Start at mid game"), 1, 0)
#midgame = QtWidgets.QCheckBox()
#self.registerField('midGame', midgame)
#mapSettingsLayout.addWidget(midgame, 1, 1)
mapSettingsGroup.setLayout(mapSettingsLayout)
# Time Period
@ -310,7 +312,6 @@ class TheaterConfiguration(QtWidgets.QWizardPage):
# Register fields
self.registerField('timePeriod', timePeriodSelect)
self.registerField('timePeriod', timePeriodSelect)
timeGroupLayout = QtWidgets.QGridLayout()
timeGroupLayout.addWidget(timePeriod, 0, 0)
@ -319,10 +320,11 @@ class TheaterConfiguration(QtWidgets.QWizardPage):
layout = QtWidgets.QGridLayout()
layout.setColumnMinimumWidth(0, 20)
layout.addWidget(campaignList, 0, 0, 3, 1)
layout.addWidget(campaignList, 0, 0, 4, 1)
layout.addWidget(self.campaignMapDescription, 0, 1, 1, 1)
layout.addWidget(mapSettingsGroup, 1, 1, 1, 1)
layout.addWidget(timeGroup, 2, 1, 1, 1)
layout.addWidget(self.performanceText, 1, 1, 1, 1)
layout.addWidget(mapSettingsGroup, 2, 1, 1, 1)
layout.addWidget(timeGroup, 3, 1, 1, 1)
self.setLayout(layout)

View File

@ -5,5 +5,6 @@
"recommended_player_faction": "United Kingdom 1944",
"recommended_enemy_faction": "Germany 1942",
"description": "<p>Experience the Battle of Britain on the Channel map !<br/></p><p><strong>Note:</strong> It is not possible to cross the channel to capture enemy bases yet, but you can consider you won if you manage to destroy all the ennemy targets</p>",
"miz": "battle_of_britain.miz"
"miz": "battle_of_britain.miz",
"performance": 1
}

View File

@ -3,5 +3,6 @@
"theater": "Caucasus",
"authors": "Colonel Panic",
"description": "<p>A medium sized theater with bases along the coast of the Black Sea.</p>",
"miz": "black_sea.miz"
"miz": "black_sea.miz",
"performance": 1
}

View File

@ -5,5 +5,6 @@
"recommended_player_faction": "USA 2005",
"recommended_enemy_faction": "Iran 2015",
"description": "<p>This is a simple scenario in the Desert near Dubai and Abu-Dhabi. Progress from Liwa airbase to Al-Minhad.</p><p>This scenario shouldn't require too much performance.</p>",
"miz": "desert_war.miz"
"miz": "desert_war.miz",
"performance": 1
}

View File

@ -5,5 +5,6 @@
"recommended_player_faction": "Allies 1944",
"recommended_enemy_faction": "Germany 1942",
"description": "<p>In this scenario, your forces starts in Dunkirk and can be supported by the airfields on the other side of the Channel.</p><p>If you select the inverted configuration, you can play a German invasion of England.</p><p><strong>Note:</strong> B-17 should be operated from Manston airfield</p>",
"miz": "dunkirk.miz"
"miz": "dunkirk.miz",
"performance": 1
}

View File

@ -5,5 +5,6 @@
"recommended_player_faction": "USA 2005",
"recommended_enemy_faction": "Iran 2015",
"description": "<p>In this scenario, you can play an invasion of the Emirates and Oman, where your forces starts in Fujairah.</p><p><strong>Note:</strong> Fujairah airfield has very few slots for aircrafts, so it recommended to operate from carriers at the start of the campaign. Thus, a carrier-capable faction is recommended.</p>",
"miz": "emirates.miz"
"miz": "emirates.miz",
"performance": 1
}

View File

@ -3,5 +3,6 @@
"theater": "Caucasus",
"authors": "george",
"description": "<p>Full map of the Caucasus</p><p><strong>Note:</strong> This scenario is heavy on performance, enabling \"culling\" in settings is highly recommended.</p>",
"miz": "full_caucasus.miz"
"miz": "full_caucasus.miz",
"performance": 3
}

View File

@ -5,5 +5,6 @@
"recommended_player_faction": "Israel 2000",
"recommended_enemy_faction": "Syria 2011",
"description": "<p>In this scenario, you start in Israel and the conflict is focused around the golan heights, an historically disputed territory.<br/><br/>You can use the inverted configuration to start on the Syrian side.<br/><br/>If this scenario is too heavy, try the lite version.</p>",
"miz": "golan_heights.miz"
"miz": "golan_heights.miz",
"performance": 2
}

View File

@ -5,5 +5,6 @@
"recommended_player_faction": "Israel 2000",
"recommended_enemy_faction": "Syria 2011",
"description": "<p>In this scenario, you start in Israel and the conflict is focused around the golan heights, an historically disputed territory.<br/><br/>This scenario is designed to be performance friendly.</p>",
"miz": "golan_heights_lite.miz"
"miz": "golan_heights_lite.miz",
"performance": 1
}

View File

@ -5,5 +5,6 @@
"recommended_player_faction": "USA 2005",
"recommended_enemy_faction": "Insurgents (Hard)",
"description": "<p>In this scenario, you start from Jordan, and have to fight your way through eastern Syria.</p>",
"miz": "inherent_resolve.miz"
"miz": "inherent_resolve.miz",
"performance": 1
}

View File

@ -5,5 +5,6 @@
"recommended_player_faction": "Turkey 2005",
"recommended_enemy_faction": "Insurgents (Hard)",
"description": "<p>In this scenario, you start from Turkey and have to invade territories in northern Syria.</p>",
"miz": "invasion_from_turkey.miz"
"miz": "invasion_from_turkey.miz",
"performance": 1
}

View File

@ -5,5 +5,6 @@
"recommended_player_faction": "USA 2005",
"recommended_enemy_faction": "Iran 2015",
"description": "<p>In this scenario, you start in Bandar Abbas, and must invade Iran.</p>",
"miz": "invasion_of_iran.miz"
"miz": "invasion_of_iran.miz",
"performance": 3
}

View File

@ -5,5 +5,6 @@
"recommended_player_faction": "USA 2005",
"recommended_enemy_faction": "Iran 2015",
"description": "<p>This is lighter version of the invasion of Iran scenario.</p>",
"miz": "invasion_of_iran_lite.miz"
"miz": "invasion_of_iran_lite.miz",
"performance": 1
}

View File

@ -4,7 +4,7 @@
"authors": "Khopa",
"recommended_player_faction": "Allies 1944",
"recommended_enemy_faction": "Germany 1944",
"performance": 3,
"description": "<p>Normandy 1944 D-Day scenario.</p>",
"miz":"normandy.miz"
"miz":"normandy.miz",
"performance": 3
}

View File

@ -5,5 +5,6 @@
"recommended_player_faction": "Allies 1944",
"recommended_enemy_faction": "Germany 1944",
"description": "<p>A lighter version of the Normandy 1944 D-Day scenario.</p>",
"miz": "normandy_small.miz"
"miz": "normandy_small.miz",
"performance": 2
}

View File

@ -97,5 +97,6 @@
"Maykop-Khanskaya",
"Mineralnye Vody"
]
]
],
"performance": 1
}

View File

@ -3,5 +3,6 @@
"theater": "Persian Gulf",
"authors": "Plob",
"description": "<p>Full map of the Persian Gulf</p><p><strong>Note:</strong> This scenario is heavy on performance, enabling \"culling\" in settings is highly recommended.</p>",
"miz": "persian_gulf_full_map.miz"
"miz": "persian_gulf_full_map.miz",
"performance": 3
}

View File

@ -4,7 +4,7 @@
"authors": "Khopa",
"recommended_player_faction": "Russia 2010",
"recommended_enemy_faction": "USA 1990",
"performance": "heavy",
"description": "<p>A small theater in Russia, progress from Mozdok to Maykop.</p><p>This scenario is pretty simple, it is ideal if you want to run a short campaign. If your PC is not powerful, this is also the less performance heavy scenario.</p>",
"miz": "russia_small.miz"
"miz": "russia_small.miz",
"performance": 0
}

View File

@ -3,5 +3,6 @@
"theater": "Syria",
"authors": "Hawkmoon",
"description": "<p>Full map of Syria</p><p><strong>Note:</strong>For a better early game experience is suggested to give the AI an high amount of starting money This scenario is heavy on performance, enabling \"culling\" in settings is highly recommended.</p>",
"miz": "syria_full_map_remastered.miz"
"miz": "syria_full_map_remastered.miz",
"performance": 3
}

View File

@ -5,5 +5,6 @@
"recommended_player_faction": "Russia 2010",
"recommended_enemy_faction": "Insurgents (Hard)",
"description": "<p>This scenario can be used to simulate parts of the Syrian Civil War.<br/><br/>You start on the coast with an airbase in Latakia, and ground forces in Tartus.<br/><br/>This scenario can also be used to simulate a western invasion of Syria.<br/><br/>In inverted configuration you start in Aleppo.</p>",
"miz": "syrian_civil_war.miz"
"miz": "syrian_civil_war.miz",
"performance": 2
}

View File

@ -109,5 +109,6 @@
"Gudauta",
"Sochi-Adler"
]
]
],
"performance": 1
}

View File

@ -0,0 +1,33 @@
{% if performance == 0 %}
<div style="color:#82A466">
{% elif performance == 1 %}
<div style="color:yellow">
{% elif performance == 2 %}
<div style="color:orange">
{% else %}
<div style="color:red">
{%endif %}
<strong>Performance impact :&nbsp;</strong> {{performance}}/3
{% if performance == 0 %}
<p>
This scenario is rather performance friendly.
</p>
{% elif performance == 1 %}
<p>
This scenario requires a very good computer to run.
</p>
{% elif performance == 2 %}
<p>
This scenario is not performance friendly. The usage of the culling settings is recommended for most users.
</p>
{% elif performance == 3 %}
<p>
This theater is huge, and will generate very complex DCS missions with hundreds of units, pushing the limits of DCS engine.
An insanely powerful computer will be necessary to run it.
Usage of culling settings will probably be mandatory for decent FPS.
</p>
{%endif %}
</div>

View File

@ -0,0 +1,33 @@
{% if performance == 0 %}
<div style="color:#82A466">
{% elif performance == 1 %}
<div style="color:yellow">
{% elif performance == 2 %}
<div style="color:orange">
{% else %}
<div style="color:red">
{%endif %}
<strong>Impact sur les performances :&nbsp;</strong> {{performance}}/3
{% if performance == 0 %}
<p>
Ce scénario est d'une taille limitée et pensé pour obtenir de bonnes performances en jeu.
</p>
{% elif performance == 1 %}
<p>
Ce scénario nécessite une machine puissante.
</p>
{% elif performance == 2 %}
<p>
Ce scénario n'est pas pensé pour la performance et requiert une machine très puissante.
L'usage des paramètres "culling" est recommandé pour la plupart des utilisateurs.
</p>
{% elif performance == 3 %}
<p>
Ce scénario est gigantesque, et générera des missions DCS d'une grande compléxité contenant des centaines/milliers d'unités.
Une machine extrêmement puissante est nécessaire, et l'utilisation des paramètres de "culling" sera obligatoire pour des performances décentes.
</p>
{%endif %}
</div>