action sounds

This commit is contained in:
Alberto Xamin 2021-01-21 18:21:55 +01:00
parent 9ffe44f477
commit 4081d805f0
No known key found for this signature in database
GPG Key ID: 4F026F48309500A2
3 changed files with 6 additions and 2 deletions

Binary file not shown.

Binary file not shown.

View File

@ -14,6 +14,8 @@
</template> </template>
<script> <script>
import message_sfx from '@/assets/sounds/tap-kissy.mp3'
import notification_sfx from '@/assets/sounds/tap-sizzle.mp3'
export default { export default {
name: 'Chat', name: 'Chat',
data: () => ({ data: () => ({
@ -27,9 +29,11 @@ export default {
if ((typeof msg === "string") && msg.indexOf('_') === 0) { if ((typeof msg === "string") && msg.indexOf('_') === 0) {
let params = msg.split('|') let params = msg.split('|')
let type = params.shift().substring(1) let type = params.shift().substring(1)
this.messages.push({text:this.$t(`chat.${type}`, params)}) this.messages.push({text:this.$t(`chat.${type}`, params)});
(new Audio(notification_sfx)).play();
}else { }else {
this.messages.push(msg) (new Audio(message_sfx)).play();
this.messages.push(msg);
} }
let container = this.$el.querySelector("#chatbox"); let container = this.$el.querySelector("#chatbox");
container.scrollTop = container.scrollHeight; container.scrollTop = container.scrollHeight;