Files
the-island/frontend/debug_client.html
empty 6c66764cce feat: add gameplay enhancements and visual improvements
Backend:
- Add weather system with 6 weather types and transition probabilities
- Add day/night cycle (dawn, day, dusk, night) with phase modifiers
- Add mood system for agents (happy, neutral, sad, anxious)
- Add new commands: heal, talk, encourage, revive
- Add agent social interaction system with relationships
- Add casual mode with auto-revive and reduced decay rates

Frontend (Web):
- Add world state display (weather, time of day)
- Add mood bar to agent cards
- Add new action buttons for heal, encourage, talk, revive
- Handle new event types from server

Unity Client:
- Add EnvironmentManager with dynamic sky gradient and island scene
- Add WeatherEffects with rain, sun rays, fog, and heat particles
- Add SceneBootstrap for automatic visual system initialization
- Improve AgentVisual with better character sprites and animations
- Add breathing and bobbing idle animations
- Add character shadows
- Improve UI panels with rounded corners and borders
- Improve SpeechBubble with rounded corners and proper tail
- Add support for all new server events and commands

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-01 15:25:15 +08:00

462 lines
15 KiB
HTML

<!DOCTYPE html>
<html lang="zh-CN">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>荒岛:人性的试炼</title>
<style>
* {
box-sizing: border-box;
margin: 0;
padding: 0;
}
body {
font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
background: linear-gradient(135deg, #1a2a1a 0%, #0d1f0d 100%);
color: #eee;
min-height: 100vh;
padding: 20px;
}
.container {
max-width: 1000px;
margin: 0 auto;
}
h1 {
text-align: center;
margin-bottom: 10px;
color: #88cc88;
text-shadow: 0 0 10px rgba(136, 204, 136, 0.5);
}
.subtitle {
text-align: center;
color: #666;
margin-bottom: 20px;
font-size: 0.9rem;
}
.status-bar {
display: flex;
justify-content: space-between;
align-items: center;
background: rgba(255, 255, 255, 0.1);
padding: 10px 20px;
border-radius: 8px;
margin-bottom: 20px;
}
.status-indicator {
display: flex;
align-items: center;
gap: 8px;
}
.status-dot {
width: 12px;
height: 12px;
border-radius: 50%;
background: #ff4444;
}
.status-dot.connected {
background: #44ff44;
box-shadow: 0 0 10px rgba(68, 255, 68, 0.5);
}
/* User Stats */
.user-panel {
background: rgba(136, 204, 136, 0.1);
border: 1px solid rgba(136, 204, 136, 0.3);
border-radius: 12px;
padding: 15px 20px;
margin-bottom: 20px;
display: flex;
justify-content: space-between;
align-items: center;
}
.user-info {
display: flex;
align-items: center;
gap: 20px;
}
.gold-display {
font-size: 1.3rem;
color: #ffd700;
}
/* Agent Cards */
.agents-section {
margin-bottom: 20px;
}
.section-title {
color: #88cc88;
margin-bottom: 15px;
font-size: 1.1rem;
}
.agents-grid {
display: grid;
grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
gap: 15px;
padding-top: 50px; /* Space for speech bubbles */
}
.agent-card {
background: rgba(255, 255, 255, 0.05);
border: 1px solid rgba(255, 255, 255, 0.1);
border-radius: 12px;
padding: 20px;
transition: all 0.3s;
}
.agent-card:hover {
transform: translateY(-2px);
box-shadow: 0 5px 20px rgba(0, 0, 0, 0.3);
}
.agent-card.dead {
opacity: 0.5;
filter: grayscale(80%);
border-color: #444;
}
.agent-header {
display: flex;
justify-content: space-between;
align-items: center;
margin-bottom: 15px;
}
.agent-name {
font-size: 1.2rem;
font-weight: bold;
}
.agent-personality {
font-size: 0.85rem;
color: #aaa;
background: rgba(255,255,255,0.1);
padding: 3px 10px;
border-radius: 10px;
}
.agent-status {
font-size: 0.8rem;
padding: 3px 8px;
border-radius: 8px;
}
.agent-status.alive { background: rgba(68, 255, 68, 0.2); color: #88ff88; }
.agent-status.dead { background: rgba(255, 68, 68, 0.2); color: #ff8888; }
/* Stat Bars */
.stat-bar-container {
margin-bottom: 10px;
}
.stat-bar-label {
display: flex;
justify-content: space-between;
font-size: 0.85rem;
margin-bottom: 5px;
}
.stat-bar {
height: 12px;
background: rgba(0, 0, 0, 0.4);
border-radius: 6px;
overflow: hidden;
}
.stat-bar-fill {
height: 100%;
border-radius: 6px;
transition: width 0.3s ease;
}
.stat-bar-fill.hp { background: linear-gradient(90deg, #ff4444, #ff6666); }
.stat-bar-fill.energy { background: linear-gradient(90deg, #ffaa00, #ffcc44); }
/* Feed Button */
.feed-btn {
width: 100%;
margin-top: 10px;
padding: 8px;
background: #88cc88;
color: #1a2a1a;
border: none;
border-radius: 6px;
cursor: pointer;
font-weight: bold;
transition: all 0.2s;
}
.feed-btn:hover {
background: #66aa66;
}
.feed-btn:disabled {
background: #444;
color: #888;
cursor: not-allowed;
}
/* Speech Bubble */
.speech-bubbles-overlay {
position: absolute;
top: 0;
left: 0;
right: 0;
pointer-events: none;
z-index: 100;
}
.speech-bubble {
position: absolute;
background: rgba(255, 255, 255, 0.95);
color: #333;
padding: 10px 15px;
border-radius: 12px;
font-size: 0.9rem;
max-width: 250px;
text-align: center;
box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
transform: translateX(-50%);
animation: bubbleIn 0.3s ease-out;
pointer-events: auto;
}
.speech-bubble::after {
content: '';
position: absolute;
bottom: -8px;
left: 50%;
transform: translateX(-50%);
border-left: 8px solid transparent;
border-right: 8px solid transparent;
border-top: 8px solid rgba(255, 255, 255, 0.95);
}
.speech-bubble .bubble-name {
font-weight: bold;
color: #88cc88;
margin-bottom: 5px;
font-size: 0.8rem;
}
.speech-bubble.fade-out {
animation: bubbleOut 0.3s ease-in forwards;
}
@keyframes bubbleIn {
from { opacity: 0; transform: translateX(-50%) translateY(10px); }
to { opacity: 1; transform: translateX(-50%) translateY(0); }
}
@keyframes bubbleOut {
from { opacity: 1; transform: translateX(-50%) translateY(0); }
to { opacity: 0; transform: translateX(-50%) translateY(-10px); }
}
.agents-section {
position: relative;
}
.agent-card {
position: relative;
}
/* Panels */
.panels {
display: flex;
flex-direction: column;
gap: 20px;
}
.panel {
background: rgba(255, 255, 255, 0.05);
border: 1px solid rgba(255, 255, 255, 0.1);
border-radius: 12px;
padding: 20px;
}
.panel h2 {
color: #88cc88;
margin-bottom: 15px;
font-size: 1.1rem;
}
.input-group {
display: flex;
gap: 10px;
flex-wrap: wrap;
}
input[type="text"] {
flex: 1;
min-width: 150px;
padding: 10px 15px;
border: 1px solid rgba(255, 255, 255, 0.2);
border-radius: 6px;
background: rgba(0, 0, 0, 0.3);
color: #fff;
font-size: 14px;
}
input[type="text"]:focus {
outline: none;
border-color: #88cc88;
}
button {
padding: 10px 20px;
border: none;
border-radius: 6px;
background: #88cc88;
color: #1a2a1a;
font-weight: bold;
cursor: pointer;
transition: all 0.2s;
}
button:hover {
background: #66aa66;
transform: translateY(-1px);
}
button:disabled {
background: #444;
cursor: not-allowed;
}
.controls {
display: flex;
gap: 15px;
align-items: center;
margin-bottom: 10px;
}
.controls label {
display: flex;
align-items: center;
gap: 5px;
font-size: 14px;
}
.event-log {
height: 300px;
overflow-y: auto;
background: rgba(0, 0, 0, 0.4);
border-radius: 8px;
padding: 15px;
font-family: 'Consolas', monospace;
font-size: 13px;
}
.event {
padding: 8px 12px;
margin-bottom: 8px;
border-radius: 6px;
border-left: 3px solid;
}
.event.comment { border-color: #888; background: rgba(136, 136, 136, 0.1); }
.event.tick { border-color: #444; background: rgba(68, 68, 68, 0.05); opacity: 0.6; }
.event.system { border-color: #88cc88; background: rgba(136, 204, 136, 0.1); }
.event.error { border-color: #ff4444; background: rgba(255, 68, 68, 0.1); }
.event.feed { border-color: #ffaa00; background: rgba(255, 170, 0, 0.1); color: #ffcc66; }
.event.agent_died { border-color: #ff4444; background: rgba(255, 68, 68, 0.15); color: #ff8888; }
.event.agent_speak { border-color: #88ccff; background: rgba(136, 204, 255, 0.1); color: #aaddff; }
.event.talk { border-color: #88ccff; background: rgba(136, 204, 255, 0.1); color: #aaddff; }
.event.check { border-color: #88cc88; background: rgba(136, 204, 136, 0.1); }
.event.heal { border-color: #ff88cc; background: rgba(255, 136, 204, 0.1); color: #ffaadd; }
.event.encourage { border-color: #ffcc44; background: rgba(255, 204, 68, 0.1); color: #ffdd88; }
.event.revive { border-color: #cc88ff; background: rgba(204, 136, 255, 0.1); color: #ddaaff; }
.event.auto_revive { border-color: #cc88ff; background: rgba(204, 136, 255, 0.1); color: #ddaaff; }
.event.weather_change { border-color: #66cccc; background: rgba(102, 204, 204, 0.1); color: #88dddd; }
.event.phase_change { border-color: #ccaa44; background: rgba(204, 170, 68, 0.1); color: #ddcc88; }
.event.day_change { border-color: #88ccff; background: rgba(136, 204, 255, 0.15); color: #aaddff; }
.event.social_interaction { border-color: #ff8888; background: rgba(255, 136, 136, 0.1); color: #ffaaaa; }
.event-time { color: #888; font-size: 11px; }
.event-type { font-weight: bold; text-transform: uppercase; font-size: 11px; }
.event-data { margin-top: 5px; white-space: pre-wrap; }
/* World Display */
.world-panel {
background: rgba(102, 204, 204, 0.1);
border: 1px solid rgba(102, 204, 204, 0.3);
border-radius: 12px;
padding: 12px 20px;
margin-bottom: 20px;
display: flex;
justify-content: center;
gap: 30px;
font-size: 1rem;
}
.world-panel span {
display: flex;
align-items: center;
gap: 6px;
}
/* Agent Actions */
.agent-actions {
display: grid;
grid-template-columns: 1fr 1fr;
gap: 8px;
margin-top: 12px;
}
.action-btn {
padding: 6px 8px;
font-size: 0.8rem;
border-radius: 6px;
border: none;
cursor: pointer;
transition: all 0.2s;
font-weight: bold;
}
.action-btn.feed { background: #88cc88; color: #1a2a1a; }
.action-btn.feed:hover { background: #66aa66; }
.action-btn.heal { background: #ff88cc; color: #1a2a1a; }
.action-btn.heal:hover { background: #ff66bb; }
.action-btn.encourage { background: #ffcc44; color: #1a2a1a; }
.action-btn.encourage:hover { background: #ffbb22; }
.action-btn.talk { background: #88ccff; color: #1a2a1a; }
.action-btn.talk:hover { background: #66bbff; }
.action-btn.revive { background: #cc88ff; color: #1a2a1a; grid-column: span 2; }
.action-btn.revive:hover { background: #bb66ff; }
</style>
</head>
<body>
<div class="container">
<h1>荒岛:人性的试炼</h1>
<p class="subtitle">The Island: Trial of Humanity</p>
<div class="status-bar">
<div class="status-indicator">
<div class="status-dot" id="statusDot"></div>
<span id="statusText">未连接</span>
</div>
<button id="connectBtn" onclick="toggleConnection()">连接</button>
</div>
<!-- User Panel -->
<div class="user-panel">
<div class="user-info">
<span>玩家:</span>
<input type="text" id="username" value="观众001" style="width: 120px;">
</div>
<div class="gold-display">
💰 <span id="userGold">100</span> 金币
</div>
</div>
<!-- World State Panel -->
<div class="world-panel" id="worldDisplay">
<span>📅 第1天</span>
<span>☀️ 白天</span>
<span>☀️ Sunny</span>
</div>
<!-- Agents Section -->
<div class="agents-section">
<div class="speech-bubbles-overlay" id="speechBubblesOverlay"></div>
<div style="display: flex; justify-content: space-between; align-items: center; margin-bottom: 15px;">
<h2 class="section-title" style="margin-bottom: 0;">岛上幸存者</h2>
<button onclick="resetGame()" style="background: #ff6666; padding: 8px 16px; font-size: 13px;">🔄 重新开始</button>
</div>
<div class="agents-grid" id="agentsGrid">
<!-- Agent cards will be dynamically generated -->
<div class="agent-card" id="agent-loading">
<p style="text-align: center; color: #666;">等待连接...</p>
</div>
</div>
</div>
<div class="panels">
<div class="panel">
<h2>发送指令</h2>
<div class="input-group">
<input type="text" id="message" placeholder="输入指令 (feed Jack, check, 查询...)">
<button onclick="sendComment()">发送</button>
</div>
<p style="margin-top: 10px; font-size: 0.85rem; color: #888;">
指令: <code>feed/heal/encourage/revive [名字]</code> | <code>talk [名字] [话题]</code> | <code>check</code> | <code>reset</code>
</p>
</div>
<div class="panel">
<h2>事件日志</h2>
<div class="controls">
<button onclick="clearLog()">清空</button>
<label><input type="checkbox" id="autoScroll" checked> 自动滚动</label>
<label><input type="checkbox" id="hideTicks" checked> 隐藏 Tick</label>
</div>
<div class="event-log" id="eventLog"></div>
</div>
</div>
</div>
<script src="app.js"></script>
</body>
</html>