Loading src/app/dao/TabuMiddlewareService.ts +5 −0 Original line number Original line Diff line number Diff line Loading @@ -38,4 +38,9 @@ export class TabuMiddlewareService { console.log(req); console.log(req); return this.request('POST', `${environment.tabuMiddlewareURL}getGamestatus`, req); return this.request('POST', `${environment.tabuMiddlewareURL}getGamestatus`, req); } } getS2C(req: any): Promise<any> { console.log(req); return this.request('POST', `${environment.tabuMiddlewareURL}getS2C`, req); } } } src/app/game/game.component.html +6 −6 Original line number Original line Diff line number Diff line Loading @@ -2,34 +2,34 @@ <p>Punktestand: {{points}}</p> <p>Punktestand: {{points}}</p> <mat-card> <mat-card> <h1> <h1> {{word}} {{cardInfo.solution}} </h1> </h1> </mat-card> </mat-card> <br> <br> <mat-card> <mat-card> <h2> <h2> {{forbidden1}} {{cardInfo.tabu1}} </h2> </h2> </mat-card> </mat-card> <mat-card> <mat-card> <h2> <h2> {{forbidden2}} {{cardInfo.tabu2}} </h2> </h2> </mat-card> </mat-card> <mat-card> <mat-card> <h2> <h2> {{forbidden3}} {{cardInfo.tabu3}} </h2> </h2> </mat-card> </mat-card> <mat-card> <mat-card> <h2> <h2> {{forbidden4}} {{cardInfo.tabu4}} </h2> </h2> </mat-card> </mat-card> <mat-card> <mat-card> <h2> <h2> {{forbidden5}} {{cardInfo.tabu5}} </h2> </h2> </mat-card> </mat-card> <br> <br> Loading src/app/game/game.component.ts +34 −7 Original line number Original line Diff line number Diff line import { Component, OnInit } from '@angular/core'; import { Component, OnInit } from '@angular/core'; import {ProgressSpinnerMode} from '@angular/material/progress-spinner'; import {ProgressSpinnerMode} from '@angular/material/progress-spinner'; import {CardInfo} from '../interface/cardInfo'; import {TabuMiddlewareService} from '../dao/TabuMiddlewareService'; import {ActivatedRoute} from '@angular/router'; @Component({ @Component({ selector: 'app-game', selector: 'app-game', templateUrl: './game.component.html', templateUrl: './game.component.html', Loading @@ -7,21 +10,45 @@ import {ProgressSpinnerMode} from '@angular/material/progress-spinner'; }) }) export class GameComponent implements OnInit { export class GameComponent implements OnInit { word = 'Hund'; sessionName = ''; forbidden1 = 'Haustier'; cardInfo: CardInfo = { forbidden2 = 'Katze'; cardID: -1, forbidden3 = 'Gassi'; solution: '', forbidden4 = 'Leine'; tabu1: '', forbidden5 = 'Welpe'; tabu2: '', tabu3: '', tabu4: '', tabu5: '' }; points = 0; points = 0; color = 'primary'; color = 'primary'; mode: ProgressSpinnerMode = 'determinate'; mode: ProgressSpinnerMode = 'determinate'; value = 50; value = 50; constructor() { } constructor(private service: TabuMiddlewareService, private activatedRoute: ActivatedRoute) {} ngOnInit(): void { ngOnInit(): void { this.activatedRoute.paramMap.subscribe(params => { this.sessionName = String(params.get('sessionName')); this.service.getS2C({spielname: this.sessionName}).then(value => { console.log('Test1:', value); const status = JSON.parse(value.status); if (status) { console.log('Test2:', value); this.cardInfo.cardID = JSON.parse(value.cardID); this.cardInfo.solution = value.solution; this.cardInfo.tabu1 = value.tabu1; this.cardInfo.tabu2 = value.tabu2; this.cardInfo.tabu3 = value.tabu3; this.cardInfo.tabu4 = value.tabu4; this.cardInfo.tabu5 = value.tabu5; } } console.log(this.cardInfo); }).catch(reason => console.log(reason)); }); } rightAnswer(): void{ rightAnswer(): void{ this.points += 1; this.points += 1; } } Loading src/app/interface/cardInfo.ts 0 → 100644 +9 −0 Original line number Original line Diff line number Diff line export interface CardInfo { cardID: number; solution: string; tabu1: string; tabu2: string; tabu3: string; tabu4: string; tabu5: string; } src/app/overview/overview.component.ts +1 −2 Original line number Original line Diff line number Diff line Loading @@ -27,8 +27,7 @@ export class OverviewComponent implements OnInit { ngOnInit(): void { ngOnInit(): void { this.activatedRoute.paramMap.subscribe(params => { this.activatedRoute.paramMap.subscribe(params => { this.sessionName = String(params.get('sessionName')); this.sessionName = String(params.get('sessionName')); console.log('SessionName: ', this.sessionName); this.service.getGamestatus({'spielname': this.sessionName}).then(value => { this.service.getGamestatus({"spielname": this.sessionName}).then(value => { const status = JSON.parse(value.status); const status = JSON.parse(value.status); if (status) { if (status) { this.gameStatus.sessionID = JSON.parse(value.sessionID); this.gameStatus.sessionID = JSON.parse(value.sessionID); Loading Loading
src/app/dao/TabuMiddlewareService.ts +5 −0 Original line number Original line Diff line number Diff line Loading @@ -38,4 +38,9 @@ export class TabuMiddlewareService { console.log(req); console.log(req); return this.request('POST', `${environment.tabuMiddlewareURL}getGamestatus`, req); return this.request('POST', `${environment.tabuMiddlewareURL}getGamestatus`, req); } } getS2C(req: any): Promise<any> { console.log(req); return this.request('POST', `${environment.tabuMiddlewareURL}getS2C`, req); } } }
src/app/game/game.component.html +6 −6 Original line number Original line Diff line number Diff line Loading @@ -2,34 +2,34 @@ <p>Punktestand: {{points}}</p> <p>Punktestand: {{points}}</p> <mat-card> <mat-card> <h1> <h1> {{word}} {{cardInfo.solution}} </h1> </h1> </mat-card> </mat-card> <br> <br> <mat-card> <mat-card> <h2> <h2> {{forbidden1}} {{cardInfo.tabu1}} </h2> </h2> </mat-card> </mat-card> <mat-card> <mat-card> <h2> <h2> {{forbidden2}} {{cardInfo.tabu2}} </h2> </h2> </mat-card> </mat-card> <mat-card> <mat-card> <h2> <h2> {{forbidden3}} {{cardInfo.tabu3}} </h2> </h2> </mat-card> </mat-card> <mat-card> <mat-card> <h2> <h2> {{forbidden4}} {{cardInfo.tabu4}} </h2> </h2> </mat-card> </mat-card> <mat-card> <mat-card> <h2> <h2> {{forbidden5}} {{cardInfo.tabu5}} </h2> </h2> </mat-card> </mat-card> <br> <br> Loading
src/app/game/game.component.ts +34 −7 Original line number Original line Diff line number Diff line import { Component, OnInit } from '@angular/core'; import { Component, OnInit } from '@angular/core'; import {ProgressSpinnerMode} from '@angular/material/progress-spinner'; import {ProgressSpinnerMode} from '@angular/material/progress-spinner'; import {CardInfo} from '../interface/cardInfo'; import {TabuMiddlewareService} from '../dao/TabuMiddlewareService'; import {ActivatedRoute} from '@angular/router'; @Component({ @Component({ selector: 'app-game', selector: 'app-game', templateUrl: './game.component.html', templateUrl: './game.component.html', Loading @@ -7,21 +10,45 @@ import {ProgressSpinnerMode} from '@angular/material/progress-spinner'; }) }) export class GameComponent implements OnInit { export class GameComponent implements OnInit { word = 'Hund'; sessionName = ''; forbidden1 = 'Haustier'; cardInfo: CardInfo = { forbidden2 = 'Katze'; cardID: -1, forbidden3 = 'Gassi'; solution: '', forbidden4 = 'Leine'; tabu1: '', forbidden5 = 'Welpe'; tabu2: '', tabu3: '', tabu4: '', tabu5: '' }; points = 0; points = 0; color = 'primary'; color = 'primary'; mode: ProgressSpinnerMode = 'determinate'; mode: ProgressSpinnerMode = 'determinate'; value = 50; value = 50; constructor() { } constructor(private service: TabuMiddlewareService, private activatedRoute: ActivatedRoute) {} ngOnInit(): void { ngOnInit(): void { this.activatedRoute.paramMap.subscribe(params => { this.sessionName = String(params.get('sessionName')); this.service.getS2C({spielname: this.sessionName}).then(value => { console.log('Test1:', value); const status = JSON.parse(value.status); if (status) { console.log('Test2:', value); this.cardInfo.cardID = JSON.parse(value.cardID); this.cardInfo.solution = value.solution; this.cardInfo.tabu1 = value.tabu1; this.cardInfo.tabu2 = value.tabu2; this.cardInfo.tabu3 = value.tabu3; this.cardInfo.tabu4 = value.tabu4; this.cardInfo.tabu5 = value.tabu5; } } console.log(this.cardInfo); }).catch(reason => console.log(reason)); }); } rightAnswer(): void{ rightAnswer(): void{ this.points += 1; this.points += 1; } } Loading
src/app/interface/cardInfo.ts 0 → 100644 +9 −0 Original line number Original line Diff line number Diff line export interface CardInfo { cardID: number; solution: string; tabu1: string; tabu2: string; tabu3: string; tabu4: string; tabu5: string; }
src/app/overview/overview.component.ts +1 −2 Original line number Original line Diff line number Diff line Loading @@ -27,8 +27,7 @@ export class OverviewComponent implements OnInit { ngOnInit(): void { ngOnInit(): void { this.activatedRoute.paramMap.subscribe(params => { this.activatedRoute.paramMap.subscribe(params => { this.sessionName = String(params.get('sessionName')); this.sessionName = String(params.get('sessionName')); console.log('SessionName: ', this.sessionName); this.service.getGamestatus({'spielname': this.sessionName}).then(value => { this.service.getGamestatus({"spielname": this.sessionName}).then(value => { const status = JSON.parse(value.status); const status = JSON.parse(value.status); if (status) { if (status) { this.gameStatus.sessionID = JSON.parse(value.sessionID); this.gameStatus.sessionID = JSON.parse(value.sessionID); Loading