master
yin5th 2021-11-22 18:35:45 +08:00
parent 9071528f4e
commit 0c20350ce6
3 changed files with 210 additions and 3 deletions

View File

@ -1,4 +1,4 @@
let uidList = [] let uidObj = {}
// 领舞人领舞时间 秒 // 领舞人领舞时间 秒
let leaderTime = 10 let leaderTime = 10
@ -108,9 +108,17 @@ function receiveMessage(event)
} }
} }
// uid是否存在 不存在则存入uidObj
let isNew = 0
if (!uidObj[data.uid]) {
isNew = 1
uidObj[data.uid] = data.uname
}
console.log(isNew, data.uname + ' 是否存在')
// custom.js中 每条弹幕的处理 放到了此处 // custom.js中 每条弹幕的处理 放到了此处
// -------------------- 每条弹幕处理 begin ----------------------- // -------------------- 每条弹幕处理 begin -----------------------
let random1 = data.uid in uidList ? 1 : 0
let random2 = Math.floor(Math.random() + 0.5) let random2 = Math.floor(Math.random() + 0.5)
// 获取领舞信息 // 获取领舞信息
@ -124,7 +132,7 @@ function receiveMessage(event)
// TODO 测试后 删除弹幕随机附加事件 // TODO 测试后 删除弹幕随机附加事件
let dm = {text: data.danmaku, uid: data.uid, uname: data.uname, let dm = {text: data.danmaku, uid: data.uid, uname: data.uname,
event: getEvent(getFirstEventKeyword(data.danmaku+randomEvent)), event: getEvent(getFirstEventKeyword(data.danmaku+randomEvent)),
is_new: random1, is_admin: 0, is_exit: random2, is_leader: isLeader} is_new: isNew, is_admin: 0, is_exit: random2, is_leader: isLeader}
// TODO 测试后 删除领舞随机 // TODO 测试后 删除领舞随机
let leaderRandomEvent = getEvent(getFirstEventKeyword(data.danmaku+randomEvent)) let leaderRandomEvent = getEvent(getFirstEventKeyword(data.danmaku+randomEvent))

33
js/handle2.js Normal file
View File

@ -0,0 +1,33 @@
let uidObj = {}
let uidArr = []
for (let i =0; i<100000000;i++) {
uidObj[i] = i
uidArr.push(100000+i)
}
console.log((new Date).getTime(), '对象开始查询')
console.log(uidObj['9999999999'], '对象结果')
console.log((new Date).getTime(), '对象查询完成,计算耗时')
console.log((new Date).getTime(), '数据填充完成,开始查询')
console.log(uidArr.find(function (item) {
return item == '999999999'
}), 'uid数组')
console.log((new Date).getTime(), '数据查询完成,计算耗时')
console.log(uidObj['9999'] ? 1 : 0, '111')
console.log(uidObj['dfsdf'] ? 1 : 0, 'dfdsfd')
// setInterval(function () {
// let index = Math.floor(Math.random() * 10000000 + 1)
// console.log(uidObj[index])
// }, 100)
// console.log(uidObj)

166
test.html Normal file
View File

