From a72d8c720b9ed16574d1a282d3d07f3614e378d5 Mon Sep 17 00:00:00 2001 From: thepaperpilot Date: Sat, 24 Dec 2022 00:18:58 -0600 Subject: [PATCH] Make Christmas open automatically --- src/data/Day.vue | 6 +- src/data/projEntry.tsx | 245 ++++++++++++++++++++++------------------- 2 files changed, 138 insertions(+), 113 deletions(-) diff --git a/src/data/Day.vue b/src/data/Day.vue index a63ccc3..e47cb60 100644 --- a/src/data/Day.vue +++ b/src/data/Day.vue @@ -6,7 +6,7 @@ masteryLock, wallpaper: day < 8 }" - v-if="opened.value" + v-if="opened.value && visibility !== Visibility.None" >
@@ -26,7 +26,7 @@
import Notif from "components/Notif.vue"; +import { Visibility } from "features/feature"; import Tooltip from "features/tooltips/Tooltip.vue"; import { layers } from "game/layers"; import Decimal from "util/bignum"; @@ -66,6 +67,7 @@ const props = defineProps<{ recentlyUpdated: Ref; shouldNotify: ProcessedComputable; mastered: Ref; + visibility?: Visibility; }>(); const emit = defineEmits<{ diff --git a/src/data/projEntry.tsx b/src/data/projEntry.tsx index 6cd4fdd..0a79fac 100644 --- a/src/data/projEntry.tsx +++ b/src/data/projEntry.tsx @@ -4,7 +4,8 @@ import { Component, GatherProps, GenericComponent, - jsx + jsx, + Visibility } from "features/feature"; import { BaseLayer, createLayer, GenericLayer, layers } from "game/layers"; import { isPersistent, Persistent, persistent } from "game/persistence"; @@ -15,7 +16,7 @@ import { Computable, convertComputable, ProcessedComputable } from "util/compute import { createLazyProxy } from "util/proxies"; import { save } from "util/save"; import { render, renderRow, VueFeature } from "util/vue"; -import type { Ref } from "vue"; +import { Ref, watchEffect } from "vue"; import { computed, ref, unref } from "vue"; import "./advent.css"; import Day from "./Day.vue"; @@ -60,7 +61,7 @@ import toysSymbol from "./symbols/truck.png"; import advManagementSymbol from "./symbols/workshopMansion.png"; import wrappingPaperSymbol from "./symbols/wrappingPaper.png"; import snowflakeSymbol from "./symbols/snowflake.svg"; -import presentSymbol from "./layers/factory-components/present.svg" +import presentSymbol from "./layers/factory-components/present.svg"; import { createParticles } from "features/particles/particles"; import { credits } from "./credits"; @@ -74,6 +75,7 @@ export interface Day extends VueFeature { opened: Persistent; recentlyUpdated: Ref; // Has the tab recieved an update since the player last opened it? shouldNotify: ProcessedComputable; + visibility?: Visibility; } export const main = createLayer("main", function (this: BaseLayer) { @@ -96,112 +98,113 @@ export const main = createLayer("main", function (this: BaseLayer) { this.boundingRect.value = boundingRect; }, style: "z-index: -1" - })) + })); - particles.addEmitter({ - lifetime: {min: 5, max: 5}, - pos: {x: 0, y: 0}, - frequency: 0.05, - behaviors: [ - { - type: 'alpha', - config: { - alpha: { - list: [ - { - value: 1, - time: 0 - }, - { - value: 1, - time: 1 - } - ], - }, - } - }, - { - type: 'scale', - config: { - scale: { - list: [ - { - value: 1, - time: 0 - }, - { - value: 1, - time: 1 - } - ], - }, - } - }, - { - type: 'color', - config: { - color: { - list: [ - { - value: "fb1010", - time: 0 - }, - { - value: "f5b830", - time: 1 - } - ], - }, - } - }, - { - type: 'moveSpeed', - config: { - speed: { - list: [ - { - value: 200, - time: 0 - }, - { - value: 100, - time: 1 - } - ], - isStepped: false - }, - } - }, - { - type: 'rotationStatic', - config: { - min: 70, - max: 110 - } - }, - { - type: 'spawnShape', - config: { - type: 'rect', - data: { - x: 0, - y: 0, - width: 800, - height: 10 + particles + .addEmitter({ + lifetime: { min: 5, max: 5 }, + pos: { x: 0, y: 0 }, + frequency: 0.05, + behaviors: [ + { + type: "alpha", + config: { + alpha: { + list: [ + { + value: 1, + time: 0 + }, + { + value: 1, + time: 1 + } + ] + } + } + }, + { + type: "scale", + config: { + scale: { + list: [ + { + value: 1, + time: 0 + }, + { + value: 1, + time: 1 + } + ] + } + } + }, + { + type: "color", + config: { + color: { + list: [ + { + value: "fb1010", + time: 0 + }, + { + value: "f5b830", + time: 1 + } + ] + } + } + }, + { + type: "moveSpeed", + config: { + speed: { + list: [ + { + value: 200, + time: 0 + }, + { + value: 100, + time: 1 + } + ], + isStepped: false + } + } + }, + { + type: "rotationStatic", + config: { + min: 70, + max: 110 + } + }, + { + type: "spawnShape", + config: { + type: "rect", + data: { + x: 0, + y: 0, + width: 800, + height: 10 + } + } + }, + { + type: "textureSingle", + config: { + texture: snowflakeSymbol } } - }, - { - type: 'textureSingle', - config: { - texture: snowflakeSymbol - } - } - ] - }).then(e => { - e.autoUpdate = true; - }) - + ] + }) + .then(e => { + e.autoUpdate = true; + }); const currentlyMastering = computed(() => isMastery.value @@ -285,6 +288,7 @@ export const main = createLayer("main", function (this: BaseLayer) { story: string; completedStory: string; masteredStory: string; + visibility?: Visibility; } ): Day { const opened = persistent(false); @@ -314,7 +318,8 @@ export const main = createLayer("main", function (this: BaseLayer) { story, completedStory, masteredStory, - recentlyUpdated + recentlyUpdated, + visibility } = this; const mastered: Ref = @@ -327,6 +332,7 @@ export const main = createLayer("main", function (this: BaseLayer) { recentlyUpdated, shouldNotify, mastered, + visibility, onOpenLore() { const completed = main.day.value > day; loreScene.value = completed ? day - 1 : -1; @@ -370,7 +376,10 @@ export const main = createLayer("main", function (this: BaseLayer) { opened.value = true; setTimeout(() => { loreScene.value = -1; - loreTitle.value = day == 25 ? "The End!" : unref(layers[layer ?? "trees"]?.name ?? ""); + loreTitle.value = + day == 25 + ? "The End!" + : unref(layers[layer ?? "trees"]?.name ?? ""); loreBody.value = story; if (player.autoPause) player.devSpeed = null; showLoreModal.value = true; @@ -638,9 +647,10 @@ export const main = createLayer("main", function (this: BaseLayer) { shouldNotify: false, layer: null, // credits symbol: snowflakeSymbol, - story: `It's Christmas. Thanks to your efforts, Santa has delivered all the presents to people all over the world. That is, all but one...


Open your present
`, + story: `It's Christmas. Thanks to your efforts, Santa has delivered all the presents to people all over the world. That is, all but one...


Open your present

`, completedStory: "", - masteredStory: "" + masteredStory: "", + visibility: Visibility.None })) ]; @@ -673,6 +683,15 @@ export const main = createLayer("main", function (this: BaseLayer) { } } + watchEffect(() => { + if (day.value === 25 && showLoreModal.value === false) { + loreScene.value = -1; + loreTitle.value = "Merry Christmas!"; + loreBody.value = days[day.value - 1].story; + showLoreModal.value = true; + } + }); + return { name: "Calendar", days, @@ -724,7 +743,11 @@ export const main = createLayer("main", function (this: BaseLayer) { ) .map((days: Day[]) => renderRow(...days))}
- {render(particles) /*creditsOpen.value || day.value == 25 ? render(particles) : null*/} + { + render( + particles + ) /*creditsOpen.value || day.value == 25 ? render(particles) : null*/ + } )) };