Ejemplo n.º 1
0
 // Start is called before the first frame update
 void Start()
 {
     Instance = this;
     MonoJavaCallback.InitMonoJavaCallback();
     ConnectEngine.Instance.OnConnect         += OnConnectUI;
     ConnectEngine.Instance.ConnectionChanged += ConnectionStatusChanged;
     ipField.onEndEdit.AddListener(SubmitIP);
     portField.onEndEdit.AddListener(SubmitPort);
     currentParameters = new ConnectionParams
     {
         name = "TestTCPConnection"
     };
     connectButton.onClick.AddListener(TestTCPConnect);
     disconnectButton.onClick.AddListener(TestTCPDisconnect);
     if (currentParameters.HasSavedData())
     {
         currentParameters    = Newtonsoft.Json.JsonConvert.DeserializeObject <ConnectionParams>(currentParameters.GetStringParametersFromPlayerPrefs());
         ipField.text         = currentParameters.ip;
         portField.text       = currentParameters.port.ToString();
         keepAliveToggle.isOn = currentParameters.keepAlive;
     }
 }