diff --git a/integrations/Apple/ZeroTierSDK_Apple/ZeroTierSDK_Apple.xcodeproj/project.xcworkspace/xcuserdata/Joseph.xcuserdatad/UserInterfaceState.xcuserstate b/integrations/Apple/ZeroTierSDK_Apple/ZeroTierSDK_Apple.xcodeproj/project.xcworkspace/xcuserdata/Joseph.xcuserdatad/UserInterfaceState.xcuserstate index fc06d3d..a6e0d4c 100644 Binary files a/integrations/Apple/ZeroTierSDK_Apple/ZeroTierSDK_Apple.xcodeproj/project.xcworkspace/xcuserdata/Joseph.xcuserdatad/UserInterfaceState.xcuserstate and b/integrations/Apple/ZeroTierSDK_Apple/ZeroTierSDK_Apple.xcodeproj/project.xcworkspace/xcuserdata/Joseph.xcuserdatad/UserInterfaceState.xcuserstate differ diff --git a/integrations/Unity3D/Assets/Demo.cs b/integrations/Unity3D/Assets/Demo.cs index 78a025b..148fdcf 100644 --- a/integrations/Unity3D/Assets/Demo.cs +++ b/integrations/Unity3D/Assets/Demo.cs @@ -12,6 +12,8 @@ public class Demo : MonoBehaviour private ZeroTierNetworkInterface zt; string nwid = ""; + int server_connection_socket; // The "connection id" + private void zt_sample_network_test_thread() { print("test_network"); @@ -69,33 +71,40 @@ public class Demo : MonoBehaviour Debug.Log ("Leaving: " + input.text); zt.LeaveNetwork (input.text); } - - + public void Connect() { - GameObject go = GameObject.Find ("inputServerAddress"); - //Text text = go.GetComponents ()[0]; - InputField input = go.GetComponents () [0]; - Debug.Log ("Connecting to: " + input.text); - //zt.Connect(0, input.text + GameObject addr_go = GameObject.Find ("inputServerAddress"); + GameObject port_go = GameObject.Find ("inputServerPort"); + InputField addr = addr_go.GetComponents () [0]; + InputField port = port_go.GetComponents () [0]; + Debug.Log ("Connecting to: " + addr.text + ":" + port.text); + byte error = 0; + server_connection_socket = zt.Connect (0, addr.text, int.Parse (port.text), out error); + Debug.Log ("server_connection_socket = " + server_connection_socket); + Debug.Log ("Conenct(): " + error); } public void Disconnect() { - GameObject go = GameObject.Find ("inputServerAddress"); - InputField text = go.GetComponents () [0]; - Debug.Log ("Disconnecting from: " + text.text); + GameObject addr_go = GameObject.Find ("inputServerAddress"); + GameObject port_go = GameObject.Find ("inputServerAddress"); + InputField addr = addr_go.GetComponents () [0]; + InputField port = port_go.GetComponents () [0]; + Debug.Log ("Disconnecting from: " + addr.text + ":" + port.text); + Debug.Log ("Disconnect(): " + zt.Disconnect (server_connection_socket)); } - - + public void SendMessage() { GameObject go = GameObject.Find ("inputMessage"); - InputField text = go.GetComponents () [0]; - Debug.Log ("Sending Message: " + text.text); + InputField msg = go.GetComponents () [0]; + Debug.Log ("Sending Message: " + msg.text); + byte error = 0; + zt.Send (server_connection_socket, msg.text.ToCharArray (), msg.text.ToCharArray ().Length, out error); + Debug.Log ("Send(): " + error); } - void Start() { // Set defaults diff --git a/integrations/Unity3D/Assets/MainScene.unity b/integrations/Unity3D/Assets/MainScene.unity index 7b4d9f7..cf749dc 100644 Binary files a/integrations/Unity3D/Assets/MainScene.unity and b/integrations/Unity3D/Assets/MainScene.unity differ