void OnGUI() { GUILayout.Label($"Create Dekuple {_suffix}", EditorStyles.boldLabel); EditorGUIUtility.labelWidth = 100; _input = EditorGUILayout.TextField("Base Name", _input); GUILayout.BeginHorizontal(); if (GUILayout.Button("Save")) { TemplateMenu.CreateFile(_template, _input, $"{Directory.GetParent(Application.dataPath).FullName}/{TemplateMenu.GetDirectory()}/{_input}{_suffix}.cs"); Close(); } if (GUILayout.Button("Cancel")) { Close(); } GUILayout.EndHorizontal(); }
void OnGUI() { GUILayout.Label($"Create Dekuple Entity", EditorStyles.boldLabel); EditorGUIUtility.labelWidth = 100; _input = EditorGUILayout.TextField("Name", _input); GUILayout.Space(6); var pathStyle = new GUIStyle("ToolbarTextField") { stretchWidth = true }; EditorGUIUtility.labelWidth = 150f; GUILayout.BeginHorizontal(); EditorGUILayout.PrefixLabel("View Class Path: "); if (GUILayout.Button(_viewClassPath, pathStyle)) { _viewClassPath = EditorUtility.OpenFolderPanel("Select folder to create view.", _viewClassPath, ""); } GUILayout.EndHorizontal(); GUILayout.BeginHorizontal(); EditorGUILayout.PrefixLabel("View Interface Path: "); if (GUILayout.Button(_viewInterfacePath, pathStyle)) { _viewInterfacePath = EditorUtility.OpenFolderPanel("Select folder to create view.", _viewInterfacePath, ""); } GUILayout.EndHorizontal(); GUILayout.BeginHorizontal(); EditorGUILayout.PrefixLabel("Agent Class Path: "); if (GUILayout.Button(_agentClassPath, pathStyle)) { _agentClassPath = EditorUtility.OpenFolderPanel("Select folder to create view.", _agentInterfacePath, ""); } GUILayout.EndHorizontal(); GUILayout.BeginHorizontal(); EditorGUILayout.PrefixLabel("Agent Interface Path: "); if (GUILayout.Button(_agentInterfacePath, pathStyle)) { _agentInterfacePath = EditorUtility.OpenFolderPanel("Select folder to create view.", _agentInterfacePath, ""); } GUILayout.EndHorizontal(); GUILayout.BeginHorizontal(); EditorGUILayout.PrefixLabel("Model Class Path: "); if (GUILayout.Button(_modelClassPath, pathStyle)) { _modelClassPath = EditorUtility.OpenFolderPanel("Select folder to create view.", _modelClassPath, ""); } GUILayout.EndHorizontal(); GUILayout.BeginHorizontal(); EditorGUILayout.PrefixLabel("Model Interface Path: "); if (GUILayout.Button(_modelInterfacePath, pathStyle)) { _modelInterfacePath = EditorUtility.OpenFolderPanel("Select folder to create view.", _modelInterfacePath, ""); } GUILayout.EndHorizontal(); GUILayout.BeginHorizontal(); if (GUILayout.Button("Save")) { TemplateMenu.CreateFile(_viewInterface, _input, $"{_viewInterfacePath}/I{_input}View.cs"); TemplateMenu.CreateFile(_agentInterface, _input, $"{_agentInterfacePath}/I{_input}Agent.cs"); TemplateMenu.CreateFile(_modelInterface, _input, $"{_modelInterfacePath}/I{_input}Model.cs"); TemplateMenu.CreateFile(_viewClass, _input, $"{_viewClassPath}/{_input}View.cs"); TemplateMenu.CreateFile(_agentClass, _input, $"{_agentClassPath}/{_input}Agent.cs"); TemplateMenu.CreateFile(_modelClass, _input, $"{_modelClassPath}/{_input}Model.cs"); Close(); } if (GUILayout.Button("Cancel")) { Close(); } GUILayout.EndHorizontal(); }