From 5f4c4d770f98ef531598520b65fdff0d2aa02e6e Mon Sep 17 00:00:00 2001 From: yasevret Date: Sat, 13 Feb 2021 14:51:22 +0100 Subject: [PATCH] Correction Solo 3*3 --- SwichGIT/src/js/main.js | 58 +++++++++++++++++++++++++++++------------ 1 file changed, 41 insertions(+), 17 deletions(-) diff --git a/SwichGIT/src/js/main.js b/SwichGIT/src/js/main.js index bba64b7..9f3a6e5 100644 --- a/SwichGIT/src/js/main.js +++ b/SwichGIT/src/js/main.js @@ -17,7 +17,7 @@ var selectionDiemension = 0; var lesPoints = 0; //Points du Joueur1 -function majSizeCard(column){ +function majSizeCard(column) { var newTaille = column * 3.2 + 1; document.documentElement.style.setProperty('--taille', newTaille + "vh"); } @@ -220,14 +220,26 @@ class Figure { var unCercle = document.createElement('div'); unCercle.className = "anneau"; unCercle.style.backgroundColor = "var(--colorbase)"; - if (pos == 0 || pos == 2 || pos == 9 || pos == 11) { - unCercle.style.backgroundColor = "var(--colorone)"; - } - if (pos == 1 || pos == 10) { - unCercle.style.backgroundColor = "var(--colortwo)"; - } - if (pos == 4 || pos == 7) { - unCercle.style.backgroundColor = "var(--colorthree)"; + if (selectionDiemension == 0) { + if (pos == 0 || pos == 2 || pos == 9 || pos == 11) { + unCercle.style.backgroundColor = "var(--colorone)"; + } + if (pos == 1 || pos == 10) { + unCercle.style.backgroundColor = "var(--colortwo)"; + } + if (pos == 4 || pos == 7) { + unCercle.style.backgroundColor = "var(--colorthree)"; + } + } else if (selectionDiemension == 1) { + if (pos == 0 || pos == 2 || pos == 6 || pos == 8) { + unCercle.style.backgroundColor = "var(--colorone)"; + } + if (pos == 1 || pos == 7) { + unCercle.style.backgroundColor = "var(--colortwo)"; + } + if (pos == 4) { + unCercle.style.backgroundColor = "var(--colorthree)"; + } } var unRond = document.createElement('div'); @@ -249,14 +261,26 @@ class Figure { unRond.className = "rond"; unRond.style.backgroundColor = "var(--colorbase)"; - if (pos == 0 || pos == 2 || pos == 9 || pos == 11) { - unRond.style.backgroundColor = "var(--colorone)"; - } - if (pos == 1 || pos == 10) { - unRond.style.backgroundColor = "var(--colortwo)"; - } - if (pos == 4 || pos == 7) { - unRond.style.backgroundColor = "var(--colorthree)"; + if (selectionDiemension == 0) { + if (pos == 0 || pos == 2 || pos == 9 || pos == 11) { + unRond.style.backgroundColor = "var(--colorone)"; + } + if (pos == 1 || pos == 10) { + unRond.style.backgroundColor = "var(--colortwo)"; + } + if (pos == 4 || pos == 7) { + unRond.style.backgroundColor = "var(--colorthree)"; + } + } else if (selectionDiemension == 1) { + if (pos == 0 || pos == 2 || pos == 6 || pos == 8) { + unRond.style.backgroundColor = "var(--colorone)"; + } + if (pos == 1 || pos == 7) { + unRond.style.backgroundColor = "var(--colortwo)"; + } + if (pos == 4) { + unRond.style.backgroundColor = "var(--colorthree)"; + } } divContainForm.appendChild(unRond); divcase.appendChild(divContainForm);