示例#1
0
        public override void AddChildNodes(NodeComponent nodeComponent, TreeViewItem parentItem, IList <TreeViewItem> rows)
        {
            var node  = nodeComponent as StateNode;
            var flows = node.nestedFlowNodes;

            if (flows != null && flows.Count > 0)
            {
                var tree = new HierarchyFlowTree(nodeComponent, MemberData.none, uNodeEditorUtility.GetUIDFromString(nodeComponent.GetInstanceID() + "[EVENTS]"), -1, "Events");
                parentItem.AddChild(tree);
                rows.Add(tree);
                for (int i = 0; i < flows.Count; i++)
                {
                    manager.AddNodes(flows[i], tree, rows);
                }
            }
            var transitions = node.TransitionEvents;

            if (transitions != null && transitions.Length > 0)
            {
                //var tree = new HierarchyFlowTree(nodeComponent, MemberData.none, uNodeEditorUtility.GetUIDFromString(nodeComponent.GetInstanceID() + "[TRANSITIONS]"), -1, "Transitions");
                //parentItem.AddChild(tree);
                //rows.Add(tree);
                for (int i = 0; i < transitions.Length; i++)
                {
                    var transitionTree = new HierarchyTransitionTree(transitions[i], -1);
                    manager.AddNodeTree(transitionTree, parentItem, rows);
                    manager.AddNodeTree(transitions[i].target, transitionTree, rows);
                }
            }
        }
示例#2
0
        public static HierarchyFlowTree CreateFlowTree(NodeComponent owner, string fieldName, MemberData member, string displayName)
        {
            var tree = new HierarchyFlowTree(owner, member, uNodeEditorUtility.GetUIDFromString($"{owner.GetHashCode()}:F={fieldName}"), -1, displayName)
            {
                icon = uNodeEditorUtility.GetTypeIcon(typeof(TypeIcons.FlowIcon)) as Texture2D
            };

            return(tree);
        }