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

View File

@ -25,9 +25,9 @@ public sealed class KPTLConnect : Component, Component.INetworkListener
LoadingScreen.Title = "Creating Lobby"; LoadingScreen.Title = "Creating Lobby";
await Task.DelayRealtimeSeconds( 0.1f ); await Task.DelayRealtimeSeconds( 0.1f );
Networking.CreateLobby(); 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); Networking.Connect(lobbyId);
} }
} }
@ -63,7 +63,9 @@ public sealed class KPTLConnect : Component, Component.INetworkListener
var lobbyList = await Networking.QueryLobbies(); 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> /// <summary>

View File

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