diff --git a/.vercelignore b/.vercelignore new file mode 100644 index 0000000..3e9edfd --- /dev/null +++ b/.vercelignore @@ -0,0 +1,9 @@ +.git +.github +.vercel +node_modules +dist +tools +.env* +config.local.* +*.log diff --git a/index.html b/index.html index fee81cf..49c2f23 100644 --- a/index.html +++ b/index.html @@ -671,6 +671,17 @@
⚙️ สวิตช์ระบบพิเศษของ GaC
+
+
+
Freecam / FaceCam
+
เลือกโหมด แล้วกด Tab ในเกมเพื่อเปิดหรือปิดกล้อง
+ + + + + +
+
Silver Wolf Global Feature
diff --git a/js/app.js b/js/app.js index c6f2cad..21c23ec 100644 --- a/js/app.js +++ b/js/app.js @@ -7614,6 +7614,11 @@ async function loadPersistentSettings() { } if (!data) return; + const cameraMode = document.getElementById('camera-mode'); + const cameraDistance = document.getElementById('camera-distance'); + if (cameraMode) cameraMode.value = data.camera_settings?.mode || 'freecam'; + if (cameraDistance) cameraDistance.value = data.camera_settings?.distance ?? 2; + if (data.main_character && el.persistentMcSelect) { el.persistentMcSelect.value = data.main_character; } @@ -8422,6 +8427,21 @@ function setupEvents() { }); // Persistent Toggles + document.getElementById('btn-save-camera')?.addEventListener('click', async () => { + const button = document.getElementById('btn-save-camera'); + const mode = document.getElementById('camera-mode').value; + const distance = Number(document.getElementById('camera-distance').value); + if (!Number.isFinite(distance) || distance < 0.5 || distance > 5) { + showToast('ระยะ FaceCam ต้องอยู่ระหว่าง 0.5 ถึง 5', 'error'); return; + } + button.disabled = true; + try { + const saved = await apiCall('/api/camera', 'POST', { mode, distance }); + if (state.persistentData) state.persistentData.camera_settings = saved; + showToast('บันทึกกล้องแล้ว', 'success'); + } catch (err) { showToast(err.message, 'error'); } + finally { button.disabled = false; } + }); document.getElementById('btn-save-aha-help')?.addEventListener('click', async () => { const select = document.getElementById('aha-help-level'); const button = document.getElementById('btn-save-aha-help'); diff --git a/scripts/build-vercel.cjs b/scripts/build-vercel.cjs new file mode 100644 index 0000000..382e3e7 --- /dev/null +++ b/scripts/build-vercel.cjs @@ -0,0 +1,13 @@ +// Only the static web application is published; repository tools and local +// configuration are not copied to the public deployment. +const fs = require('node:fs'); +const path = require('node:path'); +const root = path.resolve(__dirname, '..'); +const output = path.join(root, 'dist'); +fs.mkdirSync(output, { recursive: true }); +for (const name of ['index.html', 'version.json', 'assets', 'css', 'js']) { + const source = path.join(root, name); + if (!fs.existsSync(source)) throw new Error(`Missing static application input: ${name}`); + fs.cpSync(source, path.join(output, name), { recursive: true, force: true }); +} +console.log('Static application prepared for Vercel.'); diff --git a/vercel.json b/vercel.json new file mode 100644 index 0000000..828259f --- /dev/null +++ b/vercel.json @@ -0,0 +1,4 @@ +{ + "buildCommand": "node scripts/build-vercel.cjs", + "outputDirectory": "dist" +}