mirror of
https://github.com/dcs-retribution/dcs-retribution.git
synced 2025-11-10 15:41:24 +00:00
Merge branch 'develop' into frontline_vector
This commit is contained in:
@@ -128,7 +128,7 @@ def parse_args() -> argparse.Namespace:
|
||||
def create_game(campaign_path: Path, blue: str, red: str,
|
||||
supercarrier: bool) -> Game:
|
||||
campaign = Campaign.from_json(campaign_path)
|
||||
generator = GameGenerator(blue, red, campaign.theater,
|
||||
generator = GameGenerator(blue, red, campaign.load_theater(),
|
||||
Settings(supercarrier=supercarrier),
|
||||
start_date=datetime.today(),
|
||||
starting_budget=650,
|
||||
|
||||
@@ -18,6 +18,7 @@ class QBudgetBox(QGroupBox):
|
||||
self.money_amount = QLabel()
|
||||
|
||||
self.finances = QPushButton("Details")
|
||||
self.finances.setDisabled(True)
|
||||
self.finances.setProperty("style", "btn-primary")
|
||||
self.finances.clicked.connect(self.openFinances)
|
||||
|
||||
@@ -36,8 +37,12 @@ class QBudgetBox(QGroupBox):
|
||||
self.money_amount.setText(str(budget) + "M (+" + str(reward) + "M)")
|
||||
|
||||
def setGame(self, game):
|
||||
if game is None:
|
||||
return
|
||||
|
||||
self.game = game
|
||||
self.setBudget(self.game.budget, self.game.budget_reward_amount)
|
||||
self.finances.setEnabled(True)
|
||||
|
||||
def openFinances(self):
|
||||
self.subwindow = QFinancesMenu(self.game)
|
||||
|
||||
@@ -60,11 +60,13 @@ class QTopPanel(QFrame):
|
||||
self.factionsInfos = QFactionsInfos(self.game)
|
||||
|
||||
self.settings = QPushButton("Settings")
|
||||
self.settings.setDisabled(True)
|
||||
self.settings.setIcon(CONST.ICONS["Settings"])
|
||||
self.settings.setProperty("style", "btn-primary")
|
||||
self.settings.clicked.connect(self.openSettings)
|
||||
|
||||
self.statistics = QPushButton("Statistics")
|
||||
self.statistics.setDisabled(True)
|
||||
self.statistics.setIcon(CONST.ICONS["Statistics"])
|
||||
self.statistics.setProperty("style", "btn-primary")
|
||||
self.statistics.clicked.connect(self.openStatisticsWindow)
|
||||
@@ -100,6 +102,9 @@ class QTopPanel(QFrame):
|
||||
if game is None:
|
||||
return
|
||||
|
||||
self.settings.setEnabled(True)
|
||||
self.statistics.setEnabled(True)
|
||||
|
||||
self.conditionsWidget.setCurrentTurn(game.turn, game.conditions)
|
||||
self.budgetBox.setGame(game)
|
||||
self.factionsInfos.setGame(game)
|
||||
|
||||
@@ -248,7 +248,7 @@ class QBuyGroupForGroundObjectDialog(QDialog):
|
||||
self.init_ui()
|
||||
|
||||
def init_ui(self):
|
||||
faction = self.game.player_name
|
||||
faction = self.game.player_faction
|
||||
|
||||
# Sams
|
||||
|
||||
@@ -268,7 +268,7 @@ class QBuyGroupForGroundObjectDialog(QDialog):
|
||||
|
||||
# Armored units
|
||||
|
||||
armored_units = db.find_unittype(PinpointStrike, faction) # Todo : refactor this legacy nonsense
|
||||
armored_units = db.find_unittype(PinpointStrike, faction.name) # Todo : refactor this legacy nonsense
|
||||
for unit in set(armored_units):
|
||||
self.buyArmorCombo.addItem(db.unit_type_name_2(unit) + " [$" + str(db.PRICES[unit]) + "M]", userData=unit)
|
||||
self.buyArmorCombo.currentIndexChanged.connect(self.armorComboChanged)
|
||||
|
||||
@@ -8,5 +8,5 @@ class QInfoItem(QStandardItem):
|
||||
def __init__(self, info: Information):
|
||||
super(QInfoItem, self).__init__()
|
||||
self.info = info
|
||||
self.setText("[%02d]" % self.info.turn + " " + self.info.title + ' : {:<16}'.format(info.text))
|
||||
self.setText(str(info))
|
||||
self.setEditable(False)
|
||||
|
||||
@@ -4,7 +4,7 @@ import json
|
||||
import logging
|
||||
from dataclasses import dataclass
|
||||
from pathlib import Path
|
||||
from typing import List
|
||||
from typing import Any, Dict, List
|
||||
|
||||
from PySide2 import QtGui
|
||||
from PySide2.QtCore import QItemSelectionModel
|
||||
@@ -21,7 +21,8 @@ class Campaign:
|
||||
icon_name: str
|
||||
authors: str
|
||||
description: str
|
||||
theater: ConflictTheater
|
||||
data: Dict[str, Any]
|
||||
path: Path
|
||||
|
||||
@classmethod
|
||||
def from_json(cls, path: Path) -> Campaign:
|
||||
@@ -29,10 +30,17 @@ class Campaign:
|
||||
data = json.load(campaign_file)
|
||||
|
||||
sanitized_theater = data["theater"].replace(" ", "")
|
||||
return cls(data["name"], f"Terrain_{sanitized_theater}",
|
||||
data.get("authors", "???"),
|
||||
data.get("description", ""),
|
||||
ConflictTheater.from_json(path.parent, data))
|
||||
return cls(
|
||||
data["name"],
|
||||
f"Terrain_{sanitized_theater}",
|
||||
data.get("authors", "???"),
|
||||
data.get("description", ""),
|
||||
data,
|
||||
path
|
||||
)
|
||||
|
||||
def load_theater(self) -> ConflictTheater:
|
||||
return ConflictTheater.from_json(self.path.parent, self.data)
|
||||
|
||||
|
||||
def load_campaigns() -> List[Campaign]:
|
||||
|
||||
@@ -58,7 +58,7 @@ class NewGameWizard(QtWidgets.QWizard):
|
||||
if selectedCampaign is None:
|
||||
selectedCampaign = self.campaigns[0]
|
||||
|
||||
conflictTheater = selectedCampaign.theater
|
||||
conflictTheater = selectedCampaign.load_theater()
|
||||
|
||||
timePeriod = db.TIME_PERIODS[list(db.TIME_PERIODS.keys())[self.field("timePeriod")]]
|
||||
midGame = self.field("midGame")
|
||||
|
||||
Reference in New Issue
Block a user