From ab295db0c32be8cb97df09b0fe0c993a80467807 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mathias=20Dj=C3=A4rv?= Date: Tue, 14 Feb 2017 18:51:43 +0100 Subject: [PATCH] tweaked proxy connect UI --- .../Assets/JoystickSocketReader.cs | 27 ++++++++++-------- .../Assets/JoystickVisualizer.unity | Bin 115796 -> 116636 bytes .../ProjectSettings/QualitySettings.asset | Bin 4736 -> 4772 bytes 3 files changed, 15 insertions(+), 12 deletions(-) diff --git a/JoystickVisualizer/Assets/JoystickSocketReader.cs b/JoystickVisualizer/Assets/JoystickSocketReader.cs index 6711478..eb2cb55 100644 --- a/JoystickVisualizer/Assets/JoystickSocketReader.cs +++ b/JoystickVisualizer/Assets/JoystickSocketReader.cs @@ -2,6 +2,7 @@ using System.Net.Sockets; using System; using JoystickProxy; +using UnityEngine.UI; public class JoystickSocketReader : MonoBehaviour { private int HAT_ANGLE = 8; @@ -24,7 +25,7 @@ public class JoystickSocketReader : MonoBehaviour { public GameObject connectionError; - public GameObject HostInputField; + public GameObject HostInputPanel; public string Host = "127.0.0.1"; public int Port = 9998; @@ -122,16 +123,13 @@ public class JoystickSocketReader : MonoBehaviour { private WarthogJoystick warthogJoystick; private WarthogThrottle warthogThrottle; - public void Host_Changed(string host) - { - Host = host; - connectionError.SetActive(false); - if (client != null) - { - client.Close (); - } - reconnect (); - } + public InputField ProxyHostInputField; + + public void UpdateHost() + { + Host = ProxyHostInputField.text; + reconnect(); + } void Start () { warthogJoystick = new WarthogJoystick(); @@ -168,7 +166,7 @@ void Start () { } void Update () { - if (HostInputField.activeInHierarchy || connectionError.activeInHierarchy) + if (HostInputPanel.activeInHierarchy || connectionError.activeInHierarchy) { // If we're inputting host, don't do anything return; @@ -239,6 +237,11 @@ void reconnect() { { lastMessage = DateTime.Now; // Reconnect attempt every other second + try + { + client.Close(); + } catch(Exception) {} + client = new TcpClient(); var result = client.BeginConnect(Host, Port, null, null); diff --git a/JoystickVisualizer/Assets/JoystickVis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