Example #1
0
    public void OnMapLoadedAsClient(Scene scene, LoadSceneMode loadSceneMode)
    {
        SceneManager.sceneLoaded -= OnMapLoadedAsClient;

        Client = new Client();
        Client.OnDisconnectedFromServer += OnClientDisconnectedFromServer;
        Client.Start();

        string ipAddress;
        ushort portNumber;
        var    succeededParsing = NetLib.ParseIpAddressAndPort(
            EnteredClientIpAddressAndPort, Server.PortNumber, out ipAddress, out portNumber
            );

        if (succeededParsing)
        {
            Client.StartConnectingToServer(ipAddress, portNumber);
        }
    }
Example #2
0
    public void OnMapLoadedAsClientUsingMasterServer(Scene scene, LoadSceneMode loadSceneMode)
    {
        SceneManager.sceneLoaded -= OnMapLoadedAsClient;

        Client = new Client();
        Client.OnDisconnectedFromServer += OnClientDisconnectedFromServer;
        Client.Start();

        string ipAddress;
        ushort portNumber;
        var    succeededParsing = NetLib.ParseIpAddressAndPort(
            EnteredClientIpAddressAndPort, Server.PortNumber, out ipAddress, out portNumber
            );

        if (succeededParsing)
        {
            Client.ClientPeer.StartConnectingToServerThroughMasterServer(
                matchInfoSnapshot, "", MatchmakingRequestDomain
                );
        }
    }