BioTrivia finally finished
@ -27,13 +27,16 @@
|
|||||||
Верни отговори:
|
Верни отговори:
|
||||||
<igx-linear-bar [max]="questions.length" [value]="guessedQuestions"></igx-linear-bar>
|
<igx-linear-bar [max]="questions.length" [value]="guessedQuestions"></igx-linear-bar>
|
||||||
<div *ngIf="guessedQuestions < questions.length">
|
<div *ngIf="guessedQuestions < questions.length">
|
||||||
<h6>Грешни отговори</h6>
|
<h6>Грешни отговори:</h6>
|
||||||
<div *ngFor="let answer of getIncorrectAnswers()">
|
<div class="wrongAnswers">
|
||||||
<b>{{answer.question.question}}</b><br>
|
<div *ngFor="let answer of getIncorrectAnswers()">
|
||||||
Вашият отговор: {{answer.answer}}
|
<b>{{answer.index}}. {{answer.question.question}}</b><br>
|
||||||
Правилен отговор: {{answer.question.answer.correctChoise}}
|
<div><div class="identation"></div> Вашият отговор: {{answer.answer}}</div>
|
||||||
|
<div><div class="identation"></div> Правилен отговор: {{answer.question.answer.correctChoise}}</div>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<button igxButton igxRipple routerLink="">Върни се в началния екран</button>
|
<button igxButton igxRipple routerLink="">Върни се в началния екран</button>
|
||||||
|
<button igxButton igxRipple (click)="restartGame()">Играй отново</button>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
@ -47,4 +47,15 @@
|
|||||||
top: 0;
|
top: 0;
|
||||||
left: 0;
|
left: 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.wrongAnswers {
|
||||||
|
max-height: 50vh;
|
||||||
|
overflow-y: auto;
|
||||||
|
}
|
||||||
|
|
||||||
|
.identation {
|
||||||
|
width: 2em;
|
||||||
|
height: 1em;
|
||||||
|
display: inline-block;
|
||||||
|
}
|
||||||
}
|
}
|
@ -2,6 +2,7 @@ import { Component, ElementRef, NgZone, OnInit, ViewChild, ViewChildren } from '
|
|||||||
import { IgxRadioComponent, IgxRadioGroupDirective } from 'igniteui-angular';
|
import { IgxRadioComponent, IgxRadioGroupDirective } from 'igniteui-angular';
|
||||||
import { Observable, Subject } from 'rxjs';
|
import { Observable, Subject } from 'rxjs';
|
||||||
import { Answer, DbService, Question } from '../db.service';
|
import { Answer, DbService, Question } from '../db.service';
|
||||||
|
import { UserdataService } from '../userdata.service';
|
||||||
|
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
@ -33,7 +34,8 @@ export class MinigameBiotriviaComponent implements OnInit {
|
|||||||
}
|
}
|
||||||
|
|
||||||
constructor(
|
constructor(
|
||||||
private db: DbService
|
private db: DbService,
|
||||||
|
private userdata: UserdataService,
|
||||||
) { }
|
) { }
|
||||||
|
|
||||||
ngOnInit(): void {
|
ngOnInit(): void {
|
||||||
@ -126,7 +128,7 @@ export class MinigameBiotriviaComponent implements OnInit {
|
|||||||
startingEl.style.position = 'absolute';
|
startingEl.style.position = 'absolute';
|
||||||
|
|
||||||
this.stage = 'starting-ongoing';
|
this.stage = 'starting-ongoing';
|
||||||
this.questions = this.db.getRandomQuestions(1, this.db.getRandomCategory());
|
this.questions = this.db.getRandomQuestions(5, this.db.getRandomCategory());
|
||||||
this.loadNextQuestion();
|
this.loadNextQuestion();
|
||||||
|
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
@ -160,7 +162,39 @@ export class MinigameBiotriviaComponent implements OnInit {
|
|||||||
return array;
|
return array;
|
||||||
}
|
}
|
||||||
|
|
||||||
getIncorrectAnswers(): { question: Question, answer: string }[] {
|
getIncorrectAnswers(): { question: Question, answer: string, index: number }[] {
|
||||||
return this.answers.filter(v => v.answer === v.question.answer.correctChoise);
|
return this.answers.map((v, i) => {
|
||||||
|
return { ...v, index: i + 1 };
|
||||||
|
}).filter((v) => v.answer !== v.question.answer.correctChoise);
|
||||||
|
}
|
||||||
|
|
||||||
|
restartGame(): void {
|
||||||
|
if (this.stage !== 'ended') return;
|
||||||
|
|
||||||
|
const endingEl = this.endingElementRef.first.nativeElement as HTMLElement;
|
||||||
|
endingEl.style.position = 'absolute';
|
||||||
|
|
||||||
|
this.stage = 'ongoing-ended';
|
||||||
|
|
||||||
|
this.questions = this.db.getRandomQuestions(5, this.db.getRandomCategory());
|
||||||
|
|
||||||
|
this.displayError = false;
|
||||||
|
|
||||||
|
this.guessedQuestions = 0;
|
||||||
|
this.currQuestionN = 0;
|
||||||
|
this.answers = [];
|
||||||
|
|
||||||
|
this.selectedAnswer = '';
|
||||||
|
|
||||||
|
this.loadNextQuestion();
|
||||||
|
|
||||||
|
setTimeout(() => {
|
||||||
|
const ongoingEl = this.ongoingElementRef.first.nativeElement as HTMLElement;
|
||||||
|
|
||||||
|
// tslint:disable-next-line: deprecation
|
||||||
|
this.animateElements(endingEl, ongoingEl).subscribe(() => {
|
||||||
|
this.stage = 'ongoing';
|
||||||
|
});
|
||||||
|
}, 20);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
19
apollo-frontend/src/app/mock.minigames.ts
Normal file
@ -0,0 +1,19 @@
|
|||||||
|
import { Saved, Minigame } from "./db.service";
|
||||||
|
|
||||||
|
export const mock_minigames: Saved<Minigame>[] = [
|
||||||
|
{
|
||||||
|
id: '0',
|
||||||
|
el: {
|
||||||
|
name: 'Рециклиране',
|
||||||
|
url: '/minigames/conveyor-belt',
|
||||||
|
comingSoon: true,
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
id: '0',
|
||||||
|
el: {
|
||||||
|
name: 'BioTrivia',
|
||||||
|
url: '/minigames/biotrivia',
|
||||||
|
}
|
||||||
|
}
|
||||||
|
];
|
BIN
apollo-frontend/src/assets/images/cards/image_1.jpg
Normal file
After Width: | Height: | Size: 365 KiB |
BIN
apollo-frontend/src/assets/images/cards/image_10.jpg
Normal file
After Width: | Height: | Size: 62 KiB |
BIN
apollo-frontend/src/assets/images/cards/image_2.jpg
Normal file
After Width: | Height: | Size: 30 KiB |
BIN
apollo-frontend/src/assets/images/cards/image_3.jpg
Normal file
After Width: | Height: | Size: 317 KiB |
BIN
apollo-frontend/src/assets/images/cards/image_4.jpg
Normal file
After Width: | Height: | Size: 23 KiB |
BIN
apollo-frontend/src/assets/images/cards/image_5.jpg
Normal file
After Width: | Height: | Size: 210 KiB |
BIN
apollo-frontend/src/assets/images/cards/image_6.jpg
Normal file
After Width: | Height: | Size: 737 KiB |
BIN
apollo-frontend/src/assets/images/cards/image_7.jpg
Normal file
After Width: | Height: | Size: 18 KiB |
BIN
apollo-frontend/src/assets/images/cards/image_8.jpg
Normal file
After Width: | Height: | Size: 172 KiB |
BIN
apollo-frontend/src/assets/images/cards/image_9.jpg
Normal file
After Width: | Height: | Size: 7.1 KiB |
@ -23,8 +23,8 @@ html {
|
|||||||
|
|
||||||
@import "~igniteui-angular/lib/core/styles/themes/index";
|
@import "~igniteui-angular/lib/core/styles/themes/index";
|
||||||
|
|
||||||
$company-color: rgb(139, 39, 39); // Some green shade I like
|
$company-color: rgb(17, 90, 48); // Some green shade I like
|
||||||
$secondary-color: rgb(139, 39, 39); // Watermelon pink
|
$secondary-color: rgb(156, 28, 28); // Watermelon pink
|
||||||
|
|
||||||
$my-color-palette: igx-palette($primary: $company-color,
|
$my-color-palette: igx-palette($primary: $company-color,
|
||||||
$secondary: $secondary-color);
|
$secondary: $secondary-color);
|
||||||
@ -41,4 +41,5 @@ $my-color-palette: igx-palette($primary: $company-color,
|
|||||||
background-color: #f8f8f855;
|
background-color: #f8f8f855;
|
||||||
backdrop-filter: blur(10px);
|
backdrop-filter: blur(10px);
|
||||||
box-shadow: #0004 3px 3px 5px;
|
box-shadow: #0004 3px 3px 5px;
|
||||||
|
|
||||||
}
|
}
|