-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.html
645 lines (582 loc) · 19.3 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
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<link rel="stylesheet" href="./src/styles.css" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Tauri App</title>
<style>
/* バウンドアニメーション */
.animate__animated {
animation-duration: 1s;
animation-fill-mode: both;
}
.animate__bounce {
animation-name: animate__bounce;
}
@keyframes animate__bounce {
0%,
20%,
50%,
80%,
100% {
transform: translateY(0);
}
40% {
transform: translateY(-30px);
}
60% {
transform: translateY(-15px);
}
}
</style>
</head>
<body>
<div id="viewer" class="viewer-container">
<div class="chromakey-area">
<div id="wing-left" class="wing-left"></div>
<!-- score -->
<div class="score-container">
<div class="score-title">Score</div>
<div class="score">
<p id="win-score">0</p>
<p>-</p>
<p id="lose-score">0</p>
<p>-</p>
<p id="draw-score">0</p>
</div>
</div>
<!-- role -->
<div class="role-container">
<div class="role-title">Role</div>
<div class="role">
<img
id="tank"
src="./src/assets/role/tank.svg"
alt="Tank"
height="60"
/>
<img
id="damage"
src="./src/assets/role/damage.svg"
alt="Damage"
height="60"
/>
<img
id="support"
src="./src/assets/role/support.svg"
alt="Support"
height="60"
/>
</div>
</div>
<!-- rate -->
<div class="rate-container">
<div class="rate-title">Rate</div>
<div class="rate">
<img
id="bronze"
src="./src/assets/rate/Bronze.png"
alt="Bronze"
height="60"
/>
<img
id="silver"
src="./src/assets/rate/Silver.png"
alt="Silver"
height="60"
/>
<img
id="gold"
src="./src/assets/rate/Gold.png"
alt="Gold"
height="60"
/>
<img
id="platinum"
src="./src/assets/rate/Platinum.png"
alt="Platinum"
height="60"
/>
<img
id="diamond"
src="./src/assets/rate/Diamond.png"
alt="Diamond"
height="60"
/>
<img
id="masters"
src="./src/assets/rate/Masters.png"
alt="Masters"
height="60"
/>
<img
id="grandmaster"
src="./src/assets/rate/Grandmaster.png"
alt="Grandmaster"
height="60"
/>
<img
id="champion"
src="./src/assets/rate/Champion.png"
alt="Champion"
height="60"
/>
<img
id="top500"
src="./src/assets/rate/Top500.png"
alt="Top500"
height="60"
/>
<p id="tier" class="tier">5</p>
</div>
</div>
<div id="wing-right" class="wing-right"></div>
</div>
</div>
<!-- control score -->
<div class="control-container">
<div class="control">
<div class="control-title">Control Panel</div>
<div class="control-btns">
<!-- score -->
<h2>SCORE</h2>
<div class="control-score">
<div class="control-score-btn">
<p>Win:</p>
<p id="current-win-score" class="current-score">0</p>
<button id="win-up-btn" class="green-btn">▲</button>
<button id="win-down-btn" class="red-btn">▼</button>
</div>
<div class="control-score-btn">
<p>Lose:</p>
<p id="current-lose-score" class="current-score">0</p>
<button id="lose-up-btn" class="green-btn">▲</button>
<button id="lose-down-btn" class="red-btn">▼</button>
</div>
<div class="control-score-btn">
<p>Draw:</p>
<p id="current-draw-score" class="current-score">0</p>
<button id="draw-up-btn" class="green-btn">▲</button>
<button id="draw-down-btn" class="red-btn">▼</button>
</div>
<button id="reset-btn" class="reset-btn">Reset</button>
<p id="error" class="error">
You can't go over 99. Please reset the score.
</p>
</div>
<!-- role -->
<h2>ROLE</h2>
<div class="control-role">
<div>
<input
type="radio"
id="tank-btn"
name="role"
value="tank"
class="role-btn"
/>
<label for="tank-btn" class="">Tank</label>
</div>
<div>
<input
type="radio"
id="damage-btn"
name="role"
value="damage"
class="role-btn"
checked
/>
<label for="damage-btn" class="">Damage</label>
</div>
<div>
<input
type="radio"
id="support-btn"
name="role"
value="support"
class="role-btn"
/>
<label for="support-btn" class="">Support</label>
</div>
</div>
<!-- rate -->
<h2>RATE</h2>
<div class="control-rate">
<div class="control-rate-container">
<div>
<input
type="radio"
id="bronze-btn"
name="rate"
value="bronze"
class="rate-btn"
checked
/>
<label for="bronze-btn" class="">Bronze</label>
</div>
<div>
<input
type="radio"
id="silver-btn"
name="rate"
value="silver"
class="rate-btn"
/>
<label for="silver-btn" class="">Silver</label>
</div>
<div>
<input
type="radio"
id="gold-btn"
name="rate"
value="gold"
class="rate-btn"
/>
<label for="gold-btn" class="">Gold</label>
</div>
<div>
<input
type="radio"
id="platinum-btn"
name="rate"
value="platinum"
class="rate-btn"
/>
<label for="platinum-btn" class="">Platinum</label>
</div>
<div>
<input
type="radio"
id="diamond-btn"
name="rate"
value="diamond"
class="rate-btn"
/>
<label for="diamond-btn" class="">Diamond</label>
</div>
<div>
<input
type="radio"
id="masters-btn"
name="rate"
value="masters"
class="rate-btn"
/>
<label for="masters-btn" class="">Masters</label>
</div>
<div>
<input
type="radio"
id="grandmaster-btn"
name="rate"
value="grandmaster"
class="rate-btn"
/>
<label for="grandmaster-btn" class="">Grandmaster</label>
</div>
<div>
<input
type="radio"
id="champion-btn"
name="rate"
value="champion"
class="rate-btn"
/>
<label for="champion-btn" class="">Champion</label>
</div>
<div>
<input
type="radio"
id="top500-btn"
name="rate"
value="top500"
class="rate-btn"
/>
<label for="top500-btn" class="">Top500</label>
</div>
</div>
<div id="control-tier" class="control-tier">
<p id="current-tier-text">Tier:</p>
<p id="current-tier" class="tier">5</p>
<button id="up-btn" class="control-tier-btn green-btn">▲</button>
<button id="down-btn" class="control-tier-btn red-btn">▼</button>
</div>
</div>
<!-- wing -->
<h2>WING</h2>
<div class="control-wing">
<button class="green-btn">on</button>
<button class="red-btn">off</button>
</div>
</div>
</div>
</div>
</body>
<script>
// score
let win = 0;
let lose = 0;
let draw = 0;
// 最大値
const max = 30;
const winScore = document.getElementById("win-score");
const loseScore = document.getElementById("lose-score");
const drawScore = document.getElementById("draw-score");
const currentWinScore = document.getElementById("current-win-score");
const currentLoseScore = document.getElementById("current-lose-score");
const currentDrawScore = document.getElementById("current-draw-score");
// score btns
const winUpBtn = document.getElementById("win-up-btn");
const winDownBtn = document.getElementById("win-down-btn");
const loseUpBtn = document.getElementById("lose-up-btn");
const loseDownBtn = document.getElementById("lose-down-btn");
const drawUpBtn = document.getElementById("draw-up-btn");
const drawDownBtn = document.getElementById("draw-down-btn");
// 数値を加算、減算するボタン
winUpBtn.addEventListener("click", () => {
if (win < max) {
win++;
winScore.innerText = win;
currentWinScore.innerText = win;
}
});
winDownBtn.addEventListener("click", () => {
if (win > 0) {
win--;
winScore.innerText = win;
currentWinScore.innerText = win;
}
});
loseUpBtn.addEventListener("click", () => {
lose++;
loseScore.innerText = lose;
currentLoseScore.innerText = lose;
});
loseDownBtn.addEventListener("click", () => {
if (lose > 0) {
lose--;
loseScore.innerText = lose;
currentLoseScore.innerText = lose;
}
});
drawUpBtn.addEventListener("click", () => {
draw++;
drawScore.innerText = draw;
currentDrawScore.innerText = draw;
});
drawDownBtn.addEventListener("click", () => {
if (draw > 0) {
draw--;
drawScore.innerText = draw;
currentDrawScore.innerText = draw;
}
});
// reset btn
const resetBtn = document.getElementById("reset-btn");
resetBtn.addEventListener("click", () => {
win = 0;
lose = 0;
draw = 0;
winScore.innerText = win;
loseScore.innerText = lose;
drawScore.innerText = draw;
currentWinScore.innerText = win;
currentLoseScore.innerText = lose;
currentDrawScore.innerText = draw;
});
// role btns
const tankBtn = document.getElementById("tank-btn");
const damageBtn = document.getElementById("damage-btn");
const supportBtn = document.getElementById("support-btn");
// role images
const tank = document.getElementById("tank");
const damage = document.getElementById("damage");
const support = document.getElementById("support");
// 起動時三つも表示されているので、checkedがついているdamageのみ表示
tank.style.display = "none";
support.style.display = "none";
// role radio btns
tankBtn.addEventListener("click", () => {
tank.style.display = "block";
damage.style.display = "none";
support.style.display = "none";
});
damageBtn.addEventListener("click", () => {
tank.style.display = "none";
damage.style.display = "block";
support.style.display = "none";
});
supportBtn.addEventListener("click", () => {
tank.style.display = "none";
damage.style.display = "none";
support.style.display = "block";
});
// rate btns
const bronzeBtn = document.getElementById("bronze-btn");
const silverBtn = document.getElementById("silver-btn");
const goldBtn = document.getElementById("gold-btn");
const platinumBtn = document.getElementById("platinum-btn");
const diamondBtn = document.getElementById("diamond-btn");
const mastersBtn = document.getElementById("masters-btn");
const grandmasterBtn = document.getElementById("grandmaster-btn");
const championBtn = document.getElementById("champion-btn");
const top500Btn = document.getElementById("top500-btn");
// rate images
const bronze = document.getElementById("bronze");
const silver = document.getElementById("silver");
const gold = document.getElementById("gold");
const platinum = document.getElementById("platinum");
const diamond = document.getElementById("diamond");
const masters = document.getElementById("masters");
const grandmaster = document.getElementById("grandmaster");
const champion = document.getElementById("champion");
const top500 = document.getElementById("top500");
// 起動時Bronzeが表示されているので、checkedがついているbronzeのみ表示
silver.style.display = "none";
gold.style.display = "none";
platinum.style.display = "none";
diamond.style.display = "none";
masters.style.display = "none";
grandmaster.style.display = "none";
champion.style.display = "none";
top500.style.display = "none";
// rateを変更すると、それに応じたrateの画像を表示
function handleRateButtonClick(rate, rateElement) {
const rates = [
"bronze",
"silver",
"gold",
"platinum",
"diamond",
"masters",
"grandmaster",
"champion",
"top500",
];
rates.forEach((r) => {
const element = document.getElementById(r);
if (r === rate) {
element.style.display = "block";
} else {
element.style.display = "none";
}
});
}
bronzeBtn.addEventListener("click", () => {
handleRateButtonClick("bronze", bronze);
});
silverBtn.addEventListener("click", () => {
handleRateButtonClick("silver", silver);
});
goldBtn.addEventListener("click", () => {
handleRateButtonClick("gold", gold);
});
platinumBtn.addEventListener("click", () => {
handleRateButtonClick("platinum", platinum);
});
diamondBtn.addEventListener("click", () => {
handleRateButtonClick("diamond", diamond);
});
mastersBtn.addEventListener("click", () => {
handleRateButtonClick("masters", masters);
});
grandmasterBtn.addEventListener("click", () => {
handleRateButtonClick("grandmaster", grandmaster);
});
championBtn.addEventListener("click", () => {
handleRateButtonClick("champion", champion);
});
top500Btn.addEventListener("click", () => {
handleRateButtonClick("top500", top500);
});
// rateのtier変更
const tier = document.getElementById("tier");
const currentTier = document.getElementById("current-tier");
const upBtn = document.getElementById("up-btn");
const downBtn = document.getElementById("down-btn");
// 一番上が1で、一番下が5なので、逆にする
upBtn.addEventListener("click", () => {
if (parseInt(tier.innerText) > 1) {
tier.innerText = parseInt(tier.innerText) - 1;
currentTier.innerText = parseInt(currentTier.innerText) - 1;
}
});
downBtn.addEventListener("click", () => {
if (parseInt(tier.innerText) < 5) {
tier.innerText = parseInt(tier.innerText) + 1;
currentTier.innerText = parseInt(currentTier.innerText) + 1;
}
});
// アニメーション
function addAnimation(target) {
target.addEventListener("DOMSubtreeModified", () => {
target.classList.add("animate__animated", "animate__bounce");
setTimeout(() => {
target.classList.remove("animate__animated", "animate__bounce");
}, 1000);
});
}
addAnimation(winScore);
addAnimation(loseScore);
addAnimation(drawScore);
// wingを表示非表示を切り替える
const wingLeft = document.getElementById("wing-left");
const wingRight = document.getElementById("wing-right");
const wingBtns = document.querySelectorAll(".control-wing button");
// btnの色初期値
wingBtns[0].style.backgroundColor = "#02a202";
wingBtns[1].style.backgroundColor = "gray";
wingBtns.forEach((btn) => {
btn.addEventListener("click", () => {
if (btn.innerText === "on") {
wingLeft.style.display = "block";
wingRight.style.display = "block";
// offボタンの色を変える
wingBtns[0].style.backgroundColor = "#02a202";
wingBtns[1].style.backgroundColor = "gray";
} else {
wingLeft.style.display = "none";
wingRight.style.display = "none";
// onボタンの色を変える
wingBtns[0].style.backgroundColor = "gray";
wingBtns[1].style.backgroundColor = "#dd0051";
}
});
});
// top500だったらid:control-tierを非表示にする
const controlTier = document.getElementById("control-tier");
function checkTop500() {
if (top500Btn.checked) {
controlTier.style.display = "none";
tier.style.display = "none";
} else {
controlTier.style.display = "flex";
tier.style.display = "flex";
}
}
top500Btn.addEventListener("click", checkTop500);
// 他のを選択した時には表示される
bronzeBtn.addEventListener("click", checkTop500);
silverBtn.addEventListener("click", checkTop500);
goldBtn.addEventListener("click", checkTop500);
platinumBtn.addEventListener("click", checkTop500);
diamondBtn.addEventListener("click", checkTop500);
mastersBtn.addEventListener("click", checkTop500);
grandmasterBtn.addEventListener("click", checkTop500);
championBtn.addEventListener("click", checkTop500);
// error message
// winまたはlose、drawが99になったらエラーメッセージを表示
const error = document.getElementById("error");
// 初期値は非表示
error.style.display = "none";
function checkError() {
if (win === max || lose === max || draw === max) {
error.style.display = "block";
} else {
error.style.display = "none";
}
}
winScore.addEventListener("DOMSubtreeModified", checkError);
</script>
</html>