Ejemplo n.º 1
0
        private void start2(EventX e)
        {
            string upkEditorWorkspace = EditorConfigUtils.GetProjectResource("upk/");

            if (Directory.Exists(upkEditorWorkspace) == false)
            {
                EditorUtility.DisplayDialog("error", "path not found:" + upkEditorWorkspace, "ok");
                return;
            }
            string selectedPath = EditorUtility.OpenFolderPanel("选择upk文件夹", upkEditorWorkspace, "");

            if (string.IsNullOrEmpty(selectedPath))
            {
                return;
            }

            DirectoryInfo directoryInfo = new DirectoryInfo(selectedPath);

            DirectoryInfo[] list = directoryInfo.GetDirectories();

            foreach (DirectoryInfo info in list)
            {
                doSingle(info.FullName, false);
            }

            AssetDatabase.Refresh();
        }
Ejemplo n.º 2
0
        protected void reload(EventX e)
        {
            skillProjectDirectory = EditorConfigUtils.GetProjectResource("All/skill/");
            string editorPrefabPath = "Assets/Prefabs";

            modelWindow.init(editorPrefabPath, "avatar");
            effectWindow.init(editorPrefabPath, "effect");
            soundWindow.init(editorPrefabPath, "sound");
        }
Ejemplo n.º 3
0
        private void start(EventX e)
        {
            string upkEditorWorkspace = EditorConfigUtils.GetProjectResource("upk/");

            if (Directory.Exists(upkEditorWorkspace) == false)
            {
                EditorUtility.DisplayDialog("error", "path not found:" + upkEditorWorkspace, "ok");
                return;
            }
            string selectedPath = EditorUtility.OpenFolderPanel("选择upk文件夹", upkEditorWorkspace, "");

            if (string.IsNullOrEmpty(selectedPath))
            {
                return;
            }
            doSingle(selectedPath);
        }
Ejemplo n.º 4
0
        private void drawExportUI()
        {
            using (new EditorGUILayout.HorizontalScope())
            {
                if (GUILayout.Button("导入"))
                {
                    string sceneName     = EditorSceneManager.GetActiveScene().name;
                    string mapPathPrefix = EditorConfigUtils.GetProjectResource("All/map/" + sceneName + "/");
                    FileHelper.AutoCreateDirectory(mapPathPrefix);

                    string path = EditorUtility.OpenFilePanel("选择文件", mapPathPrefix, "json");
                    if (string.IsNullOrEmpty(path) == false)
                    {
                        string json = FileHelper.GetUTF8Text(path);
                        JsonUtility.FromJsonOverwrite(json, mTarget);
                        mTarget.fileName = Path.GetFileNameWithoutExtension(path);
                    }
                }
                if (GUILayout.Button("导出"))
                {
                    string sceneName     = EditorSceneManager.GetActiveScene().name;
                    string mapPathPrefix = EditorConfigUtils.GetProjectResource("All/map/" + sceneName + "/");
                    FileHelper.AutoCreateDirectory(mapPathPrefix);

                    string fileName = mTarget.fileName;
                    if (string.IsNullOrEmpty(fileName))
                    {
                        fileName = "default";
                    }

                    string path = EditorUtility.SaveFilePanel("选择文件", mapPathPrefix, fileName, "json");
                    if (string.IsNullOrEmpty(path) == false)
                    {
                        mTarget.fileName = Path.GetFileNameWithoutExtension(path);
                        string json = JsonUtility.ToJson(mTarget, false);
                        FileHelper.SaveUTF8(json, path);
                    }
                }
            }
        }
Ejemplo n.º 5
0
        public override void OnGUI(Rect position, SerializedProperty property, GUIContent label)
        {
            float w = position.width;

            position.width = w - 50;
            EditorGUI.PropertyField(position, property);

            position.x    += position.width;
            position.width = 50;
            if (GUI.Button(position, "select", EditorStyles.miniButton))
            {
                PathSelecterAttribute selecterAttribute = attribute as PathSelecterAttribute;
                string extention = selecterAttribute.extention;
                string value     = property.stringValue;

                string path = "";
                switch (selecterAttribute.type)
                {
                case PathSelecterType.SKILL:
                    path = EditorConfigUtils.GetProjectResource("All/skill/");
                    break;

                case PathSelecterType.STOTY:
                    path = EditorConfigUtils.GetProjectResource("All/story/");
                    break;

                case PathSelecterType.SKILL_STOTY:

                    path = EditorConfigUtils.GetProjectResource("All/");
                    if (string.IsNullOrEmpty(value) == false)
                    {
                        path = EditorConfigUtils.GetProjectResource("All/story/") + value + "." + extention;
                        if (File.Exists(path) == false)
                        {
                            path = EditorConfigUtils.GetProjectResource("All/skill/") + value + "." + extention;
                        }
                        path = FileHelper.GetFullPathParent(path);
                    }
                    break;

                default:
                    path = EditorConfigUtils.ProjectResource;
                    break;
                }

                string fullPath = EditorUtility.OpenFilePanel("选取文件", path, extention);
                if (string.IsNullOrEmpty(fullPath) == false)
                {
                    string[] list = fullPath.As3Split("All/skill/");
                    if (list.Length < 2)
                    {
                        list = fullPath.As3Split("All/story/");
                    }

                    if (list.Length > 1)
                    {
                        fullPath = list[1];
                    }

                    list = fullPath.As3Split(".");
                    if (list.Length > 0)
                    {
                        fullPath = list[0];
                    }

                    property.stringValue = fullPath;
                }
            }
        }