mirror of
https://github.com/dcs-retribution/dcs-retribution.git
synced 2025-11-10 15:41:24 +00:00
Move waypoints and commit boundaries to FastAPI.
This commit is contained in:
@@ -1,15 +1,20 @@
|
||||
from game import Game
|
||||
from qt_ui.models import GameModel
|
||||
|
||||
|
||||
class GameContext:
|
||||
_game: Game | None
|
||||
_game_model: GameModel
|
||||
|
||||
@classmethod
|
||||
def set(cls, game: Game | None) -> None:
|
||||
cls._game = game
|
||||
def set_model(cls, game_model: GameModel) -> None:
|
||||
cls._game_model = game_model
|
||||
|
||||
@classmethod
|
||||
def get(cls) -> Game:
|
||||
if cls._game is None:
|
||||
if cls._game_model.game is None:
|
||||
raise RuntimeError("GameContext has no Game set")
|
||||
return cls._game
|
||||
return cls._game_model.game
|
||||
|
||||
@classmethod
|
||||
def get_model(cls) -> GameModel:
|
||||
return cls._game_model
|
||||
|
||||
Reference in New Issue
Block a user