add sounds for turn and death

This commit is contained in:
Alberto Xamin 2021-01-21 21:28:36 +01:00
parent 4081d805f0
commit f628ab75dc
No known key found for this signature in database
GPG Key ID: 4F026F48309500A2
4 changed files with 13 additions and 2 deletions

Binary file not shown.

Binary file not shown.

View File

@ -16,8 +16,13 @@
<script>
import message_sfx from '@/assets/sounds/tap-kissy.mp3'
import notification_sfx from '@/assets/sounds/tap-sizzle.mp3'
import turn_sfx from '@/assets/sounds/beep-holdtone.mp3'
import death_sfx from '@/assets/sounds/beep-organ.mp3'
export default {
name: 'Chat',
props: {
username: String
},
data: () => ({
messages: [],
text: '',
@ -30,7 +35,13 @@ export default {
let params = msg.split('|')
let type = params.shift().substring(1)
this.messages.push({text:this.$t(`chat.${type}`, params)});
if (type == 'turn' && params[0] == this.username) {
(new Audio(turn_sfx)).play();
}else if (type == 'died_role') {
(new Audio(death_sfx)).play();
}else{
(new Audio(notification_sfx)).play();
}
}else {
(new Audio(message_sfx)).play();
this.messages.push(msg);

View File

@ -58,7 +58,7 @@
<player :isEndingTurn="wantsToEndTurn" :cancelEndingTurn="()=>{wantsToEndTurn = false}" :chooseCardFromPlayer="choose" :cancelChooseCardFromPlayer="()=>{hasToChoose=false}"/>
</div>
</div>
<chat/>
<chat :username="username"/>
<Chooser v-if="selectedInfo" :text="$t('details')" :cards="selectedInfo" :cancelText="$t('ok')" :cancel="()=>{selectedInfo = null}" :select="()=>{selectedInfo = null}"/>
<transition name="bounce">
<Chooser v-if="hasToChoose" :text="`${$t('choose_card')}${target_p?$t('choose_card_from') + target_p:''}`" :cards="chooseCards" :select="chooseCard"/>