Archived
pseudo mvc
This commit is contained in:
@@ -1 +1,2 @@
|
||||
from controller.client import Client
|
||||
from controller.game import GameController
|
||||
|
||||
@@ -0,0 +1,11 @@
|
||||
from netcode import WSServer
|
||||
|
||||
|
||||
class GameController:
|
||||
server: WSServer
|
||||
|
||||
def __init__(self, server: WSServer):
|
||||
self.server = server
|
||||
|
||||
def start_game(self):
|
||||
pass
|
||||
+8
-2
@@ -2,6 +2,7 @@
|
||||
from typing import List, Callable, Coroutine, Any
|
||||
|
||||
from game import Card, Team
|
||||
from controller import GameController
|
||||
|
||||
|
||||
class Game:
|
||||
@@ -16,17 +17,22 @@ class Game:
|
||||
|
||||
default_health = 80
|
||||
|
||||
broadcast: Callable[[str], Coroutine[Any, Any, Any]]
|
||||
controller: GameController
|
||||
|
||||
def __init__(self):
|
||||
def __init__(self, controller):
|
||||
self.market_stack = []
|
||||
self.market = []
|
||||
self.gem_stack = []
|
||||
self.teams = []
|
||||
self.started = False
|
||||
|
||||
self.controller = controller
|
||||
|
||||
def create_team(self):
|
||||
if self.started:
|
||||
return False
|
||||
team = Team(health=self.default_health)
|
||||
self.teams.append(team)
|
||||
|
||||
def start_game(self):
|
||||
pass
|
||||
|
||||
+3
-4
@@ -4,12 +4,11 @@ from game import Game
|
||||
|
||||
from netcode.ws_server import WebSocketServerProtocol
|
||||
from netcode import WSServer
|
||||
from controller import Client
|
||||
from controller import Client, GameController
|
||||
|
||||
gameServer = WSServer()
|
||||
hero_game = Game()
|
||||
hero_game.broadcast = gameServer.broadcast
|
||||
|
||||
controller = GameController(gameServer)
|
||||
hero_game = Game(controller)
|
||||
|
||||
playerServer = WSServer()
|
||||
|
||||
|
||||
Reference in New Issue
Block a user