一起动作

master
yin5th 2021-11-25 10:23:54 +08:00
parent 571c3112e8
commit 66a46bd31c
1 changed files with 21 additions and 4 deletions

View File

@ -29,6 +29,23 @@ function getEvent(name) {
return map[name] ? map[name] : '' return map[name] ? map[name] : ''
} }
// 根据事件文字 获取领舞者事件名
function getLeaderEvent(name) {
let map = {
'切歌' : 'change_song',
'一起跳' : 'dancing-down',
'一起向左' : 'dancing-left',
'一起向右' : 'dancing-right',
'一起左抖腿' : 'dancing-wobble',
'一起右抖腿' : 'dancing-wobble-right',
'一起抖动' : 'dancing-up',
'一起喊' : 'all_shout',
'镜头' : scale()
}
return map[name] ? map[name] : ''
}
// 随机选择镜头 // 随机选择镜头
function scale() { function scale() {
return list[Math.floor(Math.random() * 3)]; return list[Math.floor(Math.random() * 3)];
@ -113,7 +130,7 @@ function receiveMessage(event)
return false return false
} }
adminList = ['内有猛犬小心','热心市民阿狄呐','流域_墨绿绿']; adminList = ['内有猛犬小心','热心市民阿狄呐','流域_墨绿绿'];
// adminList = ['饺子吃肉肉']; adminList = ['yin5th'];
// 大航海列表 // 大航海列表
if (adminList.length > 0) { if (adminList.length > 0) {
// 获取当前领舞人 // 获取当前领舞人
@ -159,11 +176,11 @@ function receiveMessage(event)
// 获取领舞信息 // 获取领舞信息
let leaderInfo = sessionStorage.getItem('leader') let leaderInfo = sessionStorage.getItem('leader')
let eventName = getEvent(data.danmaku)
let isLeader = data.uname == leaderInfo ? 1 : 0 let isLeader = data.uname == leaderInfo ? 1 : 0
let dm = {text: data.danmaku, uid: data.uid, uname: data.uname, let dm = {text: data.danmaku, uid: data.uid, uname: data.uname,
event: getEvent(data.danmaku), event: eventName,
is_new: isNew, is_admin: 0, is_leader: isLeader} is_new: isNew, is_admin: 0, is_leader: isLeader}
console.log(data.danmaku, '弹幕')
let leader = { let leader = {
uid: 0, uname: leaderInfo, text: '', event: '' uid: 0, uname: leaderInfo, text: '', event: ''
} }
@ -171,7 +188,7 @@ function receiveMessage(event)
leader.uid = dm.uid leader.uid = dm.uid
leader.uname = dm.uname leader.uname = dm.uname
leader.text = dm.text leader.text = dm.text
leader.event = dm.event leader.event = getLeaderEvent(dm.text)
} }
// 新用户 // 新用户
if(dm.is_new==1){ if(dm.is_new==1){