// Start is called before the first frame update
 void Start()
 {
     osc.SetAddressHandler("/data", OnData);
     osc.SetAllMessageHandler(OnReceiveAnything);
     timer     = 0;
     messageno = 2;
 }
Exemple #2
0
    //Bloom bloomLayer = null; // Pour modifier les paramètres de post processing si besoin.

    void Start()
    {
        // Tout les messages partent dans la fonction allAdress. C'est elle qui fait le dispatch
        osc.SetAllMessageHandler(allAdress);

        // J'isole le message "/enable" qui est traité séparément dans une fonction enableObject.
        // Elle permet d'activer ou non des objets. Plus de détails directement dans la fonction...
        osc.SetAddressHandler("/enable", enableObject);
    }
Exemple #3
0
    // Use this for initialization
    void Start()
    {
        osc = GetComponent <OSC>();

        osc.SetAllMessageHandler(AllMessageHandler);

        ganData = new GANData();

        StartCoroutine("Ping");
        StartCoroutine("SendLoop");
    }
Exemple #4
0
    // Start is called before the first frame update
    void Start()
    {
        OSC osc = GetComponent <OSC>();

        osc.SetAllMessageHandler(OnOscMessage);
        foreach (EffectMapPair pair in effects)
        {
            effectMap[pair.addressBase] = pair.trigger;
        }
        //initialKillAll();
    }
    // Start is called before the first frame update
    void Start()
    {
        _openButton.onClick.AddListener(Open);
        _closeButton.onClick.AddListener(Close);
        _setDestIpButton.onClick.AddListener(SendSetDestIp);
        _setKvalButton.onClick.AddListener(SetKval);
        _getKvalButton.onClick.AddListener(GetKval);
        _setSpeedButton.onClick.AddListener(SetSpeedProfile);
        _getSpeedButton.onClick.AddListener(GetSpeedProfile);
        _runButton.onClick.AddListener(Run);
        _softHiZButton.onClick.AddListener(SoftHiZ);
        _goToButton.onClick.AddListener(GoTo);

        osc.SetAllMessageHandler(ReceiveOsc);
    }
Exemple #6
0
    //   public OnOSCReceivedFloat onOSCReceivedFloat;

    void Start()
    {
        if (osc == null)
        {
            osc = GameObject.Find("OSC").GetComponent <OSC>();
        }
        if (visualEffect == null)
        {
            visualEffect = GetComponent <VisualEffect>();
        }
        //osc.SetAddressHandler(oscAdress, OnReceive);
        osc.SetAllMessageHandler(OnReceiveAll);

        foreach (Converter converter in converters)
        {
            converter.setVisualEffect(visualEffect);
            osc.SetAddressHandler(prefix + converter.oscAdress, converter.OnReceive);
        }
    }
    /// <summary>
    /// Starts the dialog using OSC
    /// </summary>
    void DialogOSC()
    {
        Debug.Log("Starting dialog ... | local IP = " + localIP + " remote host = " + server_ip + " ipBroadcast = " + ipBroadcast);
        if (server_ip != null && !reConnect)
        {
            if (server_ip.Length > 0)
            {
                ipBroadcast = server_ip;                                // send directly to the host
            }
        }

        if (!reConnect)
        {
            oscHandshaker = gameObject.AddComponent <OSC>();
        }
        oscHandshaker.listenPort    = startup_port;
        oscHandshaker.broadcastPort = startup_port + 1;
        oscHandshaker.broadcastHost = ipBroadcast;
        oscHandshaker.setup(startup_port, ipBroadcast, startup_port + 1);               // Listen to the startup_port and send on this port + 1
        oscHandshaker.SetAllMessageHandler(OnReceive);                                  // receive messages OnReceive
    }
Exemple #8
0
 // Use this for initialization
 void Start()
 {
     oscReference.SetAllMessageHandler(OnReceive);
 }
Exemple #9
0
 void Start()
 {
     oscObject = GetComponent <OSC>();
     oscObject.SetAllMessageHandler(ProcessMessage);
 }
Exemple #10
0
    /// <summary>
    /// Initialization
    /// </summary>
    void Start()
    {
        typeComponent = objectComponent.GetType();
        oscAddress.Clear();                     // cleaning the address list
        OSC[] instancesOSC;
        instancesOSC = FindObjectsOfType(typeof(OSC)) as OSC[];
        GameObject oscGameobject;

        oscGameobject = this.gameObject;


        // Should remove this when _remoteString = true
        // the issue is probably in Start() _remotestring is false, thus, transfer this to update() with a trigger
        if (instancesOSC.Length > 0)
        {
            if (RCPortInPort != null)
            {
                foreach (OSC item in instancesOSC)
                {
                    if (item.getPortIN() == RCPortInPort.getPortIN())
                    {
                        oscGameobject = item.gameObject;
                    }
                }
                oscReference = oscGameobject.GetComponent <OSC> ();
                oscReference.SetAddressHandler(address, OnReceive);
                oscReference.SetAllMessageHandler(OnReceiveAll);
            }
        }
        else
        {
            if ((FindObjectsOfType(typeof(RemoteStrings)) as RemoteStrings[]).Length < 1)
            {
                Debug.Log("NO OSC or RemoteString!!! You have to drag a OSC behavior or RemoteString to initalize the plugin");
            }
        }

        // Initialize property object by defining a new one
        if (propertyObject == null)
        {
            Type typeComponent       = objectComponent.GetType();
            const BindingFlags flags = /*BindingFlags.NonPublic | */ BindingFlags.DeclaredOnly | BindingFlags.Public |
                                       BindingFlags.Instance | BindingFlags.Static;
            PropertyInfo[] properties = typeComponent.GetProperties(flags);
            if (properties.Length > _generalIndex)
            {
                propertyObject = properties [_generalIndex];
            }
        }

        // Initialize methods object by defining a new one
        if (methodObject == null)
        {
            Type typeComponent       = objectComponent.GetType();
            const BindingFlags flags = /*BindingFlags.NonPublic | */ BindingFlags.DeclaredOnly | BindingFlags.Public |
                                       BindingFlags.Instance | BindingFlags.Static;

            MethodInfo[] methods = typeComponent.GetMethods(flags);
            if (methods.Length > _generalIndex)
            {
                methodObject = methods [_generalIndex];
            }
        }
        requirements = new ObjectRequirements();

        // this is for blendshapes
        GameObject objectTemp = this.gameObject;

        meshTemp = objectTemp.GetComponent <SkinnedMeshRenderer> ();
        if (meshTemp != null)
        {
            Mesh mesh = GetComponent <SkinnedMeshRenderer> ().sharedMesh;
            if (_extra + 1 > mesh.blendShapeCount)
            {
                _extra = 0;                                                     // verify if we have enought blenshapes
            }
        }

        localType = getTypeArguments();
    }
Exemple #11
0
 void OnDisable()
 {
     osc.SetAllMessageHandler(null);
 }
Exemple #12
0
 void OnEnable()
 {
     osc = GetComponent <OSC>();
     osc.SetAllMessageHandler(OnOSCMessage);
     sequence = ScriptableObject.CreateInstance <Sequence>();
 }
 // Use this for initialization
 void Start()
 {
     oscReference.SetAllMessageHandler(OnReceive);
     //oscReference.SetAddressHandler("/ch1n62", OnReceive);
 }
