/// <summary> /// Intialize tile editor. /// </summary> private void OnEP_Editor() { GUILayout.Label("Packages Settings", EditorStyles.boldLabel); /* Export the whole list. */ EditorUtil.CreateGroup(() => { mSerializedObject.Update(); EditorGUILayout.PropertyField(mSerializedProperty, true); mSerializedObject.ApplyModifiedProperties(); }); GUILayout.Label("Unity Ignore File", EditorStyles.boldLabel); EditorUtil.CreateGroup(() => { if (GUILayout.Button("Generate Unity Ignore")) { GenerateUnityIgnoreFiles(); } }); GUILayout.Label("Export Packages", EditorStyles.boldLabel); int buttonShown = 0; EditorUtil.CreateGroup(() => { for (int index = 0; index < instance.exportPackagesList.Length; ++index) { ExportPackageInfo eps = instance.exportPackagesList[index]; /* GUI Layout */ string name = eps.packageName; string version = eps.versionNo; string finalPackageName = FormPackageName(name, version); ++buttonShown; /* Assign export button. */ if (GUILayout.Button("Export -> " + finalPackageName)) { Export(name, version); } } if (buttonShown >= EXPORT_ALL_PACKAGES_BUTTON_COUNT) { if (GUILayout.Button("Export All Packages")) { ExportAllPackages(); } } }); }
public static void ExportNext() { ++EXPORT_INDEX; if (instance.exportPackagesList.Length <= EXPORT_INDEX) { return; } ExportPackageInfo eps = instance.exportPackagesList[EXPORT_INDEX]; /* GUI Layout */ string packageName = eps.packageName; string versionNo = eps.versionNo; Export(packageName, versionNo, null, true); }
private static void GenerateUnityIgnoreFiles() { string ignoreTemplatePath = Application.dataPath + "/" + TEMPLATE_PATH + "/"; string ignoreFileTemplatePath = ignoreTemplatePath + IGNORE_FILE_TEMPLATE_FILE; string[] templateLines = File.ReadAllLines(ignoreFileTemplatePath); for (int index = 0; index < instance.exportPackagesList.Length; ++index) { ExportPackageInfo eps = instance.exportPackagesList[index]; string packageName = eps.packageName; string versionNo = eps.versionNo; string ignoreFilePath = Application.dataPath + "/" + IGNORE_FILE_PATH + "/"; string ignoreFileName = packageName + IGNORE_FILE_EXT; string newIgnoreFullPath = ignoreFilePath + ignoreFileName; ignoreFileTemplatePath = ignoreFileTemplatePath.Replace("\\", "/"); newIgnoreFullPath = newIgnoreFullPath.Replace("\\", "/"); if (!File.Exists(newIgnoreFullPath)) { FileStream fileStream = new FileStream(newIgnoreFullPath, FileMode.OpenOrCreate, FileAccess.ReadWrite, FileShare.None); // make header, date, info, etc. string[] decoratedTemplateLines = MakeDecoration(templateLines, packageName, versionNo); using (StreamWriter sw = new StreamWriter(fileStream)) { foreach (string line in decoratedTemplateLines) { sw.WriteLine(line); } } } } // reset asset database once. AssetDatabase.Refresh(); }