- 단일 "게임 시작" 버튼으로 통합 - 런처 설치 시 게임 실행, 미설치 시 자동 다운로드 (blur 감지) Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -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 {
|
||||
|
||||
@@ -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 (
|
||||
<section className="download-section">
|
||||
<div className="download-content">
|
||||
<h2 className="download-title">게임 런처 다운로드</h2>
|
||||
<h2 className="download-title">A301</h2>
|
||||
{info ? (
|
||||
<>
|
||||
<p className="download-meta">
|
||||
{info.fileName} · {info.fileSize} · {info.version}
|
||||
{info.version} · {info.fileSize}
|
||||
</p>
|
||||
<a href={info.url} download onClick={handleDownload} className="btn-download">
|
||||
{user ? '다운로드' : '로그인 후 다운로드'}
|
||||
</a>
|
||||
<button onClick={handleLaunch} className="btn-launch">
|
||||
게임 시작
|
||||
<button onClick={handlePlay} className="btn-play" disabled={launching}>
|
||||
{launching ? '실행 중...' : '게임 시작'}
|
||||
</button>
|
||||
<p className="launch-hint">
|
||||
게임 시작이 안 되나요? 먼저 다운로드 후 launcher.exe install을 실행해주세요.
|
||||
처음 설치하는 경우 자동으로 다운로드됩니다
|
||||
</p>
|
||||
</>
|
||||
) : (
|
||||
|
||||
Reference in New Issue
Block a user