js模仿魔兽世界英雄联盟游戏代码
代码语言:html
所属分类:游戏
代码描述:js模仿魔兽世界英雄联盟游戏代码
下面为部分代码预览,完整代码请点击下载或在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>峡谷争锋 · RIFT CLASH</title>
<style>
:root {
--blue: #3b82f6;
--blue-dark: #1d4ed8;
--red: #ef4444;
--red-dark: #b91c1c;
--gold: #f59e0b;
--xp: #a855f7;
--hp: #22c55e;
--mp: #38bdf8;
--warn: #dc2626;
--bg-panel: rgba(11, 17, 30, 0.92);
--border-gold: rgba(245, 158, 11, 0.45);
--text-main: #f1f5f9;
--text-dim: #94a3b8;
}
* { box-sizing: border-box; margin: 0; padding: 0; user-select: none; -webkit-user-select: none; }
html, body {
width: 100%; height: 100%; overflow: hidden;
background: #060a14; color: var(--text-main);
font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
touch-action: none;
}
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: rgba(15, 23, 42, 0.8); }
::-webkit-scrollbar-thumb { background: rgba(245, 158, 11, 0.45); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--gold); }
#game-container { position: fixed; inset: 0; z-index: 1; }
#webgl-canvas, #overlay-canvas {
position: absolute; inset: 0; width: 100%; height: 100%; display: block;
}
#overlay-canvas { pointer-events: none; z-index: 2; }
/* Top Bar */
#top-hud {
position: fixed; top: 8px; left: 50%; transform: translateX(-50%);
z-index: 10; display: flex; align-items: center; gap: 14px;
background: var(--bg-panel); border: 1px solid var(--border-gold);
border-radius: 10px; padding: 6px 16px;
box-shadow: 0 6px 24px rgba(0,0,0,0.6); backdrop-filter: blur(8px);
font-size: 13px; white-space: nowrap;
}
.score-block { display: flex; align-items: center; gap: 8px; font-weight: 700; }
.team-blue { color: #60a5fa; }
.team-red { color: #f87171; }
.stat-pill {
display: inline-flex; align-items: center; gap: 4px;
padding: 2px 8px; border-radius: 5px; background: rgba(255,255,255,0.06);
}
#game-timer { font-variant-numeric: tabular-nums; font-weight: 700; color: var(--gold); font-size: 15px; min-width: 48px; text-align: center; }
.hud-icon-btn {
background: rgba(255,255,255,0.08); border: 1px solid rgba(255,255,255,0.16);
color: var(--text-main); border-radius: 6px; padding: 4px 9px; cursor: pointer;
font-size: 12px; transition: background 0.15s, border-color 0.15s;
}
.hud-icon-btn:hover { background: rgba(245, 158, 11, 0.22); border-color: var(--gold); }
/* Kill Feed / Announcements */
#announcement-banner {
position: fixed; top: 58px; left: 50%; transform: translateX(-50%);
z-index: 11; pointer-events: none; display: flex; flex-direction: column; align-items: center; gap: 6px;
}
.announce-item {
background: rgba(11, 17, 30, 0.88); border: 1px solid var(--border-gold);
padding: 6px 18px; border-radius: 20px; font-size: 13px; font-weight: 600;
box-shadow: 0 4px 16px rgba(0,0,0,0.5); animation: fadeSlide 0.25s ease;
}
@keyframes fadeSlide { from { opacity: 0; transform: translateY(-8px); } to { opacity: 1; transform: translateY(0); } }
/* Bottom Center HUD */
#bottom-hud {
position: fixed; bottom: 8px; left: 50%; transform: translateX(-50%);
z-index: 10; display: flex; align-items: flex-end; gap: 10px;
background: var(--bg-panel); border: 1px solid var(--border-gold);
border-radius: 12px; padding: 8px 12px;
box-shadow: 0 8px 32px rgba(0,0,0,0.7); backdrop-filter: blur(8px);
transform-origin: bottom center;
}
.portrait-wrap {
position: relative; width: 62px; height: 62px; flex-shrink: 0;
border-radius: 50%; border: 2px solid var(--gold); overflow: hidden; background: #0f172a;
}
#hero-portrait-canvas { width: 100%; height: 100%; display: block; }
.level-badge {
position: absolute; bottom: -2px; right: -2px;
width: 24px; height: 24px; border-radius: 50%;
background: #0f172a; border: 2px solid var(--gold); color: var(--gold);
font-size: 11px; font-weight: 800; display: flex; align-items: center; justify-content: center;
z-index: 2;
}
.portrait-container { position: relative; flex-shrink: 0; }
.hud-stats-mini {
display: flex; flex-direction: column; gap: 3px; font-size: 11px; color: var(--text-dim);
min-width: 78px;
}
.hud-stats-mini strong { color: var(--text-main); font-size: 12px; }
.center-controls { display: flex; flex-direction: column; gap: 6px; }
.skills-row { display: flex; align-items: center; gap: 6px; }
.skill-slot {
position: relative; width: 48px; height: 48px; border-radius: 8px;
background: #111827; border: 1.5px solid rgba(255,255,255,0.22);
cursor: pointer; display: flex; flex-direction: column; align-items: center; justify-content: center;
overflow: hidden; transition: transform 0.1s, border-color 0.15s;
}
.skill-slot:hover { border-color: var(--gold); transform: translateY(-1px); }
.skill-slot.unlearned { opacity: 0.45; }
.skill-slot.no-mana { filter: saturate(0.35); border-color: #38bdf8; }
.skill-slot.summoner { width: 38px; height: 38px; border-radius: 6px; }
.skill-key {
position: absolute; top: 2px; left: 4px; font-size: 10px; font-weight: 800;
color: var(--gold); text-shadow: 0 1px 2px #000; z-index: 3;
}
.skill-icon-txt { font-size: 18px; z-index: 1; }
.skill-cost {
position: absolute; bottom: 1px; right: 3px; font-size: 9px; color: var(--mp);
font-weight: 700; text-shadow: 0 1px 2px #000; z-index: 3;
}
.skill-cd-mask {
position: absolute; inset: 0; z-index: 2; display: none;
align-items: center; justify-content: center; font-size: 14px; font-weight: 800;
color: #fff; text-shadow: 0 1px 4px #000;
}
.skill-pips {
position: absolute; bottom: 2px; left: 3px; display: flex; gap: 2px; z-index: 3;
}
.skill-pip { width: 4px; height: 4px; border-radius: 50%; background: rgba(255,255,255,0.2); }
.skill-pip.on { background: var(--gold); }
.lvl-up-btn {
position: absolute; top: -18px; left: 50%; transform: translateX(-50%);
width: 24px; height: 16px; border-radius: 4px; background: var(--gold); color: #000;
font-weight: 900; font-size: 13px; line-height: 15px; text-align: center;
cursor: pointer; z-index: 12; box-shadow: 0 2px 8px rgba(245,158,11,0.6);
display: none; border: none;
}
.skill-wrapper { position: relative; }
.bars-col { display: flex; flex-direction: column; gap: 4px; }
.bar-box {
position: relative; width: 100%; height: 15px; border-radius: 4px;
background: rgba(0,0,0,0.65); border: 1px solid rgba(255,255,255,0.12); overflow: hidden;
}
.bar-fill { height: 100%; transition: width 0.1s linear; }
.bar-hp { background: linear-gradient(90deg, #16a34a, #22c55e); }
.bar-mp { background: linear-gradient(90deg, #0284c7, #38bdf8); }
.bar-xp { background: linear-gradient(90deg, #7e22ce, #a855f7); height: 6px; }
.bar-box.xp-box { height: 6px; }
.bar-label {
position: absolute; inset: 0; display: flex; align-items: center; justify-content: center;
font-size: 10px; font-weight: 700; text-shadow: 0 1px 2px #000;
}
.items-panel { display: flex; flex-direction: column; gap: 5px; }
.items-grid { display: grid; grid-template-columns: repeat(3, 32px); gap: 4px; }
.item-slot {
width: 32px; height: 32px; border-radius: 5px; background: rgba(0,0,0,0.5);
border: 1px solid rgba(255,255,255,0.18); display: flex; align-items: center;
justify-content: center; font-size: 15px; position: relative; cursor: pointer;
}
.item-slot[title]:hover { border-color: var(--gold); }
.gold-row {
display: flex; align-items: center; justify-content: space-between; gap: 6px;
font-size: 12px; font-weight: 700; color: var(--gold);
}
.shop-mini-btn {
background: rgba(245,158,11,0.18); border: 1px solid var(--border-gold);
color: var(--gold); border-radius: 4px; padding: 2px 6px; font-size: 11px; cursor: pointer;
}
.shop-mini-btn:hover { background: rgba(245,158,11,0.35); }
/* Minimap */
#minimap-wrap {
position: fixed; bottom: 8px; right: 8px; z-index: 10;
background: var(--bg-panel); border: 2px solid var(--border-gold);
border-radius: 10px; padding: 4px; box-shadow: 0 6px 24px rgba(0,0,0,0.7);
}
#minimap-canvas { width: 176px; height: 176px; display: block; border-radius: 6px; cursor: crosshair; }
/* Touch Controls */
#touch-controls {
position: fixed; bottom: 105px; right: 14px; z-index: 9;
display: none; flex-direction: column; gap: 8px; align-items: flex-end;
}
.touch-row { display: flex; gap: 8px; }
.touch-btn {
width: 48px; height: 48px; border-radius: 50%;
background: rgba(15, 23, 42, 0.85); border: 1.5px solid var(--gold);
color: #fff; font-weight: 800; font-size: 14px;
display: flex; align-items: center; justify-content: center;
box-shadow: 0 4px 12px rgba(0,0,0,0.5);
}
.touch-btn:active { transform: scale(0.92); background: rgba(245,158,11,0.35); }
/* Overlays & Modals */
.modal-backdrop {
position: fixed; inset: 0; z-index: 30;
background: rgba(4, 8, 18, 0.82); backdrop-filter: blur(6px);
display: none; align-items: center; justify-content: center; padding: 16px;
}
.modal-backdrop.open { display: flex; }
.modal-card {
background: #0d1424; border: 1.5px solid var(--border-gold);
border-radius: 14px; padding: 20px 24px; max-width: 920px; width: 100%;
max-height: 88vh; overflow-y: auto; box-shadow: 0 18px 60px rgba(0,0,0,0.85);
}
.modal-header {
display: flex; align-items: center; justify-content: space-between;
margin-bottom: 16px; padding-bottom: 10px; border-bottom: 1px solid rgba(255,255,255,0.1);
}
.modal-title { font-size: 20px; font-weight: 800; color: var(--gold); letter-spacing: 0.5px; }
.btn-primary {
background: linear-gradient(135deg, #d97706, #f59e0b); color: #090d16;
border: none; border-radius: 8px; padding: 10px 22px; font-weight: 800; font-size: 14px;
cursor: pointer; transition: transform 0.1s, filter 0.15s;
}
.btn-primary:hover { filter: brightness(1.1); transform: translateY(-1px); }
.btn-secondary {
background: rgba(255,255,255,0.08); color: var(--text-main);
border: 1px solid rgba(255,255,255,0.2); border-radius: 8px; padding: 8px 16px;
font-weight: 600; font-size: 13px; cursor: pointer;
}
.btn-secondary:hover { background: rgba(255,255,255,0.16); }
/* Hero Selection */
#hero-select-modal { z-index: 40; }
.hero-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; margin-bottom: 18px; }
.hero-card {
background: rgba(255,255,255,0.04); border: 1.5px solid rgba(255,255,255,0.14);
border-radius: 12px; padding: 14px; cursor: pointer; transition: all 0.18s;
display: flex; flex-direction: column; gap: 8px;
}
.hero-card:hover { border-color: rgba(245,158,11,0.6); background: rgba(255,255,255,0.07); }
.hero-card.selected {
border-color: var(--gold); background: rgba(245, 158, 11, 0.12);
box-shadow: 0 0 24px rgba(245, 158, 11, 0.22);
}
.hero-card-head { display: flex; align-items: center; gap: 10px; }
.hero-badge {
width: 44px; height: 44px; border-radius: 10px; display: flex;
align-items: center; justify-content: center; font-size: 22px; font-weight: 800;
}
.hero-role { font-size: 11px; color: var(--gold); font-weight: 700; }
.hero-skill-list { font-size: 12px; color: var(--text-dim); line-height: 1.45; }
.hero-skill-list b { color: var(--text-main); }
.select-footer {
display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px;
padding-top: 12px; border-top: 1px solid rgba(255,255,255,0.1);
}
.diff-group { display: flex; align-items: center; gap: 8px; }
.diff-btn {
padding: 6px 14px; border-radius: 6px; border: 1px solid rgba(255,255,255,0.2);
background: rgba(255,255,255,0.05); color: var(--text-main); cursor: pointer; font-size: 13px;
}
.diff-btn.active { border-color: var(--gold); background: rgba(245,158,11,0.22); color: var(--gold); font-weight: 700; }
/* Shop */
.shop-tabs { display: flex; gap: 8px; margin-bottom: 12px; flex-wrap: wrap; }
.shop-tab {
padding: 6px 14px; border-radius: 6px; background: rgba(255,255,255,0.06);
border: 1px solid rgba(255,255,255,0.14); color: var(--text-main); cursor: pointer; font-size: 13px;
}
.shop-tab.active { background: rgba(245,158,11,0.2); border-color: var(--gold); color: var(--gold); font-weight: 700; }
.shop-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 10px; }
.shop-item {
background: rgba(255,255,255,0.04); border: 1px solid rgba(255,255,255,0.14);
border-radius: 8px; padding: 10px; display: flex; flex-direction: column; gap: 5px;
cursor: pointer; transition: border-color 0.15s;
}
.shop-item:hover:not(.disabled) { border-color: var(--gold); background: rgba(245,158,11,0.08); }
.shop-item.disabled { opacity: 0.42; cursor: not-allowed; }
.shop-item-top { display: flex; justify-content: space-between; align-items: center; font-weight: 700; font-size: 13px; }
.shop-owned-row { display: flex; gap: 8px; margin-top: 14px; padding-top: 12px; border-top: 1px solid rgba(255,255,255,0.1); align-items: center; flex-wrap: wrap; }
/* Scoreboard */
.sb-table { width: 100%; border-collapse: collapse; font-size: 13px; margin-bottom: 12px; }
.sb-table th, .sb-table td { padding: 8px 10px; text-align: left; border-bottom: 1px solid rgba(255,255,255,0.08); }
.sb-table th { color: var(--text-dim); font-weight: 600; font-size: 12px; }
/* Death Overlay */
#death-overlay {
position: fixed; inset: 0; z-inde.........完整代码请登录后点击上方下载按钮下载查看















网友评论0