예제 #1
0
        private void DrawMapValue(OSCMapValue mapValue, bool expand)
        {
            var defaultColor = GUI.color;

            if (expand)
            {
                EditorGUILayout.BeginHorizontal();
            }
            else
            {
                EditorGUILayout.BeginHorizontal(OSCEditorStyles.Box);
            }

            using (new GUILayout.HorizontalScope(OSCEditorStyles.Box, GUILayout.Width(80)))
            {
                GUILayout.Label(mapValue.Type + ":");
            }

            if (mapValue.Type == OSCMapType.Float)
            {
                DrawMapValueFloat(mapValue, expand);
            }
            else if (mapValue.Type == OSCMapType.Int)
            {
                DrawMapValueInt(mapValue, expand);
            }
            else if (mapValue.Type == OSCMapType.FloatToBool)
            {
                DrawMapValueFloatToBool(mapValue, expand);
            }
            else if (mapValue.Type == OSCMapType.IntToBool)
            {
                DrawMapValueIntToBool(mapValue, expand);
            }
            else if (mapValue.Type == OSCMapType.BoolToFloat)
            {
                DrawMapValueBoolToFloat(mapValue, expand);
            }
            else if (mapValue.Type == OSCMapType.BoolToInt)
            {
                DrawMapValueBoolToInt(mapValue, expand);
            }

            using (new GUILayout.HorizontalScope(OSCEditorStyles.Box, GUILayout.Width(25)))
            {
                GUI.color = Color.red;
                if (GUILayout.Button("x", GUILayout.Height(EditorGUIUtility.singleLineHeight), GUILayout.Width(20)))
                {
                    _deleteValue = mapValue;
                }

                GUI.color = defaultColor;
            }

            EditorGUILayout.EndHorizontal();
        }
예제 #2
0
        private void DrawMapValue(OSCMapValue mapValue, bool expand)
        {
            if (expand)
            {
                EditorGUILayout.BeginHorizontal();
            }
            else
            {
                EditorGUILayout.BeginHorizontal("box");
            }

            EditorGUILayout.BeginHorizontal("box", GUILayout.Width(80));
            GUILayout.Label(mapValue.Type + ":");
            EditorGUILayout.EndHorizontal();

            if (mapValue.Type == OSCMapType.Float)
            {
                DrawMapValueFloat(mapValue, expand);
            }
            else if (mapValue.Type == OSCMapType.Int)
            {
                DrawMapValueInt(mapValue, expand);
            }
            else if (mapValue.Type == OSCMapType.FloatToBool)
            {
                DrawMapValueFloatToBool(mapValue, expand);
            }
            else if (mapValue.Type == OSCMapType.IntToBool)
            {
                DrawMapValueIntToBool(mapValue, expand);
            }
            else if (mapValue.Type == OSCMapType.BoolToFloat)
            {
                DrawMapValueBoolToFloat(mapValue, expand);
            }
            else if (mapValue.Type == OSCMapType.BoolToInt)
            {
                DrawMapValueBoolToInt(mapValue, expand);
            }

            EditorGUILayout.BeginHorizontal("box");
            GUI.color = Color.red;
            var deleteButton = GUILayout.Button("x", GUILayout.Height(EditorGUIUtility.singleLineHeight), GUILayout.Width(20));

            if (deleteButton)
            {
                _deleteValue = mapValue;
            }
            GUI.color = _defaultColor;
            EditorGUILayout.EndHorizontal();

            EditorGUILayout.EndHorizontal();
        }
예제 #3
0
        private void CreateMapValue(OSCMapMessage mapMessage, OSCMapType mapType)
        {
            var mapValue = new OSCMapValue();

            mapValue.Type = mapType;

            if (mapType == OSCMapType.FloatToBool)
            {
                mapValue.Value = 0.5f;
            }
            else if (mapType == OSCMapType.IntToBool)
            {
                mapValue.Value = 1;
            }

            mapMessage.Values.Add(mapValue);
        }
예제 #4
0
        private void DrawMapValueIntToBool(OSCMapValue mapValue, bool expand)
        {
            GUI.color = Color.yellow;
            EditorGUILayout.BeginHorizontal("box", GUILayout.Width(50));
            GUILayout.Label(_toBoolContent);
            EditorGUILayout.EndHorizontal();
            GUI.color = _defaultColor;

            EditorGUILayout.BeginHorizontal("box", GUILayout.Width(120));
            mapValue.Logic = (OSCMapLogic)EditorGUILayout.EnumPopup(mapValue.Logic);
            EditorGUILayout.EndHorizontal();

            EditorGUILayout.BeginHorizontal("box");
            GUILayout.Label(_valueContent);
            mapValue.Value = EditorGUILayout.IntField((int)mapValue.Value);
            EditorGUILayout.EndHorizontal();
        }
