From 933d57228a56dd148cc7686b6c1b3be3df4cfb79 Mon Sep 17 00:00:00 2001 From: Frederic Jung Date: Sun, 25 Oct 2026 10:08:26 +0100 Subject: [PATCH] Pitch installing the app to phone players before a new game --- site/i18n/it.js | 27 ++++++++++++++++++++++++--- site/index.html | 32 +++++++++++++++++++++++++------- tests/modes.test.js | 36 ++++++++++++++++++++++++++++++++++++ 3 files changed, 85 insertions(+), 10 deletions(-) diff --git a/site/i18n/it.js b/site/i18n/it.js index 4f849e2..5fabea4 100644 --- a/site/i18n/it.js +++ b/site/i18n/it.js @@ -2024,9 +2024,6 @@ "Full screen, works offline, one tap from your home screen.":"A schermo intero, funziona offline, a un tocco dalla schermata Home.", "Install":"Installa", "Game":"Gioco", -"Play it like an app":"Giocalo come un’app", -"Add to your home screen":"Aggiungi alla schermata Home", -"On iPhone and iPad: tap the Share button in Safari, then “Add to Home Screen”. Series of Tubes then opens full screen, like an app, and keeps working offline.":"Su iPhone e iPad: tocca il pulsante Condividi in Safari, poi “Aggiungi alla schermata Home”. Series of Tubes si aprirà a schermo intero, come un’app, e funzionerà anche offline.", "Speed":"Velocità", "The North’s hub, with its own exchange and very damp air-conditioning intakes. Cables to Ireland and Denmark come ashore up the coast.":"Lo snodo del Nord, con il suo exchange e prese d’aria dei condizionatori molto umide. I cavi per l’Irlanda e la Danimarca arrivano sulla costa poco più su.", "Scotland’s capital. North Sea cables to Norway and the Faroes land up the coast.":"La capitale della Scozia. I cavi del Mare del Nord verso la Norvegia e le Fær Øer approdano lungo la costa.", @@ -2101,4 +2098,28 @@ "{n} connection":"{n} connessione", "{n} connections":"{n} connessioni", "+{n} more":"+{n} altre", +"Installed!
Open Series of Tubes from your home screen. Your saves come along.":"Installato!
Apri Series of Tubes dalla schermata Home. I tuoi salvataggi vengono con te.", +"Best played as an app":"Meglio come app", +"Install it before you start: a game begun in Safari stays in Safari.":"Installala prima di iniziare: una partita cominciata in Safari resta in Safari.", +"Tap Share {icon} in the browser toolbar.":"Tocca Condividi {icon} nella barra del browser.", +"Tap Add to Home Screen. You may need to scroll down, or tap More first.":"Tocca Aggiungi alla schermata Home. Potrebbe servire scorrere in basso, o toccare prima Altro.", +"Open Series of Tubes from your home screen and start your network there.":"Apri Series of Tubes dalla schermata Home e avvia lì la tua rete.", +"Open your browser menu (⋮).":"Apri il menu del browser (⋮).", +"Tap Install app or Add to Home screen.":"Tocca Installa app o Aggiungi a schermata Home.", +"Open Series of Tubes from your home screen.":"Apri Series of Tubes dalla schermata Home.", +"Before you start":"Prima di iniziare", +"Play it as an app":"Giocalo come un’app", +"Series of Tubes is made for your home screen. It takes ten seconds, costs nothing, and it is a much better game there:":"Series of Tubes è fatto per la schermata Home. Ci vogliono dieci secondi, non costa nulla, e lì è un gioco molto migliore:", +"Full screen.":"Schermo intero.", +"No browser bars, a lot more map.":"Niente barre del browser, molta più mappa.", +"Works offline.":"Funziona offline.", +"Build your backbone on the train or on a plane.":"Costruisci la tua dorsale in treno o in aereo.", +"Your save stays safe.":"Il salvataggio resta al sicuro.", +"Safari can clear the data of websites you have not opened for a week. A home-screen app keeps its own.":"Safari può cancellare i dati dei siti che non apri da una settimana. Un’app sulla schermata Home tiene i suoi.", +"Install first.":"Prima installa.", +"On iPhone, a game started in Safari does not carry over to the home-screen app.":"Su iPhone, una partita iniziata in Safari non passa all’app sulla schermata Home.", +"One tap away.":"A un tocco di distanza.", +"It opens straight into your network, like any other app.":"Si apre direttamente sulla tua rete, come qualsiasi altra app.", +"Install the app":"Installa l’app", +"Play in the browser anyway":"Gioca comunque nel browser", }; diff --git a/site/index.html b/site/index.html index 786dc5e..0515d98 100644 --- a/site/index.html +++ b/site/index.html @@ -373,6 +373,9 @@ input.t{width:100%;box-sizing:border-box;border:3px solid var(--ink);border-radi A decluttered, app-like layout: a one-row status strip at the top, a tab bar at the bottom (play, speed, goals, deals, NOC, networks), and bottom sheets you drag up, down or away. */ html,body{overscroll-behavior:none} +.pitch{list-style:none;padding:0;margin:10px 0}.pitch li{margin:7px 0;line-height:1.38;font-size:14px}.pitch li.warn{background:#FFF4D6;border:2px solid var(--ink);border-radius:10px;padding:6px 8px} +.isteps{padding-left:22px;margin:8px 0 4px}.isteps li{margin:5px 0;line-height:1.38;font-size:14px}.isteps svg{vertical-align:-3px} +.icard{margin:8px 0 10px;border:2.5px solid var(--ink);border-radius:14px;padding:8px 10px;background:#FFF4D6} /* iPhone home-screen app with a viewport shorter than the screen: the page box takes the real screen height and becomes the containing block for everything fixed, so bottom-anchored UI reaches the bottom. */ html.iosfix,html.iosfix body{height:var(--app-h)} @@ -1275,7 +1278,7 @@ const WEEK_MODS=[{id:'pricey',n:tr('Transit costs 30% more')},{id:'chaos',n:tr(' function weekly(){const {y,w}=isoWeek(new Date());let r=(y*100+w)*2654435761>>>0;const nx=()=>{r=(r*1103515245+12345)>>>0;return r/4294967296;};const city=WEEK_CITIES[Math.floor(nx()*WEEK_CITIES.length)];const mods=[];while(mods.length<2){const m=WEEK_MODS[Math.floor(nx()*WEEK_MODS.length)];if(!mods.includes(m))mods.push(m);}return {id:'weekly',key:`${y}-W${String(w).padStart(2,'0')}`,seed:y*100+w,city,mods,days:365};} const scnRule=k=>!!(S&&S.scn&&S.scn.rules&&S.scn.rules[k]); function scnHof(){try{return JSON.parse(localStorage.getItem('sot-scn')||'{}')||{};}catch(e){return {};}} -function beginGame(nm,city,o={}){newGame(nm,city);S.mode=o.mode||'normal'; +function beginGame(nm,city,o={}){if(needPitch()&&!UI.pitched){UI.pendGame=[nm,city,o];openModal(pitchHtml(true));return;}newGame(nm,city);S.mode=o.mode||'normal'; if(S.mode==='sandbox'){S.cash=1e9;S.lvl=4;S.nextFail=1e9;S.nextEvent=1e9;} if(o.scn){const sc=o.scn;S.scn={id:sc.id,rules:sc.rules||{},days:sc.days,name:sc.n||tr('Weekly challenge {key}',{key:sc.key}),key:sc.key||null,mods:(sc.mods||[]).map(m=>m.id)};S.rng=(o.seed||hstr(sc.id))|0;S.mode='scenario';S.asn=200000+Math.floor(Math.random()*15000); if(sc.cash)S.cash=sc.cash;if(sc.setup)sc.setup(); @@ -2416,7 +2419,8 @@ const ACT={ phonePlay:()=>{haptic(10);if(UI.speed){UI.lastSpeed=UI.speed;UI.speed=0;}else UI.speed=UI.lastSpeed||1;renderHUD();}, phoneSpeed:()=>{haptic(8);const cur=UI.speed||UI.lastSpeed||1,i=SPEEDS.indexOf(cur),n=SPEEDS[(i+1)%SPEEDS.length];UI.speed=n;UI.lastSpeed=n;renderHUD();}, install:()=>{if(installEvt){installEvt.prompt();installEvt.userChoice.finally(()=>{installEvt=null;});return;} - openModal(`

