forked from profectus/Profectus
onClick, onPress, and onHold => click, press, and hold
This commit is contained in:
parent
6849b89706
commit
e5b031ddb0
11 changed files with 27 additions and 27 deletions
|
@ -3,7 +3,7 @@
|
||||||
<div slot="header">
|
<div slot="header">
|
||||||
<h2>Saves Manager</h2>
|
<h2>Saves Manager</h2>
|
||||||
</div>
|
</div>
|
||||||
<div slot="body" v-sortable="{ onUpdate, handle: '.handle' }">
|
<div slot="body" v-sortable="{ update, handle: '.handle' }">
|
||||||
<save v-for="(save, index) in saves" :key="index" :save="save" @open="openSave(save.id)" @export="exportSave(save.id)"
|
<save v-for="(save, index) in saves" :key="index" :save="save" @open="openSave(save.id)" @export="exportSave(save.id)"
|
||||||
@editSave="name => editSave(save.id, name)" @duplicate="duplicateSave(save.id)" @delete="deleteSave(save.id)" />
|
@editSave="name => editSave(save.id, name)" @duplicate="duplicateSave(save.id)" @delete="deleteSave(save.id)" />
|
||||||
</div>
|
</div>
|
||||||
|
@ -169,7 +169,7 @@ export default {
|
||||||
this.importingFailed = false;
|
this.importingFailed = false;
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
onUpdate(e) {
|
update(e) {
|
||||||
this.saves.splice(e.newIndex, 0, this.saves.splive(e.oldIndex, 1)[0]);
|
this.saves.splice(e.newIndex, 0, this.saves.splive(e.oldIndex, 1)[0]);
|
||||||
|
|
||||||
const modData = JSON.parse(decodeURIComponent(escape(atob(localStorage.getItem(modInfo.id)))));
|
const modData = JSON.parse(decodeURIComponent(escape(atob(localStorage.getItem(modInfo.id)))));
|
||||||
|
|
|
@ -89,8 +89,8 @@ export default {
|
||||||
clickTab(e) {
|
clickTab(e) {
|
||||||
if (e.shiftKey) {
|
if (e.shiftKey) {
|
||||||
player[this.id].forceTooltip = !player[this.id].forceTooltip;
|
player[this.id].forceTooltip = !player[this.id].forceTooltip;
|
||||||
} else if (this.layer.onClick != undefined) {
|
} else if (this.layer.click != undefined) {
|
||||||
this.layer.onClick();
|
this.layer.click();
|
||||||
} else if (this.layer.modal) {
|
} else if (this.layer.modal) {
|
||||||
this.$emit('show-modal', this.id);
|
this.$emit('show-modal', this.id);
|
||||||
} else if (this.append) {
|
} else if (this.append) {
|
||||||
|
|
|
@ -56,7 +56,7 @@ export default {
|
||||||
getStyle(cell, data) {
|
getStyle(cell, data) {
|
||||||
return {'background-color': '#'+ (data*1234%999999)}
|
return {'background-color': '#'+ (data*1234%999999)}
|
||||||
},
|
},
|
||||||
onClick() { // Don't forget onHold
|
click() { // Don't forget onHold
|
||||||
this.data++
|
this.data++
|
||||||
},
|
},
|
||||||
getTitle(cell) {
|
getTitle(cell) {
|
||||||
|
|
|
@ -222,8 +222,8 @@ export default {
|
||||||
}, // Useful for if you gain secondary resources or have other interesting things happen to this layer when you reset it. You gain the currency after this function ends.
|
}, // Useful for if you gain secondary resources or have other interesting things happen to this layer when you reset it. You gain the currency after this function ends.
|
||||||
|
|
||||||
hotkeys: [
|
hotkeys: [
|
||||||
{key: "c", description: "reset for lollipops or whatever", onPress(){if (layers[this.layer].canReset) resetLayer(this.layer)}},
|
{key: "c", description: "reset for lollipops or whatever", press(){if (layers[this.layer].canReset) resetLayer(this.layer)}},
|
||||||
{key: "ctrl+c", description: "respec things", onPress(){layers[this.layer].buyables.respec()}, unlocked() {return hasUpgrade('c', '22')}} ,
|
{key: "ctrl+c", description: "respec things", press(){layers[this.layer].buyables.respec()}, unlocked() {return hasUpgrade('c', '22')}} ,
|
||||||
],
|
],
|
||||||
increaseUnlockOrder: [], // Array of layer names to have their order increased when this one is first unlocked
|
increaseUnlockOrder: [], // Array of layer names to have their order increased when this one is first unlocked
|
||||||
|
|
||||||
|
|
|
@ -84,7 +84,7 @@ export default {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
onHold(){
|
hold(){
|
||||||
console.log("Clickkkkk...")
|
console.log("Clickkkkk...")
|
||||||
},
|
},
|
||||||
style() {
|
style() {
|
||||||
|
|
|
@ -32,7 +32,7 @@ export default {
|
||||||
prestigeButtonText(){return "Reset everything for +"+format(layers.i.getResetGain)+" Infinity.<br>You need "+format(layers.i.requires())+" pointy points to reset."},
|
prestigeButtonText(){return "Reset everything for +"+format(layers.i.getResetGain)+" Infinity.<br>You need "+format(layers.i.requires())+" pointy points to reset."},
|
||||||
row: 1, // Row the layer is in on the tree (0 is the first row)
|
row: 1, // Row the layer is in on the tree (0 is the first row)
|
||||||
hotkeys: [
|
hotkeys: [
|
||||||
{key: "i", description: "I: Infinity", onPress(){if (layers.i.canReset) resetLayer(this.layer)}},
|
{key: "i", description: "I: Infinity", press(){if (layers.i.canReset) resetLayer(this.layer)}},
|
||||||
],
|
],
|
||||||
layerShown(){return player[this.layer].unlocked||new Decimal(player.p.buyables[21]).gte(8)},
|
layerShown(){return player[this.layer].unlocked||new Decimal(player.p.buyables[21]).gte(8)},
|
||||||
milestones: {
|
milestones: {
|
||||||
|
|
|
@ -47,7 +47,7 @@ export default {
|
||||||
},
|
},
|
||||||
row: 0, // Row the layer is in on the tree (0 is the first row)
|
row: 0, // Row the layer is in on the tree (0 is the first row)
|
||||||
hotkeys: [
|
hotkeys: [
|
||||||
{key: "p", description: "P: Reset for prestige points", onPress(){if (layers.p.canReset) resetLayer(this.layer)}},
|
{key: "p", description: "P: Reset for prestige points", press(){if (layers.p.canReset) resetLayer(this.layer)}},
|
||||||
],
|
],
|
||||||
layerShown(){return true},
|
layerShown(){return true},
|
||||||
upgrades:{
|
upgrades:{
|
||||||
|
@ -503,7 +503,7 @@ export default {
|
||||||
|
|
||||||
display() {return "Multiply generator efficiency by "+format(player.p.cmult)+((player.p.cmult.min(100).eq(100)&&!hasUpgrade(this.layer,111))?" (hardcapped)":"")},
|
display() {return "Multiply generator efficiency by "+format(player.p.cmult)+((player.p.cmult.min(100).eq(100)&&!hasUpgrade(this.layer,111))?" (hardcapped)":"")},
|
||||||
unlocked(){return hasUpgrade("p",94)},
|
unlocked(){return hasUpgrade("p",94)},
|
||||||
onClick(){player.p.cmult=player.p.cmult.plus(hasUpgrade("p",141)?1:0.01)
|
click(){player.p.cmult=player.p.cmult.plus(hasUpgrade("p",141)?1:0.01)
|
||||||
if (!hasUpgrade(this.layer,111))player.p.cmult=player.p.cmult.min(100)
|
if (!hasUpgrade(this.layer,111))player.p.cmult=player.p.cmult.min(100)
|
||||||
},
|
},
|
||||||
canClick(){return player.p.cmult.lt(100)||hasUpgrade(this.layer,111)},
|
canClick(){return player.p.cmult.lt(100)||hasUpgrade(this.layer,111)},
|
||||||
|
|
|
@ -16,7 +16,7 @@ const g = {
|
||||||
shown: true,
|
shown: true,
|
||||||
canClick() {return player.points.gte(10)},
|
canClick() {return player.points.gte(10)},
|
||||||
tooltip: "Thanos your points",
|
tooltip: "Thanos your points",
|
||||||
onClick() {
|
click() {
|
||||||
player.points = player.points.div(2);
|
player.points = player.points.div(2);
|
||||||
console.log(this.layer);
|
console.log(this.layer);
|
||||||
}
|
}
|
||||||
|
@ -27,7 +27,7 @@ const h = {
|
||||||
tooltip() {return "Restore your points to {{ player.c.otherThingy }}"},
|
tooltip() {return "Restore your points to {{ player.c.otherThingy }}"},
|
||||||
row: "side",
|
row: "side",
|
||||||
canClick() {return player.points.lt(player.c.otherThingy)},
|
canClick() {return player.points.lt(player.c.otherThingy)},
|
||||||
onClick() {player.points = new Decimal(player.c.otherThingy)}
|
click() {player.points = new Decimal(player.c.otherThingy)}
|
||||||
};
|
};
|
||||||
const spook = {
|
const spook = {
|
||||||
id: "spook",
|
id: "spook",
|
||||||
|
|
|
@ -292,8 +292,8 @@ 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) {
|
if (layer.clickables[id].hold != undefined) {
|
||||||
layer.clickables[id].onHold.forceCached = false;
|
layer.clickables[id].hold.forceCached = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -361,11 +361,11 @@ export function addLayer(layer, player = null) {
|
||||||
if (layer.grids[id].getStyle != undefined) {
|
if (layer.grids[id].getStyle != undefined) {
|
||||||
layer.grids[id].getStyle.forceCached = false;
|
layer.grids[id].getStyle.forceCached = false;
|
||||||
}
|
}
|
||||||
if (layer.grids[id].onClick != undefined) {
|
if (layer.grids[id].click != undefined) {
|
||||||
layer.grids[id].onClick.forceCached = false;
|
layer.grids[id].click.forceCached = false;
|
||||||
}
|
}
|
||||||
if (layer.grids[id].onHold != undefined) {
|
if (layer.grids[id].hold != undefined) {
|
||||||
layer.grids[id].onHold.forceCached = false;
|
layer.grids[id].hold.forceCached = false;
|
||||||
}
|
}
|
||||||
if (layer.grids[id].getTitle != undefined) {
|
if (layer.grids[id].getTitle != undefined) {
|
||||||
layer.grids[id].getTitle.forceCached = false;
|
layer.grids[id].getTitle.forceCached = false;
|
||||||
|
@ -446,8 +446,8 @@ export function addLayer(layer, player = null) {
|
||||||
if (layer.hotkeys) {
|
if (layer.hotkeys) {
|
||||||
for (let id in layer.hotkeys) {
|
for (let id in layer.hotkeys) {
|
||||||
if (isPlainObject(layer.hotkeys[id])) {
|
if (isPlainObject(layer.hotkeys[id])) {
|
||||||
if (layer.hotkeys[id].onPress) {
|
if (layer.hotkeys[id].press) {
|
||||||
layer.hotkeys[id].onPress.forceCached = false;
|
layer.hotkeys[id].press.forceCached = false;
|
||||||
}
|
}
|
||||||
if (layer.hotkeys[id].unlocked == undefined) {
|
if (layer.hotkeys[id].unlocked == undefined) {
|
||||||
layer.hotkeys[id].unlocked = function() {
|
layer.hotkeys[id].unlocked = function() {
|
||||||
|
@ -492,7 +492,7 @@ export function reloadLayer(layer) {
|
||||||
addLayer(layer);
|
addLayer(layer);
|
||||||
}
|
}
|
||||||
|
|
||||||
const uncachedProperties = [ 'startData', 'onClick', 'update', 'reset', 'hardReset' ];
|
const uncachedProperties = [ 'startData', 'click', 'update', 'reset', 'hardReset' ];
|
||||||
const gridProperties = [ 'upgrades', 'achievements', 'challenges', 'buyables', 'clickables' ];
|
const gridProperties = [ 'upgrades', 'achievements', 'challenges', 'buyables', 'clickables' ];
|
||||||
const featureProperties = [ 'upgrades', 'achievements', 'challenges', 'buyables', 'clickables', 'milestones', 'bars',
|
const featureProperties = [ 'upgrades', 'achievements', 'challenges', 'buyables', 'clickables', 'milestones', 'bars',
|
||||||
'infoboxes', 'grids', 'hotkeys', 'subtabs' ];
|
'infoboxes', 'grids', 'hotkeys', 'subtabs' ];
|
||||||
|
|
|
@ -186,11 +186,11 @@ function getCellHandler(id) {
|
||||||
}
|
}
|
||||||
|
|
||||||
let prop = target[key];
|
let prop = target[key];
|
||||||
if (prop != undefined) {
|
|
||||||
return prop;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (key.slice == undefined) {
|
if (isFunction(prop) && prop.forceCached === false) {
|
||||||
|
return () => prop.call(receiver, id, target.getData(id));
|
||||||
|
}
|
||||||
|
if (prop != undefined || key.slice == undefined) {
|
||||||
return prop;
|
return prop;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -307,7 +307,7 @@ document.onkeydown = function(e) {
|
||||||
if (hotkeys[key]) {
|
if (hotkeys[key]) {
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
if (hotkeys[key].unlocked) {
|
if (hotkeys[key].unlocked) {
|
||||||
hotkeys[key].onPress?.();
|
hotkeys[key].press?.();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue