-
Notifications
You must be signed in to change notification settings - Fork 3
/
variables.js
170 lines (156 loc) · 6.96 KB
/
variables.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
// copyright Loho, Lorenz, Joswig, Raber & polymake team
//=========== VARIABLES =====================================================
//===========================================================================
//
// the settings variables
var testMode = false;
var calibration= false;
var difficulty = 1;
var difficultyOffset = 3;
var numOfRounds = 5;
var logfile = false;
var selectTime = true;
var enableFoldingMode = false;
var initialRotationTime = 0.5;
var initialRotationSpeed = 0.2;
var maxRotationTime = 8000;
var maxRotationSpeed= 5;
var rotationSpeed = maxRotationSpeed * initialRotationSpeed;
var rotationTime = maxRotationTime * initialRotationTime;
var selectNumOfPolys = document.getElementById('selectNumOfPolys');
var selectedDifficulty = document.getElementById('difficulty1');
//----------- the game elements ------------------------
var game = document.getElementById('game');
var settings = document.getElementById('settings');
var animations = document.getElementsByClassName('animation');
var animationsDiv = document.getElementById('animations');
var equals = document.getElementsByClassName('equal');
var nets = document.getElementsByClassName('net');
var arrows= document.getElementsByClassName('arrow');
var polytopes= document.getElementsByClassName('polytope');
var containers = document.getElementsByClassName('container');
var buttons = document.getElementsByClassName('buttonType1');
var buttons2 = document.getElementsByClassName('buttonType2');
var buttonsDiv = document.getElementById('buttons');
var okButton = document.getElementById('ok');
var moreButton = document.getElementById('more');
var closeMoreButton = document.getElementById('closeMoreButton');
var startGameButton = document.getElementById('startGame');
var resetButton = document.getElementById('reset');
var settingsButton = document.getElementById('settingsButton');
var settingsOkButton = document.getElementById('settingsOkButton');
var notDraggables= document.getElementsByClassName('notDraggable');
var buttonBackgrounds = document.getElementsByClassName('buttonBackground');
var gameDifficulties= document.getElementsByClassName('gameDifficulty');
var difficultyDivs = document.getElementsByClassName('difficulty');
var pointsDiv = document.getElementById('numPoints');
var bestScoreDiv= document.getElementById('numBestScore');
var pointsWord = document.getElementById('points');
var bestScoreWord = document.getElementById('bestScore');
var polyScripts = document.getElementById('polyScripts');
var addPointsDiv = document.getElementById('addPointsDiv');
var addPointsDivs = document.getElementsByClassName('addPoints');
var pointsNumber= document.getElementById('pointsNumber');
var bestScoreNumber= document.getElementById('numBestScore');
var roundDiv = document.getElementById('roundDiv');
var roundNumber = document.getElementById('roundNumber');
var netsDiv = document.getElementById('nets');
var timeDiv = document.getElementById('timeDiv');
var numberOfPolytopes = 3;
const maxNumberOfPolytopes = 5;
var timeCol = document.getElementsByClassName('timeCol');
var dragHint = document.getElementById('dragHint');
var restartHint = document.getElementById('restartHint');
// the start screen variables
var startScreen = document.getElementById('startScreen');
var moreScreen = document.getElementById('moreScreen');
var settingsScreen = document.getElementById('settingsScreen');
var startDifficulties= document.getElementsByClassName('startDifficulty');
var numOfPolysDivs = document.getElementsByClassName('numOfPolys');
var languageDivs;
var selectLanguage;
var currDifficulty;
// fallback language
var language = 'en';
var rotSpeedRange = document.getElementById('controlsRotationSpeed');
var zoomSpeedRange = document.getElementById('controlsZoomSpeed');
var panEnabledCheckbox = document.getElementById('controlsPanEnabled');
var zoomEnabledCheckbox = document.getElementById('controlsZoomEnabled');
var hideCursorCheckbox = document.getElementById('hideCursor');
//the folding mode variables
var foldingDiv = document.getElementById('folding');
var nextButton = document.getElementById('next');
var solutionButton = document.getElementById('solution');
var foldingRenderId;
var foldingScripts = document.getElementById('foldingScripts');
var closeFoldingButton = document.getElementById('closeFoldingButton');
var centerButton = document.getElementById('centerButton');
var foldingRenderIds = new Array(maxNumberOfPolytopes);
var foldingPolytopeRoots= new Array(maxNumberOfPolytopes);
var foldingCreators;
var foldingRenderers = [];
for (var i=0; i<maxNumberOfPolytopes; i++){
foldingRenderers.push(Detector.webgl? new THREE.WebGLRenderer({antialias: true}): new THREE.CanvasRenderer({antialias: true}));
}
var foldingControls= Array(maxNumberOfPolytopes);
var foldingAxes = Array(maxNumberOfPolytopes);
var foldingEdgeGroups = Array(maxNumberOfPolytopes);
var foldingAngles= Array(maxNumberOfPolytopes);
var foldingSubtrees= Array(maxNumberOfPolytopes);
var foldingAllpoints= Array(maxNumberOfPolytopes);
var foldingObjects= Array(maxNumberOfPolytopes);
var foldingScripts = document.getElementById('foldingScripts');
var foldings = document.getElementsByClassName('folding');
var foldingCameras = new Array(maxNumberOfPolytopes);
var oldPositions= new Array(maxNumberOfPolytopes);
var oldUps= new Array(maxNumberOfPolytopes);
var foldingActivated = false;
var intervals = [];
//var rotIntervals = [];
var timeouts = [];
var foldScale;
var unfoldScale;
var firstFolding;
//var rotScale;
// for the threejs animations
var renderers = [];
var polytopeCameras = new Array(maxNumberOfPolytopes);
var polytopeObjects = new Array(maxNumberOfPolytopes);
var polytopeControls = new Array(maxNumberOfPolytopes);
var polyRotations = new Array(maxNumberOfPolytopes);
for (var i=0; i<maxNumberOfPolytopes; i++){
renderers.push(Detector.webgl? new THREE.WebGLRenderer({antialias: true}): new THREE.CanvasRenderer({antialias: true}));
}
var renderIds = new Array(maxNumberOfPolytopes);
var polytopeCreators;
var currScrNum;
var currFoldingScrNum;
var animating = true;
var controlsRotationSpeed;
var controlsZoomSpeed;
var controlsNoPan;
var controlsNoZoom;
// ------------ variables and data for the game -----------------------------
var currentSelection; // the net which is currently selected
var round = 1;
var halfRounds;
var points = 0;
var addPoints = 0;
var time = 0;
var roundTime;
var roundStartTime;
var countingTime = false;
var correctMatches;
var allCorrect;
//-------------- the game over elements -------------------
var gameOver = document.getElementById('gameOver');
var gameIsOver = false;
var highscore = 0;
var highscoreTime = 100000;
var endpoints = document.getElementsByClassName('endpoints');
var endpointsWords = document.getElementsByClassName('endpointsWords');
var highscoreDiv = document.getElementById('numOfHighscore');
var highscoreTimeDiv = document.getElementById('numOfHighscoreTime');
var yourPointsDiv = document.getElementById('numOfYourPoints');
var yourTimeDiv = document.getElementById('numOfYourTime');
var newGameButton = document.getElementById('newGame');