-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathtest-tutorial-ui.html
More file actions
318 lines (279 loc) · 11.9 KB
/
test-tutorial-ui.html
File metadata and controls
318 lines (279 loc) · 11.9 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
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Tutorial UI Test - BreakEscape</title>
<!-- Fonts -->
<link href="https://fonts.googleapis.com/css2?family=Press+Start+2P&family=VT323&display=swap" rel="stylesheet">
<!-- Tutorial CSS -->
<link rel="stylesheet" href="public/break_escape/css/tutorial.css">
<style>
body {
margin: 0;
padding: 20px;
background: #1a1a2e;
font-family: 'VT323', monospace;
color: #fff;
/* Add some animated elements to simulate the game */
background-image:
linear-gradient(45deg, transparent 40%, rgba(0, 255, 136, 0.05) 50%, transparent 60%),
linear-gradient(-45deg, transparent 40%, rgba(0, 255, 136, 0.05) 50%, transparent 60%);
background-size: 200px 200px;
animation: gameBackground 20s linear infinite;
}
@keyframes gameBackground {
0% { background-position: 0 0, 100px 100px; }
100% { background-position: 200px 200px, 300px 300px; }
}
.test-container {
max-width: 1200px;
margin: 0 auto;
}
h1 {
font-family: 'Press Start 2P', monospace;
color: #00ff88;
text-align: center;
margin-bottom: 40px;
font-size: 24px;
text-shadow: 0 0 10px rgba(0, 255, 136, 0.5);
}
.test-section {
margin-bottom: 40px;
background: rgba(0, 0, 0, 0.5);
padding: 20px;
border: 2px solid #444;
}
.test-section h2 {
font-family: 'Press Start 2P', monospace;
color: #00ff88;
font-size: 16px;
margin-bottom: 20px;
}
button {
font-family: 'Press Start 2P', monospace;
font-size: 12px;
padding: 12px 24px;
margin: 10px;
cursor: pointer;
border: 2px solid #00ff88;
background: #00ff88;
color: #000;
transition: all 0.2s ease;
}
button:hover {
background: #00cc6a;
transform: translateY(-2px);
}
.description {
font-size: 20px;
margin-bottom: 20px;
line-height: 1.6;
}
/* Simulate game elements visible behind tutorial */
.game-simulation {
position: fixed;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
font-family: 'Press Start 2P', monospace;
font-size: 14px;
color: rgba(0, 255, 136, 0.3);
text-align: center;
z-index: 1;
pointer-events: none;
}
/* Mock game elements */
.mock-inventory {
position: fixed;
bottom: 0;
left: 50%;
transform: translateX(-50%);
height: 80px;
width: 100%;
background: rgba(149, 157, 216, 0.8);
border-top: 2px solid #444;
display: flex;
align-items: center;
justify-content: center;
gap: 10px;
}
.mock-slot {
width: 60px;
height: 60px;
border: 1px solid rgba(255, 255, 255, 0.3);
background: rgba(255, 255, 255, 0.1);
}
</style>
</head>
<body>
<!-- Simulated game background -->
<div class="game-simulation">
<div>Game World</div>
<div style="margin-top: 20px;">Visible Behind Tutorial</div>
</div>
<div class="test-container">
<h1>Tutorial UI Test</h1>
<div class="test-section">
<h2>1. Tutorial Prompt Modal</h2>
<p class="description">
Initial prompt with NO dark overlay - game remains visible behind it.
</p>
<button onclick="showPromptModal()">Show Prompt Modal</button>
</div>
<div class="test-section">
<h2>2. Tutorial Panel (Active Step)</h2>
<p class="description">
Panel with NO dark overlay - game visible during tutorial. Shows above inventory bar.
Tutorial is z-index 1400, so dialogue minigames (1500+) appear above it.
</p>
<button onclick="showTutorialPanel(false, 'movement')">Show Movement Step</button>
<button onclick="showTutorialPanel(false, 'inventory')">Show Inventory Step</button>
</div>
<div class="test-section">
<h2>3. Tutorial Panel (Completed Step)</h2>
<p class="description">
When a step is completed, the objective box turns green with a different animation.
</p>
<button onclick="showTutorialPanel(true)">Show Completed Tutorial Step</button>
</div>
<div class="test-section">
<h2>4. Responsive Design</h2>
<p class="description">
Try resizing your browser window to see mobile-responsive styling kick in at 768px width.
</p>
</div>
<div class="test-section">
<h2>5. Accessibility Features</h2>
<p class="description">
• Keyboard navigation with visible focus states<br>
• Respects prefers-reduced-motion settings<br>
• High contrast mode support<br>
• Proper ARIA semantics
</p>
</div>
</div>
<!-- Mock inventory bar -->
<div class="mock-inventory">
<div class="mock-slot"></div>
<div class="mock-slot"></div>
<div class="mock-slot"></div>
<div class="mock-slot"></div>
<div class="mock-slot"></div>
</div>
<script>
function showPromptModal() {
// Remove any existing modal
const existing = document.querySelector('.tutorial-prompt-overlay');
if (existing) existing.remove();
// Create modal overlay
const overlay = document.createElement('div');
overlay.className = 'tutorial-prompt-overlay';
overlay.innerHTML = `
<div class="tutorial-prompt-modal">
<h2>Welcome to BreakEscape!</h2>
<p>Would you like to go through a quick tutorial to learn the basic controls?</p>
<div class="tutorial-prompt-buttons">
<button id="tutorial-yes" class="tutorial-btn tutorial-btn-primary">Yes, show me</button>
<button id="tutorial-no" class="tutorial-btn tutorial-btn-secondary">No, I'll figure it out</button>
</div>
</div>
`;
document.body.appendChild(overlay);
// Add click handlers
document.getElementById('tutorial-yes').addEventListener('click', () => {
document.body.removeChild(overlay);
showTutorialPanel(false);
});
document.getElementById('tutorial-no').addEventListener('click', () => {
document.body.removeChild(overlay);
});
// Click outside to close
overlay.addEventListener('click', (e) => {
if (e.target === overlay) {
document.body.removeChild(overlay);
}
});
}
function showTutorialPanel(completed = false, stepType = 'movement') {
// Remove any existing panel
const existing = document.querySelector('.tutorial-overlay');
if (existing) existing.remove();
// Define step content
const steps = {
movement: {
progress: 'Step 1 of 6',
title: 'Movement',
instruction: 'Use W, A, S, D keys to move your character around.',
objective: 'Try moving in different directions'
},
inventory: {
progress: 'Step 5 of 6',
title: 'Inventory',
instruction: 'Your inventory is at the bottom of the screen. Click on items like the Notepad to use them.',
objective: 'Click on the Notepad in your inventory to open it'
}
};
const step = steps[stepType] || steps.movement;
// Create tutorial overlay
const overlay = document.createElement('div');
overlay.className = 'tutorial-overlay';
overlay.innerHTML = `
<div class="tutorial-panel">
<div class="tutorial-header">
<span class="tutorial-progress">${step.progress}</span>
<button class="tutorial-skip" title="Skip Tutorial">Skip Tutorial</button>
</div>
<h3 class="tutorial-title">${step.title}</h3>
<p class="tutorial-instruction">${step.instruction}</p>
<div class="tutorial-objective ${completed ? 'completed' : ''}">
<strong>Objective:</strong>
<span class="tutorial-objective-text">${step.objective}</span>
</div>
<div class="tutorial-actions">
<button class="tutorial-next" style="display: ${completed ? 'inline-block' : 'none'};">Continue →</button>
</div>
</div>
`;
document.body.appendChild(overlay);
// Add click handler for skip button
overlay.querySelector('.tutorial-skip').addEventListener('click', () => {
if (confirm('Are you sure you want to skip the tutorial?')) {
document.body.removeChild(overlay);
}
});
// Add click handler for next button
overlay.querySelector('.tutorial-next').addEventListener('click', () => {
document.body.removeChild(overlay);
});
// If not completed, simulate completion after 3 seconds
// Player must click Continue to proceed (no auto-advance)
if (!completed) {
setTimeout(() => {
const objectiveElement = overlay.querySelector('.tutorial-objective');
const nextButton = overlay.querySelector('.tutorial-next');
if (objectiveElement && nextButton) {
objectiveElement.classList.add('completed');
nextButton.style.display = 'inline-block';
// Note: Button appears but doesn't auto-advance
}
}, 3000);
}
}
// Keyboard shortcuts for testing
document.addEventListener('keydown', (e) => {
if (e.key === '1') showPromptModal();
if (e.key === '2') showTutorialPanel(false, 'movement');
if (e.key === '3') showTutorialPanel(true, 'movement');
if (e.key === '4') showTutorialPanel(false, 'inventory');
if (e.key === '5') showTutorialPanel(true, 'inventory');
});
console.log('Tutorial UI Test Ready!');
console.log('Press 1 to show prompt modal');
console.log('Press 2 to show movement step (active)');
console.log('Press 3 to show movement step (completed)');
console.log('Press 4 to show inventory step (active)');
console.log('Press 5 to show inventory step (completed)');
</script>
</body>
</html>