mirror of
https://github.com/dcs-retribution/dcs-retribution.git
synced 2025-11-10 15:41:24 +00:00
Use FastAPI interface for the front lines.
Can't submit yet because there's no way to uniquely identify front- lines, so no way to update these as they change.
This commit is contained in:
parent
e5f4974e9a
commit
8d806def5b
@ -15,7 +15,6 @@ from game.theater import (
|
||||
from qt_ui.models import GameModel
|
||||
from qt_ui.windows.GameUpdateSignal import GameUpdateSignal
|
||||
from .controlpointjs import ControlPointJs
|
||||
from .frontlinejs import FrontLineJs
|
||||
from .groundobjectjs import GroundObjectJs
|
||||
from .supplyroutejs import SupplyRouteJs
|
||||
|
||||
@ -44,7 +43,6 @@ class MapModel(QObject):
|
||||
controlPointsChanged = Signal()
|
||||
groundObjectsChanged = Signal()
|
||||
supplyRoutesChanged = Signal()
|
||||
frontLinesChanged = Signal()
|
||||
mapReset = Signal()
|
||||
|
||||
def __init__(self, game_model: GameModel) -> None:
|
||||
@ -54,7 +52,6 @@ class MapModel(QObject):
|
||||
self._control_points = []
|
||||
self._ground_objects = []
|
||||
self._supply_routes = []
|
||||
self._front_lines = []
|
||||
|
||||
GameUpdateSignal.get_instance().game_loaded.connect(self.on_game_load)
|
||||
self.reset()
|
||||
@ -63,7 +60,6 @@ class MapModel(QObject):
|
||||
self._control_points = []
|
||||
self._supply_routes = []
|
||||
self._ground_objects = []
|
||||
self._front_lines = []
|
||||
self.cleared.emit()
|
||||
|
||||
def reset(self) -> None:
|
||||
@ -74,7 +70,6 @@ class MapModel(QObject):
|
||||
self.reset_control_points()
|
||||
self.reset_ground_objects()
|
||||
self.reset_routes()
|
||||
self.reset_front_lines()
|
||||
self.mapReset.emit()
|
||||
|
||||
def on_game_load(self, game: Optional[Game]) -> None:
|
||||
@ -161,14 +156,6 @@ class MapModel(QObject):
|
||||
def supplyRoutes(self) -> List[SupplyRouteJs]:
|
||||
return self._supply_routes
|
||||
|
||||
def reset_front_lines(self) -> None:
|
||||
self._front_lines = [FrontLineJs(f) for f in self.game.theater.conflicts()]
|
||||
self.frontLinesChanged.emit()
|
||||
|
||||
@Property(list, notify=frontLinesChanged)
|
||||
def frontLines(self) -> List[FrontLineJs]:
|
||||
return self._front_lines
|
||||
|
||||
@property
|
||||
def game(self) -> Game:
|
||||
if self.game_model.game is None:
|
||||
|
||||
@ -255,7 +255,6 @@ new QWebChannel(qt.webChannelTransport, function (channel) {
|
||||
game.controlPointsChanged.connect(drawControlPoints);
|
||||
game.groundObjectsChanged.connect(drawGroundObjects);
|
||||
game.supplyRoutesChanged.connect(drawSupplyRoutes);
|
||||
game.frontLinesChanged.connect(drawFrontLines);
|
||||
game.mapReset.connect(drawAircraft);
|
||||
});
|
||||
|
||||
@ -625,12 +624,14 @@ function drawSupplyRoutes() {
|
||||
|
||||
function drawFrontLines() {
|
||||
frontLinesLayer.clearLayers();
|
||||
game.frontLines.forEach((front) => {
|
||||
L.polyline(front.extents, { weight: 8, color: "#fe7d0a" })
|
||||
.on("contextmenu", function () {
|
||||
front.showPackageDialog();
|
||||
})
|
||||
.addTo(frontLinesLayer);
|
||||
getJson("/front-lines").then((frontLines) => {
|
||||
for (const front of frontLines) {
|
||||
L.polyline(front.extents, { weight: 8, color: "#fe7d0a" })
|
||||
.on("contextmenu", function () {
|
||||
front.showPackageDialog();
|
||||
})
|
||||
.addTo(frontLinesLayer);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user