예제 #5
0
        private void DrawMapValueBoolToInt(OSCMapValue mapValue, bool expand)
        {
            var defaultColor = GUI.color;

            if (!expand)
            {
                EditorGUILayout.BeginVertical();
                EditorGUILayout.BeginHorizontal();
            }

            GUI.color = Color.yellow;
            EditorGUILayout.BeginHorizontal(OSCEditorStyles.Box, GUILayout.Width(50));
            GUILayout.Label(_trueContent);
            EditorGUILayout.EndHorizontal();
            GUI.color = defaultColor;

            EditorGUILayout.BeginHorizontal(OSCEditorStyles.Box);
            GUILayout.Label(_valueContent);
            mapValue.TrueValue = EditorGUILayout.IntField((int)mapValue.TrueValue);
            EditorGUILayout.EndHorizontal();

            if (!expand)
            {
                EditorGUILayout.EndHorizontal();
                EditorGUILayout.BeginHorizontal();
            }

            GUI.color = Color.yellow;
            EditorGUILayout.BeginHorizontal(OSCEditorStyles.Box, GUILayout.Width(50));
            GUILayout.Label(_falseContent);
            EditorGUILayout.EndHorizontal();
            GUI.color = defaultColor;

            EditorGUILayout.BeginHorizontal(OSCEditorStyles.Box);
            GUILayout.Label(_valueContent);
            mapValue.FalseValue = EditorGUILayout.IntField((int)mapValue.FalseValue);
            EditorGUILayout.EndHorizontal();

            if (!expand)
            {
                EditorGUILayout.EndHorizontal();
                EditorGUILayout.EndVertical();
            }
        }
예제 #6
0
        private void DrawMapValueFloatToBool(OSCMapValue mapValue, bool expand)
        {
            var defaultColor = GUI.color;

            GUI.color = Color.yellow;
            EditorGUILayout.BeginHorizontal(OSCEditorStyles.Box, GUILayout.Width(50));
            GUILayout.Label(_toBoolContent);
            EditorGUILayout.EndHorizontal();
            GUI.color = defaultColor;

            EditorGUILayout.BeginHorizontal(OSCEditorStyles.Box, GUILayout.Width(120));
            mapValue.Logic = (OSCMapLogic)EditorGUILayout.EnumPopup(mapValue.Logic);
            EditorGUILayout.EndHorizontal();

            EditorGUILayout.BeginHorizontal(OSCEditorStyles.Box);
            GUILayout.Label(_valueContent);
            mapValue.Value = EditorGUILayout.FloatField(mapValue.Value);
            EditorGUILayout.EndHorizontal();
        }
예제 #7
0
        private void DrawMapValueBoolToFloat(OSCMapValue mapValue, bool expand)
        {
            if (!expand)
            {
                EditorGUILayout.BeginVertical();
                EditorGUILayout.BeginHorizontal();
            }

            GUI.color = Color.yellow;
            EditorGUILayout.BeginHorizontal("box", GUILayout.Width(50));
            GUILayout.Label(_trueContent);
            EditorGUILayout.EndHorizontal();
            GUI.color = _defaultColor;

            EditorGUILayout.BeginHorizontal("box");
            GUILayout.Label(_valueContent);
            mapValue.TrueValue = EditorGUILayout.FloatField(mapValue.TrueValue);
            EditorGUILayout.EndHorizontal();

            if (!expand)
            {
                EditorGUILayout.EndHorizontal();
                EditorGUILayout.BeginHorizontal();
            }

            GUI.color = Color.yellow;
            EditorGUILayout.BeginHorizontal("box", GUILayout.Width(50));
            GUILayout.Label(_falseContent);
            EditorGUILayout.EndHorizontal();
            GUI.color = _defaultColor;

            EditorGUILayout.BeginHorizontal("box");
            GUILayout.Label(_valueContent);
            mapValue.FalseValue = EditorGUILayout.FloatField(mapValue.FalseValue);
            EditorGUILayout.EndHorizontal();

            if (!expand)
            {
                EditorGUILayout.EndHorizontal();
                EditorGUILayout.EndVertical();
            }
        }
        private void DrawValue(OSCMapValue value)
        {
            GUILayout.BeginVertical();
            GUILayout.BeginVertical("box");

            EditorGUILayout.BeginHorizontal();

            GUI.color = Color.yellow;
            EditorGUILayout.BeginHorizontal("box");
            GUILayout.Label(_typeContents, GUILayout.Width(50));
            EditorGUILayout.EndHorizontal();
            GUI.color = _defaultColor;

            EditorGUILayout.BeginHorizontal("box");
            GUILayout.Label(value.Type.ToString());
            EditorGUILayout.EndHorizontal();

            EditorGUILayout.EndHorizontal();

            GUILayout.EndVertical();
            GUILayout.EndVertical();
        }
