Press n or j to go to the next uncovered block, b, p or k for the previous block.
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 | 2x 68x 68x | /**
* CombatLeftHUD - Left side HUD for combat screen (Player 1)
*
* REUSES existing components:
* - PlayerHUD: Archetype image, name, health/stamina bars
* - SpeedIndicatorHUD: Movement speed percentage
* - BodyPartHealthDisplay: Individual body part health bars
* - GuardIndicator: Current stance guard status
*
* Gaming Layout Best Practice:
* - Width: Resolution-based 14-18% of screen
* - Height: 100% minus top/bottom HUD heights
* - Leaves approximately 64–72% center for arena depending on resolution (≈72% on desktop)
*
* Now uses shared HUD utilities with resolution-based sizing.
*
* @korean 전투화면 왼쪽 HUD - 플레이어 1 상태
*/
import React from "react";
import { useHUDLayout } from "../../../../../hooks/useHUDLayout";
import { PlayerState } from "../../../../../systems";
import type { StanceLaterality } from "../../../../../systems/trigram/types";
import { BaseHUDContainer } from "../../../../shared/ui/BaseHUDContainer";
import { GuardIndicator } from "../../../../shared/three/indicators/GuardIndicator";
import { PlayerHUD } from "../../../../shared/three/ui/PlayerHUD";
import { SpeedIndicatorHUD } from "../../../../shared/three/ui/SpeedIndicatorHUD";
import { BodyPartHealthDisplay } from "../../../../shared/three/ui/BodyPartHealthDisplay";
import { BreathingIndicator } from "../../../../shared/three/ui/BreathingIndicator";
export interface CombatLeftHUDProps {
/** Screen width for layout calculations */
readonly width: number;
/** Screen height for layout calculations */
readonly height: number;
/** Whether mobile layout is active */
readonly isMobile: boolean;
/** Position scale multiplier for large displays */
readonly positionScale: number;
/** Player 1 state */
readonly player: PlayerState;
/** Player laterality (left/right foot forward) */
readonly laterality: StanceLaterality;
/** Whether player is in guard stance */
readonly isInGuard: boolean;
/** Player speed modifiers */
readonly speedModifiers: {
finalSpeed: number;
baseSpeed: number;
};
}
/**
* CombatLeftHUD Component
*
* Left side of the combat screen containing Player 1's stats.
* Occupies approximately 14–18% of screen width based on resolution breakpoints/interpolation,
* positioned between the top and bottom HUDs.
* REUSES existing PlayerHUD, SpeedIndicatorHUD, BodyPartHealthDisplay components.
* Uses shared HUD utilities for consistent, resolution-based layout and styling.
*/
export const CombatLeftHUD: React.FC<CombatLeftHUDProps> = ({
width,
height,
isMobile,
positionScale,
player,
laterality,
isInGuard,
speedModifiers,
}) => {
// Use shared HUD layout hook
const layout = useHUDLayout(
width,
height,
positionScale,
'left',
'combat'
);
return (
<BaseHUDContainer
position="left"
width={layout.hudWidth}
height={layout.availableHeight}
topOffset={layout.topOffset}
padding={layout.padding}
gap={layout.gap}
style={{ overflow: "hidden" }}
dataTestId="combat-left-hud"
>
{/* Player 1 Stats - REUSING PlayerHUD component with embedded positioning */}
<div
style={{
pointerEvents: "none",
position: "relative",
}}
data-testid="combat-left-hud-player-section"
>
<PlayerHUD
player={player}
position="left"
isMobile={isMobile}
laterality={laterality}
/>
</div>
{/* Speed Indicator - REUSING SpeedIndicatorHUD component */}
<div
style={{
pointerEvents: "none",
position: "relative",
}}
data-testid="combat-left-hud-speed-section"
>
<SpeedIndicatorHUD
finalSpeed={speedModifiers.finalSpeed}
baseSpeed={speedModifiers.baseSpeed}
position="left"
isMobile={isMobile}
visible={true}
/>
</div>
{/* Body Part Health - REUSING BodyPartHealthDisplay component */}
{player.bodyPartHealth && (
<div
style={{
pointerEvents: "none",
position: "relative",
}}
data-testid="combat-left-hud-bodypart-section"
>
<BodyPartHealthDisplay
bodyPartHealth={player.bodyPartHealth}
playerId={player.id}
position="left"
isMobile={isMobile}
/>
</div>
)}
{/* Breathing Disruption Indicator - Shows breathing difficulty status */}
<div
style={{
pointerEvents: "none",
position: "relative",
}}
data-testid="combat-left-hud-breathing-section"
>
<BreathingIndicator
player={player}
isMobile={isMobile}
/>
</div>
{/* Guard Indicator - at bottom of HUD */}
<div
style={{
pointerEvents: "none",
marginTop: "auto",
position: "relative",
}}
data-testid="combat-left-hud-guard-section"
>
<GuardIndicator
currentStance={player.currentStance}
isInGuard={isInGuard}
position="left"
isMobile={isMobile}
/>
</div>
</BaseHUDContainer>
);
};
export default CombatLeftHUD;
|