Esempio n. 1
0
        public override void Execute(string packet)
        {
            ShowQuestionResponse showQuestionResponse = JsonConvert.DeserializeObject <ShowQuestionResponse>(packet);
            GameViewModel        gvm = ClientObject.view as GameViewModel;
            int questionId           = showQuestionResponse.QuestionId;

            gvm.SelectedQuestionId = questionId;
            Application.Current.Dispatcher.Invoke(() =>
            {
                (((((MainWindow)Application.Current.MainWindow).Frame.Content as Game)?.GameFrame.Content) as CategoriesAndQuestionsTable)?.HideButton(questionId);
            });
            gvm.ShowQuestion(questionId);
            gvm.BlockAnswerButton(true);
            gvm.RemoveQuestion(questionId);
        }
Esempio n. 2
0
        public void Excecute(ClientObject client, ServerObject server, RoomObject room, string packet = "")
        {
            room.Game.list.Clear();
            room.Game.listClickButton.Clear();
            room.Respondents.Clear();
            Console.WriteLine("Show question");
            var request  = JsonConvert.DeserializeObject <ShowQuestionRequest>(packet);
            var response = new ShowQuestionResponse();

            response.QuestionId         = request.QuestionId;
            room.Game.CurrentQuestionId = request.QuestionId;
            string packetResponse = JsonConvert.SerializeObject(response);

            room.SendMessageToAllClients(packetResponse);
            //останавливаем таймер когда игрок выбрал вопрос
            room.Game.StopSelectQuestionTimer();
            //запускаем таймер для нажания на кнопку "ответ"
            room.Game.StartAnswerButtonClickTimer();
        }