|
@ -27,10 +27,11 @@ export default class Style { |
|
|
this.firstDraw.on('click', () => { |
|
|
this.firstDraw.on('click', () => { |
|
|
|
|
|
|
|
|
this.game.currentPlayerInstanz.drawCard(1); |
|
|
this.game.currentPlayerInstanz.drawCard(1); |
|
|
this.refreshHtml(); |
|
|
|
|
|
|
|
|
|
|
|
this.drawCardAnim(false, true); |
|
|
this.drawCardAnim(false, true); |
|
|
|
|
|
|
|
|
|
|
|
this.refreshHtml(); |
|
|
|
|
|
|
|
|
}); |
|
|
}); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
@ -44,6 +45,7 @@ export default class Style { |
|
|
this.firstPutAnim.attr('src', './img/stackCards/' + this.game.cardOnDeck.color + '/' + this.game.cardOnDeck.name + '.png'); |
|
|
this.firstPutAnim.attr('src', './img/stackCards/' + this.game.cardOnDeck.color + '/' + this.game.cardOnDeck.name + '.png'); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
this.showPlayerDeck(this.game.currentPlayerInstanz, true); |
|
|
|
|
|
|
|
|
this.refreshDebug(); |
|
|
this.refreshDebug(); |
|
|
} |
|
|
} |
|
@ -58,17 +60,17 @@ export default class Style { |
|
|
$('#playerCards').append('<button id="button' + i + '">+</button> | '); |
|
|
$('#playerCards').append('<button id="button' + i + '">+</button> | '); |
|
|
$('#button' + i).on('click', () => { |
|
|
$('#button' + i).on('click', () => { |
|
|
this.game.currentPlayerInstanz.putCard(i); |
|
|
this.game.currentPlayerInstanz.putCard(i); |
|
|
|
|
|
setTimeout(() => { |
|
|
this.refreshHtml(); |
|
|
this.refreshHtml(); |
|
|
|
|
|
}, 100); |
|
|
}); |
|
|
}); |
|
|
if (this.game.currentPlayerInstanz.hand[i].canPut) |
|
|
|
|
|
$('#button' + i).css('background-color', 'green'); |
|
|
|
|
|
|
|
|
if (this.game.currentPlayerInstanz.hand[i].canPut) $('#button' + i).css('background-color', 'green'); |
|
|
} |
|
|
} |
|
|
$('#playerCards').append("" + this.game.currentPlayerInstanz.hand.length) |
|
|
$('#playerCards').append("" + this.game.currentPlayerInstanz.hand.length) |
|
|
$("#cardOnDeck").html("Karte auf dem Tisch: " + this.game.cardOnDeck.name + " - " + this.game.cardOnDeck.color); |
|
|
$("#cardOnDeck").html("Karte auf dem Tisch: " + this.game.cardOnDeck.name + " - " + this.game.cardOnDeck.color); |
|
|
$("#playerInGame").html("Spieler im Spiel: " + this.game.players.length); |
|
|
$("#playerInGame").html("Spieler im Spiel: " + this.game.players.length); |
|
|
|
|
|
|
|
|
if (!this.game.currentPlayerInstanz.canPlay) |
|
|
|
|
|
$('#drawCard').css('background-color', 'red'); |
|
|
|
|
|
|
|
|
if (!this.game.currentPlayerInstanz.canPlay) $('#drawCard').css('background-color', 'red'); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
putCardAnim() { |
|
|
putCardAnim() { |
|
@ -89,8 +91,68 @@ export default class Style { |
|
|
|
|
|
|
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
showPlayerDeck(player, click) { |
|
|
|
|
|
console.log("anzeigen") |
|
|
|
|
|
$('#playerDeck').html(""); |
|
|
|
|
|
|
|
|
|
|
|
let currentPlayerHand = player.hand; |
|
|
|
|
|
|
|
|
|
|
|
let width = window.innerWidth; |
|
|
|
|
|
let height = window.innerHeight; |
|
|
|
|
|
|
|
|
|
|
|
let percent = 0; |
|
|
|
|
|
let top = window.innerHeight * 0.68; |
|
|
|
|
|
let cardAmount = currentPlayerHand.length; |
|
|
|
|
|
|
|
|
|
|
|
for (let i = 0; i < cardAmount; i++) { |
|
|
|
|
|
console.log(this.game.currentPlayer); |
|
|
|
|
|
currentPlayerHand.xPos = 0; |
|
|
|
|
|
currentPlayerHand.yPos = 0; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
$('#playerDeck').append('<div id="card' + i + '" class="pictureCard">' + '<img src="./img/cards/' + currentPlayerHand[i].color + '/' + currentPlayerHand[i].name + '.png' + '"></div>'); |
|
|
|
|
|
|
|
|
|
|
|
currentPlayerHand[i].xPos = (width * (((43 + cardAmount / 2 * 5) - percent)) / 100); |
|
|
|
|
|
currentPlayerHand[i].yPos = top; |
|
|
|
|
|
|
|
|
|
|
|
console.log(i + ' ' + currentPlayerHand[i].yPos); |
|
|
|
|
|
|
|
|
|
|
|
let card = $('#card' + i); |
|
|
|
|
|
|
|
|
|
|
|
let put = false; |
|
|
|
|
|
|
|
|
|
|
|
if (click) { |
|
|
|
|
|
let yPos = currentPlayerHand[i].yPos; |
|
|
|
|
|
card.on('mouseenter', () => { |
|
|
|
|
|
if (!put) card.css('top', yPos - 60); |
|
|
|
|
|
}) |
|
|
|
|
|
card.on('mouseleave', () => { |
|
|
|
|
|
if (!put) card.css('top', yPos); |
|
|
|
|
|
}) |
|
|
|
|
|
card.on('click', () => { |
|
|
|
|
|
if (!this.game.players[this.game.currentPlayer].hand[i].canPut) return; |
|
|
|
|
|
put = true |
|
|
|
|
|
let lastPlayer = player; |
|
|
|
|
|
player.putCard(i); |
|
|
|
|
|
card.css('top', yPos - height * 0.2); |
|
|
|
|
|
card.css('opacity', 0); |
|
|
|
|
|
setTimeout(() => { |
|
|
|
|
|
this.refreshHtml(); |
|
|
|
|
|
|
|
|
|
|
|
}, 400); |
|
|
|
|
|
}) |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
card.css('left', currentPlayerHand[i].xPos + 'px'); |
|
|
|
|
|
card.css('top', top + 'px') |
|
|
|
|
|
$('.pictureCard') |
|
|
|
|
|
percent += 5; |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
drawCardAnim(enable, playerDraw) { |
|
|
drawCardAnim(enable, playerDraw) { |
|
|
if(this.drawCardRunning) return; |
|
|
|
|
|
|
|
|
if (this.drawCardRunning) return; |
|
|
this.drawCardRunning = true; |
|
|
this.drawCardRunning = true; |
|
|
|
|
|
|
|
|
if (playerDraw) { |
|
|
if (playerDraw) { |
|
@ -100,7 +162,7 @@ export default class Style { |
|
|
this.firstDraw.css('top', '60vh'); |
|
|
this.firstDraw.css('top', '60vh'); |
|
|
this.firstDraw.css('opacity', 0); |
|
|
this.firstDraw.css('opacity', 0); |
|
|
|
|
|
|
|
|
setTimeout(()=>{ |
|
|
|
|
|
|
|
|
setTimeout(() => { |
|
|
this.firstDraw.css('transition', ''); |
|
|
this.firstDraw.css('transition', ''); |
|
|
this.firstDraw.css('top', '47vh'); |
|
|
this.firstDraw.css('top', '47vh'); |
|
|
this.firstDraw.css('min-width', '20vh'); |
|
|
this.firstDraw.css('min-width', '20vh'); |
|
@ -148,11 +210,11 @@ export default class Style { |
|
|
return this._firstPutAnim; |
|
|
return this._firstPutAnim; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
get drawCardRunning(){ |
|
|
|
|
|
|
|
|
get drawCardRunning() { |
|
|
return this._drawCardRunnig; |
|
|
return this._drawCardRunnig; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
set drawCardRunning(bool){ |
|
|
|
|
|
|
|
|
set drawCardRunning(bool) { |
|
|
this._drawCardRunnig = bool; |
|
|
this._drawCardRunnig = bool; |
|
|
} |
|
|
} |
|
|
|
|
|
|