From d31f8ef0b466e22ae74270872688672f30f6d9c1 Mon Sep 17 00:00:00 2001 From: Renan LE CARO Date: Mon, 31 Mar 2025 20:13:47 +0200 Subject: [PATCH] Help --- app/build.gradle.kts | 4 +- app/src/main/assets/index.html | 2 +- dist/index.html | 48 +++++++-------- src/PWA/sw-b71.js | 2 +- src/data/levels.json | 2 +- src/data/version.json | 2 +- src/game.less | 2 +- src/game.ts | 4 +- src/help.ts | 60 ++++++++++--------- src/level_editor/levels_editor.less | 6 +- src/level_editor/levels_editor.tsx | 14 ++--- src/pure_functions.ts | 93 ++++++++++++++++------------- 12 files changed, 124 insertions(+), 115 deletions(-) diff --git a/app/build.gradle.kts b/app/build.gradle.kts index 06b41ae..fa999f6 100644 --- a/app/build.gradle.kts +++ b/app/build.gradle.kts @@ -11,8 +11,8 @@ android { applicationId = "me.lecaro.breakout" minSdk = 21 targetSdk = 34 - versionCode = 29056849 - versionName = "29056849" + versionCode = 29057409 + versionName = "29057409" testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner" vectorDrawables { useSupportLibrary = true diff --git a/app/src/main/assets/index.html b/app/src/main/assets/index.html index d5e5bad..6c7c12b 100644 --- a/app/src/main/assets/index.html +++ b/app/src/main/assets/index.html @@ -1 +1 @@ -Breakout 71
\ No newline at end of file +Breakout 71
\ No newline at end of file diff --git a/dist/index.html b/dist/index.html index eb1cda7..18c109c 100644 --- a/dist/index.html +++ b/dist/index.html @@ -192,7 +192,7 @@ body:not(.has-alert-open) #popup { border: none; width: 60px; height: 60px; - position: absolute; + position: fixed; top: 0; right: 0; overflow: hidden; @@ -1462,7 +1462,7 @@ const upgrades = (0, _upgrades.rawUpgrades).map((u)=>({ })); },{"./data/palette.json":"ktRBU","./data/levels.json":"8JSUc","./data/version.json":"iyP6E","./upgrades":"1u3Dx","./getLevelBackground":"7OIPf","./levelIcon":"6rQoT","@parcel/transformer-js/src/esmodule-helpers.js":"gkKU3"}],"iyP6E":[function(require,module,exports,__globalThis) { -module.exports = JSON.parse("\"29056849\""); +module.exports = JSON.parse("\"29057409\""); },{}],"1u3Dx":[function(require,module,exports,__globalThis) { var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); @@ -2207,39 +2207,39 @@ function hoursSpentPlaying() { function miniMarkDown(md) { let html = []; let lastNode = null; - md.split('\n').forEach((line)=>{ + md.split("\n").forEach((line)=>{ const titlePrefix = line.match(/^#+ /)?.[0]; if (titlePrefix) { if (lastNode) html.push(lastNode); lastNode = { - tagName: 'h' + (titlePrefix.length - 1), + tagName: "h" + (titlePrefix.length - 1), text: line.slice(titlePrefix.length) }; - } else if (line.startsWith('- ')) { - if (lastNode?.tagName !== 'ul') { + } else if (line.startsWith("- ")) { + if (lastNode?.tagName !== "ul") { if (lastNode) html.push(lastNode); lastNode = { - tagName: 'ul', - text: '' + tagName: "ul", + text: "" }; } - lastNode.text += '
  • ' + line.slice(2) + '
  • '; + lastNode.text += "
  • " + line.slice(2) + "
  • "; } else if (!line.trim()) { if (lastNode) html.push(lastNode); lastNode = null; } else { - if (lastNode?.tagName !== 'p') { + if (lastNode?.tagName !== "p") { if (lastNode) html.push(lastNode); lastNode = { - tagName: 'p', - text: '' + tagName: "p", + text: "" }; } - lastNode.text += line + ' '; + lastNode.text += line + " "; } }); if (lastNode) html.push(lastNode); - return html.map((h)=>'<' + h.tagName + '>' + h.text.replace(/\bhttps?:\/\/[^\s<>]+/gi, (a)=>`${a}`) + '').join('\n'); + return html.map((h)=>"<" + h.tagName + ">" + h.text.replace(/\bhttps?:\/\/[^\s<>]+/gi, (a)=>`${a}`) + "").join("\n"); } },{"@parcel/transformer-js/src/esmodule-helpers.js":"gkKU3"}],"6rQoT":[function(require,module,exports,__globalThis) { @@ -4747,19 +4747,17 @@ var _asyncAlert = require("./asyncAlert"); var _pureFunctions = require("./pure_functions"); function helpMenuEntry() { return { - icon: (0, _loadGameData.icons)['icon:help'], - text: (0, _i18N.t)('main_menu.help_title'), - help: (0, _i18N.t)('main_menu.help_help'), + icon: (0, _loadGameData.icons)["icon:help"], + text: (0, _i18N.t)("main_menu.help_title"), + help: (0, _i18N.t)("main_menu.help_help"), async value () { await (0, _asyncAlert.asyncAlert)({ - title: (0, _i18N.t)('main_menu.help_title'), + title: (0, _i18N.t)("main_menu.help_title"), allowClose: true, content: [ - (0, _pureFunctions.miniMarkDown)((0, _i18N.t)('main_menu.help_content')), - (0, _i18N.t)('main_menu.help_upgrades'), + (0, _pureFunctions.miniMarkDown)((0, _i18N.t)("main_menu.help_content")), + (0, _i18N.t)("main_menu.help_upgrades"), ...(0, _loadGameData.upgrades).map((u)=>` - -
    ${u.icon}

    @@ -4770,9 +4768,9 @@ function helpMenuEntry() { ${(0, _pureFunctions.miniMarkDown)(u.fullHelp)} `), - (0, _pureFunctions.miniMarkDown)((0, _i18N.t)('main_menu.credits')), - (0, _i18N.t)('main_menu.credit_levels'), - ...(0, _loadGameData.allLevels).filter((l)=>l.credit?.startsWith('http')).map((l)=>` + (0, _pureFunctions.miniMarkDown)((0, _i18N.t)("main_menu.credits")), + (0, _i18N.t)("main_menu.credit_levels"), + ...(0, _loadGameData.allLevels).filter((l)=>l.credit?.startsWith("http")).map((l)=>`

    ${(0, _loadGameData.icons)[l.name]}

    diff --git a/src/PWA/sw-b71.js b/src/PWA/sw-b71.js index 2f7d388..66e50a6 100644 --- a/src/PWA/sw-b71.js +++ b/src/PWA/sw-b71.js @@ -1,5 +1,5 @@ // The version of the cache. -const VERSION = "29056849"; +const VERSION = "29057409"; // The name of the cache const CACHE_NAME = `breakout-71-${VERSION}`; diff --git a/src/data/levels.json b/src/data/levels.json index 7c5be99..68a97b8 100644 --- a/src/data/levels.json +++ b/src/data/levels.json @@ -1108,4 +1108,4 @@ "color": "", "credit": "https://prohama.com/balloon-1/" } -] \ No newline at end of file +] diff --git a/src/data/version.json b/src/data/version.json index ca4dd19..05b7fcc 100644 --- a/src/data/version.json +++ b/src/data/version.json @@ -1 +1 @@ -"29056849" +"29057409" diff --git a/src/game.less b/src/game.less index 4534380..4aa24aa 100644 --- a/src/game.less +++ b/src/game.less @@ -189,7 +189,7 @@ body:not(.has-alert-open) #popup { button#close-modale { color: white; - position: absolute; + position: fixed; top: 0; right: 0; width: 60px; diff --git a/src/game.ts b/src/game.ts index 1a0d69f..7af060a 100644 --- a/src/game.ts +++ b/src/game.ts @@ -63,7 +63,7 @@ import { import { isOptionOn, options, toggleOption } from "./options"; import { hashCode } from "./getLevelBackground"; import { hoursSpentPlaying } from "./pure_functions"; -import {helpMenuEntry} from "./help"; +import { helpMenuEntry } from "./help"; export function play() { if (applyFullScreenChoice()) return; @@ -556,7 +556,7 @@ export async function openMainMenu() { openSettingsMenu(); }, }, - helpMenuEntry() + helpMenuEntry(), ]; const cb = await asyncAlert<() => void>({ diff --git a/src/help.ts b/src/help.ts index 378e8f0..4278d2e 100644 --- a/src/help.ts +++ b/src/help.ts @@ -1,23 +1,22 @@ -import {allLevels, icons, upgrades} from "./loadGameData"; -import {t} from "./i18n/i18n"; -import {asyncAlert} from "./asyncAlert"; -import {miniMarkDown} from "./pure_functions"; +import { allLevels, icons, upgrades } from "./loadGameData"; +import { t } from "./i18n/i18n"; +import { asyncAlert } from "./asyncAlert"; +import { miniMarkDown } from "./pure_functions"; export function helpMenuEntry() { - return { - icon: icons['icon:help'], - text: t('main_menu.help_title'), - help: t('main_menu.help_help'), - async value() { - await asyncAlert({ - title:t('main_menu.help_title'), - allowClose:true, - content:[ - miniMarkDown(t('main_menu.help_content')), - t('main_menu.help_upgrades'), - ...upgrades.map(u=>` - - + return { + icon: icons["icon:help"], + text: t("main_menu.help_title"), + help: t("main_menu.help_help"), + async value() { + await asyncAlert({ + title: t("main_menu.help_title"), + allowClose: true, + content: [ + miniMarkDown(t("main_menu.help_content")), + t("main_menu.help_upgrades"), + ...upgrades.map( + (u) => `

    ${u.icon}

    @@ -27,22 +26,25 @@ export function helpMenuEntry() {

    ${miniMarkDown(u.fullHelp)} -`), - miniMarkDown(t('main_menu.credits')), +`, + ), + miniMarkDown(t("main_menu.credits")), - t('main_menu.credit_levels'), - ...allLevels.filter(l=>l.credit?.startsWith('http')).map(l=>` + t("main_menu.credit_levels"), + ...allLevels + .filter((l) => l.credit?.startsWith("http")) + .map( + (l) => `
    ${icons[l.name]}

    ${l.name}
    ${l.credit}

    -
    `) - - ] - }) - } - } +
    `, + ), + ], + }); + }, + }; } - diff --git a/src/level_editor/levels_editor.less b/src/level_editor/levels_editor.less index 84e4354..5e4e14b 100644 --- a/src/level_editor/levels_editor.less +++ b/src/level_editor/levels_editor.less @@ -33,12 +33,12 @@ body { & > div { display: grid; grid-template-columns: auto auto; - grid-template-areas: "name credits" "buttons bricks"; - .name{ + grid-template-areas: "name credits" "buttons bricks"; + .name { grid-area: name; width: 100px; } - .credits{ + .credits { grid-area: credits; } diff --git a/src/level_editor/levels_editor.tsx b/src/level_editor/levels_editor.tsx index e69baf6..a511012 100644 --- a/src/level_editor/levels_editor.tsx +++ b/src/level_editor/levels_editor.tsx @@ -53,7 +53,7 @@ function App() { >
    {levels.map((level, li) => { - const { name,credit, bricks, size, svg, color } = level; + const { name, credit, bricks, size, svg, color } = level; const brickButtons = []; for (let x = 0; x < size; x++) { @@ -97,23 +97,19 @@ function App() { return (
    updateLevel(li, { name: e.target.value })} /> updateLevel(li, { credit: e.target.value })} /> - - -
    +