mirror of
https://github.com/thepaperpilot/Advent-Incremental.git
synced 2024-11-28 02:51:46 +00:00
After opening the present, win the game
This commit is contained in:
parent
a72d8c720b
commit
aa7fbccb34
1 changed files with 18 additions and 2 deletions
|
@ -16,7 +16,7 @@ import { Computable, convertComputable, ProcessedComputable } from "util/compute
|
||||||
import { createLazyProxy } from "util/proxies";
|
import { createLazyProxy } from "util/proxies";
|
||||||
import { save } from "util/save";
|
import { save } from "util/save";
|
||||||
import { render, renderRow, VueFeature } from "util/vue";
|
import { render, renderRow, VueFeature } from "util/vue";
|
||||||
import { Ref, watchEffect } from "vue";
|
import { Ref, watch, watchEffect } from "vue";
|
||||||
import { computed, ref, unref } from "vue";
|
import { computed, ref, unref } from "vue";
|
||||||
import "./advent.css";
|
import "./advent.css";
|
||||||
import Day from "./Day.vue";
|
import Day from "./Day.vue";
|
||||||
|
@ -80,6 +80,8 @@ export interface Day extends VueFeature {
|
||||||
|
|
||||||
export const main = createLayer("main", function (this: BaseLayer) {
|
export const main = createLayer("main", function (this: BaseLayer) {
|
||||||
const day = persistent<number>(1);
|
const day = persistent<number>(1);
|
||||||
|
const hasWon = persistent<boolean>(false);
|
||||||
|
|
||||||
const timeUntilNewDay = computed(
|
const timeUntilNewDay = computed(
|
||||||
() => (+new Date(new Date().getFullYear(), 11, day.value) - player.time) / 1000
|
() => (+new Date(new Date().getFullYear(), 11, day.value) - player.time) / 1000
|
||||||
);
|
);
|
||||||
|
@ -684,11 +686,12 @@ export const main = createLayer("main", function (this: BaseLayer) {
|
||||||
}
|
}
|
||||||
|
|
||||||
watchEffect(() => {
|
watchEffect(() => {
|
||||||
if (day.value === 25 && showLoreModal.value === false) {
|
if (day.value === 25 && showLoreModal.value === false && !hasWon.value) {
|
||||||
loreScene.value = -1;
|
loreScene.value = -1;
|
||||||
loreTitle.value = "Merry Christmas!";
|
loreTitle.value = "Merry Christmas!";
|
||||||
loreBody.value = days[day.value - 1].story;
|
loreBody.value = days[day.value - 1].story;
|
||||||
showLoreModal.value = true;
|
showLoreModal.value = true;
|
||||||
|
hasWon.value = true;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -713,6 +716,7 @@ export const main = createLayer("main", function (this: BaseLayer) {
|
||||||
masteredDays,
|
masteredDays,
|
||||||
creditsOpen,
|
creditsOpen,
|
||||||
credits,
|
credits,
|
||||||
|
hasWon,
|
||||||
display: jsx(() => (
|
display: jsx(() => (
|
||||||
<>
|
<>
|
||||||
{player.devSpeed === 0 ? <div>Game Paused</div> : null}
|
{player.devSpeed === 0 ? <div>Game Paused</div> : null}
|
||||||
|
@ -743,6 +747,18 @@ export const main = createLayer("main", function (this: BaseLayer) {
|
||||||
)
|
)
|
||||||
.map((days: Day[]) => renderRow(...days))}
|
.map((days: Day[]) => renderRow(...days))}
|
||||||
</div>
|
</div>
|
||||||
|
{hasWon.value ? (
|
||||||
|
<>
|
||||||
|
<Spacer />
|
||||||
|
<button
|
||||||
|
class="button"
|
||||||
|
style="font-size: xx-large"
|
||||||
|
onClick={() => (creditsOpen.value = true)}
|
||||||
|
>
|
||||||
|
Open Credits
|
||||||
|
</button>
|
||||||
|
</>
|
||||||
|
) : null}
|
||||||
{
|
{
|
||||||
render(
|
render(
|
||||||
particles
|
particles
|
||||||
|
|
Loading…
Reference in a new issue