Inez Game
Build and Push Docker Images / build-and-push (push) Failing after 56s

This commit is contained in:
Bram committed 2026-11-05 13:52:59 +01:00
1 parent 8855d36684
commit 73baba74b1
10 files changed
+4565

No files matched your search

+148
View File
@@ -0,0 +1,148 @@
const App = (function () {
let state = Storage.load();
let currentLevelId = null;
let levelHandle = null;
let levelFinishing = false;
function validateConfig() {
const errors = [];
const games = GAME_CONFIG.games;
const expected = Levels.count;
if (!Array.isArray(games) || games.length !== expected) {
errors.push("er moeten precies " + expected + " games in GAME_CONFIG.games staan.");
} else {
games.forEach(function (game, index) {
if (!game || !game.title) {
errors.push("game " + (index + 1) + " heeft geen titel.");
return;
}
if (!game.appId && !game.url && !game.key) {
errors.push("game " + (index + 1) + " heeft geen appId, url of key.");
}
});
}
if (!GAME_CONFIG.herName) errors.push("de naam van de jarige ontbreekt.");
return errors;
}
function init() {
UI.init();
UI.setState(state);
UI.renderMap();
UI.showScreen("welcome");
const errors = validateConfig();
if (errors.length > 0) {
UI.showConfigError(errors);
}
}
function destroyLevel() {
if (levelHandle) {
levelHandle.destroy();
levelHandle = null;
}
currentLevelId = null;
levelFinishing = false;
UI.setHint("");
}
function goToMap() {
destroyLevel();
UI.renderMap();
UI.showScreen("map");
}
function goHome() {
if (currentLevelId !== null) {
destroyLevel();
UI.renderMap();
UI.toast("Je kunt dit level later opnieuw doen.");
}
UI.showScreen("map");
}
function startLevel(id) {
if (id < 1 || id > Levels.count) return;
const completed = state.completed.indexOf(id) !== -1;
if (id > state.unlocked && !completed) {
UI.toast("Dit level is nog niet open.");
return;
}
destroyLevel();
currentLevelId = id;
UI.showLevel(id);
levelHandle = Levels.mount(id, document.getElementById("level-stage"), {
hint: function (message) { UI.setHint(message); },
onComplete: function () { finishLevel(id); }
});
}
function finishLevel(id) {
if (currentLevelId !== id || levelFinishing) return;
levelFinishing = true;
const firstTime = state.completed.indexOf(id) === -1;
if (firstTime) {
state.completed.push(id);
state.completed.sort(function (a, b) { return a - b; });
state.unlocked = Math.max(state.unlocked, Math.min(Levels.count, id + 1));
Storage.save(state);
UI.setState(state);
}
const gameIndex = id - 1;
if (state.revealed.indexOf(gameIndex) === -1) {
const markRevealed = function () {
if (state.revealed.indexOf(gameIndex) !== -1) return;
state.revealed.push(gameIndex);
state.revealed.sort(function (a, b) { return a - b; });
Storage.save(state);
UI.setState(state);
};
UI.showReveal(gameIndex, function () {
markRevealed();
destroyLevel();
UI.renderMap();
if (state.completed.length === Levels.count && state.revealed.length === Levels.count) {
UI.showFinale();
} else {
UI.showScreen("map");
}
}, { onSteamOpen: markRevealed });
return;
}
destroyLevel();
UI.renderMap();
UI.toast(firstTime ? "Level voltooid!" : "Mooi opnieuw gedaan!");
UI.showScreen("map");
}
function resetGame() {
state = Storage.reset();
destroyLevel();
UI.setState(state);
UI.renderMap();
UI.showScreen("welcome");
UI.toast("De tuin is opnieuw begonnen.");
}
return {
init: init,
goToMap: goToMap,
goHome: goHome,
startLevel: startLevel,
resetGame: resetGame
};
})();
App.init();