diff --git a/src/app/app.component.ts b/src/app/app.component.ts index d5b8318..a0aa6c9 100644 --- a/src/app/app.component.ts +++ b/src/app/app.component.ts @@ -7,7 +7,7 @@ import { ActivatedRoute, Router } from "@angular/router"; import { filter, map, takeUntil } from "rxjs/operators"; import { ToastService } from "./toast.service"; import { VoiceService } from "./services/voice.service"; -import { Subject } from "rxjs"; +import {delay, delayWhen, Subject} from "rxjs"; import { getAudioPath } from "./helper/tts.helper"; import {animate, keyframes, style, transition, trigger} from "@angular/animations"; import {environment} from "../environments/environment"; @@ -53,9 +53,8 @@ export class AppComponent implements OnInit, OnDestroy { console.log(data); this.eventService.emit(data); }); - this.apiService.getAppState('main').subscribe((result) => { - if(this.router.url.indexOf('admin') === -1) { - console.log(this.router.url); + this.apiService.getAppState('main').pipe(takeUntil(this.destroyed),delay(300)).subscribe((result) => { + if(this.router.url.indexOf('admin') === -1 || window.location.href.indexOf('admin') === -1) { this.router.navigate([`/${result.value}`]).then(() => { console.log(`navigated to ${result.value}`); }) diff --git a/src/app/components/answer-notification/answer-notification.component.html b/src/app/components/answer-notification/answer-notification.component.html index 5474eca..e9ceced 100644 --- a/src/app/components/answer-notification/answer-notification.component.html +++ b/src/app/components/answer-notification/answer-notification.component.html @@ -3,7 +3,7 @@

🎉 Ура, правильный ответ!

❌ А вот и нет! ❌

-
+
diff --git a/src/app/components/answer-notification/answer-notification.component.ts b/src/app/components/answer-notification/answer-notification.component.ts index eebb819..c23b264 100644 --- a/src/app/components/answer-notification/answer-notification.component.ts +++ b/src/app/components/answer-notification/answer-notification.component.ts @@ -1,6 +1,6 @@ import { Component, OnDestroy, OnInit } from '@angular/core'; import { ApiService } from "../../services/api.service"; -import { interval, Observable, Subject } from "rxjs"; +import {concatMap, interval, Observable, Subject} from "rxjs"; import { EventService } from "../../services/event.service"; import { filter, map, take, takeUntil, tap } from "rxjs/operators"; import { Participant } from "../../../types/participant"; @@ -57,7 +57,6 @@ export class AnswerNotificationComponent implements OnInit, OnDestroy { participants: Participant[] = []; audioSrc: string; private destroyed$ = new Subject(); - constructor(private apiService: ApiService, private eventService: EventService, private voiceService: VoiceService) { this.eventService.answerReceivedEvent.pipe( takeUntil(this.destroyed$), @@ -75,6 +74,8 @@ export class AnswerNotificationComponent implements OnInit, OnDestroy { // this.participant.score = e.newScore // } // }); + + } showNotification(telegramId: number, validAnswer: boolean, validAnswerValue: string, note: string|null) { @@ -89,7 +90,10 @@ export class AnswerNotificationComponent implements OnInit, OnDestroy { templateData['user'] = p.name; templateData['answer'] = validAnswerValue; templateData['user-genitive'] = p.properties.genitive; - this.voiceService.playAudio(getAudioPathWithTemplate(template, '', templateData)); + if(this.participants.length === 1) { + this.voiceService.playAudio(getAudioPathWithTemplate(template, '', templateData)); + } + //this.voiceService.playAudio(getAudioPathWithTemplate(template, '', templateData)); this.voiceService.audioEndedSubject.pipe(takeUntil(this.destroyed$), take(1)).subscribe(r => { if (note && validAnswer) { this.voiceService.playAudio(getAudioPath(note)) @@ -101,13 +105,14 @@ export class AnswerNotificationComponent implements OnInit, OnDestroy { } countdownCompleted() { + this.participants = []; console.log(`countdown-completed`); this.showCountdown = false; this.isShown = false; this.announceAudio = false; this.countdown = 10; - this.apiService.continueGame().subscribe(r => console.log(r)); - this.participants = []; + // this.apiService.continueGame().subscribe(r => console.log(r)); + } ngOnInit(): void { diff --git a/src/app/components/game-queue/game-queue.component.html b/src/app/components/game-queue/game-queue.component.html index 3413d44..0851407 100644 --- a/src/app/components/game-queue/game-queue.component.html +++ b/src/app/components/game-queue/game-queue.component.html @@ -59,3 +59,6 @@
+
+ +
\ No newline at end of file diff --git a/src/app/components/game-queue/game-queue.component.scss b/src/app/components/game-queue/game-queue.component.scss index 7abaa08..e693b83 100644 --- a/src/app/components/game-queue/game-queue.component.scss +++ b/src/app/components/game-queue/game-queue.component.scss @@ -50,4 +50,11 @@ h1,h3 { animation: results 3s 1; background-color: $thg_yellow; color: black; +} + +.versus-container { + position: absolute; + width: 100%; + height: 100vh; + background-color: $thg_red; } \ No newline at end of file diff --git a/src/app/components/game-queue/game-queue.component.ts b/src/app/components/game-queue/game-queue.component.ts index b83ad11..596fd11 100644 --- a/src/app/components/game-queue/game-queue.component.ts +++ b/src/app/components/game-queue/game-queue.component.ts @@ -3,7 +3,7 @@ import { EventGameQueue, QueueTypes } from "../../../types/server-event"; import { Participant } from "../../../types/participant"; import { ApiService } from "../../services/api.service"; import { Subject } from "rxjs"; -import {map, takeUntil} from "rxjs/operators"; +import {map, take, takeUntil} from "rxjs/operators"; import { Question } from "../../../types/question"; import { getAudioPath } from "../../helper/tts.helper"; import { PrizeDto } from "../../../types/prize.dto"; diff --git a/src/app/components/participant-item/participant-item.component.html b/src/app/components/participant-item/participant-item.component.html index 76ca1ac..b2804d4 100644 --- a/src/app/components/participant-item/participant-item.component.html +++ b/src/app/components/participant-item/participant-item.component.html @@ -1,5 +1,5 @@ -
-
+
+
diff --git a/src/app/components/participant-item/participant-item.component.scss b/src/app/components/participant-item/participant-item.component.scss index 346c927..98d6079 100644 --- a/src/app/components/participant-item/participant-item.component.scss +++ b/src/app/components/participant-item/participant-item.component.scss @@ -13,6 +13,7 @@ .transparent { background: inherit; + max-width: 200px; } figure { @@ -66,7 +67,7 @@ figure { } .big { - font-size: 7em; + font-size: 3em; color: $thg_green; transition-delay: 2s; diff --git a/src/app/services/api.service.ts b/src/app/services/api.service.ts index c7886d6..ee603ca 100644 --- a/src/app/services/api.service.ts +++ b/src/app/services/api.service.ts @@ -93,6 +93,11 @@ export class ApiService { return this.httpClient.post(`${environment.API_URL}/quiz/proceed`, {}); } + questionTimeout() { + console.log(`continue game`); + return this.httpClient.post(`${environment.API_URL}/quiz/timeout`, {}); + } + markQueueAsCompleted(_id: string) { return this.httpClient.post(`${environment.API_URL}/game/${_id}/complete`, {}); } diff --git a/src/app/views/onboarding/onboarding.component.html b/src/app/views/onboarding/onboarding.component.html index 8b1cab9..071a83c 100644 --- a/src/app/views/onboarding/onboarding.component.html +++ b/src/app/views/onboarding/onboarding.component.html @@ -54,7 +54,7 @@ ...
Заблокировать игрока
-

Запрещает игроку давать ответы в следующих двух раундах

+

Запрещает игроку давать ответы в случайном количестве раундов

diff --git a/src/app/views/onboarding/onboarding.component.ts b/src/app/views/onboarding/onboarding.component.ts index cc787b6..ced4203 100644 --- a/src/app/views/onboarding/onboarding.component.ts +++ b/src/app/views/onboarding/onboarding.component.ts @@ -60,7 +60,7 @@ export class OnboardingComponent implements OnInit, OnDestroy { this.shakeCard(this.luckyCardEl); }}, { - text: 'Карту бана можно сыграть на любого игрока (даже себя), чтобы отправить его на пару ходов во Владикавказ. Игрок не сможет участвовать в игре в течение двух раундов', + text: 'Карту бана можно сыграть на любого игрока (даже себя), чтобы отправить его на пару ходов во Владикавказ. Игрок не сможет участвовать в случайном количестве раундов', action: () => { this.shakeCard(this.banPlayerEl); } diff --git a/src/types/server-event.ts b/src/types/server-event.ts index d752923..ac762bb 100644 --- a/src/types/server-event.ts +++ b/src/types/server-event.ts @@ -7,6 +7,7 @@ export enum QueueTypes { playExtraCard = 'play_extra_card', screpa = 'screpa', showresults = 'show_results', + versus = 'versus', } export interface EventPhotosUpdated {