// // 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 methods // //------------------------------------------------------------------------------ public static void ShowWindow(String templateFilePath, String defaultName, String targetPath) { TemplateUtilityWindow window = TemplateUtilityWindow.CreateInstance <TemplateUtilityWindow>(); String title = String.Format("Template: {0}", defaultName); #if UNITY_5_0 window.title = title; #else window.titleContent = new GUIContent(title); #endif window.Initialize(templateFilePath, defaultName, targetPath); window.ShowUtility(); window.Focus(); }
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); }