protected override void DoExport()
        {
            GameObject[] prefabRoots = Selection.gameObjects;

            Scene gameScene = SceneManager.GetActiveScene();

            if (!gameScene.isDirty || gameScene.isDirty && EditorUtility.DisplayDialog("提示", "检测到当前场景未保存,导出会自动进行保存场景,是否要继续导出", "导出", "暂不导出"))
            {
                EditorSceneManager.SaveScene(gameScene, gameScene.path);

                // foreach (GameObject prefabRoot in prefabRoots) {
                //     WXUtility.TraverseSceneTreeToSave(prefabRoot, gameScene);
                // }

                foreach (GameObject prefabRoot in prefabRoots)
                {
                    WXPrefab converter = new WXPrefab(
                        prefabRoot,
                        AssetDatabase.GetAssetPath(WXUtility.GetPrefabSource(prefabRoot))
                        );

                    PresetUtil.writeGroup(converter, this /*, (string)(configs.ContainsKey("exportPath") ? configs["exportPath"] : "")*/);
                }
            }
        }
        protected override void DoExport()
        {
            GameObject           activeGameObject = (GameObject)Selection.activeObject;
            WXAnimatorController converter        = new WXAnimatorController(activeGameObject.GetComponent <Animator>(), activeGameObject);

            PresetUtil.writeGroup(converter, this /*, (string)(configs.ContainsKey("exportPath") ? configs["exportPath"] : "")*/);
        }
        protected override void DoExport()
        {
            // GameObject prefabRoot = (GameObject) Selection.activeObject;

            GameObject[] prefabRoots = Selection.gameObjects;

            Scene gameScene = SceneManager.GetActiveScene();

            if (!gameScene.isDirty || gameScene.isDirty && EditorUtility.DisplayDialog("提示", "检测到当前场景未保存,导出会自动进行保存场景,是否要继续导出", "导出", "暂不导出"))
            {
                string path = gameScene.path;

                EditorSceneManager.SaveScene(gameScene, path);

                foreach (GameObject prefabRoot in prefabRoots)
                {
                    WXNGUITree converter = new WXNGUITree(
                        prefabRoot,
                        AssetDatabase.GetAssetPath(WXUtility.GetPrefabSource(prefabRoot)),
                        (this.exportConfigs as NGUIExportConfig).exportAsScene
                        );

                    PresetUtil.writeGroup(converter, this /*, (string)(configs.ContainsKey("exportPath") ? configs["exportPath"] : "")*/);
                }
            }
        }
        // 导出一个资源
        private void DequeueAndExport(int maxCount)
        {
            if (maxCount == 0)
            {
                return;
            }

            string guid      = exportQueue.Dequeue();
            string assetPath = AssetDatabase.GUIDToAssetPath(guid);

            EditorUtility.DisplayProgressBar(
                "资源导出",
                assetPath,
                (float)(maxCount - exportQueue.Count - 1) / maxCount
                );

            GameObject prefab = (GameObject)AssetDatabase.LoadAssetAtPath(
                assetPath,
                AssetDatabase.GetMainAssetTypeAtPath(assetPath)
                );

            // prefab
            // 忘了为什么要加这句判断了,资源管理器里的prefab理论上这里返回都是null
            if (WXUtility.GetPrefabSource(prefab))
            {
                DequeueAndExport(maxCount);
                return;
            }

            // 资源管理器里的prefab,GetPrefabSource是null,这里就要实例化之后再取。
            prefab = (GameObject)PrefabUtility.InstantiatePrefab(prefab);
            Selection.activeObject    = prefab;
            prefab.transform.position = Vector3.zero;
            prefab.SetActive(true);
            //RichText.StaticTextCreator[] staicTextCreators = prefabRoot.GetComponentsInChildren<RichText.StaticTextCreator>();
            //if (staicTextCreators != null && staicTextCreators.Length > 0)
            //{
            //    for (int k = 0; k < staicTextCreators.Length; k++)
            //    {
            //        RichText.StaticTextCreator stc = staicTextCreators[k];
            //        stc.ParseStaticText(true);
            //    }
            //}

            WXPrefab wxPrefab = new WXPrefab(prefab, assetPath);

            PresetUtil.writeGroup(wxPrefab, this /*, (string)(configs.ContainsKey("exportPath") ? configs["exportPath"] : "")*/);

            UnityEngine.Object.DestroyImmediate(prefab);


            if (exportQueue.Count == 0)
            {
                EditorUtility.ClearProgressBar();
            }
            else
            {
                DequeueAndExport(maxCount);
            }
        }
