three实现经典三维cs反恐精英游戏代码

代码语言:html

所属分类:其他

代码由gemini-4 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: #e2c07d;
    --sand-dark: #b59252;
    --mil-green: #3a4a38;
    --ct-blue: #4b8bbe;
    --ct-blue-glow: rgba(75, 139, 190, 0.45);
    --t-orange: #d9822b;
    --t-orange-glow: rgba(217, 130, 43, 0.45);
    --warn-red: #e63946;
    --ok-green: #38b000;
    --bg-panel: rgba(14, 18, 22, 0.86);
    --border-gold: rgba(226, 192, 125, 0.35);
  }
  * {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    user-select: none;
    -webkit-user-select: none;
  }
  html, body {
    width: 100%;
    height: 100%;
    overflow: hidden;
    background: #12100e;
    font-family: "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
    color: #f0e6d2;
  }
  ::-webkit-scrollbar { width: 6px; height: 6px; }
  ::-webkit-scrollbar-track { background: rgba(0,0,0,0.3); }
  ::-webkit-scrollbar-thumb { background: var(--sand-dark); border-radius: 3px; }

  #game-canvas {
    position: fixed;
    inset: 0;
    width: 100%;
    height: 100%;
    display: block;
    z-index: 1;
  }

  /* 受伤红屏与闪白 */
  #fx-overlay {
    position: fixed;
    inset: 0;
    pointer-events: none;
    z-index: 4;
    transition: box-shadow 0.1s ease-out, background 0.15s ease-out;
  }
  #damage-arc {
    position: fixed;
    top: 50%;
    left: 50%;
    width: 240px;
    height: 240px;
    margin-left: -120px;
    margin-top: -120px;
    border-radius: 50%;
    border: 6px solid transparent;
    pointer-events: none;
    z-index: 5;
    opacity: 0;
    transition: opacity 0.15s;
  }
  /* 狙击开镜遮罩 */
  #scope-overlay {
    position: fixed;
    inset: 0;
    pointer-events: none;
    z-index: 5;
    display: none;
    background: radial-gradient(circle at center, transparent 28%, rgba(0,0,0,0.96) 31%);
  }
  #scope-overlay::before, #scope-overlay::after {
    content: "";
    position: absolute;
    background: rgba(0, 0, 0, 0.85);
  }
  #scope-overlay::before { top: 50%; left: 0; right: 0; height: 1.5px; }
  #scope-overlay::after { left: 50%; top: 0; bottom: 0; width: 1.5px; }

  /* HUD 主层 */
  #hud {
    position: fixed;
    inset: 0;
    pointer-events: none;
    z-index: 10;
  }

  /* 左上雷达 */
  #radar-box {
    position: absolute;
    top: 14px;
    left: 14px;
    width: 156px;
    height: 156px;
    background: var(--bg-panel);
    border: 2px solid var(--border-gold);
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 6px 18px rgba(0,0,0,0.6);
  }
  #radar-canvas {
    width: 100%;
    height: 100%;
    display: block;
  }
  #radar-label {
    position: absolute;
    bottom: 4px;
    left: 6px;
    right: 6px;
    display: flex;
    justify-content: space-between;
    font-size: 11px;
    color: var(--sand);
    text-shadow: 0 1px 2px #000;
    font-weight: 700;
  }

  /* 顶部中央比分与时间 */
  #top-bar {
    position: absolute;
    top: 12px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    pointer-events: auto;
  }
  .score-strip {
    display: flex;
    align-items: center;
    background: var(--bg-panel);
    border: 1px solid var(--border-gold);
    border-radius: 6px;
    overflow: hidden;
    box-shadow: 0 4px 16px rgba(0,0,0,0.6);
  }
  .team-score {
    padding: 6px 14px;
    font-size: 20px;
    font-weight: 800;
    min-width: 68px;
    text-align: center;
    letter-spacing: 1px;
  }
  .team-score.ct { background: rgba(75, 139, 190, 0.25); color: #7ec8ff; border-right: 1px solid var(--border-gold); }
  .team-score.t { background: rgba(217, 130, 43, 0.25); color: #ffb366; border-left: 1px solid var(--border-gold); }
  #timer-box {
    padding: 4px 18px;
    text-align: center;
    min-width: 110px;
  }
  #round-timer {
    font-size: 22px;
    font-weight: 900;
    font-variant-numeric: tabular-nums;
    color: #fff;
  }
  #round-timer.bomb-active {
    color: var(--warn-red);
    animation: pulseRed 0.6s infinite alternate;
  }
  @keyframes pulseRed {
    from { transform: scale(1); text-shadow: 0 0 4px var(--warn-red); }
    to { transform: scale(1.08); text-shadow: 0 0 14px var(--warn-red); }
  }
  #round-phase {
    font-size: 11px;
    color: var(--sand);
    letter-spacing: 1px;
  }
  #top-subbar {
    display: flex;
    align-items: center;
    gap: 8px;
  }
  .Alive-pills {
    display: flex;
    gap: 4px;
    background: rgba(0,0,0,0.55);
    padding: 3px 8px;
    border-radius: 4px;
    font-size: 11px;
    border: 1px solid rgba(255,255,255,0.12);
  }
  .hud-btn {
    pointer-events: auto;
    background: rgba(20, 26, 30, 0.85);
    color: var(--sand);
    border: 1px solid var(--border-gold);
    border-radius: 4px;
    padding: 3px 8px;
    font-size: 11px;
    cursor: pointer;
    transition: background 0.15s;
  }
  .hud-btn:hover { background: rgba(226, 192, 125, 0.2); }

  /* 右上击杀播报 */
  #killfeed {
    position: absolute;
    top: 14px;
    right: 14px;
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 5px;
    max-width: 320px;
  }
  .kill-item {
    background: rgba(12, 15, 18, 0.82);
    border-left: 3px solid var(--sand);
    padding: 4px 10px;
    border-radius: 4px;
    font-size: 12px;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 6px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.5);
    animation: slideIn 0.2s ease-out;
  }
  @keyframes slideIn {
    from { opacity: 0; transform: translateX(20px); }
    to { opacity: 1; transform: translateX(0); }
  }
  .k-ct { color: #7ec8ff; }
  .k-t { color: #ffb366; }
  .k-wpn { color: #ccc; font-size: 11px; background: rgba(255,255,255,0.1); padding: 1px 5px; border-radius: 3px; }
  .k-hs { color: var(--warn-red); font-weight: 900; }

  /* 中心准星与命中反馈 */
  #crosshair {
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
  }
  .ch-line {
    position: absolute;
    background: #55ff55;
    box-shadow: 0 0 2px #000;
  }
  .ch-top { width: 2px; height: 8px; left: -1px; bottom: 4px; }
  .ch-bottom { width: 2px; height: 8px; left: -1px; top: 4px; }
  .ch-left { height: 2px; width: 8px; top: -1px; right: 4px; }
  .ch-right { height: 2px; width: 8px; top: -1px; left: 4px; }
  .ch-dot { width: 2px; height: 2px; left: -1px; top: -1px; background: #55ff55; }

  #hitmarker {
    position: absolute;
    top: 50%;
    left: 50%;
    width: 22px;
    height: 22px;
    margin-left: -11px;
    margin-top: -11px;
    opacity: 0;
    transition: opacity 0.08s;
  }
  #hitmarker::before, #hitmarker::after {
    content: "";
    position: absolute;
    top: 10px;
    left: 0;
    width: 22px;
    height: 2px;
    background: #ffffff;
    box-shadow: 0 0 3px #000;
  }
  #hitmarker::before { transform: rotate(45deg); }
  #hitmarker::after { transform: rotate(-45deg); }
  #hitmarker.headshot::before, #hitmarker.headshot::after {
    background: var(--warn-red);
    height: 3px;
  }

  /* 拆弹/安包进度条与交互提示 */
  #center-prompts {
    position: absolute;
    top: 62%;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    text-align: center;
  }
  #action-hint {
    background: rgba(12, 16, 20, 0.85);
    border: 1px solid var(--border-gold);
    padding: 6px 14px;
    border-radius: 5px;
    font-size: 13px;
    color: var(--sand);
    display: none;
  }
  #progress-wrap {
    width: 240px;
    background: rgba(0,0,0,0.8);
    border: 1px solid var(--sand);
    border-radius: 5px;
    padding: 6px;
    display: none;
  }
  #progress-title {
    font-size: 12px;
    margin-bottom: 4px;
    color: #fff;
    font-weight: 700;
  }
  #progress-bar-bg {
    width: 100%;
    height: 10px;
    background: rgba(255,255,255,0.15);
    border-radius: 3px;
    overflow: hidden;
  }
  #progress-bar-fill {
    width: 0%;
    height: 100%;
    background: linear-gradient(90deg, var(--ct-blue), #66d9ff);
  }

  /* 回合横幅 */
  #round-banner {
    position: absolute;
    top: 24%;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(14, 18, 22, 0.92);
    border: 2px solid var(--sand);
    border-radius: 8px;
    padding: 14px 32px;
    text-align: center;
    box-shadow: 0 10px 30px rgba(0,0,0,0.75);
    display: none;
  }
  #banner-title { font-size: 24px; font-weight: 900; letter-spacing: 2px; margin-bottom: 4px; }
  #banner-sub { font-size: 13px; color: var(--sand); }

  /* 观战提示栏 */
  #spectator-bar {
    position: absolute;
    bottom: 95px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(14, 18, 22, 0.88);
    border: 1px solid var(--warn-red);
    padding: 8px 18px;
    border-radius: 6px;
    font-size: 13px;
    text-align: center;
    display: none;
    pointer-events: auto;
  }

  /* 左下状态栏(HP / 护甲 / 金钱 / 拆弹器) */
  #bottom-left {
    position: absolute;
    bottom: 16px;
    left: 16px;
    display: flex;
    flex-direction: column;
    gap: 8px;
  }
  .money-row {
    display: flex;
    align-items: center;
    gap: 10px;
  }
  #money-display {
    background: var(--bg-panel);
    border: 1px solid rgba(56, 176, 0, 0.5);
    padding: 5px 14px;
    border-radius: 6px;
    font-size: 20px;
    font-weight: 800;
    color: #55ff55;
    font-variant-numeric: tabular-nums;
  }
  #kit-badge, #buy-hint-badge {
    background: var(--bg-panel);
    border: 1px solid var(--border-gold);
    padding: 5px 10px;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 700;
    color: var(--sand);
  }
  .vitals-row {
    display: flex;
    gap: 10px;
  }
  .vital-card {
    background: var(--bg-panel);
    border: 1px solid var(--border-gold);
    border-radius: 6px;
    padding: 8px 14px;
    min-width: 118px;
    display: flex;
    align-items: baseline;
     justify-content: space-between;
  }
  .vital-label { font-size: 12px; color: var(--sand); font-weight: 700; }
  .vital-val { font-size: 28px; font-weight: 900; font-variant-numeric: tabular-nums; }
  #hp-val.low { color: var(--warn-red); animation: pulseRed 0.5s infinite alternate; }

  /* 右下弹药与武器栏 */
  #bottom-right {
    position: absolute;
    bottom: 16px;
    right: 16px;
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 8px;
  }
  #weapon-slots {
    display: flex;
    gap: 6px;
  }
  .slot-pill {
    background: rgba(14, 18, 22, 0.72);
    border: 1px solid rgba(255,255,255,0.15);
    padding: 4px 10px;
    border-radius: 4px;
    font-size: 12px;
    color: #aaa;
  }
  .slot-pill.active {
    background: rgba(226, 192, 125, 0.22);
    border-color: var(--sand);
    color: #fff;
    font-weight: 700;
  }
  .ammo-card {
    background: var(--bg-panel);
    border: 1px solid var(--border-gold);
    border-radius: 6px;
    padding: 8px 18px;
    display: flex;
    align-items: baseline;
    gap: 12px;
  }
  #weapon-name { font-size: 14px; font-weight: 800; color: var(--sand); }
  #ammo-mag { font-size: 30px; font-weight: 900; font-variant-numeric: tabular-nums; }
  #ammo-sep { font-size: 20px; color: #888; }
  #ammo-res { font-size: 18px; color: #bbb; font-variant-numeric: tabular-nums; }

  /* 弹窗通用样式(开始/暂停、购买菜单、计分板、比赛结算) */
  .modal-layer {
    position: fixed;
    inset: 0;
    background: rgba(8, 10, 12, 0.82);
    backdrop-filter: blur(5px);
    z-index: 30;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
  }
  .panel-box {
    background: linear-gradient(145deg, rgba(22, 26, 30, 0.96), rgba(14, 17, 20, 0.98));
    border: 1px solid var(--sand);
    border-radius: 10px;
    max-width: 780px;
    width: 100%;
    max-height: 92vh;
    overflow-y: auto;
    padding: 24px;
    box-shadow: 0 20px 50px rgba(0,0,0,0.85);
  }
  .panel-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid var(--border-gold);
    padding-bottom: 12px;
    margin-bottom: 16px;
  }
  .game-title {
    font-size: 26px;
    font-weight: 900;
    color: var(--sand);
    letter-spacing: 2px;
  }
  .game-sub {
    font-size: 12px;
    color: #aaa;
  }

  .grid-2 {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
  }
  .info-block {
    background: rgba(0,0,0,0.35);
    border: 1px solid rgba(255,255,255,0.1);
    border-radius: 8px;
    padding: 14px;
  }
  .info-block h3 {
    color: var(--sand);
    font-size: 14px;
    margin-bottom: 10px;
    border-left: 3px solid var(--ct-blue);
    padding-left: 8px;
  }
  .key-list {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 6px;
    font-size: 12px;
    color: #ccc;
  }
  .key-badge {
    display: inline-block;
    background: rgba(226, 192, 125, 0.18);
    border: 1px solid var(--border-gold);
    color: var(--sand);
    padding: 1px 6px;
    border-radius: 4px;
    font-weight: 700;
    margin-right: 4px;
  }

  .setting-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
    font-size: 13px;
  }
  .setting-row select, .setting-row input[type="range"] {
    background: #1a2026;
    color: #fff;
    border: 1px solid var(--border-gold);
    padding: 4px 8px;
    border-radius: 4px;
    width: 140px;
  }

  .btn-primary {
    background: linear-gradient(135deg, var(--ct-blue), #2b5d87);
    color: #fff;
    border: 1px solid #8ad0ff;
    padding: 12px 28px;
    border-radius: 6px;
    font-size: 16px;
    font-weight: 800;
    cursor: pointer;
    letter-spacing: 1px;
    transition: transform 0.1s, filter 0.15s;
  }
  .btn-prim.........完整代码请登录后点击上方下载按钮下载查看

网友评论0