コード例 #1
0
        private void DrawSourcePathElement(Rect rect, int index, bool isActive, bool isFocused)
        {
            rect.width -= EditorConstants.FolderPathPickerHeight * 2;
            rect.height = EditorConstants.FolderPathPickerHeight;
            var sourcePathRect = new Rect(rect);

            var sourcePathProperty =
                serializedObject.FindProperty(SourcePathsPropertyName).GetArrayElementAtIndex(index);

            EditorGUI.PropertyField(
                sourcePathRect,
                sourcePathProperty,
                new GUIContent(string.Format(EditorConstants.SourcePathElementLabelFormat, index)));

            var filePickerRect = new Rect
            {
                position = new Vector2(
                    sourcePathRect.width + EditorConstants.FolderPathPickerBuffer,
                    sourcePathRect.position.y),
                width  = EditorConstants.FolderPathPickerHeight,
                height = EditorConstants.FolderPathPickerHeight,
            };

            var folderPickerRect = new Rect
            {
                position = new Vector2(
                    sourcePathRect.width + EditorConstants.FolderPathPickerHeight + EditorConstants.FolderPathPickerBuffer,
                    sourcePathRect.position.y),
                width  = EditorConstants.FolderPathPickerHeight,
                height = EditorConstants.FolderPathPickerHeight,
            };

            GUILayoutTools.DrawFilePicker(
                filePickerRect,
                sourcePathProperty,
                EditorConstants.SelectSourcePathFilePickerTitle);

            GUILayoutTools.DrawFolderPicker(
                folderPickerRect,
                sourcePathProperty,
                EditorConstants.SelectSourcePathPickerFolderTitle);
        }
コード例 #2
0
        private void DrawPathElement(string propertyName, Rect rect, int index, bool isActive, bool isFocused)
        {
            rect.width -= EditorConstants.FOLDER_PATH_PICKER_HEIGHT * 2;
            rect.height = EditorConstants.FOLDER_PATH_PICKER_HEIGHT;
            var sourcePathRect = new Rect(rect);

            var sourcePathProperty =
                serializedObject.FindProperty(propertyName).GetArrayElementAtIndex(index);

            EditorGUI.PropertyField(
                sourcePathRect,
                sourcePathProperty,
                new GUIContent(string.Format(EditorConstants.SOURCE_PATH_ELEMENT_LABEL_FORMAT, index)));

            var filePickerRect = new Rect {
                position = new Vector2(
                    sourcePathRect.width + EditorConstants.FOLDER_PATH_PICKER_BUFFER,
                    sourcePathRect.position.y),
                width  = EditorConstants.FOLDER_PATH_PICKER_HEIGHT,
                height = EditorConstants.FOLDER_PATH_PICKER_HEIGHT,
            };

            var folderPickerRect = new Rect {
                position = new Vector2(
                    sourcePathRect.width + EditorConstants.FOLDER_PATH_PICKER_HEIGHT + EditorConstants.FOLDER_PATH_PICKER_BUFFER,
                    sourcePathRect.position.y),
                width  = EditorConstants.FOLDER_PATH_PICKER_HEIGHT,
                height = EditorConstants.FOLDER_PATH_PICKER_HEIGHT,
            };

            GUILayoutTools.DrawFilePicker(
                filePickerRect,
                sourcePathProperty,
                EditorConstants.SELECT_SOURCE_PATH_FILE_PICKER_TITLE);

            GUILayoutTools.DrawFolderPicker(
                folderPickerRect,
                sourcePathProperty,
                EditorConstants.SELECT_SOURCE_PATH_PICKER_FOLDER_TITLE);
        }