fix background empty / resetCallback - refactor pet methods/components

This commit is contained in:
negue
2018-10-24 20:43:15 +02:00
parent 16256ee190
commit 3c5025a78e
4 changed files with 17 additions and 27 deletions

View File

@@ -1,5 +1,5 @@
<template lang="pug"> <template lang="pug">
b-modal#hatching-modal(@change="resetHatchablePet($event)") b-modal#hatching-modal()
div.content(v-if="hatchablePet") div.content(v-if="hatchablePet")
div.potionEggGroup div.potionEggGroup
div.potionEggBackground div.potionEggBackground
@@ -73,12 +73,5 @@ export default {
}), }),
}; };
}, },
methods: {
resetHatchablePet ($event) {
if (!$event) {
this.hatchablePet = null;
}
},
},
}; };
</script> </script>

View File

@@ -88,7 +88,6 @@
:item="item", :item="item",
:popoverPosition="'top'", :popoverPosition="'top'",
:progress="item.progress", :progress="item.progress",
:emptyItem="!item.isOwned()",
:showPopover="currentDraggingFood == null", :showPopover="currentDraggingFood == null",
:highlightBorder="highlightPet == item.key", :highlightBorder="highlightPet == item.key",
@click="petClicked(item)" @click="petClicked(item)"

View File

@@ -8,7 +8,7 @@ div
span.item-content.hatchAgain(v-if="mountOwned && isHatchable") span.item-content.hatchAgain(v-if="mountOwned && isHatchable")
span.egg(:class="eggClass") span.egg(:class="eggClass")
span.potion(:class="potionClass") span.potion(:class="potionClass")
span.item-content(v-else, :class="getPetItemClass()") span.item-content(v-else, :class="getPetItemClass")
span.pet-progress-background(v-if="item.isAllowedToFeed() && progress > 0") span.pet-progress-background(v-if="item.isAllowedToFeed() && progress > 0")
div.pet-progress-bar(v-bind:style="{width: 100 * progress/50 + '%' }") div.pet-progress-bar(v-bind:style="{width: 100 * progress/50 + '%' }")
span.item-label(v-if="label") {{ label }} span.item-label(v-if="label") {{ label }}
@@ -85,10 +85,6 @@ div
type: Number, type: Number,
default: -1, default: -1,
}, },
emptyItem: {
type: Boolean,
default: false,
},
highlightBorder: { highlightBorder: {
type: Boolean, type: Boolean,
default: false, default: false,
@@ -111,12 +107,16 @@ div
click () { click () {
this.$emit('click', {}); this.$emit('click', {});
}, },
},
computed: {
potionClass () {
return `Pet_HatchingPotion_${this.item.potionKey}`;
},
eggClass () {
return `Pet_Egg_${this.item.eggKey}`;
},
getPetItemClass () { getPetItemClass () {
if (this.mountOwned && !this.isHatchable) { if (this.item.isOwned() || this.mountOwned && this.isHatchable) {
return `GreyedOut Pet Pet-${this.item.key} ${this.item.eggKey}`;
}
if (this.item.isOwned()) {
return `Pet Pet-${this.item.key} ${this.item.eggKey}`; return `Pet Pet-${this.item.key} ${this.item.eggKey}`;
} }
@@ -131,20 +131,15 @@ div
// Can't hatch // Can't hatch
return 'GreyedOut PixelPaw'; return 'GreyedOut PixelPaw';
}, },
},
computed: {
potionClass () {
return `Pet_HatchingPotion_${this.item.potionKey}`;
},
eggClass () {
return `Pet_Egg_${this.item.eggKey}`;
},
isHatchable () { isHatchable () {
return this.item.isHatchable(); return this.item.isHatchable();
}, },
mountOwned () { mountOwned () {
return this.item.mountOwned(); return this.item.mountOwned();
}, },
emptyItem () {
return !this.item.isOwned();
},
}, },
}; };
</script> </script>

View File

@@ -1,4 +1,7 @@
import notifications from './notifications';
export default { export default {
mixins: [notifications],
methods: { methods: {
closeHatchPetDialog () { closeHatchPetDialog () {
this.$root.$emit('bv::hide::modal', 'hatching-modal'); this.$root.$emit('bv::hide::modal', 'hatching-modal');