Ejemplo n.º 1
0
        public static void PromptUserForNameAuto()
        {
            string templateFilePath = "";
            String targetPath       = EditorUtils.GetDirectoryPathOfSelectedAsset();

            if (targetPath.Contains("CYMCommon"))
            {
                templateFilePath = BaseConstMgr.Path_XTempCYMMonobehaviour;
            }
            else if (targetPath.Contains("_Func"))
            {
                templateFilePath = BaseConstMgr.Path_XTempMonobehaviour;
            }

            if (String.IsNullOrEmpty(targetPath))
            {
                targetPath = "Assets";
            }

            if (!File.Exists(templateFilePath))
            {
                return;
            }

            String templateName = Path.GetFileNameWithoutExtension(templateFilePath);

            templateName = Regex.Replace(templateName, @"\W", "");

            XenoTemplateUtilityWindow.ShowWindow(templateFilePath, templateName, targetPath);
        }
        //
        // Public methods
        //

        //------------------------------------------------------------------------------
        public static void ShowWindow(String templateFilePath, String defaultName, String targetPath)
        {
            XenoTemplateUtilityWindow window = XenoTemplateUtilityWindow.CreateInstance <XenoTemplateUtilityWindow>();
            String title = String.Format("XenoTemplate: {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();
        }
Ejemplo n.º 3
0
        //
        // Public methods
        //

        //------------------------------------------------------------------------------
        public static void PromptUserForName(String templateFilePath)
        {
            String targetPath = EditorUtils.GetDirectoryPathOfSelectedAsset();

            if (String.IsNullOrEmpty(targetPath))
            {
                targetPath = "Assets";
            }

            if (!File.Exists(templateFilePath))
            {
                return;
            }

            String templateName = Path.GetFileNameWithoutExtension(templateFilePath);

            templateName = Regex.Replace(templateName, @"\W", "");

            XenoTemplateUtilityWindow.ShowWindow(templateFilePath, templateName, targetPath);
        }