mirror of
https://github.com/dcs-retribution/dcs-retribution.git
synced 2025-11-10 15:41:24 +00:00
Add play/pause features to the sim.
There's no UI feedback for this yet other than the log messages. https://github.com/dcs-liberation/dcs_liberation/issues/1704
This commit is contained in:
@@ -13,15 +13,16 @@ import qt_ui.uiconstants as CONST
|
||||
from game import Game, persistency
|
||||
from game.ato.package import Package
|
||||
from game.profiling import logged_duration
|
||||
from game.sim import MissionSimulation
|
||||
from game.utils import meters
|
||||
from gen.flights.traveltime import TotEstimator
|
||||
from qt_ui.models import GameModel
|
||||
from qt_ui.simcontroller import SimController
|
||||
from qt_ui.widgets.QBudgetBox import QBudgetBox
|
||||
from qt_ui.widgets.QConditionsWidget import QConditionsWidget
|
||||
from qt_ui.widgets.QFactionsInfos import QFactionsInfos
|
||||
from qt_ui.widgets.QIntelBox import QIntelBox
|
||||
from qt_ui.widgets.clientslots import MaxPlayerCount
|
||||
from qt_ui.widgets.simspeedcontrols import SimSpeedControls
|
||||
from qt_ui.windows.AirWingDialog import AirWingDialog
|
||||
from qt_ui.windows.GameUpdateSignal import GameUpdateSignal
|
||||
from qt_ui.windows.PendingTransfersDialog import PendingTransfersDialog
|
||||
@@ -29,21 +30,14 @@ from qt_ui.windows.QWaitingForMissionResultWindow import QWaitingForMissionResul
|
||||
|
||||
|
||||
class QTopPanel(QFrame):
|
||||
def __init__(self, game_model: GameModel):
|
||||
def __init__(self, game_model: GameModel, sim_controller: SimController) -> None:
|
||||
super(QTopPanel, self).__init__()
|
||||
self.game_model = game_model
|
||||
self.sim_controller = sim_controller
|
||||
self.dialog: Optional[QDialog] = None
|
||||
|
||||
self.setMaximumHeight(70)
|
||||
self.init_ui()
|
||||
GameUpdateSignal.get_instance().gameupdated.connect(self.setGame)
|
||||
GameUpdateSignal.get_instance().budgetupdated.connect(self.budget_update)
|
||||
|
||||
@property
|
||||
def game(self) -> Optional[Game]:
|
||||
return self.game_model.game
|
||||
|
||||
def init_ui(self):
|
||||
self.conditionsWidget = QConditionsWidget()
|
||||
self.budgetBox = QBudgetBox(self.game)
|
||||
|
||||
@@ -86,6 +80,7 @@ class QTopPanel(QFrame):
|
||||
|
||||
self.proceedBox = QGroupBox("Proceed")
|
||||
self.proceedBoxLayout = QHBoxLayout()
|
||||
self.proceedBoxLayout.addLayout(SimSpeedControls(sim_controller))
|
||||
self.proceedBoxLayout.addLayout(MaxPlayerCount(self.game_model.ato_model))
|
||||
self.proceedBoxLayout.addWidget(self.passTurnButton)
|
||||
self.proceedBoxLayout.addWidget(self.proceedButton)
|
||||
@@ -105,6 +100,13 @@ class QTopPanel(QFrame):
|
||||
|
||||
self.setLayout(self.layout)
|
||||
|
||||
GameUpdateSignal.get_instance().gameupdated.connect(self.setGame)
|
||||
GameUpdateSignal.get_instance().budgetupdated.connect(self.budget_update)
|
||||
|
||||
@property
|
||||
def game(self) -> Optional[Game]:
|
||||
return self.game_model.game
|
||||
|
||||
def setGame(self, game: Optional[Game]):
|
||||
if game is None:
|
||||
return
|
||||
@@ -277,11 +279,13 @@ class QTopPanel(QFrame):
|
||||
if not self.confirm_negative_start_time(negative_starts):
|
||||
return
|
||||
|
||||
sim = MissionSimulation(self.game)
|
||||
sim.run()
|
||||
sim.generate_miz(persistency.mission_path_for("liberation_nextturn.miz"))
|
||||
if self.game.settings.fast_forward_to_first_contact:
|
||||
self.sim_controller.run_to_first_contact()
|
||||
self.sim_controller.generate_miz(
|
||||
persistency.mission_path_for("liberation_nextturn.miz")
|
||||
)
|
||||
|
||||
waiting = QWaitingForMissionResultWindow(self.game, sim, self)
|
||||
waiting = QWaitingForMissionResultWindow(self.game, self.sim_controller, self)
|
||||
waiting.exec_()
|
||||
|
||||
def budget_update(self, game: Game):
|
||||
|
||||
Reference in New Issue
Block a user