Skip to content

Commit

Permalink
清除brnn时间监听
Browse files Browse the repository at this point in the history
  • Loading branch information
WhoIsYourBaby committed Jul 28, 2017
1 parent b1e887b commit 8c180be
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 2 deletions.
8 changes: 8 additions & 0 deletions client_cocos/assets/Script/protocol/BrnnProto.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,4 +36,12 @@ BrnnProto.onDealPoker = function (callback) {
//计算输赢结果
BrnnProto.onGoldResult = function (callback) {
pomelo.on('brnn.onGoldResult', callback);
}

BrnnProto.disableEvent = function() {
pomelo.removeAllListeners('brnn.onGoldResult');
pomelo.removeAllListeners('brnn.onDealPoker');
pomelo.removeAllListeners('brnn.onWillStart');
pomelo.removeAllListeners('brnn.onAdd');
pomelo.removeAllListeners('brnn.onLeave');
}
5 changes: 4 additions & 1 deletion client_cocos/assets/Script/protocol/GateConnector.js
Original file line number Diff line number Diff line change
Expand Up @@ -70,5 +70,8 @@ GateConnector.connectorEnterRoom = function (rtype, rid, callback) {
}

GateConnector.connectorExit = function(callback) {
pomelo.request('connector.entryHandler.exit', callback);
pomelo.request('connector.entryHandler.exit', function() {
pomelo.disconnect();
callback();
});
}
11 changes: 10 additions & 1 deletion client_cocos/assets/Script/ui/BrnnRoomController.js
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,6 @@ cc.Class({
// use this for initialization
onLoad: function () {
this.brnnChipInDic = {'1':0, '2':0, '3':0, '4':0};
this.buttonExit.node.on('click', this.buttonExitTap, this);
var masterViewSC = this.masterView.getComponent('ChipViewScript');
this.chipViewSC.push(masterViewSC);

Expand All @@ -64,8 +63,18 @@ cc.Class({
var cpscript = cp.getComponent('ChipViewScript');
this.chipViewSC.push(cpscript);
}

},

onEnable: function () {
this.buttonExit.node.on('click', this.buttonExitTap, this);
this.initBrnnEvent();
},

onDisable: function () {
this.buttonExit.node.off('click', this.buttonExitTap, this);
BrnnProto.disableEvent();
},
// called every frame, uncomment this function to activate update callback
// update: function (dt) {

Expand Down

0 comments on commit 8c180be

Please sign in to comment.