2021-06-12 04:38:16 +00:00
|
|
|
<template>
|
2022-02-27 19:49:34 +00:00
|
|
|
<div
|
|
|
|
v-if="unref(visibility) !== Visibility.None"
|
|
|
|
:style="[
|
|
|
|
{
|
|
|
|
visibility: unref(visibility) === Visibility.Hidden ? 'hidden' : undefined,
|
|
|
|
backgroundImage: (earned && image && `url(${image})`) || ''
|
|
|
|
},
|
|
|
|
unref(style) ?? []
|
|
|
|
]"
|
|
|
|
:class="{
|
|
|
|
feature: true,
|
|
|
|
achievement: true,
|
|
|
|
locked: !unref(earned),
|
|
|
|
bought: unref(earned),
|
|
|
|
...unref(classes)
|
|
|
|
}"
|
2022-01-14 04:25:47 +00:00
|
|
|
>
|
2022-02-27 19:49:34 +00:00
|
|
|
<component v-if="component" :is="component" />
|
|
|
|
<MarkNode :mark="unref(mark)" />
|
|
|
|
<LinkNode :id="id" />
|
|
|
|
</div>
|
2021-06-12 04:38:16 +00:00
|
|
|
</template>
|
|
|
|
|
2022-01-25 04:25:34 +00:00
|
|
|
<script lang="ts">
|
2022-03-04 03:39:48 +00:00
|
|
|
import { CoercableComponent, Visibility } from "features/feature";
|
|
|
|
import { computeOptionalComponent, processedPropType } from "util/vue";
|
2022-02-27 19:49:34 +00:00
|
|
|
import { defineComponent, StyleValue, toRefs, unref } from "vue";
|
2022-03-04 03:39:48 +00:00
|
|
|
import Tooltip from "components/Tooltip.vue";
|
|
|
|
import LinkNode from "components/links/LinkNode.vue";
|
|
|
|
import MarkNode from "components/MarkNode.vue";
|
|
|
|
import "components/common/features.css";
|
2021-06-12 04:38:16 +00:00
|
|
|
|
2022-01-25 04:25:34 +00:00
|
|
|
export default defineComponent({
|
|
|
|
props: {
|
|
|
|
visibility: {
|
2022-02-27 19:49:34 +00:00
|
|
|
type: processedPropType<Visibility>(Number),
|
2022-01-25 04:25:34 +00:00
|
|
|
required: true
|
|
|
|
},
|
2022-02-27 19:49:34 +00:00
|
|
|
display: processedPropType<CoercableComponent>(Object, String, Function),
|
2022-01-25 04:25:34 +00:00
|
|
|
earned: {
|
2022-02-27 19:49:34 +00:00
|
|
|
type: processedPropType<boolean>(Boolean),
|
2022-01-25 04:25:34 +00:00
|
|
|
required: true
|
|
|
|
},
|
2022-02-27 19:49:34 +00:00
|
|
|
image: processedPropType<string>(String),
|
|
|
|
style: processedPropType<StyleValue>(String, Object, Array),
|
|
|
|
classes: processedPropType<Record<string, boolean>>(Object),
|
|
|
|
mark: processedPropType<boolean | string>(Boolean, String),
|
2022-01-25 04:25:34 +00:00
|
|
|
id: {
|
|
|
|
type: String,
|
|
|
|
required: true
|
|
|
|
}
|
|
|
|
},
|
2022-02-27 19:49:34 +00:00
|
|
|
components: {
|
|
|
|
LinkNode,
|
|
|
|
MarkNode,
|
|
|
|
Tooltip
|
|
|
|
},
|
2022-01-25 04:25:34 +00:00
|
|
|
setup(props) {
|
|
|
|
const { display } = toRefs(props);
|
2022-01-14 04:25:47 +00:00
|
|
|
|
2022-01-25 04:25:34 +00:00
|
|
|
return {
|
2022-02-27 19:49:34 +00:00
|
|
|
component: computeOptionalComponent(display),
|
|
|
|
unref,
|
2022-01-25 04:25:34 +00:00
|
|
|
Visibility
|
|
|
|
};
|
|
|
|
}
|
First pass at typescript support
Oh man did this end up requiring a *ton* of other work as well.
There's still a few typing issues I still can't quite work out,
and others I'd like to improve when I have time. In fact, this version
doesn't even really work, it has a stack overflow error caused by
a tooltip for some reason have a tree inside it, which in turn has
another tooltip, etc. There's also 17 errors that I *really* feel like
shouldn't be there, but they are, and 113 warnings - mostly using !
to assert that things are non-null. Lots of work left to do, to sum up.
The reason I'm committing this now is because I really need to get to
work on my game jam, and since it won't use a tree or really many of
TMT-X's features, I can get away with using a broken engine :)
2021-08-17 04:30:54 +00:00
|
|
|
});
|
2021-06-12 04:38:16 +00:00
|
|
|
</script>
|
|
|
|
|
|
|
|
<style scoped>
|
|
|
|
.achievement {
|
|
|
|
height: 90px;
|
|
|
|
width: 90px;
|
|
|
|
font-size: 10px;
|
|
|
|
color: white;
|
|
|
|
text-shadow: 0 0 2px #000000;
|
|
|
|
}
|
|
|
|
</style>
|