Compare commits
No commits in common. "70cd2a8587333f6e0f68f23d82f7bb3cef776b0a" and "29dc437cc8af963a18441fc89db93c2bcdfbb1a4" have entirely different histories.
70cd2a8587
...
29dc437cc8
5 changed files with 14 additions and 26 deletions
|
|
@ -5,7 +5,6 @@
|
||||||
<h4>Game</h4>
|
<h4>Game</h4>
|
||||||
<button class="btn btn-danger" (click)="clearGameQueue()">Clear queue</button>
|
<button class="btn btn-danger" (click)="clearGameQueue()">Clear queue</button>
|
||||||
<button class="btn btn-danger" (click)="simulateEndGamePoints()">Simulate endgame points</button>
|
<button class="btn btn-danger" (click)="simulateEndGamePoints()">Simulate endgame points</button>
|
||||||
<button class="btn btn-danger" (click)="simulateValidAnswer()">Simulate valid answer</button>
|
|
||||||
<h4>Versus</h4>
|
<h4>Versus</h4>
|
||||||
<button class="btn btn-danger" (click)="simulateVersus()">Begin versus</button>
|
<button class="btn btn-danger" (click)="simulateVersus()">Begin versus</button>
|
||||||
<button class="btn btn-danger" (click)="resetAllVersusTasksAsIncompleted()">Mark all as uncompleted</button>
|
<button class="btn btn-danger" (click)="resetAllVersusTasksAsIncompleted()">Mark all as uncompleted</button>
|
||||||
|
|
|
||||||
|
|
@ -53,8 +53,4 @@ export class AdminTestingComponent implements OnInit, OnDestroy {
|
||||||
simulateEndGamePoints() {
|
simulateEndGamePoints() {
|
||||||
this.testingApiService.simulateEndGamePoints().pipe(takeUntil(this.destroyed$)).subscribe(r => console.log(r));
|
this.testingApiService.simulateEndGamePoints().pipe(takeUntil(this.destroyed$)).subscribe(r => console.log(r));
|
||||||
}
|
}
|
||||||
|
|
||||||
simulateValidAnswer() {
|
|
||||||
this.testingApiService.simulateValidAnswer().pipe(takeUntil(this.destroyed$)).subscribe(r => console.log(r));
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -3,10 +3,8 @@
|
||||||
<div class="d-block justify-content-centers">
|
<div class="d-block justify-content-centers">
|
||||||
<h1 *ngIf="answerIsValid">🎉 Ура, правильный ответ!</h1>
|
<h1 *ngIf="answerIsValid">🎉 Ура, правильный ответ!</h1>
|
||||||
<h1 *ngIf="!answerIsValid">❌ А вот и нет! ❌</h1>
|
<h1 *ngIf="!answerIsValid">❌ А вот и нет! ❌</h1>
|
||||||
<div class="d-flex align-items-center justify-content-center flex-wrap">
|
<div class="d-flex align-items-center justify-content-center">
|
||||||
<ng-container *ngFor="let participant of participants" >
|
<app-participant-item *ngIf="participant" [participant]="participant"></app-participant-item>
|
||||||
<app-participant-item [participant]="participant"></app-participant-item>
|
|
||||||
</ng-container>
|
|
||||||
</div>
|
</div>
|
||||||
<h2 class="text-center" *ngIf="!answerIsValid">выйграл наказание</h2>
|
<h2 class="text-center" *ngIf="!answerIsValid">выйграл наказание</h2>
|
||||||
<audio *ngIf="!answerIsValid" src="assets/sfx/wrong_answer.mp3" autoplay></audio>
|
<audio *ngIf="!answerIsValid" src="assets/sfx/wrong_answer.mp3" autoplay></audio>
|
||||||
|
|
|
||||||
|
|
@ -51,10 +51,11 @@ import { VoiceService } from "../../services/voice.service";
|
||||||
export class AnswerNotificationComponent implements OnInit, OnDestroy {
|
export class AnswerNotificationComponent implements OnInit, OnDestroy {
|
||||||
isShown = false;
|
isShown = false;
|
||||||
answerIsValid = false;
|
answerIsValid = false;
|
||||||
|
participant: Participant;
|
||||||
|
timer: Observable<any>;
|
||||||
countdown = 10;
|
countdown = 10;
|
||||||
showCountdown = false;
|
showCountdown = false;
|
||||||
announceAudio = true;
|
announceAudio = true;
|
||||||
participants: Participant[] = [];
|
|
||||||
audioSrc: string;
|
audioSrc: string;
|
||||||
private destroyed$ = new Subject<void>();
|
private destroyed$ = new Subject<void>();
|
||||||
|
|
||||||
|
|
@ -67,21 +68,20 @@ export class AnswerNotificationComponent implements OnInit, OnDestroy {
|
||||||
takeUntil(this.destroyed$),
|
takeUntil(this.destroyed$),
|
||||||
map(e => e.data)
|
map(e => e.data)
|
||||||
).subscribe(d => this.showNotification(d.telegramId, false, d.validAnswer, null));
|
).subscribe(d => this.showNotification(d.telegramId, false, d.validAnswer, null));
|
||||||
// this.eventService.scoreChangedEvent.pipe(
|
this.eventService.scoreChangedEvent.pipe(
|
||||||
// takeUntil(this.destroyed$),
|
takeUntil(this.destroyed$),
|
||||||
// map(e => e.data),
|
map(e => e.data),
|
||||||
// ).subscribe(e => {
|
).subscribe(e => {
|
||||||
// if(e.telegramId === this.participant.telegramId) {
|
if(e.telegramId === this.participant.telegramId) {
|
||||||
// this.participant.score = e.newScore
|
this.participant.score = e.newScore
|
||||||
// }
|
}
|
||||||
// });
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
showNotification(telegramId: number, validAnswer: boolean, validAnswerValue: string, note: string|null) {
|
showNotification(telegramId: number, validAnswer: boolean, validAnswerValue: string, note: string|null) {
|
||||||
console.log(`showNotification`);
|
this.countdown = validAnswer ? 10 : 5;
|
||||||
this.apiService.getParticipant(telegramId).subscribe(p => {
|
this.apiService.getParticipant(telegramId).subscribe(p => {
|
||||||
this.countdown = validAnswer ? 10 : 5;
|
this.participant = p;
|
||||||
this.participants.push(p);
|
|
||||||
this.isShown = true;
|
this.isShown = true;
|
||||||
this.answerIsValid = validAnswer;
|
this.answerIsValid = validAnswer;
|
||||||
const template = validAnswer ? 'announce-valid' : 'announce-invalid';
|
const template = validAnswer ? 'announce-valid' : 'announce-invalid';
|
||||||
|
|
@ -107,7 +107,6 @@ export class AnswerNotificationComponent implements OnInit, OnDestroy {
|
||||||
this.announceAudio = false;
|
this.announceAudio = false;
|
||||||
this.countdown = 10;
|
this.countdown = 10;
|
||||||
this.apiService.continueGame().subscribe(r => console.log(r));
|
this.apiService.continueGame().subscribe(r => console.log(r));
|
||||||
this.participants = [];
|
|
||||||
}
|
}
|
||||||
|
|
||||||
ngOnInit(): void {
|
ngOnInit(): void {
|
||||||
|
|
|
||||||
|
|
@ -28,8 +28,4 @@ export class TestingApiService {
|
||||||
simulateEndGamePoints() {
|
simulateEndGamePoints() {
|
||||||
return this.httpClient.post(`${API_URL}/quiz/calculate-endgame-extrapoints`, {})
|
return this.httpClient.post(`${API_URL}/quiz/calculate-endgame-extrapoints`, {})
|
||||||
}
|
}
|
||||||
|
|
||||||
simulateValidAnswer() {
|
|
||||||
return this.httpClient.post(`${API_URL}/game/simulate-valid-answer`, {});
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue