-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.html
More file actions
286 lines (252 loc) · 12.2 KB
/
index.html
File metadata and controls
286 lines (252 loc) · 12.2 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
<!DOCTYPE html>
<html lang="zh-CN">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no">
<title>模拟币生 Coin Life</title>
<script src="https://cdn.tailwindcss.com"></script>
<script src="https://unpkg.com/lucide@latest"></script>
<style>
@import url('https://fonts.googleapis.com/css2?family=VT323&display=swap');
:root {
--pixel-bg: #1a1b26;
--pixel-green: #4ade80;
--pixel-red: #ef4444;
--pixel-gold: #fbbf24;
--pixel-neon-blue: #00f3ff;
--pixel-neon-pink: #ff00ff;
}
body {
font-family: 'VT323', monospace;
background-color: var(--pixel-bg);
color: white;
overflow: hidden;
touch-action: none;
image-rendering: pixelated;
}
/* 像素字体增强 */
.pixel-font {
font-family: 'VT323', monospace;
}
/* 霓虹灯效果 */
.neon-text-blue {
text-shadow: 0 0 5px var(--pixel-neon-blue), 0 0 10px var(--pixel-neon-blue);
}
.neon-text-pink {
text-shadow: 0 0 5px var(--pixel-neon-pink), 0 0 10px var(--pixel-neon-pink);
}
/* 游戏容器 */
#game-container {
width: 100vw;
height: 100vh;
position: relative;
background: #0f172a;
}
/* 状态覆盖层 */
.screen {
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 100%;
display: flex;
flex-direction: column;
justify-content: center;
align-items: center;
z-index: 10;
transition: opacity 0.5s;
}
.hidden-screen {
opacity: 0;
pointer-events: none;
z-index: -1;
}
/* 像素按钮 */
.pixel-btn {
background: #3b82f6;
border: 4px solid #1d4ed8;
box-shadow: 4px 4px 0px #000;
color: white;
padding: 10px 20px;
font-size: 1.5rem;
cursor: pointer;
transition: transform 0.1s;
}
.pixel-btn:active {
transform: translate(4px, 4px);
box-shadow: 0px 0px 0px #000;
}
/* 滑块样式 */
input[type=range] {
-webkit-appearance: none;
appearance: none;
width: 100%;
background: transparent;
}
input[type=range]::-webkit-slider-thumb {
-webkit-appearance: none;
appearance: none;
height: 30px;
width: 15px;
background: #ffffff;
border: 2px solid #000;
cursor: pointer;
margin-top: -12px;
box-shadow: 2px 2px 0 #000;
}
input[type=range]::-webkit-slider-runnable-track {
width: 100%;
height: 8px;
cursor: pointer;
background: linear-gradient(to right, #ef4444 0%, #ef4444 45%, #ffffff 45%, #ffffff 55%, #4ade80 55%, #4ade80 100%);
border: 2px solid #000;
}
/* 弹幕动画 */
.danmaku {
position: absolute;
white-space: nowrap;
font-size: 1.2rem;
text-shadow: 1px 1px 0 #000;
animation: fly-left 4s linear forwards;
pointer-events: none;
}
@keyframes fly-left {
from { left: 100%; }
to { left: -100%; }
}
/* 城市背景动画 */
.city-bg {
background-image: linear-gradient(transparent 90%, rgba(0,243,255,0.1) 90%),
linear-gradient(90deg, transparent 90%, rgba(0,243,255,0.1) 90%);
background-size: 20px 20px;
animation: scroll-city 20s linear infinite;
}
@keyframes scroll-city {
from { background-position: 0 0; }
to { background-position: 0 100%; }
}
</style>
</head>
<body>
<div id="game-container" class="relative overflow-hidden">
<!-- Canvas Layer for Night Rendering -->
<canvas id="gameCanvas" class="absolute top-0 left-0 w-full h-full z-0"></canvas>
<!-- 1. Start Screen -->
<div id="start-screen" class="screen city-bg bg-slate-900">
<div class="text-center relative z-20 p-6 border-4 border-white bg-black/80 shadow-[8px_8px_0_0_#000]">
<h1 class="text-6xl mb-2 neon-text-blue tracking-widest pixel-font">COIN LIFE</h1>
<p class="text-2xl mb-8 neon-text-pink pixel-font">模拟币生</p>
<div class="flex justify-center space-x-8 mb-8 text-yellow-400 animate-pulse">
<span>BTC</span>
<span>ETH</span>
<span>DOGE</span>
</div>
<button id="btn-start" class="pixel-btn bg-green-500 border-green-700 w-full">START GAME</button>
<div class="mt-4 text-gray-400 text-sm pixel-font">7 Days to Financial Freedom... or Ruin.</div>
</div>
<!-- Deco bottom -->
<div class="absolute bottom-10 flex space-x-6">
<i data-lucide="trophy" class="w-8 h-8 text-yellow-500"></i>
<i data-lucide="history" class="w-8 h-8 text-blue-400"></i>
</div>
</div>
<!-- 2. Day Screen (Decision) -->
<div id="day-screen" class="screen hidden-screen bg-slate-800/95 backdrop-blur-sm z-20">
<div class="w-full max-w-lg p-6 flex flex-col h-full">
<!-- Header -->
<div class="flex justify-between items-center mb-6 border-b-2 border-white pb-4">
<span class="text-3xl text-yellow-400 pixel-font font-bold">Day <span id="day-num">1</span>/7</span>
<div class="text-right">
<div class="text-sm text-gray-400">Total Assets</div>
<div class="text-3xl pixel-font text-green-400 font-bold">$<span id="total-assets">1000</span></div>
</div>
</div>
<!-- PnL Display (显示昨晚盈亏,第一天不显示) -->
<div id="pnl-section" class="mb-6 text-center hidden">
<div class="text-2xl pixel-font font-bold mb-2">
<span id="pnl-text" class="text-red-400">You lose $50(10%) in the night!</span>
</div>
</div>
<!-- Current Price -->
<div class="text-center mb-6">
<div class="text-lg text-gray-400 mb-2">Current Price</div>
<div class="text-6xl neon-text-blue pixel-font font-bold">$<span id="current-price-display">10</span></div>
</div>
<!-- News Section -->
<div class="mb-6">
<div class="text-xl text-white mb-3 pixel-font font-bold">Today you hear</div>
<div class="bg-black/50 border-2 border-gray-600 p-4 relative">
<div class="absolute top-2 right-2 bg-red-500 text-white text-xs px-2 py-1 font-bold">NEWS</div>
<p id="daily-news" class="text-lg leading-tight pixel-font text-blue-200">某大型交易所插针,全网爆仓。</p>
<div id="news-effect" class="text-sm text-gray-500 mt-2 italic">市场情绪波动中...</div>
</div>
</div>
<!-- Trading Decision -->
<div class="mt-auto">
<div class="flex justify-between items-center mb-4">
<div class="text-xl text-white pixel-font font-bold">You decide to</div>
<div class="text-right">
<div class="text-sm text-gray-400">Cash / Amount</div>
<div class="text-lg pixel-font text-green-400">$<span id="cash-balance">1000</span></div>
<div class="text-lg pixel-font text-blue-400"><span id="amount-balance">0</span> coins</div>
</div>
</div>
<div class="bg-gray-900 border-4 border-white p-6 shadow-[8px_8px_0_0_#000]">
<!-- Slider Labels -->
<div class="flex justify-between text-lg mb-3 font-bold pixel-font">
<span class="text-red-400">Sell</span>
<span class="text-gray-400">Hold</span>
<span class="text-green-400">Buy</span>
</div>
<!-- Slider -->
<input type="range" id="trade-slider" min="0" max="100" value="50" step="1" class="mb-4">
<!-- Action Display -->
<div class="text-center mb-6">
<div class="text-2xl pixel-font font-bold">Action: <span id="action-text" class="text-yellow-400">Hold</span></div>
</div>
<!-- Sleep Button -->
<button id="btn-sleep" class="pixel-btn bg-indigo-600 border-indigo-800 w-full text-2xl py-4 font-bold">SLEEP & NEXT DAY</button>
</div>
</div>
</div>
</div>
<!-- 3. Night HUD (Overlay on Canvas) -->
<div id="night-hud" class="absolute top-0 left-0 w-full h-full pointer-events-none z-10 hidden">
<div class="absolute top-4 left-4 text-xl pixel-font bg-black/50 px-2 text-white border border-white">
Day <span id="night-day-num">1</span>/<span id="total-days">7</span>
</div>
<div class="absolute top-4 right-4 text-right">
<div id="night-pnl" class="text-3xl pixel-font font-bold text-gray-100">+$0</div>
<div class="text-xs text-gray-400">NIGHT PnL</div>
</div>
<!-- Bullet comments container -->
<div id="danmaku-container" class="absolute top-20 left-0 w-full h-64 overflow-hidden"></div>
</div>
<!-- 4. End Screen -->
<div id="end-screen" class="screen hidden-screen bg-black z-30">
<div class="w-full max-w-md p-6 border-4 border-white bg-slate-900 text-center relative">
<div class="absolute -top-6 left-1/2 transform -translate-x-1/2 bg-yellow-500 text-black px-4 py-1 font-bold border-2 border-white shadow-[4px_4px_0_0_#fff]">
FINAL JUDGMENT
</div>
<h2 class="text-3xl mt-6 mb-2 pixel-font text-white">GAME OVER</h2>
<div class="mb-6">
<p class="text-gray-400 text-sm">Final Assets</p>
<p class="text-5xl neon-text-blue pixel-font">$<span id="final-score">0</span></p>
<p id="roi-text" class="text-lg mt-1"></p>
</div>
<!-- Personality Card -->
<div class="bg-gray-800 p-4 mb-6 border-2 border-gray-600">
<div class="flex justify-between items-center mb-2">
<span class="text-gray-400 text-xs">TITLE</span>
<span class="text-gray-400 text-xs">ID: MAGGIE_PM</span>
</div>
<h3 id="player-title" class="text-2xl text-yellow-400 font-bold mb-2 pixel-font">DIAMOND HANDS</h3>
<p id="flavor-text" class="text-sm text-left text-gray-300 italic font-serif leading-relaxed">"..."</p>
</div>
<button id="btn-restart" class="pixel-btn bg-white text-black border-gray-400 w-full">TRY AGAIN</button>
</div>
</div>
</div>
<script src="js/game.js"></script>
</body>
</html>