mirror of
https://github.com/RandomityGuy/MBHaxe.git
synced 2025-10-30 08:11:25 +00:00
fix client disconnect artifacts on host player list, fix webrtc not working on web
This commit is contained in:
parent
b064c38118
commit
2694d2ce68
2 changed files with 7 additions and 12 deletions
|
|
@ -83,13 +83,7 @@ class Net {
|
||||||
public static var serverInfo:ServerInfo;
|
public static var serverInfo:ServerInfo;
|
||||||
public static var remoteServerInfo:RemoteServerInfo;
|
public static var remoteServerInfo:RemoteServerInfo;
|
||||||
|
|
||||||
static var stunServers = [
|
static var stunServers = ["stun:stun.l.google.com:19302"];
|
||||||
"stun:stun.l.google.com:19302",
|
|
||||||
"stun:stun1.l.google.com:19302",
|
|
||||||
"stun:stun2.l.google.com:19302",
|
|
||||||
"stun:stun3.l.google.com:19302",
|
|
||||||
"stun:stun4.l.google.com:19302",
|
|
||||||
];
|
|
||||||
|
|
||||||
public static var turnServer:String = "";
|
public static var turnServer:String = "";
|
||||||
|
|
||||||
|
|
@ -106,7 +100,7 @@ class Net {
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function addClientFromSdp(sdpString:String, privateJoin:Bool, onFinishSdp:String->Void) {
|
public static function addClientFromSdp(sdpString:String, privateJoin:Bool, onFinishSdp:String->Void) {
|
||||||
var peer = new RTCPeerConnection(stunServers.concat([turnServer]), "0.0.0.0");
|
var peer = new RTCPeerConnection(stunServers, "0.0.0.0");
|
||||||
var sdpObj = Json.parse(sdpString);
|
var sdpObj = Json.parse(sdpString);
|
||||||
peer.setRemoteDescription(sdpObj.sdp, sdpObj.type);
|
peer.setRemoteDescription(sdpObj.sdp, sdpObj.type);
|
||||||
addClient(peer, privateJoin, onFinishSdp);
|
addClient(peer, privateJoin, onFinishSdp);
|
||||||
|
|
@ -191,7 +185,7 @@ class Net {
|
||||||
|
|
||||||
public static function joinServer(serverName:String, isInvite:Bool, connectedCb:() -> Void) {
|
public static function joinServer(serverName:String, isInvite:Bool, connectedCb:() -> Void) {
|
||||||
MasterServerClient.connectToMasterServer(() -> {
|
MasterServerClient.connectToMasterServer(() -> {
|
||||||
client = new RTCPeerConnection(stunServers.concat([turnServer]), "0.0.0.0");
|
client = new RTCPeerConnection(stunServers, "0.0.0.0");
|
||||||
var candidates = [];
|
var candidates = [];
|
||||||
|
|
||||||
var closing = false;
|
var closing = false;
|
||||||
|
|
@ -267,9 +261,9 @@ class Net {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
haxe.Timer.delay(() -> {
|
// haxe.Timer.delay(() -> {
|
||||||
finishSdp();
|
// finishSdp();
|
||||||
}, 5000);
|
// }, 5000);
|
||||||
|
|
||||||
clientDatachannel = client.createDatachannel("mp");
|
clientDatachannel = client.createDatachannel("mp");
|
||||||
clientDatachannelUnreliable = client.createDatachannelWithOptions("unreliable", true, null, 600);
|
clientDatachannelUnreliable = client.createDatachannelWithOptions("unreliable", true, null, 600);
|
||||||
|
|
|
||||||
|
|
@ -222,6 +222,7 @@ class NetCommands {
|
||||||
MarbleGame.instance.world.allClientsReady();
|
MarbleGame.instance.world.allClientsReady();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Net.clientIdMap.remove(clientId);
|
||||||
if (MarbleGame.canvas.content is MultiplayerLevelSelectGui) {
|
if (MarbleGame.canvas.content is MultiplayerLevelSelectGui) {
|
||||||
cast(MarbleGame.canvas.content, MultiplayerLevelSelectGui).updateLobbyNames();
|
cast(MarbleGame.canvas.content, MultiplayerLevelSelectGui).updateLobbyNames();
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue