feat: 实现避难所仓储系统与生存状态HUD改进

- 新增避难所仓储功能,支持物品在随身背包与仓储间转移
- 添加生存状态图标资源与状态阈值告警系统
- 重构HUD界面,优化状态显示与操作流程
- 扩展游戏核心系统,增加仓储相关动作和校验
- 更新文档说明仓储规则与实现细节
This commit is contained in:
2026-04-28 22:58:49 +08:00
parent e783e6e533
commit 6234a50bdb
27 changed files with 1455 additions and 1024 deletions
@@ -1,22 +1,27 @@
import type { OverlayPanel } from '../types';
import type { GameView } from '@tinywaste/game-core';
import { getActiveQuestCount, getSupplyCounts } from '../hudModel';
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">
<div className="operator-card">
<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>
@@ -26,7 +31,7 @@ export function BottomDock({
<div className="dock-nav-groups">
<div className="dock-tabs">
<button className="dock-tab active">Shelter</button>
<button className="dock-tab active">{currentPlace?.name ?? 'Expedition'}</button>
<button
className={`dock-tab ${activePanel === 'blueprints' ? 'active' : ''}`}
onClick={() => onOpenPanel('blueprints')}
@@ -54,13 +59,28 @@ export function BottomDock({
</div>
<div className="dock-metrics">
<span>{dominantAlert ? dominantAlert.label : '状态稳定'}</span>
<span> {supplyCounts.water}</span>
<span> {supplyCounts.food}</span>
<span> {supplyCounts.medicine}</span>
<span> {supplyCounts.material}</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>
);
}