|
@@ -2,21 +2,21 @@ import { createStore } from 'vuex'
|
|
|
|
|
|
function resetGameProgress() {
|
|
|
const ret = {
|
|
|
- jagsawProgress: config.sceneTree.map((item) => {
|
|
|
+ jigsawProgress: config.sceneTree.map((item) => {
|
|
|
return {
|
|
|
name: item.name,
|
|
|
- isJagsawDone: false,
|
|
|
+ isJigsawDone: false,
|
|
|
children: item.children.map((innerItem) => {
|
|
|
return {
|
|
|
name: innerItem.name,
|
|
|
- hasGotJagsaw: false,
|
|
|
+ hasGotJigsaw: false,
|
|
|
}
|
|
|
})
|
|
|
}
|
|
|
}),
|
|
|
buildProgress: -1,
|
|
|
}
|
|
|
- localStorage.setItem('HuiZhouGuJianZhuProgress', JSON.stringify(ret))
|
|
|
+ localStorage.setItem(`HuiZhouGuJianZhuProgress-v${process.env.VUE_APP_VERSION}`, JSON.stringify(ret))
|
|
|
return ret
|
|
|
}
|
|
|
|
|
@@ -24,7 +24,7 @@ export default createStore({
|
|
|
state: {
|
|
|
hasPlayedStartupVideo: process.env.VUE_APP_CLI_MODE === 'dev' ? false : false,
|
|
|
hasPlayedGameRule: false,
|
|
|
- gameProgress: localStorage.getItem('HuiZhouGuJianZhuProgress') ? JSON.parse(localStorage.getItem('HuiZhouGuJianZhuProgress')) : resetGameProgress()
|
|
|
+ gameProgress: localStorage.getItem(`HuiZhouGuJianZhuProgress-v${process.env.VUE_APP_VERSION}`) ? JSON.parse(localStorage.getItem(`HuiZhouGuJianZhuProgress-v${process.env.VUE_APP_VERSION}`)) : resetGameProgress()
|
|
|
},
|
|
|
getters: {
|
|
|
},
|
|
@@ -36,19 +36,19 @@ export default createStore({
|
|
|
state.hasPlayedGameRule = true
|
|
|
},
|
|
|
// 获得拼图碎片
|
|
|
- recordJagsawGot(state, sceneL2Id, sceneL3Id) {
|
|
|
+ recordJigsawGot(state, sceneL2Id, sceneL3Id) {
|
|
|
try {
|
|
|
- state.gameProgress.jagsawProgress[sceneL2Id].children[sceneL3Id].hasGotJagsaw = true
|
|
|
- localStorage.setItem('HuiZhouGuJianZhuProgress', JSON.stringify(state.gameProgress))
|
|
|
+ state.gameProgress.jigsawProgress[sceneL2Id].children[sceneL3Id].hasGotJigsaw = true
|
|
|
+ localStorage.setItem(`HuiZhouGuJianZhuProgress-v${process.env.VUE_APP_VERSION}`, JSON.stringify(state.gameProgress))
|
|
|
} catch (error) {
|
|
|
console.error(error)
|
|
|
state.gameProgress = resetGameProgress()
|
|
|
}
|
|
|
},
|
|
|
- recordJagsawDone(state, sceneL2Id) {
|
|
|
+ recordJigsawDone(state, sceneL2Id) {
|
|
|
try {
|
|
|
- state.gameProgress.jagsawProgress[sceneL2Id].isJagsawDone = true
|
|
|
- localStorage.setItem('HuiZhouGuJianZhuProgress', JSON.stringify(state.gameProgress))
|
|
|
+ state.gameProgress.jigsawProgress[sceneL2Id].isJigsawDone = true
|
|
|
+ localStorage.setItem(`HuiZhouGuJianZhuProgress-v${process.env.VUE_APP_VERSION}`, JSON.stringify(state.gameProgress))
|
|
|
} catch (error) {
|
|
|
console.error(error)
|
|
|
state.gameProgress = resetGameProgress()
|
|
@@ -57,7 +57,7 @@ export default createStore({
|
|
|
recordBuildProgress(state, progress) {
|
|
|
try {
|
|
|
state.gameProgress.buildProgress = progress
|
|
|
- localStorage.setItem('HuiZhouGuJianZhuProgress', JSON.stringify(state.gameProgress))
|
|
|
+ localStorage.setItem(`HuiZhouGuJianZhuProgress-v${process.env.VUE_APP_VERSION}`, JSON.stringify(state.gameProgress))
|
|
|
} catch (error) {
|
|
|
console.error(error)
|
|
|
state.gameProgress = resetGameProgress()
|