Loading src/app/dao/TabuMiddlewareService.ts +15 −0 Original line number Diff line number Diff line Loading @@ -53,4 +53,19 @@ export class TabuMiddlewareService { console.log(req); return this.request('POST', `${environment.tabuMiddlewareURL}removePoint`, req); } newGame(req: any): Promise<any> { console.log(req); return this.request('POST', `${environment.tabuMiddlewareURL}newGame`, req); } newRound(req: any): Promise<any> { console.log(req); return this.request('POST', `${environment.tabuMiddlewareURL}newRound`, req); } endRound(req: any): Promise<any> { console.log(req); return this.request('POST', `${environment.tabuMiddlewareURL}endRound`, req); } } src/app/overview/overview.component.html +2 −2 Original line number Diff line number Diff line Loading @@ -2,7 +2,7 @@ <mat-card class="transparent"> <div class="FloatLeftAndCenterElement"> <div class="newStartButtonLeft"> <button matTooltip="Neues Spiel starten" [disabled]="buttonPlayDisabled" mat-raised-button color="primary" (click)="startGame()"> <button matTooltip="Neues Spiel starten" [disabled]="buttonNewGameDisabled" mat-raised-button color="primary" (click)="startGame()"> <mat-icon color = "white" aria-hidden="false">autorenew</mat-icon></button> </div> <div class="CenterText"> Loading Loading @@ -39,7 +39,7 @@ <br> <mat-card-title>{{nextTeam}} ist am Zug:</mat-card-title> <br> <button [disabled]="buttonPlayDisabled" mat-raised-button color="primary">Nächste Runde</button> <button [disabled]="buttonNextRoundDisabled" mat-raised-button color="primary" (click)="nextRound()">Nächste Runde</button> </mat-card-actions> </mat-card> </div> src/app/overview/overview.component.ts +17 −3 Original line number Diff line number Diff line Loading @@ -2,6 +2,7 @@ import { Component, OnInit } from '@angular/core'; import {ActivatedRoute, Router} from '@angular/router'; import {TabuMiddlewareService} from '../dao/TabuMiddlewareService'; import {GameStatus} from '../interface/gameStatus'; import {error} from 'selenium-webdriver'; @Component({ selector: 'app-overview', Loading @@ -13,7 +14,8 @@ export class OverviewComponent implements OnInit { blue = 'choose'; nextTeam = 'Blau'; team = ''; buttonPlayDisabled = true; buttonNewGameDisabled = true; buttonNextRoundDisabled = true; sessionName = ''; membership = 'Wähle dein Team'; gameStatus: GameStatus = { Loading @@ -36,13 +38,13 @@ export class OverviewComponent implements OnInit { console.log('Team:', this.team); if (this.team === 'red'){ this.membership = 'Du gehörst zu Team rot!'; this.buttonPlayDisabled = false; this.buttonNewGameDisabled = false; this.red = 'red'; this.blue = 'choose'; } else if (this.team === 'blue'){ this.membership = 'Du gehörst zu Team blau!'; this.buttonPlayDisabled = false; this.buttonNewGameDisabled = false; this.blue = 'blue'; this.red = 'choose'; } Loading @@ -64,9 +66,11 @@ export class OverviewComponent implements OnInit { this.gameStatus.activeWatchdog = JSON.parse(value.activeWatchdog); if (this.gameStatus.redTurn){ this.nextTeam = 'Rot'; this.buttonNextRoundDisabled = this.team !== 'red'; } else{ this.nextTeam = 'Blau'; this.buttonNextRoundDisabled = this.team !== 'blue'; } } console.log(this.gameStatus); Loading @@ -76,9 +80,19 @@ export class OverviewComponent implements OnInit { startGame(): void { if (this.team === 'red' || this.team === 'blue') { this.service.newGame({spielname: this.sessionName}).then(value => { const status = JSON.parse(value.status); if (status) { this.router.navigate([this.router.url + '/explainer']); } }).catch(reason => console.log(reason)); } } nextRound(): void { this.router.navigate([this.router.url + '/explainer']); } joinTeam(team: string): void { this.team = team; this.router.navigate([this.sessionName + '/' + team]); Loading Loading
src/app/dao/TabuMiddlewareService.ts +15 −0 Original line number Diff line number Diff line Loading @@ -53,4 +53,19 @@ export class TabuMiddlewareService { console.log(req); return this.request('POST', `${environment.tabuMiddlewareURL}removePoint`, req); } newGame(req: any): Promise<any> { console.log(req); return this.request('POST', `${environment.tabuMiddlewareURL}newGame`, req); } newRound(req: any): Promise<any> { console.log(req); return this.request('POST', `${environment.tabuMiddlewareURL}newRound`, req); } endRound(req: any): Promise<any> { console.log(req); return this.request('POST', `${environment.tabuMiddlewareURL}endRound`, req); } }
src/app/overview/overview.component.html +2 −2 Original line number Diff line number Diff line Loading @@ -2,7 +2,7 @@ <mat-card class="transparent"> <div class="FloatLeftAndCenterElement"> <div class="newStartButtonLeft"> <button matTooltip="Neues Spiel starten" [disabled]="buttonPlayDisabled" mat-raised-button color="primary" (click)="startGame()"> <button matTooltip="Neues Spiel starten" [disabled]="buttonNewGameDisabled" mat-raised-button color="primary" (click)="startGame()"> <mat-icon color = "white" aria-hidden="false">autorenew</mat-icon></button> </div> <div class="CenterText"> Loading Loading @@ -39,7 +39,7 @@ <br> <mat-card-title>{{nextTeam}} ist am Zug:</mat-card-title> <br> <button [disabled]="buttonPlayDisabled" mat-raised-button color="primary">Nächste Runde</button> <button [disabled]="buttonNextRoundDisabled" mat-raised-button color="primary" (click)="nextRound()">Nächste Runde</button> </mat-card-actions> </mat-card> </div>
src/app/overview/overview.component.ts +17 −3 Original line number Diff line number Diff line Loading @@ -2,6 +2,7 @@ import { Component, OnInit } from '@angular/core'; import {ActivatedRoute, Router} from '@angular/router'; import {TabuMiddlewareService} from '../dao/TabuMiddlewareService'; import {GameStatus} from '../interface/gameStatus'; import {error} from 'selenium-webdriver'; @Component({ selector: 'app-overview', Loading @@ -13,7 +14,8 @@ export class OverviewComponent implements OnInit { blue = 'choose'; nextTeam = 'Blau'; team = ''; buttonPlayDisabled = true; buttonNewGameDisabled = true; buttonNextRoundDisabled = true; sessionName = ''; membership = 'Wähle dein Team'; gameStatus: GameStatus = { Loading @@ -36,13 +38,13 @@ export class OverviewComponent implements OnInit { console.log('Team:', this.team); if (this.team === 'red'){ this.membership = 'Du gehörst zu Team rot!'; this.buttonPlayDisabled = false; this.buttonNewGameDisabled = false; this.red = 'red'; this.blue = 'choose'; } else if (this.team === 'blue'){ this.membership = 'Du gehörst zu Team blau!'; this.buttonPlayDisabled = false; this.buttonNewGameDisabled = false; this.blue = 'blue'; this.red = 'choose'; } Loading @@ -64,9 +66,11 @@ export class OverviewComponent implements OnInit { this.gameStatus.activeWatchdog = JSON.parse(value.activeWatchdog); if (this.gameStatus.redTurn){ this.nextTeam = 'Rot'; this.buttonNextRoundDisabled = this.team !== 'red'; } else{ this.nextTeam = 'Blau'; this.buttonNextRoundDisabled = this.team !== 'blue'; } } console.log(this.gameStatus); Loading @@ -76,9 +80,19 @@ export class OverviewComponent implements OnInit { startGame(): void { if (this.team === 'red' || this.team === 'blue') { this.service.newGame({spielname: this.sessionName}).then(value => { const status = JSON.parse(value.status); if (status) { this.router.navigate([this.router.url + '/explainer']); } }).catch(reason => console.log(reason)); } } nextRound(): void { this.router.navigate([this.router.url + '/explainer']); } joinTeam(team: string): void { this.team = team; this.router.navigate([this.sessionName + '/' + team]); Loading