three实现经典三维cs反恐精英游戏代码
代码语言:html
所属分类:其他
代码由gemini-4-hydrogen ai生成,可能有错误,仅供参考:点击查看提示词
代码描述:three实现经典三维cs反恐精英游戏代码
代码标签: three 经典 三维 cs 反恐 精英 游戏 代码
下面为部分代码预览,完整代码请点击下载或在bfwstudio webide中打开
<!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>反恐行动 · TACTICAL STRIKE</title>
<style>
:root {
--sand: #e8c568;
--sand-dim: #b59445;
--olive: #4a5d3f;
--ct: #5b9bd5;
--t: #e68a2e;
--red: #e04848;
--green: #4caf50;
--bg-dark: rgba(14, 17, 22, 0.84);
--bg-panel: rgba(20, 24, 30, 0.92);
--border: rgba(232, 197, 104, 0.35);
--text: #f0eee9;
--muted: #9aa3ad;
}
* { box-sizing: border-box; user-select: none; -webkit-user-select: none; }
html, body {
margin: 0; padding: 0; width: 100%; height: 100%; overflow: hidden;
background: #111317; color: var(--text);
font-family: "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
}
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: rgba(0,0,0,0.3); }
::-webkit-scrollbar-thumb { background: var(--sand-dim); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--sand); }
#game-container { position: fixed; inset: 0; width: 100%; height: 100%; }
canvas#webgl-canvas { display: block; width: 100%; height: 100%; }
/* Damage Vignette & Direction */
#damage-vignette {
position: fixed; inset: 0; pointer-events: none; opacity: 0;
background: radial-gradient(circle, transparent 48%, rgba(224, 32, 32, 0.65) 100%);
transition: opacity 0.08s ease-out; z-index: 5;
}
#damage-indicator {
position: fixed; top: 50%; left: 50%; width: 180px; height: 180px;
margin: -90px 0 0 -90px; pointer-events: none; opacity: 0; z-index: 6;
}
#damage-arrow {
position: absolute; top: 0; left: 50%; transform: translateX(-50%);
width: 0; height: 0;
border-left: 14px solid transparent; border-right: 14px solid transparent;
border-bottom: 24px solid rgba(255, 50, 50, 0.9);
filter: drop-shadow(0 0 8px rgba(255,0,0,0.8));
}
/* HUD Layer */
#hud {
position: fixed; inset: 0; pointer-events: none; z-index: 10;
display: none;
}
/* Top Center Timer & Score */
#top-bar {
position: absolute; top: 10px; left: 50%; transform: translateX(-50%);
display: flex; align-items: stretch; gap: 2px;
background: var(--bg-dark); border: 1px solid var(--border);
border-radius: 4px; overflow: hidden; box-shadow: 0 4px 16px rgba(0,0,0,0.5);
}
.score-box {
padding: 5px 14px; text-align: center; min-width: 58px;
display: flex; flex-direction: column; justify-content: center;
}
.score-ct { background: rgba(91, 155, 213, 0.22); border-right: 1px solid rgba(255,255,255,0.08); }
.score-t { background: rgba(230, 138, 46, 0.22); border-left: 1px solid rgba(255,255,255,0.08); }
.team-label { font-size: 10px; font-weight: 700; letter-spacing: 1px; }
.score-ct .team-label { color: var(--ct); }
.score-t .team-label { color: var(--t); }
.team-score { font-size: 20px; font-weight: 800; line-height: 1.1; }
.team-alive { font-size: 10px; color: var(--muted); }
#timer-box {
padding: 4px 18px; display: flex; flex-direction: column; align-items: center; justify-content: center;
min-width: 112px;
}
#round-label { font-size: 10px; color: var(--sand); letter-spacing: 1px; text-transform: uppercase; }
#round-timer { font-size: 22px; font-weight: 800; font-variant-numeric: tabular-nums; }
#round-timer.bomb-active { color: var(--red); animation: pulseRed 0.6s infinite alternate; }
@keyframes pulseRed { from { opacity: 1; } to { opacity: 0.45; } }
/* Radar */
#radar-wrap {
position: absolute; top: 12px; left: 12px;
background: var(--bg-dark); border: 1px solid var(--border);
border-radius: 6px; padding: 4px; box-shadow: 0 4px 14px rgba(0,0,0,0.5);
}
#radar-canvas { display: block; width: 150px; height: 150px; border-radius: 4px; }
#radar-zone {
position: absolute; bottom: 6px; left: 8px; right: 8px;
font-size: 10px; font-weight: 700; color: var(--sand);
text-shadow: 0 1px 2px #000; pointer-events: none;
}
/* Kill Feed */
#kill-feed {
position: absolute; top: 12px; right: 54px;
display: flex; flex-direction: column; align-items: flex-end; gap: 5px;
max-width: 320px;
}
.kill-item {
background: rgba(12, 15, 20, 0.82); border-right: 3px solid var(--sand);
padding: 4px 10px; font-size: 12px; border-radius: 2px;
display: flex; align-items: center; gap: 6px;
animation: fadeInRight 0.2s ease-out;
}
@keyframes fadeInRight { from { opacity: 0; transform: translateX(16px); } to { opacity: 1; transform: none; } }
.ct-name { color: var(--ct); font-weight: 700; }
.t-name { color: var(--t); font-weight: 700; }
.kill-wpn { color: var(--muted); font-size: 11px; }
.hs-badge { color: var(--red); font-weight: 800; font-size: 11px; }
/* Mute Button (always clickable) */
#mute-btn {
position: fixed; top: 12px; right: 12px; z-index: 60;
width: 36px; height: 36px; border-radius: 4px;
background: var(--bg-dark); border: 1px solid var(--border);
color: var(--sand); font-size: 16px; cursor: pointer;
display: flex; align-items: center; justify-content: center;
pointer-events: auto;
}
#mute-btn:hover { background: rgba(232,197,104,0.2); }
/* Bottom Left Status */
#hud-bottom-left {
position: absolute; bottom: 16px; left: 16px;
display: flex; align-items: flex-end; gap: 10px;
}
.stat-card {
background: var(--bg-dark); border: 1px solid var(--border);
border-radius: 4px; padding: 8px 14px; min-width: 92px;
}
.stat-title { font-size: 10px; color: var(--muted); letter-spacing: 1px; }
.stat-val { font-size: 28px; font-weight: 800; line-height: 1.05; font-variant-numeric: tabular-nums; }
#hp-val { color: var(--text); }
#hp-val.low { color: var(--red); }
#armor-val { color: var(--ct); }
#money-card {
background: var(--bg-dark); border: 1px solid rgba(76, 175, 80, 0.4);
border-radius: 4px; padding: 8px 14px;
}
#money-val { font-size: 22px; font-weight: 800; color: var(--green); }
#kit-badge {
display: none; font-size: 11px; color: var(--sand); font-weight: 700; margin-top: 2px;
}
/* Bottom Right Weapon & Ammo */
#hud-bottom-right {
position: absolute; bottom: 16px; right: 16px;
display: flex; flex-direction: column; align-items: flex-end; gap: 6px;
}
#weapon-slots {
display: flex; gap: 6px;
}
.slot-pill {
background: rgba(14,17,22,0.7); border: 1px solid rgba(255,255,255,0.12);
padding: 3px 8px; font-size: 11px; border-radius: 3px; color: var(--muted);
}
.slot-pill.active {
border-color: var(--sand); color: var(--sand); background: rgba(232,197,104,0.15); font-weight: 700;
}
#ammo-card {
background: var(--bg-dark); border: 1px solid var(--border);
border-radius: 4px; padding: 8px 16px; text-align: right; min-width: 170px;
}
#weapon-name { font-size: 12px; color: var(--sand); font-weight: 700; letter-spacing: 0.8px; }
#ammo-display { font-size: 28px; font-weight: 800; font-variant-numeric: tabular-nums; }
#ammo-reserve { font-size: 15px; color: var(--muted); font-weight: 600; }
/* Center Crosshair & Prompts */
#crosshair {
position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%);
width: 0; height: 0; pointer-events: none;
}
.ch-line {
position: absolute; background: rgba(120, 255, 120, 0.92);
box-shadow: 0 0 2px rgba(0,0,0,0.9);
}
#ch-top { width: 2px; height: 8px; left: -1px; bottom: 5px; }
#ch-bot { width: 2px; height: 8px; left: -1px; top: 5px; }
#ch-left { height: 2px; width: 8px; top: -1px; right: 5px; }
#ch-right { height: 2px; width: 8px; top: -1px; left: 5px; }
#ch-dot { width: 2px; height: 2px; left: -1px; top: -1px; background: rgba(120, 255, 120, 0.95); position: absolute; }
#hitmarker {
position: absolute; top: 50%; left: 50%; width: 24px; height: 24px;
margin: -12px 0 0 -12px; opacity: 0; pointer-events: none;
}
#hitmarker::before, #hitmarker::after {
content: ""; position: absolute; inset: 0;
background: linear-gradient(45deg, transparent 44%, #fff 44%, #fff 56%, transparent 56%),
linear-gradient(-45deg, transparent 44%, #fff 44%, #fff 56%, transparent 56%);
}
#hitmarker.headshot::before, #hitmarker.headshot::after {
background: linear-gradient(45deg, transparent 43%, #ff3b3b 43%, #ff3b3b 57%, transparent 57%),
linear-gradient(-45deg, transparent 43%, #ff3b3b 43%, #ff3b3b 57%, transparent 57%);
}
#center-prompt {
position: absolute; top: 60%; left: 50%; transform: translateX(-50%);
background: rgba(12,15,20,0.85); border: 1px solid var(--sand);
padding: 6px 14px; border-radius: 4px; font-size: 13px; color: var(--sand);
display: none; text-align: center;
}
#action-progress-wrap {
position: absolute; top: 65%; left: 50%; transform: translateX(-50%);
width: 240px; display: none; text-align: center;
}
#action-progress-label { font-size: 12px; color: #fff; margin-bottom: 4px; text-shadow: 0 1px 2px #000; }
#action-progress-bar {
width: 100%; height: 10px; background: rgba(0,0,0,0.7);
border: 1px solid var(--sand); border-radius: 5px; overflow: hidden;
}
#action-progress-fill { width: 0%; height: 100%; background: var(--sand); }
#buy-hint {
position: absolute; top: 82px; left: 50%; transform: translateX(-50%);
background: rgba(74, 93, 63, 0.9); border: 1px solid var(--sand);
padding: 4px 12px; border-radius: 4px; font-size: 12px; color: #fff;
display: none;
}
#spectate-banner {
position: absolute; bottom: 96px; left: 50%; transform: translateX(-50%);
background: rgba(12, 15, 20, 0.88); border: 1px solid var(--ct);
padding: 6px 18px; border-radius: 4px; font-size: 13px; color: var(--ct);
display: none;
}
#round-banner {
position: absolute; top: 26%; left: 50%; transform: translate(-50%, -50%);
background: rgba(12, 15, 20, 0.92); border-top: 3px solid var(--sand); border-bottom: 3px solid var(--sand);
padding: 16px 42px; text-align: center; display: none;
box-shadow: 0 10px 30px rgba(0,0,0,0.7);
}
#round-banner-title { font-size: 28px; font-weight: 900; letter-spacing: 2px; }
#round-banner-sub { font-size: 14px; color: var(--muted); margin-top: 4px; }
/* Overlays */
.overlay {
position: fixed; inset: 0; z-index: 40;
background: rgba(10, 12, 16, 0.82); backdrop-filter: blur(6px);
display: none; align-items: center; justify-content: center; padding: 16px;
}
.overlay.active { display: flex; }
.panel {
background: var(--bg-panel); border: 1px solid var(--border);
border-radius: 8px; padding: 24px 28px; max-width: 720px; width: 100%;
max-height: 90vh; overflow-y: auto;
box-shadow: 0 18px 50px rgba(0,0,0,0.75);
}
h1.game-title {
margin: 0; font-size: 32px; font-weight: 900; letter-spacing: 2px;
color: var(--sand); text-shadow: 0 2px 10px rgba(232,197,104,0.3);
}
.subtitle { color: var(--muted); font-size: 13px; margin: 4px 0 18px; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.box {
background: rgba(0,0,0,0.28); border: 1px solid rgba(255,255,255,0.08);
border-radius: 6px; padding: 12px 14px;
}
.box h3 { margin: 0 0 8px; font-size: 14px; color: var(--sand); letter-spacing: 0.5px; }
.controls-list { font-size: 12px; line-height: 1.75; color: #d5d8de; margin: 0; padding-left: 16px; }
kbd {
background: rgba(255,255,255,0.12); border: 1px solid rgba(255,255,255,0.2);
border-radius: 3px; padding: 1px 5px; font-size: 11px; color: var(--sand);
}
.form-row {
display: flex; align-items: center; justify-content: space-between;
margin-bottom: 10px; font-size: 13px;
}
select, input[type="range"] {
background: #1a2029; color: var(--text); border: 1px solid var(--border);
border-radius: 4px; padding: 5px 8px; font-size: 13px;
}
.btn-row { display: flex; gap: 10px; margin-top: 18px; flex-wrap: wrap; }
.btn {
padding: 10px 20px; border-radius: 5px; border: 1px solid var(--sand);
background: rgba(232,197,104,0.16); color: var(--sand);
font-size: 14px; font-weight: 700; cursor: pointer; transition: 0.15s;
}
.btn:hover { background: var(--sand); color: #111; }
.btn-primary { background: var(--sand); color: #111; flex: 1; font-size: 16px; }
.btn-primary:hover { background: #f5d882; }
.btn-danger { border-color: var(--red); color: var(--red); background: rgba(224,72,72,0.12); }
.btn-danger:hover { background: var(--red); color: #fff; }
/* Buy Menu */
#buy-overlay { z-index: 35; }
.buy-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-top: 12px; }
.buy-item {
background: rgba(0,0,0,0.35); border: 1px solid rgba(255,255,255,0.12);
border-radius: 6px; padding: 10px; cursor: pointer; text-align: left;
transition: 0.15s; color: var(--text);
}
.buy-item:hover:not(.disabled) { border-color: var(--sand); background: rgba(232,197,104,0.12); }
.buy-item.owned { border-color: var(--green); }
.buy-item.disabled { opacity: 0.45; cursor: not-allowed; }
.buy-name { font-weight: 700; font-size: 14px; color: var(--sand); }
.buy-price { font-weight: 800; font-size: 13px; color: var(--green); margin: 3px 0; }
.buy-desc { font-size: 11px; color: var(--muted); }
/* Scoreboard */
#scoreboard-overlay { z-index: 30; pointer-events: none; }
table.sb-table { width: 100%; border-collapse: collapse; font-size: 13px; ma.........完整代码请登录后点击上方下载按钮下载查看















网友评论0