This commit is contained in:
opti1337 2024-10-30 00:19:13 +03:00
parent f818bc8941
commit 55cf4aa1ed
3 changed files with 8 additions and 5 deletions

View File

@ -6,6 +6,7 @@
"Flags": 0,
"Name": "NetworkManager",
"Enabled": true,
"NetworkMode": 0,
"Components": [
{
"__type": "Sandbox.SceneInformation",
@ -16,7 +17,7 @@
},
{
"__type": "Sandbox.KPTLConnect",
"__guid": "f04f8f05-a397-4270-a980-0af80440178e",
"__guid": "895b0f93-287e-4607-808e-6ce5bdbb5c05",
"PlayerPrefab": {
"_type": "gameobject",
"prefab": "prefabs/player.prefab"

View File

@ -25,9 +25,9 @@ public sealed class KPTLConnect : Component, Component.INetworkListener
LoadingScreen.Title = "Creating Lobby";
await Task.DelayRealtimeSeconds( 0.1f );
Networking.CreateLobby();
} else
} else if (!StartServer && !Networking.IsActive)
{
string lobbyId = await Http.RequestStringAsync( "https://sbox.koptilnya.xyz/string" );
string lobbyId = await Http.RequestStringAsync( "https://sbox.koptilnya.xyz" );
Networking.Connect(lobbyId);
}
}
@ -63,7 +63,9 @@ public sealed class KPTLConnect : Component, Component.INetworkListener
var lobbyList = await Networking.QueryLobbies();
await Http.RequestAsync( $"https://sbox.koptilnya.xyz/string?text={lobbyList[0].LobbyId}", "POST" );
await Http.RequestAsync( $"https://sbox.koptilnya.xyz/?text={lobbyList[0].LobbyId}", "POST" );
Log.Info( "Lobby ID updated successfully!" );
}
/// <summary>

View File

@ -24,6 +24,6 @@
"CsProjName": "",
"StartupScene": "scenes/minimal.scene",
"MapStartupScene": "scenes/minimal.scene",
"LaunchMode": "Launcher"
"LaunchMode": "Normal"
}
}