-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.html
185 lines (165 loc) · 7.06 KB
/
index.html
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
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
<!DOCTYPE html>
<html>
<head>
<title>Portal: It's MyGO!!!!!</title>
<meta charset="utf-8">
<link rel="Shortcut Icon" href="./assets/ico/RanaLogo.png" type="image/x-icon" />
<meta name="viewport" content="width=device-width, initial-scale=1, user-scale=no">
<link rel="stylesheet" type="text/css" href="./assets/style/base.css">
<link rel="stylesheet" type="text/css" href="./assets/style/start.css">
<link rel="preconnect" href="https://fonts.googleapis.com">
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
<link
href="https://fonts.googleapis.com/css2?family=Inter:ital,opsz,wght@0,14..32,100..900;1,14..32,100..900&family=Noto+Serif+SC:[email protected]&family=Noto+Serif:ital,wght@0,100..900;1,100..900&family=Noto+Sans+SC:[email protected]&display=swap"
rel="stylesheet">
</head>
<body>
<div class="menu">
<div class="title">
<div class="vertical">
<div>传</div>
<div>送</div>
</div>
<div class="horizontal">
<div class="text">
乐奈与抹茶奇境
</div>
</div>
</div>
<div class="button-container">
<div class="button" id="start">开始新游戏</div>
<div class="button" id="load">加载存档</div>
<div class="button" id="achievement">成就</div>
<div class="button" id="exit">退出</div>
</div>
<div class="side">
Portal! It's MyGO!!!!!
</div>
</div>
<div class="save hide" id="save-load">
<div class="save-container"></div>
<div class="button-container">
<div class="button" id="save-back">返回</div>
</div>
</div>
<div class="achievementDisp hide">
<div class="achievement-container">
<div class="title">成就</div>
<div class="list"></div>
</div>
<div class="button-container">
<div class="button" id="achievement-back">返回</div>
</div>
</div>
<div class="transition hidden">
<div></div>
<div></div>
<div></div>
<div></div>
</div>
<div id="resource" style="display: none;"></div>
<script type="text/javascript" src="script/utils/Store.js"></script>
<script type="text/javascript" src="script/utils/Auth.js"></script>
<script type="text/javascript" src="script/utils/Save.js"></script>
<script type="text/javascript" src="script/utils/Vector.js"></script>
<script type="text/javascript" src="script/utils/Hitbox.js"></script>
<script type="text/javascript" src="script/utils/AchievementDisp.js"></script>
<script type="text/javascript" src="script/Managers/AchievementManager.js"></script>
<script type="text/javascript" src="script/Managers/DataManager.js"></script>
<script type="text/javascript">
const slideIn = () => {
const transition = document.querySelector(".transition");
transition.classList.remove("hidden");
transition.classList.add("slideIn");
setTimeout(() => {
transition.classList.add("hidden");
transition.classList.remove("slideIn");
}, 1800);
};
const slideOut = () => {
const transition = document.querySelector(".transition");
transition.classList.remove("hidden");
transition.classList.add("slideOut");
setTimeout(() => {
transition.classList.add("hidden");
transition.classList.remove("slideOut");
}, 1800);
};
window.onload = async () => {
window.$store = new Store();
Store.remove("toLoad");
window.$game = {
dataManager: new DataManager(),
}
const achievementDisp = new AchievementDisp(
document.querySelector(".achievement-container > .list")
);
const load = new Load((data) => {
Store.set("toLoad", JSON.stringify(data));
window.location.href = `./game.html?${window.$store.encode()}`;
})
slideIn();
if (!Auth.isAuthenticated()) {
Auth.toLogin();
}
let canScroll = false;
const achievementManager = new AchievementManager();
document.querySelector("#start").addEventListener("click", () => {
window.location.href = `./game.html?${window.$store.encode()}`;
});
document.querySelector("#load").addEventListener("click", () => {
slideOut();
setTimeout(() => {
document.querySelector(".menu").classList.add("hide");
document.querySelector(".save").classList.remove("hide");
load.build();
slideIn();
}, 1800);
});
document.querySelector("#save-back").addEventListener("click", () => {
slideOut();
setTimeout(() => {
document.querySelector(".save").classList.add("hide");
document.querySelector(".save-container").innerHTML = "";
document.querySelector(".menu").classList.remove("hide");
slideIn();
}, 1800);
});
document.querySelector("#achievement").addEventListener("click", () => {
slideOut();
if (!Store.get("achievements") || !AchievementManager.getAll().length) {
achievementManager.refresh();
}
setTimeout(() => {
document.querySelector(".menu").classList.add("hide");
document.querySelector(".achievementDisp").classList.remove("hide");
achievementDisp.disp();
slideIn();
canScroll = true;
}, 1800);
});
document.querySelector("#achievement-back").addEventListener("click", () => {
slideOut();
canScroll = false;
setTimeout(() => {
document.querySelector(".achievementDisp").classList.add("hide");
document.querySelector(".achievement-container > .list").innerHTML = "";
document.querySelector(".menu").classList.remove("hide");
slideIn();
}, 1800);
});
document.querySelector("#exit").addEventListener("click", () => {
Auth.logout();
Auth.toLogin();
});
document.querySelector(".achievementDisp").addEventListener("scroll", (e) => {
if (canScroll) {
let offsetY = e.target.scrollLeft * Math.tan(10 / 180 * Math.PI)
document.querySelector(".achievementDisp").style.setProperty("--offsetY", `${offsetY}px`);
}
})
await achievementManager.load()
}
</script>
</body>
</html>