public TreeNode(bool spread, string content, int indent = 0, bool autosaveSpreadState = false) { if (autosaveSpreadState) { spread = EditorPrefs.GetBool(content, spread); } Content = content; Spread = new Property <bool>(spread); Style = new GUIStyleProperty(() => EditorStyles.foldout); mFirstLine.AddTo(this); mFirstLine.AddChild(EasyIMGUI.Space().Pixel(indent)); if (autosaveSpreadState) { Spread.Bind(value => EditorPrefs.SetBool(content, value)); } EasyIMGUI.Custom().OnGUI(() => { Spread.Value = EditorGUILayout.Foldout(Spread.Value, Content, true, Style.Value); }) .AddTo(mFirstLine); EasyIMGUI.Custom().OnGUI(() => { if (Spread.Value) { mSpreadView.DrawGUI(); } }).AddTo(this); }
public override void OnGUI() { base.OnGUI(); RootLayout.DrawGUI(); RenderEndCommandExecuter.ExecuteCommand(); }
public override void OnInspectorGUI() { base.OnInspectorGUI(); var codeGenerateInfo = target as ViewController; GUILayout.BeginVertical("box"); GUILayout.Label("代码生成部分", new GUIStyle() { fontStyle = FontStyle.Bold, fontSize = 15 }); if (codeGenerateInfo.ScriptName.IsNullOrEmpty()) { codeGenerateInfo.ScriptName = codeGenerateInfo.name; } GUILayout.BeginHorizontal(); GUILayout.Label(LocaleText.ScriptName, GUILayout.Width(150)); codeGenerateInfo.ScriptName = GUILayout.TextArea(codeGenerateInfo.ScriptName); GUILayout.EndHorizontal(); GUILayout.BeginHorizontal(); GUILayout.Label(LocaleText.ScriptsFolder, GUILayout.Width(150)); codeGenerateInfo.ScriptsFolder = GUILayout.TextArea(codeGenerateInfo.ScriptsFolder, GUILayout.Height(30)); GUILayout.EndHorizontal(); GUILayout.BeginHorizontal(); codeGenerateInfo.GeneratePrefab = GUILayout.Toggle(codeGenerateInfo.GeneratePrefab, LocaleText.GeneratePrefab); GUILayout.EndHorizontal(); if (codeGenerateInfo.GeneratePrefab) { GUILayout.BeginHorizontal(); GUILayout.Label(LocaleText.PrefabGenreateFolder, GUILayout.Width(150)); codeGenerateInfo.PrefabFolder = GUILayout.TextArea(codeGenerateInfo.PrefabFolder, GUILayout.Height(30)); GUILayout.EndHorizontal(); } mRootLayout.DrawGUI(); GUILayout.EndVertical(); }
public TreeNode(bool spread, string content, int indent = 0) { Content = content; Spread = new Property <bool>(spread); Style = new GUIStyle(EditorStyles.foldout); mFirstLine.AddTo(this); mFirstLine.AddChild(new SpaceView(indent)); new CustomView(() => { Spread.Value = EditorGUILayout.Foldout(Spread.Value, Content, true, Style); }).AddTo(mFirstLine); new CustomView(() => { if (Spread.Value) { mSpreadView.DrawGUI(); } }).AddTo(this); }
public override void OnInspectorGUI() { mRootLayout.DrawGUI(); base.OnInspectorGUI(); }
public override void OnInspectorGUI() { base.OnInspectorGUI(); GUILayout.BeginVertical("box"); GUILayout.Label("代码生成部分", new GUIStyle() { fontStyle = FontStyle.Bold, fontSize = 15 }); GUILayout.BeginHorizontal(); GUILayout.Label(LocaleText.Namespace, GUILayout.Width(150)); mCodeGenerateInfo.Namespace = EditorGUILayout.TextArea(mCodeGenerateInfo.Namespace); GUILayout.EndHorizontal(); GUILayout.BeginHorizontal(); GUILayout.Label(LocaleText.ScriptName, GUILayout.Width(150)); mCodeGenerateInfo.ScriptName = EditorGUILayout.TextArea(mCodeGenerateInfo.ScriptName); GUILayout.EndHorizontal(); GUILayout.BeginHorizontal(); GUILayout.Label(LocaleText.ScriptsFolder, GUILayout.Width(150)); mCodeGenerateInfo.ScriptsFolder = EditorGUILayout.TextArea(mCodeGenerateInfo.ScriptsFolder, GUILayout.Height(30)); GUILayout.EndHorizontal(); EditorGUILayout.Space(); EditorGUILayout.LabelField("请将要生成脚本的文件夹拖到下边区域 或 自行填写目录到上一栏中"); var sfxPathRect = EditorGUILayout.GetControlRect(); sfxPathRect.height = 200; GUI.Box(sfxPathRect, string.Empty); EditorGUILayout.LabelField(string.Empty, GUILayout.Height(185)); if ( Event.current.type == EventType.DragUpdated && sfxPathRect.Contains(Event.current.mousePosition) ) { //改变鼠标的外表 DragAndDrop.visualMode = DragAndDropVisualMode.Generic; if (DragAndDrop.paths != null && DragAndDrop.paths.Length > 0) { if (DragAndDrop.paths[0] != "") { var newPath = DragAndDrop.paths[0]; mCodeGenerateInfo.ScriptsFolder = newPath; AssetDatabase.SaveAssets(); AssetDatabase.Refresh(); EditorSceneManager.MarkSceneDirty(EditorSceneManager.GetActiveScene()); } } } GUILayout.BeginHorizontal(); mCodeGenerateInfo.GeneratePrefab = GUILayout.Toggle(mCodeGenerateInfo.GeneratePrefab, LocaleText.GeneratePrefab); GUILayout.EndHorizontal(); if (mCodeGenerateInfo.GeneratePrefab) { GUILayout.BeginHorizontal(); GUILayout.Label(LocaleText.PrefabGenreateFolder, GUILayout.Width(150)); mCodeGenerateInfo.PrefabFolder = GUILayout.TextArea(mCodeGenerateInfo.PrefabFolder, GUILayout.Height(30)); GUILayout.EndHorizontal(); } var fileFullPath = mCodeGenerateInfo.ScriptsFolder + "/" + mCodeGenerateInfo.ScriptName + ".cs"; if (File.Exists(mCodeGenerateInfo.ScriptsFolder + "/" + mCodeGenerateInfo.ScriptName + ".cs")) { var scriptObject = AssetDatabase.LoadAssetAtPath <MonoScript>(fileFullPath); if (GUILayout.Button("打开脚本", GUILayout.Height(30))) { AssetDatabase.OpenAsset(scriptObject); } if (GUILayout.Button("选择脚本", GUILayout.Height(30))) { Selection.objects = new Object[] { scriptObject }; } } mRootLayout.DrawGUI(); GUILayout.EndVertical(); }
public void OnGUI() { mRootLayout.DrawGUI(); }