diff --git a/src/components/DownloadSection.css b/src/components/DownloadSection.css index a45265d..f71dbdb 100644 --- a/src/components/DownloadSection.css +++ b/src/components/DownloadSection.css @@ -19,45 +19,29 @@ margin: 0 0 28px; } -.btn-download { +.btn-play { display: inline-block; - padding: 16px 48px; + padding: 18px 64px; background: #BACDB0; color: #2E2C2F; border: none; border-radius: 8px; - font-size: 1.1rem; + font-size: 1.2rem; font-weight: 700; - text-decoration: none; cursor: pointer; transition: opacity 0.2s, transform 0.15s; letter-spacing: 0.05em; } -.btn-download:hover { +.btn-play:hover { opacity: 0.9; transform: translateY(-1px); } -.btn-launch { - display: inline-block; - padding: 16px 48px; - background: transparent; - color: #BACDB0; - border: 2px solid #BACDB0; - border-radius: 8px; - font-size: 1.1rem; - font-weight: 700; - cursor: pointer; - transition: background 0.2s, color 0.2s, transform 0.15s; - letter-spacing: 0.05em; - margin-left: 16px; -} - -.btn-launch:hover { - background: #BACDB0; - color: #2E2C2F; - transform: translateY(-1px); +.btn-play:disabled { + opacity: 0.6; + cursor: not-allowed; + transform: none; } .launch-hint { diff --git a/src/components/DownloadSection.jsx b/src/components/DownloadSection.jsx index f287d38..0fbe6fe 100644 --- a/src/components/DownloadSection.jsx +++ b/src/components/DownloadSection.jsx @@ -7,6 +7,7 @@ import './DownloadSection.css'; export default function DownloadSection() { const [info, setInfo] = useState(null); const [ready, setReady] = useState(false); + const [launching, setLaunching] = useState(false); const { user } = useAuth(); const navigate = useNavigate(); @@ -16,19 +17,30 @@ export default function DownloadSection() { .catch(() => setReady(true)); }, []); - const handleDownload = (e) => { - if (!user) { - e.preventDefault(); - navigate('/login'); - } - }; - - const handleLaunch = () => { + const handlePlay = () => { if (!user) { navigate('/login'); return; } + + setLaunching(true); + + let launched = false; + const onBlur = () => { launched = true; }; + window.addEventListener('blur', onBlur); window.location.href = 'a301://launch?token=' + user.token; + + setTimeout(() => { + window.removeEventListener('blur', onBlur); + setLaunching(false); + if (!launched && info?.url) { + // 런처 미설치 → 자동 다운로드 + const a = document.createElement('a'); + a.href = info.url; + a.download = ''; + a.click(); + } + }, 2000); }; if (!ready) return null; @@ -36,20 +48,17 @@ export default function DownloadSection() { return (
-

게임 런처 다운로드

+

A301

{info ? ( <>

- {info.fileName} · {info.fileSize} · {info.version} + {info.version} · {info.fileSize}

- - {user ? '다운로드' : '로그인 후 다운로드'} - -

- 게임 시작이 안 되나요? 먼저 다운로드 후 launcher.exe install을 실행해주세요. + 처음 설치하는 경우 자동으로 다운로드됩니다

) : (