Beispiel #1
0
        private void StartMultiplayerClient()
        {
            if (multiplayerClient == null)
            {
                multiplayerClient      = new GameObject();
                multiplayerClient.name = "Multiplayer Client";
                multiplayerClient.AddComponent <Multiplayer>();
                multiplayerSession.ConnectionStateChanged += SessionConnectionStateChangedHandler;
            }

            try
            {
                multiplayerSession.Connect(ServerIp, ServerPort);
            }
            catch (ClientConnectionFailedException)
            {
                Log.InGame($"Unable to contact the remote server at: {ServerIp}:{ServerPort}");

                if (ServerIp.Equals("127.0.0.1"))
                {
                    if (Process.GetProcessesByName("NitroxServer-Subnautica").Length == 0)
                    {
                        Log.InGame("Start your server first to join your self-hosted world");
                    }
                    else
                    {
                        Log.InGame("Seems like your firewall settings are interfering");
                    }
                }

                OnCancelClick();
            }
        }
Beispiel #2
0
        private void StartMultiplayerClient()
        {
            if (multiplayerClient == null)
            {
                multiplayerClient = new GameObject("Multiplayer Client");
                multiplayerClient.AddComponent <Multiplayer>();
                multiplayerSession.ConnectionStateChanged += SessionConnectionStateChangedHandler;
            }

            try
            {
                multiplayerSession.Connect(serverIp, serverPort);
            }
            catch (ClientConnectionFailedException)
            {
                Log.InGameSensitive(Language.main.Get("Nitrox_UnableToConnect") + " {ip}:{port}", serverIp, serverPort);

                if (serverIp.Equals("127.0.0.1"))
                {
                    if (Process.GetProcessesByName("NitroxServer-Subnautica").Length == 0)
                    {
                        Log.InGame(Language.main.Get("Nitrox_StartServer"));
                    }
                    else
                    {
                        Log.InGame(Language.main.Get("Nitrox_FirewallInterfering"));
                    }
                }
                OnCancelClick();
            }
        }
Beispiel #3
0
        private void StartMultiplayerClient()
        {
            if (multiplayerClient == null)
            {
                multiplayerClient = new GameObject();
                multiplayerClient.AddComponent <Multiplayer>();
                multiplayerSession.ConnectionStateChanged += SessionConnectionStateChangedHandler;
            }

            multiplayerSession.Connect(ServerIp);
        }
Beispiel #4
0
        public void OnConsoleCommand_mplayer(NotificationCenter.Notification n)
        {
            //This could be cleaned up. Honestly, I see this as a hack to deal with other unimplemented features. I'd rather just patch this boat until we can let it sink...
            NitroxServiceLocator.BeginNewLifetimeScope();
            multiplayerSession = NitroxServiceLocator.LocateService <IMultiplayerSession>();

            if (multiplayerSession.CurrentState.CurrentStage == MultiplayerSessionConnectionStage.SessionJoined)
            {
                Log.InGame("Already connected to a server");
            }
            else if (n?.data?.Count > 0)
            {
                Log.InGame("Console Multiplayer Session Join Client Loaded...");
                StartMultiplayerClient();

                string ipAddress = n.data.Count >= 2 ? (string)n.data[1] : DEFAULT_IP_ADDRESS;
                userName = (string)n.data[0];

                multiplayerSession.Connect(ipAddress);
            }
            else
            {
                Log.InGame("Command syntax: mplayer USERNAME [SERVERIP]");
            }
        }
Beispiel #5
0
        public void OnConsoleCommand_mplayer(NotificationCenter.Notification n)
        {
            //This could be cleaned up. Honestly, I see this as a hack to deal with other unimplemented features. I'd rather just patch this boat until we can let it sink...
            NitroxServiceLocator.BeginNewLifetimeScope();
            multiplayerSession = NitroxServiceLocator.LocateService <IMultiplayerSession>();

            if (multiplayerSession.CurrentState.CurrentStage == MultiplayerSessionConnectionStage.SessionJoined)
            {
                Log.InGame("Уже подключен к серверу");
            }
            else if (n?.data?.Count > 0)
            {
                Log.InGame("Консоль мультиплеерской сессии подключения игроков загружена...");
                StartMultiplayerClient();
                int    serverPort = 11000;
                string ipAddress  = n.data.Count >= 2 ? (string)n.data[1] : DEFAULT_IP_ADDRESS;
                userName = (string)n.data[0];
                string seperator = ":";
                if (ipAddress.Contains(seperator))
                {
                    char     splitter = ':';
                    string[] splitIP  = ipAddress.Split(splitter);
                    ipAddress  = splitIP[0];
                    serverPort = int.Parse(splitIP[1]);
                }
                multiplayerSession.Connect(ipAddress, serverPort);
            }
            else
            {
                Log.InGame("Синтаксис команды: mplayer USERNAME [SERVERIP]");
            }
        }
Beispiel #6
0
        private void StartMultiplayerClient()
        {
            if (multiplayerClient == null)
            {
                multiplayerClient = new GameObject();
                multiplayerClient.AddComponent <Multiplayer>();
                multiplayerSession.ConnectionStateChanged += SessionConnectionStateChangedHandler;
            }

            try
            {
                multiplayerSession.Connect(ServerIp);
            }
            catch (ClientConnectionFailedException)
            {
                Log.InGame($"Unable to contact the remote server at: {ServerIp}:11000");
                OnCancelClick();
            }
        }
Beispiel #7
0
        private void StartMultiplayerClient()
        {
            if (multiplayerClient == null)
            {
                multiplayerClient      = new GameObject();
                multiplayerClient.name = "Multiplayer Client"; // Its always nice to name things
                multiplayerClient.AddComponent <Multiplayer>();
                multiplayerSession.ConnectionStateChanged += SessionConnectionStateChangedHandler;
            }

            try
            {
                multiplayerSession.Connect(ServerIp, serverPort);
            }
            catch (ClientConnectionFailedException)
            {
                Log.InGame($"Unable to contact the remote server at: {ServerIp}:{serverPort}");
                OnCancelClick();
            }
        }
Beispiel #8
0
        public void OnConsoleCommand_mplayer(NotificationCenter.Notification n)
        {
            if (multiplayerSession.CurrentState.CurrentStage == MultiplayerSessionConnectionStage.SessionJoined)
            {
                Log.InGame("Already connected to a server");
            }
            else if (n?.data?.Count > 0)
            {
                Log.InGame("Console Multiplayer Session Join Client Loaded...");
                StartMultiplayerClient();

                string ipAddress = n.data.Count >= 2 ? (string)n.data[1] : DEFAULT_IP_ADDRESS;
                userName = (string)n.data[0];

                multiplayerSession.Connect(ipAddress);
            }
            else
            {
                Log.InGame("Command syntax: mplayer USERNAME [SERVERIP]");
            }
        }