mirror of
https://git.j0bot.ch/admin_j0bot/ploxion-multivers.git
synced 2026-11-29 06:55:07 +00:00
synchro du labo (0bf0da65) : app.blade.php, README.md
This commit is contained in:
parent
d14586307d
commit
f6950dc633
22
README.md
22
README.md
@ -1,3 +1,21 @@
|
|||||||
# ploxion-multivers
|
# 🌌 Multivers
|
||||||
|
|
||||||
PLOXION · Voyage entre les univers : le boson de Higgs définit le numéro de l'univers, chaque univers a sa mécanique. HyperSleep + Rosa te guident. · fournit: multivers, game, hypersleep, rosa, univers
|
Voyage entre les univers : le boson de Higgs définit le numéro de l'univers, chaque univers a sa mécanique. HyperSleep + Rosa te guident.
|
||||||
|
|
||||||
|
| | |
|
||||||
|
| --- | --- |
|
||||||
|
| id | `multivers` |
|
||||||
|
| fournit | `multivers` `game` `hypersleep` `rosa` `univers` |
|
||||||
|
| bions qu'il nomme | `jOSApps` `jOSBoxion` `jOSGame` `jOSXui` |
|
||||||
|
| fichiers | `app.blade.php` |
|
||||||
|
| dans le labo | `resources/views/ploxions/multivers/` (dépôt `my_website2`) |
|
||||||
|
|
||||||
|
## Contribuer
|
||||||
|
|
||||||
|
- **Dans le xer** : https://labo.j0bot.ch/px/atelier?ploxion=multivers — prends-le, modifie-le, vois-le tourner, « ⧗ envoyer le tsoin ».
|
||||||
|
- **Dans VS Code** : `xb prendre multivers` (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
|
||||||
|
|||||||
591
app.blade.php
Normal file
591
app.blade.php
Normal file
@ -0,0 +1,591 @@
|
|||||||
|
{{-- PL0XI0N multivers 🌌 — le voyage entre univers du jeu « Protagonistes » (OneNote 2020) rendu jouable. Canon : « Le boson de Higgs définit le numéro de l'univers » ; « Chaque univers a sa propre mécanique » ; « À chaque voyage entre univers il doit s'endormir dans une sorte de caisson. » H702 → A304, Rosa vous guide. --}}
|
||||||
|
<style>
|
||||||
|
.px-multivers{position:relative;display:flex;flex-direction:column;gap:8px;height:100%;min-height:480px;background:var(--xr-bg,#0a0d16);color:var(--xr-fg,#e8ecf8);overflow:hidden;padding:8px;box-sizing:border-box;border-radius:10px}
|
||||||
|
.px-multivers *{box-sizing:border-box}
|
||||||
|
.px-multivers .px-mv-top{display:flex;flex-wrap:wrap;gap:6px;align-items:center;font-size:12px}
|
||||||
|
.px-multivers .px-mv-chip{background:var(--xr-card,#111a30);border:1px solid var(--xr-line,#1b2540);border-radius:999px;padding:3px 10px;color:var(--xr-muted,#7f93c8);white-space:nowrap}
|
||||||
|
.px-multivers .px-mv-chip b{color:var(--xr-fg,#e8ecf8);font-weight:600}
|
||||||
|
.px-multivers .px-mv-stage{position:relative;flex:1;min-height:280px;border:1px solid var(--xr-line,#1b2540);border-radius:12px;overflow:hidden;background:#05070d;touch-action:none}
|
||||||
|
.px-multivers canvas{display:block;width:100%;height:100%}
|
||||||
|
.px-multivers .px-mv-rule{font-size:12px;color:var(--xr-muted,#7f93c8);line-height:1.35;min-height:2.6em;padding:0 2px}
|
||||||
|
.px-multivers .px-mv-toast{position:absolute;left:50%;top:12px;transform:translate(-50%,0);background:var(--xr-card,#111a30);border:1px solid var(--xr-accent,#6ea8fe);border-radius:8px;padding:6px 12px;font-size:12px;opacity:0;transition:opacity .3s;pointer-events:none;z-index:5;max-width:92%}
|
||||||
|
.px-multivers .px-mv-toast.on{opacity:1}
|
||||||
|
.px-multivers .px-mv-stage.px-mv-danger{animation:px-mv-shake .13s linear infinite}
|
||||||
|
@keyframes px-mv-shake{0%{transform:translate(0,0)}25%{transform:translate(1.5px,-1px)}50%{transform:translate(-1px,1.5px)}75%{transform:translate(1px,1px)}100%{transform:translate(0,0)}}
|
||||||
|
.px-multivers .px-mv-sleep{position:absolute;inset:0;z-index:10;background:#000;display:none;flex-direction:column;align-items:center;padding:16px;overflow-y:auto;border-radius:10px}
|
||||||
|
.px-multivers .px-mv-sleep.on{display:flex}
|
||||||
|
.px-multivers .px-mv-tunnel{position:relative;width:100%;height:110px;flex:none;display:flex;align-items:center;justify-content:center;overflow:hidden;background:linear-gradient(180deg,#000 0%,#02030a 100%)}
|
||||||
|
.px-multivers .px-mv-light{width:90px;height:90px;border-radius:50%;background:radial-gradient(circle,#fff 0%,rgba(255,255,255,.55) 35%,rgba(255,255,255,0) 70%);animation:px-mv-light 5s ease-in-out infinite alternate}
|
||||||
|
@keyframes px-mv-light{from{transform:scale(.35);opacity:.4}to{transform:scale(1.6);opacity:1}}
|
||||||
|
.px-multivers .px-mv-rosa{width:100%;max-width:560px;margin-top:10px}
|
||||||
|
.px-multivers .px-mv-rname{font-size:11px;letter-spacing:2px;color:var(--xr-accent,#8fb7ff);display:flex;gap:8px;align-items:center;justify-content:space-between}
|
||||||
|
.px-multivers .px-mv-say{min-height:96px;font-family:ui-monospace,SFMono-Regular,monospace;font-size:13px;line-height:1.55;white-space:pre-wrap;margin:8px 0;color:#cfe0ff;cursor:pointer}
|
||||||
|
.px-multivers .px-mv-fiche{background:var(--xr-card,#111a30);border:1px solid var(--xr-line,#1b2540);border-left:3px solid var(--xr-accent,#6ea8fe);border-radius:8px;padding:10px;font-size:12px;color:var(--xr-muted,#9fb2dd);line-height:1.5;opacity:0;transition:opacity .6s}
|
||||||
|
.px-multivers .px-mv-fiche.on{opacity:1}
|
||||||
|
.px-multivers .px-mv-fiche h4{margin:0 0 4px;font-size:12px;color:var(--xr-fg,#e8ecf8)}
|
||||||
|
.px-multivers .px-mv-btn{background:var(--xr-card,#111a30);border:1px solid var(--xr-line,#1b2540);color:var(--xr-fg,#e8ecf8);border-radius:8px;padding:9px 14px;font-size:13px;min-height:44px;cursor:pointer;touch-action:manipulation;-webkit-tap-highlight-color:transparent}
|
||||||
|
.px-multivers .px-mv-wake{margin-top:12px;width:100%;max-width:560px;border-color:var(--xr-accent,#6ea8fe);opacity:0;pointer-events:none;transition:opacity .5s}
|
||||||
|
.px-multivers .px-mv-wake.on{opacity:1;pointer-events:auto}
|
||||||
|
.px-multivers .px-mv-spk{font-size:12px;padding:2px 12px;min-height:44px}
|
||||||
|
@media (prefers-reduced-motion:reduce){.px-multivers .px-mv-light{animation:none;transform:scale(1);opacity:.8}.px-multivers .px-mv-stage.px-mv-danger{animation:none}}
|
||||||
|
</style>
|
||||||
|
<script>
|
||||||
|
(function () {
|
||||||
|
'use strict';
|
||||||
|
|
||||||
|
var LS = "jos:multivers";
|
||||||
|
var CELL = 32;
|
||||||
|
|
||||||
|
function esc(s){ try{ if(window.jOSb && jOSb.esc) return jOSb.esc(s); }catch(e){} var d=document.createElement("div"); d.textContent = s==null? "": s; return d.innerHTML; }
|
||||||
|
function h32(s){ var h=2166136261; s=String(s); for(var i=0;i<s.length;i++){ h^=s.charCodeAt(i); h=(h*16777619)>>>0; } return h>>>0; }
|
||||||
|
function rng(seed){ var t=seed>>>0; return function(){ t=(t+0x6D2B79F5)>>>0; var r=Math.imul(t^(t>>>15),1|t); r=(r+Math.imul(r^(r>>>7),61|r))^r; return ((r^(r>>>14))>>>0)/4294967296; }; }
|
||||||
|
function idFor(name){ var h=h32(name); return String.fromCharCode(65+(h%26)) + (100+((h>>>8)%900)); }
|
||||||
|
function clamp(v,a,b){ return v<a? a: (v>b? b: v); }
|
||||||
|
|
||||||
|
// ————— les univers (déterministes, id = lettre+3 chiffres du hash) —————
|
||||||
|
function mkU(fid,name,higgs,mech,icon,col,regle,ficheT,ficheX,pNom,pIco){
|
||||||
|
return { id: fid || idFor(name), name:name, higgs: higgs!=null? higgs : (((h32(name)>>>4)%999)+" GeV"),
|
||||||
|
mech:mech, icon:icon, col:col, regle:regle, fiche:{t:ficheT,x:ficheX}, pouvoir:{nom:pNom,icone:pIco} };
|
||||||
|
}
|
||||||
|
var UNIS = [
|
||||||
|
mkU("H702","Origine","246 GeV","normal","🌍","#5fd3a5",
|
||||||
|
"ici, la physique est celle de chez vous. Échauffez-vous : ramassez 3 fragments de matière exotique ⧗ pour armer le caisson.",
|
||||||
|
"Le multivers","Certaines théories sérieuses (inflation éternelle, paysage des cordes) prédisent une multitude d'univers-bulles, chacun avec ses propres constantes. Changez une seule constante, et la chimie, la lumière ou le temps changent complètement de visage.",
|
||||||
|
"Pied-cosmique","🧭"),
|
||||||
|
mkU("A304","Sans-Masse","0 GeV","sansmasse","🎈","#8fb7ff",
|
||||||
|
"le champ de Higgs y est nul : plus de masse, plus de gravité. On peut enlever la gravité et utiliser le recul et les collisions pour avancer — chaque poussée vous fait dériver sans fin.",
|
||||||
|
"Le boson de Higgs","Le champ de Higgs remplit tout l'espace ; chez nous il vaut 246 GeV. Les particules qui interagissent avec lui acquièrent une masse (boson découvert au CERN en 2012). À 0 GeV, électrons et quarks fileraient à la vitesse de la lumière : plus d'atomes, plus de vous. Le boson de Higgs définit le numéro de l'univers.",
|
||||||
|
"Recul-maîtrisé","🚀"),
|
||||||
|
mkU(null,"Sans-Lumière",null,"sanslumiere","🔦","#c9a5ff",
|
||||||
|
"aucun photon libre : la lumière ne porte qu'à quelques mètres autour de vous. Avancez à tâtons, la boussole sera votre œil.",
|
||||||
|
"Les photons","La lumière est faite de photons, des particules sans masse filant à 299 792 458 m/s. Tout ce que vous voyez est un photon qui a fini sa course dans votre œil — parfois après 13 milliards d'années de voyage.",
|
||||||
|
"Vision-nocturne","👁"),
|
||||||
|
mkU(null,"Sans-Son",null,"sansson","🤫","#7fd4e8",
|
||||||
|
"aucun milieu ne porte le son : silence absolu. Fiez-vous aux ondes que vos déplacements dessinent dans le vide.",
|
||||||
|
"Le son a besoin d'un milieu","Le son est une onde de pression : il lui faut de la matière (air, eau, acier) pour se propager. Dans le vide, aucune vibration ne se transmet — les explosions spatiales sont parfaitement muettes.",
|
||||||
|
"Oreille-interne","🌊"),
|
||||||
|
mkU(null,"Cubique",null,"cubique","🧊","#ffd166",
|
||||||
|
"l'espace y est quantifié : tout snap sur une grille. On se déplace case par case, comme un monde en voxels.",
|
||||||
|
"La longueur de Planck","En dessous de la longueur de Planck (1,6 × 10⁻³⁵ m), la notion même de distance perd son sens. Certaines théories de gravité quantique imaginent un espace-temps granulaire — un univers en pixels.",
|
||||||
|
"Pas-quantifié","🧊"),
|
||||||
|
mkU(null,"Sans-Temps",null,"sanstemps","⏳","#ff8fa3",
|
||||||
|
"le temps n'avance que quand vous bougez. Immobile, l'univers entier retient son souffle avec vous.",
|
||||||
|
"Le temps est relatif","Le temps n'est pas absolu : il ralentit quand on va vite ou près d'une grande masse (relativité d'Einstein). Les horloges des satellites GPS dérivent de 38 microsecondes par jour — sans correction, votre position serait fausse de plusieurs kilomètres.",
|
||||||
|
"Temps-lié","⧗"),
|
||||||
|
mkU(null,"Fractal",null,"fractal","🌀","#9be37b",
|
||||||
|
"l'espace se répète en boucle auto-similaire : sortez par un bord, vous revenez par l'autre — et le monde se contient lui-même en plus petit.",
|
||||||
|
"L'auto-similarité","Une fractale se ressemble à toutes les échelles : côtes, poumons, chou romanesco. Leur dimension peut être non-entière (la côte de Bretagne vaut environ 1,25). L'auto-similarité, c'est de l'infini plié dans du fini.",
|
||||||
|
"Écho-fractal","🌀"),
|
||||||
|
mkU(null,"Plat-2D",null,"plat","📄","#e8c07f",
|
||||||
|
"cet univers n'a que deux dimensions : le haut et le bas n'existent pas pour vous. Tout se joue sur la ligne.",
|
||||||
|
"Vivre en 2D","Dans un espace à 2 dimensions, la gravité décroîtrait en 1/r : aucune orbite stable. Et un tube digestif couperait tout être vivant en deux. La 3D n'est pas un détail — c'est une condition d'existence.",
|
||||||
|
"Perspective-plate","📄"),
|
||||||
|
mkU(null,"Sans-Vie",null,"sansvie","🏜","#d9b38c",
|
||||||
|
"rien n'y a jamais vécu : un désert parfaitement immobile. Seul ce qui vient d'ailleurs y bouge — vous.",
|
||||||
|
"La vie contre l'entropie","La vie est une pompe à entropie : elle maintient son ordre interne en exportant du désordre (chaleur). Sans flux d'énergie — soleil, volcans — pas de vie possible : juste un équilibre mort et silencieux.",
|
||||||
|
"Souffle-du-vide","🏜"),
|
||||||
|
mkU(null,"Hyper-Gravité",null,"hyperg","🪨","#f08c5a",
|
||||||
|
"la gravité y écrase tout : poussez fort vers le haut, ou apprenez à vivre collé au sol.",
|
||||||
|
"La gravité, force faible","La gravité est la plus faible des quatre forces fondamentales (environ 10³⁶ fois moins intense que l'électromagnétisme), mais elle ne s'annule jamais et gagne toujours à grande échelle : c'est elle qui sculpte étoiles et galaxies.",
|
||||||
|
"Jambes-d'acier","🦿")
|
||||||
|
];
|
||||||
|
|
||||||
|
var GL = "▓░#§%&@?!*¤";
|
||||||
|
function corrupt(txt,lvl,seed){
|
||||||
|
var r=rng(seed), p=Math.max(0.02, 0.45-lvl*0.07), out="";
|
||||||
|
for(var i=0;i<txt.length;i++){ var c=txt.charAt(i);
|
||||||
|
if(c!==" " && c!=="\n" && r()<p) out+=GL.charAt((r()*GL.length)|0); else out+=c; }
|
||||||
|
return out;
|
||||||
|
}
|
||||||
|
|
||||||
|
function mount(container, ctx0){
|
||||||
|
var dead=false, playing=false;
|
||||||
|
var pseudo="voyageur";
|
||||||
|
try{ if(ctx0 && ctx0.user) pseudo = ctx0.user.name || ctx0.user.pseudo || pseudo; }catch(e){}
|
||||||
|
var reduced=false;
|
||||||
|
try{ reduced = window.matchMedia && matchMedia("(prefers-reduced-motion: reduce)").matches; }catch(e){}
|
||||||
|
|
||||||
|
// ————— état persistant —————
|
||||||
|
var voyages=0, univIndex=0;
|
||||||
|
function applyState(d){ if(!d) return; voyages=(d.v|0)||0; univIndex=clamp((d.u|0)||0,0,UNIS.length-1); }
|
||||||
|
function save(){
|
||||||
|
var d={v:voyages,u:univIndex};
|
||||||
|
try{ localStorage.setItem(LS,JSON.stringify(d)); }catch(e){}
|
||||||
|
try{ if(window.jOSBoxion && jOSBoxion.saveSoon) jOSBoxion.saveSoon("multivers",d); }catch(e){}
|
||||||
|
}
|
||||||
|
function loadState(cb){
|
||||||
|
var d=null;
|
||||||
|
try{ d=JSON.parse(localStorage.getItem(LS)||"null"); }catch(e){}
|
||||||
|
if(d){ applyState(d); cb(); return; }
|
||||||
|
try{
|
||||||
|
if(window.jOSBoxion && jOSBoxion.load){
|
||||||
|
jOSBoxion.load("multivers").then(function(x){ if(!dead){ if(x) applyState(x); cb(); } }, function(){ if(!dead) cb(); });
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}catch(e){}
|
||||||
|
cb();
|
||||||
|
}
|
||||||
|
|
||||||
|
// ————— DOM —————
|
||||||
|
container.innerHTML = ""
|
||||||
|
+"<div class='px-multivers'>"
|
||||||
|
+ "<div class='px-mv-top'>"
|
||||||
|
+ "<span class='px-mv-chip px-mv-uni'>🌌 …</span>"
|
||||||
|
+ "<span class='px-mv-chip px-mv-higgs'>Higgs : …</span>"
|
||||||
|
+ "<span class='px-mv-chip'>⧗ <b class='px-mv-frag'>0/3</b></span>"
|
||||||
|
+ "<span class='px-mv-chip'>✈ <b class='px-mv-voy'>0</b></span>"
|
||||||
|
+ "<span class='px-mv-chip px-mv-rlvl'>ROSA niv. 0</span>"
|
||||||
|
+ "</div>"
|
||||||
|
+ "<div class='px-mv-stage'>"
|
||||||
|
+ "<canvas></canvas>"
|
||||||
|
+ "<div class='px-mv-toast'></div>"
|
||||||
|
+ "</div>"
|
||||||
|
+ "<div class='px-mv-rule'></div>"
|
||||||
|
+ "<div class='px-mv-sleep'>"
|
||||||
|
+ "<div class='px-mv-tunnel'><div class='px-mv-light'></div></div>"
|
||||||
|
+ "<div class='px-mv-rosa'>"
|
||||||
|
+ "<div class='px-mv-rname'><span class='px-mv-rn'>R O S A</span><button class='px-mv-btn px-mv-spk' type='button'>🔊 voix</button></div>"
|
||||||
|
+ "<div class='px-mv-say'></div>"
|
||||||
|
+ "<div class='px-mv-fiche'><h4></h4><p></p></div>"
|
||||||
|
+ "</div>"
|
||||||
|
+ "<button class='px-mv-btn px-mv-wake' type='button'>Se réveiller</button>"
|
||||||
|
+ "</div>"
|
||||||
|
+"</div>";
|
||||||
|
|
||||||
|
function q(sel){ return container.querySelector(sel); }
|
||||||
|
var stage=q(".px-mv-stage"), cv=q("canvas"), g=cv.getContext("2d");
|
||||||
|
var toastEl=q(".px-mv-toast"), ruleEl=q(".px-mv-rule");
|
||||||
|
var sleepEl=q(".px-mv-sleep"), sayEl=q(".px-mv-say"), ficheEl=q(".px-mv-fiche");
|
||||||
|
var wakeBtn=q(".px-mv-wake"), spkBtn=q(".px-mv-spk"), rnEl=q(".px-mv-rn");
|
||||||
|
|
||||||
|
var W=320, H=240, toastT=null, typT=null;
|
||||||
|
function fit(){
|
||||||
|
var r=stage.getBoundingClientRect();
|
||||||
|
W=Math.max(280, r.width|0); H=Math.max(220, r.height|0);
|
||||||
|
var dpr=Math.min(1.5, window.devicePixelRatio||1);
|
||||||
|
cv.width=(W*dpr)|0; cv.height=(H*dpr)|0;
|
||||||
|
g.setTransform(dpr,0,0,dpr,0,0);
|
||||||
|
}
|
||||||
|
|
||||||
|
// ————— audio (généré, jamais de fichier) —————
|
||||||
|
var AC=null, noiseBuf=null;
|
||||||
|
function ac(){
|
||||||
|
if(!AC){ try{ AC=new (window.AudioContext||window.webkitAudioContext)(); }catch(e){} }
|
||||||
|
try{ if(AC && AC.state==="suspended") AC.resume(); }catch(e){}
|
||||||
|
return AC;
|
||||||
|
}
|
||||||
|
function beep(f,d){
|
||||||
|
if(cur().mech==="sansson") return;
|
||||||
|
var c=ac(); if(!c) return;
|
||||||
|
try{
|
||||||
|
var o=c.createOscillator(), gn=c.createGain();
|
||||||
|
o.type="sine"; o.frequency.value=f;
|
||||||
|
gn.gain.setValueAtTime(0.07,c.currentTime);
|
||||||
|
gn.gain.exponentialRampToValueAtTime(0.0001,c.currentTime+d);
|
||||||
|
o.connect(gn); gn.connect(c.destination); o.start(); o.stop(c.currentTime+d);
|
||||||
|
}catch(e){}
|
||||||
|
}
|
||||||
|
function noise(d,vol){
|
||||||
|
if(cur().mech==="sansson") return;
|
||||||
|
var c=ac(); if(!c) return;
|
||||||
|
try{
|
||||||
|
if(!noiseBuf){ noiseBuf=c.createBuffer(1,(c.sampleRate*0.5)|0,c.sampleRate);
|
||||||
|
var ch=noiseBuf.getChannelData(0); for(var i=0;i<ch.length;i++) ch[i]=Math.random()*2-1; }
|
||||||
|
var s=c.createBufferSource(); s.buffer=noiseBuf; s.loop=true;
|
||||||
|
var gn=c.createGain(); gn.gain.setValueAtTime(vol||0.05,c.currentTime);
|
||||||
|
gn.gain.exponentialRampToValueAtTime(0.0001,c.currentTime+d);
|
||||||
|
s.connect(gn); gn.connect(c.destination); s.start(); s.stop(c.currentTime+d);
|
||||||
|
}catch(e){}
|
||||||
|
}
|
||||||
|
|
||||||
|
// ————— jeu —————
|
||||||
|
var px=0,py=0,vx=0,vy=0,hd=-1.5708,cool=0,frame=0,glitchT=0,got=0;
|
||||||
|
var frags=[], stars=[], rings=[], portal=null, anom={active:false,at:9e9}, urand=rng(1);
|
||||||
|
function cur(){ return UNIS[univIndex]; }
|
||||||
|
function nextU(){ return UNIS[(univIndex+1)%UNIS.length]; }
|
||||||
|
function flatY(){ return H*0.62; }
|
||||||
|
|
||||||
|
function toast(msg){
|
||||||
|
try{ if(window.jOSb && jOSb.toast){ jOSb.toast(msg); return; } }catch(e){}
|
||||||
|
toastEl.textContent=msg; toastEl.classList.add("on");
|
||||||
|
if(toastT) clearTimeout(toastT);
|
||||||
|
toastT=setTimeout(function(){ toastEl.classList.remove("on"); },2600);
|
||||||
|
}
|
||||||
|
|
||||||
|
function hud(){
|
||||||
|
var U=cur();
|
||||||
|
q(".px-mv-uni").textContent=U.icon+" "+U.id+" · "+U.name;
|
||||||
|
q(".px-mv-higgs").textContent="Higgs : "+U.higgs;
|
||||||
|
q(".px-mv-frag").textContent=got+"/3";
|
||||||
|
q(".px-mv-voy").textContent=String(voyages);
|
||||||
|
q(".px-mv-rlvl").textContent="ROSA niv. "+voyages;
|
||||||
|
ruleEl.textContent="Règle : "+U.regle+(portal? " — Le portail vers "+nextU().id+" est ouvert, suis la boussole." : "");
|
||||||
|
}
|
||||||
|
|
||||||
|
function spawnStars(U){
|
||||||
|
var r=rng(h32(U.id+":stars")); stars=[];
|
||||||
|
for(var i=0;i<36;i++) stars.push({x:r()*W, y:r()*H, s:r()<0.2?2:1});
|
||||||
|
}
|
||||||
|
function spawnFrags(U){
|
||||||
|
var r=rng(h32(U.id+":frag")); frags=[];
|
||||||
|
for(var i=0;i<3;i++){
|
||||||
|
var ox=40+r()*(W-80), oy=40+r()*(H-80);
|
||||||
|
if(U.mech==="plat") oy=flatY();
|
||||||
|
if(U.mech==="hyperg") oy=H-24-r()*60;
|
||||||
|
frags.push({ox:ox,oy:oy,x:ox,y:oy,a:r()*6.283,orb:10+r()*18,vx:(r()-0.5)*1.4,vy:(r()-0.5)*1.4,got:false});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function enterUniverse(){
|
||||||
|
var U=cur();
|
||||||
|
got=0; portal=null; rings=[]; glitchT=0; frame=0; cool=0;
|
||||||
|
urand=rng(h32(U.id+":run:"+(voyages%97)));
|
||||||
|
px=W/2; py=U.mech==="plat"? flatY(): H/2; vx=0; vy=0; hd=-1.5708;
|
||||||
|
if(U.mech==="hyperg") py=H-20;
|
||||||
|
if(U.mech==="cubique"){ px=Math.round(px/CELL)*CELL; py=Math.round(py/CELL)*CELL; }
|
||||||
|
spawnStars(U); spawnFrags(U);
|
||||||
|
anom={active:false, at:520+urand()*900, x:0, y:0, t:0, nn:0};
|
||||||
|
playing=true; hud();
|
||||||
|
toast(U.icon+" Univers "+U.id+" — "+U.name);
|
||||||
|
}
|
||||||
|
|
||||||
|
function awardPower(U){
|
||||||
|
var p={id:"multivers:"+U.id, nom:U.pouvoir.nom, univers:U.id+" "+U.name, icone:U.pouvoir.icone, date:new Date().toISOString()};
|
||||||
|
try{
|
||||||
|
var arr=JSON.parse(localStorage.getItem("jos:pokedex")||"[]");
|
||||||
|
if(!(arr instanceof Array)) arr=[];
|
||||||
|
var has=false; for(var i=0;i<arr.length;i++){ if(arr[i] && arr[i].id===p.id){ has=true; break; } }
|
||||||
|
if(!has){ arr.push(p); localStorage.setItem("jos:pokedex",JSON.stringify(arr)); }
|
||||||
|
}catch(e){}
|
||||||
|
try{ if(window.jOSGame && jOSGame.award) jOSGame.award("multivers."+U.id,{label:p.nom,icon:p.icone,toast:true}); }catch(e){}
|
||||||
|
try{ if(window.jOSGame && jOSGame.unlock) jOSGame.unlock("multivers."+U.id); }catch(e){}
|
||||||
|
toast("Pouvoir gagné : "+p.icone+" "+p.nom);
|
||||||
|
}
|
||||||
|
|
||||||
|
function complete(){
|
||||||
|
var U=cur();
|
||||||
|
awardPower(U);
|
||||||
|
var r=rng(h32(U.id+":portal"));
|
||||||
|
portal={x:30+r()*(W-60), y:30+r()*(H-60)};
|
||||||
|
if(U.mech==="plat") portal.y=flatY();
|
||||||
|
if(U.mech==="hyperg") portal.y=Math.max(portal.y,H-46);
|
||||||
|
beep(660,0.15); hud();
|
||||||
|
}
|
||||||
|
|
||||||
|
function travel(){
|
||||||
|
var from=cur();
|
||||||
|
voyages++; univIndex=(univIndex+1)%UNIS.length; save();
|
||||||
|
playing=false;
|
||||||
|
try{ if(window.jOSGame && jOSGame.event) jOSGame.event("multivers.voyage",{de:from.id, vers:cur().id, voyages:voyages}); }catch(e){}
|
||||||
|
hypersleep(from.id, cur(), enterUniverse);
|
||||||
|
}
|
||||||
|
|
||||||
|
// ————— HyperSleep + Rosa —————
|
||||||
|
function hypersleep(fromId, toU, cb){
|
||||||
|
sleepEl.classList.add("on");
|
||||||
|
wakeBtn.classList.remove("on"); ficheEl.classList.remove("on");
|
||||||
|
var lvl=voyages;
|
||||||
|
rnEl.textContent="R O S A — signal niv. "+lvl+(lvl<3? " ▒": "");
|
||||||
|
var clean="Bienvenue dans l'HyperSleep "+pseudo+". Je m'appelle Rosa et je vais vous guider durant votre voyage. "
|
||||||
|
+"Vous vous déplacez de l'univers "+fromId+" à l'univers "+toU.id+" ("+toU.name+", champ de Higgs : "+toU.higgs+"). "
|
||||||
|
+"Les règles y sont très différentes : "+toU.regle;
|
||||||
|
if(lvl%7===3) clean+="\n…quelque part, deux silhouettes marchent en arrière. Ne les suivez pas.";
|
||||||
|
var shown=corrupt(clean, lvl, h32(clean)^lvl);
|
||||||
|
ficheEl.querySelector("h4").textContent="📎 Fiche : "+toU.fiche.t;
|
||||||
|
ficheEl.querySelector("p").textContent=toU.fiche.x;
|
||||||
|
wakeBtn.textContent="Se réveiller dans "+toU.id;
|
||||||
|
sayEl.textContent="";
|
||||||
|
var i=0, step=reduced? 3: 1;
|
||||||
|
if(typT) clearInterval(typT);
|
||||||
|
typT=setInterval(function(){
|
||||||
|
i=Math.min(shown.length, i+step);
|
||||||
|
sayEl.textContent=shown.slice(0,i)+(i<shown.length? "▌": "");
|
||||||
|
if(i>=shown.length){ clearInterval(typT); typT=null; ficheEl.classList.add("on"); wakeBtn.classList.add("on"); }
|
||||||
|
},22);
|
||||||
|
sayEl.onclick=function(){ i=Math.max(i, shown.length-1); };
|
||||||
|
spkBtn.onclick=function(){
|
||||||
|
try{
|
||||||
|
var u=new SpeechSynthesisUtterance(clean);
|
||||||
|
u.lang="fr-FR"; u.rate=Math.min(1, 0.8+lvl*0.03);
|
||||||
|
speechSynthesis.cancel(); speechSynthesis.speak(u);
|
||||||
|
}catch(e){}
|
||||||
|
};
|
||||||
|
wakeBtn.onclick=function(){
|
||||||
|
if(typT){ clearInterval(typT); typT=null; }
|
||||||
|
try{ speechSynthesis.cancel(); }catch(e){}
|
||||||
|
sleepEl.classList.remove("on"); wakeBtn.classList.remove("on"); ficheEl.classList.remove("on");
|
||||||
|
if(!dead) cb();
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
// ————— entrées : clavier + joystick tactile —————
|
||||||
|
var keys={l:0,r:0,u:0,d:0}, js={on:false,bx:0,by:0,dx:0,dy:0};
|
||||||
|
function keymap(k){
|
||||||
|
if(k==="ArrowLeft"||k==="a"||k==="A"||k==="q"||k==="Q") return "l";
|
||||||
|
if(k==="ArrowRight"||k==="d"||k==="D") return "r";
|
||||||
|
if(k==="ArrowUp"||k==="w"||k==="W"||k==="z"||k==="Z") return "u";
|
||||||
|
if(k==="ArrowDown"||k==="s"||k==="S") return "d";
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
function kd(e){
|
||||||
|
var t=e.target;
|
||||||
|
if(t && (t.tagName==="INPUT"||t.tagName==="TEXTAREA"||t.isContentEditable)) return;
|
||||||
|
var k=keymap(e.key);
|
||||||
|
if(k){ keys[k]=1; ac(); e.preventDefault(); }
|
||||||
|
}
|
||||||
|
function ku(e){ var k=keymap(e.key); if(k) keys[k]=0; }
|
||||||
|
function tpos(t){ var r=cv.getBoundingClientRect(); return {x:t.clientX-r.left, y:t.clientY-r.top}; }
|
||||||
|
function ts(e){ var p=tpos(e.changedTouches[0]); js.on=true; js.bx=p.x; js.by=p.y; js.dx=0; js.dy=0; ac(); e.preventDefault(); }
|
||||||
|
function tm(e){ if(!js.on) return; var p=tpos(e.changedTouches[0]); js.dx=clamp(p.x-js.bx,-40,40); js.dy=clamp(p.y-js.by,-40,40); e.preventDefault(); }
|
||||||
|
function te(e){ js.on=false; js.dx=0; js.dy=0; }
|
||||||
|
function inX(){ return clamp((keys.r-keys.l)+(js.on? js.dx/40: 0),-1,1); }
|
||||||
|
function inY(){ return clamp((keys.d-keys.u)+(js.on? js.dy/40: 0),-1,1); }
|
||||||
|
|
||||||
|
// ————— simulation —————
|
||||||
|
function step(){
|
||||||
|
var U=cur(), m=U.mech;
|
||||||
|
var ix=inX(), iy=(m==="plat")? 0: inY();
|
||||||
|
if(m==="sansmasse"){ vx+=ix*0.12; vy+=iy*0.12; }
|
||||||
|
else if(m==="cubique"){
|
||||||
|
vx=0; vy=0;
|
||||||
|
if(cool>0) cool--;
|
||||||
|
else{
|
||||||
|
var sx=Math.abs(ix)>0.5? (ix>0?1:-1):0, sy=Math.abs(iy)>0.5? (iy>0?1:-1):0;
|
||||||
|
if(sx||sy){ px+=sx*CELL; py+=sy*CELL; cool=7; beep(520,0.03); }
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if(m==="hyperg"){ vx+=ix*0.5; vy+=iy*0.62+0.3; vx*=0.85; vy*=0.985; }
|
||||||
|
else if(m==="sansvie"){ vx+=ix*0.55; vy+=iy*0.55; vx*=0.72; vy*=0.72; }
|
||||||
|
else{ vx+=ix*0.5; vy+=iy*0.5; vx*=0.86; vy*=0.86; }
|
||||||
|
px+=vx; py+=vy;
|
||||||
|
if(m==="plat") py=flatY();
|
||||||
|
if(m==="fractal"){ px=(px+W)%W; py=(py+H)%H; }
|
||||||
|
else if(m==="sansmasse"){
|
||||||
|
if(px<10){px=10;vx=-vx*0.92;} if(px>W-10){px=W-10;vx=-vx*0.92;}
|
||||||
|
if(py<10){py=10;vy=-vy*0.92;} if(py>H-10){py=H-10;vy=-vy*0.92;}
|
||||||
|
} else {
|
||||||
|
px=clamp(px,10,W-10); py=clamp(py,10,H-10);
|
||||||
|
if(m==="hyperg" && py>=H-14){ py=H-14; vy=Math.min(vy,0); }
|
||||||
|
}
|
||||||
|
var spd=Math.sqrt(vx*vx+vy*vy);
|
||||||
|
if(spd>0.3) hd=Math.atan2(vy,vx);
|
||||||
|
var tf=(m==="sanstemps")? Math.max(0.04, Math.min(1, spd/2.2)): 1;
|
||||||
|
frame+=tf;
|
||||||
|
|
||||||
|
// fragments
|
||||||
|
for(var i=0;i<frags.length;i++){
|
||||||
|
var f=frags[i]; if(f.got) continue;
|
||||||
|
if(m==="sansmasse"){
|
||||||
|
f.x+=f.vx*tf; f.y+=f.vy*tf;
|
||||||
|
if(f.x<14||f.x>W-14) f.vx=-f.vx; if(f.y<14||f.y>H-14) f.vy=-f.vy;
|
||||||
|
} else if(m!=="sansvie"){
|
||||||
|
f.a+=0.015*tf;
|
||||||
|
f.x=clamp(f.ox+Math.cos(f.a)*f.orb,14,W-14);
|
||||||
|
f.y=(m==="plat")? flatY(): clamp(f.oy+Math.sin(f.a)*f.orb,14,H-14);
|
||||||
|
}
|
||||||
|
var dx=px-f.x, dy=py-f.y;
|
||||||
|
if(dx*dx+dy*dy<400){
|
||||||
|
f.got=true; got++; beep(880,0.09); hud();
|
||||||
|
if(got>=3) complete();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// ondes (sans-son)
|
||||||
|
if(m==="sansson"){
|
||||||
|
if(spd>0.5 && (frame|0)%10===0){ rings.push({x:px,y:py,r:6,a:0.5}); if(rings.length>8) rings.shift(); }
|
||||||
|
for(var j=rings.length-1;j>=0;j--){ rings[j].r+=1.6; rings[j].a-=0.012; if(rings[j].a<=0) rings.splice(j,1); }
|
||||||
|
}
|
||||||
|
|
||||||
|
// portail
|
||||||
|
if(portal){
|
||||||
|
var pdx=px-portal.x, pdy=py-portal.y;
|
||||||
|
if(pdx*pdx+pdy*pdy<484){ travel(); return; }
|
||||||
|
}
|
||||||
|
|
||||||
|
// L'ANOMALIE — rencontre rare déterministe
|
||||||
|
if(!anom.active && frame>anom.at){
|
||||||
|
anom.active=true; anom.t=520; anom.nn=frame;
|
||||||
|
anom.x=px<W/2? W-24: 24; anom.y=py<H/2? H-24: 24;
|
||||||
|
noise(0.5,0.09);
|
||||||
|
toast("⚠ L'ANOMALIE. Ne la touche pas — FUIS.");
|
||||||
|
}
|
||||||
|
if(anom.active){
|
||||||
|
var adx=px-anom.x, ady=py-anom.y, ad=Math.sqrt(adx*adx+ady*ady)||1;
|
||||||
|
anom.x+=(adx/ad)*1.05*tf; anom.y+=(ady/ad)*1.05*tf;
|
||||||
|
anom.t-=tf;
|
||||||
|
if(frame>anom.nn+90){ anom.nn=frame; noise(0.3,0.05); }
|
||||||
|
if(!reduced){ if(ad<150 || glitchT>0) stage.classList.add("px-mv-danger"); else stage.classList.remove("px-mv-danger"); }
|
||||||
|
if(ad<18){
|
||||||
|
for(var k=0;k<frags.length;k++) frags[k].got=false;
|
||||||
|
got=0; portal=null; glitchT=60; noise(0.7,0.12);
|
||||||
|
toast("⚠ Problème avec les lois de la physique — la matière exotique s'est dispersée.");
|
||||||
|
try{ if(window.jOSGame && jOSGame.event) jOSGame.event("multivers.anomalie",{univers:U.id}); }catch(e){}
|
||||||
|
anom.active=false; anom.at=frame+1100+urand()*900; hud();
|
||||||
|
} else if(anom.t<=0){
|
||||||
|
anom.active=false; anom.at=frame+1400+urand()*1200;
|
||||||
|
stage.classList.remove("px-mv-danger");
|
||||||
|
toast("…l'Anomalie s'éloigne en grésillant.");
|
||||||
|
}
|
||||||
|
} else if(glitchT<=0){ stage.classList.remove("px-mv-danger"); }
|
||||||
|
if(glitchT>0) glitchT--;
|
||||||
|
}
|
||||||
|
|
||||||
|
// ————— rendu —————
|
||||||
|
function nearestTarget(){
|
||||||
|
if(portal) return portal;
|
||||||
|
var best=null, bd=1e9;
|
||||||
|
for(var i=0;i<frags.length;i++){ var f=frags[i]; if(f.got) continue;
|
||||||
|
var d=(px-f.x)*(px-f.x)+(py-f.y)*(py-f.y); if(d<bd){ bd=d; best=f; } }
|
||||||
|
return best;
|
||||||
|
}
|
||||||
|
function drawEnts(){
|
||||||
|
var U=cur();
|
||||||
|
g.font="14px system-ui,sans-serif"; g.lineWidth=1;
|
||||||
|
for(var i=0;i<frags.length;i++){ var f=frags[i]; if(f.got) continue;
|
||||||
|
var pr=reduced? 0: Math.sin(frame*0.08+i*2)*2;
|
||||||
|
g.beginPath(); g.arc(f.x,f.y,9+pr,0,6.283); g.strokeStyle="#ffd166"; g.stroke();
|
||||||
|
g.fillStyle="#ffd166"; g.fillText("⧗",f.x-6,f.y+5);
|
||||||
|
}
|
||||||
|
if(portal){
|
||||||
|
var pp=reduced? 0: Math.sin(frame*0.06)*3;
|
||||||
|
g.beginPath(); g.arc(portal.x,portal.y,14+pp,0,6.283); g.strokeStyle=U.col; g.lineWidth=2; g.stroke();
|
||||||
|
g.beginPath(); g.arc(portal.x,portal.y,7,0,6.283); g.strokeStyle="#ffffff"; g.lineWidth=1; g.stroke();
|
||||||
|
g.fillStyle=U.col; g.font="10px system-ui,sans-serif"; g.fillText(nextU().id,portal.x-10,portal.y+27);
|
||||||
|
g.font="14px system-ui,sans-serif"; g.lineWidth=1;
|
||||||
|
}
|
||||||
|
if(anom.active){
|
||||||
|
var jx=Math.sin(frame*2.3)*2.5, jy=Math.cos(frame*1.9)*2.5;
|
||||||
|
g.beginPath(); g.arc(anom.x+jx,anom.y+jy,12,0,6.283); g.fillStyle="#12040a"; g.fill(); g.strokeStyle="#ff3355"; g.stroke();
|
||||||
|
g.beginPath(); g.arc(anom.x-jx,anom.y-jy,17,0,6.283); g.strokeStyle="rgba(255,51,85,.4)"; g.stroke();
|
||||||
|
}
|
||||||
|
var drawn=false;
|
||||||
|
try{ if(window.jGlyph && jGlyph.prim){ jGlyph.prim(g,"koin",px,py,10,U.col); drawn=true; } }catch(e){}
|
||||||
|
if(!drawn){
|
||||||
|
g.save(); g.translate(px,py); g.rotate(hd);
|
||||||
|
g.beginPath(); g.moveTo(10,0); g.lineTo(-7,6); g.lineTo(-7,-6); g.closePath();
|
||||||
|
g.fillStyle=U.col; g.fill(); g.restore();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
function draw(){
|
||||||
|
var U=cur(), m=U.mech;
|
||||||
|
g.clearRect(0,0,W,H);
|
||||||
|
if(glitchT>0){ g.save(); g.translate(Math.sin(frame*3.1)*3, Math.cos(frame*2.7)*3); }
|
||||||
|
// décor
|
||||||
|
if(m==="sansvie"){
|
||||||
|
g.fillStyle="rgba(220,190,140,.30)";
|
||||||
|
for(var i=0;i<stars.length;i++) g.fillRect(stars[i].x,stars[i].y,stars[i].s,stars[i].s);
|
||||||
|
g.strokeStyle="rgba(220,190,140,.22)";
|
||||||
|
g.beginPath(); g.arc(W*0.3,H+30,70,3.34,6.08); g.stroke();
|
||||||
|
g.beginPath(); g.arc(W*0.75,H+40,95,3.34,6.08); g.stroke();
|
||||||
|
} else if(m!=="sanslumiere"){
|
||||||
|
g.fillStyle="rgba(200,215,255,.45)";
|
||||||
|
for(var i2=0;i2<stars.length;i2++) g.fillRect(stars[i2].x,stars[i2].y,stars[i2].s,stars[i2].s);
|
||||||
|
}
|
||||||
|
if(m==="cubique"){
|
||||||
|
g.strokeStyle="rgba(120,140,200,.12)"; g.beginPath();
|
||||||
|
for(var gx=0;gx<=W;gx+=CELL){ g.moveTo(gx,0); g.lineTo(gx,H); }
|
||||||
|
for(var gy=0;gy<=H;gy+=CELL){ g.moveTo(0,gy); g.lineTo(W,gy); }
|
||||||
|
g.stroke();
|
||||||
|
}
|
||||||
|
if(m==="plat"){ g.strokeStyle="rgba(232,192,127,.5)"; g.beginPath(); g.moveTo(0,flatY()+14); g.lineTo(W,flatY()+14); g.stroke(); }
|
||||||
|
if(m==="hyperg"){ g.fillStyle="rgba(240,140,90,.25)"; g.fillRect(0,H-6,W,6); }
|
||||||
|
if(m==="sansson"){
|
||||||
|
for(var r2=0;r2<rings.length;r2++){ var rr=rings[r2];
|
||||||
|
g.beginPath(); g.arc(rr.x,rr.y,rr.r,0,6.283);
|
||||||
|
g.strokeStyle="rgba(127,212,232,"+Math.max(0,rr.a).toFixed(3)+")"; g.stroke(); }
|
||||||
|
g.fillStyle="rgba(127,212,232,.5)"; g.font="11px system-ui,sans-serif"; g.fillText("🤫 silence total",10,16);
|
||||||
|
}
|
||||||
|
drawEnts();
|
||||||
|
if(m==="fractal"){
|
||||||
|
g.save(); g.globalAlpha=0.25; g.translate(W*0.7,6); g.scale(0.28,0.28); drawEnts(); g.restore();
|
||||||
|
g.save(); g.globalAlpha=0.15; g.translate(4,H*0.72); g.scale(0.18,0.18); drawEnts(); g.restore();
|
||||||
|
}
|
||||||
|
if(m==="sanslumiere"){
|
||||||
|
var gr=g.createRadialGradient(px,py,42,px,py,132);
|
||||||
|
gr.addColorStop(0,"rgba(3,5,10,0)"); gr.addColorStop(1,"rgba(3,5,10,0.96)");
|
||||||
|
g.fillStyle=gr; g.fillRect(0,0,W,H);
|
||||||
|
}
|
||||||
|
if(m==="sanstemps"){
|
||||||
|
var spd=Math.sqrt(vx*vx+vy*vy), tf=Math.max(0.04,Math.min(1,spd/2.2));
|
||||||
|
g.fillStyle="rgba(255,143,163,.6)"; g.fillRect(10,H-12,60*tf,3);
|
||||||
|
g.font="10px system-ui,sans-serif"; g.fillText("temps",10,H-16);
|
||||||
|
}
|
||||||
|
// boussole
|
||||||
|
var t=nearestTarget();
|
||||||
|
if(t){
|
||||||
|
var a=Math.atan2(t.y-py,t.x-px);
|
||||||
|
g.save(); g.translate(W-26,26);
|
||||||
|
g.beginPath(); g.arc(0,0,14,0,6.283); g.strokeStyle="rgba(140,160,220,.5)"; g.stroke();
|
||||||
|
g.rotate(a); g.beginPath(); g.moveTo(10,0); g.lineTo(-6,4); g.lineTo(-6,-4); g.closePath();
|
||||||
|
g.fillStyle=portal? U.col: "#ffd166"; g.fill(); g.restore();
|
||||||
|
}
|
||||||
|
// joystick
|
||||||
|
if(js.on){
|
||||||
|
g.beginPath(); g.arc(js.bx,js.by,30,0,6.283); g.strokeStyle="rgba(140,160,220,.35)"; g.stroke();
|
||||||
|
g.beginPath(); g.arc(js.bx+js.dx,js.by+js.dy,14,0,6.283); g.fillStyle="rgba(140,160,220,.35)"; g.fill();
|
||||||
|
}
|
||||||
|
if(glitchT>0) g.restore();
|
||||||
|
}
|
||||||
|
|
||||||
|
// ————— boucle —————
|
||||||
|
var raf=0;
|
||||||
|
function tick(){
|
||||||
|
if(dead) return;
|
||||||
|
raf=requestAnimationFrame(tick);
|
||||||
|
if(playing){ step(); if(playing) draw(); }
|
||||||
|
}
|
||||||
|
|
||||||
|
// ————— câblage —————
|
||||||
|
window.addEventListener("keydown",kd);
|
||||||
|
window.addEventListener("keyup",ku);
|
||||||
|
window.addEventListener("resize",fit);
|
||||||
|
cv.addEventListener("touchstart",ts,{passive:false});
|
||||||
|
cv.addEventListener("touchmove",tm,{passive:false});
|
||||||
|
cv.addEventListener("touchend",te);
|
||||||
|
cv.addEventListener("touchcancel",te);
|
||||||
|
|
||||||
|
fit();
|
||||||
|
loadState(function(){
|
||||||
|
if(dead) return;
|
||||||
|
hud();
|
||||||
|
if(voyages===0 && univIndex===0) hypersleep("◇◇◇", UNIS[0], enterUniverse);
|
||||||
|
else enterUniverse();
|
||||||
|
});
|
||||||
|
raf=requestAnimationFrame(tick);
|
||||||
|
|
||||||
|
return { unmount: function(){
|
||||||
|
dead=true; playing=false;
|
||||||
|
try{ cancelAnimationFrame(raf); }catch(e){}
|
||||||
|
if(typT) clearInterval(typT);
|
||||||
|
if(toastT) clearTimeout(toastT);
|
||||||
|
window.removeEventListener("keydown",kd);
|
||||||
|
window.removeEventListener("keyup",ku);
|
||||||
|
window.removeEventListener("resize",fit);
|
||||||
|
try{ speechSynthesis.cancel(); }catch(e){}
|
||||||
|
try{ if(AC) AC.close(); }catch(e){}
|
||||||
|
container.innerHTML="";
|
||||||
|
}};
|
||||||
|
}
|
||||||
|
|
||||||
|
window.jOSApps = window.jOSApps || {};
|
||||||
|
// ===== XUI (contrat v0, bion jOSXui) : describe() = mon voyage inter-univers, non monté =====
|
||||||
|
// p1 = l'univers où je suis (LA donnée maîtresse : jos:multivers {v:voyages,u:univIndex},
|
||||||
|
// le même état que save/loadState) ; p2 = pouvoirs du pokedex (jos:pokedex). Ne throw jamais.
|
||||||
|
function describe(){
|
||||||
|
var items=[];
|
||||||
|
try{
|
||||||
|
var d=null; try{ d=JSON.parse(localStorage.getItem(LS)||"null"); }catch(e){}
|
||||||
|
var u=UNIS[clamp(((d&&d.u)|0),0,UNIS.length-1)]||UNIS[0];
|
||||||
|
items.push({ p:1, kind:"stat", label:"🌌 univers", value:(u.icon||"")+" "+u.name+" ("+u.higgs+")" });
|
||||||
|
items.push({ p:2, kind:"stat", label:"voyages", value:((d&&d.v)|0) });
|
||||||
|
var dex=[]; try{ dex=JSON.parse(localStorage.getItem("jos:pokedex")||"[]")||[]; }catch(e){} if(!(dex instanceof Array)) dex=[];
|
||||||
|
items.push({ p:2, kind:"stat", label:"pouvoirs gagnés", value:dex.length+" / "+UNIS.length });
|
||||||
|
if(dex.length) items.push({ p:3, kind:"list", label:"pokedex", items:dex.slice(-4).reverse().map(function(p){
|
||||||
|
return { label:String((p&&p.icone)||"✦"), value:String((p&&p.nom)||"pouvoir") }; }) });
|
||||||
|
}catch(e){ items=[{ p:1, kind:"text", label:"🌌 multivers", value:"voyage indisponible" }]; }
|
||||||
|
return { v:1, id:"multivers", title:"Multivers", icon:"🌌", items:items };
|
||||||
|
}
|
||||||
|
|
||||||
|
window.jOSApps["multivers"] = { manifest: { id: "multivers", name: "Multivers", icon: "🌌" }, mount: mount, describe: describe };
|
||||||
|
})();
|
||||||
|
</script>
|
||||||
Loading…
Reference in New Issue
Block a user