Browse Source

Klasse Style hinzugefügt + Debug implementiert

main
Nicolas Fritz 2 years ago
parent
commit
892c4175ba
  1. 8
      uno/index.html
  2. 28
      uno/web/Style.js
  3. 5
      uno/web/uno.js

8
uno/index.html

@ -4,13 +4,13 @@
<meta charset="UTF-8">
<title>Uno</title>
<script defer src="../plugins.js"></script>
<script defer type="module" src="./web/uno.js"></script>
</head>
<body>
<div id="debug">
<p id="spieler"></p>
<p id="playerInGame"></p>
<p id="player"></p>
<p id="cardOnDeck"></p>
</div>
<script src="../plugins.js"></script>
<script defer src="web/Style.js"></script>
<script defer type="module" src="./web/uno.js"></script>
</body>
</html>

28
uno/web/Style.js

@ -1 +1,27 @@
$("#spieler").html("Spieler: ");
export default class Style{
constructor(gameInstanz) {
this._game = gameInstanz;
}
refreshDebug(){
$("#player").html("Spieler: " + this.game.currentPlayerInstanz.name);
//$("#playerCards").html("Spieler: " + this.game.currentPlayerInstanz.name);
$("#cardOnDeck").html("Karte auf dem Tisch: " + this.game.cardOnDeck.name + " - " + this.game.cardOnDeck.color);
$("#playerInGame").html("Spieler im Spiel: " + this.game.players.length);
}
showDebug(){
$('#debug').show();
}
hideDebug(){
$('#debug').hide();
}
get game(){
return this._game;
}
}

5
uno/web/uno.js

@ -1,5 +1,6 @@
//Legt mögliche Farben fest, "NONE" sind Auswahlkarten
import Game from "./Game.js";
import Style from "./Style.js";
export const CARD_COLORS = ["NONE", "BLUE", "GREEN", "RED", "YELLOW"];
@ -11,8 +12,10 @@ let rules = {
}
let game = new Game(2, rules);
let style = new Style(game);
game.start();
console.log(game.currentPlayer + game.cardOnDeck.name +"");
style.showDebug();
style.refreshDebug();
Loading…
Cancel
Save