Exemple #1
0
        void OnGUI()
        {
            if (!initialized)
            {
                return;
            }

            var editorConfig      = ProjectFolders.Instance;
            var assetManageConfig = AssetManageConfig.Instance;

            var externalResourcesPath = editorConfig.ExternalResourcesPath;

            EditorGUILayout.Separator();

            var backgroundColor = new Color(0.3f, 0.3f, 0.5f);
            var labelColor      = new Color(0.8f, 0.8f, 0.8f, 0.8f);

            EditorLayoutTools.DrawLabelWithBackground("AssetInfoManifest", backgroundColor, labelColor);

            if (GUILayout.Button("Generate"))
            {
                // アセット情報ファイルを生成.
                AssetInfoManifestGenerator.Generate(externalResourcesPath, assetManageConfig);
            }

            GUILayout.Space(6f);

            EditorLayoutTools.DrawLabelWithBackground("ExternalResource", backgroundColor, labelColor);

            if (GUILayout.Button("Generate"))
            {
                if (ExternalResourceManager.BuildConfirm())
                {
                    var build = true;

                    #if ENABLE_CRIWARE_ADX || ENABLE_CRIWARE_SOFDEC
                    // CRIの最新アセットに更新.
                    CriAssetUpdater.Execute();
                    #endif

                    try
                    {
                        EditorApplication.LockReloadAssemblies();

                        // アセット情報ファイルを生成.
                        AssetInfoManifestGenerator.Generate(externalResourcesPath, assetManageConfig);

                        // 依存関係の検証.
                        var validate = AssetDependencies.Validate(externalResourcesPath);

                        if (!validate)
                        {
                            var messeage = "There is an incorrect reference.\nDo you want to cancel the build?";

                            if (!EditorUtility.DisplayDialog("InvalidDependant", messeage, "build", "cancel"))
                            {
                                build = false;

                                // ExternalResourceフォルダ以外の参照が含まれる場合は依存関係を表示.
                                InvalidDependantWindow.Open(externalResourcesPath);
                            }
                        }

                        // ビルド.
                        if (build)
                        {
                            ExternalResourceManager.Build(externalResourcesPath, assetManageConfig);
                        }
                    }
                    finally
                    {
                        EditorApplication.UnlockReloadAssemblies();
                    }
                }
            }

            EditorGUILayout.Separator();
        }
Exemple #2
0
        void OnGUI()
        {
            if (!initialized)
            {
                return;
            }

            EditorGUILayout.Separator();

            EditorLayoutTools.Title("AssetInfoManifest");

            GUILayout.Space(2f);

            if (GUILayout.Button("Generate"))
            {
                // アセット情報ファイルを生成.
                AssetInfoManifestGenerator.Generate();
            }

            GUILayout.Space(6f);

            EditorLayoutTools.Title("ExternalResource");

            GUILayout.Space(2f);

            if (GUILayout.Button("Generate"))
            {
                if (BuildManager.BuildConfirm())
                {
                    var build = true;

                    #if ENABLE_CRIWARE_ADX || ENABLE_CRIWARE_SOFDEC
                    // CRIの最新アセットに更新.
                    CriAssetUpdater.Execute();
                    #endif

                    try
                    {
                        EditorApplication.LockReloadAssemblies();

                        // アセット情報ファイルを生成.
                        var assetInfoManifest = AssetInfoManifestGenerator.Generate();

                        // 依存関係の検証.
                        var validate = BuildManager.AssetDependenciesValidate(assetInfoManifest);

                        if (!validate)
                        {
                            var message = "There is an incorrect reference.\nDo you want to cancel the build?";

                            if (!EditorUtility.DisplayDialog("Invalid Dependencies", message, "build", "cancel"))
                            {
                                build = false;

                                // ExternalResourceフォルダ以外の参照が含まれる場合は依存関係を表示.
                                InvalidDependantWindow.Open();
                            }
                        }

                        // ビルド.
                        if (build)
                        {
                            var exportPath = BuildManager.GetExportPath();

                            if (!string.IsNullOrEmpty(exportPath))
                            {
                                if (onBuildStart != null)
                                {
                                    onBuildStart.OnNext(Unit.Default);
                                }

                                BuildManager.Build(exportPath, assetInfoManifest)
                                .ToObservable()
                                .Subscribe()
                                .AddTo(Disposable);
                            }
                            else
                            {
                                Debug.LogError("The export path is not set.");

                                var config = ManageConfig.Instance;

                                if (config != null)
                                {
                                    Selection.activeObject = config;
                                }
                            }
                        }
                    }
                    finally
                    {
                        EditorApplication.UnlockReloadAssemblies();
                    }
                }
            }

            EditorGUILayout.Separator();
        }