fixes
This commit is contained in:
parent
5dd911fb01
commit
ad965cfd6a
12 changed files with 37 additions and 16 deletions
|
|
@ -7,7 +7,7 @@ import { ActivatedRoute, Router } from "@angular/router";
|
||||||
import { filter, map, takeUntil } from "rxjs/operators";
|
import { filter, map, takeUntil } from "rxjs/operators";
|
||||||
import { ToastService } from "./toast.service";
|
import { ToastService } from "./toast.service";
|
||||||
import { VoiceService } from "./services/voice.service";
|
import { VoiceService } from "./services/voice.service";
|
||||||
import { Subject } from "rxjs";
|
import {delay, delayWhen, Subject} from "rxjs";
|
||||||
import { getAudioPath } from "./helper/tts.helper";
|
import { getAudioPath } from "./helper/tts.helper";
|
||||||
import {animate, keyframes, style, transition, trigger} from "@angular/animations";
|
import {animate, keyframes, style, transition, trigger} from "@angular/animations";
|
||||||
import {environment} from "../environments/environment";
|
import {environment} from "../environments/environment";
|
||||||
|
|
@ -53,9 +53,8 @@ export class AppComponent implements OnInit, OnDestroy {
|
||||||
console.log(data);
|
console.log(data);
|
||||||
this.eventService.emit(data);
|
this.eventService.emit(data);
|
||||||
});
|
});
|
||||||
this.apiService.getAppState('main').subscribe((result) => {
|
this.apiService.getAppState('main').pipe(takeUntil(this.destroyed),delay(300)).subscribe((result) => {
|
||||||
if(this.router.url.indexOf('admin') === -1) {
|
if(this.router.url.indexOf('admin') === -1 || window.location.href.indexOf('admin') === -1) {
|
||||||
console.log(this.router.url);
|
|
||||||
this.router.navigate([`/${result.value}`]).then(() => {
|
this.router.navigate([`/${result.value}`]).then(() => {
|
||||||
console.log(`navigated to ${result.value}`);
|
console.log(`navigated to ${result.value}`);
|
||||||
})
|
})
|
||||||
|
|
|
||||||
|
|
@ -3,7 +3,7 @@
|
||||||
<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 flex-wrap" *ngIf="this.participants.length > 0">
|
||||||
<ng-container *ngFor="let participant of participants" >
|
<ng-container *ngFor="let participant of participants" >
|
||||||
<app-participant-item [participant]="participant"></app-participant-item>
|
<app-participant-item [participant]="participant"></app-participant-item>
|
||||||
</ng-container>
|
</ng-container>
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
import { Component, OnDestroy, OnInit } from '@angular/core';
|
import { Component, OnDestroy, OnInit } from '@angular/core';
|
||||||
import { ApiService } from "../../services/api.service";
|
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 { EventService } from "../../services/event.service";
|
||||||
import { filter, map, take, takeUntil, tap } from "rxjs/operators";
|
import { filter, map, take, takeUntil, tap } from "rxjs/operators";
|
||||||
import { Participant } from "../../../types/participant";
|
import { Participant } from "../../../types/participant";
|
||||||
|
|
@ -57,7 +57,6 @@ export class AnswerNotificationComponent implements OnInit, OnDestroy {
|
||||||
participants: Participant[] = [];
|
participants: Participant[] = [];
|
||||||
audioSrc: string;
|
audioSrc: string;
|
||||||
private destroyed$ = new Subject<void>();
|
private destroyed$ = new Subject<void>();
|
||||||
|
|
||||||
constructor(private apiService: ApiService, private eventService: EventService, private voiceService: VoiceService) {
|
constructor(private apiService: ApiService, private eventService: EventService, private voiceService: VoiceService) {
|
||||||
this.eventService.answerReceivedEvent.pipe(
|
this.eventService.answerReceivedEvent.pipe(
|
||||||
takeUntil(this.destroyed$),
|
takeUntil(this.destroyed$),
|
||||||
|
|
@ -75,6 +74,8 @@ export class AnswerNotificationComponent implements OnInit, OnDestroy {
|
||||||
// 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) {
|
||||||
|
|
@ -89,7 +90,10 @@ export class AnswerNotificationComponent implements OnInit, OnDestroy {
|
||||||
templateData['user'] = p.name;
|
templateData['user'] = p.name;
|
||||||
templateData['answer'] = validAnswerValue;
|
templateData['answer'] = validAnswerValue;
|
||||||
templateData['user-genitive'] = p.properties.genitive;
|
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 => {
|
this.voiceService.audioEndedSubject.pipe(takeUntil(this.destroyed$), take(1)).subscribe(r => {
|
||||||
if (note && validAnswer) {
|
if (note && validAnswer) {
|
||||||
this.voiceService.playAudio(getAudioPath(note))
|
this.voiceService.playAudio(getAudioPath(note))
|
||||||
|
|
@ -101,13 +105,14 @@ export class AnswerNotificationComponent implements OnInit, OnDestroy {
|
||||||
}
|
}
|
||||||
|
|
||||||
countdownCompleted() {
|
countdownCompleted() {
|
||||||
|
this.participants = [];
|
||||||
console.log(`countdown-completed`);
|
console.log(`countdown-completed`);
|
||||||
this.showCountdown = false;
|
this.showCountdown = false;
|
||||||
this.isShown = false;
|
this.isShown = false;
|
||||||
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 {
|
||||||
|
|
|
||||||
|
|
@ -59,3 +59,6 @@
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
<div class="versus-container" *ngIf="action && action.type === gameQueueTypes.versus">
|
||||||
|
|
||||||
|
</div>
|
||||||
|
|
@ -51,3 +51,10 @@ h1,h3 {
|
||||||
background-color: $thg_yellow;
|
background-color: $thg_yellow;
|
||||||
color: black;
|
color: black;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.versus-container {
|
||||||
|
position: absolute;
|
||||||
|
width: 100%;
|
||||||
|
height: 100vh;
|
||||||
|
background-color: $thg_red;
|
||||||
|
}
|
||||||
|
|
@ -3,7 +3,7 @@ import { EventGameQueue, QueueTypes } from "../../../types/server-event";
|
||||||
import { Participant } from "../../../types/participant";
|
import { Participant } from "../../../types/participant";
|
||||||
import { ApiService } from "../../services/api.service";
|
import { ApiService } from "../../services/api.service";
|
||||||
import { Subject } from "rxjs";
|
import { Subject } from "rxjs";
|
||||||
import {map, takeUntil} from "rxjs/operators";
|
import {map, take, takeUntil} from "rxjs/operators";
|
||||||
import { Question } from "../../../types/question";
|
import { Question } from "../../../types/question";
|
||||||
import { getAudioPath } from "../../helper/tts.helper";
|
import { getAudioPath } from "../../helper/tts.helper";
|
||||||
import { PrizeDto } from "../../../types/prize.dto";
|
import { PrizeDto } from "../../../types/prize.dto";
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
<div class="card rounded m-3 animate__animated" [ngClass]="{ 'small': small, 'shadow': shadow, 'transparent': transparent, 'banned': banned, 'animate__flipInY': small }">
|
<div *ngIf="participant" class="card rounded m-3 animate__animated" [ngClass]="{ 'small': small, 'shadow': shadow, 'transparent': transparent, 'banned': banned, 'animate__flipInY': small }">
|
||||||
<figure class="p-1" *ngIf="participant">
|
<figure class="p-1">
|
||||||
<img [src]="getImageUrl()" class="participant-photo img-fluid">
|
<img [src]="getImageUrl()" class="participant-photo img-fluid">
|
||||||
</figure>
|
</figure>
|
||||||
<div class="card-title">
|
<div class="card-title">
|
||||||
|
|
|
||||||
|
|
@ -13,6 +13,7 @@
|
||||||
|
|
||||||
.transparent {
|
.transparent {
|
||||||
background: inherit;
|
background: inherit;
|
||||||
|
max-width: 200px;
|
||||||
}
|
}
|
||||||
|
|
||||||
figure {
|
figure {
|
||||||
|
|
@ -66,7 +67,7 @@ figure {
|
||||||
}
|
}
|
||||||
|
|
||||||
.big {
|
.big {
|
||||||
font-size: 7em;
|
font-size: 3em;
|
||||||
color: $thg_green;
|
color: $thg_green;
|
||||||
|
|
||||||
transition-delay: 2s;
|
transition-delay: 2s;
|
||||||
|
|
|
||||||
|
|
@ -93,6 +93,11 @@ export class ApiService {
|
||||||
return this.httpClient.post(`${environment.API_URL}/quiz/proceed`, {});
|
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) {
|
markQueueAsCompleted(_id: string) {
|
||||||
return this.httpClient.post(`${environment.API_URL}/game/${_id}/complete`, {});
|
return this.httpClient.post(`${environment.API_URL}/game/${_id}/complete`, {});
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -54,7 +54,7 @@
|
||||||
<img src="../../../assets/cards/BanPlayer.png" class="card-img-top" alt="...">
|
<img src="../../../assets/cards/BanPlayer.png" class="card-img-top" alt="...">
|
||||||
<div class="card-body">
|
<div class="card-body">
|
||||||
<h5 class="card-title">Заблокировать игрока</h5>
|
<h5 class="card-title">Заблокировать игрока</h5>
|
||||||
<p class="card-text">Запрещает игроку давать ответы в следующих двух раундах</p>
|
<p class="card-text">Запрещает игроку давать ответы в случайном количестве раундов</p>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
||||||
|
|
@ -60,7 +60,7 @@ export class OnboardingComponent implements OnInit, OnDestroy {
|
||||||
this.shakeCard(this.luckyCardEl);
|
this.shakeCard(this.luckyCardEl);
|
||||||
}},
|
}},
|
||||||
{
|
{
|
||||||
text: 'Карту бана можно сыграть на любого игрока (даже себя), чтобы отправить его на пару ходов во Владикавказ. Игрок не сможет участвовать в игре в течение двух раундов',
|
text: 'Карту бана можно сыграть на любого игрока (даже себя), чтобы отправить его на пару ходов во Владикавказ. Игрок не сможет участвовать в случайном количестве раундов',
|
||||||
action: () => {
|
action: () => {
|
||||||
this.shakeCard(this.banPlayerEl);
|
this.shakeCard(this.banPlayerEl);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -7,6 +7,7 @@ export enum QueueTypes {
|
||||||
playExtraCard = 'play_extra_card',
|
playExtraCard = 'play_extra_card',
|
||||||
screpa = 'screpa',
|
screpa = 'screpa',
|
||||||
showresults = 'show_results',
|
showresults = 'show_results',
|
||||||
|
versus = 'versus',
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface EventPhotosUpdated {
|
export interface EventPhotosUpdated {
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue