Exemplo n.º 1
0
    public override void Visit(EditorControl c)
    {
        currCtrl = c as ColorCtrl;
        if (currCtrl == null)
        {
            return;
        }


        EditorGUI.BeginDisabledGroup(!currCtrl.Enable);

        EditorGUILayout.BeginHorizontal();
        GUILayout.Label(currCtrl.Caption, new GUILayoutOption[] { GUILayout.MaxWidth(100f) });
        Color newColor = EditorGUILayout.ColorField(
            currCtrl.currColor,
            new GUILayoutOption[] {
            GUILayout.MaxWidth(c.Size.width),
            GUILayout.MaxHeight(c.Size.height)
        });

        if (!newColor.Equals(currCtrl.currColor))
        {
            currCtrl.currColor = newColor;
            currCtrl.CurrValue = newColor;
            currCtrl.frameTriggerInfo.isValueChanged = true;
        }
        EditorGUILayout.EndHorizontal();

        EditorGUI.EndDisabledGroup();

        c.UpdateLastRect();

        CheckInputEvent(c);
    }
Exemplo n.º 2
0
    // Initialization code
    private void init()
    {
        // Initialize (seen in comments window)
        // print ("UDP Object init()");

        // Create remote endpoint (to Matlab)
        // remoteEndPoint = new IPEndPoint (IPAddress.Parse (IP), portRemote);

        // Create local client
        client = new UdpClient(portLocal);

        GameObject gameControllerObject = GameObject.FindGameObjectWithTag("GameController");

        if (gameControllerObject != null)
        {
            colorCtrl = gameControllerObject.GetComponent <ColorCtrl>();
        }
        if (colorCtrl == null)
        {
            Debug.Log("Cannot find 'ColorCtrl' script");
        }
        //  //IPEndPoint object will allow us to read datagrams sent from any source.
        //  IPEndPoint RemoteIpEndPoint = new IPEndPoint(IPAddress.Any, 0);

        // local endpoint define (where messages are received)
        // Create a new thread for reception of incoming messages
        receiveThread = new Thread(
            new ThreadStart(ReceiveData));
        receiveThread.IsBackground = true;
        receiveThread.Start();
        print("UDP is listening");
    }
Exemplo n.º 3
0
    void Start()
    {
        listener = new TcpListener(55001);
        listener.Start();
        print("is listening");
        GameObject gameControllerObject = GameObject.FindGameObjectWithTag("GameController");

        if (gameControllerObject != null)
        {
            colorCtrl = gameControllerObject.GetComponent <ColorCtrl>();
        }
        if (colorCtrl == null)
        {
            Debug.Log("Cannot find 'ColorCtrl' script");
        }
    }