Commit 9fd4f9e9 authored by Mac's avatar Mac

首页改动

parent 51162a43
...@@ -74,12 +74,12 @@ ...@@ -74,12 +74,12 @@
}).fail(data => {}); }).fail(data => {});
getMsg() getMsg()
function sendMsg(msg,type) { function sendMsg(msg) {
if(type ==1){
proxy.invoke("SendBarrage", msg).done(data => { proxy.invoke("SendBarrage", msg).done(data => {
layer.msg('发送成功'); layer.msg('发送成功');
}); });
}
} }
function send() { function send() {
var value = $('.bar_input input').val(); var value = $('.bar_input input').val();
...@@ -87,7 +87,7 @@ ...@@ -87,7 +87,7 @@
layer.msg('不能为空哦'); layer.msg('不能为空哦');
return return
} }
sendMsg(value,1) sendMsg(value)
} }
function getMsg() { function getMsg() {
......
...@@ -98,37 +98,7 @@ ...@@ -98,37 +98,7 @@
</div> </div>
<div class="circleCount">3</div> <div class="circleCount">3</div>
<input type="button" value="开始" id="Start" style="z-index:9999;position: fixed;top:0;">
<!-- &lt;!&ndash; 排行榜&ndash;&gt;-->
<!-- <div class="rank_mask">-->
<!-- <div class="zhezao"></div>-->
<!-- <div class="rank_box">-->
<!-- <div class="rBox_top"></div>-->
<!-- <div class="rank_y">-->
<!-- <p>你的排名 第</p>-->
<!-- <p style="font-style: oblique">1</p>-->
<!-- <p style="margin-left: 0.05rem">名</p>-->
<!-- </div>-->
<!-- <div class="rank_i">-->
<!-- <div class="rank_item">-->
<!-- <div class="rank_itemL">-->
<!-- <div class="rank_num">10</div>-->
<!-- <p>李思思</p>-->
<!-- </div>-->
<!-- <div class="rank_itemR">-->
<!-- <div class="shuxi"></div>-->
<!-- <p>1234</p>-->
<!-- </div>-->
<!-- </div>-->
<!-- </div>-->
<!-- <div class="Close"></div>-->
<!-- </div>-->
<!-- </div>-->
</div> </div>
...@@ -151,7 +121,10 @@ ...@@ -151,7 +121,10 @@
}); });
var proxy = conn.createHubProxy("annualLeaveHub"); var proxy = conn.createHubProxy("annualLeaveHub");
conn.start().done(data => { conn.start().done(data => {
sendMsg() sendMsg();
sendScore();
joinGeme() //参加活动
}).fail(data => {}); }).fail(data => {});
getMsg() getMsg()
...@@ -185,19 +158,22 @@ ...@@ -185,19 +158,22 @@
$('.status3').css({'display':'flex'}); $('.status3').css({'display':'flex'});
} }
}); });
if(type ==1){
proxy.invoke("SetGameScore", 'Mouse',msg).done(data => { //发送分数
console.log(data)
});
}
proxy.invoke("JoinGame", 'Mouse').done(data => { //进入页面调用
}
function sendScore(msg) {
proxy.invoke("SetGameScore", 'Mouse',msg).done(data => { //发送分数
console.log(data) console.log(data)
}); });
} }
function joinGeme() {
proxy.invoke("JoinGame", 'Mouse').done(data => { //加入活动
console.log(data)
});
}
function getMsg() { function getMsg() {
//随时获取游戏的状态 //随时获取游戏的状态
proxy.on('getChangeMenu',function (data) { proxy.on('getChangeMenu',function (data) {
...@@ -209,12 +185,14 @@ ...@@ -209,12 +185,14 @@
$('.status1').css({'display':'none'}); $('.status1').css({'display':'none'});
$('.status2').css({'display':'none'}); $('.status2').css({'display':'none'});
$('.status3').css({'display':'none'}); $('.status3').css({'display':'none'});
joinGeme()
} }
if(data.status==1){ if(data.status==1){
$('.status').css({'display':'none'}); $('.status').css({'display':'none'});
$('.status1').css({'display':'flex'}); $('.status1').css({'display':'flex'});
$('.status2').css({'display':'none'}); $('.status2').css({'display':'none'});
$('.status3').css({'display':'none'}); $('.status3').css({'display':'none'});
joinGeme()
} }
if(data.status==2){ if(data.status==2){
StartGame() StartGame()
...@@ -240,6 +218,9 @@ ...@@ -240,6 +218,9 @@
function ces2(){ function ces2(){
score=0 score=0
key = 0 key = 0
for (var i=0 ;i<laoshudata.length; i++){
laoshudata[i].noclick =0; //0 为未点击 1为点击过
}
timer1 = setInterval(increase ,laoshudata[key].Interval+300) timer1 = setInterval(increase ,laoshudata[key].Interval+300)
} }
...@@ -251,12 +232,13 @@ ...@@ -251,12 +232,13 @@
$('.hole-container .hole:eq('+wz+') .mouse img').animate({top:"0.05rem"},600); $('.hole-container .hole:eq('+wz+') .mouse img').animate({top:"0.05rem"},600);
//为老鼠的时候加100分 //为老鼠的时候加100分
$('.hole-container .hole:eq('+wz+') .mouse img').click(function () { $('.hole-container .hole:eq('+wz+') .mouse img').click(function () {
score=score+100; if(laoshudata[key].noclick == 0) {
$('.score').html(score+ '分') score = score + 100;
$('.hole-container .hole:eq('+wz+') .mouse img').attr('src','../../images/aM/dadao.png').click(function () { $('.score').html(score + '分')
sendScore(score)
}); $('.hole-container .hole:eq(' + wz + ') .mouse img').attr('src', '../../images/aM/dadao.png')
laoshudata[key].noclick=1
}
}) })
$('.hole-container .hole:eq('+wz+') .mouse img').animate({top:"0.65rem"},600); $('.hole-container .hole:eq('+wz+') .mouse img').animate({top:"0.65rem"},600);
...@@ -270,12 +252,13 @@ ...@@ -270,12 +252,13 @@
$('.hole-container .hole:eq('+wz+') .mouse').append('<img src="../../images/aM/pig.png" alt="">'); $('.hole-container .hole:eq('+wz+') .mouse').append('<img src="../../images/aM/pig.png" alt="">');
$('.hole-container .hole:eq('+wz+') .mouse img').animate({top:"0.05rem"},600); $('.hole-container .hole:eq('+wz+') .mouse img').animate({top:"0.05rem"},600);
$('.hole-container .hole:eq('+wz+') .mouse img').click(function () { $('.hole-container .hole:eq('+wz+') .mouse img').click(function () {
score=score-50; if(laoshudata[key].noclick == 0){
$('.score').html(score+ '分') score=score-50;
$('.hole-container .hole:eq('+wz+') .mouse img').attr('src','../../images/aM/dadao.png').click(function () { $('.score').html(score+ '分')
sendScore(score)
}); $('.hole-container .hole:eq('+wz+') .mouse img').attr('src','../../images/aM/dadao.png')
laoshudata[key].noclick=1
}
}) })
$('.hole-container .hole:eq('+wz+') .mouse img').animate({top:"0.65rem"},600); $('.hole-container .hole:eq('+wz+') .mouse img').animate({top:"0.65rem"},600);
setTimeout(function () { setTimeout(function () {
...@@ -289,10 +272,6 @@ ...@@ -289,10 +272,6 @@
key++ key++
} }
//模拟监听到开始事件
$("#Start").click(function(){
StartGame();
});
function StartGame() { function StartGame() {
Count=3; Count=3;
Count2=30; Count2=30;
...@@ -325,7 +304,7 @@ ...@@ -325,7 +304,7 @@
if (Count2 === 0) { if (Count2 === 0) {
window.clearInterval(clock); window.clearInterval(clock);
window.clearInterval(timer1); //清除老鼠 window.clearInterval(timer1); //清除老鼠
sendMsg(score,1) sendScore(score)
//显示统计窗口 //显示统计窗口
$('.rank_mask').css('display','block'); $('.rank_mask').css('display','block');
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment