Exemple #1
0
        partial void OnTargetLinkDelLinkInfo_WPF(CodeGenerateSystem.Base.LinkInfo info)
        {
            var param = CSParam as PropertyNodeConstructionParams;

            switch (param.PropertyInfo.HostType)
            {
            case MethodInfoAssist.enHostType.Base:
            case MethodInfoAssist.enHostType.This:
                TargetThisFlag.Visibility = Visibility.Visible;
                break;
            }
        }
Exemple #2
0
        public async System.Threading.Tasks.Task AddGraphInParam(MethodInvokeParameterControl ctrl, CodeGenerateSystem.Base.LinkInfo info)
        {
            if (HostNodesContainer.IsLoading)
            {
                return;
            }
            if (mLinkedNodesContainer == null)
            {
                await InitializeLinkedNodesContainer();
            }

            var param = CSParam as MethodInvoke_DelegateControlConstructionParams;
            var func  = new CustomMethodInfo.FunctionParam();

            func.HostMethodInfo = param.DelegateMethodInfo;
            func.ParamName      = info.m_linkFromObjectInfo.HostNodeControl.GCode_GetValueName(info.m_linkFromObjectInfo, null);
            func.ParamType      = new VariableType(info.m_linkFromObjectInfo.HostNodeControl.GCode_GetType(info.m_linkFromObjectInfo, null), param.CSType);

            int insertIndex = -1;

            for (int i = 0; i < mChildNodes.Count; i++)
            {
                if (mChildNodes[i] == ctrl)
                {
                    insertIndex++;
                    if (insertIndex >= param.InParamIndexes.Count)
                    {
                        insertIndex = -1;

                        param.DelegateMethodInfo.InParams.Add(func);
                        param.InParamIndexes.Add(ctrl.Id);
                        param.DelegateMethodInfo._OnAddedInParam(func);
                    }
                    else
                    {
                        param.DelegateMethodInfo.InParams.Insert(insertIndex, func);
                        param.InParamIndexes.Insert(insertIndex, ctrl.Id);
                        param.DelegateMethodInfo._OnInsertInParam(insertIndex, func);
                    }
                    break;
                }
                else
                {
                    insertIndex = param.InParamIndexes.IndexOf(mChildNodes[i].Id);
                }
            }

            //for(int i=0; i< mLinkedNodesContainer.CtrlNodeList.Count; i++)
            //{
            //    var node = mLinkedNodesContainer.CtrlNodeList[i];
            //    if(node is MethodCustom)
            //    {
            //        var methodNode = node as MethodCustom;
            //        if(insertIndex < 0)
            //            await methodNode.OnAddedInParam(func);
            //        else
            //        {
            //            await methodNode.OnInsertInParam(insertIndex, func);
            //        }
            //        continue;
            //    }
            //    //else if(node is ReturnCustom)
            //    //{
            //    //    var retNode = node as ReturnCustom;
            //    //    retNode.ResetMethodInfo(param.DelegateMethodInfo);
            //    //}
            //}
        }
Exemple #3
0
        void OnAddLinkInfo(CodeGenerateSystem.Base.LinkInfo info)
        {
            var type = info.m_linkFromObjectInfo.HostNodeControl.GCode_GetType(info.m_linkFromObjectInfo, null);

            if (type == null)
            {
                info.Clear();
                return;
            }
            foreach (var i in strs)
            {
                if (type.FullName.IndexOf(i) != -1)
                {
                    ElementType        = typeof(Object);
                    DicTypeVisibility  = Visibility.Collapsed;
                    ListTypeVisibility = Visibility.Visible;
                    this.HostNodesContainer.RefreshNodeProperty(this, CodeGenerateSystem.Base.ENodeHandleType.AddNodeControl);
                    return;
                }
            }

            var param = CSParam as ForeachNodeConstructionParams;

            ArrayCountVisibility = Visibility.Collapsed;
            if (type.IsPointer)
            {
                ArrayCountVisibility = Visibility.Visible;
                var name = type.FullName.Remove(type.FullName.Length - 1);
                ElementType         = type.Assembly.GetType(name);
                DicTypeVisibility   = Visibility.Collapsed;
                ListTypeVisibility  = Visibility.Visible;
                param.LoopValueType = ForeachNodeConstructionParams.enLoopValueType.IntPtr;
            }
            else if (type.IsArray)
            {
                var name = type.FullName.Substring(0, type.FullName.IndexOf('['));
                ElementType         = EngineNS.Rtti.RttiHelper.GetTypeFromTypeFullName(name);
                DicTypeVisibility   = Visibility.Collapsed;
                ListTypeVisibility  = Visibility.Visible;
                param.LoopValueType = ForeachNodeConstructionParams.enLoopValueType.Array;
            }
            else if (type.IsGenericType)
            {
                if (type.GenericTypeArguments.Length == 1)
                {
                    ElementType         = type.GenericTypeArguments[0];
                    DicTypeVisibility   = Visibility.Collapsed;
                    ListTypeVisibility  = Visibility.Visible;
                    param.LoopValueType = ForeachNodeConstructionParams.enLoopValueType.List;
                }

                if (type.GenericTypeArguments.Length == 2)
                {
                    KeyType             = type.GenericTypeArguments[0];
                    ValueType           = type.GenericTypeArguments[1];
                    DicTypeVisibility   = Visibility.Visible;
                    ListTypeVisibility  = Visibility.Collapsed;
                    param.LoopValueType = ForeachNodeConstructionParams.enLoopValueType.Dictionary;
                }
            }
            this.HostNodesContainer.RefreshNodeProperty(this, CodeGenerateSystem.Base.ENodeHandleType.AddNodeControl);
        }
