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 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 | 2x 71x 71x 41x 41x 41x 41x 41x 41x 41x 41x 41x 41x 71x 71x 36x | /**
* CombatBottomHUD - Bottom bar for combat screen
*
* Contains:
* - Technique Bar (centered)
* - Volume Control (bottom-right, compact)
* - Combat Messages (above technique bar)
*
* Gaming Layout Best Practice:
* - Width: 100% of screen
* - Height: Resolution-based ~10% of screen height (40-120px range)
*
* @korean 전투화면 하단 바 - 기술 바, 음량, 전투 메시지
*/
import React from "react";
import { PlayerState } from "../../../../../systems";
import { Technique } from "../../../../../types";
import { Z_INDEX } from "../../../../../types/LayoutTypes";
import { SPACING, SPACING_ADJUSTMENTS, BORDER_RADIUS, TYPOGRAPHY, TYPOGRAPHY_NUMERIC, HIERARCHY, BORDERS, GRADIENTS, HUD_STYLE ,
OPACITY,
COMBAT_UI_DIMENSIONS,
COMBAT_UI_DIMENSIONS_NUMERIC,
TEXT_EFFECTS,
FONT_SIZE_MULTIPLIERS,
} from "../../../../../types/constants/designSystem";
import {
BREAKPOINTS,
getHUDHeight,
getResponsiveFontSize,
getResponsivePadding,
shouldShowMobileControls,
} from "../../../../../utils/responsiveLayout";
import { TechniqueBar } from "../../../../shared/three/ui/TechniqueBar";
import { VolumeControl } from "../../../../shared/ui/VolumeControl";
export interface CombatBottomHUDProps {
/** Screen width for layout calculations */
readonly width: number;
/** Screen height for layout calculations */
readonly height: number;
/** Whether mobile controls should be shown (NOT for sizing) */
readonly isMobile?: boolean;
/** Position scale multiplier for large displays */
readonly positionScale: number;
/** Whether technique bar should be visible */
readonly visible: boolean;
/** Available techniques for the technique bar */
readonly techniques: readonly Technique[];
/** Player state for technique availability checks */
readonly player: PlayerState;
/** Currently selected technique index */
readonly selectedIndex: number;
/** Active technique cooldowns */
readonly cooldowns: Map<string, number>;
/** Handler for technique selection */
readonly onTechniqueSelect: (index: number) => void;
/** Combat messages to display */
readonly combatMessages?: readonly string[];
}
/**
* CombatBottomHUD Component
*
* Compact bottom bar with centered technique bar, volume control,
* and combat messages. Uses resolution-based sizing for all elements.
*/
export const CombatBottomHUD: React.FC<CombatBottomHUDProps> = ({
width,
height,
isMobile = false,
positionScale,
visible,
techniques,
player,
selectedIndex,
cooldowns,
onTechniqueSelect,
combatMessages = [],
}) => {
// isMobile only used for mobile controls visibility
const showMobileControls = shouldShowMobileControls(width, isMobile);
const layout = React.useMemo(() => {
// Resolution-based HUD height (10% of screen height, 40-120px range)
const hudHeight = getHUDHeight(height, 0.1) * positionScale;
// Resolution-based padding
const padding = getResponsivePadding(width) * positionScale;
// Resolution-based font sizes (using design system as minimum)
const baseFontSize = getResponsiveFontSize(width);
const titleFontSize = Math.max(TYPOGRAPHY_NUMERIC.nano, baseFontSize * FONT_SIZE_MULTIPLIERS.titleSmall);
const messageFontSize = Math.max(TYPOGRAPHY_NUMERIC.caption, baseFontSize * FONT_SIZE_MULTIPLIERS.messageSmall);
// Resolution-based widths (using design system constants as reference)
const minMessageWidth = width < BREAKPOINTS.mobile
? COMBAT_UI_DIMENSIONS_NUMERIC.combatLogMinMobile
: COMBAT_UI_DIMENSIONS_NUMERIC.combatLogMinDesktop;
const maxMessageWidth = width < BREAKPOINTS.mobile
? width * COMBAT_UI_DIMENSIONS.combatLogMaxWidthPercentMobile
: COMBAT_UI_DIMENSIONS_NUMERIC.combatLogMaxDesktop;
const maxTechniqueBarWidth = width < BREAKPOINTS.mobile
? COMBAT_UI_DIMENSIONS.techniqueBarWidthMobile
: COMBAT_UI_DIMENSIONS.techniqueBarWidthDesktop;
// Resolution-based message padding (using design system spacing)
const messagePadding = width < BREAKPOINTS.mobile
? `${SPACING_ADJUSTMENTS.compact} ${SPACING.sm}`
: `${SPACING.xs} ${SPACING.md}`;
return {
hudHeight,
padding,
titleFontSize,
messageFontSize,
minMessageWidth,
maxMessageWidth,
maxTechniqueBarWidth,
messagePadding,
};
}, [width, height, positionScale]);
// Only show last 3 combat messages
const recentMessages = combatMessages.slice(-3);
return (
<div
style={{
position: "absolute",
bottom: 0,
left: 0,
width: "100%",
height: `${layout.hudHeight}px`,
display: "flex",
flexDirection: "column",
justifyContent: "flex-end",
alignItems: "center",
pointerEvents: "none",
padding: `${layout.padding}px`,
boxSizing: "border-box",
borderTop: BORDERS.default,
background: GRADIENTS.verticalReverse(0.9),
backdropFilter: HUD_STYLE.backdropFilter,
}}
data-testid="combat-bottom-hud"
>
{/* Combat Messages - styled box above technique bar */}
{recentMessages.length > 0 && (
<div
style={{
position: "absolute",
top: `${layout.padding}px`,
left: "50%",
transform: "translateX(-50%)",
display: "flex",
flexDirection: "column",
alignItems: "center",
gap: SPACING_ADJUSTMENTS.micro,
zIndex: Z_INDEX.HUD,
padding: layout.messagePadding,
background: HUD_STYLE.background,
border: BORDERS.muted,
borderRadius: BORDER_RADIUS.md,
boxShadow: HUD_STYLE.shadow,
minWidth: `${layout.minMessageWidth}px`,
maxWidth: typeof layout.maxMessageWidth === 'number'
? `${layout.maxMessageWidth}px`
: layout.maxMessageWidth,
}}
data-testid="combat-bottom-hud-messages"
>
<div
style={{
fontSize: `${layout.titleFontSize}px`,
fontFamily: TYPOGRAPHY.caption.fontFamily,
color: HIERARCHY.accent70.color,
textTransform: "uppercase",
letterSpacing: "1px",
marginBottom: SPACING_ADJUSTMENTS.tiny,
}}
>
전투 기록 | Combat Log
</div>
{recentMessages.map((message, index) => (
<div
key={index}
style={{
fontSize: `${layout.messageFontSize}px`,
fontFamily: TYPOGRAPHY.bodySmall.fontFamily,
color: HIERARCHY.primary.color,
textShadow: TEXT_EFFECTS.darkShadow,
opacity: OPACITY.base + index * OPACITY.increment,
textAlign: "center",
}}
>
{message}
</div>
))}
</div>
)}
{/* Technique Bar - centered, embedded mode for proper containment */}
{visible && (
<div
style={{
pointerEvents: "all",
display: "flex",
justifyContent: "center",
alignItems: "center",
width: "100%",
maxWidth: layout.maxTechniqueBarWidth,
}}
data-testid="combat-bottom-hud-technique-section"
>
<TechniqueBar
techniques={techniques as Technique[]}
player={player}
selectedIndex={selectedIndex}
cooldowns={cooldowns}
onTechniqueSelect={onTechniqueSelect}
onTechniqueHover={(_tech) => {}}
isMobile={showMobileControls}
screenWidth={width}
screenHeight={height}
embedded={true}
/>
</div>
)}
{/* Volume Control - bottom right corner */}
<div
style={{
position: "absolute",
right: `${layout.padding * 1.5}px`,
bottom: `${layout.padding}px`,
pointerEvents: "all",
}}
data-testid="combat-bottom-hud-volume-section"
>
<VolumeControl position="bottom-right" compact={true} />
</div>
</div>
);
};
export default CombatBottomHUD;
|