// // Public methods // public static void PromptUserForNameAuto() { string templateFilePath = ""; String targetPath = EditorUtil.GetDirectoryPathOfSelectedAsset(); if (targetPath.Contains("CYMCommon")) { templateFilePath = Const.RPath_TempCYMMonobehaviour; } else if (targetPath.Contains("CSharp")) { templateFilePath = Const.RPath_TempCSharp; } else { templateFilePath = Const.RPath_TempMonobehaviour; } if (String.IsNullOrEmpty(targetPath)) { targetPath = "Assets"; } if (!File.Exists(templateFilePath)) { return; } String templateName = Path.GetFileNameWithoutExtension(templateFilePath); templateName = Regex.Replace(templateName, @"\W", ""); TemplateUtilityWindow.ShowWindow(templateFilePath, templateName, targetPath); }
public static void ShowTemplate(string name) { String targetPath = EditorUtil.GetDirectoryPathOfSelectedAsset(); string templateFilePath = Path.Combine(Const.RPath_Common, "_Res/Configs/TemplateFiles/" + name + ".asset"); if (String.IsNullOrEmpty(targetPath)) { targetPath = "Assets"; } if (!File.Exists(templateFilePath)) { return; } String templateName = Path.GetFileNameWithoutExtension(templateFilePath); templateName = Regex.Replace(templateName, @"\W", ""); TemplateUtilityWindow.ShowWindow(templateFilePath, templateName, targetPath); }
//------------------------------------------------------------------------------ public static void PromptUserForName(String templateFilePath) { String targetPath = EditorUtil.GetDirectoryPathOfSelectedAsset(); if (String.IsNullOrEmpty(targetPath)) { targetPath = "Assets"; } if (!File.Exists(templateFilePath)) { return; } String templateName = Path.GetFileNameWithoutExtension(templateFilePath); templateName = Regex.Replace(templateName, @"\W", ""); TemplateUtilityWindow.ShowWindow(templateFilePath, templateName, targetPath); }