优化击剑、起飞、一起击剑、一起起飞
						commit
						41a44859b9
					
				
							
								
								
									
										65
									
								
								js/custom.js
								
								
								
								
							
							
						
						
									
										65
									
								
								js/custom.js
								
								
								
								
							|  | @ -10,8 +10,6 @@ var allSayTimer = 5000; | |||
| var actionArr = ['dancing-left','dancing-right','dancing-down','dancing-up','dancing-wobble','dancing-wobble-right']; | ||||
| // 人物位移动画
 | ||||
| var moveArr = ['run-right','run-left','run-right-top','run-left-top','run-right-bottom','run-left-bottom']; | ||||
| // 随机荧光棒动画
 | ||||
| var fluoArr = ['stick-go','stickcome']; | ||||
| var peopleId = 0; | ||||
| // 窗体宽度
 | ||||
| var winWidth = $(window).width(); | ||||
|  | @ -26,8 +24,6 @@ var dancingTime = 6000; | |||
| var runTime = 6000; | ||||
| // 随机移动的定时器
 | ||||
| var upTimer = null; | ||||
| // 荧光棒关闭时间
 | ||||
| var fluoTime = 6000//默认6秒关闭
 | ||||
| // 集体舞ji
 | ||||
| function allDancing(dangcing){ | ||||
| 	if(dangcing!=''){ | ||||
|  | @ -56,16 +52,17 @@ function allDancing(dangcing){ | |||
| 		},10000) | ||||
| 	} | ||||
| } | ||||
| // 创建人物时随机分配舞蹈
 | ||||
| // 随机舞
 | ||||
| function randomDancing(id){ | ||||
| 	actionArr.forEach((item,index)=>{ | ||||
| 		var haveDan = $(`.data${id} .people-img`).is(`.${item}`); | ||||
| 		if(haveDan){ | ||||
| 			$(`.data${id} .people-img`).removeClass(item); | ||||
| 			$(`.data${id} .people-img`).addClass(actionArr[Math.floor(Math.random()*actionArr.length)]); | ||||
| } | ||||
| // 荧光棒动画事件
 | ||||
| function fluoEv(id,fluoEvent){ | ||||
| 	$(`#${id} .stick`).addClass(fluoEvent); | ||||
| 	setTimeout(()=>{ | ||||
| 		$(`#${id} .stick`).removeClass(fluoEvent); | ||||
| 	},fluoTime) | ||||
| 		} else { | ||||
| 			$(`.data${id} .people-img`).addClass(actionArr[Math.floor(Math.random()*actionArr.length)]); | ||||
| 		} | ||||
| 	}) | ||||
| } | ||||
| // 个人动作舞
 | ||||
| function peopleAction(id,aevent){ | ||||
|  | @ -79,13 +76,55 @@ function peopleAction(id,aevent){ | |||
| 		} | ||||
| 	}) | ||||
| } | ||||
| // 位移事件
 | ||||
| // 上
 | ||||
| function upMove(id){ | ||||
| 	var odivu = document.getElementById(`${id}`); | ||||
| 	upTimer = setInterval(()=>{ | ||||
| 		// if(parseInt(odivu.style.top) <=10){
 | ||||
| 		// 	// clearInterval(upTimer);
 | ||||
| 		// 	// downMove(id);
 | ||||
| 		// 	$(`#${id}`).animate({top:`${Math.floor(Math.random()*90)}%`,left:`${Math.floor(Math.random()*90)}%`},Math.floor(Math.random()*40000+10000));
 | ||||
| 		// } else {
 | ||||
| 			$(`#${id}`).animate({top:`${Math.floor(Math.random()*90)}%`,left:`${Math.floor(Math.random()*90)}%`},Math.floor(Math.random()*40000+10000)); | ||||
| 		// }
 | ||||
| 	},runTime) | ||||
| } | ||||
| // // 下
 | ||||
| // function downMove(id){
 | ||||
| // 	var odivd = document.getElementById(`${id}`);
 | ||||
| // 	var downTimer = setInterval(()=>{
 | ||||
| // 		if(parseInt(odivd.style.top) >=86){
 | ||||
| // 			clearInterval(downTimer);
 | ||||
| // 			upMove(id);
 | ||||
| // 		} else {
 | ||||
| // 			$(`#${id}`).animate({top:`${Math.floor(Math.random()*90)}%`,left:`${Math.floor(Math.random()*90)}%`},Math.floor(Math.random()*40000+10000));
 | ||||
| // 		}
 | ||||
| // 	},10)
 | ||||
| // }
 | ||||
| // // 左
 | ||||
| // function leftMove(id){
 | ||||
| // 	var odivl = document.getElementById(`${id}`);
 | ||||
| // 	var leftTimer = setInterval(()=>{
 | ||||
| // 		if(odivl.offsetLeft < 10){
 | ||||
| // 			clearInterval(leftTimer);
 | ||||
| // 			rightMove(id);
 | ||||
| // 		} else {
 | ||||
