2021-05-22 20:29:06 +00:00
|
|
|
<template>
|
2022-01-14 04:25:47 +00:00
|
|
|
<Modal v-model="isOpen">
|
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
|
|
|
<template v-slot:header>
|
|
|
|
<div class="header">
|
|
|
|
<h2>Options</h2>
|
|
|
|
</div>
|
|
|
|
</template>
|
|
|
|
<template v-slot:body>
|
2022-01-14 04:25:47 +00:00
|
|
|
<Select title="Theme" :options="themes" v-model="theme" />
|
2022-02-27 22:41:39 +00:00
|
|
|
<component :is="settingFieldsComponent" />
|
2022-01-14 04:25:47 +00:00
|
|
|
<Toggle title="Show TPS" v-model="showTPS" />
|
2022-02-27 22:41:39 +00:00
|
|
|
<hr />
|
2022-01-14 04:25:47 +00:00
|
|
|
<Toggle title="Unthrottled" v-model="unthrottled" />
|
2022-01-25 04:25:34 +00:00
|
|
|
<Toggle :title="offlineProdTitle" v-model="offlineProd" />
|
|
|
|
<Toggle :title="autosaveTitle" v-model="autosave" />
|
2022-03-11 22:58:11 +00:00
|
|
|
<Toggle v-if="projInfo.enablePausing" :title="isPausedTitle" v-model="isPaused" />
|
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
|
|
|
</template>
|
|
|
|
</Modal>
|
2021-05-22 20:29:06 +00:00
|
|
|
</template>
|
|
|
|
|
2022-01-25 04:25:34 +00:00
|
|
|
<script setup lang="tsx">
|
2022-03-04 03:39:48 +00:00
|
|
|
import Modal from "components/Modal.vue";
|
2022-03-11 22:58:11 +00:00
|
|
|
import projInfo from "data/projInfo.json";
|
2022-03-04 03:39:48 +00:00
|
|
|
import rawThemes from "data/themes";
|
2022-03-11 22:58:11 +00:00
|
|
|
import { jsx } from "features/feature";
|
2022-06-27 00:17:22 +00:00
|
|
|
import Tooltip from "features/tooltips/Tooltip.vue";
|
2022-03-04 03:39:48 +00:00
|
|
|
import player from "game/player";
|
|
|
|
import settings, { settingFields } from "game/settings";
|
|
|
|
import { camelToTitle } from "util/common";
|
2022-03-11 22:58:11 +00:00
|
|
|
import { coerceComponent, render } from "util/vue";
|
2022-02-27 19:49:34 +00:00
|
|
|
import { computed, ref, toRefs } from "vue";
|
2022-02-27 22:04:56 +00:00
|
|
|
import Select from "./fields/Select.vue";
|
2022-03-11 22:58:11 +00:00
|
|
|
import Toggle from "./fields/Toggle.vue";
|
2021-05-22 20:29:06 +00:00
|
|
|
|
2022-01-14 04:25:47 +00:00
|
|
|
const isOpen = ref(false);
|
|
|
|
|
|
|
|
defineExpose({
|
|
|
|
open() {
|
|
|
|
isOpen.value = true;
|
|
|
|
}
|
|
|
|
});
|
|
|
|
|
|
|
|
const themes = Object.keys(rawThemes).map(theme => ({
|
|
|
|
label: camelToTitle(theme),
|
|
|
|
value: theme
|
|
|
|
}));
|
|
|
|
|
2022-02-27 22:41:39 +00:00
|
|
|
const settingFieldsComponent = computed(() => {
|
2022-12-21 03:26:25 +00:00
|
|
|
return coerceComponent(jsx(() => (<>{settingFields.map(render)}</>)));
|
2022-02-27 22:41:39 +00:00
|
|
|
});
|
2022-01-14 04:25:47 +00:00
|
|
|
|
2022-02-27 22:41:39 +00:00
|
|
|
const { showTPS, theme, unthrottled } = toRefs(settings);
|
2022-01-25 04:25:34 +00:00
|
|
|
const { autosave, offlineProd } = toRefs(player);
|
2022-01-14 04:25:47 +00:00
|
|
|
const isPaused = computed({
|
|
|
|
get() {
|
2022-02-27 19:49:34 +00:00
|
|
|
return player.devSpeed === 0;
|
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
|
|
|
},
|
2022-01-14 04:25:47 +00:00
|
|
|
set(value: boolean) {
|
2022-02-27 19:49:34 +00:00
|
|
|
player.devSpeed = value ? 0 : null;
|
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
|
|
|
}
|
|
|
|
});
|
2022-01-25 04:25:34 +00:00
|
|
|
|
2022-02-27 19:49:34 +00:00
|
|
|
const offlineProdTitle = jsx(() => (
|
|
|
|
<span>
|
2022-01-25 04:25:34 +00:00
|
|
|
Offline Production<Tooltip display="Save-specific">*</Tooltip>
|
2022-02-27 19:49:34 +00:00
|
|
|
</span>
|
|
|
|
));
|
|
|
|
const autosaveTitle = jsx(() => (
|
|
|
|
<span>
|
2022-01-25 04:25:34 +00:00
|
|
|
Autosave<Tooltip display="Save-specific">*</Tooltip>
|
2022-02-27 19:49:34 +00:00
|
|
|
</span>
|
|
|
|
));
|
|
|
|
const isPausedTitle = jsx(() => (
|
|
|
|
<span>
|
2022-01-25 04:25:34 +00:00
|
|
|
Pause game<Tooltip display="Save-specific">*</Tooltip>
|
2022-02-27 19:49:34 +00:00
|
|
|
</span>
|
|
|
|
));
|
2021-05-22 20:29:06 +00:00
|
|
|
</script>
|
|
|
|
|
|
|
|
<style scoped>
|
2021-06-21 04:29:55 +00:00
|
|
|
.header {
|
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
|
|
|
margin-bottom: -10px;
|
2021-05-22 20:29:06 +00:00
|
|
|
}
|
2021-09-05 23:53:04 +00:00
|
|
|
|
2021-09-06 00:03:50 +00:00
|
|
|
*:deep() .tooltip-container {
|
2021-09-05 23:53:04 +00:00
|
|
|
display: inline;
|
|
|
|
margin-left: 5px;
|
|
|
|
}
|
2021-05-22 20:29:06 +00:00
|
|
|
</style>
|