Added mastered effect to calendar days

This commit is contained in:
thepaperpilot 2022-12-16 00:42:04 -06:00
parent bc13b05d85
commit 6725fc850f
2 changed files with 71 additions and 9 deletions

View file

@ -1,13 +1,21 @@
<template> <template>
<div class="day feature dontMerge opened" v-if="opened.value"> <div
<Tooltip :display="(layers[layer ?? '']?.name ?? '')" :direction="Direction.Up" yoffset="5px"> class="day feature dontMerge opened"
:class="{ mastered: unref(mastered) }"
v-if="opened.value"
>
<Tooltip :display="layers[layer ?? '']?.name ?? ''" :direction="Direction.Up" yoffset="5px">
<Transition appear name="door"> <Transition appear name="door">
<div class="doors" @click="emit('openLayer')"> <div class="doors" @click="emit('openLayer')">
<div class="date">Dec<br />{{ day }}</div> <div class="date">Dec<br />{{ day }}</div>
<div class="date">Dec<br />{{ day }}</div> <div class="date">Dec<br />{{ day }}</div>
</div> </div>
</Transition> </Transition>
<div class="icon" @click="emit('openLayer')" :style="{ backgroundImage: `url(${symbol})` }"></div> <div
class="icon"
@click="emit('openLayer')"
:style="{ backgroundImage: `url(${symbol})` }"
></div>
<div class="lore" @click="emit('openLore')">?</div> <div class="lore" @click="emit('openLore')">?</div>
<Notif v-if="unref(shouldNotify)" /> <Notif v-if="unref(shouldNotify)" />
</Tooltip> </Tooltip>
@ -15,14 +23,18 @@
<div <div
v-else v-else
class="day feature dontMerge" class="day feature dontMerge"
:class="{ can: canOpen, locked: !canOpen, canOpen }" :class="{ can: canOpen, locked: !canOpen, canOpen, mastered: unref(mastered) }"
@click="tryUnlock" @click="tryUnlock"
> >
<div class="doors"></div> <div class="doors"></div>
<div class="date">Dec<br />{{ day }}</div> <div class="date">Dec<br />{{ day }}</div>
<div v-if="!canOpen" class="material-icons lock">lock</div> <div v-if="!canOpen" class="material-icons lock">lock</div>
<div v-if="main.day.value === day && !canOpen" class="timer"> <div v-if="main.day.value === day && !canOpen" class="timer">
{{ main.timeUntilNewDay.value < 0 ? "NYI, sorry" : formatTime(main.timeUntilNewDay.value, 0) }} {{
main.timeUntilNewDay.value < 0
? "NYI, sorry"
: formatTime(main.timeUntilNewDay.value, 0)
}}
</div> </div>
<Notif v-if="canOpen" /> <Notif v-if="canOpen" />
</div> </div>
@ -47,6 +59,7 @@ const props = defineProps<{
opened: Ref<boolean>; opened: Ref<boolean>;
recentlyUpdated: Ref<boolean>; recentlyUpdated: Ref<boolean>;
shouldNotify: ProcessedComputable<boolean>; shouldNotify: ProcessedComputable<boolean>;
mastered: Ref<boolean>;
}>(); }>();
const emit = defineEmits<{ const emit = defineEmits<{
@ -78,6 +91,30 @@ function tryUnlock() {
background-color: var(--raised-background); background-color: var(--raised-background);
aspect-ratio: 1; aspect-ratio: 1;
margin: 5%; margin: 5%;
box-shadow: rgb(0 0 0 / 13%) 0px 3px 0px inset, rgb(0 0 0 / 13%) 3px 0px 0px inset,
rgb(0 0 0 / 13%) 0px 0px 3px inset, rgb(0 0 0 / 13%) 0px 0px 0px 3px inset;
}
.mastered.day {
background: linear-gradient(
225deg,
rgb(255, 76, 76) 10.8%,
rgb(255, 255, 255) 11.1%,
rgb(255, 255, 255) 21.9%,
rgb(65, 255, 95) 22.2%,
rgb(65, 255, 95) 33%,
rgb(255, 255, 255) 33.3%,
rgb(255, 255, 255) 44.1%,
rgb(255, 76, 76) 44.4%,
rgb(255, 76, 76) 55.2%,
rgb(255, 255, 255) 55.5%,
rgb(255, 255, 255) 66.3%,
rgb(65, 255, 95) 66.6%,
rgb(65, 255, 95) 77.4%,
rgb(255, 255, 255) 77.7%,
rgb(255, 255, 255) 88.5%,
rgb(255, 76, 76) 88.8%
);
} }
.door-enter-from::before, .door-enter-from::before,
@ -132,7 +169,8 @@ function tryUnlock() {
clip-path: polygon(100% 0, 50% 0, 50% 100%, 100% 100%); clip-path: polygon(100% 0, 50% 0, 50% 100%, 100% 100%);
} }
.tooltip-container, .doors { .tooltip-container,
.doors {
position: absolute; position: absolute;
width: 100%; width: 100%;
height: 100%; height: 100%;
@ -164,6 +202,29 @@ function tryUnlock() {
right: 0; right: 0;
} }
.mastered .doors::before,
.mastered .doors::after {
background: linear-gradient(
225deg,
rgb(255, 76, 76) 10.8%,
rgb(255, 255, 255) 11.1%,
rgb(255, 255, 255) 21.9%,
rgb(65, 255, 95) 22.2%,
rgb(65, 255, 95) 33%,
rgb(255, 255, 255) 33.3%,
rgb(255, 255, 255) 44.1%,
rgb(255, 76, 76) 44.4%,
rgb(255, 76, 76) 55.2%,
rgb(255, 255, 255) 55.5%,
rgb(255, 255, 255) 66.3%,
rgb(65, 255, 95) 66.6%,
rgb(65, 255, 95) 77.4%,
rgb(255, 255, 255) 77.7%,
rgb(255, 255, 255) 88.5%,
rgb(255, 76, 76) 88.8%
);
}
.date { .date {
position: absolute; position: absolute;
top: 50%; top: 50%;

View file

@ -73,7 +73,7 @@ const masterableLayers = [
oil, oil,
plastic, plastic,
dyes dyes
] ];
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);
@ -89,7 +89,7 @@ export const main = createLayer("main", function (this: BaseLayer) {
const isMastery = persistent<boolean>(false); const isMastery = persistent<boolean>(false);
const toggleMastery = () => { const toggleMastery = () => {
isMastery.value = !isMastery.value; isMastery.value = !isMastery.value;
} };
function createDay( function createDay(
optionsFunc: () => { optionsFunc: () => {
@ -127,7 +127,7 @@ export const main = createLayer("main", function (this: BaseLayer) {
shouldNotify, shouldNotify,
story, story,
completedStory, completedStory,
recentlyUpdated, recentlyUpdated
} = this; } = this;
return { return {
@ -137,6 +137,7 @@ export const main = createLayer("main", function (this: BaseLayer) {
opened, opened,
recentlyUpdated, recentlyUpdated,
shouldNotify, shouldNotify,
mastered: (layers[layer ?? ""] as any)?.mastered ?? ref(false),
onOpenLore() { onOpenLore() {
const completed = main.day.value > day; const completed = main.day.value > day;
loreScene.value = completed ? day - 1 : -1; loreScene.value = completed ? day - 1 : -1;