Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions src/components/game/GameCanvas.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -306,9 +306,9 @@ function GameCanvas({
<div class="flex items-center gap-2">
<div class="text-xl">☠️</div>
<div>
<div class="text-lg font-bold text-red-400">${username} 전사!</div>
<div class="text-md font-bold text-red-400">${username} 전사!</div>
<div class="text-xs text-white opacity-80">상대의 색이 사라졌습니다!</div>
<div class="text-xs opacity-70">지금이 기회! 빈 공간을 차지하세요!</div>
<div class="text-xs opacity-70">빈 공간을 공략하세요!</div>
</div>
</div>
`;
Expand Down Expand Up @@ -1197,6 +1197,7 @@ function GameCanvas({
lives={lives}
maxLives={2}
isLifeDecreasing={isLifeDecreasing}
userColor={userColor}
/>
</div>
)}
Expand All @@ -1208,6 +1209,7 @@ function GameCanvas({
lives={lives}
maxLives={2}
isLifeDecreasing={isLifeDecreasing}
userColor={userColor}
/>
</div>
)}
Expand Down
98 changes: 59 additions & 39 deletions src/components/game/LifeIndicator.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,15 @@ interface LifeIndicatorProps {
lives: number;
maxLives: number;
isLifeDecreasing: boolean;
userColor?: string; // 사용자 색상 추가
}

const LifeIndicator: React.FC<LifeIndicatorProps> = ({ lives, maxLives, isLifeDecreasing }) => {
const LifeIndicator: React.FC<LifeIndicatorProps> = ({
lives,
maxLives,
isLifeDecreasing,
userColor,
}) => {
const heartRefs = useRef<Array<HTMLDivElement | null>>([]);

useEffect(() => {
Expand All @@ -19,7 +25,7 @@ const LifeIndicator: React.FC<LifeIndicatorProps> = ({ lives, maxLives, isLifeDe
[
{ transform: 'scale(1)', opacity: 1 },
{ transform: 'scale(1.5)', opacity: 0.8 },
{ transform: 'scale(0.5) rotate(10deg)', opacity: 0 }
{ transform: 'scale(0.5) rotate(10deg)', opacity: 0 },
],
{ duration: 800, easing: 'ease-out', fill: 'forwards' }
);
Expand All @@ -28,44 +34,58 @@ const LifeIndicator: React.FC<LifeIndicatorProps> = ({ lives, maxLives, isLifeDe
}, [lives, isLifeDecreasing]);

return (
<div className="flex items-center gap-1 rounded-lg bg-gray-900/80 px-3 py-2 backdrop-blur-sm">
{[...Array(maxLives)].map((_, i) => (
<div
key={i}
className="h-6 w-6 transition-all duration-300"
ref={(el) => {
if (heartRefs.current) heartRefs.current[i] = el;
}}
>
{i < lives ? (
<svg
xmlns="http://www.w3.org/2000/svg"
viewBox="0 0 24 24"
fill="#ef4444"
className="h-6 w-6"
>
<path d="m11.645 20.91-.007-.003-.022-.012a15.247 15.247 0 0 1-.383-.218 25.18 25.18 0 0 1-4.244-3.17C4.688 15.36 2.25 12.174 2.25 8.25 2.25 5.322 4.714 3 7.688 3A5.5 5.5 0 0 1 12 5.052 5.5 5.5 0 0 1 16.313 3c2.973 0 5.437 2.322 5.437 5.25 0 3.925-2.438 7.111-4.739 9.256a25.175 25.175 0 0 1-4.244 3.17 15.247 15.247 0 0 1-.383.219l-.022.012-.007.004-.003.001a.752.752 0 0 1-.704 0l-.003-.001Z" />
</svg>
) : (
<svg
xmlns="http://www.w3.org/2000/svg"
fill="none"
viewBox="0 0 24 24"
strokeWidth={1.5}
stroke="#ef4444"
className="h-6 w-6"
>
<path
strokeLinecap="round"
strokeLinejoin="round"
d="M21 8.25c0-2.485-2.099-4.5-4.688-4.5-1.935 0-3.597 1.126-4.312 2.733-.715-1.607-2.377-2.733-4.313-2.733C5.1 3.75 3 5.765 3 8.25c0 7.22 9 12 9 12s9-4.78 9-12Z"
/>
</svg>
)}
</div>
))}
<div className='flex items-center gap-2 rounded-lg bg-gray-900/80 px-3 py-2 backdrop-blur-sm'>
{/* 사용자 색상 표시 */}
<div className='flex items-center gap-1'>
<span className='text-xs font-medium text-white'>Color: </span>
<div
className='h-5 w-5 rounded-full border-2 border-white/50 shadow-lg'
style={{ backgroundColor: userColor || '#FF5733' }}
/>
</div>

{/* 목숨 표시 */}
<div className='flex items-center gap-1'>
<span className='text-xs font-medium text-white'>Life: </span>

{[...Array(maxLives)].map((_, i) => (
<div
key={i}
className='h-6 w-6 transition-all duration-300'
ref={(el) => {
if (heartRefs.current) heartRefs.current[i] = el;
}}
>
{i < lives ? (
<svg
xmlns='http://www.w3.org/2000/svg'
viewBox='0 0 24 24'
fill='#ef4444'
className='h-6 w-6'
>
<path d='m11.645 20.91-.007-.003-.022-.012a15.247 15.247 0 0 1-.383-.218 25.18 25.18 0 0 1-4.244-3.17C4.688 15.36 2.25 12.174 2.25 8.25 2.25 5.322 4.714 3 7.688 3A5.5 5.5 0 0 1 12 5.052 5.5 5.5 0 0 1 16.313 3c2.973 0 5.437 2.322 5.437 5.25 0 3.925-2.438 7.111-4.739 9.256a25.175 25.175 0 0 1-4.244 3.17 15.247 15.247 0 0 1-.383.219l-.022.012-.007.004-.003.001a.752.752 0 0 1-.704 0l-.003-.001Z' />
</svg>
) : (
<svg
xmlns='http://www.w3.org/2000/svg'
fill='none'
viewBox='0 0 24 24'
strokeWidth={1.5}
stroke='#ef4444'
className='h-6 w-6'
>
<path
strokeLinecap='round'
strokeLinejoin='round'
d='M21 8.25c0-2.485-2.099-4.5-4.688-4.5-1.935 0-3.597 1.126-4.312 2.733-.715-1.607-2.377-2.733-4.313-2.733C5.1 3.75 3 5.765 3 8.25c0 7.22 9 12 9 12s9-4.78 9-12Z'
/>
</svg>
)}
</div>
))}
</div>
</div>
);
};

export default LifeIndicator;
export default LifeIndicator;
42 changes: 23 additions & 19 deletions src/components/modal/DeathModal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -24,29 +24,33 @@ const DeathModal: React.FC<DeathModalProps> = ({ isOpen }) => {

return (
<div
className={`fixed inset-0 z-[9999] flex items-center justify-center ${isTransparent ? 'bg-black/70' : 'bg-black/40'} transition-all duration-700`}
className={`fixed inset-0 z-[9999] flex items-center justify-center ${isTransparent ? 'bg-black/20' : 'bg-black/40'} transition-all duration-700`}
>
<div
className={`w-full max-w-md rounded-xl ${isTransparent ? 'border-red-500/30 bg-gradient-to-b from-red-900/30 to-black/30' : 'border-red-500 bg-gradient-to-b from-red-900/90 to-black/90'} border-2 p-8 text-center shadow-2xl transition-all duration-700`}
className={`w-full max-w-md rounded-xl ${isTransparent ? 'border-red-500/30 bg-gradient-to-b from-red-900/20 to-black/20' : 'border-red-500 bg-gradient-to-b from-red-900/90 to-black/90'} border-2 p-8 text-center shadow-2xl transition-all duration-700`}
>
<div className='mb-4 text-8xl'>☠️</div>
<h2
className={`mb-6 text-4xl font-bold ${isTransparent ? 'text-red-400/30' : 'animate-pulse text-red-400'} transition-all duration-700`}
<div
className={`mb-4 text-2xl font-bold transition-all duration-700 ${isTransparent ? 'text-white opacity-40' : 'opacity-100'}`}
>
당신은 탈락했습니다!
</h2>
<p
className={`mb-8 text-xl ${isTransparent ? 'text-white/30' : 'text-white'} transition-all duration-700`}
>
모든 생명을 잃었습니다.
</p>
<p
className={`mb-2 text-lg ${isTransparent ? 'text-gray-300/30' : 'text-gray-300'} transition-all duration-700`}
>
{isTransparent
? '관전 모드로 전환되었습니다.'
: '전장이 마무리될 때까지 잠시만 기다려주세요.'}
</p>
{isTransparent ? (
'관전모드로 변경되었습니다'
) : (
<span className='mb-4 text-8xl'>☠️</span>
)}
</div>
{!isTransparent && (
<>
<h2 className='mb-6 animate-pulse text-4xl font-bold text-red-400 transition-all duration-700'>
당신은 탈락했습니다!
</h2>
<p className='mb-8 text-xl text-white transition-all duration-700'>
모든 생명을 잃었습니다.
</p>
<p className='mb-2 text-lg text-gray-300 transition-all duration-700'>
전장이 마무리될 때까지 잠시만 기다려주세요.
</p>
</>
)}
</div>
</div>
);
Expand Down