mirror of
https://github.com/dcs-retribution/dcs-retribution.git
synced 2025-11-10 15:41:24 +00:00
feat: Added Financial Income to GroundObjectMenu building window
This commit is contained in:
parent
7c22f6e83b
commit
976ee51bf5
@ -2,7 +2,7 @@ import os
|
||||
|
||||
from PySide2.QtGui import QPixmap
|
||||
from PySide2.QtWidgets import QGroupBox, QHBoxLayout, QVBoxLayout, QLabel
|
||||
|
||||
from game.db import REWARDS
|
||||
|
||||
class QBuildingInfo(QGroupBox):
|
||||
|
||||
@ -28,6 +28,14 @@ class QBuildingInfo(QGroupBox):
|
||||
layout = QVBoxLayout()
|
||||
layout.addWidget(self.header)
|
||||
layout.addWidget(self.name)
|
||||
|
||||
if self.building.category in REWARDS.keys():
|
||||
income_label_text = 'Value: ' + str(REWARDS[self.building.category]) + "M"
|
||||
if self.building.is_dead:
|
||||
income_label_text = '<s>' + income_label_text + '</s>'
|
||||
self.reward = QLabel(income_label_text)
|
||||
layout.addWidget(self.reward)
|
||||
|
||||
footer = QHBoxLayout()
|
||||
self.setLayout(layout)
|
||||
|
||||
|
||||
@ -8,7 +8,7 @@ from dcs import Point
|
||||
|
||||
from game import Game, db
|
||||
from game.data.building_data import FORTIFICATION_BUILDINGS
|
||||
from game.db import PRICES, unit_type_of, PinpointStrike
|
||||
from game.db import PRICES, REWARDS, unit_type_of, PinpointStrike
|
||||
from gen.defenses.armor_group_generator import generate_armor_group_of_type_and_size
|
||||
from gen.sam.sam_group_generator import get_faction_possible_sams_generator
|
||||
from qt_ui.uiconstants import EVENT_ICONS
|
||||
@ -51,6 +51,8 @@ class QGroundObjectMenu(QDialog):
|
||||
self.mainLayout.addWidget(self.intelBox)
|
||||
else:
|
||||
self.mainLayout.addWidget(self.buildingBox)
|
||||
if self.cp.captured:
|
||||
self.mainLayout.addWidget(self.financesBox)
|
||||
|
||||
self.actionLayout = QHBoxLayout()
|
||||
|
||||
@ -105,11 +107,30 @@ class QGroundObjectMenu(QDialog):
|
||||
self.buildingBox = QGroupBox("Buildings :")
|
||||
self.buildingsLayout = QGridLayout()
|
||||
j = 0
|
||||
|
||||
total_income = 0
|
||||
received_income = 0
|
||||
for i, building in enumerate(self.buildings):
|
||||
if building.dcs_identifier not in FORTIFICATION_BUILDINGS:
|
||||
self.buildingsLayout.addWidget(QBuildingInfo(building, self.ground_object), j/3, j%3)
|
||||
j = j + 1
|
||||
|
||||
if building.category in REWARDS.keys():
|
||||
total_income = total_income + REWARDS[building.category]
|
||||
if not building.is_dead:
|
||||
received_income = received_income + REWARDS[building.category]
|
||||
|
||||
|
||||
self.financesBox = QGroupBox("Finances: ")
|
||||
self.financesBoxLayout = QGridLayout()
|
||||
|
||||
str_total_income = 'Available: ' + str(total_income) + "M"
|
||||
str_percived_income = 'Receiving: ' + str(received_income) + "M"
|
||||
|
||||
self.financesBoxLayout.addWidget(QLabel(str_total_income), 2, 1)
|
||||
self.financesBoxLayout.addWidget(QLabel(str_percived_income), 2, 2)
|
||||
|
||||
self.financesBox.setLayout(self.financesBoxLayout)
|
||||
self.buildingBox.setLayout(self.buildingsLayout)
|
||||
self.intelBox.setLayout(self.intelLayout)
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user