public PropertyView(uNodeProperty property, ExplorerPropertyData data = null) { if (data == null) { data = new ExplorerPropertyData(); } data.guid = uNodeUtility.GetObjectID(property).ToString(); expanded = data.expanded; this.data = data; this.property = property; title = $"{property.Name} : {property.type.DisplayName(false, false)}"; titleIcon.image = uNodeEditorUtility.GetTypeIcon(typeof(TypeIcons.PropertyIcon)); expanded = data.expanded; expandedElement.visible = false; onExpandClicked += () => { if (!isInSearch) { data.expanded = expanded; Save(); } }; if (ExplorerManager.explorerData.showSummary) { if (!string.IsNullOrWhiteSpace(property.summary)) { var summary = new SummaryView(property.summary); headerContainer.Add(summary); } } if (ExplorerManager.explorerData.showTypeIcon) { typeIcon = new Image() { name = "type-icon", image = uNodeEditorUtility.GetIcon(property.type), }; titleContainer.Add(typeIcon); typeIcon.PlaceInFront(titleIcon); } }
public void SetData(ITreeData value) { data = value as ExplorerPropertyData; }
public GraphTreeView(uNodeRoot root, ExplorerGraphData data = null) { if (data == null) { data = new ExplorerGraphData(); } data.guid = uNodeUtility.GetObjectID(root).ToString(); expanded = data.expanded; this.data = data; this.root = root; title = root.DisplayName; titleContainer.RegisterCallback <MouseDownEvent>(evt => { if (evt.clickCount >= 2 && evt.button == 0) { uNodeEditor.ChangeTarget(root, true); } }); onExpandClicked += () => { if (!isInSearch) { data.expanded = expanded; Save(); } }; if (!string.IsNullOrWhiteSpace(root.summary) && ExplorerManager.explorerData.showSummary) { var summary = new SummaryView(root.summary); headerContainer.Add(summary); } if (root is ICustomIcon) { titleIcon.image = uNodeEditorUtility.GetTypeIcon(root); } else if (root is IMacroGraph) { titleIcon.image = uNodeEditorUtility.GetTypeIcon(typeof(TypeIcons.GraphIcon)); } else if (root is IClassSystem) { titleIcon.image = uNodeEditorUtility.GetTypeIcon((root as IClassSystem).IsStruct ? typeof(TypeIcons.StructureIcon) : typeof(TypeIcons.ClassIcon)); } else { titleIcon.image = uNodeEditorUtility.GetTypeIcon(typeof(TypeIcons.RuntimeTypeIcon)); } onFirstExpanded += () => { if (ExplorerManager.explorerData.showVariable) { foreach (var v in root.Variables) { string uid = v.Name; var childData = data.variables.FirstOrDefault(d => d.guid == uid); if (childData == null) { childData = new ExplorerVariableData(); data.variables.Add(childData); } AddChild(new VariableView(v, root, childData)); } } if (ExplorerManager.explorerData.showProperty) { foreach (var p in root.Properties) { string uid = uNodeUtility.GetObjectID(p).ToString(); var childData = data.properties.FirstOrDefault(d => d.guid == uid); if (childData == null) { childData = new ExplorerPropertyData(); data.properties.Add(childData); } AddChild(new PropertyView(p, childData)); } } if (ExplorerManager.explorerData.showFunction) { foreach (var f in root.Functions) { string uid = uNodeUtility.GetObjectID(f).ToString(); var childData = data.functions.FirstOrDefault(d => d.guid == uid); if (childData == null) { childData = new ExplorerFunctionData(); data.functions.Add(childData); } AddChild(new FunctionView(f, childData)); } } }; }