2022-01-10 03:28:09 +00:00
|
|
|
<template>
|
2022-01-10 10:16:25 +00:00
|
|
|
<div class="container max-h-full h-full w-full mx-auto bg-gray-400 px-4">
|
2022-01-10 06:08:59 +00:00
|
|
|
<main
|
|
|
|
class="grid w-full h-full overflow-auto relative"
|
2022-01-10 10:16:25 +00:00
|
|
|
:class="`bg-${activeTab.color}`"
|
2022-01-10 06:08:59 +00:00
|
|
|
>
|
2022-01-10 04:33:09 +00:00
|
|
|
<time-header />
|
2022-01-10 03:28:09 +00:00
|
|
|
|
2022-01-10 07:11:55 +00:00
|
|
|
<key-art-stage />
|
2022-01-10 03:28:09 +00:00
|
|
|
|
2022-01-10 10:16:25 +00:00
|
|
|
<div class="grid grid-cols-6 gap-1 w-full h-10 relative">
|
2022-01-10 03:28:09 +00:00
|
|
|
<game-tab
|
2022-01-10 10:16:25 +00:00
|
|
|
v-for="tab in $store.state.tabs"
|
|
|
|
:key="tab.route"
|
2022-01-10 03:28:09 +00:00
|
|
|
:tab-data="tab"
|
|
|
|
/>
|
|
|
|
</div>
|
|
|
|
|
|
|
|
<div
|
2022-01-10 07:11:55 +00:00
|
|
|
class="tab-content px-4 w-full relative overflow-y-scroll"
|
2022-01-10 03:28:09 +00:00
|
|
|
:class="activeTabColorClasses"
|
|
|
|
>
|
2022-01-10 07:11:55 +00:00
|
|
|
<div
|
2022-01-13 21:02:43 +00:00
|
|
|
class="tab-title w-full text-2xl text-center pt-1 pb-2"
|
2022-01-10 10:16:25 +00:00
|
|
|
v-text="activeTab.title"
|
2022-01-10 07:11:55 +00:00
|
|
|
/>
|
2022-01-10 03:28:09 +00:00
|
|
|
|
|
|
|
<nuxt />
|
|
|
|
</div>
|
|
|
|
</main>
|
2022-01-14 07:15:32 +00:00
|
|
|
<narrative-modal v-if="$store.state.modalIsOpen" />
|
2022-01-10 03:28:09 +00:00
|
|
|
</div>
|
|
|
|
</template>
|
|
|
|
|
|
|
|
<script>
|
2022-01-10 10:16:25 +00:00
|
|
|
import { mapGetters } from 'vuex'
|
|
|
|
|
2022-01-10 03:28:09 +00:00
|
|
|
export default {
|
|
|
|
computed: {
|
2022-01-10 10:16:25 +00:00
|
|
|
...mapGetters(['activeTab']),
|
2022-01-10 03:28:09 +00:00
|
|
|
activeTabColorClasses() {
|
2022-01-10 10:16:25 +00:00
|
|
|
return `bg-${this.activeTab.lightColor} text-${this.activeTab.darkColor}`
|
2022-01-10 03:28:09 +00:00
|
|
|
},
|
|
|
|
},
|
|
|
|
mounted() {
|
|
|
|
window.setInterval(() => {
|
2022-01-14 07:15:32 +00:00
|
|
|
if (this.$store.state.modalIsOpen || this.$store.state.gameStopped) return
|
|
|
|
|
|
|
|
if (this.$store.state.playerAge < this.$store.state.playerAgeMax) {
|
2022-01-10 23:38:43 +00:00
|
|
|
this.gametick()
|
2022-01-14 07:15:32 +00:00
|
|
|
} else {
|
|
|
|
this.checkLossCondition()
|
|
|
|
}
|
2022-01-10 10:16:25 +00:00
|
|
|
}, 100)
|
2022-01-10 03:28:09 +00:00
|
|
|
window.setInterval(() => {
|
2022-01-14 07:15:32 +00:00
|
|
|
if (this.$store.state.modalIsOpen || this.$store.state.gameStopped) return
|
|
|
|
|
2022-01-10 23:38:43 +00:00
|
|
|
if (this.$store.state.playerAge < this.$store.state.playerAgeMax)
|
|
|
|
this.$store.commit('tickGameDate')
|
2022-01-10 06:25:55 +00:00
|
|
|
}, 1000)
|
2022-01-10 03:28:09 +00:00
|
|
|
},
|
|
|
|
methods: {
|
|
|
|
gametick() {
|
2022-01-12 06:23:41 +00:00
|
|
|
// Instruments tick
|
2022-01-10 10:16:25 +00:00
|
|
|
this.$store.state.processes
|
|
|
|
.filter((p) => p.created)
|
2022-01-14 07:15:32 +00:00
|
|
|
.forEach((process) => {
|
2022-01-10 10:16:25 +00:00
|
|
|
if (process.completion >= process.completionRequired) {
|
2022-01-11 06:06:03 +00:00
|
|
|
const reward = process.baseReward * (1 + process.workerLevel)
|
|
|
|
|
|
|
|
this.$store.commit('addCurrency', reward)
|
2022-01-12 04:24:29 +00:00
|
|
|
this.$store.commit('resetProcess', { process })
|
2022-01-10 10:16:25 +00:00
|
|
|
}
|
|
|
|
|
2022-01-12 04:24:29 +00:00
|
|
|
this.$store.commit('tickProcess', { process })
|
2022-01-10 03:28:09 +00:00
|
|
|
})
|
2022-01-12 06:23:41 +00:00
|
|
|
|
|
|
|
// Energy ticks
|
|
|
|
if (
|
|
|
|
this.$store.getters.isTabUnlocked('Time Machine') &&
|
|
|
|
this.$store.state.energy < this.$store.state.energyMax
|
|
|
|
) {
|
|
|
|
this.$store.commit('tickEnergy')
|
|
|
|
}
|
2022-01-10 03:28:09 +00:00
|
|
|
},
|
2022-01-14 07:15:32 +00:00
|
|
|
checkLossCondition() {
|
|
|
|
this.$store.commit('stopGame')
|
|
|
|
|
|
|
|
// End state
|
|
|
|
const lostTheGame =
|
|
|
|
this.$store.state.playerAge === this.$store.state.playerAgeMax &&
|
|
|
|
!this.$store.getters.isTabUnlocked('Time Machine')
|
|
|
|
|
|
|
|
if (lostTheGame) {
|
|
|
|
const message =
|
|
|
|
'You wasted your precious time your whole life with nothing to show for it.' +
|
|
|
|
'<br><br>' +
|
|
|
|
'You have lost the game. Reload the page and try again.'
|
|
|
|
|
|
|
|
this.$store.commit('openModal', message)
|
|
|
|
} else {
|
|
|
|
const message =
|
|
|
|
"You are too frail to continue. It's time to gather your knowledge into a book and " +
|
|
|
|
'send it, along with the time machine and your timekeeping instruments, to your younger self. ' +
|
|
|
|
'Hopefully they will know what to do with this valuable wisdom.' +
|
|
|
|
'<br><br>' +
|
|
|
|
'Go to the <b>Missions</b> tab to continue.'
|
|
|
|
|
|
|
|
this.$store.commit('openModal', message)
|
|
|
|
}
|
|
|
|
},
|
2022-01-10 03:28:09 +00:00
|
|
|
},
|
|
|
|
}
|
|
|
|
</script>
|
|
|
|
|
|
|
|
<style>
|
2022-01-14 03:57:35 +00:00
|
|
|
@import url('https://fonts.googleapis.com/css2?family=Manrope:wght@400;600;800&family=Roboto+Slab:wght@600&display=swap');
|
2022-01-13 21:02:43 +00:00
|
|
|
|
2022-01-10 03:28:09 +00:00
|
|
|
html,
|
|
|
|
body,
|
|
|
|
#__nuxt,
|
|
|
|
#__layout {
|
|
|
|
height: 100%; /* 100vh is broken on mobile. this is the fix. */
|
|
|
|
width: 100vw;
|
|
|
|
}
|
|
|
|
|
|
|
|
html {
|
|
|
|
background: #e5e7eb;
|
|
|
|
overflow-y: hidden;
|
2022-01-13 21:02:43 +00:00
|
|
|
font-family: 'Manrope', sans-serif;
|
2022-01-10 03:28:09 +00:00
|
|
|
}
|
|
|
|
</style>
|
|
|
|
|
|
|
|
<style scoped>
|
|
|
|
main {
|
2022-01-10 07:11:55 +00:00
|
|
|
grid-template-rows: auto minmax(0, 2fr) auto minmax(0, 3fr);
|
2022-01-10 06:08:59 +00:00
|
|
|
transition: background-color 2000ms;
|
2022-01-10 03:28:09 +00:00
|
|
|
}
|
2022-01-13 21:02:43 +00:00
|
|
|
|
|
|
|
.tab-title {
|
|
|
|
font-family: 'Roboto Slab', serif;
|
|
|
|
}
|
2022-01-10 03:28:09 +00:00
|
|
|
</style>
|