static void Init() { PGFrameWindow window = (PGFrameWindow)EditorWindow.GetWindow(typeof(PGFrameWindow)); window.SetIcons(); window.titleContent = new GUIContent(window.pgf_window_title_icon); window.Show(); Current = window; }
public ElementJsonFileCreater(PGFrameWindow frameWindow, string name) : base(frameWindow, name) { }
public SimpleClassJsonFileCreater(PGFrameWindow frameWindow, string name) : base(frameWindow, name) { }
public PGFrameCommonManager(PGFrameWindow frameWindow) { this.FrameWindow = frameWindow; }
void OnGUI() { if (Current == null) { Current = this; Current.NeedRefresh = true; Current.NeedRefreshCommon = true; RefreshIcons(); } if (Event.current.type == EventType.Layout && (NeedRefresh || NeedRefreshCommon)) { RefreshFiles(); } if (Generator == null) { Generator = new PGCodeGenerator(); Generator.Init(); } GUILayout.BeginVertical(); GUILayout.Label("PGFrame", EditorStyles.boldLabel); if (GUILayout.Button("刷新")) { NeedRefresh = true; NeedRefreshCommon = true; RefreshFiles(); } ApplySelected(); if (NeedRefresh == false) { if (SelectedJsonElement == null) { if (GUILayout.Button("添加 Workspace")) { PopupWindow.Show(buttonRect, new TextFieldPopupDialog("请输入 Workspace 的名字:", (string value) => { JsonWorkspaceManager manager = new JsonWorkspaceManager(Path.Combine(Application.dataPath, JsonRoot)); manager.CreateWorkspace(value); CommonManager.Load(); AssetDatabase.Refresh(); NeedRefresh = true; return; })); if (Event.current.type == EventType.Repaint) { buttonRect = GUILayoutUtility.GetLastRect(); } } DesignList(); } else { switch ((DocType)Enum.Parse(typeof(DocType), SelectedJsonElement.DocType)) { case DocType.Element: DesignList_Element(); break; case DocType.SimpleClass: DesignList_SimpleClass(); break; case DocType.Enum: DesignList_Enum(); break; case DocType.FSM: DesignList(); break; default: throw new ArgumentOutOfRangeException(); } if (GUILayout.Button("打开相关文件...")) { PGFrameOpenFileTools.OpenContentMenu(SelectedJsonElement); } } } else { this.Repaint(); } GUILayout.FlexibleSpace(); if (SelectedWorkspace != null && jElements != null) { if (GUILayout.Button(string.Format("发布代码 ({0})", jElements.Length))) { for (int i = 0; i < jElements.Length; i++) { JSONElement xe = jElements [i]; Generator.GenerateCode(xe.jo); } AssetDatabase.Refresh(); } } if (SelectedWorkspace != null && jElements != null) { if (GUILayout.Button(string.Format("删除代码 ({0})", jElements.Length))) { if (EditorUtility.DisplayDialog("警告!", string.Format("确定删除整个Workspace:{0}的文件,包括非base层代码", SelectedWorkspace.Name), "确定删除", "取消操作")) { for (int i = 0; i < jElements.Length; i++) { JSONElement xe = jElements [i]; Generator.DeleteCode(xe.jo); } AssetDatabase.Refresh(); } } } GUILayout.EndVertical(); // if (Event.current.type == EventType.KeyDown && Event.current.) }