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">
|
||||
<h2>Saves Manager</h2>
|
||||
</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)"
|
||||
@editSave="name => editSave(save.id, name)" @duplicate="duplicateSave(save.id)" @delete="deleteSave(save.id)" />
|
||||
</div>
|
||||
|
@ -169,7 +169,7 @@ export default {
|
|||
this.importingFailed = false;
|
||||
}
|
||||
},
|
||||
onUpdate(e) {
|
||||
update(e) {
|
||||
this.saves.splice(e.newIndex, 0, this.saves.splive(e.oldIndex, 1)[0]);
|
||||
|
||||
const modData = JSON.parse(decodeURIComponent(escape(atob(localStorage.getItem(modInfo.id)))));
|
||||
|
|
|
@ -89,8 +89,8 @@ export default {
|
|||
clickTab(e) {
|
||||
if (e.shiftKey) {
|
||||
player[this.id].forceTooltip = !player[this.id].forceTooltip;
|
||||
} else if (this.layer.onClick != undefined) {
|
||||
this.layer.onClick();
|
||||
} else if (this.layer.click != undefined) {
|
||||
this.layer.click();
|
||||
} else if (this.layer.modal) {
|
||||
this.$emit('show-modal', this.id);
|
||||
} else if (this.append) {
|
||||
|
|
|
@ -56,7 +56,7 @@ export default {
|
|||
getStyle(cell, data) {
|
||||
return {'background-color': '#'+ (data*1234%999999)}
|
||||
},
|
||||
onClick() { // Don't forget onHold
|
||||
click() { // Don't forget onHold
|
||||
this.data++
|
||||
},
|
||||
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.
|
||||
|
||||
hotkeys: [
|
||||
{key: "c", description: "reset for lollipops or whatever", onPress(){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: "c", description: "reset for lollipops or whatever", press(){if (layers[this.layer].canReset) resetLayer(this.layer)}},
|
||||
{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
|
||||
|
||||
|
|
|
@ -84,7 +84,7 @@ export default {
|
|||
break;
|
||||
}
|
||||
},
|
||||
onHold(){
|
||||
hold(){
|
||||
console.log("Clickkkkk...")
|
||||
},
|
||||
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."},
|
||||
row: 1, // Row the layer is in on the tree (0 is the first row)
|
||||
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)},
|
||||
milestones: {
|
||||
|
|
|
@ -47,7 +47,7 @@ export default {
|
|||
},
|
||||
row: 0, // Row the layer is in on the tree (0 is the first row)
|
||||
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},
|
||||
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)":"")},
|
||||
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)
|
||||
},
|
||||
canClick(){return player.p.cmult.lt(100)||hasUpgrade(this.layer,111)},
|
||||
|
|
|
@ -16,7 +16,7 @@ const g = {
|
|||
shown: true,
|
||||
canClick() {return player.points.gte(10)},
|
||||
tooltip: "Thanos your points",
|
||||
onClick() {
|
||||
click() {
|
||||
player.points = player.points.div(2);
|
||||
console.log(this.layer);
|
||||
}
|
||||
|
@ -27,7 +27,7 @@ const h = {
|
|||
tooltip() {return "Restore your points to {{ player.c.otherThingy }}"},
|
||||
row: "side",
|
||||
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 = {
|
||||
id: "spook",
|
||||
|
|
|
@ -292,8 +292,8 @@ export function addLayer(layer, player = null) {
|
|||
if (layer.clickables[id].click != undefined) {
|
||||
layer.clickables[id].click.forceCached = false;
|
||||
}
|
||||
if (layer.clickables[id].onHold != undefined) {
|
||||
layer.clickables[id].onHold.forceCached = false;
|
||||
if (layer.clickables[id].hold != undefined) {
|
||||
layer.clickables[id].hold.forceCached = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -361,11 +361,11 @@ export function addLayer(layer, player = null) {
|
|||
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].click != undefined) {
|
||||
layer.grids[id].click.forceCached = false;
|
||||
}
|
||||
if (layer.grids[id].onHold != undefined) {
|
||||
layer.grids[id].onHold.forceCached = false;
|
||||
if (layer.grids[id].hold != undefined) {
|
||||
layer.grids[id].hold.forceCached = false;
|
||||
}
|
||||
if (layer.grids[id].getTitle != undefined) {
|
||||
layer.grids[id].getTitle.forceCached = false;
|
||||
|
@ -446,8 +446,8 @@ export function addLayer(layer, player = null) {
|
|||
if (layer.hotkeys) {
|
||||
for (let id in layer.hotkeys) {
|
||||
if (isPlainObject(layer.hotkeys[id])) {
|
||||
if (layer.hotkeys[id].onPress) {
|
||||
layer.hotkeys[id].onPress.forceCached = false;
|
||||
if (layer.hotkeys[id].press) {
|
||||
layer.hotkeys[id].press.forceCached = false;
|
||||
}
|
||||
if (layer.hotkeys[id].unlocked == undefined) {
|
||||
layer.hotkeys[id].unlocked = function() {
|
||||
|
@ -492,7 +492,7 @@ export function reloadLayer(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 featureProperties = [ 'upgrades', 'achievements', 'challenges', 'buyables', 'clickables', 'milestones', 'bars',
|
||||
'infoboxes', 'grids', 'hotkeys', 'subtabs' ];
|
||||
|
|
|
@ -186,11 +186,11 @@ function getCellHandler(id) {
|
|||
}
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
|
|
|
@ -307,7 +307,7 @@ document.onkeydown = function(e) {
|
|||
if (hotkeys[key]) {
|
||||
e.preventDefault();
|
||||
if (hotkeys[key].unlocked) {
|
||||
hotkeys[key].onPress?.();
|
||||
hotkeys[key].press?.();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue