private void DrawActions(OSCBase osc, Color elementColor)
        {
            GUI.color   = Color.yellow;
            GUI.enabled = osc.IsAvaible;

            if (osc is OSCTransmitter)
            {
                DrawTransmitterActions((OSCTransmitter)osc);
            }
            else if (osc is OSCReceiver)
            {
                DrawReceiverActions((OSCReceiver)osc);
            }

            GUI.enabled = true;
            GUI.color   = Color.white;

            var selectButton = GUILayout.Button(_selectActionContent, GUILayout.MaxWidth(60));

            if (selectButton)
            {
                OSCEditorUtils.PingObject(osc);
            }

            GUI.color = elementColor;
        }
Exemplo n.º 2
0
        private void DrawActions(OSCBase osc)
        {
            GUI.color   = Color.yellow;
            GUI.enabled = osc.IsStarted;

            var transmitter = osc as OSCTransmitter;

            if (transmitter != null)
            {
                if (GUILayout.Button(_sendActionContent))
                {
                    var debugPacket = OSCWindowDebug.CurrentPacket;
                    if (debugPacket != null)
                    {
                        transmitter.Send(debugPacket.Copy());
                    }
                }
            }

            var receiver = osc as OSCReceiver;

            if (receiver != null)
            {
                if (GUILayout.Button(_receiveActionContent))
                {
                    var debugPacket = OSCWindowDebug.CurrentPacket;
                    if (debugPacket != null)
                    {
                        if (_receiveMethod == null)
                        {
                            _receiveMethod = typeof(OSCReceiver).GetMethod("PacketReceived", BindingFlags.Instance | BindingFlags.NonPublic);
                        }

                        _receiveMethod.Invoke(receiver, new object[] { debugPacket.Copy() });
                    }
                }
            }

            GUI.enabled = true;
            GUI.color   = _defaultColor;

            var selectButton = GUILayout.Button(_selectActionContent, GUILayout.MaxWidth(60));

            if (selectButton)
            {
                EditorGUIUtility.PingObject(osc);
                Selection.activeObject = osc;
            }
        }
Exemplo n.º 3
0
        private void DrawName(OSCBase osc)
        {
            var transmitter = osc as OSCTransmitter;

            if (transmitter != null)
            {
                GUILayout.Label(string.Format("Transmitter: {0}:{1}", transmitter.RemoteHost, transmitter.RemotePort));
            }

            var receiver = osc as OSCReceiver;

            if (receiver != null)
            {
                GUILayout.Label(string.Format("Receiver: {0}", receiver.LocalPort));
            }
        }
Exemplo n.º 4
0
        private void DrawName(OSCBase osc)
        {
            var transmitter = osc as OSCTransmitter;

            if (transmitter != null)
            {
                GUILayout.Label($"Transmitter: {transmitter.RemoteHost}:{transmitter.RemotePort}");
            }

            var receiver = osc as OSCReceiver;

            if (receiver != null)
            {
                GUILayout.Label($"Receiver: {receiver.LocalPort}");
            }
        }
Exemplo n.º 5
0
        private void DrawElement(OSCBase osc)
        {
            GUI.color = osc.IsStarted ? Color.green : Color.red;
            using (new GUILayout.VerticalScope(EditorStyles.helpBox))
            {
                DrawName(osc);
                using (new GUILayout.HorizontalScope(OSCEditorStyles.Box))
                {
                    GUILayout.Label("Active: " + osc.IsStarted);
                }

                GUILayout.Label(_actionsContent);
                using (new GUILayout.HorizontalScope(OSCEditorStyles.Box))
                {
                    DrawActions(osc);
                }
            }

            GUI.color = _defaultColor;
        }
Exemplo n.º 6
0
        private void DrawElement(string name, OSCBase osc)
        {
            var elementColor = osc.IsAvailable ? Color.green : Color.red;

            GUI.color = elementColor;

            GUILayout.BeginVertical(EditorStyles.helpBox);

            GUILayout.Label(name);

            GUILayout.BeginVertical("box");
            GUILayout.Label("Active: " + osc.IsAvailable);
            GUILayout.EndVertical();

            GUILayout.Label(_actionsContent);
            GUILayout.BeginHorizontal("box");
            DrawActions(osc, elementColor);
            GUILayout.EndHorizontal();

            GUILayout.EndVertical();

            GUI.color = Color.white;
        }