GetSyphonClient() 공개 정적인 메소드

public static GetSyphonClient ( string uuid ) : SyphonClientObject,
uuid string
리턴 SyphonClientObject,
예제 #1
0
    public static void OnRetireServer(string appName, string name, string uuid)
    {
        string realAppName = "";
        string realName    = "";

        //if there are any ACTIVE client singleton objects in use,
        //destroy them immediately.
        //destroy their texture and destroy the pointer to them, and remove them from the SyphonClients list.
        SyphonClientObject result = Syphon.GetSyphonClient(uuid);

        if (result)
        {
            //because the Syphon callback may not have a valid appName and name key in the OnServerRetire Syphon callback,
            //we need to ensure we get the extract those cached names from the uuid/instance.
            realAppName = result.BoundAppName;
            realName    = result.BoundName;

            DestroyClient(result);
        }

//		//now remove the server name
//		//if it doesn't contain the appName key, you shouldn't have to do anything.
        if (Syphon.Servers.ContainsKey(realAppName))
        {
            if (realName == "")
            {
                //if the name is UNNAMED_STRING and it contains the unnamed string, remove the server from the list.
                if (Syphon.Servers[realAppName].ContainsKey(Syphon.UNNAMED_STRING))
                {
                    Syphon.Servers[realAppName].Remove(Syphon.UNNAMED_STRING);

                    //if there are no more objects in the dictionary list for that app, remove the associated appName entry
                    if (Syphon.Servers[realAppName].Count == 0)
                    {
                        Syphon.Servers.Remove(realAppName);
                    }
                }
            }
            //if the name is valid and the server's app dictionary contains the name string, remove the server from the list.
            else if (Syphon.Servers[realAppName].ContainsKey(realName))
            {
                Syphon.Servers[realAppName].Remove(realName);

                //if there are no more entries in the dictionary list for that app, remove the associated appName entry
                if (Syphon.Servers[realAppName].Count == 0)
                {
                    Syphon.Servers.Remove(realAppName);
                }
            }

            //TODO: remove this.
            Instance.UpdateServerNames();
        }

        if (RetireServer != null)
        {
            RetireServer(realAppName, realName);
        }
    }
예제 #2
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;
            }
        }
    }
예제 #3
0
 void Start()
 {
     clientObject = Syphon.GetSyphonClient(clientAppName, clientName);
     //if the client object exists,
     if (clientObject != null)
     {
         //if the texture has been initialized, apply its texture to something.
         ApplyTexture();
     }
 }