Commit c4009ceb authored by 范雪寒's avatar 范雪寒

test:

parent e9b3f3af
......@@ -123,6 +123,7 @@ export class NetworkHelper {
console.log("this.room = " + JSON.stringify(this.room.roomInfo));
}
player: MGOBE.Player;
joinRoom(roomType: string, maxPlayers: number, customData: string = "") {
return new Promise((resolve, reject) => {
const playerName = "Tom" + Math.random();
......@@ -149,6 +150,7 @@ export class NetworkHelper {
const player = event.data.roomInfo.playerList.find(
(player) => player.name == playerName
);
this.player = player;
if (this.checkRoomOwnerOffLine()) {
if (this._eventListeners["playerOffLine"]) {
this._eventListeners["playerOffLine"](event);
......@@ -180,7 +182,7 @@ export class NetworkHelper {
dismissRoom() {
const roomInfo = this.room.roomInfo;
const player = roomInfo.playerList.find(
(player) => player.name == playerName
(player) => player.name == this.player.name
);
if (roomInfo.owner == player.id) {
return new Promise((resolve, reject) => {
......@@ -312,10 +314,10 @@ export class NetworkHelper {
async onDestroy() {
try {
console.log("onDestroy1");
this.dismissRoom();
MGOBE.Listener.clear();
this.stopFrameSync();
this.closeRoom();
this.dismissRoom();
this.leaveRoom();
console.log("onDestroy2");
} catch (e) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment