Exemplo n.º 1
0
        private static bool GenerateModeHashFiles(string rootPath)
        {
            var resDir = Path.Combine(rootPath, "blockres");

            if (!Directory.Exists(resDir))
            {
                EditorUtility.DisplayDialog("create model res config", "please build asset bundle first", "");
                return(false);
            }

            var configPath = GetPrimitiveAbInfoConfig(rootPath);
            var refPath    = Path.Combine(Environment.CurrentDirectory, rootPath) + "/";

            ResPublisher.GenerateResConfig(new[] { resDir }, configPath, refPath, null, "");
            return(true);
        }
Exemplo n.º 2
0
        private void OnGUI()
        {
            GUILayout.Space(10);
            if (GUILayout.Button("同步数据"))
            {
                SyncDataFromServer();
            }
            GUILayout.Space(10);
            GUILayout.BeginHorizontal();
            GUILayout.TextField(configFilePath);


            if (GUILayout.Button("选择搭建文件"))
            {
                configFilePath = EditorUtility.OpenFilePanelWithFilters("选择搭建文件", "", new string[] { "", "txt" });
            }

            GUILayout.EndHorizontal();
            GUILayout.Space(10);
            if (GUILayout.Button("生成"))
            {
                if (!string.IsNullOrEmpty(configFilePath))
                {
                    CopyBuildingFiles2FtpRes(new[] { configFilePath });

                    ResPublisher.CreateBuildingThumbConfigs(new[] { configFilePath });
                    ModelPublisher.CreateCustomConfig(new[] { configFilePath });
                    EditorUtility.DisplayDialog("生成资源文件", "资源文件生成完成", "确定");
                }
            }
            GUILayout.Space(20);
            if (GUILayout.Button("上传"))
            {
                UploadFile(Path.GetFileNameWithoutExtension(configFilePath));
            }

            GUILayout.Space(20);

            isShowAdvance = GUILayout.Toggle(isShowAdvance, "高级");

            if (!isShowAdvance)
            {
                return;
            }

            GUILayout.Space(20);
            if (GUILayout.Button("选择目录"))
            {
                var folder = EditorUtility.OpenFolderPanel("选择搭建文件目录", "", "");

                if (!string.IsNullOrEmpty(folder))
                {
                    string[] files = Directory.GetFiles(folder).Where(s => s.EndsWith("txt")).ToArray();

                    CopyBuildingFiles2FtpRes(files);
                    ResPublisher.CreateBuildingThumbConfigs(files);
                    ModelPublisher.CreateCustomConfig(files);
                    EditorUtility.DisplayDialog("生成资源文件", "资源文件生成完成", "确定");
                }
            }
        }