@ -0,0 +1,166 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title></title>
<link rel="stylesheet" type="text/css" href="css/animate.css" />
<link rel="stylesheet" type="text/css" href="css/style.css" />
<script src="js/jquery-3.4.1.min.js" type="text/javascript" charset="utf-8"></script>
<script src="./js/handle2.js" type="text/javascript" charset="utf-8"></script>
<body>
<!--灯光-->
<div class="Lighting">
</div>
<!--增加 class=" scale-right" 可使用从右向左镜头效果scale-left scale-bottom-left scale-bottom-right -->
<div class=" ground-bg">
<!--地面灯光-->
<div class="ground-light">
<div class="ground-animate"></div>
</div>
<!--舞台背景-->
<div class="stage">
<div class="video" >
<video id="mousedown" loop autoplay muted src="image/vd.mp4" ></video>
</div>
<!--音乐-->
<audio controls autoplay loop muted style="z-index: 999; position: fixed;display: none;">
<source src="muz/829094.mp3" type="audio/mpeg">
</audio>
<!--点击播放音乐-->
<script>
document.body.addEventListener('mousedown', function(){
var vdo = $("audio")[0]; //jquery
vdo.muted = false;
}, false);
</script>
<!---->
<div class="sound">
<img src="image/icon_02.png" />
</div>
<div class="leading">
<div class="speak speak-pink"></div>
<div class="leading-dancer dancing-wobble-right">
</div>
<div class="table">
<img src="image/icon_01.png" />
<p class="name">当前领舞:<span class="lingname"></span></p>
</div>
</div>
</div>
<!--大航海介绍-->
<div class="types">
<!-- <div class="name">
<p>送任意电池可获得荧光棒!<br />
大航海排名前三可成为领舞!<br />
领舞特权:切歌,镜头,统一动作”跳跃,旋转,向左,向右,向左抖腿,向右抖腿”,
一起喊“任意文字”
</p>
</div> -->
<!-- <div class="list">
<p>1最炫民族风</p>
<p>2爱情买卖</p>
<p>3两只蝴蝶</p>
</div> -->
</div>
<!--舞池-->
<!--当前舞池动作: dancing-left, dancing-right,dancing-down,dancing-UP,dancing-Wobble,dancing-Wobble-right-->
<div class="dance-floor-box">
<div class="dance-floor">
<!-- <div class="dance-people" style="top: 40%; left: 50%;">
<div class="people-img people-img02 dancing-UP">
<div class="stick stick-02">
</div>
<div class="people-name">
内有猛犬小心
</div>
</div>
</div> -->
<!-- <div class="dance-people" style="top: 30%; left: 20%;">
<div class="speak ">
切歌,镜头,统一动作”跳跃,旋转,向左,向右”,
</div>
<div class="people-img people-img01 dancing-left">
<div class="stick stick-01 ">
</div>
<div class="people-name ">
内有猛犬小心
</div>
</div>
</div>
<div class="dance-people" style="top: 40%; left: 50%;">
<div class="people-img people-img02 dancing-down">
<div class="stick stick-02">
</div>
<div class="people-name">
内有猛犬小心
</div>
</div>
</div>
<div class="dance-people" style="top: 20%; left: 40%;">
<div class="people-img people-img03 dancing-right">
<div class="stick stick-03">
</div>
<div class="people-name">
内有猛犬小心
</div>
</div>
</div> -->
<!-- <div class="dance-people" style="top: 26%; left: 60%;">
<div class="people-img people-img04 dancing-UP">
<div class="stick stick-04">
</div>
<div class="people-name">
内有猛犬小心
</div>
</div>
</div>
<div class="dance-people" style="top: 56%; left: 60%;">
<div class="people-img people-img05 dancing-Wobble">
<div class="stick stick-05">
</div>
<div class="people-name">
内有猛犬小心
</div>
</div>
</div>
<div class="dance-people" style="top: 55%; left: 30%;">
<div class="people-img people-img06 dancing-Wobble-right">
<div class="stick stick-01">
</div>
<div class="people-name">
内有猛犬小心
</div>
</div>
</div>
</div>
<!--舞池 end-->
</div>
</div>
</div>
<!--小纸片氛围js-->
<script src="js/jquery.js" type="text/javascript" charset="utf-8"></script>
<!--小纸片氛围js-->
<!-- fireworks scripts -->
<!--
<div class="w3-agilefireworks">
<div class="agilefireworks-bg">
</div>
</div> -->
<script type="text/javascript" src="js/fireworks.js"></script>
<script>
setTimeout(function() {
$('.w3-agilefireworks').fireworks();
});
</script>
<!-- //fireworks scripts -->
</body>
</html>