public async Task <RideTheBus> Load() { var gameResponse = await _gameState.LoadGame(Game.GameType, Game.Id.ToString()); Game = Converter <RideTheBus> .FromJson(gameResponse); return(Game); }
public RideTheBusGame(IHandleGameState gameState, Guid?id = null) { _gameState = gameState; if (id == null) { Game = new RideTheBus(); Game.Id = Guid.NewGuid(); Game.GameState = GameState.New; } else { Load((Guid)id); } }
public async Task <RideTheBus> PlayerSwitch(string name) { var player = Game.Players.Single(player => player.Name == name); if (player.State == PlayerState.PlayingTurn) { player.State = PlayerState.Turn; await Save(); Game = await Load(); } return(Game); }
private async void Load(Guid id) { var gameResponse = await _gameState.LoadGame(GameType.RideTheBus, id.ToString()); Game = Converter <RideTheBus> .FromJson(gameResponse); }