mirror of
https://github.com/dcs-retribution/dcs-retribution.git
synced 2025-11-10 15:41:24 +00:00
Stream turn initialization events from the UI.
This commit is contained in:
parent
762bc328e1
commit
a3a5c59327
@ -3,6 +3,7 @@ from collections.abc import Callable
|
||||
from PySide2.QtWidgets import QGroupBox, QLabel, QPushButton, QVBoxLayout
|
||||
|
||||
from game import Game
|
||||
from game.server import EventStream
|
||||
from game.sim.gameupdateevents import GameUpdateEvents
|
||||
from game.theater import ControlPoint
|
||||
from qt_ui.windows.GameUpdateSignal import GameUpdateSignal
|
||||
@ -57,5 +58,7 @@ class QGroundForcesStrategy(QGroupBox):
|
||||
self.cp.base.affect_strength(amount)
|
||||
enemy_point.base.affect_strength(-amount)
|
||||
# Clear the ATO to replan missions affected by the front line.
|
||||
self.game.initialize_turn(GameUpdateEvents())
|
||||
events = GameUpdateEvents()
|
||||
self.game.initialize_turn(events)
|
||||
EventStream.put_nowait(events)
|
||||
GameUpdateSignal.get_instance().updateGame(self.game)
|
||||
|
||||
@ -1,11 +1,12 @@
|
||||
from collections import defaultdict
|
||||
import logging
|
||||
from collections import defaultdict
|
||||
from dataclasses import dataclass, field
|
||||
from typing import Type
|
||||
|
||||
from PySide2.QtCore import Signal
|
||||
from PySide2.QtGui import Qt
|
||||
from PySide2.QtWidgets import (
|
||||
QCheckBox,
|
||||
QComboBox,
|
||||
QDialog,
|
||||
QGridLayout,
|
||||
@ -14,7 +15,6 @@ from PySide2.QtWidgets import (
|
||||
QPushButton,
|
||||
QSpinBox,
|
||||
QVBoxLayout,
|
||||
QCheckBox,
|
||||
QWidget,
|
||||
)
|
||||
from dcs.unittype import UnitType
|
||||
@ -22,20 +22,19 @@ from dcs.unittype import UnitType
|
||||
from game import Game
|
||||
from game.armedforces.forcegroup import ForceGroup
|
||||
from game.data.groups import GroupRole, GroupTask
|
||||
from game.point_with_heading import PointWithHeading
|
||||
from game.sim.gameupdateevents import GameUpdateEvents
|
||||
from game.theater import TheaterGroundObject
|
||||
from game.theater.theatergroundobject import (
|
||||
VehicleGroupGroundObject,
|
||||
SamGroundObject,
|
||||
EwrGroundObject,
|
||||
)
|
||||
from game.theater.theatergroup import TheaterGroup
|
||||
from game.layout.layout import (
|
||||
LayoutException,
|
||||
TgoLayout,
|
||||
TgoLayoutGroup,
|
||||
)
|
||||
from game.server import EventStream
|
||||
from game.sim.gameupdateevents import GameUpdateEvents
|
||||
from game.theater import TheaterGroundObject
|
||||
from game.theater.theatergroundobject import (
|
||||
EwrGroundObject,
|
||||
SamGroundObject,
|
||||
VehicleGroupGroundObject,
|
||||
)
|
||||
from qt_ui.uiconstants import EVENT_ICONS
|
||||
from qt_ui.windows.GameUpdateSignal import GameUpdateSignal
|
||||
|
||||
@ -219,7 +218,9 @@ class QGroundObjectTemplateLayout(QGroupBox):
|
||||
)
|
||||
|
||||
# Replan redfor missions
|
||||
self.game.initialize_turn(GameUpdateEvents(), for_red=True, for_blue=False)
|
||||
events = GameUpdateEvents()
|
||||
self.game.initialize_turn(events, for_red=True, for_blue=False)
|
||||
EventStream.put_nowait(events)
|
||||
GameUpdateSignal.get_instance().updateGame(self.game)
|
||||
|
||||
|
||||
|
||||
@ -14,13 +14,11 @@ from dcs import Point
|
||||
from game import Game
|
||||
from game.config import REWARDS
|
||||
from game.data.building_data import FORTIFICATION_BUILDINGS
|
||||
from game.server import EventStream
|
||||
from game.sim.gameupdateevents import GameUpdateEvents
|
||||
from game.theater import ControlPoint, TheaterGroundObject
|
||||
from game.theater.theatergroundobject import (
|
||||
BuildingGroundObject,
|
||||
EwrGroundObject,
|
||||
SamGroundObject,
|
||||
VehicleGroupGroundObject,
|
||||
)
|
||||
from qt_ui.uiconstants import EVENT_ICONS
|
||||
from qt_ui.widgets.QBudgetBox import QBudgetBox
|
||||
@ -210,7 +208,9 @@ class QGroundObjectMenu(QDialog):
|
||||
package.target == self.ground_object
|
||||
for package in self.game.ato_for(player=False).packages
|
||||
):
|
||||
self.game.initialize_turn(GameUpdateEvents(), for_red=True, for_blue=False)
|
||||
events = GameUpdateEvents()
|
||||
self.game.initialize_turn(events, for_red=True, for_blue=False)
|
||||
EventStream.put_nowait(events)
|
||||
|
||||
self.do_refresh_layout()
|
||||
GameUpdateSignal.get_instance().updateGame(self.game)
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user