diff --git a/assets/game-api.js b/assets/game-api.js index b187954..3a00622 100644 --- a/assets/game-api.js +++ b/assets/game-api.js @@ -1,6 +1,8 @@ // 宇森游戏 · 前端与 Odoo 通信层 // 本地调试:前端 8888 -> Odoo 8069(跨域,带调试 CORS 头) // 生产部署:前端与 Odoo 同域,由 nginx 代理 /game/*。 +// 说明:odoo.conf 已 db_name=yt_game 钉死库,URL 上的 ?db= 形同虚设, +// 请求一律落到 yt_game;下列 game/* 沿用统一 API_CONFIG,yt_world/* 单独带 ?db=yt_game。 const API_CONFIG = { base: (location.hostname === '127.0.0.1' && location.port === '8888') @@ -60,17 +62,17 @@ const API = { }, // ---------- 沙盘记忆(yt_world 模块) ---------- async world() { - return (await fetch('/yt_world/api/world?db=game', { credentials: 'same-origin' })).json(); + return (await fetch('/yt_world/api/world?db=yt_game', { credentials: 'same-origin' })).json(); }, async saveTiles(tiles) { - return (await fetch('/yt_world/api/tiles/save?db=game', { + return (await fetch('/yt_world/api/tiles/save?db=yt_game', { method: 'POST', credentials: 'same-origin', headers: { 'Content-Type': 'application/json' }, body: JSON.stringify({ tiles }), })).json(); }, async saveSettings(settings) { - return (await fetch('/yt_world/api/settings?db=game', { + return (await fetch('/yt_world/api/settings?db=yt_game', { method: 'POST', credentials: 'same-origin', headers: { 'Content-Type': 'application/json' }, body: JSON.stringify({ settings }), diff --git a/world.html b/world.html index b0d9eb9..d4da67f 100644 --- a/world.html +++ b/world.html @@ -17,25 +17,52 @@ body { background: #0a0e17; overflow: hidden; font-family: 'Microsoft YaHei', sa #gameCanvas.canDrag { cursor: grab; } #topBar { - position: fixed; top: 0; left: 0; right: 0; height: 44px; - background: linear-gradient(180deg, rgba(10,14,23,0.95) 0%, rgba(10,14,23,0.7) 100%); - display: flex; align-items: center; padding: 0 16px; - border-bottom: 1px solid rgba(100,200,255,0.2); - z-index: 100; backdrop-filter: blur(8px); + position: fixed; top: 0; left: 0; right: 0; height: 58px; + background: #0a0e17; + display: flex; align-items: center; padding: 0 18px; + border-bottom: 1px solid rgba(139,92,246,.35); + z-index: 100; pointer-events: none; + color: #e9edf6; font-family: "Noto Sans SC", system-ui, sans-serif; } #topBar .title { - font-size: 15px; font-weight: bold; - background: linear-gradient(90deg, #4af, #a8e6cf); + font-size: 18px; font-weight: 700; + background: linear-gradient(90deg, #7cc7ff, #b6f0d4); -webkit-background-clip: text; -webkit-text-fill-color: transparent; - display: flex; align-items: center; gap: 8px; + display: flex; align-items: center; gap: 10px; } -#topBar .title img { width: 30px; height: 30px; border-radius: 6px; box-shadow: 0 0 10px rgba(74,175,255,0.45); } +#topBar .title img { width: 34px; height: 34px; border-radius: 7px; box-shadow: 0 0 12px rgba(74,175,255,.5); } #topBar .title .worldName { - font-size: 13px; font-weight: 600; color: #bcd0e6; -webkit-text-fill-color: #bcd0e6; - margin-left: 8px; padding-left: 8px; border-left: 1px solid rgba(255,255,255,0.25); + font-size: 15px; font-weight: 600; color: #cfe1f3; -webkit-text-fill-color: #cfe1f3; + margin-left: 10px; padding-left: 10px; border-left: 1px solid rgba(255,255,255,.28); } -#topBar .coords { margin-left: auto; font-size: 12px; color: #8899aa; } +#topBar .coords { font-size: 14px; color: #a8b8cc; } + +/* ===== 顶部右侧用户区(融合进 #topBar,恒在最右侧) ===== */ +#topBar .userArea{position:relative;margin-left:auto;pointer-events:auto;} +#topBar .ua-trigger{display:flex;align-items:center;gap:8px;background:rgba(139,92,246,.18); + border:1px solid rgba(139,92,246,.5);color:#e9edf6;padding:7px 14px;border-radius:999px; + font:inherit;font-size:14px;font-weight:500;cursor:pointer;transition:.2s;} +#topBar .ua-trigger:hover{background:rgba(139,92,246,.32);border-color:#a78bfa;} +#topBar .ua-avatar{width:22px;height:22px;border-radius:50%; + background:linear-gradient(135deg,#c77dff,#4af);display:inline-flex;align-items:center;justify-content:center; + font-size:11px;color:#fff;font-weight:700;} +#topBar .ua-name{font-weight:600;color:#c77dff;max-width:160px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;} +#topBar .ua-caret{font-size:10px;color:#9aa6c4;transition:transform .2s;} +#topBar .ua-trigger[aria-expanded="true"] .ua-caret{transform:rotate(180deg);} +#topBar .ua-menu{position:absolute;top:calc(100% + 8px);right:0;min-width:200px; + background:#0e1428;border:1px solid rgba(139,92,246,.45);border-radius:12px;padding:6px; + box-shadow:0 10px 28px rgba(0,0,0,.55);display:none;z-index:120;} +#topBar .ua-menu.open{display:block;animation:uaSlide .18s ease-out;} +@keyframes uaSlide{from{opacity:0;transform:translateY(-6px);}to{opacity:1;transform:translateY(0);}} +#topBar .ua-item{display:flex;align-items:center;justify-content:space-between;width:100%; + background:transparent;border:none;color:#cfd5ea;padding:9px 12px;border-radius:8px; + font:inherit;font-size:14px;cursor:pointer;text-align:left;transition:.15s;} +#topBar .ua-item:not(:disabled):hover{background:rgba(139,92,246,.2);color:#fff;} +#topBar .ua-item:disabled{opacity:.5;cursor:not-allowed;} +#topBar .ua-item--danger:not(:disabled):hover{background:rgba(239,68,68,.22);color:#ffb4b4;} +#topBar .ua-sep{height:1px;background:rgba(255,255,255,.08);margin:5px 4px;} +#topBar .ua-soon{font-size:10px;color:#778;background:rgba(255,255,255,.06);padding:1px 6px;border-radius:8px;} /* 主沙盘底部功能框架(预留区:放功能按钮 / 素材槽,比微观边框更高) */ #bottomBar { @@ -351,18 +378,12 @@ body { background: #0a0e17; overflow: hidden; font-family: 'Microsoft YaHei', sa #authSplash{position:fixed;inset:0;z-index:9999;display:flex;align-items:center;justify-content:center; background:linear-gradient(160deg,#080c1a,#0e1730 48%,#15213f);color:#9aa6c4; font-family:"Noto Sans SC",system-ui,sans-serif;font-size:15px;letter-spacing:3px;} -#authBar{position:fixed;top:8px;right:16px;z-index:110;display:none;align-items:center;gap:8px; - padding:5px 12px;border-radius:999px;background:rgba(10,16,30,.85);backdrop-filter:blur(10px); - border:1px solid rgba(255,255,255,.14);font-family:"Noto Sans SC",system-ui,sans-serif;font-size:12px;color:#e9edf6;} -#authBar .ab-name{color:#c77dff;font-weight:500;} -#authBar .ab-logout{cursor:pointer;color:#9aa6c4;border:1px solid rgba(255,255,255,.18);background:transparent;border-radius:8px;padding:4px 10px;font-family:inherit;font-size:12px;transition:.2s;} -#authBar .ab-logout:hover{color:#fff;border-color:#8b5cf6;} +/* #authBar 已融合进 #topBar .userArea */
登录校验中…
-
@@ -380,6 +401,19 @@ body { background: #0a0e17; overflow: hidden; font-family: 'Microsoft YaHei', sa 宇森大地 坐标: (0, 0) +
@@ -487,7 +521,6 @@ body { background: #0a0e17; overflow: hidden; font-family: 'Microsoft YaHei', sa
地块信息
🟢 平原
-
坐标: (0, 0)
建筑
@@ -519,7 +552,7 @@ body { background: #0a0e17; overflow: hidden; font-family: 'Microsoft YaHei', sa