From 892c4175ba79cf81518cb56c2b962d3a5866e4e2 Mon Sep 17 00:00:00 2001 From: Nicolas Fritz Date: Wed, 25 Jan 2023 20:19:48 +0100 Subject: [PATCH] =?UTF-8?q?Klasse=20Style=20hinzugef=C3=BCgt=20+=20Debug?= =?UTF-8?q?=20implementiert?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- uno/index.html | 8 ++++---- uno/web/Style.js | 28 +++++++++++++++++++++++++++- uno/web/uno.js | 5 ++++- 3 files changed, 35 insertions(+), 6 deletions(-) diff --git a/uno/index.html b/uno/index.html index 08768cd..bd911e0 100644 --- a/uno/index.html +++ b/uno/index.html @@ -4,13 +4,13 @@ Uno +
-

+

+

+

- - - \ No newline at end of file diff --git a/uno/web/Style.js b/uno/web/Style.js index 6d555b0..48a88ae 100644 --- a/uno/web/Style.js +++ b/uno/web/Style.js @@ -1 +1,27 @@ -$("#spieler").html("Spieler: "); \ No newline at end of file + +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; + } + +} \ No newline at end of file diff --git a/uno/web/uno.js b/uno/web/uno.js index 81432cb..86f4183 100644 --- a/uno/web/uno.js +++ b/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();