private static string GenerateTransitionMethods(FlowWindow window)
        {
            if (window.isContainer)
            {
                return(string.Empty);
            }

            var flowData = FlowSystem.GetData();

            var transitions = flowData.windows.Where(_ => window.attaches.Contains(_.id)).Where(_ => !_.isDefaultLink && !_.isContainer);

            var result = string.Empty;

            foreach (var each in transitions)
            {
                var className = each.directory;
                var classNameWithNamespace = GetNamespace(each) + "." + GetDerivedClassName(each);                    //GetBaseClassName( each );

                result = result + FlowTemplateGenerator.GenerateWindowLayoutTransitionMethod(className, classNameWithNamespace);
            }

            return(result);
        }
        private static void GenerateUIWindow(string fullpath, FlowWindow window, bool recompile = false)
        {
            var isCompiledInfoInvalid = window.compiled && CompiledInfoIsInvalid(window);

            if (window.compiled == false || recompile == true || isCompiledInfoInvalid)
            {
                var baseClassName    = GetBaseClassName(window);
                var derivedClassName = GetDerivedClassName(window);
                var classNamespace   = GetNamespace(window);

                var baseClassTemplate    = FlowTemplateGenerator.GenerateWindowLayoutBaseClass(baseClassName, classNamespace, GenerateTransitionMethods(window));
                var derivedClassTemplate = FlowTemplateGenerator.GenerateWindowLayoutDerivedClass(derivedClassName, baseClassName, classNamespace);

                                #if !UNITY_WEBPLAYER
                var baseClassPath    = (fullpath + "/" + baseClassName + ".cs").Replace("//", "/");
                var derivedClassPath = (fullpath + "/" + derivedClassName + ".cs").Replace("//", "/");
                                #endif

                if (baseClassTemplate != null && derivedClassTemplate != null)
                {
                    CreateDirectory(fullpath, string.Empty);
                    CreateDirectory(fullpath, FlowDatabase.COMPONENTS_FOLDER);
                    CreateDirectory(fullpath, FlowDatabase.LAYOUT_FOLDER);
                    CreateDirectory(fullpath, FlowDatabase.SCREENS_FOLDER);

                                        #if !UNITY_WEBPLAYER
                    /*if ( Directory.Exists( window.compiledDirectory ) && fullpath != window.compiledDirectory ) {
                     *
                     *      foreach ( var each in Directory.GetFiles( window.compiledDirectory ) ) {
                     *
                     *              if ( Path.GetFileNameWithoutExtension( each ) != window.compiledDerivedClassName ) {
                     *
                     *                      File.Delete( each );
                     *              } else {
                     *
                     *                      if ( !File.Exists( derivedClassPath ) ) {
                     *
                     *                              File.Move( each, derivedClassPath );
                     *
                     *                              AssetDatabase.ImportAsset( derivedClassName );
                     *                      }
                     *              }
                     *      }
                     *
                     *      Directory.Delete( window.compiledDirectory, recursive: true );
                     * }*/

                    Directory.CreateDirectory(fullpath);

                    File.WriteAllText(baseClassPath, baseClassTemplate);

                    if (!File.Exists(derivedClassPath))
                    {
                        File.WriteAllText(derivedClassPath, derivedClassTemplate);

                        AssetDatabase.ImportAsset(derivedClassName);
                    }

                    AssetDatabase.ImportAsset(baseClassPath);
                                        #endif
                }
                else
                {
                    return;
                }

                var oldBaseClassName    = window.compiledBaseClassName;
                var newBaseClassName    = baseClassName;
                var oldDerivedClassName = window.compiledDerivedClassName;
                var newDerivedClassName = derivedClassName;

                var oldNamespace = window.compiledNamespace;

                window.compiledBaseClassName    = baseClassName;
                window.compiledDerivedClassName = derivedClassName;
                window.compiledNamespace        = classNamespace;

                var newNamespace = window.compiledNamespace;

                window.compiledDirectory = fullpath;

                window.compiled = true;

                AssetDatabase.Refresh(ImportAssetOptions.ForceUpdate);

                if (isCompiledInfoInvalid)
                {
                    EditorApplication.delayCall += () => UpdateInheritedClasses(oldBaseClassName, newBaseClassName, oldDerivedClassName, newDerivedClassName, oldNamespace, newNamespace);
                }
            }
        }