${tr('Add to your home screen')}

${tr('On iPhone and iPad: tap the Share button in Safari, then “Add to Home Screen”. Series of Tubes then opens full screen, like an app, and keeps working offline.')}

${btn(tr('Got it'),'closeModal',{},'pink')}
`);}, + openModal(pitchHtml(false));}, + pitchSkip:()=>{const p=UI.pendGame;UI.pendGame=null;UI.pitched=true;if(p)beginGame(...p);else closeModal();}, focusCity:({city})=>{selectCity(city);const C=CITY[city];cam.x=C.x;cam.y=C.y;cam.z=Math.max(cam.z,1.2);if(innerWidth<760)UI.leftOpen=false;renderLeft();}, selLink:({id})=>{UI.sel={type:'link',id};UI.confirm=null;renderPanel();}, buildPop:({city})=>{if(S.pops[city])return;if(cnCity(city)&&!cnOk()){toast(tr('You need a license first.
Foreign networks need a joint venture to build in mainland China.'),'bad');sfx('err');return;}if(!spend(popCost(city)))return;S.pops[city]={day:S.day,bb:null,boost:0,down:0,routers:1,gen:false};floater(CITY[city].x,CITY[city].y-30,tr('New POP!'),'#FF4F9A');UI.tab='cust';after();}, @@ -2586,7 +2590,7 @@ const ACT={ importPick:()=>{let f=$('importIn');if(!f){f=document.createElement('input');f.type='file';f.accept='.json,application/json';f.id='importIn';f.hidden=true;document.body.appendChild(f);f.addEventListener('change',()=>{importFile(f.files[0]);f.value='';});}f.click();}, importGo:()=>{const s0=UI.importing;if(!s0)return;UI.importing=null;const prev=S;try{S=migrate(JSON.parse(JSON.stringify(s0)));compute();checkGoals();renderAll();}catch(e){S=prev;if(S)compute();renderAll();toast(tr('Import failed.
That save is damaged and could not be loaded. Your current game is untouched.'),'bad');sfx('err');return;}UI.confirm=null;$('bankBox').hidden=true;$('dash').hidden=true;UI.started=true;UI.sel=null;UI.speed=S.uiSpeed===undefined?1:S.uiSpeed;if(S.cam&&isFinite(S.cam.x))Object.assign(cam,S.cam);else{const h=CITY[S.home];if(h){cam.x=h.x;cam.y=h.y;}}closeModal();$('modal').hidden=true;compute();renderAll();save();toast(tr('Welcome back, {name}.
Imported and saved on this device.',{name:esc(S.name)}),'good');sfx('coin');track('game_import');}, menu:()=>{if(!S||!UI.started){showTitle();return;}openModal(`
AS${S.asn} · ${esc(dateStr(S.day))} · ${tierLabel()}

${esc(S.name)}

-

${tr('Your game saves itself every few seconds on this device.')}

+

${tr('Your game saves itself every few seconds on this device.')}

${isPhone()?installRow():''}