Beispiel #1
0
    private void DrawColors()
    {
        colorScroll = EditorGUILayout.BeginScrollView(colorScroll);
        foreach (var v in UssValues.values.Where(x => x.Value is UssColorValue))
        {
            if (string.IsNullOrEmpty(query) == false &&
                v.Key.Contains(query) == false)
            {
                continue;
            }

            var colorValue = (UssColorValue)v.Value;
            var str        = ColorUtility.ToHtmlStringRGBA(colorValue.value);

            EditorGUILayout.BeginHorizontal();
            EditorGUILayout.LabelField(v.Key, valueNameStyle);
            colorValue.value = EditorGUILayout.ColorField(colorValue.value);
            EditorGUILayout.EndHorizontal();
            EditorGUILayout.BeginHorizontal();
            if (GUILayout.Button("References"))
            {
                Selection.objects = UssStyleModifier.GetReferences(GameObject.Find("Canvas"), v.Key);
            }
            EditorGUILayout.SelectableLabel("#" + str);
            EditorGUILayout.EndHorizontal();

            queryResults++;
        }
        EditorGUILayout.EndScrollView();
    }
Beispiel #2
0
    private void DrawNumbers()
    {
        colorScroll = EditorGUILayout.BeginScrollView(colorScroll);
        foreach (var v in UssValues.values.Where(x => (x.Value is UssFloatValue || x.Value is UssIntValue)))
        {
            if (string.IsNullOrEmpty(query) == false &&
                v.Key.Contains(query) == false)
            {
                continue;
            }

            EditorGUILayout.BeginHorizontal();
            EditorGUILayout.LabelField(v.Key, valueNameStyle);
            if (v.Value is UssFloatValue)
            {
                var floatValue = (UssFloatValue)v.Value;
                floatValue.value = EditorGUILayout.FloatField(floatValue.value);
            }
            else
            {
                var intValue = (UssIntValue)v.Value;
                intValue.value = EditorGUILayout.IntField(intValue.value);
            }
            EditorGUILayout.EndHorizontal();
            EditorGUILayout.BeginHorizontal();
            if (GUILayout.Button("References"))
            {
                Selection.objects = UssStyleModifier.GetReferences(GameObject.Find("Canvas"), v.Key);
            }
            EditorGUILayout.EndHorizontal();

            queryResults++;
        }
        EditorGUILayout.EndScrollView();
    }