Commit a0064812 authored by Dennis Willers's avatar Dennis Willers
Browse files

Prevent 4 Pressing same time tabu and giving the time pressed a value count

parent 2c5bfb68
Loading
Loading
Loading
Loading
+0 −1
Original line number Diff line number Diff line
@@ -39,7 +39,6 @@ export class TabuMiddlewareService {
  }

  getS2C(req: any): Promise<any> {
    console.log("getS2C Request: ", req);
    return this.request('POST', `${environment.tabuMiddlewareURL}getS2C`, req);
  }

+18 −7
Original line number Diff line number Diff line
@@ -53,7 +53,8 @@ export class GameComponent implements OnInit, OnDestroy {
              private router: Router,
              private activatedRoute: ActivatedRoute,
              private isAllowedToPlay: IsAllowedToPlay,
              private socketDataService: SocketDataService) {}
              private socketDataService: SocketDataService) {
  }

  ngOnInit(): void {
    this.activatedRoute.paramMap.subscribe(params => {
@@ -124,6 +125,7 @@ export class GameComponent implements OnInit, OnDestroy {
      }
    }, 593);
  }

  startCountdown(): void {
    setInterval(() => {
      this.timeRemaining = this.timeRemaining -= 1;
@@ -131,10 +133,11 @@ export class GameComponent implements OnInit, OnDestroy {
  }

  rightAnswer(): void {
    this.newCard();
    this.service.addPoint
    ({
      spielname: this.sessionName, team: this.team, red: this.gameStatus.red, blue: this.gameStatus.blue}).then(value => {
      spielname: this.sessionName, team: this.team, red: this.gameStatus.red, blue: this.gameStatus.blue, cardID: this.gameStatus.activeCard
    }).then(value => {
      this.newCard();
      this.gameStatus.red = JSON.parse(value.red);
      this.gameStatus.blue = JSON.parse(value.blue);
    });
@@ -145,7 +148,11 @@ export class GameComponent implements OnInit, OnDestroy {
    if (this.isExplainer) {
      this.service.removePoint
      ({
        spielname: this.sessionName, team: this.team, red: this.gameStatus.red, blue: this.gameStatus.blue
        spielname: this.sessionName,
        team: this.team,
        red: this.gameStatus.red,
        blue: this.gameStatus.blue,
        cardID: this.gameStatus.activeCard
      }).then(value => {
        this.gameStatus.red = JSON.parse(value.red);
        this.gameStatus.blue = JSON.parse(value.blue);
@@ -159,7 +166,11 @@ export class GameComponent implements OnInit, OnDestroy {
      }
      this.service.removePoint
      ({
        spielname: this.sessionName, team: opennentTeam, red: this.gameStatus.red, blue: this.gameStatus.blue
        spielname: this.sessionName,
        team: opennentTeam,
        red: this.gameStatus.red,
        blue: this.gameStatus.blue,
        cardID: this.gameStatus.activeCard
      }).then(value => {
        this.gameStatus.red = JSON.parse(value.red);
        this.gameStatus.blue = JSON.parse(value.blue);
@@ -197,11 +208,11 @@ export class GameComponent implements OnInit, OnDestroy {
        this.gameStatus.redTurn = JSON.parse(value.redTurn);
        this.gameStatus.activeExplainer = JSON.parse(value.activeExplainer);
        this.gameStatus.activeCard = JSON.parse(value.activeCard);
        console.log("SOLUTION: ", this.cardInfo.cardID);
        console.log('SOLUTION: ', this.cardInfo.cardID);
        if (this.cardInfo.cardID === -1) {
          console.log('I am in');
          this.service.getCard({cardID: value.activeCard}).then(value1 => {
            console.log("FIRST CARDS: ", value1);
            console.log('FIRST CARDS: ', value1);
            this.fillNewCard(value1);
          });
        }