mirror of
https://github.com/dcs-retribution/dcs-retribution.git
synced 2025-11-10 15:41:24 +00:00
Implemented basic base menu to buy units
This commit is contained in:
@@ -57,7 +57,9 @@ class QLiberationMap(QGraphicsView):
|
||||
def setGame(self, game: Game):
|
||||
self.game = game
|
||||
print("Reloading Map Canvas")
|
||||
self.reload_scene()
|
||||
print(self.game)
|
||||
if self.game is not None:
|
||||
self.reload_scene()
|
||||
|
||||
def reload_scene(self):
|
||||
scene = self.scene()
|
||||
@@ -67,7 +69,7 @@ class QLiberationMap(QGraphicsView):
|
||||
|
||||
pos = self._transform_point(cp.position)
|
||||
scene.addItem(QMapControlPoint(self, pos[0] - CONST.CP_SIZE / 2, pos[1] - CONST.CP_SIZE / 2, CONST.CP_SIZE,
|
||||
CONST.CP_SIZE, cp))
|
||||
CONST.CP_SIZE, cp, self.game))
|
||||
|
||||
# e = scene.addEllipse(pos[0]-CONST.CP_SIZE/2, pos[1]-CONST.CP_SIZE/2, CONST.CP_SIZE, CONST.CP_SIZE, QPen(brush=QBrush(color=color), width=5), brush=color)
|
||||
|
||||
|
||||
@@ -5,14 +5,16 @@ from PySide2.QtWidgets import QGraphicsRectItem, QGraphicsSceneHoverEvent, QGrap
|
||||
|
||||
from qt_ui.windows.QBaseMenu import QBaseMenu
|
||||
from theater import ControlPoint
|
||||
from game import Game
|
||||
import qt_ui.uiconstants as CONST
|
||||
|
||||
|
||||
class QMapControlPoint(QGraphicsRectItem):
|
||||
|
||||
def __init__(self, parent, x: float, y: float, w: float, h: float, model: ControlPoint):
|
||||
def __init__(self, parent, x: float, y: float, w: float, h: float, model: ControlPoint, game: Game):
|
||||
super(QMapControlPoint, self).__init__(x, y, w, h)
|
||||
self.model = model
|
||||
self.game = game
|
||||
self.parent = parent
|
||||
self.setAcceptHoverEvents(True)
|
||||
self.setZValue(1)
|
||||
@@ -77,5 +79,5 @@ class QMapControlPoint(QGraphicsRectItem):
|
||||
return self.model.captured and CONST.COLORS["bright_red"] or CONST.COLORS["dark_blue"]
|
||||
|
||||
def openBaseMenu(self):
|
||||
window = QBaseMenu(self.window(), self.model)
|
||||
window.show()
|
||||
self.baseMenu = QBaseMenu(self.window(), self.model, self.game)
|
||||
self.baseMenu.show()
|
||||
Reference in New Issue
Block a user