diff --git a/uno/css/uno.css b/uno/css/uno.css index 69a2324..014b874 100644 --- a/uno/css/uno.css +++ b/uno/css/uno.css @@ -72,6 +72,7 @@ body bottom: 0vh; left: 3vh; width: 100%; + opacity: 0; } .uno{ position: absolute; diff --git a/uno/web/Game.js b/uno/web/Game.js index 23f57b0..12d0958 100644 --- a/uno/web/Game.js +++ b/uno/web/Game.js @@ -136,6 +136,7 @@ export default class Game { //Beendet den Zug des aktuellen Spielers und beginnt den Zug des nächsten Spielers nextTurn() { + let delay = 0; //Testet, ob Spiel Gewonnen @@ -162,6 +163,9 @@ export default class Game { this.players[this.currentPlayer].turn = false; } + + this.style.hideUnoButton(); + setTimeout(() => { @@ -244,7 +248,10 @@ export default class Game { //Uno sagen testen - if (this.currentPlayerInstanz.hand.length <= 2 && this.currentPlayerInstanz.canPlay) this.currentPlayerInstanz.mustSayUno = true; + if (this.currentPlayerInstanz.hand.length === 2 && this.currentPlayerInstanz.canPlay){ + this.currentPlayerInstanz.mustSayUno = true; + this.style.showUnoButton(); + } } diff --git a/uno/web/Style.js b/uno/web/Style.js index 5dd8301..360e000 100644 --- a/uno/web/Style.js +++ b/uno/web/Style.js @@ -42,6 +42,10 @@ export default class Style { }) $('#drawCard').on('click', () => { + if(this.game.currentPlayerInstanz.mustSayUno){ + this.game.currentPlayerInstanz.mustSayUno = false; + console.log(this.game.currentPlayerInstanz.mustSayUno) + } this.game.currentPlayerInstanz.drawCard(1, true, true); this.refreshDebug(); }); @@ -53,6 +57,10 @@ export default class Style { this.drawCardAnim(false, false); }); this.firstDraw.on('click', () => { + if(this.game.currentPlayerInstanz.mustSayUno){ + this.game.currentPlayerInstanz.mustSayUno = false; + this.game.style.hideUnoButton(); + } let playerInstanz = this.game.currentPlayerInstanz; @@ -109,15 +117,17 @@ export default class Style { } showUnoButton(){ - $('#uno').css('opacity', 1); + $('.uno').css('transition', 'width ease-in-out 0.5s'); + $('#sayUno-glow').css('transition', 'width ease-in-out 0.5s, opacity 0.5s'); + $('.uno').css('filter', 'grayscale(0%)'); + $('#sayUno').css('opacity', 1); this.unoHover = false; this._unoClicked = false; this.startUnoLoop(); } hideUnoButton(){ - $('#uno').css('opacity', 0); - + $('#sayUno').css('opacity', 0); } startUnoLoop() {