this.queue = [];
this.activeKeys = new Y.YArray();
+ this.keydown = this.keydown.bind(this);
+ this.keyup = this.keyup.bind(this);
+ this.mousedown = this.mousedown.bind(this);
+ this.mouseup = this.mouseup.bind(this);
+ this.mousemove = this.mousemove.bind(this);
+
this.replayMode = !!replay;
if (this.replayMode) {
this.nextMove = replay.shift();
} else {
- this.keydown = this.keydown.bind(this);
- this.keyup = this.keyup.bind(this);
- this.mousedown = this.mousedown.bind(this);
- this.mouseup = this.mouseup.bind(this);
- this.mousemove = this.mousemove.bind(this);
$(document)
.bind('keydown', this.keydown)
.bind('keyup', this.keyup)
+ .bind('mousemove', this.mousemove);
+ $('#viewport')
.bind('mousedown', this.mousedown)
- .bind('mouseup', this.mouseup)
- .bind('mousemove', this.mousemove)
- ;
+ .bind('mouseup', this.mouseup);
}
},
+ destroy : function destroy(){
+ $(document)
+ .unbind('keydown', this.keydown)
+ .unbind('keyup', this.keyup)
+ .unbind('mousemove', this.mousemove);
+ $('#viewport')
+ .unbind('mousedown', this.mousedown)
+ .unbind('mouseup', this.mouseup);
+ return Tank.fn.destroy.call(this);
+ },
+
setReplay : function setReplay(replay){
this.replayMode = true;
this.replay = replay
, game = null
, overlay = null
;
-function stopProp(evt){ evt.stopPropagation(); }
-
qkv = Y(window.location.search.slice(1)).fromKV();
hkv = Y(window.location.hash.slice(1)).fromKV();
overlay = $('#overlay');
updateOverlay( config.get('ui.overlayOnPause') );
- config.addEventListener('set:ui.overlayOnPause', function(evt){ updateOverlay(evt.newval); });
+ config.addEventListener('set:ui.overlayOnPause', function(evt){ updateOverlay(evt.newval); });
config.addEventListener('set:ui.debug.showFpsGraph', function(evt){ updateUI('#info', evt.newval); });
// Player.addEventListener('create', function(evt){ P = evt.data.instance; });
$(document).bind('keydown', 'ctrl+i', function(evt){ updateUI('#info', TOGGLE); });
$(document).bind('keydown', 'ctrl+c', function(evt){ updateUI('#config', TOGGLE); });
- // Don't fire on clicks in the debug menu
- $('.debug').bind('mousedown', stopProp);
- $('.debug').bind('click', stopProp);
-
// Create #pause box
$('#loading').clone()
.attr('id', 'pause')