mirror of
https://github.com/dcs-retribution/dcs-retribution.git
synced 2025-11-10 15:41:24 +00:00
Merge remote-tracking branch 'upstream/develop'
into skynet-iads-plugin
This commit is contained in:
@@ -156,7 +156,9 @@ class QTopPanel(QFrame):
|
||||
"Packages panel on the left of the main window, and then a flight "
|
||||
"from the Flights panel below the Packages panel. The edit button "
|
||||
"below the Flights panel will allow you to edit the number of "
|
||||
"client slots in the flight. Each client slot allows one player."),
|
||||
"client slots in the flight. Each client slot allows one player.<br />"
|
||||
"<br />Click 'Yes' to continue with an AI only mission"
|
||||
"<br />Click 'No' if you'd like to make more changes."),
|
||||
QMessageBox.No,
|
||||
QMessageBox.Yes
|
||||
)
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
from typing import Optional
|
||||
|
||||
from PySide2.QtGui import QColor, QPainter
|
||||
from PySide2.QtWidgets import QAction, QMenu
|
||||
|
||||
import qt_ui.uiconstants as const
|
||||
from qt_ui.models import GameModel
|
||||
@@ -8,6 +9,7 @@ from qt_ui.windows.basemenu.QBaseMenu2 import QBaseMenu2
|
||||
from theater import ControlPoint
|
||||
from .QMapObject import QMapObject
|
||||
from ...displayoptions import DisplayOptions
|
||||
from ...windows.GameUpdateSignal import GameUpdateSignal
|
||||
|
||||
|
||||
class QMapControlPoint(QMapObject):
|
||||
@@ -20,6 +22,9 @@ class QMapControlPoint(QMapObject):
|
||||
self.setZValue(1)
|
||||
self.setToolTip(self.control_point.name)
|
||||
self.base_details_dialog: Optional[QBaseMenu2] = None
|
||||
self.capture_action = QAction(
|
||||
f"CHEAT: Capture {self.control_point.name}")
|
||||
self.capture_action.triggered.connect(self.cheat_capture)
|
||||
|
||||
def paint(self, painter, option, widget=None) -> None:
|
||||
if DisplayOptions.control_points:
|
||||
@@ -64,3 +69,24 @@ class QMapControlPoint(QMapObject):
|
||||
self.game_model
|
||||
)
|
||||
self.base_details_dialog.show()
|
||||
|
||||
def add_context_menu_actions(self, menu: QMenu) -> None:
|
||||
if self.control_point.is_fleet:
|
||||
return
|
||||
|
||||
if self.control_point.captured:
|
||||
return
|
||||
|
||||
for connected in self.control_point.connected_points:
|
||||
if connected.captured:
|
||||
break
|
||||
else:
|
||||
return
|
||||
|
||||
menu.addAction(self.capture_action)
|
||||
|
||||
def cheat_capture(self) -> None:
|
||||
self.control_point.capture(self.game_model.game, for_player=True)
|
||||
# Reinitialized ground planners and the like.
|
||||
self.game_model.game.initialize_turn()
|
||||
GameUpdateSignal.get_instance().updateGame(self.game_model.game)
|
||||
|
||||
@@ -37,6 +37,9 @@ class QMapObject(QGraphicsRectItem):
|
||||
if event.button() == Qt.LeftButton:
|
||||
self.on_click()
|
||||
|
||||
def add_context_menu_actions(self, menu: QMenu) -> None:
|
||||
pass
|
||||
|
||||
def contextMenuEvent(self, event: QGraphicsSceneContextMenuEvent) -> None:
|
||||
menu = QMenu("Menu", self.parent)
|
||||
|
||||
@@ -48,6 +51,8 @@ class QMapObject(QGraphicsRectItem):
|
||||
new_package_action.triggered.connect(self.open_new_package_dialog)
|
||||
menu.addAction(new_package_action)
|
||||
|
||||
self.add_context_menu_actions(menu)
|
||||
|
||||
menu.exec_(event.screenPos())
|
||||
|
||||
@property
|
||||
|
||||
@@ -19,6 +19,7 @@ from theater import ConflictTheater
|
||||
class Campaign:
|
||||
name: str
|
||||
icon_name: str
|
||||
authors: str
|
||||
theater: ConflictTheater
|
||||
|
||||
@classmethod
|
||||
@@ -27,7 +28,7 @@ class Campaign:
|
||||
data = json.load(campaign_file)
|
||||
|
||||
sanitized_theater = data["theater"].replace(" ", "")
|
||||
return cls(data["name"], f"Terrain_{sanitized_theater}",
|
||||
return cls(data["name"], f"Terrain_{sanitized_theater}", data.get("authors", "???"),
|
||||
ConflictTheater.from_json(data))
|
||||
|
||||
|
||||
|
||||
@@ -150,11 +150,15 @@ class FactionSelection(QtWidgets.QWizardPage):
|
||||
|
||||
redFaction = QtWidgets.QLabel("<b>Enemy Faction :</b>")
|
||||
self.redFactionSelect = QtWidgets.QComboBox()
|
||||
redFaction.setBuddy(self.redFactionSelect)
|
||||
|
||||
# Setup default selected factions
|
||||
for i, r in enumerate(db.FACTIONS):
|
||||
self.redFactionSelect.addItem(r)
|
||||
if r == "Russia 1990": # Default ennemy
|
||||
if r == "Russia 1990":
|
||||
self.redFactionSelect.setCurrentIndex(i)
|
||||
redFaction.setBuddy(self.redFactionSelect)
|
||||
if r == "USA 2005":
|
||||
self.blueFactionSelect.setCurrentIndex(i)
|
||||
|
||||
self.blueSideRecap = QtWidgets.QLabel("")
|
||||
self.blueSideRecap.setFont(CONST.FONT_PRIMARY_I)
|
||||
@@ -200,8 +204,8 @@ class FactionSelection(QtWidgets.QWizardPage):
|
||||
red_faction = db.FACTIONS[self.redFactionSelect.currentText()]
|
||||
blue_faction = db.FACTIONS[self.blueFactionSelect.currentText()]
|
||||
|
||||
red_units = red_faction["units"]
|
||||
blue_units = blue_faction["units"]
|
||||
red_units = red_faction.aircrafts
|
||||
blue_units = blue_faction.aircrafts
|
||||
|
||||
blue_txt = ""
|
||||
for u in blue_units:
|
||||
@@ -218,16 +222,16 @@ class FactionSelection(QtWidgets.QWizardPage):
|
||||
self.redSideRecap.setText(red_txt)
|
||||
|
||||
has_mod = False
|
||||
if "requirements" in red_faction.keys():
|
||||
if len(red_faction.requirements.keys()) > 0:
|
||||
has_mod = True
|
||||
for mod in red_faction["requirements"].keys():
|
||||
self.requiredMods.setText(self.requiredMods.text() + "\n<li>" + mod + ": <a href=\""+red_faction["requirements"][mod]+"\">" + red_faction["requirements"][mod] + "</a></li>")
|
||||
for mod in red_faction.requirements.keys():
|
||||
self.requiredMods.setText(self.requiredMods.text() + "\n<li>" + mod + ": <a href=\""+red_faction.requirements[mod]+"\">" + red_faction.requirements[mod] + "</a></li>")
|
||||
|
||||
if "requirements" in blue_faction.keys():
|
||||
if len(blue_faction.requirements.keys()) > 0:
|
||||
has_mod = True
|
||||
for mod in blue_faction["requirements"].keys():
|
||||
if not "requirements" in red_faction.keys() or mod not in red_faction["requirements"].keys():
|
||||
self.requiredMods.setText(self.requiredMods.text() + "\n<li>" + mod + ": <a href=\""+blue_faction["requirements"][mod]+"\">" + blue_faction["requirements"][mod] + "</a></li>")
|
||||
for mod in blue_faction.requirements.keys():
|
||||
if not "requirements" in red_faction.keys() or mod not in red_faction.requirements.keys():
|
||||
self.requiredMods.setText(self.requiredMods.text() + "\n<li>" + mod + ": <a href=\""+blue_faction.requirements[mod]+"\">" + blue_faction.requirements[mod] + "</a></li>")
|
||||
|
||||
if has_mod:
|
||||
self.requiredMods.setText(self.requiredMods.text() + "</ul>\n\n")
|
||||
|
||||
Reference in New Issue
Block a user