Esempio n. 1
0
        public async Task <IActionResult> StartSession(StartSessionRequest reqeust)
        {
            IEnumerable <PlayerServerSide> playerInLobby = playerRegistry.GetPlayersInLobby(reqeust.PlayerId);

            List <QuestionResponse> question = new List <QuestionResponse>
            {
                new QuestionResponse {
                    Text = "What number is NOT a Fibonacci number", Options = new List <String> {
                        "1", "2", "8", "20"
                    }, CorrectOptionIndex = 3, Value = 1000,
                },
                new QuestionResponse {
                    Text = "What was the name of the supernatural computer in »The hitchhiker's guide to the galaxy«", Options = new List <String> {
                        "Who cares", "Think deep", "Deep Thought", "42"
                    }, CorrectOptionIndex = 2, Value = 2000,
                },
                new QuestionResponse {
                    Text = "According to Scott Pilgrim, how many vegan law violations can you commit without losing your vegan superpowers?", Options = new List <String> {
                        "4", "3", "2", "1"
                    }, CorrectOptionIndex = 1, Value = 3000,
                },
                new QuestionResponse {
                    Text = "You know what? (F is for Familiy)", Options = new List <String> {
                        "You know what?", "You know what? You know what?", "You know what? You know what? You know what? ", "You know what? You know what? You know what? You know what?"
                    }, CorrectOptionIndex = 1, Value = 4000,
                },
            };

            StartSessionResponse response = new StartSessionResponse
            {
                PlayerInSession = playerInLobby.Select(x => GetPlayerOverview(x)).ToList(),
                Questions       = question
            };

            await lobbyHubContext.Clients.Group(reqeust.LobbyId.ToString()).StartSession(response);

            return(base.NoContent());
        }