@leancloud/client-engine
Advanced tools
Comparing version 1.0.0 to 1.0.1
@@ -50,4 +50,10 @@ "use strict"; | ||
super(...params); | ||
const roomIsEmpty = () => { | ||
if (!this.masterClient.room) { | ||
return true; | ||
} | ||
return this.players.length + this.registeredPlayers.size === 0; | ||
}; | ||
AutoDestroyGame.killerTimer | ||
.pipe(operators_1.filter(() => this.players.length + this.registeredPlayers.size === 0), operators_1.take(2)) | ||
.pipe(operators_1.filter(roomIsEmpty), operators_1.take(2)) | ||
.toPromise() | ||
@@ -54,0 +60,0 @@ .then(() => { |
@@ -48,2 +48,3 @@ /// <reference types="node" /> | ||
terminate(): Promise<any>; | ||
destroy(): void; | ||
/** | ||
@@ -83,3 +84,2 @@ * 向玩家广播自定义事件。 | ||
}>; | ||
protected destroy(): void; | ||
} | ||
@@ -86,0 +86,0 @@ export declare const GameEvent: { |
@@ -65,2 +65,7 @@ "use strict"; | ||
} | ||
destroy() { | ||
// TODO: 直接调用 gameInstance.masterClient.close() 时不会触发 END 事件 | ||
this.masterClient.close(); | ||
this.emit(exports.GameEvent.END); | ||
} | ||
/** | ||
@@ -109,6 +114,2 @@ * 向玩家广播自定义事件。 | ||
} | ||
destroy() { | ||
this.masterClient.close(); | ||
this.emit(exports.GameEvent.END); | ||
} | ||
} | ||
@@ -115,0 +116,0 @@ exports.Game = Game; |
{ | ||
"name": "@leancloud/client-engine", | ||
"version": "1.0.0", | ||
"version": "1.0.1", | ||
"description": "Node.js SDK for LeanCloud ClientEngine", | ||
@@ -5,0 +5,0 @@ "main": "build/index.js", |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
65855
1111