mirror of
https://github.com/dcs-retribution/dcs-retribution.git
synced 2025-11-10 15:41:24 +00:00
Add runway bombing missions.
This allows planning the missions and the missions are functional, but they will have no effect on future turns yet.
This commit is contained in:
@@ -1,8 +1,17 @@
|
||||
from PySide2.QtCore import Qt
|
||||
from PySide2.QtGui import QCloseEvent, QPixmap
|
||||
from PySide2.QtWidgets import QDialog, QGridLayout, QHBoxLayout, QLabel, QWidget
|
||||
from PySide2.QtWidgets import (
|
||||
QDialog,
|
||||
QHBoxLayout,
|
||||
QLabel,
|
||||
QPushButton,
|
||||
QVBoxLayout,
|
||||
QWidget,
|
||||
)
|
||||
|
||||
from game.theater import ControlPoint, ControlPointType
|
||||
from gen.flights.flight import FlightType
|
||||
from qt_ui.dialogs import Dialog
|
||||
from qt_ui.models import GameModel
|
||||
from qt_ui.uiconstants import EVENT_ICONS
|
||||
from qt_ui.windows.GameUpdateSignal import GameUpdateSignal
|
||||
@@ -20,9 +29,6 @@ class QBaseMenu2(QDialog):
|
||||
self.game_model = game_model
|
||||
self.objectName = "menuDialogue"
|
||||
|
||||
# Widgets
|
||||
self.qbase_menu_tab = QBaseMenuTabs(cp, self.game_model)
|
||||
|
||||
try:
|
||||
game = self.game_model.game
|
||||
self.airport = game.theater.terrain.airport_by_id(self.cp.id)
|
||||
@@ -39,15 +45,11 @@ class QBaseMenu2(QDialog):
|
||||
self.setMinimumWidth(800)
|
||||
self.setMaximumWidth(800)
|
||||
self.setModal(True)
|
||||
self.initUi()
|
||||
|
||||
def initUi(self):
|
||||
self.setWindowTitle(self.cp.name)
|
||||
self.topLayoutWidget = QWidget()
|
||||
self.topLayout = QHBoxLayout()
|
||||
|
||||
self.topLayoutWidget = QWidget()
|
||||
self.topLayout = QHBoxLayout()
|
||||
base_menu_header = QWidget()
|
||||
top_layout = QHBoxLayout()
|
||||
|
||||
header = QLabel(self)
|
||||
header.setGeometry(0, 0, 655, 106)
|
||||
@@ -57,26 +59,42 @@ class QBaseMenu2(QDialog):
|
||||
title = QLabel("<b>" + self.cp.name + "</b>")
|
||||
title.setAlignment(Qt.AlignLeft | Qt.AlignTop)
|
||||
title.setProperty("style", "base-title")
|
||||
unitsPower = QLabel("{} / {} / Runway : {}".format(self.cp.base.total_aircraft, self.cp.base.total_armor,
|
||||
"Available" if self.cp.has_runway() else "Unavailable"))
|
||||
self.topLayout.addWidget(title)
|
||||
self.topLayout.addWidget(unitsPower)
|
||||
self.topLayout.setAlignment(Qt.AlignTop)
|
||||
self.topLayoutWidget.setProperty("style", "baseMenuHeader")
|
||||
self.topLayoutWidget.setLayout(self.topLayout)
|
||||
aircraft = self.cp.base.total_aircraft
|
||||
armor = self.cp.base.total_armor
|
||||
runway_status = "operational" if self.cp.has_runway() else "inoperative"
|
||||
intel_summary = QLabel("\n".join([
|
||||
f"{aircraft} aircraft",
|
||||
f"{armor} ground units",
|
||||
f"Runway {runway_status}"
|
||||
]))
|
||||
top_layout.addWidget(title)
|
||||
top_layout.addWidget(intel_summary)
|
||||
top_layout.setAlignment(Qt.AlignTop)
|
||||
base_menu_header.setProperty("style", "baseMenuHeader")
|
||||
base_menu_header.setLayout(top_layout)
|
||||
|
||||
self.mainLayout = QGridLayout()
|
||||
self.mainLayout.addWidget(header, 0, 0)
|
||||
self.mainLayout.addWidget(self.topLayoutWidget, 1, 0)
|
||||
self.mainLayout.addWidget(self.qbase_menu_tab, 2, 0)
|
||||
totalBudget = QLabel(
|
||||
main_layout = QVBoxLayout()
|
||||
main_layout.addWidget(header)
|
||||
main_layout.addWidget(base_menu_header)
|
||||
main_layout.addWidget(QBaseMenuTabs(cp, self.game_model))
|
||||
bottom_row = QHBoxLayout()
|
||||
main_layout.addLayout(bottom_row)
|
||||
|
||||
if FlightType.RUNWAY_ATTACK in self.cp.mission_types(for_player=True):
|
||||
runway_attack_button = QPushButton("Attack airfield")
|
||||
bottom_row.addWidget(runway_attack_button)
|
||||
|
||||
runway_attack_button.setProperty("style", "btn-danger")
|
||||
runway_attack_button.clicked.connect(self.new_package)
|
||||
|
||||
budget_display = QLabel(
|
||||
QRecruitBehaviour.BUDGET_FORMAT.format(self.game_model.game.budget)
|
||||
)
|
||||
totalBudget.setObjectName("budgetField")
|
||||
totalBudget.setAlignment(Qt.AlignRight | Qt.AlignBottom)
|
||||
totalBudget.setProperty("style", "budget-label")
|
||||
self.mainLayout.addWidget(totalBudget)
|
||||
self.setLayout(self.mainLayout)
|
||||
budget_display.setObjectName("budgetField")
|
||||
budget_display.setAlignment(Qt.AlignRight | Qt.AlignBottom)
|
||||
budget_display.setProperty("style", "budget-label")
|
||||
bottom_row.addWidget(budget_display)
|
||||
self.setLayout(main_layout)
|
||||
|
||||
def closeEvent(self, closeEvent:QCloseEvent):
|
||||
GameUpdateSignal.get_instance().updateGame(self.game_model.game)
|
||||
@@ -88,3 +106,6 @@ class QBaseMenu2(QDialog):
|
||||
return "./resources/ui/lha.png"
|
||||
else:
|
||||
return "./resources/ui/airbase.png"
|
||||
|
||||
def new_package(self) -> None:
|
||||
Dialog.open_new_package_dialog(self.cp, parent=self.window())
|
||||
|
||||
Reference in New Issue
Block a user