Exemplo n.º 1
0
        public override void OnGUI(Rect position, SerializedProperty property, GUIContent label)
        {
            position.height = singleLine;
            if (string.IsNullOrEmpty(label.text))
            {
                property.Next(true);
                EditorDrawersUtilities.DrawPropertyWidthIndexed(position, new GUIContent("X"), property, 4, 0, false, false);
                property.Next(true);
                EditorDrawersUtilities.DrawPropertyWidthIndexed(position, new GUIContent("Y"), property, 4, 1, false, false);
                property.Next(true);
                EditorDrawersUtilities.DrawPropertyWidthIndexed(position, new GUIContent("Z"), property, 4, 2, false, false);
                property.Next(true);
                EditorDrawersUtilities.DrawPropertyWidthIndexed(position, new GUIContent("W"), property, 4, 3, false, false);
            }
            else
            {
                EditorGUI.LabelField(position, label);

                property.Next(true);
                EditorDrawersUtilities.DrawPropertyWidthIndexed(position, new GUIContent("X"), property, 5, 1, false, false);
                property.Next(true);
                EditorDrawersUtilities.DrawPropertyWidthIndexed(position, new GUIContent("Y"), property, 5, 2, false, false);
                property.Next(true);
                EditorDrawersUtilities.DrawPropertyWidthIndexed(position, new GUIContent("Z"), property, 5, 3, false, false);
                property.Next(true);
                EditorDrawersUtilities.DrawPropertyWidthIndexed(position, new GUIContent("W"), property, 5, 4, false, false);
            }
        }
Exemplo n.º 2
0
        public override void OnGUI(Rect position, SerializedProperty property, GUIContent label)
        {
            var pos = position;

            pos.height = singleLine;

            var posL = EditorDrawersUtilities.GetRectWidthIndexed(pos, 3, 0);
            var posR = EditorDrawersUtilities.GetRectWidthIndexed(pos, 3, 1, true);

            posR.y += singleLine;
            EditorGUI.LabelField(posL, label);
            EditorGUI.PropertyField(posR, property.FindPropertyRelative("Key"));
            ++EditorGUI.indentLevel;
            var key = property.GetTargetObjectOfProperty <AnimatorKey>();

            pos.y += singleLine;

            posL    = EditorDrawersUtilities.GetRectWidthIndexed(pos, 2, 0);
            posR    = EditorDrawersUtilities.GetRectWidthIndexed(pos, 2, 1);
            posR.y += singleLine;
            EditorGUI.PropertyField(posL, property.FindPropertyRelative("KeyType"));

            switch (key.KeyType)
            {
            case AnimatorKey.AnimType.Int:
                EditorGUI.PropertyField(posR, property.FindPropertyRelative("intData"));
                break;

            case AnimatorKey.AnimType.Float:
                EditorGUI.PropertyField(posR, property.FindPropertyRelative("floatData"));
                break;

            case AnimatorKey.AnimType.Bool:
                EditorGUI.PropertyField(posR, property.FindPropertyRelative("boolData"));
                break;

            case AnimatorKey.AnimType.Trigger:
                EditorGUI.PropertyField(posR, property.FindPropertyRelative("triggerData"));
                break;
            }
            --EditorGUI.indentLevel;
        }
Exemplo n.º 3
0
 public override void OnGUI(Rect position, SerializedProperty property, GUIContent label)
 {
     EditorDrawersUtilities.DrawPropertyWidthIndexed(position, label, property, GetAttribute.totalAmount, GetAttribute.index, GetAttribute.expandToWidth);
 }
Exemplo n.º 4
0
    public override void OnGUI(Rect position, SerializedProperty property, GUIContent label)
    {
        position.height = singleLine;
        EditorGUI.LabelField(position, label);
        position.y += singleLine;
        var pageProperty  = property.FindPropertyRelative(PAGE_NAME);
        var entryProperty = property.FindPropertyRelative(ENTRY_NAME);

        var pagePos  = EditorDrawersUtilities.GetRectWidthIndexed(position, 2, 0);
        var labelPos = EditorDrawersUtilities.GetRectWidthIndexed(position, 3, 1, true);

        position.y += singleLine + 2;
        var entryPos = EditorDrawersUtilities.GetRectWidthIndexed(position, 2, 1);

        var pageStr  = pageProperty.stringValue;
        var entryStr = entryProperty.stringValue;

        var pageIndex  = 0;
        var entryIndex = 0;

        var FoundPage = LocalizationEditor.ActiveLanguage.FindPage(pageStr);

        if (FoundPage != null)
        {
            pageIndex = LocalizationEditor.ActiveLanguage.Pages.IndexOf(FoundPage);
        }

        {
            var pos1 = EditorDrawersUtilities.GetRectWidthIndexed(pagePos, 4, 0);
            pagePos.y += singleLine + 2;
            var pos2 = EditorDrawersUtilities.GetRectWidthIndexed(pagePos, 3, 1, true);

            EditorGUI.LabelField(pos1, "Page: ");
            pageIndex = EditorGUI.Popup(pos2, pageIndex, LocalizationEditor.ActiveLanguage.Pages.Select(s => s.PageName).ToArray());
        }

        pageStr = LocalizationEditor.ActiveLanguage.Pages[pageIndex].PageName;
        if (FoundPage != null)
        {
            var list = LocalizationEditor.ActiveLanguage.Pages[pageIndex].Data.Keys.ToList();

            if (list.Count > 0)
            {
                if (list.Contains(entryStr))
                {
                    entryIndex = list.IndexOf(entryStr);
                }

                {
                    var pos1 = EditorDrawersUtilities.GetRectWidthIndexed(entryPos, 4, 0);
                    entryPos.y += singleLine + 2;
                    var pos2 = EditorDrawersUtilities.GetRectWidthIndexed(entryPos, 3, 1, true);

                    EditorGUI.LabelField(pos1, "Key: ");
                    entryIndex = EditorGUI.Popup(pos2, entryIndex, list.ToArray());
                }

                entryStr = list[entryIndex];
            }
            else
            {
                var pos1 = EditorDrawersUtilities.GetRectWidthIndexed(entryPos, 4, 0);
                entryPos.y += singleLine + 2;
                var pos2 = EditorDrawersUtilities.GetRectWidthIndexed(entryPos, 3, 1, true);

                EditorGUI.LabelField(pos1, "Key: ");
                entryStr = EditorGUI.TextField(pos2, entryStr);
            }
        }
        else
        {
            var pos1 = EditorDrawersUtilities.GetRectWidthIndexed(entryPos, 4, 0);
            entryPos.y += singleLine + 2;
            var pos2 = EditorDrawersUtilities.GetRectWidthIndexed(entryPos, 3, 1, true);

            EditorGUI.LabelField(pos1, "Key: ");
            entryStr = EditorGUI.TextField(pos2, entryStr);
        }
        if (!string.IsNullOrEmpty(entryStr))
        {
            var pos1 = EditorDrawersUtilities.GetRectWidthIndexed(labelPos, 3, 0);
            labelPos.y += singleLine + 2;
            var pos2 = EditorDrawersUtilities.GetRectWidthIndexed(labelPos, 4, 1, true);
            EditorGUI.LabelField(pos1, new GUIContent("       Key Data: "));
            EditorGUI.LabelField(pos2, new GUIContent(Localization.GetEntry(pageStr, entryStr)));
        }
        pageProperty.stringValue  = pageStr;
        entryProperty.stringValue = entryStr;
    }