diff --git a/src/static/test/css/main.css b/src/static/test/css/main.css index fe43ae5..df397cf 100644 --- a/src/static/test/css/main.css +++ b/src/static/test/css/main.css @@ -215,7 +215,8 @@ div[dropable=true] > * > * { } .player::before { - content: 'Spielername'; + /*content: 'Spielername';*/ + content: attr(data-name); font-weight: bold; text-align: center; display: block; diff --git a/src/static/test/index.html b/src/static/test/index.html index 1da70ab..4855108 100644 --- a/src/static/test/index.html +++ b/src/static/test/index.html @@ -24,7 +24,7 @@
-
+
@@ -32,7 +32,7 @@
-
+
@@ -40,7 +40,7 @@
-
+
@@ -48,7 +48,7 @@
-
+
diff --git a/src/static/test/js/game.js b/src/static/test/js/game.js index 520bffb..323427b 100644 --- a/src/static/test/js/game.js +++ b/src/static/test/js/game.js @@ -1,9 +1,11 @@ const colors = [...Array(12)].map((_,i) => ["blue","green","red"][i % 3]).sort(); -export const card = ({ val, drag, joker = false }) => +const cardtpl = ({ val, drag, joker = false }) => `
-
+
${val>0?val:""}
-
${joker?"Skip-Bo":val}
+
${joker?"Skip-Bo":val}
${val>0?val:""}
-
`; \ No newline at end of file +
`; + +export const card = e => [e].map(cardtpl).join``; \ No newline at end of file diff --git a/src/static/test/js/main.js b/src/static/test/js/main.js index 389ecf1..c6d3675 100644 --- a/src/static/test/js/main.js +++ b/src/static/test/js/main.js @@ -10,11 +10,15 @@ document.querySelector("#menu button.menu_join").addEventListener("click", () => msgBox("joinGame"); }); -document.querySelector("#p0_pile_card_0").insertAdjacentHTML("beforeend", - [{ val: 0, drag: true, joker: true }].map(card).join`` +document.querySelector("#p0_discard_1").insertAdjacentHTML("beforeend", + card({ val: 0, drag: true, joker: true }) ); document.querySelector("#p0_pile_card_1").insertAdjacentHTML("beforeend", - [{ val: 1, drag: true, joker: false }].map(card).join`` + card({ val: 1, drag: true, joker: false }) +); + +document.querySelector("#mainstack_card_1").insertAdjacentHTML("beforeend", + card({ val: 4 }) ); events.createCardEvents(); \ No newline at end of file diff --git a/src/static/test/js/msgbox.js b/src/static/test/js/msgbox.js index eaf534d..1371cdd 100644 --- a/src/static/test/js/msgbox.js +++ b/src/static/test/js/msgbox.js @@ -1,3 +1,5 @@ +import { connect } from "./socket.js"; + const msgBoxes = { tpl: ({ title, content, buttons }) => `
diff --git a/src/static/test/js/socket.js b/src/static/test/js/socket.js index afec90b..2d6a408 100644 --- a/src/static/test/js/socket.js +++ b/src/static/test/js/socket.js @@ -1,3 +1,5 @@ +import { msgBox, removeAllmsgBox } from "./msgbox.js"; + let socket = false , _playername , _gameroom; @@ -36,20 +38,13 @@ const socketevents = () => { document.querySelector("#menu").style.display = "none"; document.querySelector("#black").style.display = "none"; - render.renderAll(); _game.player.forEach((player, i) => { - game.stackables.set(player[0], new game.player(i)); - const _player = game.stackables.get(player[0]); - _player.id = i; - if(i === 0) { - player[1].cards.hand.forEach(card => { - _player.hand.push(new game.card({ type: card === 13 ? "joker" : "normal", val: card === 13 ? "" : card })); - }); - } - player[1].cards.stock.forEach(card => { - _player.stock.push(new game.card({ type: card === 13 ? "joker" : "normal", val: card === 13 ? "" : card })); - }); - render.renderAll(); + console.log(player); }); }); -}; \ No newline at end of file +}; + +const clear = playerid => { + console.log([...document.querySelectorAll(`div[id^='p${playerid}_']:not(#p0_discard)`)]); +} +clear("1"); \ No newline at end of file