Exemplo n.º 1
0
        public NodeParamIOData Clone()
        {
            NodeParamIOData data = new NodeParamIOData()
            {
                _paramsInfo = new Dictionary <Type, List <ParamInfoOutput> >()
            };

            foreach (var pair in _paramsInfo)
            {
                List <ParamInfoOutput> list = pair.Value.Clone();
                data._paramsInfo.Add(pair.Key, list);
            }

            return(data);
        }
Exemplo n.º 2
0
        public void ShowDetialPanel(NodeParam param, NodeParamIOData infos)
        {
            BeTreeNode node = _srcNode[param.SrcTreeID][param.NodeID];

            if (!NodeSelectedPanel.Active && !SelectedNode(GetBtnFromParam(param)))
            {
                DetialPanel.Hide();
                return;
            }
            Vector2 pos = node.LocalPosition + NodePanels.LocalPosition + new Vector2(node.Size.x, 0);

            DetialPanel.LocalPosition      = pos;
            DetialBackground.LocalPosition = pos;
            NodeSelectedPanel.Active       = false;
            DetialPanel.Show(param, infos);
        }
Exemplo n.º 3
0
        public void InitNodeOutputAvailable()
        {
            _infoDatas.Clear();
            NodeParamIOData   initData  = new NodeParamIOData();
            Stack <NodeParam> nodeStack = new Stack <NodeParam>();

            nodeStack.Push(_root);

            while (nodeStack.Count > 0)
            {
                NodeParam node = nodeStack.Pop();

                foreach (ParamInfoInput input in node.Inputs)
                {
                    List <ParamInfoOutput> ps = initData[input.InputType];
                    if (ps == null || input.Input != null && !ps.Contains(input.Input))
                    {
                        input.Input = null;
                    }

                    if (!string.IsNullOrEmpty(input.SrcInputStr) && input.Input == null)
                    {
                        foreach (var p in ps)
                        {
                            if (p.OutputName == input.SrcInputStr)
                            {
                                input.Input = p;
                                break;
                            }
                        }
                    }
                }

                _infoDatas.Add(node, initData.Clone());

                foreach (ParamInfoOutput paramInfo in node.Outputs)
                {
                    initData.AddParam(paramInfo.OutputType, paramInfo);
                }

                for (int i = node.ChildrenList.Count - 1; i >= 0; --i)
                {
                    nodeStack.Push(node.ChildrenList[i]);
                }
            }
        }
        public void Show(NodeParam node, NodeParamIOData infos)
        {
            GUI.FocusControl("强制测试用名");
            Active = true;
            _node  = node;
            _infos = infos;

            _outputs.Clear();
            _typeIndexSelection.Clear();
            _typeIndexShow.Clear();

            foreach (ParamInfoInput pair in _node.Inputs)
            {
                List <ParamInfoOutput> outputs;
                if (!_outputs.TryGetValue(pair.InputType, out outputs))
                {
                    outputs = _infos[pair.InputType];
                    _outputs.Add(pair.InputType, outputs);
                }

                List <string> shows = new List <string>();
                foreach (ParamInfoOutput output in outputs)
                {
                    shows.Add($"{output.OutputName}");
                }

                if (shows.Count > 0)
                {
                    if (pair.Input != null)
                    {
                        int index = outputs.IndexOf(pair.Input);
                        _typeIndexSelection.Add(pair, index);
                    }
                    else
                    {
                        shows.Insert(0, NONE_SELECTED);
                        _typeIndexSelection.Add(pair, 0);
                    }
                    _typeIndexShow.Add(pair, shows.ToArray());
                }
            }
        }