You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

46 lines
1.6 KiB

  1. export default class Style{
  2. constructor(gameInstanz) {
  3. this._game = gameInstanz;
  4. $('#drawCard').on('click', ()=>{
  5. this.game.currentPlayerInstanz.drawCard(1);
  6. this.refreshDebug();
  7. });
  8. }
  9. refreshDebug(){
  10. $('#drawCard').css('background-color', 'white');
  11. $("#player").html("Spieler: " + this.game.currentPlayerInstanz.name);
  12. $("#playerCards").html("Karten: ");
  13. for (let i = 0; i < this.game.currentPlayerInstanz.hand.length; i++){
  14. $('#playerCards').append(this.game.currentPlayerInstanz.hand[i].name + " - " + this.game.currentPlayerInstanz.hand[i].color);
  15. $('#playerCards').append('<button id="button' + i + '">+</button> | ');
  16. $('#button' + i).on('click', () =>{
  17. this.game.currentPlayerInstanz.putCard(i);
  18. this.refreshDebug();
  19. });
  20. if (this.game.currentPlayerInstanz.hand[i].canPut)
  21. $('#button' + i).css('background-color', 'green');
  22. }
  23. $('#playerCards').append("" + this.game.currentPlayerInstanz.hand.length)
  24. $("#cardOnDeck").html("Karte auf dem Tisch: " + this.game.cardOnDeck.name + " - " + this.game.cardOnDeck.color);
  25. $("#playerInGame").html("Spieler im Spiel: " + this.game.players.length);
  26. if(!this.game.currentPlayerInstanz.canPlay)
  27. $('#drawCard').css('background-color', 'red');
  28. }
  29. static showDebug(){
  30. $('#debug').show();
  31. }
  32. static hideDebug(){
  33. $('#debug').hide();
  34. }
  35. get game(){
  36. return this._game;
  37. }
  38. }