// public static void ReadGameState(GameState currentState, float remainingGameTime) { CurrentState = currentState; RemainingGameTime = remainingGameTime; switch (CurrentState) { case GameState.Waiting: WaitingForGame?.Invoke(); break; case GameState.Playing: GameActivated?.Invoke(RemainingGameTime); break; case GameState.Ended: GameEnded?.Invoke(); break; case GameState.Restarting: GameRestarting?.Invoke(); break; case GameState.ShuttingDown: ServerShuttingDown?.Invoke(); break; } }
public ClientNetworkStateContainer(Prompter prompter) { NotConnected = new NotConnected(); PendingLogOn = new PendingLogOn(prompter); WaitingForBoard = new WaitingForBoard(); PendingBoard = new PendingBoard(prompter); WaitingForGame = new WaitingForGame(prompter); FoundGame = new FoundGame(prompter); InitialGame = new InitialGame(prompter); MyTurn = new MyTurn(); TheirTurn = new TheirTurn(prompter); Waiting = new Waiting(prompter); }
public ServerNetworkStateContainer(BspSender sender, IBspDisconnecter disconnecter, GameTypeRepository gameTypeRepo, UserRepository userRepo, MatchMaker matchMaker) { var state = new BspServerState(); NotConnected = new NotConnected(state, sender, gameTypeRepo, userRepo); PendingLogOn = new PendingLogOn(); WaitingForBoard = new WaitingForBoard(state, sender, gameTypeRepo, matchMaker); PendingBoard = new PendingBoard(); WaitingForGame = new WaitingForGame(state, sender, disconnecter, userRepo); FoundGame = new FoundGame(state, sender, disconnecter, userRepo); InitialGame = new InitialGame(); MyTurn = new MyTurn(state, sender, disconnecter, userRepo); TheirTurn = new TheirTurn(); Waiting = new Waiting(); }