mirror of
https://github.com/dcs-retribution/dcs-retribution.git
synced 2025-11-10 15:41:24 +00:00
New mission briefing menu, work in progress.
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
from PySide2.QtWidgets import QFrame, QHBoxLayout, QPushButton, QVBoxLayout, QMessageBox
|
||||
from PySide2.QtWidgets import QFrame, QHBoxLayout, QPushButton, QVBoxLayout, QMessageBox, QGridLayout
|
||||
|
||||
from game import Game
|
||||
from qt_ui.widgets.QBudgetBox import QBudgetBox
|
||||
@@ -7,6 +7,7 @@ from qt_ui.widgets.QTurnCounter import QTurnCounter
|
||||
|
||||
import qt_ui.uiconstants as CONST
|
||||
from qt_ui.windows.GameUpdateSignal import GameUpdateSignal
|
||||
from qt_ui.windows.mission.QMissionPlanning import QMissionPlanning
|
||||
from qt_ui.windows.settings.QSettingsWindow import QSettingsWindow
|
||||
|
||||
|
||||
@@ -23,11 +24,17 @@ class QTopPanel(QFrame):
|
||||
self.turnCounter = QTurnCounter()
|
||||
self.budgetBox = QBudgetBox()
|
||||
|
||||
|
||||
self.passTurnButton = QPushButton("Pass Turn")
|
||||
self.passTurnButton.setIcon(CONST.ICONS["PassTurn"])
|
||||
self.passTurnButton.setProperty("style", "btn-primary")
|
||||
self.passTurnButton.clicked.connect(self.passTurn)
|
||||
|
||||
self.proceedButton = QPushButton("Proceed")
|
||||
self.proceedButton.setIcon(CONST.ICONS["PassTurn"])
|
||||
self.proceedButton.setProperty("style", "btn-primary")
|
||||
self.proceedButton.clicked.connect(self.proceed)
|
||||
|
||||
self.submenus = QVBoxLayout()
|
||||
self.settings = QPushButton("Settings")
|
||||
self.settings.setIcon(CONST.ICONS["Settings"])
|
||||
@@ -48,6 +55,7 @@ class QTopPanel(QFrame):
|
||||
self.layout.addWidget(self.turnCounter)
|
||||
self.layout.addWidget(self.budgetBox)
|
||||
self.layout.addWidget(self.passTurnButton)
|
||||
self.layout.addWidget(self.proceedButton)
|
||||
self.setLayout(self.layout)
|
||||
|
||||
def setGame(self, game:Game):
|
||||
@@ -66,4 +74,8 @@ class QTopPanel(QFrame):
|
||||
|
||||
def passTurn(self):
|
||||
self.game.pass_turn()
|
||||
GameUpdateSignal.get_instance().updateGame(self.game)
|
||||
GameUpdateSignal.get_instance().updateGame(self.game)
|
||||
|
||||
def proceed(self):
|
||||
self.subwindow = QMissionPlanning(self.game)
|
||||
self.subwindow.show()
|
||||
@@ -1,5 +1,7 @@
|
||||
from PySide2.QtWidgets import QGridLayout, QLabel, QGroupBox, QVBoxLayout
|
||||
|
||||
from game import db
|
||||
from qt_ui.uiconstants import AIRCRAFT_ICONS, VEHICLES_ICONS
|
||||
from theater import ControlPoint, Airport
|
||||
|
||||
|
||||
@@ -26,7 +28,14 @@ class QBaseInformation(QGroupBox):
|
||||
|
||||
i = 0
|
||||
for k,v in unit_dict.items():
|
||||
self.layout.addWidget(QLabel(str(v) + " x " + k), i, 0)
|
||||
icon = QLabel()
|
||||
if k in VEHICLES_ICONS.keys():
|
||||
icon.setPixmap(VEHICLES_ICONS[k])
|
||||
else:
|
||||
icon.setText("<b>"+k[:6]+"</b>")
|
||||
icon.setProperty("style", "icon-plane")
|
||||
self.layout.addWidget(icon, i, 0)
|
||||
self.layout.addWidget(QLabel(str(v) + " x " + k), i, 1)
|
||||
i = i + 1
|
||||
|
||||
stretch = QVBoxLayout()
|
||||
|
||||
@@ -1,29 +0,0 @@
|
||||
from PySide2.QtWidgets import QGridLayout, QLabel, QGroupBox, QVBoxLayout, QHBoxLayout
|
||||
|
||||
from game import db
|
||||
from gen.flights.ai_flight_planner import FlightPlanner
|
||||
|
||||
|
||||
class QPlannedFlightView(QGroupBox):
|
||||
|
||||
def __init__(self, flight_planner:FlightPlanner):
|
||||
super(QPlannedFlightView, self).__init__("Planned flights")
|
||||
self.flight_planner = flight_planner
|
||||
self.init_ui()
|
||||
|
||||
def init_ui(self):
|
||||
self.layout = QGridLayout()
|
||||
|
||||
for i,f in enumerate(self.flight_planner.flights):
|
||||
ftype = QLabel("<b>" + f.flight_type.name + "</b>")
|
||||
count = QLabel(str(f.count) + " x " + db.unit_type_name(f.unit_type))
|
||||
sched = QLabel(" in " + str(f.scheduled_in) + " minutes")
|
||||
|
||||
self.layout.addWidget(ftype, i, 0)
|
||||
self.layout.addWidget(count, i, 1)
|
||||
self.layout.addWidget(sched, i, 2)
|
||||
|
||||
stretch = QVBoxLayout()
|
||||
stretch.addStretch()
|
||||
self.layout.addLayout(stretch, len(self.flight_planner.flights)+1, 0)
|
||||
self.setLayout(self.layout)
|
||||
@@ -83,13 +83,28 @@ class QLiberationMap(QGraphicsView):
|
||||
text.setPos(pos[0] + CONST.CP_SIZE + 1, pos[1] - CONST.CP_SIZE / 2 + 1)
|
||||
|
||||
|
||||
if cp.captured:
|
||||
pen = QPen(brush=CONST.COLORS["blue"])
|
||||
brush = CONST.COLORS["blue_transparent"]
|
||||
|
||||
flight_path_pen = QPen(brush=CONST.COLORS["blue"])
|
||||
flight_path_pen.setColor(CONST.COLORS["blue"])
|
||||
flight_path_pen.setWidth(1)
|
||||
flight_path_pen.setStyle(Qt.DashDotLine)
|
||||
else:
|
||||
pen = QPen(brush=CONST.COLORS["red"])
|
||||
brush = CONST.COLORS["red_transparent"]
|
||||
|
||||
flight_path_pen = QPen(brush=CONST.COLORS["bright_red"])
|
||||
flight_path_pen.setColor(CONST.COLORS["bright_red"])
|
||||
flight_path_pen.setWidth(1)
|
||||
flight_path_pen.setStyle(Qt.DashDotLine)
|
||||
|
||||
for ground_object in cp.ground_objects:
|
||||
|
||||
if ground_object.airbase_group:
|
||||
continue
|
||||
|
||||
go_pos = self._transform_point(ground_object.position)
|
||||
scene.addItem(QMapGroundObject(self, go_pos[0], go_pos[1], 16, 16, cp, ground_object))
|
||||
if not ground_object.airbase_group:
|
||||
scene.addItem(QMapGroundObject(self, go_pos[0], go_pos[1], 16, 16, cp, ground_object))
|
||||
|
||||
if ground_object.category == "aa" and self.get_display_rule("sam"):
|
||||
max_range = 0
|
||||
@@ -99,17 +114,24 @@ class QLiberationMap(QGraphicsView):
|
||||
unit = db.unit_type_from_name(u.type)
|
||||
if unit.threat_range > max_range:
|
||||
max_range = unit.threat_range
|
||||
if cp.captured:
|
||||
pen = QPen(brush=CONST.COLORS["blue"])
|
||||
brush = CONST.COLORS["blue_transparent"]
|
||||
else:
|
||||
pen = QPen(brush=CONST.COLORS["red"])
|
||||
brush = CONST.COLORS["red_transparent"]
|
||||
|
||||
scene.addEllipse(go_pos[0] - max_range/300.0 + 8, go_pos[1] - max_range/300.0 + 8, max_range/150.0, max_range/150.0, pen, brush)
|
||||
|
||||
if self.get_display_rule("lines"):
|
||||
self.scene_create_lines_for_cp(cp)
|
||||
|
||||
if cp.id in self.game.planners.keys():
|
||||
planner = self.game.planners[cp.id]
|
||||
for flight in planner.flights:
|
||||
scene.addEllipse(pos[0], pos[1], 4, 4)
|
||||
prev_pos = list(pos)
|
||||
for points in flight.points:
|
||||
new_pos = self._transform_point(Point(points[0], points[1]))
|
||||
scene.addLine(prev_pos[0]+2, prev_pos[1]+2, new_pos[0]+2, new_pos[1]+2, flight_path_pen)
|
||||
scene.addEllipse(new_pos[0], new_pos[1], 4, 4, pen, brush)
|
||||
prev_pos = list(new_pos)
|
||||
scene.addLine(prev_pos[0] + 2, prev_pos[1] + 2, pos[0] + 2, pos[1] + 2, flight_path_pen)
|
||||
|
||||
def scene_create_lines_for_cp(self, cp: ControlPoint):
|
||||
scene = self.scene()
|
||||
pos = self._transform_point(cp.position)
|
||||
|
||||
Reference in New Issue
Block a user