-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathscore.js
78 lines (66 loc) · 1.96 KB
/
score.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
var money = 27;
var save = {
money: 0,
ingredientChart: null,
chefs: null,
currentChef: null,
towerBurger: null,
offsetmax: null,
command: null,
pending: null,
priceBrugerMultiplicator: null,
isThereKetchup: null,
speed: null,
elapsedTime: null,
nbBurger: null,
}
function getItemLocalStorage() {
var retrievedObject = localStorage.getItem('saveObject');
var retrievedObjectTmp = JSON.parse(retrievedObject)
if (retrievedObjectTmp && retrievedObjectTmp != null) {
save = retrievedObjectTmp;
money = save.money;
chefs = save.chefs;
currentChef = save.currentChef;
ingredientChart = save.ingredientChart;
towerBurger = save.towerBurger;
offsetmax = save.offsetmax;
command = save.command;
pending = save.pending;
priceBrugerMultiplicator = save.priceBrugerMultiplicator;
isThereKetchup = save.isThereKetchup;
speed = save.speed;
elapsedTime = save.elapsedTime;
nbBurger = save.nbBurger;
}
}
function updateScore() {
var score = document.getElementById("scoreDigit");
if (money < 1000000) {
score.textContent = (Math.round(money)).toString(10);
} else {
score.textContent = "error";
}
for (var ingredientButton of foodList) {
ingredientButton.checkMoneyButton();
}
for (var chef of chefList) {
chef.checkMoneyButton();
}
}
function saveData() {
save.ingredientChart = ingredientChart;
save.money = money;
save.chefs = chefs;
save.currentChef = currentChef;
save.towerBurger = towerBurger;
save.offsetmax = offsetmax;
save.command = command;
save.pending = pending;
save.priceBrugerMultiplicator = priceBrugerMultiplicator;
save.isThereKetchup = isThereKetchup;
save.speed = speed;
save.elapsedTime = elapsedTime;
save.nbBurger = nbBurger;
localStorage.setItem('saveObject', JSON.stringify(save));
}