-
-
-
-
-
- Select your game mode
-
-
-
-
-
- Multiplayer local
-
-
- Matchmaking
-
-
- Ranked
-
-
- Tournament
-
-
+
-
Multiplayer local
+
-
Matchmaking
+
- {
- const popup = document.getElementById('popup-goal-selector');
- const goal = document.getElementsByClassName('color-box-goal');
-
- popup.style.display = 'flex';
- for (let i = 0; i < goal.length; i++)
- {
- goal[i].setAttribute('goalId', i);
- goal[i].appendChild(this.showObject(availableGoals[i], goal[i].getBoundingClientRect()));
- goal[i].removeEventListener('click', this.boundChangeGoal);
- goal[i].addEventListener('click', this.boundChangeGoal);
- }
- popup.removeEventListener('click', this.boundhideGoalSelector);
- popup.addEventListener('click', this.boundhideGoalSelector);
- });
+ div.removeEventListener('click', this.boundshowGoals);
+ div.addEventListener('click', this.boundshowGoals);
}
+ showGoals()
+ {
+ const popup = document.getElementById('popup-goal-selector');
+ const goal = document.getElementsByClassName('color-box-goal');
+
+ popup.style.display = 'flex';
+ for (let i = 0; i < goal.length; i++)
+ {
+ const canvas = goal[i].getElementsByTagName('canvas');
+
+ for (let j = 0; j < canvas.length; j++)
+ canvas[j].remove();
+ goal[i].setAttribute('goalId', i);
+ goal[i].appendChild(this.showObject(availableGoals[i], goal[i].getBoundingClientRect()));
+ goal[i].removeEventListener('click', this.boundChangeGoal);
+ goal[i].addEventListener('click', this.boundChangeGoal);
+ }
+ popup.removeEventListener('click', this.boundhideGoalSelector);
+ popup.addEventListener('click', this.boundhideGoalSelector);
+ };
+
showObject(func, pos)
{
const scene = new THREE.Scene();
@@ -238,9 +249,12 @@ class goalSelecter
popup.style.display = 'none';
lastSelectedGoal = availableGoals[id];
this.selected = availableGoals[id];
- this.scene.children[1].geometry.dispose();
- this.scene.children[1].material.dispose();
- this.scene.remove(this.scene.children[1]);
+ if (this.scene && this.scene.children && this.scene.children.length > 1)
+ {
+ this.scene.children[1].geometry.dispose();
+ this.scene.children[1].material.dispose();
+ this.scene.remove(this.scene.children[1]);
+ }
this.goal = this.selected(colorList[Math.floor(Math.random() * 100 % colorList.length)], true);
this.scene.add(this.goal);
this.camera.lookAt(this.goal.position);
@@ -265,7 +279,10 @@ class goalSelecter
for (let i = colorBoxGoal.length - 1; i >= 0; i--)
{
- colorBoxGoal[i].getElementsByTagName('canvas')[0].remove();
+ const canvas = colorBoxGoal[i].getElementsByTagName('canvas');
+
+ for (let j = 0; j < canvas.length; j++)
+ canvas[j].remove();
if (this.rendererList && this.rendererList[i])
{
this.rendererList[i].dispose();
@@ -301,6 +318,7 @@ class goalSelecter
dispose()
{
+ this.disposeGoalSelector();
if (this.renderer)
{
this.renderer.dispose();
@@ -329,6 +347,7 @@ class goalSelecter
}
this.scene = null;
actualGoalSelecter = null;
+ this.div.removeEventListener('click', this.boundshowGoals);
}
}
diff --git a/docker-compose/requirements/nginx/static/javascript/lobbyPage/main.js b/docker-compose/requirements/nginx/static/javascript/lobbyPage/main.js
index 99813af..44a7774 100644
--- a/docker-compose/requirements/nginx/static/javascript/lobbyPage/main.js
+++ b/docker-compose/requirements/nginx/static/javascript/lobbyPage/main.js
@@ -6,7 +6,7 @@
/* By: edbernar
Ranked
+
diff --git a/docker-compose/requirements/nginx/static/javascript/lobbyPage/3d.js b/docker-compose/requirements/nginx/static/javascript/lobbyPage/3d.js
index f8ff63e..846bf27 100644
--- a/docker-compose/requirements/nginx/static/javascript/lobbyPage/3d.js
+++ b/docker-compose/requirements/nginx/static/javascript/lobbyPage/3d.js
@@ -6,7 +6,7 @@
/* By: edbernar Tournament