| // 			$(`#${id}`).animate({top:`${Math.floor(Math.random()*90)}%`,left:`${Math.floor(Math.random()*90)}%`},Math.floor(Math.random()*40000+10000));
 | ||||
| // 		}
 | ||||
| // 	},10)
 | ||||
| // }
 | ||||
| // // 右
 | ||||
| // function rightMove(id){
 | ||||
| // 	var odivr = document.getElementById(`${id}`);
 | ||||
| // 	var rightTimer = setInterval(()=>{
 | ||||
| // 		if(odivr.offsetLeft >= 86){
 | ||||
| // 			clearInterval(rightTimer);
 | ||||
| // 			leftMove(id);
 | ||||
| // 		} else {
 | ||||
| // 			$(`#${id}`).animate({top:`${Math.floor(Math.random()*90)}%`,left:`${Math.floor(Math.random()*90)}%`},Math.floor(Math.random()*40000+10000));
 | ||||
| // 		}
 | ||||
| // 	},10)
 | ||||
| // }
 | ||||
| // 随机位移
 | ||||
| function moveEv(id){ | ||||
| 	upMove(id); | ||||
|  |  | |||
							
								
								
									
										74
									
								
								js/handle.js
								
								
								
								
							
							
						
						
									
										74
									
								
								js/handle.js
								
								
								
								
							|  | @ -16,21 +16,19 @@ let leaderTime = 15*60 | |||
| // 何时添加镜头
 | ||||
| var addJingTime = 2000;//2秒
 | ||||
| // 事件列表-中文
 | ||||
| let eventTextList = ['切歌', '跳', '向左', '向右', '左抖腿', '右抖腿', '抖动', '一起喊', '镜头','击剑','起飞'] | ||||
| // 个人---荧光棒列表-中文
 | ||||
| let fluoTextList = ['击剑','起飞']; | ||||
| // 领舞---荧光棒列表-中文
 | ||||
| let leaderFluoList = ['一起击剑','一起起飞']; | ||||
| let eventTextList = ['切歌', '跳', '向左', '向右', '左抖腿', '右抖腿', '抖动', '一起喊', '镜头'] | ||||
| // 领舞者喊的集体舞
 | ||||
| let allEventList = ['切歌', '一起跳', '一起向左', '一起向右', '一起左抖腿', '一起右抖腿', '一起抖动', '一起喊', '镜头'] | ||||
| // 镜头列表
 | ||||
| let list = ['scale-left', 'scale-right', 'scale-bottom-left', 'scale-bottom-right'] | ||||
| // 烟花次数
 | ||||
| let firTimes = 0; | ||||
| // 个人喊舞:根据事件文字 获取事件名
 | ||||
| // 根据事件文字 获取事件名
 | ||||
| function getEvent(name) { | ||||
|     let map = { | ||||
| 		'烟花':'fireworks', | ||||
| 		'一起击剑':'stickcome', | ||||
| 		'起飞':'stickgo', | ||||
|         '切歌'  : 'change_song', | ||||
|         '跳'  : 'dancing-down', | ||||
|         '向左'  : 'dancing-left', | ||||
|  | @ -45,10 +43,12 @@ function getEvent(name) { | |||
|     return map[name] ? map[name] : '' | ||||
| } | ||||
| 
 | ||||
| // 领舞者:根据事件文字 获取事件名
 | ||||
| // 根据事件文字 获取领舞者事件名
 | ||||
| function getLeaderEvent(name) { | ||||
|     let map = { | ||||
| 		'烟花':'fireworks', | ||||
| 		'一起击剑':'stickcome', | ||||
| 		'起飞':'stickgo', | ||||
|         '切歌'  : 'change_song', | ||||
|         '一起跳'  : 'dancing-down', | ||||
|         '一起向左'  : 'dancing-left', | ||||
|  | @ -62,29 +62,22 @@ function getLeaderEvent(name) { | |||
| 
 | ||||
|     return map[name] ? map[name] : '' | ||||
| } | ||||
| // 
 | ||||
| function getLeaderFluoEvent(name) { | ||||
| 	let leadMap = { | ||||
| 		'一起击剑':'stickcome', | ||||
| 		'一起起飞':'stick-go' | ||||
| 	} | ||||
| 	return leadMap[name] ? leadMap[name] : '' | ||||
| } | ||||
| 
 | ||||
| // 随机选择镜头
 | ||||
| function scale() { | ||||
|     return list[Math.floor(Math.random() * 3)]; | ||||
| } | ||||
| // 字符串包含的事件 (仅取第一个)
 | ||||
| // function getFirstEventKeyword(name) {
 | ||||
| //     let event = ''
 | ||||
| //     $.each(eventTextList, function (index, item) {
 | ||||
| //         if (name.toString().indexOf(item) != -1) {
 | ||||
| //             event = item
 | ||||
| //             return false
 | ||||
| //         }
 | ||||
| //     })
 | ||||
| //     return event
 | ||||
| // }
 | ||||
| function getFirstEventKeyword(name) { | ||||
|     let event = '' | ||||
|     $.each(eventTextList, function (index, item) { | ||||
|         if (name.toString().indexOf(item) != -1) { | ||||
|             event = item | ||||
|             return false | ||||
|         } | ||||
|     }) | ||||
|     return event | ||||
| } | ||||
| 
 | ||||
| function music() { | ||||
|     $.get(musicUrl, function (res) { | ||||
|  | @ -111,18 +104,6 @@ function changeMusic() { | |||
| function peopleHan(val){ | ||||
| 	return eventTextList.includes(val); | ||||
| } | ||||
| // 领舞者:根据事件文字 获取事件名
 | ||||
| function getFluoEvent(name) { | ||||
|     let fluoMap = { | ||||
| 		'击剑':'stickcome', | ||||
| 		'起飞':'stick-go' | ||||
|     } | ||||
|     return fluoMap[name] ? fluoMap[name] : '' | ||||
| } | ||||
| // 个人喊荧光棒
 | ||||
| function peopleFluo(val){ | ||||
| 	return fluoTextList.includes(val); | ||||
| } | ||||
| // 领舞喊舞
 | ||||
| function dancer(val){ | ||||
| 	return allEventList.includes(val); | ||||
|  | @ -175,12 +156,16 @@ function receiveMessage(event) | |||
| 
 | ||||
|     // 领舞信息 目前为领舞名称
 | ||||
|     let leaderInfo = '' | ||||
| 
 | ||||
|     // 高能榜第一位设为领舞
 | ||||
|     if (highList!=undefined && highList.length > 0) { | ||||
|     if (highList.length > 0) { | ||||
|         leaderInfo = highList[0] | ||||
|     } | ||||
| 	// leaderInfo = '内有猛犬小心'
 | ||||
| <<<<<<< HEAD | ||||
| 	leaderInfo = '饺子吃肉肉' | ||||
| ======= | ||||
| >>>>>>> c5fcb3d64edf80504ff6eccb40845e6e67a9b71e | ||||
|     // uid是否存在 不存在则存入uidObj
 | ||||
|     let isNew = 0 | ||||
| 
 | ||||
|  | @ -217,6 +202,7 @@ function receiveMessage(event) | |||
|         leader.text = dm.text | ||||
|         leader.event = eventName ? eventName : leaderEvent | ||||
|     } | ||||
| 
 | ||||
| 	// 新用户
 | ||||
| 	if(dm.is_new==1){ | ||||
| 		// if(dm.uname!=leader.uname){//如果弹幕的人的名字不等于领舞者的名字,就创建一个人物
 | ||||
|  | @ -232,17 +218,13 @@ function receiveMessage(event) | |||
|             // 舰长添加大宝剑
 | ||||
|             $(`#${dm.uid} .stick`).addClass("stick-swing-big-tow"); | ||||
|         } | ||||
| 		setTimeout(()=>{//关闭当前说话
 | ||||
| 		setTimeout(()=>{ | ||||
| 			$(`#${dm.uid} .speak`).addClass("dn"); | ||||
| 		},3000) | ||||
| 		// 舞者喊舞---动作舞
 | ||||
| 		// 舞者喊舞
 | ||||
| 		if(peopleHan(dm.text)){ | ||||
| 			peopleAction(`${dm.uid}`,dm.event); | ||||
| 		} | ||||
| 		// 舞者喊舞---荧光棒
 | ||||
| 		if(peopleFluo(dm.text)){ | ||||
| 			fluoEv(`${dm.uid}`,getFluoEvent(dm.text)); | ||||
| 		} | ||||
| 	} | ||||
|     num++; | ||||
| 
 | ||||
|  | @ -323,6 +305,7 @@ function receiveMessage(event) | |||
|                 allSay(leader.text.slice(4)); | ||||
|             } | ||||
|         } | ||||
| 		 | ||||
| 		// 领舞自己喊跳舞
 | ||||
| 		if(peopleHan(dm.text)){ | ||||
| 			clearInterval(dancerTimer); | ||||
|  | @ -332,6 +315,7 @@ function receiveMessage(event) | |||
| 		if(dancer(leader.text)){ | ||||
| 			allDancing(leader.event); | ||||
| 		} | ||||
| <<<<<<< HEAD | ||||
| 		// 领舞喊荧光棒事件
 | ||||
| 		// if(getLeaderFluoEvent(leader.text)!=''){
 | ||||
| 		// 	if(firTimes==0){//防多次说话
 | ||||
|  | @ -342,6 +326,8 @@ function receiveMessage(event) | |||
| 		// 		},5000)
 | ||||
| 		// 	}
 | ||||
| 		// }
 | ||||
| ======= | ||||
| >>>>>>> c5fcb3d64edf80504ff6eccb40845e6e67a9b71e | ||||
|     } | ||||
|     // -------------------- 每条弹幕处理 end -----------------------
 | ||||
| } | ||||
|  |  | |||
		Loading…
	
		Reference in New Issue