Exemple #14
0
    // Use this for initialization
    void Start()
    {
        osc = GetComponent <OSC>();
        osc.SetAllMessageHandler(OnOSCMessage);
        string allScript = GetScriptItems();

        string[]   lines         = allScript.Split('\n');
        ScriptItem curItem       = null;
        AreaChange newAreaChange = null;

        foreach (string lineRaw in lines)
        {
            string line = lineRaw.Trim();
            if (line.StartsWith("AREA:"))
            {
                DisplayArea newArea = new DisplayArea();
                string []   values  = line.Substring(5).Split(',');
                for (int c = 0; c < values.Length; c++)
                {
                    switch (c)
                    {
                    case 0:
                        newArea.name = values[c];
                        break;

                    case 1:
                        newArea.fontName = values[c];
                        break;

                    case 2:
                        int.TryParse(values[c], out newArea.fontSize);
                        break;

                    case 3:
                        int.TryParse(values[c], out newArea.r);
                        break;

                    case 4:
                        int.TryParse(values[c], out newArea.g);
                        break;

                    case 5:
                        int.TryParse(values[c], out newArea.b);
                        break;

                    case 6:
                        float.TryParse(values[c], out newArea.x0);
                        break;

                    case 7:
                        float.TryParse(values[c], out newArea.y0);
                        break;

                    case 8:
                        float.TryParse(values[c], out newArea.x1);
                        break;

                    case 9:
                        float.TryParse(values[c], out newArea.y1);
                        break;
                    }
                }


                GameObject imgChild = new GameObject("img " + newArea.name);
                imgChild.transform.SetParent(canvas.transform, false);
                RawImage      image = imgChild.AddComponent <RawImage>();
                RectTransform tf2   = imgChild.GetComponent <RectTransform>();
                tf2.anchorMin         = new Vector2(newArea.x0, newArea.y0);
                tf2.anchorMax         = new Vector2(newArea.x1, newArea.y1);
                tf2.offsetMin         = new Vector2(0, 0);
                tf2.offsetMax         = new Vector2(0, 0);
                newArea.image         = image;
                newArea.image.enabled = false;


                RenderTexture vidTex = new RenderTexture(1024, 1024, 0);
                vidTex.Create();

                GameObject vidChild = new GameObject("vid " + newArea.name);
                vidChild.transform.SetParent(canvas.transform, false);

                RawImage vImage = vidChild.AddComponent <RawImage>();
                vImage.texture = vidTex;
                RectTransform tf3 = vidChild.GetComponent <RectTransform>();
                tf3.anchorMin = new Vector2(newArea.x0, newArea.y0);
                tf3.anchorMax = new Vector2(newArea.x1, newArea.y1);
                tf3.offsetMin = new Vector2(0, 0);
                tf3.offsetMax = new Vector2(0, 0);

                VideoPlayer vidPlayer = vidChild.AddComponent <VideoPlayer>();
                vidPlayer.renderMode    = VideoRenderMode.RenderTexture;
                vidPlayer.targetTexture = vidTex;
                newArea.video           = vidPlayer;
                newArea.vidTex          = vidTex;
                newArea.videoImage      = vImage;



                GameObject textChild = new GameObject("txt " + newArea.name);
                textChild.transform.SetParent(canvas.transform, false);
                Text txt = textChild.AddComponent <Text>();
                txt.text      = "";
                txt.color     = new Color(((float)newArea.r) / 255.0f, ((float)newArea.g) / 255.0f, ((float)newArea.b) / 255.0f);
                txt.alignment = TextAnchor.MiddleLeft;
                txt.font      = Font.CreateDynamicFontFromOSFont(newArea.fontName, 36);
                txt.fontSize  = newArea.fontSize;

                RectTransform tf = textChild.GetComponent <RectTransform>();
                tf.anchorMin = new Vector2(newArea.x0, newArea.y0);
                tf.anchorMax = new Vector2(newArea.x1, newArea.y1);
                tf.offsetMin = new Vector2(0, 0);
                tf.offsetMax = new Vector2(0, 0);

                newArea.text = txt;

                areas.Add(newArea);
            }
            else
            {
                print(line);
                bool firstLine = (line.Length > 0 && line[0] == '#');
                if (firstLine)
                {
//                    print(line);
                    if (newAreaChange != null)
                    {
                        newAreaChange.text = newAreaChange.text.Trim();
                        curItem.changes.Add(newAreaChange);
                    }
                    newAreaChange = new AreaChange();
                    string [] cueData = line.Substring(1).Split(',');
                    if (cueData.Length > 1)
                    {
                        newAreaChange.displayArea = cueData[1];
                    }
                    curItem = null;
                    for (int c = 0; c < items.Count; c++)
                    {
                        if (items[c].cueID == cueData[0])
                        {
                            curItem = items[c];
                            break;
                        }
                    }
                    if (curItem == null)
                    {
                        curItem       = new ScriptItem();
                        curItem.cueID = cueData[0];
                        items.Add(curItem);
                        print(items.Count + "!");
                    }
                }
                else
                {
                    if (newAreaChange != null)
                    {
                        if (line.StartsWith("[") && line.IndexOf("]") > 0)
                        {
                            newAreaChange.image = LoadScriptImage(line.Substring(1, line.IndexOf("]") - 1));
                        }
                        else if (line.StartsWith("{") && line.IndexOf("}") > 0)
                        {
                            newAreaChange.movieName = LoadScriptVideo(line.Substring(1, line.IndexOf("}") - 1));
                        }
                        else
                        {
                            newAreaChange.text += line + "\n";
                        }
                    }
                }
            }
        }
        if (newAreaChange != null)
        {
            newAreaChange.text = newAreaChange.text.Trim();
            curItem.changes.Add(newAreaChange);
        }
    }
Exemple #15
0
 // Use this for initialization
 void Start()
 {
     oscRef.SetAllMessageHandler(OSCToTextDisplay);
 }