feat(achievements): remove secret achievements and add new ones. also play sound only when notification comes up instead of instantly
This commit is contained in:
@@ -6,6 +6,8 @@ const { onRender } = useScreen();
|
||||
const achievements = useAchievementsStore();
|
||||
const { assets } = useAssets();
|
||||
|
||||
const confetti = useConfetti();
|
||||
|
||||
const queue = ref<Achievement[]>([]);
|
||||
const currentAchievement = ref<Achievement | null>(null);
|
||||
const x = ref(LOGICAL_WIDTH);
|
||||
@@ -20,16 +22,16 @@ const NOTIF_X_VISIBLE = LOGICAL_WIDTH - NOTIF_WIDTH;
|
||||
const TEXT_X_OFFSET = LOGO_SIZE + PADDING * 2;
|
||||
const LINE_HEIGHT = 8;
|
||||
|
||||
achievements.$onAction(({ name, args, after }) => {
|
||||
if (name === "unlock") {
|
||||
after((wasUnlocked) => {
|
||||
if (wasUnlocked) {
|
||||
queue.value.push(args[0]);
|
||||
processQueue();
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
watch(
|
||||
() => achievements.unlocked,
|
||||
(newVal, oldVal) => {
|
||||
const added = newVal.filter((id) => !oldVal?.includes(id));
|
||||
for (const id of added) {
|
||||
queue.value.push(id);
|
||||
}
|
||||
if (added.length > 0) processQueue();
|
||||
},
|
||||
);
|
||||
|
||||
const processQueue = () => {
|
||||
if (isAnimating.value || queue.value.length === 0) return;
|
||||
@@ -40,6 +42,14 @@ const processQueue = () => {
|
||||
currentAchievement.value = next;
|
||||
isAnimating.value = true;
|
||||
|
||||
assets.audio.messageReceived.play(0.5);
|
||||
|
||||
if (next === "all_achievements") {
|
||||
confetti.spawn();
|
||||
} else {
|
||||
confetti.spawn(50, 175);
|
||||
}
|
||||
|
||||
gsap
|
||||
.timeline()
|
||||
.to(x, {
|
||||
|
||||
@@ -100,6 +100,8 @@ const handleActivateA = async (button: typeof selected.value) => {
|
||||
|
||||
if (button === "git") {
|
||||
achievements.unlock("contact_git_visit");
|
||||
} else if (button === "linkedin") {
|
||||
achievements.unlock("contact_linkedin_visit");
|
||||
}
|
||||
},
|
||||
});
|
||||
|
||||
@@ -291,13 +291,6 @@ const handleActivateA = () => {
|
||||
achievements.unlock("settings_color_change");
|
||||
}
|
||||
|
||||
if (!achievements.advancement.colors.includes(app.color.hex)) {
|
||||
achievements.advancement.colors.push(app.color.hex);
|
||||
if (achievements.advancement.colors.length === APP_COLORS.flat().length) {
|
||||
achievements.unlock("settings_color_try_all");
|
||||
}
|
||||
}
|
||||
|
||||
confirmationModal.open({
|
||||
text: $t("settings.user.color.confirmation"),
|
||||
onClosed: async () => {
|
||||
|
||||
Reference in New Issue
Block a user