feat(achievements): distinguish regular and secret achievements

This commit is contained in:
2026-01-31 01:18:28 +01:00
parent 2814abfc32
commit d5e345a7ee
4 changed files with 26 additions and 24 deletions

View File

@@ -46,7 +46,7 @@ onRender((ctx) => {
i--
) {
const achievement = ACHIEVEMENTS[i]!;
const isUnlocked = achievementsStore.isUnlocked(achievement);
const isUnlocked = achievementsStore.isUnlocked(achievement.id);
const offset = store.getItemOffset(i);
if (offset === -ACHIEVEMENTS_LINE_HEIGHT) continue;
@@ -60,11 +60,12 @@ onRender((ctx) => {
ctx.fillStyle = "#000000";
ctx.fillRect(0, y, LOGICAL_WIDTH, ACHIEVEMENTS_LINE_HEIGHT);
// TODO: draw ??? for secret ones
ctx.fillStyle = isUnlocked ? "#ffffff" : "#666666";
drawCheckbox(ctx, ACHIEVEMENTS_X, y, isUnlocked);
ctx.fillText(
$t(`achievements.${achievement}`).replace("\n", " "),
achievement.secret && !isUnlocked
? "???"
: $t(`achievements.${achievement.id}`).replace("\n", " "),
ACHIEVEMENTS_X + CHECKBOX_SIZE + CHECKBOX_TEXT_GAP,
y,
);

View File

@@ -86,7 +86,7 @@ onRender((ctx) => {
ctx.font = "7px NDS7";
for (let i = ACHIEVEMENTS_TOP_SCREEN_COUNT - 1; i >= 0; i--) {
const achievement = ACHIEVEMENTS[i]!;
const isUnlocked = achievementsStore.isUnlocked(achievement);
const isUnlocked = achievementsStore.isUnlocked(achievement.id);
const offset = store.getItemOffset(i);
if (offset === -ACHIEVEMENTS_LINE_HEIGHT) continue;
@@ -98,11 +98,12 @@ onRender((ctx) => {
ctx.fillStyle = "#000000";
ctx.fillRect(0, y, LOGICAL_WIDTH, ACHIEVEMENTS_LINE_HEIGHT);
// TODO: draw ??? for secret ones
ctx.fillStyle = isUnlocked ? "#ffffff" : "#666666";
drawCheckbox(ctx, ACHIEVEMENTS_X, y, isUnlocked);
ctx.fillText(
$t(`achievements.${achievement}`).replace("\n", " "),
achievement.secret && !isUnlocked
? "???"
: $t(`achievements.${achievement.id}`).replace("\n", " "),
ACHIEVEMENTS_X + CHECKBOX_SIZE + CHECKBOX_TEXT_GAP,
y,
);