Beispiel #1
0
        public override void OnStartClient()
        {
            if (_handler == null)
            {
                _handler = new ClientHandler(this);
                Game.Instance.JoinSession();
            }

            base.OnStartClient();
            _handler.OnStartClient();
        }
Beispiel #2
0
        // 25.1.149.130:4040

        public bool StartClient(string hostAddress)
        {
            _handler = null;
            if (NetworkUtils.ParseAddress(hostAddress, out IPAddress adrs, out ushort port))
            {
                Transport.port = port;
                _isStarted     = true;
                StartClient(NetworkUtils.ToUri(adrs, TelepathyTransport.Scheme));
                return(true);
            }

            return(false);
        }
Beispiel #3
0
        public bool StartHost(string port)
        {
            _handler       = null;
            _handler       = new ServerHandler(this);
            Transport.port = ushort.TryParse(port, out ushort res) ? res : NetworkUtils.DefaultPort;
            _isStarted     = true;
            StartHost();

            NetworkServer.Spawn(
                NetworkingLibrary.Instance.GameSession.gameObject.Create(),
                NetworkServer.localConnection);

            return(true);
        }