feat: end turn warning
This commit is contained in:
+30
-1
@@ -4,6 +4,27 @@ import { CardEffects } from '@/netcode/Effect'
|
||||
|
||||
const isTurn = computed(() => goStore.self?.team == goStore.current_game?.current_turn)
|
||||
|
||||
let warning = ref(false)
|
||||
|
||||
function checkEndTurn() {
|
||||
// TODO: Add a confirmation dialog if resources are left
|
||||
if (
|
||||
(warning.value)
|
||||
|| (goStore.self?.turn?.damage_reserve ? goStore.self?.turn?.damage_reserve > 0 : false)
|
||||
|| (goStore.self?.turn?.gold_reserve ? goStore.self?.turn?.gold_reserve > 0 : false)
|
||||
|| (goStore.self?.turn?.fuck_u_markers ? goStore.self?.turn?.fuck_u_markers > 0 : false)) {
|
||||
// Set a warning flag to true
|
||||
// Display an alert somehow using this warning flag
|
||||
warning.value = true
|
||||
}
|
||||
else {
|
||||
warning.value = false
|
||||
endTurn()
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
</script>
|
||||
|
||||
<template>
|
||||
@@ -13,7 +34,8 @@ const isTurn = computed(() => goStore.self?.team == goStore.current_game?.curren
|
||||
:disabled="!goStore.self.turn.find_effect(CardEffects.MAKE_DISCARD)">
|
||||
make Discard</button>
|
||||
<div id="turn_data">
|
||||
<button id="end_turn" v-if="isTurn" @click="endTurn">END TURN</button>
|
||||
<div class="warning" v-if="warning">ATTENTION: il reste des ressources!</div>
|
||||
<button id="end_turn" v-if="isTurn" @click="">END TURN</button>
|
||||
<PlayerStats v-if="goStore.self" :player='goStore.self'></PlayerStats>
|
||||
</div>
|
||||
|
||||
@@ -61,6 +83,13 @@ const isTurn = computed(() => goStore.self?.team == goStore.current_game?.curren
|
||||
z-index: 9;
|
||||
}
|
||||
|
||||
.warning {
|
||||
background-color: red;
|
||||
color: white;
|
||||
padding: 5px;
|
||||
border-radius: 5px;
|
||||
}
|
||||
|
||||
#end_turn {
|
||||
z-index: 10;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user