-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtrophies.js
94 lines (72 loc) · 2.55 KB
/
trophies.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
window.addEventListener("load", () => {
console.log("trophiesEnabled");
//Add EventListeners for box
document
.querySelector("#trophies_button")
.addEventListener("click", openTrophies);
if (localStorage.getItem("trophyTutorial") == "unlocked") {
trophyTutorialUnlocked();
}
if (localStorage.getItem("trophyStandard") == "unlocked") {
trophyStandardUnlocked();
}
if (localStorage.getItem("trophyPerfect") == "unlocked") {
trophyPerfectUnlocked();
}
if (localStorage.getItem("trophyAssassin") == "unlocked") {
trophyAssassinUnlocked();
}
});
let trophyTutorial;
let trophyStandard;
let trophyPerfect;
let trophyAssassin;
function openTrophies() {
console.log("openTrophies");
//Display trophies
document.querySelector("#trophies").classList.remove("hidden");
document.querySelector("#shadow").style.cursor = "pointer";
document.querySelector("#shadow").addEventListener("click", closeTrophies);
}
function closeTrophies() {
console.log("closeTrophies");
//Undisplay trophies
document.querySelector("#trophies").classList.add("hidden");
document.querySelector("#shadow").style.cursor = "auto";
document.querySelector("#shadow").removeEventListener("click", closeTrophies);
}
function trophyTutorialUnlocked() {
if (trophyTutorial != "unlocked") {
console.log("trophyTutorialUnlocked");
localStorage.setItem("trophyTutorial", "unlocked");
//Unlock trophy and reward
document.querySelector("#trophy_tutorial").classList.remove("locked");
document.querySelector("#standard_button").classList.remove("locked");
}
}
function trophyStandardUnlocked() {
if (trophyStandard != "unlocked") {
console.log("trophyStandardUnlocked");
localStorage.setItem("trophyStandard", "unlocked");
//Unlock trophy and reward
document.querySelector("#trophy_standard").classList.remove("locked");
document.querySelector("#unlimited_button").classList.remove("locked");
}
}
function trophyPerfectUnlocked() {
if (trophyPerfect != "unlocked") {
console.log("trophyPerfectUnlocked");
localStorage.setItem("trophyPerfect", "unlocked");
//Unlock trophy and reward
document.querySelector("#trophy_perfect").classList.remove("locked");
document.querySelector("#theme_pineapple").classList.remove("locked");
}
}
function trophyAssassinUnlocked() {
if (trophyAssassin != "unlocked") {
console.log("trophyAssassinUnlocked");
localStorage.setItem("trophyAssassin", "unlocked");
//Unlock trophy
document.querySelector("#trophy_assassin").classList.remove("locked");
}
}