Browse Source

tried to fix issue: Deck is inconsistent #11

Vladimir Bykov 11 years ago
parent
commit
e397bf656e

+ 2 - 1
apps/web/priv/static/app/js/okey/okey.js

@@ -103,6 +103,7 @@ function PostLoad()
                 });
                 });
             }
             }
 
 
+            playersMap[scope.user].timer.on('beforeTimerEnd', function(){ scope.Draggable.revert() })
 
 
             scope.started = !0;
             scope.started = !0;
         }
         }
@@ -189,7 +190,7 @@ function PostLoad()
         }
         }
 
 
         if(e.detail.player == scope.user){
         if(e.detail.player == scope.user){
-            scope.Draggable.revert()
+            // scope.Draggable.revert()
             deck.insert(e.detail.revealed)
             deck.insert(e.detail.revealed)
         }
         }
         centralCard.dragHandler.disable()
         centralCard.dragHandler.disable()

+ 3 - 0
apps/web/priv/static/app/js/timer.js

@@ -33,6 +33,9 @@ function TimerScope(scope) {
                 dur: this.curTime
                 dur: this.curTime
             }),
             }),
             this.timerId = this.withDelay(this.tick, 1e3);
             this.timerId = this.withDelay(this.tick, 1e3);
+            this.withDelay(function(){
+                this.$el.trigger('beforeTimerEnd')
+            }, this.duration*1e3-500)
         },
         },
         tick: function() {
         tick: function() {
             return this.paused 
             return this.paused