Exemple #4
0
 partial void ArrayInPin_OnAddLinkInfo(CodeGenerateSystem.Base.LinkInfo linkInfo);
Exemple #5
0
        void InitCheckWithMember(string memberName, Type memberType, bool isReadOnly)
        {
            var param = CSParam as ExpandNodeConstructParam;
            var cb    = new CheckBox();

            cb.Content    = memberName;
            cb.Foreground = TryFindResource("TextForeground") as Brush;
            if (param.ActiveMembers.Contains(memberName))
            {
                cb.IsChecked = true;
            }
            else
            {
                cb.IsChecked = false;
            }
            cb.Checked += (object sender, System.Windows.RoutedEventArgs e) =>
            {
                if (!mCheckDelegateOperationEnable)
                {
                    return;
                }

                var redoAction = new Action <object>((obj) =>
                {
                    mCheckDelegateOperationEnable = false;

                    param.ActiveMembers.Add(memberName);
                    var childNodeParam = new ExpandNodeChild.ExpandNodeChildConstructionParams()
                    {
                        CSType             = param.CSType,
                        HostNodesContainer = param.HostNodesContainer,
                        ParamName          = memberName,
                        ParamType          = memberType,
                        IsReadOnly         = isReadOnly,
                    };
                    var paramCtrl = new ExpandNodeChild(childNodeParam);
                    AddChildNode(paramCtrl, mParamPanel);
                    cb.Tag       = paramCtrl;
                    cb.IsChecked = true;
                    CreateTemplateClass_Show();
                    mCheckDelegateOperationEnable = true;
                });
                redoAction.Invoke(null);
                var undoAction = new Action <object>((obj) =>
                {
                    mCheckDelegateOperationEnable = false;
                    param.ActiveMembers.Remove(memberName);
                    var node = cb.Tag as ExpandNodeChild;
                    RemoveChildNode(node);
                    cb.Tag       = null;
                    cb.IsChecked = false;
                    CreateTemplateClass_Show();
                    mCheckDelegateOperationEnable = true;
                });
                EditorCommon.UndoRedo.UndoRedoManager.Instance.AddCommand(HostNodesContainer.HostControl.UndoRedoKey, null, redoAction, null, undoAction, "Add Member");
                IsDirty = true;
            };
            cb.Unchecked += (object sender, System.Windows.RoutedEventArgs e) =>
            {
                if (!mCheckDelegateOperationEnable)
                {
                    return;
                }

                var node = cb.Tag as ExpandNodeChild;
                if (node == null)
                {
                    return;
                }
                var nodeIdx = mParamPanel.Children.IndexOf(node);

                var undoRedoDatas = new List <UndoRedoData>();
                foreach (var lPin in node.GetLinkPinInfos())
                {
                    for (int i = 0; i < lPin.GetLinkInfosCount(); i++)
                    {
                        var lInfo = lPin.GetLinkInfo(i);
                        var data  = new UndoRedoData();
                        data.StartObj = lInfo.m_linkFromObjectInfo;
                        data.EndObj   = lInfo.m_linkToObjectInfo;
                        undoRedoDatas.Add(data);
                    }
                }
                var redoAction = new Action <object>((obj) =>
                {
                    mCheckDelegateOperationEnable = false;
                    RemoveChildNode(node);
                    cb.Tag       = null;
                    cb.IsChecked = false;
                    param.ActiveMembers.Remove(memberName);
                    CreateTemplateClass_Show();
                    mCheckDelegateOperationEnable = true;
                });
                redoAction.Invoke(null);
                var undoAction = new Action <object>((obj) =>
                {
                    mCheckDelegateOperationEnable = false;
                    param.ActiveMembers.Insert(nodeIdx, memberName);
                    InsertChildNode(nodeIdx, node, mParamPanel);
                    cb.Tag       = node;
                    cb.IsChecked = true;
                    foreach (var data in undoRedoDatas)
                    {
                        var linkInfo = new CodeGenerateSystem.Base.LinkInfo(ParentDrawCanvas, data.StartObj, data.EndObj);
                    }
                    CreateTemplateClass_Show();
                    mCheckDelegateOperationEnable = true;
                });
                EditorCommon.UndoRedo.UndoRedoManager.Instance.AddCommand(HostNodesContainer.HostControl.UndoRedoKey, null, redoAction, null, undoAction, "Remove Member");
                IsDirty = true;
            };
            StackPanel_Members.Children.Add(cb);
        }
