mirror of
https://github.com/logsol/chuck.js.git
synced 2026-05-11 10:37:34 +00:00
Bugfixing - unsubscribing game related topics, to prevent double calls and leaking references, added offAll method to nc. fixes no rendering bug
This commit is contained in:
parent
40e396fc23
commit
39f684315b
8 changed files with 57 additions and 19 deletions
|
|
@ -14,8 +14,10 @@ function (Parent, KeyboardInput, MouseInput, Nc) {
|
|||
this.keyboardInput = new KeyboardInput(this);
|
||||
this.xyInput = new MouseInput(this);
|
||||
|
||||
Nc.on(Nc.ns.client.input.xy.change, this.setXY, this);
|
||||
Nc.on(Nc.ns.client.input.handAction.request, this.handActionRequest, this);
|
||||
this.ncTokens = [
|
||||
Nc.on(Nc.ns.client.input.xy.change, this.setXY, this),
|
||||
Nc.on(Nc.ns.client.input.handAction.request, this.handActionRequest, this)
|
||||
];
|
||||
|
||||
var keys = {
|
||||
w:87,
|
||||
|
|
@ -118,6 +120,11 @@ function (Parent, KeyboardInput, MouseInput, Nc) {
|
|||
Nc.trigger(Nc.ns.client.game.gameInfo.toggle, false);
|
||||
};
|
||||
|
||||
PlayerController.prototype.destroy = function() {
|
||||
Nc.offAll(this.ncTokens);
|
||||
Parent.prototype.destroy.call(this);
|
||||
};
|
||||
|
||||
|
||||
return PlayerController;
|
||||
});
|
||||
Loading…
Add table
Add a link
Reference in a new issue