Merge pull request 'feat: confirm warning on end turn' (#42) from feat/confirm-end-turn into main
release-tag / release-image (push) Successful in 30s
release-tag / release-image (push) Successful in 30s
Reviewed-on: legonzaur/heron-realms-front#42
This commit was merged in pull request #42.
This commit is contained in:
+34
-1
@@ -4,6 +4,29 @@ import { CardEffects } from '@/netcode/Effect'
|
|||||||
|
|
||||||
const isTurn = computed(() => goStore.self?.team == goStore.current_game?.current_turn)
|
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
|
||||||
|
console.log("Checking end turn")
|
||||||
|
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>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
@@ -13,7 +36,8 @@ const isTurn = computed(() => goStore.self?.team == goStore.current_game?.curren
|
|||||||
:disabled="!goStore.self.turn.find_effect(CardEffects.MAKE_DISCARD)">
|
:disabled="!goStore.self.turn.find_effect(CardEffects.MAKE_DISCARD)">
|
||||||
make Discard</button>
|
make Discard</button>
|
||||||
<div id="turn_data">
|
<div id="turn_data">
|
||||||
<button id="end_turn" v-if="isTurn" @click="endTurn">END TURN</button>
|
<div class="warning" v-if="warning">/!\<br> Effets restants!<br> /!\</div>
|
||||||
|
<button id="end_turn" v-if="isTurn" @click="checkEndTurn">END TURN</button>
|
||||||
<PlayerStats v-if="goStore.self" :player='goStore.self'></PlayerStats>
|
<PlayerStats v-if="goStore.self" :player='goStore.self'></PlayerStats>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
@@ -61,6 +85,15 @@ const isTurn = computed(() => goStore.self?.team == goStore.current_game?.curren
|
|||||||
z-index: 9;
|
z-index: 9;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.warning {
|
||||||
|
background-color: rgba(255, 0, 0, 0.7);
|
||||||
|
color: white;
|
||||||
|
padding: 5px;
|
||||||
|
border-radius: 5px;
|
||||||
|
width: 60px;
|
||||||
|
font-size: 0.9em;
|
||||||
|
}
|
||||||
|
|
||||||
#end_turn {
|
#end_turn {
|
||||||
z-index: 10;
|
z-index: 10;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user