synchro du labo (0bf0da65) : app.blade.php, README.md
This commit is contained in:
22
README.md
22
README.md
@@ -1,3 +1,21 @@
|
||||
# ploxion-jeu
|
||||
# ◆ Le Jeu
|
||||
|
||||
PLOXION · L'écran-titre du jeu XERB0XION : reconstruis le xerboxion des 9 lettres jusqu'au tout. Barre de complétion (mots découverts / wiki), le chemin des paliers, boutons Découvrir (forge) / Le temps (machine) / Codex (wiki). · fournit: game, jeu, steam, xerboxion, progression
|
||||
L'écran-titre du jeu XERB0XION : reconstruis le xerboxion des 9 lettres jusqu'au tout. Barre de complétion (mots découverts / wiki), le chemin des paliers, boutons Découvrir (forge) / Le temps (machine) / Codex (wiki).
|
||||
|
||||
| | |
|
||||
| --- | --- |
|
||||
| id | `jeu` |
|
||||
| fournit | `game` `jeu` `steam` `xerboxion` `progression` |
|
||||
| bions qu'il nomme | `jOSApps` `jOSBoxion` `jOSMobile` `jOSOp` `jOSPorts` |
|
||||
| fichiers | `app.blade.php` |
|
||||
| dans le labo | `resources/views/ploxions/jeu/` (dépôt `my_website2`) |
|
||||
|
||||
## Contribuer
|
||||
|
||||
- **Dans le xer** : https://labo.j0bot.ch/px/atelier?ploxion=jeu — prends-le, modifie-le, vois-le tourner, « ⧗ envoyer le tsoin ».
|
||||
- **Dans VS Code** : `xb prendre jeu` (ou l'extension xerboxion › ⇩ Prendre), puis ⧗ Envoyer.
|
||||
- Le chemin complet : https://labo.j0bot.ch/px/contribuer
|
||||
|
||||
Ce dépôt est un **miroir** du labo (synchronisé par `bin/ploxions-forge.mjs`, depuis le commit `0bf0da65`) : une modif se propose par un tsoin ou une branche du labo, pas directement ici.
|
||||
|
||||
© 2026 chill-tekk · ne pas nuire
|
||||
|
||||
211
app.blade.php
Normal file
211
app.blade.php
Normal file
@@ -0,0 +1,211 @@
|
||||
{{-- PL0XI0N jeu — L'ÉCRAN-TITRE / HUB du JEU (RS-7 : « on fait un jeu Steam dont le but est de FINIR
|
||||
le xerboxion »). Titre + PITCH + barre de COMPLÉTION (mots découverts / wiki) + le chemin des
|
||||
paliers (ON→ION→BION→CUBION→PLOXION→BOXION→XERBOXION, allumés au fur et à mesure) + boutons de jeu
|
||||
(Découvrir=forge · Le temps=machine à tsoins · Codex=wiki). Lit /wiki/bions.json + forge:disc.
|
||||
Se met à jour en live (bus tsoin.record). window.jOSApps['jeu']. --}}
|
||||
<style>
|
||||
/* (19.10, RS-7 : « plus dans l'ambiance du reste du jeu, une allure plus chill tekk, pas d'emojis, toujours les glyphes ») — les jetons du Clickion :
|
||||
sombre, usé, sans dégradé ; les boutons de jeu EN BAS, sous le pouce */
|
||||
.jeu{ --a:#a597cf; --b:#79d9a2; --t:#ddd6ea; --m:#7f7699; --bd:#272036; --bd2:#3a3050; --s:#0f0b18; position:relative; height:100%; min-height:0; overflow-y:auto; background:#07050c; color:var(--t); font-family:-apple-system,system-ui,sans-serif; display:flex; flex-direction:column; padding:0 12px; }
|
||||
.jeu *{ box-sizing:border-box; -webkit-tap-highlight-color:transparent; }
|
||||
.jeu__hero{ text-align:center; padding:22px 4px 6px; }
|
||||
.jeu__cube{ width:74px; height:74px; margin:0 auto 8px; } .jeu__cube canvas{ width:74px; height:74px; }
|
||||
.jeu__title{ font:800 clamp(26px,8vw,36px)/1 ui-monospace,Menlo,monospace; letter-spacing:.18em; margin:0; color:var(--t); }
|
||||
.jeu__tag{ color:var(--m); font:600 12px ui-monospace,Menlo,monospace; margin-top:7px; }
|
||||
.jeu__win{ color:var(--b); font:700 12px ui-monospace,Menlo,monospace; margin-top:8px; letter-spacing:.06em; }
|
||||
.jeu__card{ margin:10px 0 0; padding:12px 13px; border:2px solid var(--bd); border-radius:16px; background:var(--s); }
|
||||
.jeu__ph{ font:700 10px ui-monospace,Menlo,monospace; text-transform:uppercase; letter-spacing:.14em; color:var(--m); margin-bottom:9px; }
|
||||
.jeu__barwrap{ height:12px; border-radius:7px; background:#07050c; border:1.5px solid var(--bd2); overflow:hidden; }
|
||||
.jeu__bar{ height:100%; width:0; background:var(--b); transition:width .6s ease; }
|
||||
.jeu__pct{ display:flex; justify-content:space-between; font:600 11.5px ui-monospace,Menlo,monospace; color:var(--m); margin-top:7px; } .jeu__pct span:first-child{ color:var(--b); }
|
||||
.jeu__path{ display:flex; align-items:center; gap:4px; overflow-x:auto; padding-bottom:2px; scrollbar-width:none; } .jeu__path::-webkit-scrollbar{ display:none; }
|
||||
.jeu__mile{ flex:0 0 auto; display:flex; flex-direction:column; align-items:center; gap:4px; opacity:.35; } .jeu__mile.on{ opacity:1; }
|
||||
.jeu__mile .d{ width:40px; height:40px; border-radius:12px; border:2px solid var(--bd2); background:#07050c; display:flex; align-items:center; justify-content:center; }
|
||||
.jeu__mile.on .d{ border-color:var(--b); } .jeu__mile .d img{ width:30px; height:30px; } .jeu__mile small{ font:600 9px ui-monospace,Menlo,monospace; color:var(--m); }
|
||||
.jeu__arrow{ color:var(--bd2); flex:0 0 auto; font:700 11px ui-monospace,Menlo,monospace; }
|
||||
.jeu__ach{ display:flex; gap:7px; flex-wrap:wrap; }
|
||||
.jeu__a{ display:flex; flex-direction:column; align-items:center; gap:4px; width:70px; padding:9px 4px; border-radius:12px; border:2px solid var(--bd); background:#07050c; opacity:.35; text-align:center; }
|
||||
.jeu__a.on{ opacity:1; border-color:var(--b); } .jeu__a .ai{ font:700 18px ui-monospace,Menlo,monospace; color:var(--b); line-height:1.1; } .jeu__a small{ font:600 9px ui-monospace,Menlo,monospace; color:var(--m); line-height:1.15; }
|
||||
.jeu__share{ display:flex; gap:7px; flex-wrap:wrap; }
|
||||
.jeu__sb{ min-height:42px; font:700 11px ui-monospace,Menlo,monospace; padding:8px 12px; border-radius:12px; border:2px solid var(--bd2); background:#07050c; color:var(--t); cursor:pointer; }
|
||||
.jeu__sb:active{ transform:scale(.96); } .jeu__sb.ghost{ color:var(--m); border-color:var(--bd); }
|
||||
.jeu__shmsg{ font:600 11px ui-monospace,Menlo,monospace; color:var(--b); min-height:16px; margin-top:8px; word-break:break-all; }
|
||||
.jeu__recent{ margin:10px 2px 4px; font:600 11px ui-monospace,Menlo,monospace; color:var(--m); } .jeu__recent b{ color:var(--b); }
|
||||
.jeu__vide{ flex:1; }
|
||||
/* la télécommande : les gestes du jeu, en bas */
|
||||
.jeu__play{ position:sticky; bottom:calc(env(safe-area-inset-bottom,0px) + 8px); margin:14px 0 8px; display:flex; gap:5px; padding:6px; border-radius:20px; border:2px solid var(--bd2); background:#0a0712; z-index:5; }
|
||||
.jeu__pb{ flex:1; min-height:56px; border:0; border-radius:14px; background:none; color:var(--m); font:700 8.5px ui-monospace,Menlo,monospace; letter-spacing:.05em; text-transform:uppercase; display:flex; flex-direction:column; align-items:center; justify-content:center; gap:3px; cursor:pointer; }
|
||||
.jeu__pb .ic{ font:400 19px/1 ui-monospace,Menlo,monospace; color:var(--t); } .jeu__pb:active{ transform:scale(.95); }
|
||||
.jeu__pb.hero{ background:#151021; color:var(--t); box-shadow:inset 0 0 0 1.5px var(--b); } .jeu__pb.hero .ic{ color:var(--b); }
|
||||
.jeu__pb[disabled]{ opacity:.35; } .jeu__pb[disabled] .ic{ color:var(--m); }
|
||||
.jeu__intro{ position:absolute; inset:0; z-index:30; background:rgba(7,5,12,.97); display:flex; align-items:center; justify-content:center; padding:22px; } .jeu__intro[hidden]{ display:none; }
|
||||
.jeu__introcard{ max-width:420px; text-align:center; border:2px solid var(--bd2); border-radius:20px; padding:24px 20px; background:var(--s); }
|
||||
.jeu__introatoms{ font:700 14px ui-monospace,Menlo,monospace; letter-spacing:.22em; color:var(--a); margin-bottom:14px; }
|
||||
.jeu__introh{ font:800 20px ui-monospace,Menlo,monospace; margin:0 0 10px; color:var(--t); }
|
||||
.jeu__introp{ color:var(--m); font-size:.9rem; margin:0 0 16px; line-height:1.5; }
|
||||
.jeu__introstep{ font:600 13px ui-monospace,Menlo,monospace; padding:11px; border:2px dashed var(--bd2); border-radius:12px; margin-bottom:18px; } .jeu__introstep b{ color:var(--b); }
|
||||
.jeu__introcta{ display:flex; flex-direction:column; gap:9px; }
|
||||
.jeu__introgo{ min-height:52px; background:var(--b); color:#07050c; font:800 13px ui-monospace,Menlo,monospace; border:0; border-radius:14px; cursor:pointer; } .jeu__introgo:active{ transform:scale(.97); }
|
||||
.jeu__introskip{ min-height:40px; background:none; border:0; color:var(--m); font:600 12px ui-monospace,Menlo,monospace; cursor:pointer; }
|
||||
.jeu__cxov{ position:absolute; inset:0; z-index:20; background:#07050c; display:flex; flex-direction:column; } .jeu__cxov[hidden]{ display:none; }
|
||||
.jeu__cxbar{ flex:0 0 auto; display:flex; align-items:center; gap:10px; padding:12px 14px; border-bottom:2px solid var(--bd); }
|
||||
.jeu__cxbar b{ font:800 15px ui-monospace,Menlo,monospace; } .jeu__cxcount{ font:600 11px ui-monospace,Menlo,monospace; color:var(--b); }
|
||||
.jeu__cxsearch{ flex:1; min-width:60px; min-height:40px; background:var(--s); border:2px solid var(--bd2); border-radius:12px; color:var(--t); padding:8px 11px; font:inherit; outline:none; }
|
||||
.jeu__cxwiki{ color:var(--a); font:600 11px ui-monospace,Menlo,monospace; white-space:nowrap; } .jeu__cxclose{ min-width:40px; min-height:40px; background:none; border:0; color:var(--m); font-size:1.1rem; cursor:pointer; }
|
||||
.jeu__cxgrid{ flex:1; min-height:0; overflow-y:auto; padding:12px; display:grid; grid-template-columns:repeat(auto-fill,minmax(108px,1fr)); gap:8px; align-content:start; }
|
||||
.jeu__cx{ border:2px solid var(--bd); border-radius:14px; padding:10px 8px; text-align:center; background:var(--s); } .jeu__cx.got{ border-color:#2c5a42; } .jeu__cx.lock{ opacity:.4; }
|
||||
.jeu__cx .cxic{ height:42px; display:flex; align-items:center; justify-content:center; margin-bottom:6px; } .jeu__cx .cxic img{ width:40px; height:40px; }
|
||||
.jeu__cx .cxic .mono{ font:800 13px ui-monospace,Menlo,monospace; color:var(--t); } .jeu__cx.lock .cxic{ font-size:1.3rem; color:var(--m); }
|
||||
.jeu__cx .cxn{ font-weight:700; font-size:.8rem; word-break:break-word; } .jeu__cx .cxd{ font-size:.6rem; color:var(--m); margin-top:3px; line-height:1.25; }
|
||||
</style>
|
||||
<script>
|
||||
(function () {
|
||||
"use strict";
|
||||
function describe() {
|
||||
var d = {}; try { d = JSON.parse(localStorage.getItem('forge:disc')) || {}; } catch (e) {}
|
||||
var n = Object.keys(d).length;
|
||||
return { v: 1, id: 'jeu', title: 'Le Jeu', icon: '◆', items: [
|
||||
{ p: 1, kind: 'stat', label: 'mots découverts', value: n }
|
||||
] };
|
||||
}
|
||||
function clickionOuvert() { try { var st = JSON.parse(localStorage.getItem('xb:xpclick') || 'null'); return !!(st && ((st.stats && st.stats.meilleur >= 40) || (st.saisons || []).some(function (x) { return x.L >= 40; }))); } catch (e) { return false; } }
|
||||
function mount(container, ctx) {
|
||||
container.innerHTML =
|
||||
'<div class="jeu">'
|
||||
+ ' <div class="jeu__hero"><div class="jeu__cube"><canvas data-cube></canvas></div>'
|
||||
+ ' <h1 class="jeu__title">XERB0XION</h1><div class="jeu__tag">reconstruis le xerboxion — des 9 lettres jusqu\'au tout</div>'
|
||||
+ ' <div class="jeu__win" data-win hidden>✺ xerboxion reconstruit</div></div>'
|
||||
+ ' <div class="jeu__card"><div class="jeu__ph">complétion</div><div class="jeu__barwrap"><div class="jeu__bar" data-bar></div></div>'
|
||||
+ ' <div class="jeu__pct"><span data-pct>0 %</span><span data-frac>0 / 0 mots</span></div></div>'
|
||||
+ ' <div class="jeu__card"><div class="jeu__ph">le chemin</div><div class="jeu__path" data-path></div></div>'
|
||||
+ ' <div class="jeu__card"><div class="jeu__ph">succès</div><div class="jeu__ach" data-ach></div></div>'
|
||||
+ ' <div class="jeu__card"><div class="jeu__ph">ta partie <span style="color:var(--bd2);text-transform:none;letter-spacing:0">· un repo</span></div>'
|
||||
+ ' <div class="jeu__share"><button class="jeu__sb" data-export>⤓ exporter</button><button class="jeu__sb" data-share>⇪ partager le lien</button><button class="jeu__sb ghost" data-reset>↺ recommencer</button></div>'
|
||||
+ ' <div class="jeu__shmsg" data-shmsg></div></div>'
|
||||
+ ' <div class="jeu__recent" data-recent></div><div class="jeu__vide"></div>'
|
||||
// la télécommande (au pouce) ; (19.10) le clicker de base, et Clickion dès qu'il est débloqué — la même partie
|
||||
+ ' <nav class="jeu__play">'
|
||||
+ ' <button class="jeu__pb hero" data-open="forge"><span class="ic">✦</span>découvrir</button>'
|
||||
+ ' <button class="jeu__pb" data-open="tsoinmachine"><span class="ic">⧗</span>le temps</button>'
|
||||
+ ' <button class="jeu__pb" data-open="wiki"><span class="ic">⬡</span>codex</button>'
|
||||
+ ' <button class="jeu__pb" data-open="xp:idle"><span class="ic">◆</span>clicker</button>'
|
||||
+ (clickionOuvert() ? ' <button class="jeu__pb hero" data-open="clickion"><span class="ic">◈</span>clickion</button>' : ' <button class="jeu__pb" disabled title="à 10^40"><span class="ic">⊘</span>10^40</button>')
|
||||
+ ' </nav>'
|
||||
+ ' <div class="jeu__cxov" data-cxov hidden>'
|
||||
+ ' <div class="jeu__cxbar"><b>Codex</b> <span class="jeu__cxcount" data-cxcount></span>'
|
||||
+ ' <input class="jeu__cxsearch" data-cxsearch placeholder="chercher un mot découvert…">'
|
||||
+ ' <a class="jeu__cxwiki" href="/wiki" target="_blank" rel="noopener">wiki ↗</a>'
|
||||
+ ' <button class="jeu__cxclose" data-cxclose aria-label="fermer">✕</button></div>'
|
||||
+ ' <div class="jeu__cxgrid" data-cxgrid></div></div>'
|
||||
+ ' <div class="jeu__intro" data-intro hidden><div class="jeu__introcard">'
|
||||
+ ' <div class="jeu__introatoms">O·I·N·B·T·S·X·E·R</div>'
|
||||
+ ' <h2 class="jeu__introh">Reconstruis le xerboxion</h2>'
|
||||
+ ' <p class="jeu__introp">Tu pars de ces 9 lettres, et rien d\'autre. Combine-les dans la forge pour découvrir des mots — chaque mot débloqué ouvre de nouvelles recettes, jusqu\'au XERBOXION.</p>'
|
||||
+ ' <div class="jeu__introstep">Ton premier coup : <b>O + N → ON</b></div>'
|
||||
+ ' <div class="jeu__introcta"><button class="jeu__introgo" data-introgo>Commencer dans la forge</button><button class="jeu__introskip" data-introskip>explorer d\'abord</button></div>'
|
||||
+ ' </div></div>'
|
||||
+ '</div>';
|
||||
var root = container.querySelector('.jeu'), jg = window.jGlyph;
|
||||
var barEl = root.querySelector('[data-bar]'), pctEl = root.querySelector('[data-pct]'), fracEl = root.querySelector('[data-frac]'),
|
||||
pathEl = root.querySelector('[data-path]'), winEl = root.querySelector('[data-win]'), recentEl = root.querySelector('[data-recent]'),
|
||||
achEl = root.querySelector('[data-ach]'), shmsgEl = root.querySelector('[data-shmsg]'),
|
||||
cxov = root.querySelector('[data-cxov]'), cxgrid = root.querySelector('[data-cxgrid]'), cxcount = root.querySelector('[data-cxcount]'), cxsearch = root.querySelector('[data-cxsearch]');
|
||||
var TERMS = {}, CRAFT = [], SPINE = ['on','ion','bion','cubion','ploxion','boxion','xerboxion'];
|
||||
var ACH = [ {i:'✦',l:'première étincelle',t:function(d,g){return g>=1;}}, {i:'10',l:'10 mots',t:function(d,g){return g>=10;}},
|
||||
{i:'◎',l:'le réel (ION)',t:function(d){return d.ion;}}, {i:'◆',l:'un ploxion',t:function(d){return d.ploxion;}},
|
||||
{i:'⬥',l:'moitié du codex',t:function(d,g){return CRAFT.length&&g>=CRAFT.length/2;}}, {i:'✺',l:'xerboxion',t:function(d){return d.xerboxion;}} ];
|
||||
var _seen = {}, _first = true;
|
||||
var GC = { portion:'#79d9a2', wormion:'#7fb2e5', koin:'#f0d36c', trion:'#a597cf', xer:'#ddd6ea', spherion:'#79d9a2', ploxion:'#a597cf' };
|
||||
|
||||
// cube 3D de titre
|
||||
(function () { var cv = root.querySelector('[data-cube]'); if (!cv || !jg) return; var g = cv.getContext('2d'), S = 74, dpr = Math.max(1, window.devicePixelRatio || 1);
|
||||
cv.width = S * dpr; cv.height = S * dpr; g.setTransform(dpr, 0, 0, dpr, 0, 0); var a = 0, raf;
|
||||
(function spin() { g.clearRect(0, 0, S, S); g.save(); g.translate(S / 2, S / 2); g.rotate(Math.sin(a) * 0.25); jg.prim(g, 'portion', 0, 0, 30, '#79d9a2', 3); g.rotate(0.6); jg.prim(g, 'koin', 0, 0, 16, '#a597cf', 2); g.restore(); a += 0.02; raf = requestAnimationFrame(spin); })();
|
||||
root._cubeRaf = function () { cancelAnimationFrame(raf); }; })();
|
||||
|
||||
function disc() { try { return JSON.parse(localStorage.getItem('forge:disc')) || {}; } catch (e) { return {}; } }
|
||||
function primData(kind, px) { if (!jg) return ''; var cv = document.createElement('canvas'); cv.width = px; cv.height = px; jg.prim(cv.getContext('2d'), kind, px / 2, px / 2, px / 2 - 3, GC[kind] || '#cfe', kind === 'xer' ? 1 : 3); try { return cv.toDataURL(); } catch (e) { return ''; } }
|
||||
function mileInner(id) { var T = TERMS[id]; if (T && T.g) return '<img src="' + primData(T.g, 30) + '">'; return '<span style="font:700 .72rem ui-monospace;color:#ddd6ea">' + (T ? T.l : id).slice(0, 4) + '</span>'; }
|
||||
|
||||
function render() {
|
||||
var d = disc(), got = CRAFT.filter(function (id) { return d[id]; }).length, tot = CRAFT.length || 1;
|
||||
var pct = Math.round(got / tot * 100);
|
||||
barEl.style.width = pct + '%'; pctEl.textContent = pct + ' %'; fracEl.textContent = got + ' / ' + CRAFT.length + ' mots';
|
||||
winEl.hidden = !d['xerboxion'];
|
||||
pathEl.innerHTML = SPINE.map(function (id, i) { var on = d[id] || TERMS[id] && TERMS[id].let;
|
||||
return (i ? '<span class="jeu__arrow">→</span>' : '') + '<div class="jeu__mile' + (on ? ' on' : '') + '"><div class="d">' + mileInner(id) + '</div><small>' + (TERMS[id] ? TERMS[id].l : id) + '</small></div>'; }).join('');
|
||||
if (achEl) { achEl.innerHTML = ACH.map(function (a, i) { var ok = a.t(d, got);
|
||||
if (ok && !_seen[i]) { _seen[i] = 1; if (!_first) { try { if (window.jXsfx) { (a.i === '✺' ? window.jXsfx.win() : window.jXsfx.unlock()); } } catch (e) {} } }
|
||||
return '<div class="jeu__a' + (ok ? ' on' : '') + '"><span class="ai">' + a.i + '</span><small>' + a.l + '</small></div>'; }).join(''); _first = false; }
|
||||
}
|
||||
function loadWiki() {
|
||||
fetch('/wiki/bions.json', { cache: 'no-store' }).then(function (r) { return r.ok ? r.json() : null; }).then(function (d) {
|
||||
if (!d || !d.bions) return; var PRIM = { portion:1, wormion:1, koin:1, trion:1, ploxion:1, xer:1, spherion:1 };
|
||||
d.bions.forEach(function (b) { var k = (b.name || '').trim().toLowerCase(); if (!k) return; var gp = (b.glyph && PRIM[(b.glyph || '').toLowerCase()]) ? (b.glyph || '').toLowerCase() : null;
|
||||
TERMS[k] = { l: b.name, g: gp, let: b.cat === 'lettre', def: b.def }; if (b.decomp) CRAFT.push(k); });
|
||||
render();
|
||||
}).catch(function () {});
|
||||
}
|
||||
|
||||
root.querySelectorAll('[data-open]').forEach(function (b) { b.onclick = function () { var id = b.getAttribute('data-open');
|
||||
if (id === 'wiki') { openCodex(); return; }
|
||||
if (id === 'xp:idle') { try { sessionStorage.setItem('xp:tab', 'idle'); } catch (e) {} id = 'xp'; }
|
||||
if (id === 'forge') { try { sessionStorage.setItem('forge:tab', 'alch'); } catch (e) {} }
|
||||
try { if (window.jOSMobile && window.jOSMobile.open) { window.jOSMobile.open(id, id === 'forge' ? 'Forge' : 'Machine à tsoins'); return; } } catch (e) {}
|
||||
try { if (window.jOSOp && window.jOSOp.openPloxion) { window.jOSOp.openPloxion(id); return; } } catch (e) {}
|
||||
try { if (window.jOS && window.jOS.openPloxion) window.jOS.openPloxion(id); } catch (e) {}
|
||||
}; });
|
||||
|
||||
// live : une découverte (forge) émet tsoin.record avec .out -> on rafraîchit + on annonce
|
||||
function onRec(pl) { if (pl && pl.out && TERMS[pl.out]) { recentEl.innerHTML = 'dernier débloqué : <b>' + (TERMS[pl.out].l) + '</b>' + (TERMS[pl.out].def ? ' — ' + TERMS[pl.out].def.slice(0, 90) : ''); } render(); }
|
||||
try { if (window.jOSPorts && window.jOSPorts.on) window.jOSPorts.on('tsoin.record', onRec); } catch (e) {}
|
||||
var poll = setInterval(render, 2500);
|
||||
|
||||
// ===== ta partie = un REPO (RS-7 : « tout est un repo ») : exporter / partager le lien / recommencer =====
|
||||
function b64e(s){ try{ return btoa(unescape(encodeURIComponent(s))); }catch(e){ return ''; } }
|
||||
function b64d(s){ try{ return decodeURIComponent(escape(atob(s))); }catch(e){ return ''; } }
|
||||
function shmsg(m){ if (shmsgEl) shmsgEl.textContent = m; }
|
||||
function saveDiscKeys(keys){ var d = disc(); keys.forEach(function(k){ d[k] = 1; }); try{ localStorage.setItem('forge:disc', JSON.stringify(d)); }catch(e){} try{ if (window.jOSBoxion && window.jOSBoxion.saveSoon) window.jOSBoxion.saveSoon('forge','disc',d); }catch(e){} }
|
||||
function runManifest(){ var keys = Object.keys(disc()); var got = keys.filter(function(k){ return CRAFT.indexOf(k) >= 0; }).length; return { game:'xerboxion', kind:'run', discovered:keys, count:keys.length, pct: CRAFT.length ? Math.round(got/CRAFT.length*100) : 0 }; }
|
||||
function exportRun(){ var m = runManifest(); var blob = new Blob([JSON.stringify(m,null,1)],{type:'application/json'}); var a = document.createElement('a'); a.href = URL.createObjectURL(blob); a.download = 'xerboxion-run.repo.json'; a.click(); shmsg('partie exportée ('+m.count+' mots) — ton repo'); }
|
||||
function shareRun(){ var keys = Object.keys(disc()); var url = location.origin + location.pathname + '?px=jeu&run=' + encodeURIComponent(b64e(keys.join(','))); var ok = function(){ shmsg('lien copié — partage ta partie'); };
|
||||
try{ if (navigator.clipboard && navigator.clipboard.writeText) navigator.clipboard.writeText(url).then(ok, function(){ shmsg(url); }); else shmsg(url); }catch(e){ shmsg(url); } }
|
||||
function resetRun(){ if (!confirm('Recommencer ? Ça efface ta partie locale (les mots découverts).')) return; try{ localStorage.removeItem('forge:disc'); }catch(e){} try{ if (window.jOSBoxion && window.jOSBoxion.saveSoon) window.jOSBoxion.saveSoon('forge','disc',{}); }catch(e){} _seen = {}; _first = true; render(); shmsg('partie remise à zéro'); }
|
||||
function importRun(){ try{ var code = new URLSearchParams(location.search).get('run'); if (!code) return; var keys = b64d(decodeURIComponent(code)).split(',').filter(Boolean); if (keys.length){ saveDiscKeys(keys); shmsg('partie importée : +'+keys.length+' mots'); } }catch(e){} }
|
||||
root.querySelector('[data-export]').onclick = exportRun;
|
||||
root.querySelector('[data-share]').onclick = shareRun;
|
||||
root.querySelector('[data-reset]').onclick = resetRun;
|
||||
importRun();
|
||||
|
||||
// ===== codex in-game : parcourir ta collection (mots découverts avec glyphes/défs + verrouillés) =====
|
||||
function esc(s){ return (s==null?'':String(s)).replace(/[&<>"]/g,function(c){return {'&':'&','<':'<','>':'>','"':'"'}[c]; }); }
|
||||
function renderCodexOv(q){ if(!cxgrid) return; q=(q||'').trim().toLowerCase(); var d=disc(), got=0;
|
||||
var cells=CRAFT.map(function(id){ var g=d[id], E=TERMS[id]||{l:id}; if(g)got++;
|
||||
if(q){ if(!g) return ''; if((E.l||id).toLowerCase().indexOf(q)<0) return ''; }
|
||||
if(g){ var ic=E.g?'<img src="'+primData(E.g,40)+'">':'<span class="mono">'+esc((E.l||id).slice(0,5))+'</span>';
|
||||
return '<div class="jeu__cx got" title="'+esc(E.def||'')+'"><div class="cxic">'+ic+'</div><div class="cxn">'+esc(E.l||id)+'</div><div class="cxd">'+esc((E.def||'').slice(0,54))+'</div></div>'; }
|
||||
return '<div class="jeu__cx lock"><div class="cxic">⊘</div><div class="cxn">· · ·</div></div>'; }).join('');
|
||||
cxgrid.innerHTML = cells || '<div style="color:var(--m);padding:20px;grid-column:1/-1;font:600 12px ui-monospace,Menlo,monospace">∅</div>';
|
||||
if(cxcount) cxcount.textContent = got+' / '+CRAFT.length+' mots'; }
|
||||
function openCodex(){ if(!cxov) return; cxov.hidden=false; if(cxsearch) cxsearch.value=''; renderCodexOv(''); try{ if(window.jXsfx) window.jXsfx.tap(); }catch(e){} }
|
||||
function closeCodex(){ if(cxov) cxov.hidden=true; }
|
||||
if(root.querySelector('[data-cxclose]')) root.querySelector('[data-cxclose]').onclick = closeCodex;
|
||||
if(cxsearch) cxsearch.oninput = function(){ renderCodexOv(cxsearch.value); };
|
||||
|
||||
// ===== onboarding : montré au tout premier lancement du jeu, puis plus jamais (flag localStorage) =====
|
||||
var introEl = root.querySelector('[data-intro]');
|
||||
function openApp(id){ try{ if(window.jOSMobile&&window.jOSMobile.open){ window.jOSMobile.open(id,id); return; } }catch(e){} try{ if(window.jOSOp&&window.jOSOp.openPloxion){ window.jOSOp.openPloxion(id); return; } }catch(e){} try{ if(window.jOS&&window.jOS.openPloxion) window.jOS.openPloxion(id); }catch(e){} }
|
||||
function onboarded(){ try{ return localStorage.getItem('jeu:onboarded')==='1'; }catch(e){ return false; } }
|
||||
function setOnboarded(){ try{ localStorage.setItem('jeu:onboarded','1'); }catch(e){} }
|
||||
if(introEl && !onboarded()) introEl.hidden = false;
|
||||
if(root.querySelector('[data-introgo]')) root.querySelector('[data-introgo]').onclick = function(){ setOnboarded(); if(introEl) introEl.hidden=true; try{ sessionStorage.setItem('forge:tab','alch'); }catch(e){} try{ if(window.jXsfx) window.jXsfx.tap(); }catch(e){} openApp('forge'); };
|
||||
if(root.querySelector('[data-introskip]')) root.querySelector('[data-introskip]').onclick = function(){ setOnboarded(); if(introEl) introEl.hidden=true; };
|
||||
|
||||
loadWiki(); render();
|
||||
return { unmount: function () { clearInterval(poll); try { if (root._cubeRaf) root._cubeRaf(); } catch (e) {} try { if (window.jOSPorts && window.jOSPorts.off) window.jOSPorts.off('tsoin.record', onRec); } catch (e) {} container.innerHTML = ''; } };
|
||||
}
|
||||
window.jOSApps = window.jOSApps || {};
|
||||
window.jOSApps['jeu'] = { manifest: { id: 'jeu', name: 'Le Jeu', icon: '◆' }, mount: mount, describe: describe };
|
||||
try { if (new URLSearchParams(location.search).get('px') === 'jeu') { var t = 0, iv = setInterval(function () { if ((window.jOSMobile && window.jOSMobile.open('jeu', 'Le Jeu')) || (window.jOS && window.jOS.openPloxion && window.jOS.openPloxion('jeu')) || ++t > 50) clearInterval(iv); }, 150); } } catch (e) {}
|
||||
})();
|
||||
</script>
|
||||
Reference in New Issue
Block a user