Example #1
0
        public async Task <RideTheBus> Load()
        {
            var gameResponse = await _gameState.LoadGame(Game.GameType, Game.Id.ToString());

            Game = Converter <RideTheBus> .FromJson(gameResponse);

            return(Game);
        }
Example #2
0
        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);
            }
        }
Example #3
0
        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);
        }
Example #4
0
        private async void Load(Guid id)
        {
            var gameResponse = await _gameState.LoadGame(GameType.RideTheBus, id.ToString());

            Game = Converter <RideTheBus> .FromJson(gameResponse);
        }