Пример #1
0
        /// <summary>
        /// 确保标准项目文件夹存在
        /// </summary>
        public static void EnsureProjectFiles()
        {
            BaseFileUtils.EnsureDirectory(BaseConstMgr.Path_Arts);

            BaseFileUtils.EnsureDirectory(BaseConstMgr.Path_Bundles);
            BaseFileUtils.EnsureDirectory(BaseConstMgr.Path_NoBundles);
            BaseFileUtils.EnsureDirectory(BaseConstMgr.Path_NoBundlesScene);
            //BaseFileUtils.EnsureDirectory(BaseConstansMgr.Path_TargetNativeDLC);

            BaseFileUtils.EnsureDirectory(BaseConstMgr.Path_Resources);
            //BaseFileUtils.EnsureDirectory(BaseConstansMgr.Path_ResourcesDLC);
            BaseFileUtils.EnsureDirectory(BaseConstMgr.Path_ResourcesConfig);
            BaseFileUtils.EnsureDirectory(BaseConstMgr.Path_ScriptTemplate);

            BaseFileUtils.EnsureDirectory(BaseConstMgr.Path_Funcs);
            BaseFileUtils.EnsureDirectory(Path.Combine(BaseConstMgr.Path_Funcs, "Editor"));
            BaseFileUtils.EnsureDirectory(Path.Combine(BaseConstMgr.Path_Funcs, "GlobalMgr"));
            BaseFileUtils.EnsureDirectory(Path.Combine(BaseConstMgr.Path_Funcs, "GlobalMono"));
            BaseFileUtils.EnsureDirectory(Path.Combine(BaseConstMgr.Path_Funcs, "TableDatas"));
            BaseFileUtils.EnsureDirectory(Path.Combine(BaseConstMgr.Path_Funcs, "UI"));
            BaseFileUtils.EnsureDirectory(Path.Combine(BaseConstMgr.Path_Funcs, "UnitMgr"));
            BaseFileUtils.EnsureDirectory(Path.Combine(BaseConstMgr.Path_Funcs, "UnitMono"));
            BaseFileUtils.EnsureDirectory(Path.Combine(BaseConstMgr.Path_Funcs, "Utils"));

            BaseFileUtils.EnsureDirectory(BaseConstMgr.Path_Tests);
            BaseFileUtils.EnsureDirectory(BaseConstMgr.Path_Gizmos);
            BaseFileUtils.EnsureDirectory(BaseConstMgr.Path_Editor);

            BaseFileUtils.EnsureDirectory(BaseConstMgr.Path_StreamingAssets);
            BaseFileUtils.EnsureDirectory(BaseConstMgr.Path_NativeDLC);

            Utile.XenoTemplateTool.RefreshTemplates(BaseConstMgr.Path_Editor, false);
        }
Пример #2
0
        public static void SaveJson(string path, object obj, bool prettyPrint = true)
        {
            string dir = Path.GetDirectoryName(path);

            BaseFileUtils.EnsureDirectory(dir);
            SaveFile(path, JsonUtility.ToJson(obj, prettyPrint));
        }
Пример #3
0
        void Present_ExpressSetup()
        {
            EditorGUILayout.BeginVertical(VerticalStyle);
            if (BuildLocalConfig.Ins.Fold_Present_ExpressSetup = EditorGUILayout.Foldout(BuildLocalConfig.Ins.Fold_Present_ExpressSetup, "平台", true))
            {
                string path         = BuildConfig.CurDistributionSetupPath;
                Rect   dragAreaRect = new Rect();
                //获得一个长300的框
                dragAreaRect = EditorGUILayout.GetControlRect(/*GUILayout.Width(600)*/ true, 18);
                //将上面的框作为文本输入框
                BuildConfig.CurDistributionSetupPath = EditorGUI.TextField(dragAreaRect, "路径", BuildConfig.CurDistributionSetupPath);

                //如果鼠标正在拖拽中或拖拽结束时,并且鼠标所在位置在文本输入框内
                if ((Event.current.type == EventType.DragUpdated ||
                     Event.current.type == EventType.DragExited) &&
                    dragAreaRect.Contains(Event.current.mousePosition))
                {
                    //改变鼠标的外表
                    DragAndDrop.visualMode = DragAndDropVisualMode.Generic;
                    if (DragAndDrop.paths != null && DragAndDrop.paths.Length > 0)
                    {
                        BuildConfig.CurDistributionSetupPath = DragAndDrop.paths[0];
                    }
                }
                EditorGUILayout.BeginHorizontal();
                if (GUILayout.Button("安装到本地"))
                {
                    if (BuildConfig.CurDistributionSetupPath != null)
                    {
                        BaseFileUtils.DeletePath(BuildConfig.CurDistributionSetupPath);
                        BaseFileUtils.EnsureDirectory(BuildConfig.CurDistributionSetupPath);
                        BaseFileUtils.CopyDir(BuildConfig.DirPath, BuildConfig.CurDistributionSetupPath);
                    }
                }
                if (GUILayout.Button("打开安装目录"))
                {
                    if (BuildConfig.CurDistributionSetupPath != null)
                    {
                        BaseFileUtils.OpenExplorer(BuildConfig.CurDistributionSetupPath);
                    }
                }
                EditorGUILayout.EndHorizontal();

                EditorGUILayout.BeginVertical();
                BuildConfig.Username = EditorGUILayout.TextField("用户名", BuildConfig.Username);
                BuildConfig.Password = EditorGUILayout.PasswordField("密码", BuildConfig.Password);

                EditorGUILayout.BeginHorizontal();
                if (GUILayout.Button("上传"))
                {
                    if (string.IsNullOrEmpty(BuildConfig.Username) || string.IsNullOrEmpty(BuildConfig.Password))
                    {
                        EditorUtility.DisplayDialog("错误", "请先输入用户名密码", "好的");
                    }
                    else
                    {
                        if (EditorUtility.DisplayDialog("重要操作", "确定要上传吗.", "上传", "取消"))
                        {
                            BuildConfig.GetBuildData(BuildConfig.Distribution).Upload();
                        }
                    }
                }

                EditorGUILayout.EndHorizontal();
                EditorGUILayout.EndVertical();
            }
            EditorGUILayout.EndVertical();
        }
Пример #4
0
 public void Init(string path)
 {
     BasePath = path;
     BaseFileUtils.EnsureDirectory(path);
 }