虚拟人物

master
yin5th 2021-12-08 10:38:18 +08:00
parent d9456a7026
commit 340f6caf86
2 changed files with 34 additions and 1 deletions

View File

@ -154,6 +154,7 @@ function exitEv(id){
}
// 进入广场
function peopleObj(name,uid,say,action,active_time, is_admin){
// console.log(name + ' ' + uid + ' ' + say + ' ' + action + ' ' + active_time + ' ' + is_admin, 'sssss')
let yspHtml = '';
let yspData = [
{

View File

@ -6,10 +6,21 @@ let musicUrl = 'https://bili.scdxtc.cn'
// 自动删除不说话用户
let autoDel = false
// 是否开始虚拟人物
let virtualPeople = true
// 虚拟人物数量
let virtualNum = 50
let virtualList = []
let virtualWordList = ['哈哈哈', '我又来了!', '大爷闪亮登场', '真会玩 哈哈']
// 多少秒不说话删除
let speakExpireTime = 10*60
// 歌曲列表
var musicList = []
let musicList = []
// 领舞人领舞时间 秒
let leaderTime = 15*60
@ -315,7 +326,28 @@ function receiveMessage(event)
// -------------------- 每条弹幕处理 end -----------------------
}
// 创建随机任务
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);
}
}
}
music();
// 清理缓存
sessionStorage.clear()
$(function(){
// 创建虚拟人物
if (virtualPeople) {
createVirtual()
}
})
window.addEventListener("message", receiveMessage, false);