@@ -572,11 +572,20 @@
|
|
572
572
|
return this.connectWebsocket();
|
573
573
|
};
|
574
574
|
|
575
|
-
/**
|
575
|
+
/** Disconnect from the networking backend + reset internal state */
|
576
576
|
public disconnect() {
|
577
577
|
this._ws?.close();
|
578
578
|
this._ws = undefined;
|
579
579
|
networkingServerUrl = undefined;
|
580
|
+
|
581
|
+
// Reset all state
|
582
|
+
this._currentRoomAllowEditing = true;
|
583
|
+
this._currentRoomName = null;
|
584
|
+
this._currentRoomViewId = null;
|
585
|
+
this._isInRoom = false;
|
586
|
+
this._currentInRoom.length = 0;
|
587
|
+
this._state = {};
|
588
|
+
this._currentDelay = -1;
|
580
589
|
}
|
581
590
|
|
582
591
|
private _listeners: { [key: string]: Function[] } = {};
|
@@ -752,7 +761,9 @@
|
|
752
761
|
if (model.room === this.currentRoomName) {
|
753
762
|
this._isInRoom = false;
|
754
763
|
this._currentRoomName = null;
|
764
|
+
this._currentRoomAllowEditing = true;
|
755
765
|
this._currentInRoom.length = 0;
|
766
|
+
if (debugnetBin || isDevEnvironment()) console.debug("Left Needle Engine Room: " + model.room);
|
756
767
|
}
|
757
768
|
break;
|
758
769
|
case RoomEvents.UserJoinedRoom:
|
@@ -791,7 +802,7 @@
|
|
791
802
|
this._currentDelay = this.context.time.time - time;
|
792
803
|
}
|
793
804
|
if (debugNet)
|
794
|
-
console.log(
|
805
|
+
console.log(`Current latency: ${(this._currentDelay * 1000).toFixed()} ms`, "Clients in room: " + this._currentInRoom?.length);
|
795
806
|
break;
|
796
807
|
}
|
797
808
|
}
|