public static string MarkInFile(string dirPath) { if (string.IsNullOrEmpty(dirPath)) { return(""); } FileInfo fi = new FileInfo(dirPath); string path = dirPath.Substring(fi.DirectoryName.IndexOf("Assets", 0)); string markingName = fi.Name.Replace(fi.Extension, "");// string.Format(PARTS_MATERIALS_PREFIX, ); AssetImporter importer = AssetImporter.GetAtPath(path); if (importer) { importer.assetBundleName = markingName + "." + EditorABSetting.GetBundleExtenstion(); } else { Debug.Log("Reject -> " + path); } string msg = "Marking Complete File : " + fi.Name; return(msg); }
public void DrawBundleLocalFiles() { // 번들 리스트 채크. DirectoryInfo dir = new DirectoryInfo(EditorABSetting.GetBuildExportFullPath()); if (dir.Exists) { List <FileInfo> inFileList = new List <FileInfo>(dir.GetFiles("*.*", SearchOption.AllDirectories)); if (inFileList.Count > 0) { for (int i = 0; i < inFileList.Count; i++) { GUILayout.Space(-1f); int highlight = (i % 2);// (selected == j); GUI.backgroundColor = highlight == 1 ? Color.white : new Color(0.6f, 0.6f, 0.6f); GUILayout.BeginHorizontal("AS TextArea", GUILayout.MinHeight(20f)); GUI.backgroundColor = Color.white; GUILayout.Label(i.ToString(), GUILayout.Width(24f)); GUILayout.Label(inFileList[i].Name, GUILayout.Width(250f)); float size = inFileList[i].Length / 1000f; int fileSize = (size > 1f) ? (int)size : 1; GUILayout.Label(fileSize + " KB", GUILayout.Width(100f)); GUILayout.Label(inFileList[i].LastWriteTime.ToString(), GUILayout.Width(180f)); GUILayout.EndHorizontal(); } } } }
void OnEnable() { config.Add("test", "t1"); instance = this; mScroll = Vector2.zero; msg_log = string.Empty; sel_rename = string.Empty; EditorABSetting.LoadPrefs(); }
void InfoHeaderGUI() { EditorTools.DrawHeader("Info", true); EditorTools.BeginContents(false); GUI.contentColor = Color.white; GUILayout.Label("\u25BA Absolute Project Path > " + EditorABSetting.GetProjectPath()); GUILayout.Label("\u25BA Current Build Setting Platform > " + EditorUserBuildSettings.activeBuildTarget.ToString()); GUILayout.Label("\u25BA Selected Bundle Extenstion > " + EditorABSetting.GetBundleExtenstion()); GUILayout.Label("\u25BA BundleExport FullPath > " + EditorABSetting.GetBuildExportFullPath()); GUI.contentColor = Color.white; EditorTools.EndContents(); }
public static string MarkFolderInFiles(string dirPath) { if (string.IsNullOrEmpty(dirPath)) { return(""); } string msg = string.Empty; List <STAssetFiles> tableFiles = GetAssetDirInFiles(dirPath, SearchOption.AllDirectories); AssetImporter importer; string folder = string.Empty; int totalAmount = tableFiles.Count; if (totalAmount > 0) { folder = tableFiles[0].folder; IEnumerator progressShow = OnProgress(folder, tableFiles, 0, totalAmount - 1); for (int i = 0; i < totalAmount; i++) { importer = AssetImporter.GetAtPath(tableFiles[i].path + "/" + tableFiles[i].name); if (importer) { importer.assetBundleName = folder + "." + EditorABSetting.GetBundleExtenstion(); } else { Debug.Log("Reject -> " + tableFiles[i].path); } progressShow.MoveNext(); } msg = "Marking Complete Folder : " + folder; } return(msg); }
void OnDisable() { instance = null; EditorABSetting.SavePrefs(); }
void TabFTPGUI() { EditorTools.DrawHeader("Info", true); EditorTools.BeginContents(false); GUILayout.Label("< Local Target Directory > " + EditorABSetting.GetBuildExportFullPath()); GUILayout.Label("< FTP Target Directory > " + FTP.GetAddress() + EditorABSetting.strExportPath + "/" + EditorABSetting.emBuildTarget.ToString() + "/"); EditorTools.EndContents(); EditorTools.DrawHeader("FTP Login", true); string tempAddress = FTP.ftpAddress; DrawFTPLogin("FTP Address", ref FTP.ftpAddress); if (tempAddress != FTP.ftpAddress) { FTP.SaveLoinInfo(); } string tempID = FTP.Id; DrawFTPLogin("ID", ref FTP.Id); if (tempID != FTP.Id) { FTP.SaveLoinInfo(); } GUILayout.BeginHorizontal(); GUILayout.Label("PASSWORD", GUILayout.Width(80f)); GUILayout.Space(5f); string tempPwd = EditorGUILayout.PasswordField(FTP.Password); GUI.backgroundColor = Color.white; GUILayout.EndHorizontal(); if (tempPwd != FTP.Password) { FTP.Password = tempPwd; FTP.SaveLoinInfo(); } EditorTools.BeginContents(false); GUILayout.BeginHorizontal(); GUI.backgroundColor = Color.cyan; GUILayout.Space(20f); if (GUILayout.Button("AssetBundle Upload to FTP")) { if (FTP.ftpAddress.Length < 10) { msg_log = "FtpServer Name - A minimum of 20 characters or more !"; } else if (FTP.Id.Length < 2) { msg_log = "FtpId Name - A minimum of 2 characters or more !"; } else if (FTP.Password.Length < 2) { msg_log = "FtpPassworkd Name - A minimum of 2 characters or more !"; } else { if (!FTP.FindFileFormFTPDirectory(EditorABSetting.strExportPath)) { FTP.MakeDirectoryFromFTP(EditorABSetting.strExportPath); } if (!FTP.FindFileFormFTPDirectory(EditorABSetting.emBuildTarget.ToString(), EditorABSetting.strExportPath + "/")) { FTP.MakeDirectoryFromFTP(EditorABSetting.strExportPath + "/" + EditorABSetting.emBuildTarget.ToString()); } FTP.UploadtoLocalDirectory(EditorABSetting.GetBuildExportFullPath(), EditorABSetting.strExportPath + "/" + EditorABSetting.emBuildTarget.ToString() + "/"); } } if (GUILayout.Button("Directory FTP")) { if (!FTP.FindFileFormFTPDirectory(EditorABSetting.strExportPath)) { FTP.MakeDirectoryFromFTP(EditorABSetting.strExportPath); } if (!FTP.FindFileFormFTPDirectory(EditorABSetting.emBuildTarget.ToString(), EditorABSetting.strExportPath + "/")) { FTP.MakeDirectoryFromFTP(EditorABSetting.strExportPath + "/" + EditorABSetting.emBuildTarget.ToString()); } ftp_filelist = FTP.FileListFormFTPDirectoryDetails2(EditorABSetting.GetBuildPipelineOutPath()); if (ftp_filelist != null) { ftpFiles = true; } else { ftpFiles = false; } } GUILayout.Space(20f); GUI.backgroundColor = Color.white; GUILayout.EndHorizontal(); EditorTools.EndContents(); GUILayout.BeginHorizontal(); GUILayout.Space(3f); GUILayout.BeginVertical(); mScroll = GUILayout.BeginScrollView(mScroll); if (EditorTools.DrawHeader("AssetBundle Local Files", true)) { DrawBundleLocalFiles(); } GUILayout.BeginHorizontal(); GUILayout.Label(" "); GUILayout.EndHorizontal(); if (ftp_filelist != null && EditorTools.DrawHeader("FTP Upload Files", false)) { DrawBundleFTPFileDetails(ftp_filelist); } GUILayout.EndScrollView(); GUILayout.EndVertical(); GUILayout.Space(3f); GUILayout.EndHorizontal(); }
void TabMakerGUI() { InfoHeaderGUI(); //----------------------------- EditorTools.DrawHeader("Build Bundle", true); EditorTools.BeginContents(false); DrawSettingItem("Build Export Folder Name", ref EditorABSetting.strExportPath, EditorABSetting.DEF_EXPORT_PATH); GUILayout.BeginHorizontal(); BuildAssetBundleOptions emOpt = (BuildAssetBundleOptions)EditorTools.EnumPopup("BuildOptions", EditorABSetting.emBuildOptions, Color.green, false); if (emOpt != EditorABSetting.emBuildOptions) { EditorABSetting.emBuildOptions = emOpt; } EditorABSetting.eBUILDTARGET emTarget = (EditorABSetting.eBUILDTARGET)EditorTools.EnumPopup("BuildTarget", EditorABSetting.emBuildTarget, Color.green, false); if (emTarget != EditorABSetting.emBuildTarget) { EditorABSetting.emBuildTarget = emTarget; } GUILayout.EndHorizontal(); EditorTools.EndContents(); //----------------------------- EditorTools.DrawHeader("AssetBundle Maker", true); EditorTools.BeginContents(false); GUILayout.BeginHorizontal(); GUI.backgroundColor = Color.cyan; GUILayout.Space(20f); if (GUILayout.Button("Add AssetBundle Folder")) { msg_log = EditorABManager.MarkFolderInFiles(EditorUtility.OpenFolderPanel("Add a Assets", EditorABSetting.GetProjectPath() + "/Assets", "Select Folder")); GUILayout.Space(20f); GUI.backgroundColor = Color.white; GUILayout.EndHorizontal(); return; } if (GUILayout.Button("Add AssetBundle File")) { msg_log = EditorABManager.MarkInFile(EditorUtility.OpenFilePanel("Add a Assets", EditorABSetting.GetProjectPath() + "/Assets", "*.*")); GUILayout.Space(20f); GUI.backgroundColor = Color.white; GUILayout.EndHorizontal(); return; } GUILayout.Space(20f); GUI.backgroundColor = Color.white; GUILayout.EndHorizontal(); EditorTools.EndContents(); // 번들 리스트 채크. string[] all = AssetDatabase.GetAllAssetBundleNames(); EditorTools.DrawHeader("AssetBundle Build", true); EditorTools.BeginContents(false); if (all.Length > 0) { GUILayout.BeginHorizontal(); GUI.backgroundColor = Color.magenta; GUILayout.Space(20f); if (GUILayout.Button("Export AssetBundles")) { EditorABSetting.CreateExoprtFolder(); CleanUnUsedBundleName(); BuildPipeline.BuildAssetBundles(EditorABSetting.GetBuildPipelineOutPath(), EditorABSetting.GetBuildPipelineOptions(), EditorABSetting.GetBuildPipelineTarget()); EditorABSetting.SaveConfigFile(); return; } GUILayout.Space(20f); GUI.backgroundColor = Color.white; GUILayout.EndHorizontal(); } EditorTools.EndContents(); // 번들 리스트 채크. if (all.Length > 0) { GUILayout.BeginHorizontal(); GUILayout.Space(3f); GUILayout.BeginVertical(); mScroll = GUILayout.BeginScrollView(mScroll); for (int i = 0; i < all.Length; i++) { string[] childs = AssetDatabase.GetAssetPathsFromAssetBundle(all[i]); if (DrawABList(i, all[i], childs.Length, false)) { for (int j = 0; j < childs.Length; j++) { GUILayout.Space(-1f); int highlight = (j % 2);// (selected == j); GUI.backgroundColor = highlight == 1 ? Color.white : new Color(0.6f, 0.6f, 0.6f); GUILayout.BeginHorizontal("AS TextArea", GUILayout.MinHeight(20f)); GUI.backgroundColor = Color.white; GUILayout.Label(j.ToString(), GUILayout.Width(24f)); if (GUILayout.Button(childs[j], "OL TextField", GUILayout.Height(20f))) { msg_log = childs[j]; } GUILayout.EndHorizontal(); } } } GUILayout.EndScrollView(); GUILayout.EndVertical(); GUILayout.Space(3f); GUILayout.EndHorizontal(); } }