示例#1
0
 partial void ResetMethodInfo_WPF(CodeDomNode.CustomMethodInfo methodInfo)
 {
     NodeName = methodInfo.MethodName;
     SetBinding(NodeNameBinderProperty, new Binding("MethodName")
     {
         Source = methodInfo, Mode = BindingMode.TwoWay
     });
 }
示例#2
0
 partial void ResetMethodInfo_WPF(CodeDomNode.CustomMethodInfo methodInfo)
 {
     NodeName     = methodInfo.MethodName;
     ShowNodeName = methodInfo.DisplayName;
     methodInfo.PropertyChanged += (sender, e) =>
     {
         switch (e.PropertyName)
         {
         case "DisplayName":
             ShowNodeName = methodInfo.DisplayName;
             break;
         }
     };
     SetBinding(NodeNameBinderProperty, new Binding("MethodName")
     {
         Source = methodInfo, Mode = BindingMode.TwoWay
     });
 }
示例#3
0
        public async Task ResetMethodInfo(CodeDomNode.CustomMethodInfo methodInfo)
        {
            var pp = mCSParam as ReturnCustomConstructParam;

            pp.MethodInfo.RemoveOutParamOperation(this);

            // 比较新旧MethodInfo参数,对参数进行增删
            for (int i = 0; i < methodInfo.OutParams.Count; i++)
            {
                if (i >= pp.MethodInfo.OutParams.Count)
                {
                    await OnAddedOutParam(methodInfo.OutParams[i]);
                }
                else
                {
                    if (pp.MethodInfo.OutParams[i].IsEqual(methodInfo.OutParams[i]))
                    {
                        var pm = mChildNodes[i] as MethodInvokeParameterControl;
                        pm.ResetParamInfo(methodInfo.OutParams[i], System.CodeDom.FieldDirection.Out);
                    }
                    else
                    {
                        await OnRemovedOutParam(i, pp.MethodInfo.OutParams[i]);
                        await OnInsertOutParam(i, methodInfo.OutParams[i]);
                    }
                }
            }
            // 删除多余的参数
            for (int i = methodInfo.OutParams.Count; i < pp.MethodInfo.OutParams.Count; i++)
            {
                await OnRemovedOutParam(i, pp.MethodInfo.OutParams[i]);
            }

            pp.MethodInfo = methodInfo;
            ResetMethodInfo_WPF(methodInfo);

            methodInfo.AddOutParamOperation(this);
        }
示例#4
0
 partial void ResetMethodInfo_WPF(CodeDomNode.CustomMethodInfo methodInfo);
        private void CreateParticleMethodCategory(string methodname, float x, float y)
        {
            Macross.NodesControlAssist NodesControlAssist = mLinkedNodesContainer.HostControl as Macross.NodesControlAssist;

            //加入列表信息
            Macross.Category category;
            var csparam = CSParam as StructNodeControlConstructionParams;

            if (!csparam.CategoryDic.TryGetValue(Macross.MacrossPanelBase.GraphCategoryName, out category))
            {
                return;
            }

            var HostControl = this.HostNodesContainer.HostControl;

            var item = new Macross.CategoryItem(null, category);

            item.CategoryItemType = Macross.CategoryItem.enCategoryItemType.OverrideFunction;
            var data = new Macross.CategoryItem.InitializeData();

            data.Reset();

            var MacrossOpPanel = NodesControlAssist.HostControl.MacrossOpPanel;

            item.Initialize(MacrossOpPanel.HostControl, data);
            //HostControl.CreateNodesContainer(item);

            //MainGridItem.Children.Add(item);
            item.Name = methodname;
            category.Items.Add(item);

            //加入结点信息 TODO..
            Type type = typeof(EngineNS.Bricks.Particle.ParticleStateNode);

            System.Reflection.MethodInfo      methodInfo = type.GetMethod(methodname);
            System.Reflection.ParameterInfo[] paramstype = methodInfo.GetParameters();

            var itemPro = new CodeDomNode.CustomMethodInfo();

            //itemPro.AddOutParamOperation(item);
            itemPro.CSType = EngineNS.ECSType.Client;

            itemPro.MethodName = methodname + "_" + NodeName;//"DoParticleSubStateBorn_" + MainGridItem.Name;

            //var CustomFunctionData = new Macross.ResourceInfos.MacrossResourceInfo.CustomFunctionData();
            var methodinfo = CodeDomNode.Program.GetMethodInfoAssistFromMethodInfo(methodInfo, type, CodeDomNode.MethodInfoAssist.enHostType.Base, "");
            var nodeType   = typeof(CodeDomNode.MethodOverride);
            var csParam    = new CodeDomNode.MethodOverride.MethodOverrideConstructParam()
            {
                CSType             = mLinkedNodesContainer.CSType,
                HostNodesContainer = mLinkedNodesContainer,
                ConstructParam     = "",
                MethodInfo         = methodinfo,
            };

            //var center = nodesContainer.NodesControl.GetViewCenter();
            var node = mLinkedNodesContainer.AddOrigionNode(nodeType, csParam, x, y);

            node.IsDeleteable = true;

            //重写双击事件 不需要进入二级编辑
            //item.OnDoubleClick -= item.OnDoubleClick;
            Type      ItemType = item.GetType();
            FieldInfo _Field   = item.GetType().GetField("OnDoubleClick", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.Public | BindingFlags.Static);

            if (_Field != null)
            {
                object _FieldValue = _Field.GetValue(item);
                if (_FieldValue != null && _FieldValue is Delegate)
                {
                    Delegate   _ObjectDelegate = (Delegate)_FieldValue;
                    Delegate[] invokeList      = _ObjectDelegate.GetInvocationList();

                    foreach (Delegate del in invokeList)
                    {
                        ItemType.GetEvent("OnDoubleClick").RemoveEventHandler(item, del);
                    }
                }
            }
            item.OnDoubleClick += (categoryItem) =>
            {
                mLinkedNodesContainer.FocusNode(node);
            };

            //NodesControlAssist.Save();
        }
