6234a50bdb
- 新增避难所仓储功能,支持物品在随身背包与仓储间转移 - 添加生存状态图标资源与状态阈值告警系统 - 重构HUD界面,优化状态显示与操作流程 - 扩展游戏核心系统,增加仓储相关动作和校验 - 更新文档说明仓储规则与实现细节
87 lines
2.8 KiB
TypeScript
87 lines
2.8 KiB
TypeScript
import type { OverlayPanel } from '../types';
|
|
import type { GameAction, GameView } from '@tinywaste/game-core';
|
|
import { getActiveQuestCount, getCurrentPlace, getDominantAlert, getSupplyCounts } from '../hudModel';
|
|
|
|
export function BottomDock({
|
|
activePanel,
|
|
onOpenPanel,
|
|
onSendAction,
|
|
view,
|
|
}: {
|
|
activePanel: OverlayPanel | null;
|
|
onOpenPanel: (panel: OverlayPanel) => void;
|
|
onSendAction: (action: GameAction) => void;
|
|
view: GameView;
|
|
}) {
|
|
const supplyCounts = getSupplyCounts(view);
|
|
const activeQuestCount = getActiveQuestCount(view);
|
|
const currentPlace = getCurrentPlace(view);
|
|
const homeRoute = view.map.edges.find((edge) => edge.to === 'home');
|
|
const dominantAlert = getDominantAlert(view);
|
|
|
|
return (
|
|
<footer className="command-dock tactical-dock">
|
|
<div className="operator-card tactical-operator">
|
|
<div className="operator-emblem">{view.player.name.slice(0, 1)}</div>
|
|
<div className="operator-copy">
|
|
<span>ACTIVE SURVIVOR</span>
|
|
<strong>{view.player.name}</strong>
|
|
</div>
|
|
</div>
|
|
|
|
<div className="dock-nav-groups">
|
|
<div className="dock-tabs">
|
|
<button className="dock-tab active">{currentPlace?.name ?? 'Expedition'}</button>
|
|
<button
|
|
className={`dock-tab ${activePanel === 'blueprints' ? 'active' : ''}`}
|
|
onClick={() => onOpenPanel('blueprints')}
|
|
>
|
|
Crafting
|
|
</button>
|
|
<button
|
|
className={`dock-tab ${activePanel === 'logs' ? 'active' : ''}`}
|
|
onClick={() => onOpenPanel('logs')}
|
|
>
|
|
Logs
|
|
</button>
|
|
<button
|
|
className={`dock-tab ${activePanel === 'inventory' ? 'active' : ''}`}
|
|
onClick={() => onOpenPanel('inventory')}
|
|
>
|
|
Inventory
|
|
</button>
|
|
<button
|
|
className={`dock-tab ${activePanel === 'missions' ? 'active' : ''}`}
|
|
onClick={() => onOpenPanel('missions')}
|
|
>
|
|
Missions
|
|
</button>
|
|
</div>
|
|
|
|
<div className="dock-metrics">
|
|
<span>{dominantAlert ? dominantAlert.label : '状态稳定'}</span>
|
|
<span>水 {supplyCounts.water}</span>
|
|
<span>食物 {supplyCounts.food}</span>
|
|
<span>药品 {supplyCounts.medicine}</span>
|
|
<span>任务 {activeQuestCount}</span>
|
|
</div>
|
|
</div>
|
|
|
|
<div className="dock-commit">
|
|
{homeRoute ? (
|
|
<button
|
|
className="primary-button dock-commit-button"
|
|
onClick={() => onSendAction({ type: 'travel', toPlaceId: homeRoute.to })}
|
|
>
|
|
返回避难点
|
|
</button>
|
|
) : (
|
|
<button className="primary-button dock-commit-button" onClick={() => onOpenPanel('inventory')}>
|
|
打开补给终端
|
|
</button>
|
|
)}
|
|
</div>
|
|
</footer>
|
|
);
|
|
}
|