private void Init(TemplateSet template) { if(template == null) { this.Close(); } this.previousLabel = template.label; this.template = template; Action repaint = () => this.Repaint(); this.ignores = new StringListField("Paths that ignore", repaint, this.template.ignores); this.considers = new StringListField("Paths that consider", repaint, this.template.considers); this.functions = new ListField<ExecutorFunctionSet>("Executor functions", (index, value) => this.GUI4ExecutorFunction(index, value), repaint, this.template.functions); this.functions.ShowHorizontalScrollBar = false; this.efpath = Getters4Editor.GetExecutorFunctionsPath(MetadataHolder.Instance); this.efobject = Getters4Editor.GetExecutorFunctionsObject(MetadataHolder.Instance); this.titleContent.text = "Edit Template"; this.titleContent.tooltip = "Edit Template Window"; }
void OnGUI() { if(this.ignores == null || this.considers == null || this.functions == null) { this.Init(this.template); } EditorGUILayout.LabelField("CustomTemplate: Edit Tempalte for " + this.template.Extension); GUILayout.Space(20.0f); #region "Validation" EditorGUILayout.BeginHorizontal(); EditorGUILayout.LabelField("Setting template's validation"); this.template.validity = (Validater)EditorGUILayout.EnumPopup(this.template.validity); EditorGUILayout.EndHorizontal(); #endregion #region "Label" EditorGUILayout.BeginHorizontal(); this.template.label = EditorGUILayout.TextField("Label for customized", this.template.label); if(GUILayout.Button("Apply")) { this.ChangeLabel(); } EditorGUILayout.EndHorizontal(); #endregion this.ignores.Draw(); this.considers.Draw(); #region "Context" EditorGUILayout.Space(); EditorGUILayout.LabelField("Context of custom template for " + this.template.Extension); this.template.context = EditorGUILayout.TextArea(this.template.context); EditorGUILayout.Space(); #endregion #region "Edit Executor Functions" this.functions.Draw(); if(this.functions.Folding) { EditorGUILayout.Space(); EditorGUI.indentLevel += 1; if(this.efobject == null) { return; } EditorGUILayout.BeginHorizontal(); EditorGUILayout.LabelField("Edit Executor Functions Script", GUILayout.ExpandWidth(false)); if(GUILayout.Button("Open Editor")) { AssetDatabase.OpenAsset(this.efobject); } EditorGUILayout.EndHorizontal(); EditorGUI.indentLevel -= 1; } #endregion #region "Path of Executor Functions Script" GUILayout.Space(5.0f); EditorGUI.BeginDisabledGroup(true); GUILayout.Space(20.0f); EditorGUILayout.TextField("File path", this.efpath); EditorGUI.EndDisabledGroup(); #endregion this.template.ignores = this.ignores.GetValidityList(); this.template.considers = this.considers.GetValidityList(); this.template.functions = this.functions.GetValidityList(); }