diff options
Diffstat (limited to 'ui')
| -rw-r--r-- | ui/index.html | 19 | ||||
| -rw-r--r-- | ui/main.js | 15 | ||||
| -rw-r--r-- | ui/style.css | 57 |
3 files changed, 91 insertions, 0 deletions
diff --git a/ui/index.html b/ui/index.html new file mode 100644 index 0000000..1acd3ab --- /dev/null +++ b/ui/index.html @@ -0,0 +1,19 @@ +<!DOCTYPE html> +<html lang="en"> +<head> + <meta charset="UTF-8"> + <meta name="viewport" content="width=device-width, initial-scale=1.0"> + <title>Minecraft 启动器</title> + <link rel="stylesheet" href="style.css"> + <script src="main.js" defer></script> +</head> +<body> + <main class="container"> + <h1>Minecraft DropOut Launcher</h1> + <div class="status-container"> + <p id="status-text">准备就绪</p> + </div> + <button id="start-game-btn">开始游戏</button> + </main> +</body> +</html>
\ No newline at end of file diff --git a/ui/main.js b/ui/main.js new file mode 100644 index 0000000..33099cd --- /dev/null +++ b/ui/main.js @@ -0,0 +1,15 @@ +const { invoke } = window.__TAURI__.core; + +const startBtn = document.getElementById("start-game-btn"); +const statusText = document.getElementById("status-text"); + +startBtn.addEventListener("click", async () => { + statusText.textContent = "正在获取 Manifest..."; + try { + const response = await invoke("start_game"); + statusText.textContent = response; + } catch (error) { + statusText.textContent = "错误: " + error; + console.error(error); + } +}); diff --git a/ui/style.css b/ui/style.css new file mode 100644 index 0000000..8820ebc --- /dev/null +++ b/ui/style.css @@ -0,0 +1,57 @@ +body { + font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif; + background-color: #2c2f33; + color: #ffffff; + display: flex; + justify-content: center; + align-items: center; + height: 100vh; + margin: 0; + user-select: none; +} + +.container { + text-align: center; + background-color: #23272a; + padding: 2rem; + border-radius: 10px; + box-shadow: 0 4px 15px rgba(0, 0, 0, 0.5); + width: 300px; +} + +h1 { + font-size: 1.2rem; + margin-bottom: 2rem; + color: #7289da; +} + +.status-container { + margin-bottom: 1.5rem; + min-height: 1.5rem; +} + +#status-text { + font-size: 0.9rem; + color: #99aab5; + margin: 0; +} + +button { + background-color: #43b581; + color: white; + border: none; + padding: 10px 20px; + border-radius: 5px; + font-size: 1rem; + cursor: pointer; + transition: background-color 0.2s; + width: 100%; +} + +button:hover { + background-color: #3ca374; +} + +button:active { + background-color: #358f66; +} |