mirror of
https://github.com/genxium/DelayNoMore
synced 2025-10-09 08:36:52 +00:00
Fixed libuv resource deallocation.
This commit is contained in:
@@ -362,7 +362,7 @@
|
||||
"array": [
|
||||
0,
|
||||
0,
|
||||
217.36746944238692,
|
||||
209.6693197428241,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
|
@@ -23,7 +23,8 @@ cc.Class({
|
||||
// LIFE-CYCLE CALLBACKS:
|
||||
onLoad() {},
|
||||
|
||||
init() {
|
||||
init(mapIns) {
|
||||
this.mapIns = mapIns;
|
||||
if (null != this.firstPlayerInfoNode) {
|
||||
this.firstPlayerInfoNode.active = false;
|
||||
}
|
||||
@@ -53,9 +54,10 @@ cc.Class({
|
||||
},
|
||||
|
||||
exitBtnOnClick(evt) {
|
||||
window.clearBoundRoomIdInBothVolatileAndPersistentStorage();
|
||||
window.closeWSConnection(constants.RET_CODE.UNKNOWN_ERROR, "");
|
||||
cc.director.loadScene('login');
|
||||
this.mapIns.hideFindingPlayersGUI();
|
||||
cc.log(`FindingPlayers.exitBtnOnClick`);
|
||||
window.closeWSConnection(constants.RET_CODE.BATTLE_STOPPED, "");
|
||||
window.clearLocalStorageAndBackToLoginScene(false);
|
||||
},
|
||||
|
||||
updatePlayersInfo(playerMetas) {
|
||||
|
@@ -360,10 +360,6 @@ cc.Class({
|
||||
if (self.countdownLabel) {
|
||||
self.countdownLabel.string = "";
|
||||
}
|
||||
if (self.findingPlayerNode) {
|
||||
const findingPlayerScriptIns = self.findingPlayerNode.getComponent("FindingPlayer");
|
||||
findingPlayerScriptIns.init();
|
||||
}
|
||||
if (self.playersInfoNode) {
|
||||
safelyAddChild(self.widgetsAboveAllNode, self.playersInfoNode);
|
||||
}
|
||||
@@ -470,7 +466,7 @@ cc.Class({
|
||||
self.findingPlayerNode.width = self.canvasNode.width;
|
||||
self.findingPlayerNode.height = self.canvasNode.height;
|
||||
const findingPlayerScriptIns = self.findingPlayerNode.getComponent("FindingPlayer");
|
||||
findingPlayerScriptIns.init();
|
||||
findingPlayerScriptIns.init(self);
|
||||
|
||||
self.playersInfoNode = cc.instantiate(self.playersInfoPrefab);
|
||||
|
||||
@@ -1066,6 +1062,7 @@ othersForcedDownsyncRenderFrame=${JSON.stringify(othersForcedDownsyncRenderFrame
|
||||
logout(byClick /* The case where this param is "true" will be triggered within `ConfirmLogout.js`.*/ , shouldRetainBoundRoomIdInBothVolatileAndPersistentStorage) {
|
||||
const self = this;
|
||||
const localClearance = () => {
|
||||
window.closeWSConnection(constants.RET_CODE.BATTLE_STOPPED, "");
|
||||
window.clearLocalStorageAndBackToLoginScene(shouldRetainBoundRoomIdInBothVolatileAndPersistentStorage);
|
||||
}
|
||||
|
||||
|
@@ -34,7 +34,7 @@ window.closeWSConnection = function(code, reason) {
|
||||
console.log(`"window.clientSession" is already closed or destroyed.`);
|
||||
return;
|
||||
}
|
||||
console.log(`Closing "window.clientSession" from the client-side.`);
|
||||
console.log(`Closing "window.clientSession" from the client-side with code=${code}.`);
|
||||
window.clientSession.close(code, reason);
|
||||
}
|
||||
|
||||
@@ -240,6 +240,12 @@ window.initPersistentSessionClient = function(onopenCb, expectedRoomId) {
|
||||
clientSession.onclose = function(evt) {
|
||||
// [WARNING] The callback "onclose" might be called AFTER the webpage is refreshed with "1001 == evt.code".
|
||||
console.warn(`The WS clientSession is closed: evt=${JSON.stringify(evt)}, evt.code=${evt.code}`);
|
||||
if (cc.sys.isNative) {
|
||||
if (mapIns.frameDataLoggingEnabled) {
|
||||
console.warn(`${mapIns._stringifyRdfIdToActuallyUsedInput()}`);
|
||||
}
|
||||
DelayNoMore.UdpSession.closeUdpSession();
|
||||
}
|
||||
switch (evt.code) {
|
||||
case constants.RET_CODE.CLIENT_MISMATCHED_RENDER_FRAME:
|
||||
break;
|
||||
@@ -261,7 +267,7 @@ window.initPersistentSessionClient = function(onopenCb, expectedRoomId) {
|
||||
case constants.RET_CODE.MYSQL_ERROR:
|
||||
case constants.RET_CODE.PLAYER_NOT_FOUND:
|
||||
case constants.RET_CODE.PLAYER_CHEATING:
|
||||
case 1006: // Peer(i.e. the backend) gone unexpectedly
|
||||
case 1006: // Peer(i.e. the backend) gone unexpectedly, but not working for "cc.sys.isNative"
|
||||
if (mapIns.frameDataLoggingEnabled) {
|
||||
console.warn(`${mapIns._stringifyRdfIdToActuallyUsedInput()}`);
|
||||
}
|
||||
@@ -270,24 +276,20 @@ window.initPersistentSessionClient = function(onopenCb, expectedRoomId) {
|
||||
default:
|
||||
break;
|
||||
}
|
||||
if (cc.sys.isNative) {
|
||||
DelayNoMore.UdpSession.closeUdpSession();
|
||||
}
|
||||
};
|
||||
};
|
||||
|
||||
window.clearLocalStorageAndBackToLoginScene = function(shouldRetainBoundRoomIdInBothVolatileAndPersistentStorage) {
|
||||
console.warn("+++++++ Calling `clearLocalStorageAndBackToLoginScene`");
|
||||
window.clearSelfPlayer();
|
||||
if (true != shouldRetainBoundRoomIdInBothVolatileAndPersistentStorage) {
|
||||
window.clearBoundRoomIdInBothVolatileAndPersistentStorage();
|
||||
}
|
||||
|
||||
if (window.mapIns && window.mapIns.musicEffectManagerScriptIns) {
|
||||
window.mapIns.musicEffectManagerScriptIns.stopAllMusic();
|
||||
}
|
||||
|
||||
window.closeWSConnection(constants.RET_CODE.UNKNOWN_ERROR, "");
|
||||
window.clearSelfPlayer();
|
||||
if (true != shouldRetainBoundRoomIdInBothVolatileAndPersistentStorage) {
|
||||
window.clearBoundRoomIdInBothVolatileAndPersistentStorage();
|
||||
}
|
||||
cc.director.loadScene('login');
|
||||
};
|
||||
|
||||
|
Reference in New Issue
Block a user