예제 #9
0
        private void DrawValue(OSCMapValue value)
        {
            GUILayout.BeginVertical();
            GUILayout.BeginVertical(OSCEditorStyles.Box);

            EditorGUILayout.BeginHorizontal();

            GUI.color = Color.yellow;
            EditorGUILayout.BeginHorizontal(OSCEditorStyles.Box);
            GUILayout.Label(_typeContents, GUILayout.Width(50));
            EditorGUILayout.EndHorizontal();
            GUI.color = Color.white;

            EditorGUILayout.BeginHorizontal(OSCEditorStyles.Box);
            GUILayout.Label(value.Type.ToString());
            EditorGUILayout.EndHorizontal();

            EditorGUILayout.EndHorizontal();

            GUILayout.EndVertical();
            GUILayout.EndVertical();
        }
예제 #10
0
        private void DrawMapValueInt(OSCMapValue mapValue, bool expand)
        {
            GUI.color = Color.yellow;
            EditorGUILayout.BeginHorizontal("box", GUILayout.Width(50));
            GUILayout.Label(_inputContent);
            EditorGUILayout.EndHorizontal();
            GUI.color = _defaultColor;

            if (!expand)
            {
                EditorGUILayout.BeginVertical();
            }

            EditorGUILayout.BeginHorizontal("box");
            GUILayout.Label(_minimumContent);
            mapValue.InputMin = EditorGUILayout.IntField((int)mapValue.InputMin);
            EditorGUILayout.EndHorizontal();

            EditorGUILayout.BeginHorizontal("box");
            GUILayout.Label(_maximusContent);
            mapValue.InputMax = EditorGUILayout.IntField((int)mapValue.InputMax);
            EditorGUILayout.EndHorizontal();

            if (!expand)
            {
                EditorGUILayout.EndVertical();
            }

            GUI.color = Color.yellow;
            EditorGUILayout.BeginHorizontal("box", GUILayout.Width(50));
            GUILayout.Label(_outputContent);
            EditorGUILayout.EndHorizontal();
            GUI.color = _defaultColor;

            if (!expand)
            {
                EditorGUILayout.BeginVertical();
            }

            EditorGUILayout.BeginHorizontal("box");
            GUILayout.Label(_minimumContent);
            mapValue.OutputMin = EditorGUILayout.IntField((int)mapValue.OutputMin);
            EditorGUILayout.EndHorizontal();

            EditorGUILayout.BeginHorizontal("box");
            GUILayout.Label(_maximusContent);
            mapValue.OutputMax = EditorGUILayout.IntField((int)mapValue.OutputMax);
            EditorGUILayout.EndHorizontal();

            if (!expand)
            {
                EditorGUILayout.EndVertical();
            }

            GUI.color = Color.yellow;
            EditorGUILayout.BeginHorizontal("box", GUILayout.Width(50));
            GUILayout.Label(_clampContent);
            EditorGUILayout.EndHorizontal();
            GUI.color = _defaultColor;

            EditorGUILayout.BeginHorizontal("box");
            mapValue.Clamp = EditorGUILayout.Toggle(mapValue.Clamp, GUILayout.Width(15));
            EditorGUILayout.EndHorizontal();
        }
