Example #1
0
        VFSPatch_Edit_Window()
        {
            mEditPath         = edit_root_path;
            this.titleContent = new GUIContent("增量更新:" + Path.GetFileName(mEditPath));
            //读配置文件
            var confPath = Path.Combine(edit_root_path, "config.json");

            if (File.Exists(confPath))
            {
                var jsonStr = File.ReadAllText(confPath);
                JsonObj = JsonUtility.FromJson <VFSPatchConfigModel>(jsonStr);
            }
        }
Example #2
0
        public VFSPatchPackage SetBaseInfo(string _PatchDataRootFolder)
        {
            mPatchBaseRootPatch = _PatchDataRootFolder;
            var basePackInfoJsonPath = Path.Combine(mPatchBaseRootPatch, "config.json");

            if (File.Exists(basePackInfoJsonPath))
            {
                var jsonStr = File.ReadAllText(basePackInfoJsonPath);
                mPatchBaseInfo = JsonUtility.FromJson <VFSPatchConfigModel>(jsonStr);
            }
            else
            {
                Debug.LogWarning("打补丁失败,没找到母包配置JSON文件:" + basePackInfoJsonPath);
                return(this);
            }


            return(this);
        }
Example #3
0
        private void OnGUI()
        {
            GUILayout.Space(10);


            GUILayout.BeginHorizontal();
            GUILayout.Label("配置名:", GUILayout.MaxWidth(80));
            mName = GUILayout.TextField(mName);
            GUILayout.EndHorizontal();


            GUILayout.BeginHorizontal();
            GUILayout.Label("补丁类型:", GUILayout.MaxWidth(80));
            mPatchType = (VFSPatchConfigModel.EPatchType)EditorGUILayout.EnumPopup(mPatchType);
            GUILayout.EndHorizontal();
            if (mPatchType == VFSPatchConfigModel.EPatchType.Each)
            {
                GUILayout.Label("补丁类型:依次安装多个补丁");
            }
            else if (mPatchType == VFSPatchConfigModel.EPatchType.Newest)
            {
                GUILayout.Label("补丁类型:每次只安装单个基于母包最新的补丁");
            }


            GUILayout.Space(5);

            GUILayout.Label("基于平台:");
            //刷出平台列表
            var folder = Directory.GetDirectories(mVFS_Root_Path);

            if (folder.Length <= 0)
            {
                GUILayout.Label("没有找到已打包的资源\n先打包哦");
            }
            else
            {
                mScroll_Platform = EditorGUILayout.BeginScrollView(mScroll_Platform);
                foreach (var item in folder)
                {
                    var platform_name = Path.GetFileName(item);
                    GUILayout.BeginHorizontal();
                    GUILayout.Label("  - " + platform_name);
                    if (selectPlatform == platform_name)
                    {
                        GUILayout.Label("- [已选中]");
                    }
                    else
                    {
                        if (GUILayout.Button("选中", GUILayout.MaxWidth(45)))
                        {
                            selectPlatform = platform_name;
                        }
                    }

                    GUILayout.EndHorizontal();
                }

                EditorGUILayout.EndScrollView();
            }

            GUILayout.Space(15);
            if (mName.IsNullOrEmpty())
            {
                GUILayout.Label("请输入有效的配置名");
            }

            if (!mName.IsNullOrEmpty())
            {
                //名称是否重复
                if (Directory.Exists(Path.Combine(VFSPatchWindow.mVFSPatch_Path, mName)))
                {
                    GUILayout.Label("配置名已存在");
                }
                else
                {
                    if (selectPlatform.IsNullOrEmpty())
                    {
                        GUILayout.Label("请选择一个已打包的资源");
                    }
                    else
                    {
                        if (GUILayout.Button("创建"))
                        {
                            Directory.CreateDirectory(Path.Combine(VFSPatchWindow.mVFSPatch_Path, mName));
                            //写一个配置文件
                            var jsonObj = new VFSPatchConfigModel();
                            jsonObj.PlatformName = selectPlatform;
                            jsonObj.PatchType    = mPatchType;
                            var jsonStr = JsonUtility.ToJson(jsonObj);
                            File.WriteAllText(Path.Combine(VFSPatchWindow.mVFSPatch_Path, mName, "config.json"), jsonStr);
                            this.Close();
                        }
                    }
                }
            }

            GUILayout.Space(10);
        }