2022-01-03 18:53:38 -05:00
< template >
2022-01-06 22:30:15 -08:00
< div
class = "page grid container max-h-full h-full w-full mx-auto bg-gray-300 px-4"
>
2022-01-06 02:18:46 -08:00
< header
class = "text-3xl flex items-center justify-center font-bold bg-gray-600 text-gray-400"
>
Timekeeper
< / header >
2022-01-06 17:17:26 -08:00
2022-01-08 14:04:05 -08:00
< main class = "bg-gray-400 grid w-full h-full overflow-auto relative" >
< div
2022-01-08 15:42:22 -08:00
class = "flex flex-row bg-gray-300 border border-gray-600 font-semibold h-10"
2022-01-08 14:04:05 -08:00
>
< div class = "text-center pt-2 pb-1 flex-grow border-r border-gray-600" >
2022-01-09 19:05:58 -05:00
{ { $store . getters . gameMonth } } { { $store . state . gameDate . year } }
2022-01-08 14:04:05 -08:00
< / div >
< div
class = "text-center pt-2 pb-1 flex-grow border-r border-gray-600 relative"
>
< progress
class = "absolute top-0 left-0 right-0 h-1 w-full"
2022-01-09 19:05:58 -05:00
: max = "
$store . state . playerAgeMax . year * 12 +
$store . state . playerAgeMax . month
"
: value = "
$store . state . playerAge . year * 12 + $store . state . playerAge . month
"
2022-01-08 14:04:05 -08:00
/ >
2022-01-09 19:05:58 -05:00
{ { $store . state . playerAge . year } } y { { $store . state . playerAge . month } } m
< / div >
< div class = "text-center pt-2 pb-1 flex-grow" >
{ { $store . state . playerAgeMax . year } } y { {
$store . state . playerAgeMax . month
} } m max
2022-01-08 14:04:05 -08:00
< / div >
< / div >
2022-01-06 15:22:21 -08:00
< div class = "units p-8 relative bg-gray-300" >
2022-01-08 22:24:11 -05:00
< div class = "units-background absolute top-8 left-0 right-0" > < / div >
2022-01-08 14:04:05 -08:00
< div
class = "absolute top-0 bottom-0 left-0 right-0 flex items-center justify-center"
2022-01-08 22:23:13 -05:00
@ click = "$store.commit('addCurrency', 1)"
2022-01-08 14:04:05 -08:00
>
< span
class = "spare-time flex flex-row items-center font-bold rounded-2xl"
>
2022-01-08 22:28:19 -05:00
< span class = "text-3xl md:text-5xl"
> { { $store . state . currency } }
< / span >
2022-01-08 14:04:05 -08:00
< span
class = "fas fa-hourglass-half text-xl pt-1 pl-2 md:text-3xl md:pt-2"
> < / span >
< / span >
< / div >
2022-01-06 02:18:46 -08:00
< / div >
2022-01-06 17:17:26 -08:00
2022-01-08 15:42:22 -08:00
< div class = "tabs flex flex-row w-full bg-gray-400 text-gray-400 h-10" >
2022-01-06 17:17:26 -08:00
< game-tab
v - for = "(tab, index) in $store.state.tabs"
2022-01-06 02:18:46 -08:00
: key = "index"
2022-01-06 17:17:26 -08:00
: index = "index"
: tab - data = "tab"
/ >
< / div >
< div
2022-01-06 22:30:15 -08:00
class = "w-full text-2xl text-center pt-1 pb-2"
2022-01-06 17:17:26 -08:00
: class = "$store.getters.activeTabColorClasses"
>
{ { $store . getters . activeTab . title } }
2022-01-06 02:18:46 -08:00
< / div >
2022-01-06 17:17:26 -08:00
< div
2022-01-06 22:30:15 -08:00
class = "tab-content px-4 w-full overflow-y-scroll"
2022-01-06 17:17:26 -08:00
: class = "$store.getters.activeTabColorClasses"
>
2022-01-06 22:30:15 -08:00
< first-tab-content v-if = "$store.state.activeTabIndex === 0" / >
< second-tab-content v-else-if = "$store.state.activeTabIndex === 1" / >
2022-01-07 19:46:33 -08:00
< third-tab-content v-else-if = "$store.state.activeTabIndex === 2" / >
2022-01-06 17:17:26 -08:00
< template v-else-if = "$store.state.activeTabIndex === 3" >
Tab 4 content
< / template >
< template v-else-if = "$store.state.activeTabIndex === 4" >
Tab 5 content
< / template >
< template v-else-if = "$store.state.activeTabIndex === 5" >
Tab 6 content
< / template >
2022-01-06 02:18:46 -08:00
< / div >
< / main >
2022-01-06 17:17:26 -08:00
2022-01-06 02:18:46 -08:00
< footer class = "text-lg flex items-center pt-4 pb-2 px-4 hidden md:block" >
Created by GrapefruitChili , PK , TNNPe , Vice for New Years Incremental Game
Jam 2022.
< / footer >
2022-01-04 17:41:36 -05:00
< / div >
2022-01-03 18:53:38 -05:00
< / template >
< script >
export default {
name : 'IndexPage' ,
2022-01-07 17:28:21 -05:00
mounted ( ) {
window . setInterval ( ( ) => {
this . gametick ( )
} , 1000 )
2022-01-09 19:05:58 -05:00
window . setInterval ( ( ) => {
this . $store . commit ( 'tickGameDate' )
} , 100 )
2022-01-07 17:28:21 -05:00
} ,
methods : {
gametick ( ) {
2022-01-08 22:56:36 -05:00
for ( let i = 0 ; i < this . $store . state . processes . length ; i ++ ) {
const p = this . $store . state . processes [ i ]
// const step = 100.0 / (6.0 * (i + 1)) // go at different rates
const step = p . workerRate * p . workerCount
let newValue = p . completion + step
while ( newValue >= 100 ) {
newValue = newValue - 100
this . $store . commit ( 'addCurrency' , p . reward )
}
2022-01-07 17:28:21 -05:00
this . $store . commit ( 'setProcessCompletion' , {
processIndex : i ,
value : newValue ,
} )
}
} ,
} ,
2022-01-03 18:53:38 -05:00
}
< / script >
2022-01-04 17:41:36 -05:00
2022-01-06 02:18:46 -08:00
< style >
html ,
body ,
# _ _nuxt ,
# _ _layout {
height : 100 % ; /* 100vh is broken on mobile. this is the fix. */
width : 100 vw ;
}
html {
background : # e5e7eb ;
2022-01-06 22:30:15 -08:00
overflow - y : hidden ;
2022-01-06 02:18:46 -08:00
}
< / style >
2022-01-04 17:41:36 -05:00
< style scoped >
2022-01-06 02:18:46 -08:00
. page {
2022-01-08 15:42:22 -08:00
grid - template - rows : 0 rem 1 fr auto ;
2022-01-04 17:41:36 -05:00
}
2022-01-06 02:18:46 -08:00
main {
2022-01-08 15:42:22 -08:00
grid - template - rows : auto minmax ( 0 , 2 fr ) auto auto minmax ( 0 , 3 fr ) ;
2022-01-04 17:41:36 -05:00
}
2022-01-06 02:18:46 -08:00
. units - background {
background : url ( 'https://freesvg.org/img/johnny_automatic_hourglass.png' ) ;
background - size : contain ;
background - repeat : no - repeat ;
background - position : center ;
opacity : 0.4 ;
height : calc ( 100 % - 4 rem ) ; /* 4rem = top padding + bottom padding */
2022-01-04 17:41:36 -05:00
}
2022-01-08 14:04:05 -08:00
. spare - time {
background : rgba ( 2555 , 255 , 255 , 0.6 ) ;
box - shadow : 0 px 0 px 21 px 3 px # fff ;
}
2022-01-04 17:41:36 -05:00
< / style >