Exemplo n.º 5
0
        protected override void DoExport()
        {
            Scene      gameScene = SceneManager.GetActiveScene();
            string     path      = gameScene.path;
            WXUGUITree converter = new WXUGUITree(objectRoot, path, true, true);

            PresetUtil.writeGroup(converter, this);
        }
Exemplo n.º 6
0
        protected override void DoExport()
        {
            GameObject prefabRoot = (GameObject)Selection.activeObject;

            WXUGUITree converter = new WXUGUITree(
                prefabRoot,
                AssetDatabase.GetAssetPath(WXUtility.GetPrefabSource(prefabRoot)),
                (this.exportConfigs as UGUIExportConfig).exportAsScene
                );

            PresetUtil.writeGroup(converter, this /*, (string)(configs.ContainsKey("exportPath") ? configs["exportPath"] : "")*/);
        }
        protected override void DoExport()
        {
            GameObject prefabRoot = (GameObject)Selection.activeObject;

            Scene  gameScene = SceneManager.GetActiveScene();
            string path      = gameScene.path;

            EditorSceneManager.SaveScene(gameScene, path);

            WXNGUITree converter = new WXNGUITree(
                prefabRoot,
                AssetDatabase.GetAssetPath(WXUtility.GetPrefabSource(prefabRoot)),
                (this.exportConfigs as NGUIExportConfig).exportAsScene
                );

            PresetUtil.writeGroup(converter, this /*, (string)(configs.ContainsKey("exportPath") ? configs["exportPath"] : "")*/);
        }
Exemplo n.º 8
0
        protected override void DoExport()
        {
            Scene gameScene = SceneManager.GetActiveScene();

            GameObject[]      root     = gameScene.GetRootGameObjects();
            List <GameObject> rootList = new List <GameObject>();

            foreach (GameObject obj in root)
            {
                // obj.transform.SetParent(dummySceneRootGO.transform);
                rootList.Add(obj);
            }

            GameObject dummySceneRootGO = new GameObject("sceneDummyRoot");

            foreach (GameObject obj in rootList)
            {
                obj.transform.SetParent(dummySceneRootGO.transform);
            }
            EditorSceneManager.SaveScene(gameScene, gameScene.path);

            // WXUtility.TraverseSceneTreeToSave(dummySceneRootGO, gameScene);

            WXScene converter = new WXScene(gameScene, gameScene.path);

            PresetUtil.writeGroup(converter, this /*, (string)(configs.ContainsKey("exportPath") ? configs["exportPath"] : "")*/);

            List <Transform> transList = new List <Transform>();

            foreach (Transform child in dummySceneRootGO.transform)
            {
                transList.Add(child);
            }
            foreach (Transform child in transList)
            {
                child.SetParent(null);
            }
            UnityEngine.Object.DestroyImmediate(dummySceneRootGO);
            EditorSceneManager.SaveScene(gameScene, gameScene.path);
        }
        protected override void DoExport()
        {
            GameObject[] prefabRoots = Selection.gameObjects;

            Scene gameScene = SceneManager.GetActiveScene();

            EditorSceneManager.SaveScene(gameScene, gameScene.path);

            // foreach (GameObject prefabRoot in prefabRoots) {
            //     WXUtility.TraverseSceneTreeToSave(prefabRoot, gameScene);
            // }

            foreach (GameObject prefabRoot in prefabRoots)
            {
                WXPrefab converter = new WXPrefab(
                    prefabRoot,
                    AssetDatabase.GetAssetPath(WXUtility.GetPrefabSource(prefabRoot))
                    );

                PresetUtil.writeGroup(converter, this /*, (string)(configs.ContainsKey("exportPath") ? configs["exportPath"] : "")*/);
            }
        }