Loading src/app/app-routing.module.ts +5 −1 Original line number Original line Diff line number Diff line Loading @@ -7,6 +7,10 @@ import {GameComponent} from './game/game.component'; import {GuesserComponent} from './guesser/guesser.component'; import {GuesserComponent} from './guesser/guesser.component'; const routes: Routes = [ const routes: Routes = [ { path: 'error', component: ErrorComponent, }, { { path: ':sessionName', path: ':sessionName', component: OverviewComponent, component: OverviewComponent, Loading Loading @@ -34,7 +38,7 @@ const routes: Routes = [ { { path: '**', path: '**', component: ErrorComponent, component: ErrorComponent, } }, ]; ]; @NgModule({ @NgModule({ Loading src/app/app.component.html +1 −1 Original line number Original line Diff line number Diff line <div fxLayout="column" fxFlexFill style="background-image: url(/assets/background.jpg)"> <div fxLayout="column" fxFlexFill style="background-image: url(/assets/background.jpg); background-repeat: repeat;" > <app-header> <app-header> </app-header> </app-header> <div fxFlex> <div fxFlex> Loading src/app/game/game.component.html +18 −2 Original line number Original line Diff line number Diff line <div style="text-align: center; margin-left: 15em; margin-right: 15em; margin-top: 5em;"> <div style="text-align: center; margin-left: 15em; margin-right: 15em; margin-top: 5em;"> <p>Punktestand: {{points}}</p> <div id="app"></div> <div id="app"></div> <mat-card> <mat-card> <h1> <h1> Loading Loading @@ -35,6 +34,23 @@ </mat-card> </mat-card> <br> <br> <button mat-raised-button color="primary" (click)="rightAnswer()">Richtig ✔</button> <button mat-raised-button color="primary" (click)="rightAnswer()">Richtig ✔</button> <button mat-raised-button color="accent" style="margin: 40px">Überspringen »</button> <button mat-raised-button color="accent" style="margin: 40px" (click)="newCard()">Überspringen »</button> <button mat-raised-button color="warn" (click)="wrongAnswer()">Tabu ✘</button> <button mat-raised-button color="warn" (click)="wrongAnswer()">Tabu ✘</button> <br> <mat-card class="transparent"> <mat-card-title>Spielstand</mat-card-title> <mat-card-content> <br> <table> <tr> <th>Team rot</th> <th>Team blau</th> </tr> <tr> <th>{{gameStatus.red}}</th> <th>{{gameStatus.blue}}</th> </tr> </table> </mat-card-content> </mat-card> </div> </div> src/app/game/game.component.scss +8 −0 Original line number Original line Diff line number Diff line table { width: 50%; margin-left: auto; margin-right: auto; } .transparent{ opacity: 0.9; } body { body { font-family: sans-serif; font-family: sans-serif; Loading src/app/game/game.component.ts +40 −10 Original line number Original line Diff line number Diff line Loading @@ -3,6 +3,8 @@ import {ProgressSpinnerMode} from '@angular/material/progress-spinner'; import {CardInfo} from '../interface/cardInfo'; import {CardInfo} from '../interface/cardInfo'; import {TabuMiddlewareService} from '../dao/TabuMiddlewareService'; import {TabuMiddlewareService} from '../dao/TabuMiddlewareService'; import {ActivatedRoute} from '@angular/router'; import {ActivatedRoute} from '@angular/router'; import {GameStatus} from '../interface/gameStatus'; @Component({ @Component({ selector: 'app-game', selector: 'app-game', templateUrl: './game.component.html', templateUrl: './game.component.html', Loading @@ -20,7 +22,16 @@ export class GameComponent implements OnInit { tabu4: '', tabu4: '', tabu5: '' tabu5: '' }; }; points = 0; gameStatus: GameStatus = { sessionID: -1, red: 0, blue: 0, redTurn: true, activeExplainer: false, activeWatchdog: false }; team = ''; color = 'primary'; color = 'primary'; mode: ProgressSpinnerMode = 'determinate'; mode: ProgressSpinnerMode = 'determinate'; Loading @@ -31,6 +42,34 @@ export class GameComponent 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')); this.service.getGamestatus({'spielname': this.sessionName}).then(value => { const status = JSON.parse(value.status); if (status) { this.gameStatus.sessionID = JSON.parse(value.sessionID); this.gameStatus.red = JSON.parse(value.red); this.gameStatus.blue = JSON.parse(value.blue); this.gameStatus.redTurn = JSON.parse(value.redTurn); this.gameStatus.activeExplainer = JSON.parse(value.activeExplainer); this.gameStatus.activeWatchdog = JSON.parse(value.activeWatchdog); } console.log(this.gameStatus); }), this.team = String(params.get('team')); this.newCard(); }); } rightAnswer(): void{ this.newCard(); this.service.addPoint({spielname: this.sessionName, team: this.team}); } wrongAnswer(): void{ this.newCard(); this.service.removePoint({spielname: this.sessionName, team: this.team}); } newCard(): void{ this.service.getS2C({spielname: this.sessionName}).then(value => { this.service.getS2C({spielname: this.sessionName}).then(value => { console.log('Test1:', value); console.log('Test1:', value); const status = JSON.parse(value.status); const status = JSON.parse(value.status); Loading @@ -46,14 +85,5 @@ export class GameComponent implements OnInit { } } console.log(this.cardInfo); console.log(this.cardInfo); }).catch(reason => console.log(reason)); }).catch(reason => console.log(reason)); }); } rightAnswer(): void{ this.points += 1; } wrongAnswer(): void{ this.points -= 1; } } } } Loading
src/app/app-routing.module.ts +5 −1 Original line number Original line Diff line number Diff line Loading @@ -7,6 +7,10 @@ import {GameComponent} from './game/game.component'; import {GuesserComponent} from './guesser/guesser.component'; import {GuesserComponent} from './guesser/guesser.component'; const routes: Routes = [ const routes: Routes = [ { path: 'error', component: ErrorComponent, }, { { path: ':sessionName', path: ':sessionName', component: OverviewComponent, component: OverviewComponent, Loading Loading @@ -34,7 +38,7 @@ const routes: Routes = [ { { path: '**', path: '**', component: ErrorComponent, component: ErrorComponent, } }, ]; ]; @NgModule({ @NgModule({ Loading
src/app/app.component.html +1 −1 Original line number Original line Diff line number Diff line <div fxLayout="column" fxFlexFill style="background-image: url(/assets/background.jpg)"> <div fxLayout="column" fxFlexFill style="background-image: url(/assets/background.jpg); background-repeat: repeat;" > <app-header> <app-header> </app-header> </app-header> <div fxFlex> <div fxFlex> Loading
src/app/game/game.component.html +18 −2 Original line number Original line Diff line number Diff line <div style="text-align: center; margin-left: 15em; margin-right: 15em; margin-top: 5em;"> <div style="text-align: center; margin-left: 15em; margin-right: 15em; margin-top: 5em;"> <p>Punktestand: {{points}}</p> <div id="app"></div> <div id="app"></div> <mat-card> <mat-card> <h1> <h1> Loading Loading @@ -35,6 +34,23 @@ </mat-card> </mat-card> <br> <br> <button mat-raised-button color="primary" (click)="rightAnswer()">Richtig ✔</button> <button mat-raised-button color="primary" (click)="rightAnswer()">Richtig ✔</button> <button mat-raised-button color="accent" style="margin: 40px">Überspringen »</button> <button mat-raised-button color="accent" style="margin: 40px" (click)="newCard()">Überspringen »</button> <button mat-raised-button color="warn" (click)="wrongAnswer()">Tabu ✘</button> <button mat-raised-button color="warn" (click)="wrongAnswer()">Tabu ✘</button> <br> <mat-card class="transparent"> <mat-card-title>Spielstand</mat-card-title> <mat-card-content> <br> <table> <tr> <th>Team rot</th> <th>Team blau</th> </tr> <tr> <th>{{gameStatus.red}}</th> <th>{{gameStatus.blue}}</th> </tr> </table> </mat-card-content> </mat-card> </div> </div>
src/app/game/game.component.scss +8 −0 Original line number Original line Diff line number Diff line table { width: 50%; margin-left: auto; margin-right: auto; } .transparent{ opacity: 0.9; } body { body { font-family: sans-serif; font-family: sans-serif; Loading
src/app/game/game.component.ts +40 −10 Original line number Original line Diff line number Diff line Loading @@ -3,6 +3,8 @@ import {ProgressSpinnerMode} from '@angular/material/progress-spinner'; import {CardInfo} from '../interface/cardInfo'; import {CardInfo} from '../interface/cardInfo'; import {TabuMiddlewareService} from '../dao/TabuMiddlewareService'; import {TabuMiddlewareService} from '../dao/TabuMiddlewareService'; import {ActivatedRoute} from '@angular/router'; import {ActivatedRoute} from '@angular/router'; import {GameStatus} from '../interface/gameStatus'; @Component({ @Component({ selector: 'app-game', selector: 'app-game', templateUrl: './game.component.html', templateUrl: './game.component.html', Loading @@ -20,7 +22,16 @@ export class GameComponent implements OnInit { tabu4: '', tabu4: '', tabu5: '' tabu5: '' }; }; points = 0; gameStatus: GameStatus = { sessionID: -1, red: 0, blue: 0, redTurn: true, activeExplainer: false, activeWatchdog: false }; team = ''; color = 'primary'; color = 'primary'; mode: ProgressSpinnerMode = 'determinate'; mode: ProgressSpinnerMode = 'determinate'; Loading @@ -31,6 +42,34 @@ export class GameComponent 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')); this.service.getGamestatus({'spielname': this.sessionName}).then(value => { const status = JSON.parse(value.status); if (status) { this.gameStatus.sessionID = JSON.parse(value.sessionID); this.gameStatus.red = JSON.parse(value.red); this.gameStatus.blue = JSON.parse(value.blue); this.gameStatus.redTurn = JSON.parse(value.redTurn); this.gameStatus.activeExplainer = JSON.parse(value.activeExplainer); this.gameStatus.activeWatchdog = JSON.parse(value.activeWatchdog); } console.log(this.gameStatus); }), this.team = String(params.get('team')); this.newCard(); }); } rightAnswer(): void{ this.newCard(); this.service.addPoint({spielname: this.sessionName, team: this.team}); } wrongAnswer(): void{ this.newCard(); this.service.removePoint({spielname: this.sessionName, team: this.team}); } newCard(): void{ this.service.getS2C({spielname: this.sessionName}).then(value => { this.service.getS2C({spielname: this.sessionName}).then(value => { console.log('Test1:', value); console.log('Test1:', value); const status = JSON.parse(value.status); const status = JSON.parse(value.status); Loading @@ -46,14 +85,5 @@ export class GameComponent implements OnInit { } } console.log(this.cardInfo); console.log(this.cardInfo); }).catch(reason => console.log(reason)); }).catch(reason => console.log(reason)); }); } rightAnswer(): void{ this.points += 1; } wrongAnswer(): void{ this.points -= 1; } } } }