DestroyClient() public static method

public static DestroyClient ( SyphonClientObject, destroyObj ) : void
destroyObj SyphonClientObject,
return void
Beispiel #1
0
    public void drawGUIClientEditor()
    {
        foreach (KeyValuePair <string, string[]> kvp in SyphonTarget.clientAppNames)
        {
            GUI.changed = false;
            int selectIndex = 0;

            //if you're not drawing the one you've selected, the index is 0.
            if (kvp.Key != clientConfirmKey)
            {
                selectIndex = 0;
            }
            //otherwise, the index is whatever the selected index is.
            else
            {
                selectIndex = GUIClientSelectionIndex;
            }

            selectIndex = EditorGUILayout.Popup(kvp.Key, selectIndex, kvp.Value);
            if (GUI.changed)
            {
                //Debug.Log("Selected: " + kvp.Key + " : " +  kvp.Value[GUIClientSelectionIndex] + "!");
                GUIClientSelectionIndex = selectIndex;
                showClientConfirmState  = true;
                clientConfirmKey        = kvp.Key;
                clientConfirmValue      = kvp.Value[GUIClientSelectionIndex];
                selectedClientObj       = Syphon.GetSyphonClient(clientConfirmKey, clientConfirmValue);
            }
        }

        if (showClientConfirmState && selectedClientObj != null)
        {
            SyphonClientObject destroyObj = null;

            GUILayout.BeginHorizontal();
            GUILayout.BeginVertical();
            GUILayout.Label("App: " + selectedClientObj.AttachedServer.SyphonServerDescriptionAppName + "\nName: " +
                            selectedClientObj.AttachedServer.SyphonServerDescriptionName);
            if (GUILayout.Button("remove client"))
            {
                destroyObj = selectedClientObj;
            }
            GUILayout.EndVertical();
            GUILayout.Label(new GUIContent("", selectedClientObj.AttachedTexture, "App: " +
                                           selectedClientObj.AttachedServer.SyphonServerDescriptionAppName + "\nName: "
                                           + selectedClientObj.AttachedServer.SyphonServerDescriptionName), GUILayout.MaxWidth(150), GUILayout.MaxHeight(128));
            GUILayout.EndHorizontal();

            if (destroyObj != null)
            {
                Syphon.DestroyClient(destroyObj);
                showClientConfirmState  = false;
                GUIClientSelectionIndex = 0;
            }
        }
    }