Exemple #6
0
        public void EndPreviewLine(LinkPinControl objInfo, NodesContainer nodesContainer)
        {
            if (nodesContainer.ContainerDrawCanvas == null)
            {
                return;
            }

            if (objInfo == null)
            {
                if (nodesContainer.StartLinkObj != null && nodesContainer.PreviewLinkCurve.Visibility == System.Windows.Visibility.Visible)
                {
                    nodesContainer.IsOpenContextMenu = true;
                }
            }
            else if (nodesContainer.StartLinkObj != null && objInfo != null)
            {
                nodesContainer.PreviewLinkCurve.Visibility = System.Windows.Visibility.Hidden;
                nodesContainer.enPreviewBezierType         = CodeGenerateSystem.Base.enBezierType.None;

                if (nodesContainer.StartLinkObj.LinkOpType == objInfo.LinkOpType && objInfo.LinkOpType != enLinkOpType.Both) // 只有start和end能连 或者其中之一 和 Both
                {
                    return;
                }
                if (CodeGenerateSystem.Base.LinkInfo.CanLinkWith(nodesContainer.StartLinkObj, objInfo))
                {
                    objInfo.MouseAssistVisible = System.Windows.Visibility.Hidden;

                    var container = new NodesContainer.LinkInfoContainer();
                    if (nodesContainer.StartLinkObj.LinkOpType == enLinkOpType.Start)
                    {
                        container.Start = nodesContainer.StartLinkObj;
                        container.End   = objInfo;
                    }
                    else if (objInfo.LinkOpType == enLinkOpType.Start)
                    {
                        container.Start = objInfo;
                        container.End   = nodesContainer.StartLinkObj;
                    }
                    else
                    {
                        container.Start = nodesContainer.StartLinkObj;
                        container.End   = objInfo;
                    }

                    if (nodesContainer.StartLinkObj.LinkCurveType == enLinkCurveType.Line)
                    {
                        NodesContainer.TransitionStaeBaseNodeForUndoRedo transCtrl = new NodesContainer.TransitionStaeBaseNodeForUndoRedo();
                        var redoAction = new Action <object>((obj) =>
                        {
                            var linkInfo = new AnimStateLinkInfo(nodesContainer.ContainerDrawCanvas, container.Start, container.End);
                            transCtrl.TransitionStateNode = linkInfo.AddTransition();
                        });
                        redoAction.Invoke(null);
                        EditorCommon.UndoRedo.UndoRedoManager.Instance.AddCommand(nodesContainer.HostControl.UndoRedoKey, null, redoAction, null,
                                                                                  (obj) =>
                        {
                            for (int i = 0; i < container.End.GetLinkInfosCount(); i++)
                            {
                                var info = container.End.GetLinkInfo(i);
                                if (info.m_linkFromObjectInfo == container.Start)
                                {
                                    var transitionInfo = info as AnimStateLinkInfo;
                                    transitionInfo.RemoveTransition(transCtrl.TransitionStateNode);
                                    break;
                                }
                            }
                        }, "Create Link");
                    }
                    else
                    {
                        var redoAction = new Action <Object>((obj) =>
                        {
                            var linkInfo = new CodeGenerateSystem.Base.LinkInfo(nodesContainer.ContainerDrawCanvas, container.Start, container.End);
                        });
                        redoAction.Invoke(null);
                        EditorCommon.UndoRedo.UndoRedoManager.Instance.AddCommand(nodesContainer.HostControl.UndoRedoKey, null, redoAction, null,
                                                                                  (obj) =>
                        {
                            for (int i = 0; i < container.End.GetLinkInfosCount(); i++)
                            {
                                var info = container.End.GetLinkInfo(i);
                                if (info.m_linkFromObjectInfo == container.Start)
                                {
                                    info.Clear();
                                    break;
                                }
                            }
                        }, "Create Link");
                    }

                    IsDirty = true;
                }
                else
                {
                    nodesContainer.OnLinkFailure(nodesContainer.StartLinkObj, objInfo);
                }
            }
        }
Exemple #7
0
 partial void AddLinkInfo_WPF(LinkInfo info)
 {
     //info.m_linkFromObjectInfo.HasLink = true;
     //info.m_linkToObjectInfo.HasLink = true;
     UpdateImageShow();
 }
Exemple #8
0
 partial void OnValueLinkDelLinkInfo_WPF(CodeGenerateSystem.Base.LinkInfo info)
 {
     ProDefaultValue.Visibility = Visibility.Visible;
 }
Exemple #9
0
 partial void OnValueLinkAddLinkInfo_WPF(CodeGenerateSystem.Base.LinkInfo info)
 {
     ProDefaultValue.Visibility = Visibility.Collapsed;
 }
Exemple #10
0
 partial void OnTargetLinkAddLinkInfo_WPF(CodeGenerateSystem.Base.LinkInfo info)
 {
     TargetThisFlag.Visibility = Visibility.Collapsed;
 }