Exemplo n.º 1
0
 public void Click()
 {
     if (!CrashDetector.Show())
     {
         CustomNetworkManager customNetworkManager = UnityEngine.Object.FindObjectOfType <CustomNetworkManager>();
         if (NetworkClient.active)
         {
             customNetworkManager.StopClient();
         }
         NetworkServer.Reset();
         customNetworkManager.ShowLog(13);
         customNetworkManager.networkAddress = this.ip;
         try
         {
             customNetworkManager.networkPort = int.Parse(this.port);
         }
         catch
         {
             GameConsole.Console.singleton.AddLog("Wrong server port, parsing to 7777!", new Color32(182, 182, 182, byte.MaxValue), false);
             customNetworkManager.networkPort = 7777;
         }
         GameConsole.Console.singleton.AddLog(string.Concat(new string[]
         {
             "Connecting to ",
             this.ip,
             ":",
             this.port,
             "!"
         }), new Color32(182, 182, 182, byte.MaxValue), false);
         customNetworkManager.StartClient();
     }
 }
Exemplo n.º 2
0
 public void Connect()
 {
     if (!CrashDetector.Show())
     {
         NetworkServer.Reset();
         this.mng.ShowLog(13);
         this.mng.StartClient();
     }
 }
        public static void Connect(ServerData sData)
        {
            if (CrashDetector.Show())
            {
                return;
            }

            CustomNetworkManager customNetworkManager = UnityEngine.Object.FindObjectOfType <CustomNetworkManager>();

            if (NetworkClient.active)
            {
                customNetworkManager.StopClient();
            }
            NetworkServer.Reset();
            CustomNetworkManager.ConnectionIp   = sData.IP;
            customNetworkManager.networkAddress = sData.IP;
            customNetworkManager.networkPort    = sData.port;
            customNetworkManager.ShowLog(13, string.Empty, string.Empty);
            customNetworkManager.StartClient();
            GameConsole.Console.singleton.AddLog(String.Format("Connecting to {0}:{1}!", sData.IP, sData.port), new Color32(182, 182, 182, byte.MaxValue), false);
        }