2022-01-09 19:28:09 -08:00
< template >
2022-01-10 02:16:25 -08:00
< div class = "container max-h-full h-full w-full mx-auto bg-gray-400 px-4" >
2022-01-09 22:08:59 -08:00
< main
class = "grid w-full h-full overflow-auto relative"
2022-01-10 02:16:25 -08:00
: class = "`bg-${activeTab.color}`"
2022-01-09 22:08:59 -08:00
>
2022-01-09 20:33:09 -08:00
< time-header / >
2022-01-09 19:28:09 -08:00
2022-01-09 23:11:55 -08:00
< key-art-stage / >
2022-01-09 19:28:09 -08:00
2022-01-10 02:16:25 -08:00
< div class = "grid grid-cols-6 gap-1 w-full h-10 relative" >
2022-01-09 19:28:09 -08:00
< game-tab
2022-01-10 02:16:25 -08:00
v - for = "tab in $store.state.tabs"
: key = "tab.route"
2022-01-09 19:28:09 -08:00
: tab - data = "tab"
/ >
< / div >
< div
2022-01-09 23:11:55 -08:00
class = "tab-content px-4 w-full relative overflow-y-scroll"
2022-01-09 19:28:09 -08:00
: class = "activeTabColorClasses"
>
2022-01-09 23:11:55 -08:00
< div
class = "w-full text-2xl text-center pt-1 pb-2"
2022-01-10 02:16:25 -08:00
v - text = "activeTab.title"
2022-01-09 23:11:55 -08:00
/ >
2022-01-09 19:28:09 -08:00
< nuxt / >
< / div >
< / main >
< / div >
< / template >
< script >
2022-01-10 02:16:25 -08:00
import { mapGetters } from 'vuex'
2022-01-09 19:28:09 -08:00
export default {
computed : {
2022-01-10 02:16:25 -08:00
... mapGetters ( [ 'activeTab' ] ) ,
2022-01-09 19:28:09 -08:00
activeTabColorClasses ( ) {
2022-01-10 02:16:25 -08:00
return ` bg- ${ this . activeTab . lightColor } text- ${ this . activeTab . darkColor } `
2022-01-09 19:28:09 -08:00
} ,
} ,
mounted ( ) {
window . setInterval ( ( ) => {
2022-01-10 18:38:43 -05:00
if ( this . $store . state . playerAge < this . $store . state . playerAgeMax )
this . gametick ( )
2022-01-10 02:16:25 -08:00
} , 100 )
2022-01-09 19:28:09 -08:00
window . setInterval ( ( ) => {
2022-01-10 18:38:43 -05:00
if ( this . $store . state . playerAge < this . $store . state . playerAgeMax )
this . $store . commit ( 'tickGameDate' )
2022-01-09 22:25:55 -08:00
} , 1000 )
2022-01-09 19:28:09 -08:00
} ,
methods : {
gametick ( ) {
2022-01-11 22:23:41 -08:00
// Instruments tick
2022-01-10 02:16:25 -08:00
this . $store . state . processes
. filter ( ( p ) => p . created )
. forEach ( ( process , index ) => {
if ( process . completion >= process . completionRequired ) {
2022-01-10 22:06:03 -08:00
const reward = process . baseReward * ( 1 + process . workerLevel )
this . $store . commit ( 'addCurrency' , reward )
2022-01-11 20:24:29 -08:00
this . $store . commit ( 'resetProcess' , { process } )
2022-01-10 02:16:25 -08:00
}
2022-01-11 20:24:29 -08:00
this . $store . commit ( 'tickProcess' , { process } )
2022-01-09 19:28:09 -08:00
} )
2022-01-11 22:23:41 -08:00
// Energy ticks
if (
this . $store . getters . isTabUnlocked ( 'Time Machine' ) &&
this . $store . state . energy < this . $store . state . energyMax
) {
this . $store . commit ( 'tickEnergy' )
}
2022-01-09 19:28:09 -08:00
} ,
} ,
}
< / script >
< style >
html ,
body ,
# _ _nuxt ,
# _ _layout {
height : 100 % ; /* 100vh is broken on mobile. this is the fix. */
width : 100 vw ;
}
html {
background : # e5e7eb ;
overflow - y : hidden ;
}
< / style >
< style scoped >
main {
2022-01-09 23:11:55 -08:00
grid - template - rows : auto minmax ( 0 , 2 fr ) auto minmax ( 0 , 3 fr ) ;
2022-01-09 22:08:59 -08:00
transition : background - color 2000 ms ;
2022-01-09 19:28:09 -08:00
}
< / style >