Esempio n. 1
0
        //
        // 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);
        }
Esempio n. 2
0
        //
        // 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();
        }
Esempio n. 3
0
        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);
        }
Esempio n. 4
0
        //------------------------------------------------------------------------------
        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);
        }