com.elestrago.unity.package-tools 2.0.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CAHNGELOG.md +130 -0
- package/CAHNGELOG.md.meta +7 -0
- package/Documentation~/Inspector.png +0 -0
- package/Documentation~/PackageManifestConfigIcon.png +0 -0
- package/Editor/CIUtils.cs +247 -0
- package/Editor/CIUtils.cs.meta +11 -0
- package/Editor/Drawers/AuthorPropertyDrawer.cs +82 -0
- package/Editor/Drawers/AuthorPropertyDrawer.cs.meta +11 -0
- package/Editor/Drawers/DependencyPropertyDrawer.cs +60 -0
- package/Editor/Drawers/DependencyPropertyDrawer.cs.meta +3 -0
- package/Editor/Drawers/SamplePropertyDrawer.cs +62 -0
- package/Editor/Drawers/SamplePropertyDrawer.cs.meta +3 -0
- package/Editor/Drawers.meta +3 -0
- package/Editor/EditorConstants.cs +110 -0
- package/Editor/EditorConstants.cs.meta +3 -0
- package/Editor/IconMap/PackageManifestConfigIcon.png +0 -0
- package/Editor/IconMap/PackageManifestConfigIcon.png.meta +127 -0
- package/Editor/IconMap.meta +8 -0
- package/Editor/Inspectors/PackageManifestConfigInspector.cs +404 -0
- package/Editor/Inspectors/PackageManifestConfigInspector.cs.meta +3 -0
- package/Editor/Inspectors.meta +3 -0
- package/Editor/MenuItems.cs +11 -0
- package/Editor/MenuItems.cs.meta +11 -0
- package/Editor/PackageManifestConfig.cs +194 -0
- package/Editor/PackageManifestConfig.cs.meta +11 -0
- package/Editor/Playdarium.PackageTool.Editor.asmdef +16 -0
- package/Editor/Playdarium.PackageTool.Editor.asmdef.meta +7 -0
- package/Editor/Tools/CodeGenTools.cs +145 -0
- package/Editor/Tools/CodeGenTools.cs.meta +11 -0
- package/Editor/Tools/CommandLineTools.cs +68 -0
- package/Editor/Tools/CommandLineTools.cs.meta +11 -0
- package/Editor/Tools/FileTools.cs +328 -0
- package/Editor/Tools/FileTools.cs.meta +3 -0
- package/Editor/Tools/GUILayoutTools.cs +177 -0
- package/Editor/Tools/GUILayoutTools.cs.meta +3 -0
- package/Editor/Tools/GitTools.cs +66 -0
- package/Editor/Tools/GitTools.cs.meta +11 -0
- package/Editor/Tools/PackageJsonModel.cs +149 -0
- package/Editor/Tools/PackageJsonModel.cs.meta +3 -0
- package/Editor/Tools/PackageManifestTools.cs +77 -0
- package/Editor/Tools/PackageManifestTools.cs.meta +3 -0
- package/Editor/Tools/UnityFileTools.cs +132 -0
- package/Editor/Tools/UnityFileTools.cs.meta +3 -0
- package/Editor/Tools.meta +3 -0
- package/Editor/Utils/PackageInitialize/PackageInitializeTemplates.cs +171 -0
- package/Editor/Utils/PackageInitialize/PackageInitializeTemplates.cs.meta +3 -0
- package/Editor/Utils/PackageInitialize/PackageInitializeUtil.cs +111 -0
- package/Editor/Utils/PackageInitialize/PackageInitializeUtil.cs.meta +3 -0
- package/Editor/Utils/PackageInitialize/PackageInitializeWindow.cs +92 -0
- package/Editor/Utils/PackageInitialize/PackageInitializeWindow.cs.meta +3 -0
- package/Editor/Utils/PackageInitialize.meta +3 -0
- package/Editor/Utils.meta +3 -0
- package/Editor.meta +3 -0
- package/LICENSE +21 -0
- package/LICENSE.meta +7 -0
- package/README.md +204 -0
- package/README.md.meta +7 -0
- package/package.json +41 -0
- package/package.json.meta +7 -0
|
@@ -0,0 +1,110 @@
|
|
|
1
|
+
/*
|
|
2
|
+
MIT License
|
|
3
|
+
|
|
4
|
+
Copyright (c) 2020 Jeff Campbell
|
|
5
|
+
|
|
6
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
7
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
8
|
+
in the Software without restriction, including without limitation the rights
|
|
9
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
10
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
11
|
+
furnished to do so, subject to the following conditions:
|
|
12
|
+
|
|
13
|
+
The above copyright notice and this permission notice shall be included in all
|
|
14
|
+
copies or substantial portions of the Software.
|
|
15
|
+
|
|
16
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
17
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
18
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
19
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
20
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
21
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
22
|
+
SOFTWARE.
|
|
23
|
+
*/
|
|
24
|
+
|
|
25
|
+
using UnityEngine;
|
|
26
|
+
|
|
27
|
+
namespace Playdarium.PackageTool
|
|
28
|
+
{
|
|
29
|
+
/// <summary>
|
|
30
|
+
/// Internal constants and readonly fields for package tools usage.
|
|
31
|
+
/// </summary>
|
|
32
|
+
internal static class EditorConstants
|
|
33
|
+
{
|
|
34
|
+
// Package Manifest
|
|
35
|
+
public const string DEFAULT_PACKAGE_VERSION = "1.0.0";
|
|
36
|
+
public const string DEFAULT_UNITY_VERSION = "2018.1";
|
|
37
|
+
|
|
38
|
+
// File
|
|
39
|
+
public const string PACKAGE_JSON_FILENAME = "package.json";
|
|
40
|
+
public const string WILDCARD_FILTER = "*";
|
|
41
|
+
public const string ASSET_EXTENSION = ".asset";
|
|
42
|
+
public const string META_FORMAT = "{0}.meta";
|
|
43
|
+
public const string GENERATED_FOLDER_NAME = "Generated";
|
|
44
|
+
public const string UNITY_PACKAGE_NAME_FORMAT = "{0}_v{1}.unityPackage";
|
|
45
|
+
public const char EMPTY_SPACE = ' ';
|
|
46
|
+
public const char UNDERSCORE = '_';
|
|
47
|
+
|
|
48
|
+
public static readonly string ProjectPath =
|
|
49
|
+
Application.dataPath.Remove(Application.dataPath.Length - 6, 6);
|
|
50
|
+
|
|
51
|
+
// Editor Styles
|
|
52
|
+
public const string GROUP_BOX = "GroupBox";
|
|
53
|
+
|
|
54
|
+
// Warnings
|
|
55
|
+
public const string GLOBAL_NAMESPACE_WARNING = "A blank namespace will result in the VersionConstants class " +
|
|
56
|
+
"being put into the global namespace.";
|
|
57
|
+
|
|
58
|
+
// Icons
|
|
59
|
+
public const string EDITOR_FOLDER_ICON = "Folder Icon";
|
|
60
|
+
public const string EDITOR_FILE_ICON = "TextAsset Icon";
|
|
61
|
+
|
|
62
|
+
// Inspector
|
|
63
|
+
public const string PACKAGE_JSON_HEADER = "Package Json";
|
|
64
|
+
public const string PACKAGE_CONTENT_HEADER = "Package Content and Export";
|
|
65
|
+
public const string PACKAGE_ACTIONS_HEADER = "Actions";
|
|
66
|
+
|
|
67
|
+
public const string SOURCE_PATHS_HEADER_LABEL = "Source Paths";
|
|
68
|
+
public const string SOURCE_PATH_ELEMENT_LABEL_FORMAT = "Path {0}:";
|
|
69
|
+
|
|
70
|
+
public const string IGNORE_PATHS_HEADER_LABEL = "Exclude Paths";
|
|
71
|
+
|
|
72
|
+
public const string KEYWORDS_HEADER_LABEL = "Keywords";
|
|
73
|
+
public const string KEYWORD_ELEMENT_LABEL_FORMAT = "Keyword {0}:";
|
|
74
|
+
|
|
75
|
+
public const string DEPENDENCY_HEADER_LABEL = "Dependencies";
|
|
76
|
+
public const string DEPENDENCY_ELEMENT_LABEL_FORMAT = "Dependency {0}:";
|
|
77
|
+
|
|
78
|
+
public const string GENERATE_VERSION_CONSTANTS_BUTTON_TEXT = "Generate VersionConstants.cs";
|
|
79
|
+
|
|
80
|
+
public const string GENERATE_VERSION_CONSTANTS_TOOLTIP =
|
|
81
|
+
"If an output path is specified, a [VersionConstants.cs] file " +
|
|
82
|
+
"will be created containing descriptive information about the " +
|
|
83
|
+
"package. This can be output to an Runtime or Editor folder.";
|
|
84
|
+
|
|
85
|
+
public const string UPDATE_PACKAGE_BUTTON_TEXT = "Export Package Source";
|
|
86
|
+
public const string EXPORT_LEGACY_PACKAGE_BUTTON_TEXT = "Export as Legacy Package";
|
|
87
|
+
|
|
88
|
+
public const string SELECT_SOURCE_PATH_FILE_PICKER_TITLE = "Select Source Asset Path";
|
|
89
|
+
public const string SELECT_SOURCE_PATH_PICKER_FOLDER_TITLE = "Select Source Folder Path";
|
|
90
|
+
public const string SELECT_PACKAGE_EXPORT_PATH_PICKER_TITLE = "Select Package Export Folder";
|
|
91
|
+
public const string SELECT_VERSION_CONSTANTS_PATH_PICKER_TITLE = "Select Version Constants Output Folder";
|
|
92
|
+
public const string SELECT_SAMPLES_PATH_FOLDER_TITLE = "Select Samples Folder Path";
|
|
93
|
+
public const string PROGRESS_BAR_TITLE = "Exporting Package Source";
|
|
94
|
+
public const string PROGRESS_BAR_TITLE_LEGACY = "Exporting Legacy Package";
|
|
95
|
+
public const string COMPILING_PROGRESS_MESSAGE = "Compiling legacy package contents...";
|
|
96
|
+
|
|
97
|
+
public const float FOLDER_PATH_PICKER_HEIGHT = 26f;
|
|
98
|
+
public const float FOLDER_PATH_PICKER_BUFFER = 36f;
|
|
99
|
+
|
|
100
|
+
// Logging
|
|
101
|
+
public const string PACKAGE_UPDATE_ERROR_FORMAT =
|
|
102
|
+
"[Package Tools] Failed to update package source for [{0}].";
|
|
103
|
+
|
|
104
|
+
public const string PACKAGE_UPDATE_SUCCESS_FORMAT =
|
|
105
|
+
"[Package Tools] Successfully updated package source for [{0}].";
|
|
106
|
+
|
|
107
|
+
public const string SAMPLES_HEADER_LABEL = "Samples";
|
|
108
|
+
public const string SAMPLES_ELEMENT_LABEL_FORMAT = "Sample {0}:";
|
|
109
|
+
}
|
|
110
|
+
}
|
|
Binary file
|
|
@@ -0,0 +1,127 @@
|
|
|
1
|
+
fileFormatVersion: 2
|
|
2
|
+
guid: aa27849da66efed40ac33d6d0da5f64f
|
|
3
|
+
TextureImporter:
|
|
4
|
+
internalIDToNameTable: []
|
|
5
|
+
externalObjects: {}
|
|
6
|
+
serializedVersion: 10
|
|
7
|
+
mipmaps:
|
|
8
|
+
mipMapMode: 0
|
|
9
|
+
enableMipMap: 0
|
|
10
|
+
sRGBTexture: 1
|
|
11
|
+
linearTexture: 0
|
|
12
|
+
fadeOut: 0
|
|
13
|
+
borderMipMap: 0
|
|
14
|
+
mipMapsPreserveCoverage: 0
|
|
15
|
+
alphaTestReferenceValue: 0.5
|
|
16
|
+
mipMapFadeDistanceStart: 1
|
|
17
|
+
mipMapFadeDistanceEnd: 3
|
|
18
|
+
bumpmap:
|
|
19
|
+
convertToNormalMap: 0
|
|
20
|
+
externalNormalMap: 0
|
|
21
|
+
heightScale: 0.25
|
|
22
|
+
normalMapFilter: 0
|
|
23
|
+
isReadable: 0
|
|
24
|
+
streamingMipmaps: 0
|
|
25
|
+
streamingMipmapsPriority: 0
|
|
26
|
+
grayScaleToAlpha: 0
|
|
27
|
+
generateCubemap: 6
|
|
28
|
+
cubemapConvolution: 0
|
|
29
|
+
seamlessCubemap: 0
|
|
30
|
+
textureFormat: 1
|
|
31
|
+
maxTextureSize: 2048
|
|
32
|
+
textureSettings:
|
|
33
|
+
serializedVersion: 2
|
|
34
|
+
filterMode: -1
|
|
35
|
+
aniso: -1
|
|
36
|
+
mipBias: -100
|
|
37
|
+
wrapU: 1
|
|
38
|
+
wrapV: 1
|
|
39
|
+
wrapW: -1
|
|
40
|
+
nPOTScale: 0
|
|
41
|
+
lightmap: 0
|
|
42
|
+
compressionQuality: 50
|
|
43
|
+
spriteMode: 1
|
|
44
|
+
spriteExtrude: 1
|
|
45
|
+
spriteMeshType: 1
|
|
46
|
+
alignment: 0
|
|
47
|
+
spritePivot: {x: 0.5, y: 0.5}
|
|
48
|
+
spritePixelsToUnits: 100
|
|
49
|
+
spriteBorder: {x: 0, y: 0, z: 0, w: 0}
|
|
50
|
+
spriteGenerateFallbackPhysicsShape: 1
|
|
51
|
+
alphaUsage: 1
|
|
52
|
+
alphaIsTransparency: 1
|
|
53
|
+
spriteTessellationDetail: -1
|
|
54
|
+
textureType: 8
|
|
55
|
+
textureShape: 1
|
|
56
|
+
singleChannelComponent: 0
|
|
57
|
+
maxTextureSizeSet: 0
|
|
58
|
+
compressionQualitySet: 0
|
|
59
|
+
textureFormatSet: 0
|
|
60
|
+
platformSettings:
|
|
61
|
+
- serializedVersion: 3
|
|
62
|
+
buildTarget: DefaultTexturePlatform
|
|
63
|
+
maxTextureSize: 2048
|
|
64
|
+
resizeAlgorithm: 0
|
|
65
|
+
textureFormat: -1
|
|
66
|
+
textureCompression: 1
|
|
67
|
+
compressionQuality: 50
|
|
68
|
+
crunchedCompression: 0
|
|
69
|
+
allowsAlphaSplitting: 0
|
|
70
|
+
overridden: 0
|
|
71
|
+
androidETC2FallbackOverride: 0
|
|
72
|
+
forceMaximumCompressionQuality_BC6H_BC7: 1
|
|
73
|
+
- serializedVersion: 3
|
|
74
|
+
buildTarget: Standalone
|
|
75
|
+
maxTextureSize: 2048
|
|
76
|
+
resizeAlgorithm: 0
|
|
77
|
+
textureFormat: -1
|
|
78
|
+
textureCompression: 1
|
|
79
|
+
compressionQuality: 50
|
|
80
|
+
crunchedCompression: 0
|
|
81
|
+
allowsAlphaSplitting: 0
|
|
82
|
+
overridden: 0
|
|
83
|
+
androidETC2FallbackOverride: 0
|
|
84
|
+
forceMaximumCompressionQuality_BC6H_BC7: 1
|
|
85
|
+
- serializedVersion: 3
|
|
86
|
+
buildTarget: iPhone
|
|
87
|
+
maxTextureSize: 2048
|
|
88
|
+
resizeAlgorithm: 0
|
|
89
|
+
textureFormat: -1
|
|
90
|
+
textureCompression: 1
|
|
91
|
+
compressionQuality: 50
|
|
92
|
+
crunchedCompression: 0
|
|
93
|
+
allowsAlphaSplitting: 0
|
|
94
|
+
overridden: 0
|
|
95
|
+
androidETC2FallbackOverride: 0
|
|
96
|
+
forceMaximumCompressionQuality_BC6H_BC7: 1
|
|
97
|
+
- serializedVersion: 3
|
|
98
|
+
buildTarget: Android
|
|
99
|
+
maxTextureSize: 2048
|
|
100
|
+
resizeAlgorithm: 0
|
|
101
|
+
textureFormat: -1
|
|
102
|
+
textureCompression: 1
|
|
103
|
+
compressionQuality: 50
|
|
104
|
+
crunchedCompression: 0
|
|
105
|
+
allowsAlphaSplitting: 0
|
|
106
|
+
overridden: 0
|
|
107
|
+
androidETC2FallbackOverride: 0
|
|
108
|
+
forceMaximumCompressionQuality_BC6H_BC7: 1
|
|
109
|
+
spriteSheet:
|
|
110
|
+
serializedVersion: 2
|
|
111
|
+
sprites: []
|
|
112
|
+
outline: []
|
|
113
|
+
physicsShape: []
|
|
114
|
+
bones: []
|
|
115
|
+
spriteID: 5e97eb03825dee720800000000000000
|
|
116
|
+
internalID: 0
|
|
117
|
+
vertices: []
|
|
118
|
+
indices:
|
|
119
|
+
edges: []
|
|
120
|
+
weights: []
|
|
121
|
+
secondaryTextures: []
|
|
122
|
+
spritePackingTag:
|
|
123
|
+
pSDRemoveMatte: 0
|
|
124
|
+
pSDShowRemoveMatteOption: 0
|
|
125
|
+
userData:
|
|
126
|
+
assetBundleName:
|
|
127
|
+
assetBundleVariant:
|
|
@@ -0,0 +1,404 @@
|
|
|
1
|
+
/*
|
|
2
|
+
MIT License
|
|
3
|
+
|
|
4
|
+
Copyright (c) 2020 Jeff Campbell
|
|
5
|
+
|
|
6
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
7
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
8
|
+
in the Software without restriction, including without limitation the rights
|
|
9
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
10
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
11
|
+
furnished to do so, subject to the following conditions:
|
|
12
|
+
|
|
13
|
+
The above copyright notice and this permission notice shall be included in all
|
|
14
|
+
copies or substantial portions of the Software.
|
|
15
|
+
|
|
16
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
17
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
18
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
19
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
20
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
21
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
22
|
+
SOFTWARE.
|
|
23
|
+
*/
|
|
24
|
+
|
|
25
|
+
using Playdarium.PackageTool.Tools;
|
|
26
|
+
using UnityEditor;
|
|
27
|
+
using UnityEditorInternal;
|
|
28
|
+
using UnityEngine;
|
|
29
|
+
|
|
30
|
+
namespace Playdarium.PackageTool.Inspectors
|
|
31
|
+
{
|
|
32
|
+
[CustomEditor(typeof(PackageManifestConfig))]
|
|
33
|
+
internal sealed class PackageManifestConfigInspector : UnityEditor.Editor
|
|
34
|
+
{
|
|
35
|
+
// private ReorderableList _sourcePathsReorderableList;
|
|
36
|
+
private ReorderableList _excludePathsReorderableList;
|
|
37
|
+
private ReorderableList _keywordReorderableList;
|
|
38
|
+
private ReorderableList _dependenciesReorderableList;
|
|
39
|
+
private ReorderableList _samplesReorderableList;
|
|
40
|
+
|
|
41
|
+
private const string SOURCE_PATH_PROPERTY_NAME = "sourcePath";
|
|
42
|
+
private const string DOCUMENTATION_PATH_PROPERTY_NAME = "documentationPath";
|
|
43
|
+
private const string README_PATH_PROPERTY_NAME = "readmePath";
|
|
44
|
+
private const string CHANGELOG_PATH_PROPERTY_NAME = "changelogPath";
|
|
45
|
+
private const string LICENSE_PATH_PROPERTY_NAME = "licensePath";
|
|
46
|
+
private const string EXCLUDE_PATHS_PROPERTY_NAME = "packageIgnorePaths";
|
|
47
|
+
private const string DESTINATION_PATH_PROPERTY_NAME = "packageDestinationPath";
|
|
48
|
+
private const string LEGACY_PACKAGE_PATH_PROPERTY_NAME = "legacyPackageDestinationPath";
|
|
49
|
+
private const string HOMEPAGE_NAME = "homepage";
|
|
50
|
+
private const string LICENSE_NAME = "license";
|
|
51
|
+
private const string NAME_PROPERTY_NAME = "packageName";
|
|
52
|
+
private const string DISPLAY_NAME_PROPERTY = "displayName";
|
|
53
|
+
private const string PACKAGE_VERSION_PROPERTY_NAME = "packageVersion";
|
|
54
|
+
private const string UNITY_VERSION_PROPERTY_NAME = "unityVersion";
|
|
55
|
+
private const string DESCRIPTION_PROPERTY_NAME = "description";
|
|
56
|
+
private const string CATEGORY_PROPERTY_NAME = "category";
|
|
57
|
+
private const string KEYWORDS_PROPERTY_NAME = "keywords";
|
|
58
|
+
private const string DEPENDENCIES_PROPERTY_NAME = "dependencies";
|
|
59
|
+
private const string AUTHOR_PROPERTY_NAME = "author";
|
|
60
|
+
private const string VERSION_CONSTANTS_PATH_PROPERTY_NAME = "versionConstantsPath";
|
|
61
|
+
private const string VERSION_CONSTANTS_NAMESPACE_PROPERTY_NAME = "versionConstantsNamespace";
|
|
62
|
+
private const string ID_PROPERTY_NAME = "_id";
|
|
63
|
+
private const string SAMPLES_PROPERTY_NAME = "samples";
|
|
64
|
+
|
|
65
|
+
private void OnEnable()
|
|
66
|
+
{
|
|
67
|
+
// _sourcePathsReorderableList = new ReorderableList(
|
|
68
|
+
// serializedObject,
|
|
69
|
+
// serializedObject.FindProperty(SOURCE_PATHS_PROPERTY_NAME))
|
|
70
|
+
// {
|
|
71
|
+
// drawHeaderCallback = DrawSourcePathHeader,
|
|
72
|
+
// drawElementCallback = DrawSourcePathElement,
|
|
73
|
+
// elementHeight = EditorConstants.FOLDER_PATH_PICKER_HEIGHT
|
|
74
|
+
// };
|
|
75
|
+
|
|
76
|
+
_excludePathsReorderableList = new ReorderableList(
|
|
77
|
+
serializedObject,
|
|
78
|
+
serializedObject.FindProperty(EXCLUDE_PATHS_PROPERTY_NAME))
|
|
79
|
+
{
|
|
80
|
+
drawHeaderCallback = DrawExcludePathHeader,
|
|
81
|
+
drawElementCallback = DrawExcludePathElement,
|
|
82
|
+
elementHeight = EditorConstants.FOLDER_PATH_PICKER_HEIGHT
|
|
83
|
+
};
|
|
84
|
+
|
|
85
|
+
_keywordReorderableList = new ReorderableList(
|
|
86
|
+
serializedObject,
|
|
87
|
+
serializedObject.FindProperty(KEYWORDS_PROPERTY_NAME))
|
|
88
|
+
{
|
|
89
|
+
drawHeaderCallback = DrawKeywordsHeader,
|
|
90
|
+
drawElementCallback = DrawKeywordElement
|
|
91
|
+
};
|
|
92
|
+
|
|
93
|
+
var dependencyProp = serializedObject.FindProperty(DEPENDENCIES_PROPERTY_NAME);
|
|
94
|
+
_dependenciesReorderableList = new ReorderableList(
|
|
95
|
+
serializedObject,
|
|
96
|
+
dependencyProp)
|
|
97
|
+
{
|
|
98
|
+
drawHeaderCallback = DrawDependencyHeader,
|
|
99
|
+
drawElementCallback = DrawDependencyElement,
|
|
100
|
+
elementHeight = EditorGUIUtility.singleLineHeight * 2f
|
|
101
|
+
};
|
|
102
|
+
|
|
103
|
+
var samplesProp = serializedObject.FindProperty(SAMPLES_PROPERTY_NAME);
|
|
104
|
+
_samplesReorderableList = new ReorderableList(
|
|
105
|
+
serializedObject,
|
|
106
|
+
samplesProp)
|
|
107
|
+
{
|
|
108
|
+
drawHeaderCallback = DrawSamplesHeader,
|
|
109
|
+
drawElementCallback = DrawSampleElement,
|
|
110
|
+
elementHeight = EditorGUIUtility.singleLineHeight * 5f
|
|
111
|
+
};
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
public override void OnInspectorGUI()
|
|
115
|
+
{
|
|
116
|
+
var config = (PackageManifestConfig)target;
|
|
117
|
+
|
|
118
|
+
using (var scope = new EditorGUI.ChangeCheckScope())
|
|
119
|
+
{
|
|
120
|
+
EditorGUILayout.LabelField(EditorConstants.PACKAGE_JSON_HEADER, EditorStyles.boldLabel);
|
|
121
|
+
using (new EditorGUI.DisabledScope(true))
|
|
122
|
+
{
|
|
123
|
+
EditorGUILayout.PropertyField(serializedObject.FindProperty(ID_PROPERTY_NAME));
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
EditorGUILayout.PropertyField(serializedObject.FindProperty(NAME_PROPERTY_NAME));
|
|
127
|
+
EditorGUILayout.PropertyField(serializedObject.FindProperty(DISPLAY_NAME_PROPERTY));
|
|
128
|
+
EditorGUILayout.PropertyField(serializedObject.FindProperty(PACKAGE_VERSION_PROPERTY_NAME));
|
|
129
|
+
EditorGUILayout.PropertyField(serializedObject.FindProperty(UNITY_VERSION_PROPERTY_NAME));
|
|
130
|
+
EditorGUILayout.PropertyField(serializedObject.FindProperty(DESCRIPTION_PROPERTY_NAME));
|
|
131
|
+
EditorGUILayout.PropertyField(serializedObject.FindProperty(CATEGORY_PROPERTY_NAME));
|
|
132
|
+
EditorGUILayout.PropertyField(serializedObject.FindProperty(AUTHOR_PROPERTY_NAME));
|
|
133
|
+
EditorGUILayout.PropertyField(serializedObject.FindProperty(HOMEPAGE_NAME));
|
|
134
|
+
EditorGUILayout.PropertyField(serializedObject.FindProperty(LICENSE_NAME));
|
|
135
|
+
|
|
136
|
+
_keywordReorderableList.DoLayoutList();
|
|
137
|
+
_dependenciesReorderableList.DoLayoutList();
|
|
138
|
+
_samplesReorderableList.DoLayoutList();
|
|
139
|
+
|
|
140
|
+
EditorGUILayout.Space();
|
|
141
|
+
EditorGUILayout.LabelField(EditorConstants.PACKAGE_CONTENT_HEADER, EditorStyles.boldLabel);
|
|
142
|
+
|
|
143
|
+
// Source Path
|
|
144
|
+
using (new EditorGUILayout.HorizontalScope())
|
|
145
|
+
{
|
|
146
|
+
var sourcePathProperty = serializedObject.FindProperty(SOURCE_PATH_PROPERTY_NAME);
|
|
147
|
+
EditorGUILayout.PropertyField(
|
|
148
|
+
sourcePathProperty,
|
|
149
|
+
GUILayout.Height(EditorConstants.FOLDER_PATH_PICKER_HEIGHT));
|
|
150
|
+
GUILayoutTools.DrawFolderPickerLayout(
|
|
151
|
+
sourcePathProperty,
|
|
152
|
+
EditorConstants.SELECT_PACKAGE_EXPORT_PATH_PICKER_TITLE);
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
// Documentation path
|
|
156
|
+
using (new EditorGUILayout.HorizontalScope())
|
|
157
|
+
{
|
|
158
|
+
var sourcePathProperty = serializedObject.FindProperty(DOCUMENTATION_PATH_PROPERTY_NAME);
|
|
159
|
+
EditorGUILayout.PropertyField(
|
|
160
|
+
sourcePathProperty,
|
|
161
|
+
GUILayout.Height(EditorConstants.FOLDER_PATH_PICKER_HEIGHT));
|
|
162
|
+
GUILayoutTools.DrawFolderPickerLayout(
|
|
163
|
+
sourcePathProperty,
|
|
164
|
+
EditorConstants.SELECT_PACKAGE_EXPORT_PATH_PICKER_TITLE);
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
// Readme Path
|
|
168
|
+
using (new EditorGUILayout.HorizontalScope())
|
|
169
|
+
{
|
|
170
|
+
var readmePathProperty = serializedObject.FindProperty(README_PATH_PROPERTY_NAME);
|
|
171
|
+
EditorGUILayout.PropertyField(
|
|
172
|
+
readmePathProperty,
|
|
173
|
+
GUILayout.Height(EditorConstants.FOLDER_PATH_PICKER_HEIGHT));
|
|
174
|
+
GUILayoutTools.DrawFilePickerLayout(
|
|
175
|
+
readmePathProperty,
|
|
176
|
+
EditorConstants.SELECT_PACKAGE_EXPORT_PATH_PICKER_TITLE);
|
|
177
|
+
}
|
|
178
|
+
|
|
179
|
+
// Changelog Path
|
|
180
|
+
using (new EditorGUILayout.HorizontalScope())
|
|
181
|
+
{
|
|
182
|
+
var changelogPathProperty = serializedObject.FindProperty(CHANGELOG_PATH_PROPERTY_NAME);
|
|
183
|
+
EditorGUILayout.PropertyField(
|
|
184
|
+
changelogPathProperty,
|
|
185
|
+
GUILayout.Height(EditorConstants.FOLDER_PATH_PICKER_HEIGHT));
|
|
186
|
+
GUILayoutTools.DrawFilePickerLayout(
|
|
187
|
+
changelogPathProperty,
|
|
188
|
+
EditorConstants.SELECT_PACKAGE_EXPORT_PATH_PICKER_TITLE);
|
|
189
|
+
}
|
|
190
|
+
|
|
191
|
+
// License Path
|
|
192
|
+
using (new EditorGUILayout.HorizontalScope())
|
|
193
|
+
{
|
|
194
|
+
var changelogPathProperty = serializedObject.FindProperty(LICENSE_PATH_PROPERTY_NAME);
|
|
195
|
+
EditorGUILayout.PropertyField(
|
|
196
|
+
changelogPathProperty,
|
|
197
|
+
GUILayout.Height(EditorConstants.FOLDER_PATH_PICKER_HEIGHT));
|
|
198
|
+
GUILayoutTools.DrawFilePickerLayout(
|
|
199
|
+
changelogPathProperty,
|
|
200
|
+
EditorConstants.SELECT_PACKAGE_EXPORT_PATH_PICKER_TITLE);
|
|
201
|
+
}
|
|
202
|
+
|
|
203
|
+
EditorGUILayout.Space();
|
|
204
|
+
// _sourcePathsReorderableList.DoLayoutList();
|
|
205
|
+
_excludePathsReorderableList.DoLayoutList();
|
|
206
|
+
|
|
207
|
+
// Package Source Export
|
|
208
|
+
using (new EditorGUILayout.HorizontalScope())
|
|
209
|
+
{
|
|
210
|
+
var destinationPathProperty = serializedObject.FindProperty(DESTINATION_PATH_PROPERTY_NAME);
|
|
211
|
+
EditorGUILayout.PropertyField(
|
|
212
|
+
destinationPathProperty,
|
|
213
|
+
GUILayout.Height(EditorConstants.FOLDER_PATH_PICKER_HEIGHT));
|
|
214
|
+
GUILayoutTools.DrawFolderPickerLayout(
|
|
215
|
+
destinationPathProperty,
|
|
216
|
+
EditorConstants.SELECT_PACKAGE_EXPORT_PATH_PICKER_TITLE);
|
|
217
|
+
}
|
|
218
|
+
|
|
219
|
+
// Legacy Package Export
|
|
220
|
+
using (new EditorGUILayout.HorizontalScope())
|
|
221
|
+
{
|
|
222
|
+
var legacyPackagePathProperty = serializedObject.FindProperty(LEGACY_PACKAGE_PATH_PROPERTY_NAME);
|
|
223
|
+
EditorGUILayout.PropertyField(
|
|
224
|
+
legacyPackagePathProperty,
|
|
225
|
+
GUILayout.Height(EditorConstants.FOLDER_PATH_PICKER_HEIGHT));
|
|
226
|
+
GUILayoutTools.DrawFolderPickerLayout(
|
|
227
|
+
legacyPackagePathProperty,
|
|
228
|
+
EditorConstants.SELECT_PACKAGE_EXPORT_PATH_PICKER_TITLE);
|
|
229
|
+
}
|
|
230
|
+
|
|
231
|
+
// Version Constants Export
|
|
232
|
+
using (new EditorGUILayout.VerticalScope(EditorConstants.GROUP_BOX))
|
|
233
|
+
{
|
|
234
|
+
// Namespace
|
|
235
|
+
var namespaceProperty = serializedObject.FindProperty(VERSION_CONSTANTS_NAMESPACE_PROPERTY_NAME);
|
|
236
|
+
EditorGUILayout.PropertyField(namespaceProperty);
|
|
237
|
+
if (string.IsNullOrEmpty(namespaceProperty.stringValue))
|
|
238
|
+
{
|
|
239
|
+
EditorGUILayout.HelpBox(EditorConstants.GLOBAL_NAMESPACE_WARNING, MessageType.Info);
|
|
240
|
+
}
|
|
241
|
+
|
|
242
|
+
// Output folder
|
|
243
|
+
using (new EditorGUILayout.HorizontalScope())
|
|
244
|
+
{
|
|
245
|
+
var versionConstantsPathProperty =
|
|
246
|
+
serializedObject.FindProperty(VERSION_CONSTANTS_PATH_PROPERTY_NAME);
|
|
247
|
+
EditorGUILayout.PropertyField(
|
|
248
|
+
versionConstantsPathProperty,
|
|
249
|
+
GUILayout.Height(EditorConstants.FOLDER_PATH_PICKER_HEIGHT));
|
|
250
|
+
GUILayoutTools.DrawFolderPickerLayout(
|
|
251
|
+
versionConstantsPathProperty,
|
|
252
|
+
EditorConstants.SELECT_VERSION_CONSTANTS_PATH_PICKER_TITLE);
|
|
253
|
+
}
|
|
254
|
+
}
|
|
255
|
+
|
|
256
|
+
if (scope.changed)
|
|
257
|
+
{
|
|
258
|
+
serializedObject.ApplyModifiedProperties();
|
|
259
|
+
}
|
|
260
|
+
}
|
|
261
|
+
|
|
262
|
+
EditorGUILayout.Space();
|
|
263
|
+
EditorGUILayout.LabelField(EditorConstants.PACKAGE_ACTIONS_HEADER, EditorStyles.boldLabel);
|
|
264
|
+
|
|
265
|
+
if (GUILayout.Button(new GUIContent(
|
|
266
|
+
EditorConstants.GENERATE_VERSION_CONSTANTS_BUTTON_TEXT,
|
|
267
|
+
EditorConstants.GENERATE_VERSION_CONSTANTS_TOOLTIP)))
|
|
268
|
+
{
|
|
269
|
+
CodeGenTools.GenerateVersionConstants(config);
|
|
270
|
+
}
|
|
271
|
+
|
|
272
|
+
if (GUILayout.Button(EditorConstants.UPDATE_PACKAGE_BUTTON_TEXT))
|
|
273
|
+
{
|
|
274
|
+
FileTools.CreateOrUpdatePackageSource(config);
|
|
275
|
+
}
|
|
276
|
+
|
|
277
|
+
if (GUILayout.Button(EditorConstants.EXPORT_LEGACY_PACKAGE_BUTTON_TEXT))
|
|
278
|
+
{
|
|
279
|
+
UnityFileTools.CompileLegacyPackage(config);
|
|
280
|
+
}
|
|
281
|
+
}
|
|
282
|
+
|
|
283
|
+
#region Source Paths ReorderableList
|
|
284
|
+
|
|
285
|
+
private void DrawSourcePathHeader(Rect rect)
|
|
286
|
+
{
|
|
287
|
+
EditorGUI.LabelField(rect, EditorConstants.SOURCE_PATHS_HEADER_LABEL, EditorStyles.boldLabel);
|
|
288
|
+
}
|
|
289
|
+
|
|
290
|
+
private void DrawSourcePathElement(Rect rect, int index, bool isActive, bool isFocused)
|
|
291
|
+
{
|
|
292
|
+
DrawPathElement(SOURCE_PATH_PROPERTY_NAME, rect, index, isActive, isFocused);
|
|
293
|
+
}
|
|
294
|
+
|
|
295
|
+
private void DrawExcludePathHeader(Rect rect)
|
|
296
|
+
{
|
|
297
|
+
EditorGUI.LabelField(rect, EditorConstants.IGNORE_PATHS_HEADER_LABEL, EditorStyles.boldLabel);
|
|
298
|
+
}
|
|
299
|
+
|
|
300
|
+
private void DrawExcludePathElement(Rect rect, int index, bool isActive, bool isFocused)
|
|
301
|
+
{
|
|
302
|
+
DrawPathElement(EXCLUDE_PATHS_PROPERTY_NAME, rect, index, isActive, isFocused);
|
|
303
|
+
}
|
|
304
|
+
|
|
305
|
+
private void DrawPathElement(string propertyName, Rect rect, int index, bool isActive, bool isFocused)
|
|
306
|
+
{
|
|
307
|
+
rect.width -= EditorConstants.FOLDER_PATH_PICKER_HEIGHT * 2;
|
|
308
|
+
rect.height = EditorConstants.FOLDER_PATH_PICKER_HEIGHT;
|
|
309
|
+
var sourcePathRect = new Rect(rect);
|
|
310
|
+
|
|
311
|
+
var sourcePathProperty =
|
|
312
|
+
serializedObject.FindProperty(propertyName).GetArrayElementAtIndex(index);
|
|
313
|
+
EditorGUI.PropertyField(
|
|
314
|
+
sourcePathRect,
|
|
315
|
+
sourcePathProperty,
|
|
316
|
+
new GUIContent(string.Format(EditorConstants.SOURCE_PATH_ELEMENT_LABEL_FORMAT, index)));
|
|
317
|
+
|
|
318
|
+
var filePickerRect = new Rect
|
|
319
|
+
{
|
|
320
|
+
position = new Vector2(
|
|
321
|
+
sourcePathRect.width + EditorConstants.FOLDER_PATH_PICKER_BUFFER,
|
|
322
|
+
sourcePathRect.position.y),
|
|
323
|
+
width = EditorConstants.FOLDER_PATH_PICKER_HEIGHT,
|
|
324
|
+
height = EditorConstants.FOLDER_PATH_PICKER_HEIGHT,
|
|
325
|
+
};
|
|
326
|
+
|
|
327
|
+
var folderPickerRect = new Rect
|
|
328
|
+
{
|
|
329
|
+
position = new Vector2(
|
|
330
|
+
sourcePathRect.width + EditorConstants.FOLDER_PATH_PICKER_HEIGHT +
|
|
331
|
+
EditorConstants.FOLDER_PATH_PICKER_BUFFER,
|
|
332
|
+
sourcePathRect.position.y),
|
|
333
|
+
width = EditorConstants.FOLDER_PATH_PICKER_HEIGHT,
|
|
334
|
+
height = EditorConstants.FOLDER_PATH_PICKER_HEIGHT,
|
|
335
|
+
};
|
|
336
|
+
|
|
337
|
+
GUILayoutTools.DrawFilePicker(
|
|
338
|
+
filePickerRect,
|
|
339
|
+
sourcePathProperty,
|
|
340
|
+
EditorConstants.SELECT_SOURCE_PATH_FILE_PICKER_TITLE);
|
|
341
|
+
|
|
342
|
+
GUILayoutTools.DrawFolderPicker(
|
|
343
|
+
folderPickerRect,
|
|
344
|
+
sourcePathProperty,
|
|
345
|
+
EditorConstants.SELECT_SOURCE_PATH_PICKER_FOLDER_TITLE);
|
|
346
|
+
}
|
|
347
|
+
|
|
348
|
+
#endregion
|
|
349
|
+
|
|
350
|
+
#region Keywords ReorderableList
|
|
351
|
+
|
|
352
|
+
private void DrawKeywordsHeader(Rect rect)
|
|
353
|
+
{
|
|
354
|
+
EditorGUI.LabelField(rect, EditorConstants.KEYWORDS_HEADER_LABEL, EditorStyles.boldLabel);
|
|
355
|
+
}
|
|
356
|
+
|
|
357
|
+
private void DrawKeywordElement(Rect rect, int index, bool isActive, bool isFocused)
|
|
358
|
+
{
|
|
359
|
+
EditorGUI.PropertyField(
|
|
360
|
+
rect,
|
|
361
|
+
serializedObject.FindProperty(KEYWORDS_PROPERTY_NAME).GetArrayElementAtIndex(index),
|
|
362
|
+
new GUIContent(string.Format(EditorConstants.KEYWORD_ELEMENT_LABEL_FORMAT, index)));
|
|
363
|
+
}
|
|
364
|
+
|
|
365
|
+
#endregion
|
|
366
|
+
|
|
367
|
+
#region Dependencies ReorderableList
|
|
368
|
+
|
|
369
|
+
private void DrawDependencyHeader(Rect rect)
|
|
370
|
+
{
|
|
371
|
+
EditorGUI.LabelField(rect, EditorConstants.DEPENDENCY_HEADER_LABEL, EditorStyles.boldLabel);
|
|
372
|
+
}
|
|
373
|
+
|
|
374
|
+
private void DrawDependencyElement(Rect rect, int index, bool isActive, bool isFocused)
|
|
375
|
+
{
|
|
376
|
+
// TODO This needs to be replaced or a custom drawer made
|
|
377
|
+
EditorGUI.PropertyField(
|
|
378
|
+
rect,
|
|
379
|
+
serializedObject.FindProperty(DEPENDENCIES_PROPERTY_NAME).GetArrayElementAtIndex(index),
|
|
380
|
+
new GUIContent(string.Format(EditorConstants.DEPENDENCY_ELEMENT_LABEL_FORMAT, index))
|
|
381
|
+
);
|
|
382
|
+
}
|
|
383
|
+
|
|
384
|
+
#endregion
|
|
385
|
+
|
|
386
|
+
#region Samples ReorderableList
|
|
387
|
+
|
|
388
|
+
private void DrawSamplesHeader(Rect rect)
|
|
389
|
+
{
|
|
390
|
+
EditorGUI.LabelField(rect, EditorConstants.SAMPLES_HEADER_LABEL, EditorStyles.boldLabel);
|
|
391
|
+
}
|
|
392
|
+
|
|
393
|
+
private void DrawSampleElement(Rect rect, int index, bool isActive, bool isFocused)
|
|
394
|
+
{
|
|
395
|
+
EditorGUI.PropertyField(
|
|
396
|
+
rect,
|
|
397
|
+
serializedObject.FindProperty(SAMPLES_PROPERTY_NAME).GetArrayElementAtIndex(index),
|
|
398
|
+
new GUIContent(string.Format(EditorConstants.SAMPLES_ELEMENT_LABEL_FORMAT, index))
|
|
399
|
+
);
|
|
400
|
+
}
|
|
401
|
+
|
|
402
|
+
#endregion
|
|
403
|
+
}
|
|
404
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
using Playdarium.PackageTool.Utils.PackageInitialize;
|
|
2
|
+
using UnityEditor;
|
|
3
|
+
|
|
4
|
+
namespace Playdarium.PackageTool
|
|
5
|
+
{
|
|
6
|
+
internal static class MenuItems
|
|
7
|
+
{
|
|
8
|
+
[MenuItem("Tools/PackageTools/Init Package")]
|
|
9
|
+
internal static void OpenAboutModalDialog() => PackageInitializeWindow.Open();
|
|
10
|
+
}
|
|
11
|
+
}
|