-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.html
More file actions
363 lines (296 loc) · 10.8 KB
/
index.html
File metadata and controls
363 lines (296 loc) · 10.8 KB
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
<!DOCTYPE html>
<html lang="en">
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.0.2/dist/css/bootstrap.min.css" rel="stylesheet"
integrity="sha384-EVSTQN3/azprG1Anm3QDgpJLIm9Nao0Yz1ztcQTwFspd3yD65VohhpuuCOmLASjC" crossorigin="anonymous">
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.5.1/jquery.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.0.2/dist/js/bootstrap.bundle.min.js"
integrity="sha384-MrcW6ZMFYlzcLA8Nl+NtUVF0sA7MsXsP1UyJoMp4YLEuNSfAP+JcXn/tWtIaxVXM"
crossorigin="anonymous"></script>
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.0.2/dist/js/bootstrap.bundle.min.js"></script>
<title>Title</title>
<head>
<style>
/* 폰트*/
@font-face {
font-family: 'yg-jalnan';
src: url('https://cdn.jsdelivr.net/gh/projectnoonnu/noonfonts_four@1.2/JalnanOTF00.woff') format('woff');
font-weight: normal;
font-style: normal;
}
/*배경과 정렬들에 대한 고정값*/
body {
background-color: transparent;
vertical-align: middle;
height: 100vh;
}
/*.btn-outline-danger {*/
/* vertical-align: middle;*/
/* width: 100%;*/
/* background-color: white;*/
/* justify-content: center;*/
/* flex-direction: row*/
/*}*/
/*!*게임을 시작하기 전 누르는 버튼*!*/
/*.start {*/
/* width: 400px;*/
/* margin: auto;*/
/*}*/
.start > button {
border: 4px solid #E8334FFF;
box-shadow: 0 0 0 8px white;
font-size: 50px;
width: 400px;
height: 400px;
margin-top: 400px;
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
border-radius: 10px;
}
/*폰트*/
/*.table {*/
/* font-family: 'yg-jalnan';*/
/*}*/
/*폰트*/
/*.start {*/
/* font-family: 'yg-jalnan';*/
/*}*/
/*배경의 배경 고정*/
html {
background: url("https://ifh.cc/g/gFppXw.jpg") no-repeat 50% 50% fixed;
-webkit-background-size: cover;
-moz-background-size: cover;
-o-background-size: cover;
background-size: cover;
}
/*배경*/
.back {
/*게임 배경 테두리*/
border: 3px solid white;
max-height: 2000px;
/* 해상도 최솟값*/
min-width: 994px;
min-height: 655px;
height: 60%;
max-width: 1000px;
width: 95%;
background-image: url("https://ifh.cc/g/PXK8Ap.jpg");
background-position: center;
background-size: cover;
margin: 50px auto 20px auto;
/*display: none;*/
}
.playgame {
height: 100%;
align-items: center;
flex-direction: column;
display: flex;
width: 100%;
justify-content: center;
}
/*컴퓨터*/
.Computer {
display: flex;
/*flex-direction: column;*/
justify-content: center;
/*align-items: center;*/
margin-top: 100px;
padding-top: 50px;
}
/*<style type="text/css">*/
/*div.question-box {*/
/* margin: 10px 0 20px 0;*/
/* flex-direction: column;*/
/* !*컴퓨터사진크기 퍼센트*!*/
/* width: 30%;*/
/* margin-top: 10%;*/
.user {
display: flex;
flex-direction: column;
justify-content: center;
align-items: center;
margin-top: 10%;
}
/*유저*/
.User > button {
background-image: url("https://ifh.cc/g/mtGs0O.png");
display: flex;
flex-direction: row;
justify-content: center;
align-items: center;
margin-top: 30%;
}
/*.UserImg {*/
/* display: flex;*/
/* flex-direction: row;*/
/* justify-content: center;*/
/* align-items: center;*/
/* margin-top: 50px;*/
/* margin-top: 300px;*/
/*}*/
/*메세지창*/
.msg {
color: white;
font-size: 100px;
margin-bottom: 50px;
}
/*.WinLose{*/
/* font-color:red;*/
/*}*/
/*.table {*/
/* !* 버튼을 누르기 전에 히스토리가 안 보이게*!*/
/* display: none;*/
/* box-shadow: 0px 0px 5px 0px gray;*/
/* font-size: 20px;*/
/* background-color: #E8334F;*/
/* text-shadow: 5px 5px 5px 5px black;*/
/* color: #ffffff;*/
/* width: 95%;*/
/* max-width: 1000px;*/
/* margin: auto;*/
/* text-align: center;*/
/* border: 2px solid white;*/
/* border-collapse: collapse;*/
/*}*/
/*td,*/
/*th {*/
/* padding: 10px;*/
/* border: 1px solid;}*/
</style>
<!-- 시작할 때 바로 가위바위보 화면이 보여질 수 있도록-->
<script>
$(document).ready(function () {
listing_user();
listing_com();
});
// 컴퓨터와 유저의 가위,바위,보 각각의 넘버 비교
// 이기면 p값에 2, 지면 p값에 3, 비기면 p값에 1을 부여
function answer(num_com, num_user) {
let win_count = 0;
let p = 0;
for (let i = 0; i < 3; i++) {
if (num_com[i] == num_user[i]) {
p = 1;
win_count = 0;
result(${p,win_count});
} else if (num_user[i] == 1 && num_com[i] == 3) {
p = 2;
win_count++;
result(${p,win_count});
} else if (num_user[i] == 2 && num_com[i] == 1) {
p = 2;
win_count++;
result(${p,win_count});
} else if (num_user[i] == 3 && num_com[i] == 2) {
p = 2;
win_count++;
result(${p,win_count});
} else {
p = 3;
win_count = 0;
result(${p,win_count});
}
}
}
// answer에서 win_count와 p값을 받고 @app.return_post로 전달
function result(p, win_count) {
$.ajax({
type: 'POST',
url: '/rsp_log',
data: {win_give: win_count, result_give: p},
success: function (response) {
alert(response['msg'])
//window.location.reload()
}
});
}
//db(rsp_user)에서 image와 넘버 번호 모음을 가져온다
function listing_user() {
//$('#cards-box').empty()
$.ajax({
type: 'GET',
url: '/rsp',
data: {},
success: function (response) {
let rows = response
for (let i = 0; i < rows.length; i++) {
let user_image = rows[i]['img_list_user']
let num_user = rows[i]['user_num']
let temp_html =``
temp_html= '<button onClick="answer(${num_user[i]})" type="button"><img width=100px src=$({user_image[i]})></button>'
$('#rsp_user').append(temp_html)
}
}
})
}
//db(rsp_com)에서 image와 넘버 번호를 가져온다
function listing_com() {
//$('#cards-box').empty()
$.ajax({
type: 'GET',
url: '/rsp/random',
data: {},
success: function (response) {
let rows = response['rsp_rand']
let image = rows['img']
let num_com = rows['num_com']
$('#ComImg').src = image
}
})
}
let date = new Date();
let temp_html=`
<button onclick="answer(${num_user[0]})" type="button"><img width=100px; src=$({user_image[0]})></button>`
</script>
</head>
<body>
<!-- <!– 게임시작하기버트–>-->
<!-- <div class="start">-->
<!-- <button onclick="open_game()" id="hide" type="button" class="btn btn-outline-danger">게임 시작하기!</button>-->
<!-- </div>-->
<!-- 배경-->
<div class="back" id="game-box">
<!-- 컴퓨터-->
<!--유저와 컴퓨터의 아이템이 back 밖으로 나가지 않도록 설정-->
<div class="playgame">
<div class="Computer">
<img id="ComImg" width="150px" src="https://ifh.cc/g/mtGs0O.png."/>
</div>
<!-- 유저-->
<div class="user" id="rsp_user">
<div>
<button onclick="answer(${num_user[0]})" type="button"><img width=100px src="https://ifh.cc/g/mtGs0O.png">
</button>
<button onclick="answer(${num_user[1]})" type="button"><img width=100px src="https://ifh.cc/g/1Y0LPy.png">
</button>
<button onclick="answer(${num_user[2]})" type="button"><img width=100px src="https://ifh.cc/g/Qqw7Qa.png">
</button>
</div>
<!--max-width=150px-->
<h1 class="msg" id="Usertext"> 이겼다 </h1>
</div>
</div>
</div>
<!-- https://ifh.cc/g/mtGs0O.png 가위-->
<!--https://ifh.cc/g/1Y0LPy.png 바위-->
<!--https://ifh.cc/g/Qqw7Qa.png 보-->
=======
<!-- <button type="button" class="btn btn-dark" onclick="rs_delete()">기록 초기화</button>-->
<!-- <table class="table" id="game-box2">-->
<!-- <thead>-->
<!-- <tr>-->
<!-- <td>회차</td>-->
<!-- <td>내가 낸 것</td>-->
<!-- <td>컴퓨터가 낸 것</td>-->
<!-- <td class="WinLose">결과</td>-->
<!-- </tr>-->
<!-- <tbody id="history-box">-->
<!-- <!– 여기에 temp_html 이 붙음 –>-->
<!-- </tbody>-->
<!-- </thead>-->
<!-- </table>-->
</body>
</html>