Action interruption progress

This commit is contained in:
Thaum Rystra
2024-03-26 23:25:18 +02:00
parent 57220c7972
commit e083490cb3
12 changed files with 184 additions and 62 deletions

View File

@@ -116,15 +116,14 @@
<script lang="js">
import { getPropertyName } from '/imports/constants/PROPERTIES';
import numberToSignedString from '../../../../../api/utility/numberToSignedString';
//TODO import doAction from '/imports/api/engine/actions/doAction';
import numberToSignedString from '/imports/api/utility/numberToSignedString';
import doAction from '/imports/client/ui/creature/actions/doAction';
import ActionConditionView from '/imports/client/ui/properties/components/actions/ActionConditionView.vue';
import AttributeConsumedView from '/imports/client/ui/properties/components/actions/AttributeConsumedView.vue';
import ItemConsumedView from '/imports/client/ui/properties/components/actions/ItemConsumedView.vue';
import PropertyIcon from '/imports/client/ui/properties/shared/PropertyIcon.vue';
import RollPopup from '/imports/client/ui/components/RollPopup.vue';
import MarkdownText from '/imports/client/ui/components/MarkdownText.vue';
import { snackbar } from '/imports/client/ui/components/snackbars/SnackbarQueue';
import CardHighlight from '/imports/client/ui/components/CardHighlight.vue';
import TreeNodeList from '/imports/client/ui/components/tree/TreeNodeList.vue';
import { docsToForest as nodeArrayToTree } from '/imports/api/parenting/parentingFunctions';

View File

@@ -1,7 +1,7 @@
<template lang="html">
<v-btn
:loading="doActionLoading"
:disabled="context.editPermission === false"
:data-id="`event-btn-${model._id}`"
outlined
class="event-button"
style="min-width: 160px; max-width: 100%;"
@@ -21,9 +21,8 @@
</template>
<script lang="js">
//TODO import doAction from '/imports/api/engine/actions/doAction';
import doAction from '/imports/client/ui/creature/actions/doAction';
import PropertyIcon from '/imports/client/ui/properties/shared/PropertyIcon.vue';
import { snackbar } from '/imports/client/ui/components/snackbars/SnackbarQueue';
export default {
components: {
@@ -39,36 +38,12 @@ export default {
},
},
data(){return {
activated: undefined,
doActionLoading: false,
hovering: false,
}},
methods: {
click(e) {
this.$emit('click', e);
doAction() {
doAction(this.model, this.$store, `event-btn-${this.model._id}`);
},
doAction({ advantage }) {
this.doActionLoading = true;
this.shwing();
doAction.call({
actionId: this.model._id,
scope: {
'~attackAdvantage': { value: advantage },
}
}, error => {
this.doActionLoading = false;
if (error) {
console.error(error);
snackbar({ text: error.reason });
}
});
},
shwing() {
this.activated = true;
setTimeout(() => {
this.activated = undefined;
}, 150);
}
}
}
</script>