three实现三维城市建筑者经营游戏
代码语言:html
所属分类:游戏
代码描述:three实现三维城市建筑者经营游戏,目标:建立繁荣的立体都市,平衡金钱与人口增长!
下面为部分代码预览,完整代码请点击下载或在bfwstudio webide中打开
<!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>
* {
margin: 0;
padding: 0;
box-sizing: border-box;
}
body {
font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
overflow: hidden;
background: #1a1a2e;
}
#gameCanvas {
display: block;
}
/* 顶部状态栏 */
#topBar {
position: fixed;
top: 0;
left: 0;
right: 0;
height: 60px;
background: linear-gradient(135deg, #16213e 0%, #1a1a2e 100%);
border-bottom: 2px solid #0f3460;
display: flex;
align-items: center;
padding: 0 20px;
z-index: 100;
box-shadow: 0 4px 20px rgba(0,0,0,0.5);
}
.stat-box {
display: flex;
align-items: center;
background: rgba(255,255,255,0.1);
padding: 8px 16px;
border-radius: 10px;
margin-right: 15px;
border: 1px solid rgba(255,255,255,0.1);
}
.stat-icon {
font-size: 24px;
margin-right: 10px;
}
.stat-value {
color: #fff;
font-size: 18px;
font-weight: bold;
}
.stat-label {
color: #aaa;
font-size: 12px;
}
#dayCounter {
margin-left: auto;
color: #e94560;
font-size: 20px;
font-weight: bold;
}
/* AI 顾问面板 */
#aiAdvisor {
position: fixed;
top: 70px;
left: 20px;
width: 320px;
background: linear-gradient(135deg, #16213e 0%, #0f3460 100%);
border-radius: 15px;
padding: 20px;
z-index: 100;
border: 2px solid #e94560;
box-shadow: 0 10px 40px rgba(233, 69, 96, 0.3);
}
#aiAdvisor h3 {
color: #e94560;
margin-bottom: 15px;
display: flex;
align-items: center;
font-size: 16px;
}
#aiAdvisor h3::before {
content: '🤖';
margin-right: 10px;
font-size: 24px;
}
#currentTask {
color: #fff;
font-size: 14px;
line-height: 1.6;
padding: 15px;
background: rgba(0,0,0,0.3);
border-radius: 10px;
margin-bottom: 15px;
}
#taskProgress {
height: 8px;
background: rgba(255,255,255,0.1);
border-radius: 4px;
overflow: hidden;
}
#taskProgressBar {
height: 100%;
background: linear-gradient(90deg, #e94560, #ff6b6b);
border-radius: 4px;
transition: width 0.5s ease;
width: 0%;
}
#taskReward {
color: #4ade80;
font-size: 12px;
margin-top: 10px;
text-align: right;
}
/* 建筑选择面板 */
#buildingPanel {
position: fixed;
bottom: 20px;
left: 50%;
transform: translateX(-50%);
display: flex;
gap: 10px;
background: linear-gradient(135deg, #16213e 0%, #1a1a2e 100%);
padding: 15px 25px;
border-radius: 20px;
z-index: 100;
border: 2px solid #0f3460;
box-shadow: 0 10px 40px rgba(0,0,0,0.5);
}
.building-btn {
width: 70px;
height: 80px;
border: 2px solid #0f3460;
border-radius: 12px;
background: rgba(255,255,255,0.05);
cursor: pointer;
transition: all 0.3s ease;
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
color: #fff;
}
.building-btn:hover {
background: rgba(255,255,255,0.15);
transform: translateY(-5px);
border-color: #e94560;
}
.building-btn.active {
background: rgba(233, 69, 96, 0.3);
border-color: #e94560;
box-shadow: 0 0 20px rgba(233, 69, 96, 0.5);
}
.building-btn .icon {
font-size: 28px;
margin-bottom: 5px;
}
.building-btn .name {
font-size: 10px;
color: #aaa;
}
.building-btn .cost {
font-size: 11px;
color: #4ade80;
font-weight: bold;
}
/* 新闻面板 */
#newsPanel {
position: fixed;
bottom: 20px;
right: 20px;
width: 300px;
max-height: 200px;
background: linear-gradient(135deg, #16213e 0%, #0f3460 100%);
border-radius: 15px;
padding: 15px;
z-index: 100;
border: 2px solid #0f3460;
overflow-y: auto;
}
#newsPanel h4 {
color: #e94560;
margin-bottom: 10px;
font-size: 14px;
}
#newsPanel h4::before {
content: '📰';
margin-right: 8px;
}
.news-item {
color: #ccc;
font-size: 12px;
padding: 8px;
.........完整代码请登录后点击上方下载按钮下载查看
















网友评论0