예제 #11
0
        private void DrawMapMessage(OSCMapMessage mapMessage, bool expand)
        {
            EditorGUILayout.BeginVertical("box");

            EditorGUILayout.BeginHorizontal();
            GUILayout.Label(_addressContent);
            GUI.color = Color.red;
            var deleteButton = GUILayout.Button("x", GUILayout.Height(EditorGUIUtility.singleLineHeight), GUILayout.Width(20));

            if (deleteButton)
            {
                _deleteMessage = mapMessage;
            }
            GUI.color = _defaultColor;
            EditorGUILayout.EndHorizontal();

            EditorGUILayout.BeginHorizontal("box");
            mapMessage.Address = EditorGUILayout.TextField(mapMessage.Address);
            EditorGUILayout.EndHorizontal();

            if (mapMessage.Values.Count > 0)
            {
                GUILayout.Label(_valuesContent);

                _deleteValue = null;

                foreach (var mapValue in mapMessage.Values)
                {
                    DrawMapValue(mapValue, expand);
                }

                if (_deleteValue != null)
                {
                    mapMessage.Values.Remove(_deleteValue);
                }
            }
            else
            {
                GUILayout.Label(_valuesContent);
                EditorGUILayout.BeginVertical("box");
                EditorGUILayout.LabelField("- Empty -", OSCEditorStyles.CenterLabel);
                EditorGUILayout.EndVertical();
            }

            if (!_mapTypeTemp.ContainsKey(mapMessage))
            {
                _mapTypeTemp.Add(mapMessage, OSCMapType.Float);
            }

            EditorGUILayout.BeginHorizontal("box");

            _mapTypeTemp[mapMessage] = (OSCMapType)EditorGUILayout.EnumPopup(_mapTypeTemp[mapMessage]);

            GUI.color = Color.green;
            var addButton = GUILayout.Button(_addMapValueContent, GUILayout.Height(EditorGUIUtility.singleLineHeight));

            if (addButton)
            {
                CreateMapValue(mapMessage, _mapTypeTemp[mapMessage]);
            }
            GUI.color = _defaultColor;
            EditorGUILayout.EndHorizontal();

            EditorGUILayout.EndVertical();
        }
예제 #12
0
        private void DrawMapValueFloat(OSCMapValue mapValue, bool expand)
        {
            var defaultColor = GUI.color;

            GUI.color = Color.yellow;
            EditorGUILayout.BeginHorizontal(OSCEditorStyles.Box, GUILayout.Width(50));
            GUILayout.Label(_inputContent);
            EditorGUILayout.EndHorizontal();
            GUI.color = defaultColor;

            if (!expand)
            {
                EditorGUILayout.BeginVertical();
            }

            EditorGUILayout.BeginHorizontal(OSCEditorStyles.Box);
            GUILayout.Label(_minimumContent);
            mapValue.InputMin = EditorGUILayout.FloatField(mapValue.InputMin);
            EditorGUILayout.EndHorizontal();

            EditorGUILayout.BeginHorizontal(OSCEditorStyles.Box);
            GUILayout.Label(_maximusContent);
            mapValue.InputMax = EditorGUILayout.FloatField(mapValue.InputMax);
            EditorGUILayout.EndHorizontal();

            if (!expand)
            {
                EditorGUILayout.EndVertical();
            }

            GUI.color = Color.yellow;
            EditorGUILayout.BeginHorizontal(OSCEditorStyles.Box, GUILayout.Width(50));
            GUILayout.Label(_outputContent);
            EditorGUILayout.EndHorizontal();
            GUI.color = defaultColor;

            if (!expand)
            {
                EditorGUILayout.BeginVertical();
            }

            EditorGUILayout.BeginHorizontal(OSCEditorStyles.Box);
            GUILayout.Label(_minimumContent);
            mapValue.OutputMin = EditorGUILayout.FloatField(mapValue.OutputMin);
            EditorGUILayout.EndHorizontal();

            EditorGUILayout.BeginHorizontal(OSCEditorStyles.Box);
            GUILayout.Label(_maximusContent);
            mapValue.OutputMax = EditorGUILayout.FloatField(mapValue.OutputMax);
            EditorGUILayout.EndHorizontal();

            if (!expand)
            {
                EditorGUILayout.EndVertical();
            }

            GUI.color = Color.yellow;
            EditorGUILayout.BeginHorizontal(OSCEditorStyles.Box, GUILayout.Width(50));
            GUILayout.Label(_clampContent);
            EditorGUILayout.EndHorizontal();
            GUI.color = defaultColor;

            EditorGUILayout.BeginHorizontal(OSCEditorStyles.Box);
            mapValue.Clamp = EditorGUILayout.Toggle(mapValue.Clamp, GUILayout.Width(15));
            EditorGUILayout.EndHorizontal();
        }