Fixed issues with debugging vue

Particularly when switching saves
This commit is contained in:
thepaperpilot 2021-06-27 13:22:07 -05:00
parent d2361bc444
commit 380da5069e
3 changed files with 48 additions and 10 deletions

View file

@ -136,9 +136,6 @@ export default {
}, },
methods: { methods: {
selectSubtab(subtab) { selectSubtab(subtab) {
if (player.subtabs[this.layer] == undefined) {
player.subtabs[this.layer] = {};
}
player.subtabs[this.layer].mainTabs = subtab; player.subtabs[this.layer].mainTabs = subtab;
}, },
toggleMinimized() { toggleMinimized() {

View file

@ -145,6 +145,9 @@ export function addLayer(layer, player = null) {
layer.achievements[id].earned = function() { layer.achievements[id].earned = function() {
return !layer.deactivated && player[layer.id].achievements.some(achievement => achievement == id); return !layer.deactivated && player[layer.id].achievements.some(achievement => achievement == id);
} }
if (layer.achievements[id].onComplete != undefined) {
layer.achievements[id].onComplete.forceCached = false;
}
} }
} }
} }
@ -289,8 +292,12 @@ export function addLayer(layer, player = null) {
if (layer.clickables[id].click != undefined) { if (layer.clickables[id].click != undefined) {
layer.clickables[id].click.forceCached = false; layer.clickables[id].click.forceCached = false;
} }
if (layer.clickables[id].onHold != undefined) {
layer.clickables[id].onHold.forceCached = false;
} }
} }
}
layer.clickables.layer = layer.id;
if (layer.clickables.masterButtonClick != undefined) { if (layer.clickables.masterButtonClick != undefined) {
layer.clickables.masterButtonClick.forceCached = false; layer.clickables.masterButtonClick.forceCached = false;
} }
@ -338,12 +345,33 @@ export function addLayer(layer, player = null) {
} }
if (layer.grids[id].getUnlocked == undefined) { if (layer.grids[id].getUnlocked == undefined) {
layer.grids[id].getUnlocked = true; layer.grids[id].getUnlocked = true;
} else {
layer.grids[id].getUnlocked.forceCached = false;
} }
if (layer.grids[id].getCanClick == undefined) { if (layer.grids[id].getCanClick == undefined) {
layer.grids[id].getCanClick = true; layer.grids[id].getCanClick = true;
} else {
layer.grids[id].getCanClick.forceCached = false;
} }
if (layer.grids[id].getStartData == undefined) { if (layer.grids[id].getStartData == undefined) {
layer.grids[id].getStartData = ""; layer.grids[id].getStartData = "";
} else {
layer.grids[id].getStartData.forceCached = false;
}
if (layer.grids[id].getStyle != undefined) {
layer.grids[id].getStyle.forceCached = false;
}
if (layer.grids[id].onClick != undefined) {
layer.grids[id].onClick.forceCached = false;
}
if (layer.grids[id].onHold != undefined) {
layer.grids[id].onHold.forceCached = false;
}
if (layer.grids[id].getTitle != undefined) {
layer.grids[id].getTitle.forceCached = false;
}
if (layer.grids[id].getDisplay != undefined) {
layer.grids[id].getDisplay.forceCached = false;
} }
layer.grids[id].getData = function(cell) { layer.grids[id].getData = function(cell) {
if (player[layer.id].grids[id][cell] != undefined) { if (player[layer.id].grids[id][cell] != undefined) {
@ -362,16 +390,22 @@ export function addLayer(layer, player = null) {
} }
} }
if (layer.subtabs) { if (layer.subtabs) {
if (player.subtabs[layer.id] == undefined) {
player.subtabs[layer.id] = {};
}
if (player.subtabs[layer.id].mainTabs == undefined) {
player.subtabs[layer.id].mainTabs = Object.keys(layer.subtabs)[0];
}
for (let id in layer.subtabs) { for (let id in layer.subtabs) {
if (isPlainObject(layer.subtabs[id])) { if (isPlainObject(layer.subtabs[id])) {
layer.subtabs[id].active = function() { layer.subtabs[id].active = function() {
return player.subtabs[this.layer]?.mainTabs === this.id; return player.subtabs[this.layer].mainTabs === this.id;
} }
} }
} }
layer.activeSubtab = function() { layer.activeSubtab = function() {
if (this.subtabs != undefined) { if (this.subtabs != undefined) {
if (this.subtabs[player.subtabs[layer.id]?.mainTabs] && if (this.subtabs[player.subtabs[layer.id].mainTabs] &&
this.subtabs[player.subtabs[layer.id].mainTabs].unlocked !== false) { this.subtabs[player.subtabs[layer.id].mainTabs].unlocked !== false) {
return this.subtabs[player.subtabs[layer.id].mainTabs]; return this.subtabs[player.subtabs[layer.id].mainTabs];
} }
@ -381,7 +415,13 @@ export function addLayer(layer, player = null) {
} }
} }
if (layer.microtabs) { if (layer.microtabs) {
if (player.subtabs[layer.id] == undefined) {
player.subtabs[layer.id] = {};
}
for (let family in layer.microtabs) { for (let family in layer.microtabs) {
if (player.subtabs[layer.id][family] == undefined) {
player.subtabs[layer.id][family] = Object.keys(layer.microtabs[family])[0];
}
for (let id in layer.microtabs[family]) { for (let id in layer.microtabs[family]) {
if (isPlainObject(layer.microtabs[family][id])) { if (isPlainObject(layer.microtabs[family][id])) {
layer.microtabs[family][id].layer = layer.id; layer.microtabs[family][id].layer = layer.id;
@ -392,9 +432,11 @@ export function addLayer(layer, player = null) {
} }
} }
} }
layer.microtabs[family].layer = layer.id;
layer.microtabs[family].family = family;
layer.microtabs[family].activeMicrotab = function() { layer.microtabs[family].activeMicrotab = function() {
if (this[player.subtabs[layer.id][family]] && this[player.subtabs[layer.id][family]].unlocked !== false) { if (this[player.subtabs[this.layer]?.[family]] && this[player.subtabs[this.layer][family]].unlocked !== false) {
return this[player.subtabs[layer.id][family]]; return this[player.subtabs[this.layer][family]];
} }
// Default to first unlocked tab // Default to first unlocked tab
return this[Object.keys(this).find(microtab => microtab !== 'activeMicrotab' && this[microtab].unlocked !== false)]; return this[Object.keys(this).find(microtab => microtab !== 'activeMicrotab' && this[microtab].unlocked !== false)];

View file

@ -143,7 +143,7 @@ function getHandler(prefix) {
function getGridHandler(prefix) { function getGridHandler(prefix) {
return { return {
get(target, key, receiver) { get(target, key) {
if (key === 'isProxy') { if (key === 'isProxy') {
return true; return true;
} }
@ -159,9 +159,8 @@ function getGridHandler(prefix) {
const getterID = `${prefix}${key}`; const getterID = `${prefix}${key}`;
if (getterID in store.getters) { if (getterID in store.getters) {
return store.getters[getterID]; return store.getters[getterID];
} else {
return target[key].bind(receiver);
} }
// Non-cached functions are going to be cell-specific, so don't call them with the grid handler
} }
if (typeof key !== 'symbol' && !isNaN(key)) { if (typeof key !== 'symbol' && !isNaN(key)) {
target[key] = new Proxy(target, getCellHandler(key)); target[key] = new Proxy(target, getCellHandler(key));