import type { GameAction, GameView } from '@tinywaste/game-core'; import { useState } from 'react'; import { edgeDestination, getCurrentPlace, getExpeditionStatus, getPlaceAtmosphere, getRiskDots, getRouteRiskTier, getVisibleRoutes, } from '../hudModel'; import { getPlaceThumbStyle } from '../uiAssets'; import { HudIcon } from './HudIcon'; export function RoutePanel({ isWorking, onSendAction, view, }: { isWorking: boolean; onSendAction: (action: GameAction) => void; view: GameView; }) { const [safeOnly, setSafeOnly] = useState(false); const currentPlace = getCurrentPlace(view); const placeId = currentPlace?.id ?? view.place.id; const expedition = getExpeditionStatus(view); const atmosphere = getPlaceAtmosphere(placeId); const allRoutes = getVisibleRoutes(view, 10); const routes = safeOnly ? allRoutes.filter((edge) => !edge.blockedReason && getRouteRiskTier(edge.risk).tone === 'safe') : allRoutes.slice(0, 3); const launchRoute = routes[0] ?? null; return (

探索

{currentPlace?.name ?? view.header.placeName}

{view.header.riskLabel}

当前位置

{view.header.placeName}
{atmosphere.weather}
{atmosphere.temperature} {atmosphere.wind}
风险等级 {view.header.riskLabel}
路线
{routes.map((edge, index) => { const destination = edgeDestination(view, edge); if (!destination) return null; const riskTier = getRouteRiskTier(edge.risk); const riskDots = getRiskDots(edge.risk); return ( ); })}
探索状态
装备 {expedition.readiness}%
状态 {Math.round((view.player.stats.life / view.player.maxStats.life) * 100)}%
负重 {view.player.inventoryUsage}/{view.player.inventoryCapacity}
); }