Ejemplo n.º 1
0
        void DrawSortField(Rect position)
        {
            float fullWindowWidth = position.width + 30;
            Rect  newPosition     = position;

            newPosition.width = fullWindowWidth * 0.99f;
            LanguageSortType chosenSortType = (LanguageSortType)EditorGUI.EnumPopup(newPosition, "Sort by", sortType);

            if (chosenSortType != sortType)
            {
                sortType = chosenSortType;
                SortLanguageValues(sortType);
                GUIUtility.keyboardControl = 0;
            }
        }
Ejemplo n.º 2
0
        void SortLanguageValues(LanguageSortType sortType)
        {
#if UNITY_4_6 || UNITY_4_7 || UNITY_5_0 || UNITY_5_1 || UNITY_5_2 || UNITY_5_3
            if (EditorUserBuildSettings.activeBuildTarget != BuildTarget.WebPlayer &&
                EditorUserBuildSettings.activeBuildTarget != BuildTarget.WebPlayerStreamed)
#endif
            {
                loadedLanguageValues.Sort((a, b) =>
                {
                    switch (sortType)
                    {
                    case LanguageSortType.KEY:
                        return(a.keyValue.CompareTo(b.keyValue));

                    case LanguageSortType.VALUE:
                        return(a.changedValue.TextValue.CompareTo(b.changedValue.TextValue));

                    case LanguageSortType.TYPE:
                        return(a.changedValue.ObjectType.CompareTo(b.changedValue.ObjectType));
                    }
                    return(a.keyValue.CompareTo(b.keyValue));
                });
            }
        }