This commit is contained in:
Renan LE CARO 2025-04-20 12:56:50 +02:00
parent 1ba55bf2a6
commit 4d7d57f17f
15 changed files with 165 additions and 120 deletions

View file

@ -24,10 +24,10 @@ Other translation are very welcome, contact me if you'd like to submit one.
## To do ## To do
- in apk, video download doesnt work - in apk, video download doesnt work
-
## Done ## Done
- ask for permanent storage
- option: reuse past frame's light in new frame lighting computation when there are 150+ coins on screen, to limit the performance impact of rendering lots of lights - option: reuse past frame's light in new frame lighting computation when there are 150+ coins on screen, to limit the performance impact of rendering lots of lights
## 29084606 ## 29084606
@ -423,7 +423,6 @@ Other translation are very welcome, contact me if you'd like to submit one.
## Game engine features ideas ## Game engine features ideas
- add a clickable button to allow sound to play in chrome android - add a clickable button to allow sound to play in chrome android
- save state in localstorage for easy resume of a game in progress - save state in localstorage for easy resume of a game in progress
- ask for permanent storage
- handle back bouton in menu - handle back bouton in menu
- Offline mode web for iphone - Offline mode web for iphone
- controller support on web/mobile - controller support on web/mobile

120
dist/index.html vendored

File diff suppressed because one or more lines are too long

View file

