dummy impls for requests and conflict resolution
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
<template>
|
||||
<div>
|
||||
<button class="button is-primary is-fullwidth"
|
||||
<div v-if="!isInConflict">
|
||||
<button class="button is-medium is-primary is-fullwidth"
|
||||
@click="putRequest"
|
||||
:disabled="isRequested">
|
||||
<span class="icon">
|
||||
@@ -8,6 +8,22 @@
|
||||
</span>
|
||||
</button>
|
||||
</div>
|
||||
<div class="buttons has-addons is-centered" v-else>
|
||||
<button class="button is-medium is-success"
|
||||
@click="cancelRequest"
|
||||
>
|
||||
<span class="icon">
|
||||
<i class="fas fa-hand-peace"></i>
|
||||
</span>
|
||||
</button>
|
||||
<button class="button is-medium is-danger"
|
||||
@click="hardenRequest"
|
||||
>
|
||||
<span class="icon">
|
||||
<i class="fas fa-dice"></i>
|
||||
</span>
|
||||
</button>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
@@ -28,13 +44,36 @@
|
||||
},
|
||||
// Check if item is requested by multiple players including active one
|
||||
isInConflict () {
|
||||
|
||||
const reqs = this.state.requests;
|
||||
const playerId = this.state.player_id;
|
||||
var reqByPlayer = false;
|
||||
var reqByOther = false;
|
||||
for (var key in reqs) {
|
||||
const isReq = reqs[key].includes(this.item);
|
||||
if (isReq) {
|
||||
if (key == playerId) {
|
||||
reqByPlayer = true;
|
||||
} else {
|
||||
reqByOther = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
return reqByPlayer && reqByOther;
|
||||
},
|
||||
},
|
||||
methods: {
|
||||
// The active player claims the item
|
||||
putRequest () {
|
||||
store.putRequest(this.item)
|
||||
},
|
||||
// The active player withdraws his request
|
||||
cancelRequest () {
|
||||
},
|
||||
// The active player insist on his claim
|
||||
// TODO: Find a simple and fun system to express
|
||||
// how much each player want an item
|
||||
hardenRequest () {
|
||||
}
|
||||
},
|
||||
}
|
||||
</script>
|
||||
|
||||
Reference in New Issue
Block a user