three实现三维植物商店种植经营游戏代码
代码语言:html
所属分类:游戏
代码描述:three实现三维植物商店3D种植经营游戏代码,核心循环:去市场买种子 → 回温室种下 → 及时浇水 → 成熟后出售 → 赚钱升级 → 解锁新植物、扩建温室。
代码标签: 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>植物商店 — 3D种植经营游戏</title>
<style>
:root {
--bg: #1d241f;
--panel: rgba(28, 36, 30, 0.86);
--panel-edge: rgba(255, 255, 255, 0.1);
--ink: #f2efe4;
--ink-dim: #b6b6a6;
--gold: #f6c445;
--leaf: #7cb342;
--leaf-dark: #4f7c33;
--clay: #c1714a;
--danger: #e0644f;
--radius: 12px;
--shadow: 0 10px 30px rgba(0, 0, 0, 0.35);
}
* { box-sizing: border-box; }
html, body, #root { height: 100%; margin: 0; }
body {
background: var(--bg);
color: var(--ink);
font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
overflow: hidden;
-webkit-font-smoothing: antialiased;
}
.app { position: relative; width: 100%; height: 100%; }
.app canvas { display: block; touch-action: none; }
.overlay {
position: absolute; inset: 0;
display: grid; grid-template-rows: auto 1fr auto;
padding: 14px; gap: 12px; pointer-events: none;
}
.overlay > * { pointer-events: none; }
.overlay__side { display: flex; justify-content: flex-end; align-items: flex-start; min-height: 0; }
.hud {
display: flex; align-items: center; gap: 18px;
padding: 10px 16px; background: var(--panel);
border: 1px solid var(--panel-edge); border-radius: var(--radius);
backdrop-filter: blur(8px); box-shadow: var(--shadow); pointer-events: auto;
}
.hud__stat { display: flex; flex-direction: column; gap: 2px; }
.hud__label { font-size: 11px; letter-spacing: 0.08em; text-transform: uppercase; color: var(--ink-dim); }
.hud__value { font-size: 24px; font-weight: 700; font-variant-numeric: tabular-nums; color: var(--gold); line-height: 1.1; }
.hud__sub { font-size: 11px; color: var(--ink-dim); font-variant-numeric: tabular-nums; }
.hud__level { min-width: 190px; }
.hud__actions { margin-left: auto; display: flex; gap: 8px; }
.xpbar { height: 7px; border-radius: 99px; background: rgba(255,255,255,0.12); overflow: hidden; margin: 3px 0; }
.xpbar__fill { height: 100%; background: linear-gradient(90deg, var(--leaf-dark), var(--leaf)); transition: width 220ms ease-out; }
.btn {
display: inline-flex; align-items: center; gap: 8px;
padding: 9px 14px; font: inherit; font-size: 14px; font-weight: 600;
color: var(--ink); background: rgba(255,255,255,0.08);
border: 1px solid var(--panel-edge); border-radius: 9px;
cursor: pointer; transition: background 140ms ease, transform 90ms ease;
}
.btn:hover:not(:disabled) { background: rgba(255,255,255,0.16); }
.btn:active:not(:disabled) { transform: translateY(1px); }
.btn:disabled { opacity: 0.4; cursor: not-allowed; }
.btn--primary { background: var(--leaf-dark); border-color: transparent; }
.btn--primary:hover:not(:disabled) { background: var(--leaf); }
.btn--warn { background: rgba(246,196,69,0.22); border-color: rgba(246,196,69,0.45); }
.btn--ghost { background: transparent; }
.btn--small { padding: 5px 10px; font-size: 12px; }
.btn--buy { min-width: 62px; justify-content: center; font-variant-numeric: tabular-nums; background: var(--leaf-dark); border-color: transparent; }
.btn--buy:hover:not(:disabled) { background: var(--leaf); }
.iconbtn {
position: relative; display: inline-flex; align-items: center; justify-content: center;
min-width: 38px; height: 34px; padding: 0 8px;
font: inherit; font-size: 13px; line-height: 1; letter-spacing: -1px;
color: var(--ink); background: rgba(255,255,255,0.08);
border: 1px solid var(--panel-edge); border-radius: 8px;
cursor: pointer; transition: background 140ms ease, color 140ms ease;
}
.iconbtn:hover { background: rgba(255,255,255,0.18); }
.iconbtn--active { background: var(--leaf-dark); border-color: transparent; color: #fff; }
.iconbtn::after {
content: attr(data-tip); position: absolute; top: calc(100% + 8px); left: 50%;
transform: translateX(-50%) translateY(-3px); padding: 5px 9px;
font-size: 12px; font-weight: 500; letter-spacing: 0; white-space: nowrap;
color: var(--ink); background: rgba(18,24,20,0.96);
border: 1px solid var(--panel-edge); border-radius: 6px;
box-shadow: var(--shadow); opacity: 0; pointer-events: none;
transition: opacity 120ms ease, transform 120ms ease; z-index: 20;
}
.iconbtn:hover::after, .iconbtn:focus-visible::after { opacity: 1; transform: translateX(-50%) translateY(0); }
.timectl { display: flex; align-items: center; gap: 4px; padding: 3px; background: rgba(0,0,0,0.22); border-radius: 10px; }
.timectl__divider { width: 1px; height: 20px; margin: 0 2px; background: var(--panel-edge); }
.sidestack { display: flex; flex-direction: column; gap: 10px; max-height: 100%; min-height: 0; pointer-events: none; }
.sidestack .tray { min-height: 0; flex: 0 1 auto; }
.expand {
width: 330px; flex: none; padding: 14px;
background: var(--panel); border: 1px solid var(--panel-edge);
border-radius: var(--radius); backdrop-filter: blur(8px);
box-shadow: var(--shadow); pointer-events: auto;
}
.expand__title { margin: 0 0 4px; font-size: 13px; letter-spacing: 0.08em; text-transform: uppercase; color: var(--ink-dim); }
.expand__now { margin: 0 0 10px; font-size: 13px; font-weight: 600; color: var(--gold); font-variant-numeric: tabular-nums; }
.expand__row { display: flex; align-items: center; gap: 10px; justify-content: space-between; }
.expand__gain { display: flex; flex-direction: column; font-size: 14px; font-weight: 600; }
.expand__sub { font-size: 11px; font-weight: 400; color: var(--ink-dim); }
.expand__hint { margin: 8px 0 0; font-size: 12px; line-height: 1.4; color: var(--ink-dim); }
.tray, .market {
width: 330px; max-height: 100%; overflow-y: auto; padding: 14px;
background: var(--panel); border: 1px solid var(--panel-edge);
border-radius: var(--radius); backdrop-filter: blur(8px);
box-shadow: var(--shadow); pointer-events: auto;
}
.tray__title, .market__title { margin: 0 0 4px; font-size: 13px; letter-spacing: 0.08em; text-transform: uppercase; color: var(--ink-dim); }
.market__hint, .tray__hint { margin: 0 0 10px; font-size: 12px; color: var(--ink-dim); }
.tray__hint { margin: 10px 0 0; padding-top: 10px; border-top: 1px solid var(--panel-edge); color: var(--gold); }
.tray__empty { display: flex; flex-direction: column; align-items: flex-start; gap: 10px; margin: 0; font-size: 13px; color: var(--ink-dim); }
.tray__list, .market__list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.seed {
display: flex; align-items: center; gap: 10px; width: 100%;
padding: 9px 11px; font: inherit; font-size: 14px; color: var(--ink);
background: rgba(255,255,255,0.06); border: 1px solid transparent;
border-radius: 9px; cursor: pointer; text-align: left;
}
.seed:hover { background: rgba(255,255,255,0.13); }
.seed--selected { border-color: var(--gold); background: rgba(246,196,69,0.14); }
.seed__dot { width: 14px; height: 14px; border-radius: 50%; flex: none; box-shadow: inset 0 -2px 3px rgba(0,0,0,0.3); }
.seed__name { font-weight: 600; }
.seed__count { margin-left: auto; color: var(--ink-dim); font-variant-numeric: tabular-nums; }
.offer { display: flex; align-items: flex-start; gap: 10px; padding: 10px; border-radius: 10px; background: rgba(255,255,255,0.05); }
.offer--locked { opacity: 0.5; }
.offer__dot { width: 14px; height: 14px; border-radius: 50%; flex: none; margin-top: 3px; box-shadow: inset 0 -2px 3px rgba(0,0,0,0.3); }
.offer__body { flex: 1; min-width: 0; }
.offer__head { display: flex; align-items: baseline; gap: 8px; font-size: 14px; }
.offer__held { font-size: 11px; color: var(--gold); }
.offer__desc { margin: 2px 0 3px; font-size: 12px; line-height: 1.35; color: var(--ink-dim); }
.offer__meta { margin: 0; font-size: 11px; color: rgba(182,182,166,0.75); }
.feed { position: absolute; left: 14px; bottom: 56px; display: flex; flex-direction: column-reverse; gap: 6px; pointer-events: none; }
.feed__item { padding: 7px 12px; border-radius: 8px; font-size: 13px; font-weight: 600; background: var(--panel); border-left: 3px solid var(--ink-dim); box-shadow: var(--shadow); animation: rise 220ms ease-out; }
.feed__item--good { border-left-color: var(--leaf); color: #d5f0b8; }
.feed__item--bad { border-left-color: var(--danger); color: #ffcfc6; }
@keyframes rise { from { opacity: 0; transform: translateY(8px); } }
.footer { display: flex; align-items: center; gap: 12px; justify-content: space-between; font-size: 12px; color: rgba(242,239,228,0.65); text-shadow: 0 1px 3px rgba(0,0,0,0.6); }
.footer button { pointer-events: auto; }
.modal { position: absolute; inset: 0; display: grid; place-items: center; background: rgba(12,18,14,0.55); backdrop-filter: blur(3px); z-index: 10; }
.modal__card { width: min(560px, calc(100vw - 40px)); padding: 20px; background: var(--panel); border: 1px solid var(--panel-edge); border-radius: var(--radius); box-shadow: var(--shadow); }
.modal__head { display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.modal__head h2 { margin: 0; font-size: 18px; }
.modal__note { margin: 6px 0 16px; font-size: 12px; line-height: 1.45; color: var(--ink-dim); }
.slots { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.slot { display: flex; align-items: center; gap: 12px; padding: 12px; border-radius: 10px; background: rgba(255,255,255,0.05); .........完整代码请登录后点击上方下载按钮下载查看















网友评论0