|
|
@ -13,6 +13,34 @@ export default class Style { |
|
|
|
|
|
|
|
this._firstPutAnim = $('#first-put-anim'); |
|
|
|
|
|
|
|
this._unohover = false; |
|
|
|
this._unoClicked = false; |
|
|
|
|
|
|
|
$('#sayUno').on('mouseenter', () => { |
|
|
|
if (this._unoClicked) return; |
|
|
|
this.unoHover = true; |
|
|
|
$('.uno').css('width', '28vw'); |
|
|
|
$('#sayUno-glow').css('opacity', 1); |
|
|
|
}) |
|
|
|
|
|
|
|
$('#sayUno').on('mouseleave', () => { |
|
|
|
if (this._unoClicked) return; |
|
|
|
this.unoHover = false; |
|
|
|
$('.uno').css('width', '25vw'); |
|
|
|
$('#sayUno-glow').css('opacity', 0.3); |
|
|
|
this.startUnoLoop(); |
|
|
|
}) |
|
|
|
|
|
|
|
$('#sayUno').on('click', () => { |
|
|
|
this.unoHover = true; |
|
|
|
this._unoClicked = true; |
|
|
|
$('.uno').css('transition', 'width ease-out 0.2s, filter 0.1s'); |
|
|
|
$('.uno').css('width', '22vw'); |
|
|
|
$('.uno').css('filter', 'grayscale(80%)'); |
|
|
|
$('#sayUno-glow').css('opacity', 1); |
|
|
|
this.game.currentPlayerInstanz.sayUno(); |
|
|
|
}) |
|
|
|
|
|
|
|
$('#drawCard').on('click', () => { |
|
|
|
this.game.currentPlayerInstanz.drawCard(1, true, true); |
|
|
|
this.refreshDebug(); |
|
|
@ -46,7 +74,7 @@ export default class Style { |
|
|
|
this.refreshDebug(); |
|
|
|
} |
|
|
|
|
|
|
|
refreshCardOnDeck(){ |
|
|
|
refreshCardOnDeck() { |
|
|
|
if (this._cardOnDeck !== this.game.cardOnDeck) { |
|
|
|
console.log(" ewfw") |
|
|
|
this.putCardAnim(); |
|
|
@ -80,19 +108,37 @@ export default class Style { |
|
|
|
if (!this.game.currentPlayerInstanz.canPlay) $('#drawCard').css('background-color', 'red'); |
|
|
|
} |
|
|
|
|
|
|
|
startUnoLoop(){ |
|
|
|
setTimeout(()=>{ |
|
|
|
showUnoButton(){ |
|
|
|
$('#uno').css('opacity', 1); |
|
|
|
this.unoHover = false; |
|
|
|
this._unoClicked = false; |
|
|
|
this.startUnoLoop(); |
|
|
|
} |
|
|
|
|
|
|
|
hideUnoButton(){ |
|
|
|
$('#uno').css('opacity', 0); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
startUnoLoop() { |
|
|
|
if (!this.unoHover && !this._unoClicked) setTimeout(() => { |
|
|
|
$('.uno').css('width', '28vw'); |
|
|
|
$('#sayUno-glow').css('opacity', 0.8); |
|
|
|
setTimeout(()=>{ |
|
|
|
console.log("bibi") |
|
|
|
$('.uno').css('width', '25vw'); |
|
|
|
$('#sayUno-glow').css('opacity', 0.3); |
|
|
|
this.startUnoLoop(); |
|
|
|
setTimeout(() => { |
|
|
|
if (!this.unoHover && !this._unoClicked) { |
|
|
|
$('.uno').css('width', '25vw'); |
|
|
|
$('#sayUno-glow').css('opacity', 0.3); |
|
|
|
this.startUnoLoop(); |
|
|
|
} |
|
|
|
}, 500); |
|
|
|
}, 500); |
|
|
|
} |
|
|
|
|
|
|
|
stopUnoLoop(){ |
|
|
|
this._unoClicked = true; |
|
|
|
this.unoHover = true; |
|
|
|
} |
|
|
|
|
|
|
|
putCardAnim() { |
|
|
|
this.firstPutAnim.attr('src', './img/stackCards/' + this.game.cardOnDeck.color + '/' + this.game.cardOnDeck.name + '.png'); |
|
|
|
|
|
|
@ -162,31 +208,31 @@ export default class Style { |
|
|
|
}) |
|
|
|
} |
|
|
|
|
|
|
|
if(anim){ |
|
|
|
if (anim) { |
|
|
|
card.css('top', height); |
|
|
|
setTimeout(()=>{ |
|
|
|
setTimeout(() => { |
|
|
|
card.css('top', top + 'px') |
|
|
|
card.css('left', (width * 45 / 100)); |
|
|
|
setTimeout(()=>{ |
|
|
|
setTimeout(() => { |
|
|
|
card.css('left', currentPlayerHand[i].xPos + 'px'); |
|
|
|
card.css('top', top + 'px') |
|
|
|
anim = false; |
|
|
|
}, 250); |
|
|
|
},100); |
|
|
|
}, 100); |
|
|
|
|
|
|
|
} else { |
|
|
|
card.css('left', currentPlayerHand[i].xPos + 'px'); |
|
|
|
card.css('top', top + 'px') |
|
|
|
} |
|
|
|
|
|
|
|
if(lastDraw && i === cardAmount - 1){ |
|
|
|
if (lastDraw && i === cardAmount - 1) { |
|
|
|
card.css('opacity', 0); |
|
|
|
card.css('top', currentPlayerHand[i].yPos - 100); |
|
|
|
setTimeout(()=>{ |
|
|
|
card.css('left', currentPlayerHand[i].xPos + 'px'); |
|
|
|
card.css('top', top + 'px') |
|
|
|
card.css('opacity', 1); |
|
|
|
},50); |
|
|
|
setTimeout(() => { |
|
|
|
card.css('left', currentPlayerHand[i].xPos + 'px'); |
|
|
|
card.css('top', top + 'px') |
|
|
|
card.css('opacity', 1); |
|
|
|
}, 50); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
@ -262,4 +308,12 @@ export default class Style { |
|
|
|
this._drawCardRunnig = bool; |
|
|
|
} |
|
|
|
|
|
|
|
get unoHover() { |
|
|
|
return this._unohover; |
|
|
|
} |
|
|
|
|
|
|
|
set unoHover(bool) { |
|
|
|
this._unohover = bool; |
|
|
|
} |
|
|
|
|
|
|
|
} |