<template>
  <div>
    <chat-box
      ref="chatbox"
      :group="group"
      :user-role="userRole"
    />
    <script-tip ref="scriptTip" :offset="offset" @allowCreatCoversition="allowCreatCoversition" />
  </div>
</template>
<script>
import ChatBox from '../chatView/chatBox.vue';
import ScriptTip from '@/views/newMap/displayNew/scriptDisplay/component/scriptTip';

export default {
    name:'DemonChat',
    components:{
        ChatBox,
        ScriptTip
    },
    props: {
        group: {
            type: String,
            required: true
        },
        userRole: {
            type: String,
            required: true
        },
        offset: {
            type: Number,
            required: true
        }
    },
    watch:{
        // 剧本执行完成消息
        '$store.state.socket.scriptFinish':function(val, old) {
            this.$message('剧本演出完毕');
            this.$refs.scriptTip.resetScriptTip();
        }
    },
    mounted() {
    },
    methods:{
        clearAllData() {
            // this.resetCoversition();
            this.$refs.chatbox.resetCoversition();
            this.$refs.scriptTip.resetScriptTip();
        },
        resetCoversition() {
            this.$refs.chatbox.resetCoversition();
        },
        allowCreatCoversition() {
        },
        resetScriptTip() {
            this.$refs.scriptTip.resetScriptTip();
        },
        cancelCommonConversation() {
            this.$refs.chatbox.cancelCommonConversation();
        }
    }
};
</script>
