2021-11-25 10:11:01 +00:00
|
|
|
// 对象uid=>最近弹幕时间
|
2021-11-22 10:35:45 +00:00
|
|
|
let uidObj = {}
|
2021-11-25 10:11:01 +00:00
|
|
|
|
|
|
|
// 歌曲库地址
|
|
|
|
let musicUrl = 'https://bili.scdxtc.cn'
|
|
|
|
|
|
|
|
// 自动删除不说话用户
|
2021-11-25 11:42:43 +00:00
|
|
|
let autoDel = false
|
2021-12-08 02:38:18 +00:00
|
|
|
|
|
|
|
// 是否开始虚拟人物
|
|
|
|
let virtualPeople = true
|
|
|
|
|
|
|
|
// 虚拟人物数量
|
2021-12-08 03:06:44 +00:00
|
|
|
let virtualNum = 50
|
2021-12-08 02:38:18 +00:00
|
|
|
|
2021-12-08 02:40:12 +00:00
|
|
|
// 虚拟人物名字列表
|
2021-12-08 03:06:44 +00:00
|
|
|
let virtualList = ['一只小绵飏','未来狗头耀武扬威什么','大牛逼玩意','长呆毛的呆猫','区实验川大聪明',
|
|
|
|
'卡拉提斯','洛天依ぅ','时光向晚','宵行Lis','给个香香的三连',
|
|
|
|
'不能翻身的咸鱼鹅','gxuangg','海绵eat宝宝','滚动的天空-轩','天知道我取了什么名字',
|
|
|
|
'秋去春来流水落花','溪溪子和酱酱子','秦昭烈帝曹操','樱子君','兜兜里有糖的洛洛',
|
|
|
|
'女王说部落都是废物','张卡2511小号','花大屎','小德佬冲鸭','l仙儿',
|
|
|
|
'钻石五的维克多','推进式地狱双头龙','骧华阳','暗月丶无心','织子双立人',
|
|
|
|
'下木先生','Naakoo','粉红色的小铲铲','drair1','为什么会变成大冬',
|
|
|
|
'红林叶影','整肠生南国','叶老狗-','瓜皮小博','一个过路的好人',
|
|
|
|
'不会玩的泰菲','三剑客2020','Kola呀考拉','住在张总的酒窝里','哆_哆啦A梦',
|
|
|
|
'一只小菜包呐','夫人老婆','爱霏妹的老邢','耄耋just','This-is-斯巴达'
|
|
|
|
]
|
2021-12-08 02:38:18 +00:00
|
|
|
|
|
|
|
let virtualWordList = ['哈哈哈', '我又来了!', '大爷闪亮登场', '真会玩 哈哈']
|
|
|
|
|
2021-12-08 08:27:13 +00:00
|
|
|
// 礼物所需电池列表
|
|
|
|
let giftList = {
|
|
|
|
'粉丝团灯牌': 1,
|
|
|
|
'牛哇牛哇': 1,
|
|
|
|
'白银宝盒': 10,
|
|
|
|
'紫金宝盒': 100,
|
|
|
|
'D言D语': 330,
|
|
|
|
'星愿水晶球': 1000,
|
|
|
|
'为你加冕': 4500,
|
|
|
|
'探索者启航': 23330,
|
|
|
|
'小花花': 1,
|
|
|
|
'这个好诶': 10,
|
|
|
|
'盛典门票': 20,
|
|
|
|
'庆典礼花': 880,
|
|
|
|
'告白花束': 220,
|
|
|
|
'疯狂心动': 520,
|
|
|
|
'守护之翼': 2000,
|
|
|
|
'次元之城': 12450,
|
|
|
|
'i了i了': 1,
|
|
|
|
'打call': 5,
|
|
|
|
'情书': 52,
|
|
|
|
'干杯': 66,
|
|
|
|
'B坷垃': 99,
|
|
|
|
'撒花': 660,
|
|
|
|
'节奏风暴': 1000,
|
|
|
|
'心动卡': 1,
|
|
|
|
'泡泡机': 50,
|
|
|
|
'爱之魔力': 280,
|
|
|
|
'摩天轮': 1000,
|
|
|
|
'转运锦鲤': 6660,
|
|
|
|
'领航者飞船': 12450,
|
|
|
|
'友谊的小船': 52,
|
|
|
|
'冲浪': 1000,
|
|
|
|
'奈斯': 20,
|
|
|
|
'变身话筒': 20,
|
|
|
|
'喵娘': 52
|
|
|
|
}
|
|
|
|
|
|
|
|
// 用户消费电池 姓名: 电池量
|
|
|
|
let userCell = {}
|
|
|
|
|
2021-11-25 10:11:01 +00:00
|
|
|
// 多少秒不说话删除
|
|
|
|
let speakExpireTime = 10*60
|
2021-11-23 04:15:38 +00:00
|
|
|
// 歌曲列表
|
2021-12-08 02:38:18 +00:00
|
|
|
let musicList = []
|
2021-11-21 09:03:00 +00:00
|
|
|
|
|
|
|
// 领舞人领舞时间 秒
|
2021-11-23 06:44:56 +00:00
|
|
|
let leaderTime = 15*60
|
2021-11-24 02:48:14 +00:00
|
|
|
// 何时添加镜头
|
|
|
|
var addJingTime = 2000;//2秒
|
2021-11-20 13:07:24 +00:00
|
|
|
// 事件列表-中文
|
2021-12-07 05:43:20 +00:00
|
|
|
let eventTextList = ['切歌', '跳', '向左', '向右', '左抖腿', '右抖腿', '抖动', '一起喊', '镜头','击剑','起飞']
|
|
|
|
// 个人---荧光棒列表-中文
|
|
|
|
let fluoTextList = ['击剑','起飞'];
|
|
|
|
// 领舞---荧光棒列表-中文
|
|
|
|
let leaderFluoList = ['一起击剑','一起起飞'];
|
2021-11-24 02:48:14 +00:00
|
|
|
// 领舞者喊的集体舞
|
2021-11-23 14:04:00 +00:00
|
|
|
let allEventList = ['切歌', '一起跳', '一起向左', '一起向右', '一起左抖腿', '一起右抖腿', '一起抖动', '一起喊', '镜头']
|
2021-11-24 02:48:14 +00:00
|
|
|
// 镜头列表
|
2021-11-23 13:54:58 +00:00
|
|
|
let list = ['scale-left', 'scale-right', 'scale-bottom-left', 'scale-bottom-right']
|
2021-11-26 13:03:06 +00:00
|
|
|
// 烟花次数
|
|
|
|
let firTimes = 0;
|
2021-12-07 05:43:20 +00:00
|
|
|
// 个人喊舞:根据事件文字 获取事件名
|
2021-11-20 13:07:24 +00:00
|
|
|
function getEvent(name) {
|
|
|
|
let map = {
|
2021-11-26 13:03:06 +00:00
|
|
|
'烟花':'fireworks',
|
2021-11-20 13:07:24 +00:00
|
|
|
'切歌' : 'change_song',
|
2021-11-23 14:04:00 +00:00
|
|
|
'跳' : 'dancing-down',
|
2021-11-20 13:07:24 +00:00
|
|
|
'向左' : 'dancing-left',
|
|
|
|
'向右' : 'dancing-right',
|
|
|
|
'左抖腿' : 'dancing-wobble',
|
|
|
|
'右抖腿' : 'dancing-wobble-right',
|
|
|
|
'抖动' : 'dancing-up',
|
|
|
|
'一起喊' : 'all_shout',
|
|
|
|
'镜头' : scale()
|
|
|
|
}
|
2021-11-21 09:03:00 +00:00
|
|
|
|
|
|
|
return map[name] ? map[name] : ''
|
2021-11-20 13:07:24 +00:00
|
|
|
}
|
|
|
|
|
2021-12-07 05:43:20 +00:00
|
|
|
// 领舞者:根据事件文字 获取事件名
|
2021-11-25 02:23:54 +00:00
|
|
|
function getLeaderEvent(name) {
|
|
|
|
let map = {
|
2021-11-26 13:03:06 +00:00
|
|
|
'烟花':'fireworks',
|
2021-11-25 02:23:54 +00:00
|
|
|
'切歌' : 'change_song',
|
|
|
|
'一起跳' : 'dancing-down',
|
|
|
|
'一起向左' : 'dancing-left',
|
|
|
|
'一起向右' : 'dancing-right',
|
|
|
|
'一起左抖腿' : 'dancing-wobble',
|
|
|
|
'一起右抖腿' : 'dancing-wobble-right',
|
|
|
|
'一起抖动' : 'dancing-up',
|
|
|
|
'一起喊' : 'all_shout',
|
|
|
|
'镜头' : scale()
|
|
|
|
}
|
|
|
|
|
|
|
|
return map[name] ? map[name] : ''
|
|
|
|
}
|
2021-12-07 05:43:20 +00:00
|
|
|
//
|
|
|
|
function getLeaderFluoEvent(name) {
|
|
|
|
let leadMap = {
|
|
|
|
'一起击剑':'stickcome',
|
|
|
|
'一起起飞':'stick-go'
|
|
|
|
}
|
|
|
|
return leadMap[name] ? leadMap[name] : ''
|
|
|
|
}
|
2021-11-20 13:07:24 +00:00
|
|
|
// 随机选择镜头
|
|
|
|
function scale() {
|
2021-11-24 13:09:21 +00:00
|
|
|
return list[Math.floor(Math.random() * 3)];
|
2021-11-20 13:07:24 +00:00
|
|
|
}
|
|
|
|
// 字符串包含的事件 (仅取第一个)
|
2021-12-07 05:43:20 +00:00
|
|
|
// function getFirstEventKeyword(name) {
|
|
|
|
// let event = ''
|
|
|
|
// $.each(eventTextList, function (index, item) {
|
|
|
|
// if (name.toString().indexOf(item) != -1) {
|
|
|
|
// event = item
|
|
|
|
// return false
|
|
|
|
// }
|
|
|
|
// })
|
|
|
|
// return event
|
|
|
|
// }
|
2021-11-20 13:07:24 +00:00
|
|
|
|
2021-11-23 04:15:38 +00:00
|
|
|
function music() {
|
2021-11-25 10:11:01 +00:00
|
|
|
$.get(musicUrl, function (res) {
|
2021-11-23 04:15:38 +00:00
|
|
|
musicList = res
|
|
|
|
if (musicList.length > 0) {
|
2021-11-25 10:11:01 +00:00
|
|
|
$('#music source').attr('src', musicUrl+'/music/'+musicList[0])
|
2021-11-23 04:15:38 +00:00
|
|
|
}
|
|
|
|
})
|
|
|
|
}
|
|
|
|
|
2021-11-23 04:54:37 +00:00
|
|
|
// 切歌
|
2021-11-23 04:15:38 +00:00
|
|
|
function changeMusic() {
|
2021-11-25 10:11:01 +00:00
|
|
|
$.get(musicUrl, function (res) {
|
2021-11-23 04:15:38 +00:00
|
|
|
musicList = res
|
|
|
|
if (musicList.length > 0) {
|
2021-11-23 04:54:37 +00:00
|
|
|
let index = Math.floor(Math.random()*(musicList.length-1))
|
|
|
|
$('#music').data('song', musicList[index])
|
2021-11-25 10:11:01 +00:00
|
|
|
$('#music source').attr('src', musicUrl+'/music/'+musicList[index])
|
2021-11-23 04:54:37 +00:00
|
|
|
$('#music')[0].load()
|
2021-11-23 04:15:38 +00:00
|
|
|
}
|
|
|
|
})
|
|
|
|
}
|
2021-11-23 13:14:51 +00:00
|
|
|
// 个人喊舞
|
|
|
|
function peopleHan(val){
|
|
|
|
return eventTextList.includes(val);
|
|
|
|
}
|
2021-12-07 05:43:20 +00:00
|
|
|
// 领舞者:根据事件文字 获取事件名
|
|
|
|
function getFluoEvent(name) {
|
|
|
|
let fluoMap = {
|
|
|
|
'击剑':'stickcome',
|
|
|
|
'起飞':'stick-go'
|
|
|
|
}
|
|
|
|
return fluoMap[name] ? fluoMap[name] : ''
|
|
|
|
}
|
|
|
|
// 个人喊荧光棒
|
|
|
|
function peopleFluo(val){
|
|
|
|
return fluoTextList.includes(val);
|
|
|
|
}
|
2021-11-23 13:14:51 +00:00
|
|
|
// 领舞喊舞
|
|
|
|
function dancer(val){
|
|
|
|
return allEventList.includes(val);
|
|
|
|
}
|
2021-11-25 10:11:01 +00:00
|
|
|
|
|
|
|
// 删除久未说话的人
|
|
|
|
function delExpireDiv() {
|
|
|
|
if (!autoDel) {
|
|
|
|
return false
|
|
|
|
}
|
|
|
|
|
|
|
|
let timestamp = parseInt(new Date().getTime()/1000)
|
|
|
|
let delList = $(".dance-people").filter(function() {
|
|
|
|
return $(this).attr("data-time") < timestamp - speakExpireTime;
|
|
|
|
})
|
2021-11-26 13:03:06 +00:00
|
|
|
// console.log(delList.length, speakExpireTime+'秒未说话人数')
|
2021-11-25 10:11:01 +00:00
|
|
|
delList.remove();
|
|
|
|
}
|
2021-11-20 13:07:24 +00:00
|
|
|
// 接受消息处理
|
|
|
|
function receiveMessage(event)
|
|
|
|
{
|
2021-12-01 03:48:08 +00:00
|
|
|
// 来源检测
|
2021-11-20 13:07:24 +00:00
|
|
|
if (event.origin !== "https://live.bilibili.com") {
|
|
|
|
return false
|
|
|
|
}
|
|
|
|
|
2021-12-01 03:48:08 +00:00
|
|
|
// 解析消息
|
2021-11-21 09:03:00 +00:00
|
|
|
let dataList = JSON.parse(event.data)
|
2021-12-02 05:50:21 +00:00
|
|
|
|
2021-12-01 03:48:08 +00:00
|
|
|
// 弹幕消息
|
2021-11-21 09:03:00 +00:00
|
|
|
let data = dataList.dm
|
2021-12-01 03:48:08 +00:00
|
|
|
|
2021-11-30 05:46:55 +00:00
|
|
|
// 舰长
|
2021-12-02 05:50:21 +00:00
|
|
|
let adminList = dataList.admin
|
2021-11-30 05:46:55 +00:00
|
|
|
// 高能榜top3
|
2021-12-02 05:50:21 +00:00
|
|
|
let highList = dataList.high
|
2021-11-30 05:46:55 +00:00
|
|
|
|
2021-12-01 03:48:08 +00:00
|
|
|
// console.log(adminList, '舰长列表')
|
|
|
|
// console.log(highList, '高能榜列表')
|
2021-11-20 13:07:24 +00:00
|
|
|
|
|
|
|
if (data.length <= 0) {
|
|
|
|
return false
|
|
|
|
}
|
|
|
|
|
|
|
|
// 当前直播间 自己的弹幕 无法获取到ct和type值 就暂时过滤
|
|
|
|
if (data.ct === '') {
|
|
|
|
return false
|
|
|
|
}
|
2021-11-25 03:01:26 +00:00
|
|
|
|
2021-12-01 03:48:08 +00:00
|
|
|
// 领舞信息 目前为领舞名称
|
2021-11-30 06:57:34 +00:00
|
|
|
let leaderInfo = ''
|
2021-12-01 03:48:08 +00:00
|
|
|
// 高能榜第一位设为领舞
|
2021-12-07 05:43:20 +00:00
|
|
|
if (highList!=undefined && highList.length > 0) {
|
2021-11-30 06:57:34 +00:00
|
|
|
leaderInfo = highList[0]
|
2021-11-21 09:03:00 +00:00
|
|
|
}
|
2021-12-01 10:21:25 +00:00
|
|
|
// leaderInfo = '内有猛犬小心'
|
2021-12-07 05:57:08 +00:00
|
|
|
// leaderInfo = '饺子吃肉肉'
|
2021-11-22 10:35:45 +00:00
|
|
|
// uid是否存在 不存在则存入uidObj
|
|
|
|
let isNew = 0
|
2021-12-01 03:48:08 +00:00
|
|
|
|
|
|
|
// 最近发弹幕时间
|
2021-11-25 10:11:01 +00:00
|
|
|
let speakTime = uidObj[data.uid];
|
|
|
|
if (!speakTime) {
|
2021-11-22 10:35:45 +00:00
|
|
|
isNew = 1
|
2021-11-25 10:11:01 +00:00
|
|
|
} else if (autoDel && speakTime < parseInt(new Date().getTime()/1000) - speakExpireTime){
|
2021-12-01 03:48:08 +00:00
|
|
|
//最近弹幕时间太久 则标注为新用户
|
2021-11-25 10:11:01 +00:00
|
|
|
isNew = 1;
|
2021-11-22 10:35:45 +00:00
|
|
|
}
|
|
|
|
|
2021-12-01 03:48:08 +00:00
|
|
|
// 更新[记录]uid最近弹幕时间
|
|
|
|
uidObj[data.uid] = data.ts
|
2021-11-22 10:35:45 +00:00
|
|
|
|
2021-11-20 13:23:59 +00:00
|
|
|
// custom.js中 每条弹幕的处理 放到了此处
|
|
|
|
// -------------------- 每条弹幕处理 begin -----------------------
|
2021-11-21 09:03:00 +00:00
|
|
|
|
2021-11-25 02:23:54 +00:00
|
|
|
let eventName = getEvent(data.danmaku)
|
2021-11-21 09:03:00 +00:00
|
|
|
let isLeader = data.uname == leaderInfo ? 1 : 0
|
2021-11-30 05:46:55 +00:00
|
|
|
let isAdmin = adminList.indexOf(data.uname) == -1 ? 0 : 1
|
2021-12-01 03:48:08 +00:00
|
|
|
// isAdmin = Math.floor(Math.random() * 30) //随机大宝剑
|
2021-11-21 09:03:00 +00:00
|
|
|
let dm = {text: data.danmaku, uid: data.uid, uname: data.uname,
|
2021-11-25 02:23:54 +00:00
|
|
|
event: eventName,
|
2021-11-30 05:46:55 +00:00
|
|
|
is_new: isNew, is_admin: isAdmin, is_leader: isLeader,active_time: data.ts}
|
2021-11-20 13:07:24 +00:00
|
|
|
let leader = {
|
2021-11-23 07:08:37 +00:00
|
|
|
uid: 0, uname: leaderInfo, text: '', event: ''
|
2021-11-20 13:07:24 +00:00
|
|
|
}
|
2021-11-25 02:39:53 +00:00
|
|
|
|
2021-11-21 09:03:00 +00:00
|
|
|
if (isLeader) {
|
2021-11-25 02:39:53 +00:00
|
|
|
let leaderEvent = getLeaderEvent(dm.text)
|
2021-11-21 09:03:00 +00:00
|
|
|
leader.uid = dm.uid
|
|
|
|
leader.uname = dm.uname
|
|
|
|
leader.text = dm.text
|
2021-11-25 02:39:53 +00:00
|
|
|
leader.event = eventName ? eventName : leaderEvent
|
2021-11-21 09:03:00 +00:00
|
|
|
}
|
2021-11-24 02:48:14 +00:00
|
|
|
// 新用户
|
2021-11-23 01:56:09 +00:00
|
|
|
if(dm.is_new==1){
|
2021-11-24 08:48:50 +00:00
|
|
|
// if(dm.uname!=leader.uname){//如果弹幕的人的名字不等于领舞者的名字,就创建一个人物
|
2021-11-30 05:46:55 +00:00
|
|
|
peopleObj(dm.uname,dm.uid,dm.text,dm.event,dm.active_time,dm.is_admin);
|
2021-11-24 08:48:50 +00:00
|
|
|
// }
|
2021-11-23 01:56:09 +00:00
|
|
|
} else {
|
2021-11-24 02:48:14 +00:00
|
|
|
// 老用户
|
2021-11-23 07:08:37 +00:00
|
|
|
$(`#${dm.uid} .speak`).html(dm.text);
|
2021-11-25 10:11:01 +00:00
|
|
|
//更新最近时间
|
|
|
|
$(`#${dm.uid}`).attr('data-time', dm.active_time);
|
2021-11-23 07:08:37 +00:00
|
|
|
$(`#${dm.uid} .speak`).removeClass("dn");
|
2021-11-30 05:46:55 +00:00
|
|
|
if (dm.is_admin == 1) {
|
|
|
|
// 舰长添加大宝剑
|
|
|
|
$(`#${dm.uid} .stick`).addClass("stick-swing-big-tow");
|
|
|
|
}
|
2021-12-07 05:43:20 +00:00
|
|
|
setTimeout(()=>{//关闭当前说话
|
2021-11-23 07:08:37 +00:00
|
|
|
$(`#${dm.uid} .speak`).addClass("dn");
|
|
|
|
},3000)
|
2021-12-07 05:43:20 +00:00
|
|
|
// 舞者喊舞---动作舞
|
2021-11-23 13:14:51 +00:00
|
|
|
if(peopleHan(dm.text)){
|
|
|
|
peopleAction(`${dm.uid}`,dm.event);
|
|
|
|
}
|
2021-12-07 05:43:20 +00:00
|
|
|
// 舞者喊舞---荧光棒
|
|
|
|
if(peopleFluo(dm.text)){
|
|
|
|
fluoEv(`${dm.uid}`,getFluoEvent(dm.text));
|
|
|
|
}
|
2021-11-22 11:13:38 +00:00
|
|
|
}
|
2021-11-20 13:07:24 +00:00
|
|
|
num++;
|
2021-11-25 10:11:01 +00:00
|
|
|
|
|
|
|
// console.log(Object.keys(uidObj).length, 'uid 长度')
|
|
|
|
// console.log(uidObj, 'uid')
|
|
|
|
// console.log(num, '人物渲染个数')
|
2021-11-24 02:48:14 +00:00
|
|
|
// 显示领舞的昵称
|
2021-11-20 13:07:24 +00:00
|
|
|
$('.lingname').text(leader.uname);
|
2021-11-25 03:01:26 +00:00
|
|
|
if (!isLeader) {
|
|
|
|
return false
|
|
|
|
}
|
|
|
|
|
2021-11-20 13:07:24 +00:00
|
|
|
if(leader.event=='scale-left' || leader.event=='scale-right' || leader.event=='scale-bottom-left' || leader.event=='scale-bottom-right'){
|
2021-11-24 02:48:14 +00:00
|
|
|
// 领舞喊镜头
|
2021-11-23 13:54:58 +00:00
|
|
|
list.forEach(item=>{
|
|
|
|
var haveDan = $(`.ground-bg`).is(`.${item}`);
|
2021-11-24 02:48:14 +00:00
|
|
|
// 如果之前有镜头,删除镜头
|
2021-11-23 13:54:58 +00:00
|
|
|
if(haveDan) {
|
|
|
|
$('.ground-bg').removeClass(item);
|
|
|
|
}
|
|
|
|
})
|
2021-11-24 02:48:14 +00:00
|
|
|
// 各几秒重新添加镜头
|
2021-11-23 13:54:58 +00:00
|
|
|
setTimeout(()=>{
|
|
|
|
$('.ground-bg').addClass(leader.event);
|
2021-11-24 02:48:14 +00:00
|
|
|
},addJingTime)
|
2021-11-20 13:07:24 +00:00
|
|
|
} else {
|
2021-12-07 05:43:20 +00:00
|
|
|
if(firTimes==0){
|
|
|
|
firTimes++;
|
|
|
|
// 显示领舞说话
|
|
|
|
if (leader.text.length>0) {
|
|
|
|
$('.speak-pink').text(leader.text);
|
|
|
|
$('.speak-pink').fadeIn();
|
|
|
|
//关闭领舞说话
|
|
|
|
setTimeout(()=>{
|
|
|
|
$('.speak-pink').fadeOut();
|
|
|
|
},3000)
|
|
|
|
}
|
|
|
|
// 领舞说切歌
|
|
|
|
if(leader.text=="切歌"){
|
|
|
|
changeMusic();
|
|
|
|
}
|
|
|
|
if(leader.text==="烟花"){
|
2021-11-26 13:03:06 +00:00
|
|
|
$('.lighting-bg').addClass('fireworks');
|
|
|
|
setTimeout(()=>{
|
|
|
|
$('.lighting-bg').removeClass('fireworks');
|
|
|
|
},5000)
|
|
|
|
}
|
2021-12-07 05:43:20 +00:00
|
|
|
//领舞起飞
|
|
|
|
if(leader.text==="一起起飞"){
|
2021-11-29 05:57:02 +00:00
|
|
|
$('.stick').removeClass('stick-swing');
|
|
|
|
$('.stick').addClass('stick-go');
|
|
|
|
setTimeout(()=>{
|
|
|
|
$('.stick').removeClass('stick-go');
|
|
|
|
$('.stick').addClass('stick-swing');
|
|
|
|
},6000)
|
|
|
|
}
|
2021-12-07 05:43:20 +00:00
|
|
|
if(leader.text==="一起击剑"){//一起击剑
|
2021-12-01 10:20:03 +00:00
|
|
|
$('.stick').addClass('stickcome');
|
|
|
|
setTimeout(()=>{
|
|
|
|
$('.stick').removeClass('stickcome');
|
|
|
|
},6000)
|
|
|
|
}
|
2021-12-07 05:43:20 +00:00
|
|
|
if(peopleFluo(leader.text)){
|
2021-12-07 05:55:56 +00:00
|
|
|
$('.leading .stick').removeClass('stick-swing');
|
|
|
|
$('.leading .stick').addClass(getFluoEvent(dm.text));
|
2021-12-07 05:43:20 +00:00
|
|
|
setTimeout(()=>{
|
2021-12-07 05:55:56 +00:00
|
|
|
$('.leading .stick').removeClass(getFluoEvent(dm.text));
|
|
|
|
$('.leading .stick').addClass('stick-swing');
|
2021-12-07 05:43:20 +00:00
|
|
|
},6000)
|
|
|
|
}
|
|
|
|
setTimeout(()=>{
|
|
|
|
firTimes = 0;
|
|
|
|
},2000)
|
|
|
|
// 领舞喊一起喊
|
|
|
|
if (leader.text.length >= 4) {
|
|
|
|
if(leader.text.slice(0,4)=="一起喊:" || leader.text.slice(0,4)=="一起喊:"){
|
|
|
|
allSay(leader.text.slice(4));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
// 领舞自己喊跳舞
|
|
|
|
if(peopleHan(dm.text)){
|
|
|
|
clearInterval(dancerTimer);
|
|
|
|
dancerOwn(leader.event);
|
|
|
|
}
|
|
|
|
// 领舞喊集体跳舞
|
|
|
|
if(dancer(leader.text)){
|
|
|
|
allDancing(leader.event);
|
|
|
|
}
|
|
|
|
// 领舞喊荧光棒事件
|
|
|
|
// if(getLeaderFluoEvent(leader.text)!=''){
|
|
|
|
// if(firTimes==0){//防多次说话
|
|
|
|
// firTimes++;
|
|
|
|
// console.log(getLeaderFluoEvent(leader.text));
|
|
|
|
// setTimeout(()=>{
|
|
|
|
// firTimes = 0;
|
|
|
|
// },5000)
|
|
|
|
// }
|
|
|
|
// }
|
2021-11-23 13:14:51 +00:00
|
|
|
}
|
2021-11-20 13:07:24 +00:00
|
|
|
}
|
2021-11-20 13:23:59 +00:00
|
|
|
// -------------------- 每条弹幕处理 end -----------------------
|
2021-11-20 13:07:24 +00:00
|
|
|
}
|
|
|
|
|
2021-12-08 02:38:18 +00:00
|
|
|
// 创建随机任务
|
|
|
|
function createVirtual() {
|
|
|
|
for (let i = 0; i < virtualNum; i++) {
|
|
|
|
let eventName = eventTextList[Math.floor(Math.random()*(eventTextList.length-1))]
|
|
|
|
let word = virtualWordList[Math.floor(Math.random()*(virtualWordList.length-1))]
|
|
|
|
if (virtualList[i] != undefined) {
|
|
|
|
peopleObj(virtualList[i], 'virtual'+i, word, getEvent(eventName), 0, 0);
|
|
|
|
} else {
|
|
|
|
peopleObj('我是卧底95'+i, 'virtual'+i, word, getEvent(eventName), 1638930062, 0);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2021-12-08 05:58:59 +00:00
|
|
|
// music();
|
2021-12-01 03:48:08 +00:00
|
|
|
// 清理缓存
|
|
|
|
sessionStorage.clear()
|
2021-12-08 02:38:18 +00:00
|
|
|
|
|
|
|
$(function(){
|
|
|
|
// 创建虚拟人物
|
|
|
|
if (virtualPeople) {
|
|
|
|
createVirtual()
|
|
|
|
}
|
|
|
|
})
|
|
|
|
|
2021-11-20 13:07:24 +00:00
|
|
|
window.addEventListener("message", receiveMessage, false);
|