Files
2026-07-13 12:35:44 +08:00

261 lines
8.1 KiB
HTML

<!DOCTYPE html>
<html>
<head>
<title>Windsurf vs All</title>
<style>
:root {
--bg-color: #f0f0f0;
--canvas-color: white;
}
:root[data-theme="dark"] {
--bg-color: #1a1a1a;
--canvas-color: #2d2d2d;
}
body {
margin: 0;
overflow: hidden;
background-color: var(--bg-color);
transition: background-color 0.3s;
}
#gameCanvas {
background-color: var(--canvas-color);
transition: background-color 0.3s;
}
#score {
position: absolute;
top: 10px;
left: 10px;
font-family: Arial, sans-serif;
font-size: 20px;
color: #333;
text-shadow: 0 0 3px rgba(255, 255, 255, 0.5);
}
:root[data-theme="dark"] #score {
color: #fff;
text-shadow: 0 0 3px rgba(0, 0, 0, 0.5);
}
#leaderboard {
position: absolute;
top: 10px;
right: 10px;
font-family: Arial, sans-serif;
background-color: rgba(0, 0, 0, 0.7);
color: white;
padding: 10px;
border-radius: 5px;
min-width: 150px;
}
#leaderboard h3 {
margin: 0 0 10px 0;
text-align: center;
font-size: 16px;
}
.leaderboard-item {
display: flex;
justify-content: space-between;
margin: 5px 0;
font-size: 14px;
}
.player-name {
color: #4CAF50;
}
#minimap {
position: absolute;
bottom: 20px;
left: 20px;
background-color: rgba(0, 0, 0, 0.7);
border: 2px solid rgba(255, 255, 255, 0.3);
border-radius: 5px;
}
#settings-icon {
position: absolute;
bottom: 20px;
right: 20px;
width: 40px;
height: 40px;
background-color: rgba(0, 0, 0, 0.7);
border-radius: 50%;
cursor: pointer;
display: flex;
align-items: center;
justify-content: center;
transition: background-color 0.3s;
}
#settings-icon:hover {
background-color: rgba(0, 0, 0, 0.9);
}
#settings-icon svg {
width: 24px;
height: 24px;
fill: white;
}
#settings-panel {
position: absolute;
bottom: 70px;
right: 20px;
width: 300px;
background-color: rgba(0, 0, 0, 0.9);
color: white;
padding: 20px;
border-radius: 10px;
font-family: Arial, sans-serif;
display: none;
transform-origin: bottom right;
transition: transform 0.3s, opacity 0.3s;
opacity: 0;
transform: scale(0.95);
}
#settings-panel.visible {
display: block;
opacity: 1;
transform: scale(1);
}
#settings-panel h2 {
margin: 0 0 15px 0;
font-size: 18px;
color: #4CAF50;
}
.control-group {
margin-bottom: 15px;
padding-bottom: 15px;
border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}
.control-group:last-child {
margin-bottom: 0;
padding-bottom: 0;
border-bottom: none;
}
.control-group h3 {
margin: 0 0 8px 0;
font-size: 16px;
color: #FFC107;
}
.control-item {
display: flex;
justify-content: space-between;
align-items: center;
margin: 5px 0;
font-size: 14px;
}
.control-action {
color: #4CAF50;
}
.button {
background-color: #4CAF50;
color: white;
border: none;
padding: 8px 16px;
border-radius: 4px;
cursor: pointer;
font-size: 14px;
transition: background-color 0.3s;
}
.button:hover {
background-color: #45a049;
}
.button-danger {
background-color: #f44336;
}
.button-danger:hover {
background-color: #da190b;
}
/* Toggle Switch Styles */
.toggle-switch {
position: relative;
display: inline-block;
width: 44px;
height: 24px;
}
.toggle-switch input {
opacity: 0;
width: 0;
height: 0;
}
.toggle-slider {
position: absolute;
cursor: pointer;
top: 0;
left: 0;
right: 0;
bottom: 0;
background-color: #ccc;
transition: .4s;
border-radius: 24px;
}
.toggle-slider:before {
position: absolute;
content: "";
height: 18px;
width: 18px;
left: 3px;
bottom: 3px;
background-color: white;
transition: .4s;
border-radius: 50%;
}
input:checked + .toggle-slider {
background-color: #4CAF50;
}
input:checked + .toggle-slider:before {
transform: translateX(20px);
}
</style>
</head>
<body>
<canvas id="gameCanvas"></canvas>
<div id="score">Score: 0</div>
<div id="leaderboard">
<h3>Leaderboard</h3>
<div id="leaderboard-content"></div>
</div>
<canvas id="minimap" width="150" height="150"></canvas>
<div id="settings-icon">
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24">
<path d="M19.14 12.94c.04-.3.06-.61.06-.94 0-.32-.02-.64-.07-.94l2.03-1.58c.18-.14.23-.41.12-.61l-1.92-3.32c-.12-.22-.37-.29-.59-.22l-2.39.96c-.5-.38-1.03-.7-1.62-.94l-.36-2.54c-.04-.24-.24-.41-.48-.41h-3.84c-.24 0-.43.17-.47.41l-.36 2.54c-.59.24-1.13.57-1.62.94l-2.39-.96c-.22-.08-.47 0-.59.22L2.74 8.87c-.12.21-.08.47.12.61l2.03 1.58c-.05.3-.09.63-.09.94s.02.64.07.94l-2.03 1.58c-.18.14-.23.41-.12.61l1.92 3.32c.12.22.37.29.59.22l2.39-.96c.5.38 1.03.7 1.62.94l.36 2.54c.05.24.24.41.48.41h3.84c.24 0 .44-.17.47-.41l.36-2.54c.59-.24 1.13-.56 1.62-.94l2.39.96c.22.08.47 0 .59-.22l1.92-3.32c.12-.22.07-.47-.12-.61l-2.01-1.58zM12 15.6c-1.98 0-3.6-1.62-3.6-3.6s1.62-3.6 3.6-3.6 3.6 1.62 3.6 3.6-1.62 3.6-3.6 3.6z"/>
</svg>
</div>
<div id="settings-panel">
<h2>Game Controls</h2>
<div class="control-group">
<h3>Movement</h3>
<div class="control-item">
<span>Move cells</span>
<span class="control-action">Mouse movement</span>
</div>
</div>
<div class="control-group">
<h3>Actions</h3>
<div class="control-item">
<span>Split cells</span>
<span class="control-action">Left click</span>
</div>
</div>
<div class="control-group">
<h3>Display</h3>
<div class="control-item">
<span>Dark Mode</span>
<label class="toggle-switch">
<input type="checkbox" id="dark-mode-toggle" onclick="toggleDarkMode()">
<span class="toggle-slider"></span>
</label>
</div>
</div>
<div class="control-group">
<h3>General</h3>
<div class="control-item">
<span>Restart Game</span>
<button class="button button-danger" onclick="window.location.reload()">Restart</button>
</div>
</div>
</div>
<script>
function toggleDarkMode() {
document.documentElement.setAttribute('data-theme', document.documentElement.getAttribute('data-theme') === 'dark' ? '' : 'dark');
}
</script>
<script type="module" src="{{ url_for('static', filename='js/game.js') }}"></script>
</body>
</html>