private void OnConnectionModeSwitched(ZView sender, IntPtr connection) { IntPtr mode = sender.GetConnectionMode(connection); string modeName = "None"; if (mode == sender.GetStandardMode()) { modeName = "Standard"; } else if (mode == sender.GetAugmentedRealityMode()) { modeName = "Augmented Reality"; } Debug.Log(string.Format("<color=green>Connection Mode Switched: {0}</color>", modeName)); }
private void DrawConnectionsSection() { ZView zView = (ZView)this.target; _isConnectionsSectionExpanded = this.DrawSectionHeader("Connections", _connectionsIconTexture, _isConnectionsSectionExpanded, true); if (_isConnectionsSectionExpanded) { bool doActiveConnectionsExist = false; try { // For each connection: int numConnections = zView.GetNumConnections(); for (int i = 0; i < numConnections; ++i) { // Get the connection. IntPtr connection = zView.GetConnection(i); // Get the connection's state. ZView.ConnectionState connectionState = zView.GetConnectionState(connection); if (connectionState != ZView.ConnectionState.Error) { // Display the connection's information. int connectionNumber = i + 1; string initiationStatusString = zView.WasConnectionLocallyInitiated(connection) ? "locally" : "remotely"; EditorGUILayout.LabelField(string.Format("Connection {0} (initiated {1})", connectionNumber, initiationStatusString)); EditorGUI.indentLevel++; { EditorGUILayout.LabelField("Name: " + zView.GetConnectedNodeName(connection)); EditorGUILayout.LabelField("Status: " + zView.GetConnectedNodeStatus(connection)); EditorGUILayout.LabelField("State: " + connectionState); IntPtr mode = zView.GetConnectionMode(connection); string modeString = "Unknown"; if (mode == IntPtr.Zero) { modeString = "None"; } else if (mode == zView.GetStandardMode()) { modeString = "Standard"; } else if (mode == zView.GetAugmentedRealityMode()) { modeString = "Augmented Reality"; } EditorGUILayout.LabelField("Mode: " + modeString); } EditorGUI.indentLevel--; EditorGUILayout.Space(); doActiveConnectionsExist = true; } } } catch { // TODO: Add warning. } if (!doActiveConnectionsExist) { EditorGUILayout.LabelField("No active connections"); EditorGUILayout.Space(); } } }