@ -109,7 +109,7 @@ body:not(.has-alert-open) #popup {
#popup { #popup {
&::before { &::before {
z-index: 10; z-index: 4;
content: ""; content: "";
display: block; display: block;
position: fixed; position: fixed;
@ -121,7 +121,7 @@ body:not(.has-alert-open) #popup {
overflow: auto; overflow: auto;
& > div { & > div {
z-index: 11; z-index: 5;
position: relative; position: relative;
margin: auto; margin: auto;
padding: 20px 10px; padding: 20px 10px;
@ -224,7 +224,7 @@ body:not(.has-alert-open) #popup {
border: none; border: none;
cursor: pointer; cursor: pointer;
overflow: hidden; overflow: hidden;
z-index: 12; z-index: 6;
&:before { &:before {
content: "+"; content: "+";
@ -269,45 +269,6 @@ body:not(.has-alert-open) #popup {
} }
} }
/*Unlocks progress bar*/
.progress {
display: block;
padding: 5px 10px;
background: #1c1c2f;
color: #fff;
box-shadow: inset 3px 3px 5px rgba(0, 0, 0, 0.5);
border-radius: 5px;
text-align: center;
position: relative;
overflow: hidden;
& > .progress_bar_part {
display: block;
background: #4049ca;
box-shadow: inset 3px 3px 5px rgba(0, 0, 0, 0.5);
left: 0;
position: absolute;
right: 0;
top: 0;
bottom: 0;
transform-origin: top left;
animation: grow 1s both ease-out;
z-index: 1;
}
& > span {
display: block;
position: relative;
z-index: 2;
}
@keyframes grow {
0% {
transform: scale(0, 1);
}
}
}
#level-recording-container { #level-recording-container {
max-width: 400px; max-width: 400px;
text-align: center; text-align: center;
@ -462,7 +423,7 @@ h2.histogram-title strong {
background: black; background: black;
color: white; color: white;
padding: 10px; padding: 10px;
z-index: 11; z-index: 5;
border-radius: 2px; border-radius: 2px;
pointer-events: none; pointer-events: none;
@ -539,6 +500,7 @@ h2.histogram-title strong {
transition: transition:
opacity 200ms, opacity 200ms,
transform 200ms; transform 200ms;
z-index: 7;
&.hidden { &.hidden {
opacity: 0; opacity: 0;
transform: translate(-20px, -20px) scale(0.5); transform: translate(-20px, -20px) scale(0.5);

View file

@ -74,7 +74,6 @@ import {
requiredAsyncAlert, requiredAsyncAlert,
} from "./asyncAlert"; } from "./asyncAlert";
import { isOptionOn, options, toggleOption } from "./options"; import { isOptionOn, options, toggleOption } from "./options";
import { hashCode } from "./getLevelBackground";
import { import {
catchRateBest, catchRateBest,
catchRateGood, catchRateGood,
@ -701,7 +700,7 @@ async function openSettingsMenu() {
"precise_lighting", "precise_lighting",
"probabilistic_lighting", "probabilistic_lighting",
].includes(key)) || ].includes(key)) ||
(isInWebView && key == "record") || // (isInWebView && key == "record") ||
false, false,
value: () => { value: () => {
toggleOption(key); toggleOption(key);

View file

@ -9,7 +9,7 @@ import {
pickedUpgradesHTMl, pickedUpgradesHTMl,
reasonLevelIsLocked, reasonLevelIsLocked,
} from "./game_utils"; } from "./game_utils";
import { getSettingValue, getTotalScore, setSettingValue } from "./settings"; import {askForPersistentStorage, getSettingValue, getTotalScore, setSettingValue} from "./settings";
import { stopRecording } from "./recording"; import { stopRecording } from "./recording";
import { asyncAlert } from "./asyncAlert"; import { asyncAlert } from "./asyncAlert";
import { rawUpgrades } from "./upgrades"; import { rawUpgrades } from "./upgrades";
@ -30,6 +30,7 @@ export function gameOver(title: string, intro: string) {
gameState.isGameOver = true; gameState.isGameOver = true;
pause(true); pause(true);
askForPersistentStorage()
stopRecording(); stopRecording();
addToTotalPlayTime(gameState.runStatistics.runTime); addToTotalPlayTime(gameState.runStatistics.runTime);

View file

@ -218,6 +218,8 @@
"settings.smooth_lighting_help": "", "settings.smooth_lighting_help": "",
"settings.sounds": "أصوات اللعبة", "settings.sounds": "أصوات اللعبة",
"settings.sounds_help": "أصوات صفير وبلبل و برررر", "settings.sounds_help": "أصوات صفير وبلبل و برررر",
"settings.storage_granted": "",
"settings.storage_refused": "",
"settings.stress_test": "", "settings.stress_test": "",
"settings.stress_test_help": "", "settings.stress_test_help": "",
"starting_perks.checked": "عند بدء لعبة جديدة، ستُمنح إحدى هذه المزايا. انقر على أي ميزة لاستبعادها.", "starting_perks.checked": "عند بدء لعبة جديدة، ستُمنح إحدى هذه المزايا. انقر على أي ميزة لاستبعادها.",

View file

@ -7767,6 +7767,76 @@
</translation> </translation>
</translations> </translations>
</concept_node> </concept_node>
<concept_node>
<name>storage_granted</name>
<description/>
<comment/>
<translations>
<translation>
<language>ar-LB</language>
<approved>false</approved>
</translation>
<translation>
<language>de-DE</language>
<approved>false</approved>
</translation>
<translation>
<language>en-US</language>
<approved>false</approved>
</translation>
<translation>
<language>es-CL</language>
<approved>false</approved>
</translation>
<translation>
<language>fr-FR</language>
<approved>false</approved>
</translation>
<translation>
<language>ru-RU</language>
<approved>false</approved>
</translation>
<translation>
<language>tr-TR</language>
<approved>false</approved>
</translation>
</translations>
</concept_node>
<concept_node>
<name>storage_refused</name>
<description/>
<comment/>
<translations>
<translation>
<language>ar-LB</language>
<approved>false</approved>
</translation>
<translation>
<language>de-DE</language>
<approved>false</approved>
</translation>
<translation>
<language>en-US</language>
<approved>false</approved>
</translation>
<translation>
<language>es-CL</language>
<approved>false</approved>
</translation>
<translation>
<language>fr-FR</language>
<approved>false</approved>
</translation>
<translation>
<language>ru-RU</language>
<approved>false</approved>
</translation>
<translation>
<language>tr-TR</language>
<approved>false</approved>
</translation>
</translations>
</concept_node>
<concept_node> <concept_node>
<name>stress_test</name> <name>stress_test</name>
<description/> <description/>

View file

@ -218,6 +218,8 @@
"settings.smooth_lighting_help": "", "settings.smooth_lighting_help": "",
"settings.sounds": "Spiel-Sounds", "settings.sounds": "Spiel-Sounds",
"settings.sounds_help": "Piepsen, Bloops und Brrrr", "settings.sounds_help": "Piepsen, Bloops und Brrrr",
"settings.storage_granted": "",
"settings.storage_refused": "",
"settings.stress_test": "", "settings.stress_test": "",
"settings.stress_test_help": "", "settings.stress_test_help": "",
"starting_perks.checked": "Wenn Sie ein neues Spiel beginnen, wird Ihnen eine dieser Vergünstigungen angeboten. Klicken Sie auf eine Vergünstigung, um sie auszuschließen.", "starting_perks.checked": "Wenn Sie ein neues Spiel beginnen, wird Ihnen eine dieser Vergünstigungen angeboten. Klicken Sie auf eine Vergünstigung, um sie auszuschließen.",

View file

@ -218,6 +218,8 @@
"settings.smooth_lighting_help": "Blur the background light effects to make them look less square. Increases lag.", "settings.smooth_lighting_help": "Blur the background light effects to make them look less square. Increases lag.",
"settings.sounds": "Game sounds", "settings.sounds": "Game sounds",
"settings.sounds_help": "Beeps, bloops and brrrr", "settings.sounds_help": "Beeps, bloops and brrrr",
"settings.storage_granted": "Your high scores should now be saved permanently",
"settings.storage_refused": "Storage access refused, your high scores and unlocks might get lost",
"settings.stress_test": "Stress test", "settings.stress_test": "Stress test",
"settings.stress_test_help": "Start a bot controlled game with a very high number of coins, to test the performance limits of your device.", "settings.stress_test_help": "Start a bot controlled game with a very high number of coins, to test the performance limits of your device.",
"starting_perks.checked": "When you start a new game, one of those perks will be given to you. Click a perk to exclude it. ", "starting_perks.checked": "When you start a new game, one of those perks will be given to you. Click a perk to exclude it. ",

View file

@ -218,6 +218,8 @@
"settings.smooth_lighting_help": "", "settings.smooth_lighting_help": "",
"settings.sounds": "Sonidos del juego", "settings.sounds": "Sonidos del juego",
"settings.sounds_help": "Pitidos, bloops y brrrr", "settings.sounds_help": "Pitidos, bloops y brrrr",
"settings.storage_granted": "",
"settings.storage_refused": "",
"settings.stress_test": "", "settings.stress_test": "",
"settings.stress_test_help": "", "settings.stress_test_help": "",
"starting_perks.checked": "Al empezar una partida nueva, recibirás una de esas ventajas. Haz clic en una ventaja para excluirla.", "starting_perks.checked": "Al empezar una partida nueva, recibirás una de esas ventajas. Haz clic en una ventaja para excluirla.",

View file

@ -218,6 +218,8 @@
"settings.smooth_lighting_help": "", "settings.smooth_lighting_help": "",
"settings.sounds": "Sons du jeu", "settings.sounds": "Sons du jeu",
"settings.sounds_help": "Bips, bloops et brrrr", "settings.sounds_help": "Bips, bloops et brrrr",
"settings.storage_granted": "",
"settings.storage_refused": "",
"settings.stress_test": "", "settings.stress_test": "",
"settings.stress_test_help": "", "settings.stress_test_help": "",
"starting_perks.checked": "Lorsque vous démarrez une nouvelle partie, l'un de ces avantages vous sera attribué. Cliquez sur un avantage pour l'exclure.", "starting_perks.checked": "Lorsque vous démarrez une nouvelle partie, l'un de ces avantages vous sera attribué. Cliquez sur un avantage pour l'exclure.",

View file

@ -218,6 +218,8 @@
"settings.smooth_lighting_help": "", "settings.smooth_lighting_help": "",
"settings.sounds": "Звуки игры", "settings.sounds": "Звуки игры",
"settings.sounds_help": "Бипы, блепы и брррр", "settings.sounds_help": "Бипы, блепы и брррр",
"settings.storage_granted": "",
"settings.storage_refused": "",
"settings.stress_test": "", "settings.stress_test": "",
"settings.stress_test_help": "", "settings.stress_test_help": "",
"starting_perks.checked": "Когда вы начнете новую игру, вам будет дано одно из этих преимуществ. Щелкните по перку, чтобы исключить его.", "starting_perks.checked": "Когда вы начнете новую игру, вам будет дано одно из этих преимуществ. Щелкните по перку, чтобы исключить его.",

View file

@ -218,6 +218,8 @@
"settings.smooth_lighting_help": "", "settings.smooth_lighting_help": "",
"settings.sounds": "Oyun sesleri", "settings.sounds": "Oyun sesleri",
"settings.sounds_help": "Bipler, blooplar ve brrrr", "settings.sounds_help": "Bipler, blooplar ve brrrr",
"settings.storage_granted": "",
"settings.storage_refused": "",
"settings.stress_test": "", "settings.stress_test": "",
"settings.stress_test_help": "", "settings.stress_test_help": "",
"starting_perks.checked": "Yeni bir oyuna başladığınızda, bu avantajlardan biri size verilecektir. Bir avantajı hariç tutmak için tıklayın.", "starting_perks.checked": "Yeni bir oyuna başladığınızda, bu avantajlardan biri size verilecektir. Bir avantajı hariç tutmak için tıklayın.",

View file

@ -12,7 +12,7 @@ let mediaRecorder: MediaRecorder | null,
recordCanvasCtx: CanvasRenderingContext2D; recordCanvasCtx: CanvasRenderingContext2D;
export function recordOneFrame(gameState: GameState) { export function recordOneFrame(gameState: GameState) {
if (!isOptionOn("record") || isInWebView) { if (!isOptionOn("record") ) {
return; return;
} }
// if (!gameState.running) return; // if (!gameState.running) return;
@ -59,7 +59,7 @@ export function drawMainCanvasOnSmallCanvas(gameState: GameState) {
} }
export function startRecordingGame(gameState: GameState) { export function startRecordingGame(gameState: GameState) {
if (!isOptionOn("record") || isInWebView) { if (!isOptionOn("record") ) {
return; return;
} }
if (mediaRecorder) return; if (mediaRecorder) return;

View file

@ -1,5 +1,8 @@
// Settings // Settings
import {toast} from "./toast";
import {t} from "./i18n/i18n";
let cachedSettings: { [key: string]: unknown } = {}; let cachedSettings: { [key: string]: unknown } = {};
try { try {
@ -24,6 +27,7 @@ export function setSettingValue<T>(key: string, value: T) {
needsSaving.add(key); needsSaving.add(key);
cachedSettings[key] = value; cachedSettings[key] = value;
} }
export function commitSettingsChangesToLocalStorage() { export function commitSettingsChangesToLocalStorage() {
try { try {
for (let key of needsSaving) { for (let key of needsSaving) {
@ -49,3 +53,19 @@ export function getCurrentMaxParticles() {
export function cycleMaxCoins() { export function cycleMaxCoins() {
setSettingValue("max_coins", (getSettingValue("max_coins", 2) + 1) % 7); setSettingValue("max_coins", (getSettingValue("max_coins", 2) + 1) % 7);
} }
let asked=false
export function askForPersistentStorage(){
if(asked) return
asked=true
if (navigator.storage && navigator.storage.persist) {
navigator.storage.persist().then((persistent) => {
if (persistent) {
toast(t('settings.storage_granted'))
} else {
toast(t('settings.storage_refused'))
}
});
}
}