示例#6
0
        public override async Task <NodesControlAssist> ShowNodesContainer(INodesContainerDicKey graphKey)
        {
            var retValue = await base.ShowNodesContainer(graphKey);

            Category bindFuncCategory;

            if (MacrossOpPanel.CategoryDic.TryGetValue(MacrossPanel.UIBindFuncCategoryName, out bindFuncCategory))
            {
                foreach (var funcItem in bindFuncCategory.Items)
                {
                    CodeDomNode.CustomMethodInfo methodInfo = null;
                    if (funcItem.PropertyShowItem is UIElementVariableBindCategoryItemPropertys)
                    {
                        var pro = funcItem.PropertyShowItem as UIElementVariableBindCategoryItemPropertys;
                        methodInfo = pro.MethodInfo;
                    }
                    if (funcItem.PropertyShowItem is UIElementPropertyCustomBindCategoryItemPropertys)
                    {
                        var pro = funcItem.PropertyShowItem as UIElementPropertyCustomBindCategoryItemPropertys;
                        methodInfo = pro.MethodInfo;
                    }
                    if (methodInfo == null)
                    {
                        continue;
                    }
                    for (int i = 0; i < retValue.NodesControl.CtrlNodeList.Count; i++)
                    {
                        var node = retValue.NodesControl.CtrlNodeList[i];
                        if (node is CodeDomNode.CustomMethodInfo.IFunctionResetOperationNode)
                        {
                            var funcNode       = node as CodeDomNode.CustomMethodInfo.IFunctionResetOperationNode;
                            var nodeMethodInfo = funcNode.GetMethodInfo();

                            if (nodeMethodInfo.MethodName == methodInfo.MethodName)
                            {
                                await funcNode.ResetMethodInfo(methodInfo);
                            }
                        }
                    }
                }
            }
            if (MacrossOpPanel.CategoryDic.TryGetValue(MacrossPanel.UIEventFuncCategoryName, out bindFuncCategory))
            {
                foreach (var funcItem in bindFuncCategory.Items)
                {
                    var pro = funcItem.PropertyShowItem as UIElementEventCategoryItemPorpertys;
                    if (pro == null)
                    {
                        continue;
                    }
                    var methodInfo = pro.MethodInfo;
                    if (methodInfo == null)
                    {
                        continue;
                    }
                    for (int i = 0; i < retValue.NodesControl.CtrlNodeList.Count; i++)
                    {
                        var node = retValue.NodesControl.CtrlNodeList[i];
                        if (node is CodeDomNode.CustomMethodInfo.IFunctionResetOperationNode)
                        {
                            var funcNode       = node as CodeDomNode.CustomMethodInfo.IFunctionResetOperationNode;
                            var nodeMethodInfo = funcNode.GetMethodInfo();

                            if (nodeMethodInfo.MethodName == methodInfo.MethodName)
                            {
                                await funcNode.ResetMethodInfo(methodInfo);
                            }
                        }
                    }
                }
            }

            return(retValue);
        }