Added ITask and basic connection

This commit is contained in:
2026-01-31 15:44:30 +01:00
parent 3b36d53b39
commit fc22d4f544
9 changed files with 4506 additions and 0 deletions

View File

@@ -0,0 +1,38 @@
using GeoSus.Client;
using System.Threading.Tasks;
using UnityEngine;
namespace Subsystems
{
public class GameManager_Network
{
private const string _serverAddress = "geosus.honzuvkod.dev";
private const int _serverPort = 7777;
private GameClient _gameClient;
public async void checkState()
{
while (true)
{
Task<bool> state = _gameClient.ConnectAsync(_serverAddress, _serverPort);
await state;
if (state.Result)
{
Debug.Log("Connected to server.");
_gameClient.Disconnect();
}
else
{
Debug.Log("Failed to connect to server");
}
await Task.Delay(5000);
}
}
public GameManager_Network(GameClient gameClient)
{
_gameClient = gameClient;
}
}
}