public virtual void DefaultSetupElements() { var elementName = UIRoot.Q <Foldout>("TemplateName"); elementName.text = TemplateName; UIRoot.Q <Button>("Delete").clickable.clicked += () => lab.Clear(); var KEYWORDS = UIRoot.Q("KeyWords"); KEYWORDS.Clear(); foreach (var kw in keyWords) { if (kw._(KeyWord.Flag.HideInInspector)) { continue; } var kwInput = new KeyWordInput(lab, kw, this); kwInput.RegisterValueChangedCallback((e) => { if (e.newValue != e.previousValue) { if (kw._(KeyWord.Flag.Public)) { lab.SetInput(kw.key, e.newValue); } else { this.SetValue(kw.key, e.newValue); } } }); KEYWORDS.Add(kwInput); } var Des = UIRoot.Q <TextField>("Description"); Des.value = TemplateDes; Des.SetEnabled(false); }
public virtual void DefaultSetupElements() { var elementName = UIRoot.Q <Foldout>("ElementName"); elementName.text = TemplateName; var ElementsContainer = UIRoot.Q <VisualElement>("ElementsContainer"); UIRoot.Q <Button>("Delete").clickable.clicked += () => lab.DeleteElement(this); UIRoot.Q <Button>("Help").clickable.clicked += () => { EditorCoroutine.Start(OpenHelper()); }; var ToolBox = ElementsContainer.Q("ToolBox"); var KEYWORDS = UIRoot.Q("KeyWords"); KEYWORDS.Clear(); foreach (var kw in keyWords) { if (kw._(KeyWord.Flag.HideInInspector)) { continue; } var kwInput = new KeyWordInput(lab, kw, this); kwInput.RegisterValueChangedCallback((e) => { this.SetValue(kw.key, e.newValue); }); KEYWORDS.Add(kwInput); } var Des = ElementsContainer.Q <TextField>("Description"); Des.value = TemplateDes; Des.SetEnabled(false); //工具箱 ToolBox.Q <Button>("Preview").clickable.clicked += () => SetPreview(); }