Polishing, Bug Fixes, Slight improvements to flight generator for BARCAP.

This commit is contained in:
Khopa
2020-05-29 03:05:27 +02:00
parent fc64e57495
commit 8afdf5ef65
21 changed files with 194 additions and 123 deletions

View File

@@ -81,7 +81,7 @@ class QTopPanel(QFrame):
self.budgetBox.setGame(self.game)
self.factionsInfos.setGame(self.game)
if not len(self.game.planners.keys()) == len(self.game.theater.controlpoints):
if self.game and self.game.turn == 0:
self.proceedButton.setEnabled(False)
else:
self.proceedButton.setEnabled(True)

View File

@@ -1,45 +0,0 @@
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
class QBaseInformation(QGroupBox):
def __init__(self, cp:ControlPoint, airport:Airport):
super(QBaseInformation, self).__init__("Base defenses")
self.cp = cp
self.airport = airport
self.setMinimumWidth(500)
self.init_ui()
def init_ui(self):
self.layout = QGridLayout()
unit_dict = {}
for g in self.cp.ground_objects:
if g.airbase_group:
for group in g.groups:
for u in group.units:
if u.type in unit_dict.keys():
unit_dict[u.type] = unit_dict[u.type] + 1
else:
unit_dict[u.type] = 1
i = 0
for k,v in unit_dict.items():
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()
stretch.addStretch()
self.layout.addLayout(stretch, len(unit_dict) + 1, 0)
self.setLayout(self.layout)

View File

@@ -76,24 +76,13 @@ class QLiberationMap(QGraphicsView):
scene.addItem(QMapControlPoint(self, pos[0] - CONST.CP_SIZE / 2, pos[1] - CONST.CP_SIZE / 2, CONST.CP_SIZE,
CONST.CP_SIZE, cp, self.game))
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:
go_pos = self._transform_point(ground_object.position)
@@ -119,6 +108,24 @@ class QLiberationMap(QGraphicsView):
self.scene_create_lines_for_cp(cp)
for cp in self.game.theater.controlpoints:
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)
pos = self._transform_point(cp.position)
if self.get_display_rule("flight_paths"):
if cp.id in self.game.planners.keys():