Keep the top bar on one row in every language
Longer Italian labels wrapped the HUD over the side panels on laptop widths. fitHud() now hides the less important readouts until the bar fits, whatever the language. Also shortens two Italian HUD labels and translates the How the Internet Works links.
This commit is contained in:
parent
f1ea017b39
commit
9315b37b82
3 changed files with 14 additions and 3 deletions
|
|
@ -6,6 +6,10 @@ All notable changes to this project are documented here. The project follows
|
|||
|
||||
## [Unreleased]
|
||||
|
||||
- The top bar fits itself to the screen in every language: when labels get
|
||||
long, the less important readouts step aside instead of wrapping over the
|
||||
side panels.
|
||||
|
||||
- Series of Tubes now speaks Italian. The game follows your browser's
|
||||
language the first time, and you can switch between English and Italian
|
||||
under Settings or on the title screen; the choice is remembered (#26, thanks @daniloctdev).
|
||||
|
|
|
|||
|
|
@ -1276,7 +1276,7 @@
|
|||
"{n}d left":"ancora {n}g",
|
||||
"{n} incident":"{n} incidente",
|
||||
"{n} incidents":"{n} incidenti",
|
||||
"All quiet":"Tutto tranquillo",
|
||||
"All quiet":"Tutto ok",
|
||||
"Goals":"Obiettivi",
|
||||
"Deals":"Offerte",
|
||||
"Reward {cash}":"Premio {cash}",
|
||||
|
|
@ -1886,7 +1886,7 @@
|
|||
"Series of Tubes: build the internet, one tube at a time":"Series of Tubes: costruisci internet, un tubo alla volta",
|
||||
"A free cartoon browser game about how the internet works. Start as a tiny network in one city, launch home broadband, buy IP transit from Tier 1 and Tier 2 carriers, peer at internet exchanges, set up private interconnects and embedded CDN caches, and lay terrestrial fiber, subsea waves and your own dark fiber with DWDM and ZR optics. Sign enterprise, hosting, high-frequency trading, AI GPU and hyperscaler customers, and keep them happy while backhoes, sharks, fat fingers, route leaks, DDoS attacks and geopolitics break things.":"Un gioco gratuito per browser, in stile cartoon, su come funziona internet. Parti come una minuscola rete in una sola città, lancia la banda larga domestica, compra IP transit da carrier Tier 1 e Tier 2, fai peering agli internet exchange, attiva interconnessioni private e cache CDN embedded, e posa fibra terrestre, wave sottomarine e la tua dark fiber con DWDM e ottiche ZR. Firma clienti aziendali, hosting, trading ad alta frequenza, GPU per l’IA e hyperscaler, e tienili contenti mentre ruspe, squali, dita grosse, route leak, attacchi DDoS e geopolitica rompono tutto.",
|
||||
"Cash · Bank":"Cassa · Banca",
|
||||
"Traffic served":"Traffico servito",
|
||||
"Traffic served":"Traffico",
|
||||
"Rank":"Rango",
|
||||
"Date":"Data",
|
||||
"Goals & NOC":"Obiettivi e NOC",
|
||||
|
|
|
|||
|
|
@ -365,6 +365,9 @@ input.t{width:100%;box-sizing:border-box;border:3px solid var(--ink);border-radi
|
|||
.speed button{min-width:26px;height:28px;font-size:11.5px}
|
||||
.chip{padding:2px 7px}
|
||||
}
|
||||
/* Whatever the language, the HUD stays on one row: fitHud() drops chips until it fits. */
|
||||
#hud.fit1 .hide-md2,#hud.fit2 .hide-md{display:none !important}
|
||||
#hud.fit3 .brand>div,#hud.fit3 .brand .caret{display:none}
|
||||
@media (max-width:760px){
|
||||
.chip{min-height:40px;padding:2px 8px}
|
||||
.chip .val{font-size:16px}
|
||||
|
|
@ -2345,6 +2348,9 @@ const logo=n=>`<span class="logo" style="--c:${n.col}">${initials(n)}</span>`;
|
|||
const barCls=u=>u>=0.9?'bad':u>=0.65?'warn':'';
|
||||
function renderAll(){if(isTablet()&&!UI.sel)UI.leftOpen=false;renderHUD();renderLeft();renderPanel();renderHint();renderMega();renderCoach();}
|
||||
function renderMega(){const el=$('mega');if(!el)return;const on=!!(S&&S.ev&&S.ev.php>S.day);if(el.hidden===!on)return;el.hidden=!on;}
|
||||
function fitHud(){const h=$('hud');if(!h)return;h.classList.remove('fit1','fit2','fit3');if(innerWidth<=760)return;
|
||||
const row=()=>{let m=0;for(const c of h.children)if(c.offsetParent)m=Math.max(m,c.offsetHeight);return m;};
|
||||
for(const c of ['fit1','fit2','fit3']){if(h.offsetHeight<=row()*1.5)break;h.classList.add(c);}}
|
||||
function renderHUD(){
|
||||
for(const v of [0,0.5,1,2,4,8]){const b=$('sp'+v);if(b)b.classList.toggle('on',UI.speed===v);}
|
||||
$('muteBtn').style.opacity=UI.muted?.4:1;
|
||||
|
|
@ -2360,6 +2366,7 @@ function renderHUD(){
|
|||
$('hDate').textContent=dateStr(S.day);
|
||||
{const bo=(S.loanOffers||[]).length,hb=$('hBank');hb.hidden=!bo;hb.textContent=bo;}
|
||||
const n=S.inc.length;$('hNoc').classList.toggle('hot',n>0);$('hNocVal').textContent=n?trn('{n} incident','{n} incidents',n):tr('All quiet');
|
||||
if(!window.__TUBES_TEST__)fitHud();
|
||||
}
|
||||
function renderLeft(){
|
||||
// Tablets in landscape: both side panels don't fit next to the map, so the left one tucks away
|
||||
|
|
@ -2834,7 +2841,7 @@ const cv=$('map'),ctx=cv.getContext('2d');
|
|||
const cam={x:1050,y:330,z:0.8};
|
||||
let CW=0,CH=0,DPR=1;
|
||||
function resize(){DPR=Math.min(2,window.devicePixelRatio||1);CW=innerWidth;CH=innerHeight;cv.width=CW*DPR;cv.height=CH*DPR;}
|
||||
addEventListener('resize',()=>{resize();WL.key=null;renderLeft();});resize();
|
||||
addEventListener('resize',()=>{resize();WL.key=null;renderLeft();fitHud();});resize();
|
||||
function rng(seed){return()=>{seed|=0;seed=seed+0x6D2B79F5|0;let t=Math.imul(seed^seed>>>15,1|seed);t=t+Math.imul(t^t>>>7,61|t)^t;return((t^t>>>14)>>>0)/4294967296;};}
|
||||
function inPoly(x,y,pts){let ins=false;for(let i=0,j=pts.length-1;i<pts.length;j=i++){const [xi,yi]=pts[i],[xj,yj]=pts[j];if(((yi>y)!==(yj>y))&&(x<(xj-xi)*(y-yi)/(yj-yi)+xi))ins=!ins;}return ins;}
|
||||
function smoothPath(pts){const p=new Path2D();const n=pts.length;const mid=(a,b)=>[(a[0]+b[0])/2,(a[1]+b[1])/2];let m=mid(pts[n-1],pts[0]);p.moveTo(m[0],m[1]);for(let i=0;i<n;i++){const nx=pts[(i+1)%n];m=mid(pts[i],nx);p.quadraticCurveTo(pts[i][0],pts[i][1],m[0],m[1]);}p.closePath();return p;}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue