static void CreateUiScript()
        {
            if (Selection.activeGameObject == null)
            {
                EditorUtility.DisplayDialog("错误", "当前未选中UI", "确认");
                return;
            }

            rootGameObject = Selection.activeGameObject.gameObject;
            NewUiNode      = AutoGenerateLua.CreateNewUiNode(rootGameObject.transform);
            string className = AutoGenerateLua.GetClassName(rootGameObject.name);
            string sceneName = rootGameObject.name;

            OpenWindow(sceneName, className, NewUiNode);
        }
        private void OnGUI()
        {
            if (ShowUiNode != null)
            {
                GUILayout.BeginHorizontal();
                {
                    GUILayout.Label("子UI:", GUILayout.Width(30));
                    IsChildUi = GUILayout.Toggle(IsChildUi, "", GUILayout.Width(50));
                    GUILayout.Space(20);

                    if (IsChildUi)
                    {
                        GUILayout.Label("父UI名称:", GUILayout.Width(80));
                        ParentUiName = EditorGUILayout.TextField(ParentUiName, GUILayout.Width(200));
                    }
                }
                GUILayout.EndHorizontal();

                GUILayout.Space(20);

                using (GUILayout.ScrollViewScope s = new GUILayout.ScrollViewScope(scroll, GUILayout.ExpandHeight(true)))
                {
                    scroll = s.scrollPosition;
                    DrawUiNode(ShowUiNode);
                }

                using (new GUILayout.HorizontalScope("AnimationEventBackground", GUILayout.Height(35)))
                {
                    if (GUILayout.Button("保存"))
                    {
                        if (!IsChildUi)
                        {
                            ParentUiName = null;
                        }

                        if (IsChildUi && string.IsNullOrEmpty(ParentUiName))
                        {
                            EditorUtility.DisplayDialog("警告", "请填写父UI名字", "确定");
                            return;
                        }

                        if (IsChildUi && !ShowUiNode.Name.StartsWith("Ui"))
                        {
                            EditorUtility.DisplayDialog("警告", "子UI的前缀必须为Ui 如:UiXXXX", "确定");
                            return;
                        }

                        SaveCacheData(ClassName, new UiJson()
                        {
                            SaveDirName = SaveDirName,
                            UiNodeData  = ShowUiNode,
                            IsChildUi   = IsChildUi,
                            ParentName  = ParentUiName
                        });
                        AutoGenerateLua.HandlerPrefab(rootGameObject);
                        AutoGenerateLua.HandlerUiNode(ParentUiName, IsChildUiSetGameObject, SaveDirName, ShowUiNode);

                        Instance.Close();
                    }

                    if (GUILayout.Button("重置"))
                    {
                        RefreshShowUiNode();
                    }

                    if (GUILayout.Button("清空"))
                    {
                        ShowUiNode = new UiNode {
                        };
                        CheckUiNode(null, ShowUiNode, NewUiNode);
                    }
                }
            }
        }