351035557@qq.com преди 5 години
родител
ревизия
aed268a0a0

+ 10 - 0
minigame/WebContent/static/css/main.css

@@ -821,6 +821,16 @@ img {
     right: 1.48438rem;
     width: 2.8125rem; }
 
+.shake-mode2{
+    position: fixed;
+    top:0;
+    left:0;
+    width:100%;
+    height:100vh;
+    z-index:100;
+    display: none;
+}
+
 .shake-mode {
   position: fixed;
   top: 0;

BIN
minigame/WebContent/static/img/wait_shake.png


+ 4 - 0
minigame/WebContent/static/index.html

@@ -99,6 +99,10 @@
     </div>
 
     <!-- 摇一摇提示 -->
+    <div class="shake-mode2">
+        <img src="./img/wait_shake.png">
+    </div>
+
     <div class="shake-mode">
         <div class="shake-dialog">
             <!-- <img src="./img/shake_fire.png"> -->

+ 29 - 21
minigame/WebContent/static/js/main.js

@@ -526,6 +526,8 @@ function handleComplete(evt, comp) {
 
 
     function shakeInit() {
+        var shake_cnt = 0;
+        $(".shake-mode2").show();
         if (window.DeviceMotionEvent) {
             window.addEventListener('devicemotion', deviceMotionHandler, false);
         } else {
@@ -553,30 +555,36 @@ function handleComplete(evt, comp) {
                 var speed = Math.abs(x + y + z - last_x - last_y - last_z) / diffTime * 10000;
                 if (speed > SHAKE_THRESHOLD) {
                     $(".shake-mode").show();
-                    setTimeout(function(){
-                        window.removeEventListener('devicemotion', deviceMotionHandler, false);
-                        exportRoot.pot.hsr.play();
-                        exportRoot.btn3.alpha = 1;
-                        btnAnim(exportRoot.btn3);
-                        exportRoot.btn3.addEventListener("mousedown",function(){
+                    $(".shake-mode2").hide();
+                    shake_cnt++;
+                    if(shake_cnt>2){
+                        setTimeout(function(){
+                            window.removeEventListener('devicemotion', deviceMotionHandler, false);
+                            exportRoot.pot.hsr.play();
+                            // exportRoot.btn3.alpha = 1;
+                            // btnAnim(exportRoot.btn3);
+                            // exportRoot.btn3.addEventListener("mousedown",function(){
+                            //     exportRoot.btn3.removeAllEventListeners();
+                            //     $(".poster-mode").fadeIn();
+                            // })
+
+
+                            if(dishIndex == 0){
+                                exportRoot.pot.hsr.gotoAndStop(1);
+                            }else if(dishIndex == 1){
+                                exportRoot.pot.qcdf.gotoAndStop(1);
+                            }else if(dishIndex == 2){
+                                exportRoot.bowl.oil.alpha = 0;
+                                exportRoot.plate['swy_icon1'].gotoAndStop(2);
+                            }else{
+                                exportRoot.pot.ymc.gotoAndStop(1);
+                            }
+                            $(".shake-mode").fadeOut();
                             exportRoot.btn3.removeAllEventListeners();
                             $(".poster-mode").fadeIn();
-                        })
-
-
-                        if(dishIndex == 0){
-                            exportRoot.pot.hsr.gotoAndStop(1);
-                        }else if(dishIndex == 1){
-                            exportRoot.pot.qcdf.gotoAndStop(1);
-                        }else if(dishIndex == 2){
-                            exportRoot.bowl.oil.alpha = 0;
-                            exportRoot.plate['swy_icon1'].gotoAndStop(2);
-                        }else{
-                            exportRoot.pot.ymc.gotoAndStop(1);
-                        }
-                        $(".shake-mode").fadeOut();
-                    },3000)
+                        },3000)
 
+                    }
                     //dosomething
                     $("#fire").addClass("anim-time");
                 }else{