• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C# Attributes.DesignerPropertyInfo类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C#中Behaviac.Design.Attributes.DesignerPropertyInfo的典型用法代码示例。如果您正苦于以下问题:C# DesignerPropertyInfo类的具体用法?C# DesignerPropertyInfo怎么用?C# DesignerPropertyInfo使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



DesignerPropertyInfo类属于Behaviac.Design.Attributes命名空间,在下文中一共展示了DesignerPropertyInfo类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。

示例1: SetProperty

        public override void SetProperty(DesignerPropertyInfo property, object obj) {
            base.SetProperty(property, obj);

            _resetMethods = false;

            DesignerMethodEnum enumAtt = property.Attribute as DesignerMethodEnum;

            if (enumAtt != null && property.Property.PropertyType == null)
            { throw new Exception(string.Format(Resources.ExceptionDesignerAttributeExpectedEnum, property.Property.Name)); }

            Nodes.Behavior behavior = GetBehavior();
            _agentType = (behavior != null) ? behavior.AgentType : null;

            SetTypes();

            object action = property.Property.GetValue(obj, null);
            MethodDef method = action as MethodDef;
            int typeIndex = -1;

            if (method != null) {
                typeIndex = getTypeIndex(method.Owner);
            }

            if (typeIndex < 0) {
                typeIndex = 0;
            }

            // Keep only one type for efficiency.
            _currentNames.Clear();
            _currentNames.Add(_names[typeIndex]);

            this.typeComboBox.Items.Clear();
            this.typeComboBox.Items.Add(_types[typeIndex]);
            this.typeComboBox.SelectedIndex = 0;
        }
开发者ID:675492062,项目名称:behaviac,代码行数:35,代码来源:DesignerMethodComboEnumEditor.cs


示例2: SetProperty

        public override void SetProperty(DesignerPropertyInfo property, object obj) {
            base.SetProperty(property, obj);

            string enumName = string.Empty;
            Type enumtype = null;

            DesignerTypeEnum enumAtt = property.Attribute as DesignerTypeEnum;

            if (enumAtt != null) {
                object agentType = property.Property.GetValue(obj, null);
                AgentType t = agentType as AgentType;

                if (t != null)
                { enumName = t.DisplayName; }

                enumtype = property.Property.PropertyType;
            }

            if (enumtype == null)
            { throw new Exception(string.Format(Resources.ExceptionDesignerAttributeExpectedEnum, property.Property.Name)); }

            _agentTypes = getAgentTypes();
            comboBox.Items.Clear();

            foreach(AgentType t in _agentTypes) {
                if (t.DisplayName == enumName) {
                    _agentTypes.Clear();
                    _agentTypes.Add(t);
                    comboBox.Items.Add(t.DisplayName);
                    break;
                }
            }

            comboBox.Text = enumName;
        }
开发者ID:675492062,项目名称:behaviac,代码行数:35,代码来源:DesignerTypeEnumEditor.cs


示例3: ShouldUpdatePropertyGrids

        public override bool ShouldUpdatePropertyGrids(DesignerPropertyInfo property) {
            DesignerPropertyInfo oplProp = DesignerProperty.GetDesignerProperty(_obj.GetType(), "Opl");
            DesignerPropertyInfo operatorProp = DesignerProperty.GetDesignerProperty(_obj.GetType(), "Operator");

            return property.Property == oplProp.Property ||
                   property.Property == operatorProp.Property;
        }
开发者ID:675492062,项目名称:behaviac,代码行数:7,代码来源:AttachActionUIPolicy.cs


示例4: GetLabel

        public override string GetLabel(DesignerPropertyInfo property) {
            OperatorTypes operatorType = (OperatorTypes)GetProperty(_obj, "Operator");

            // action
            if (this.isAction()) {
                DesignerPropertyInfo oplProp = DesignerProperty.GetDesignerProperty(_obj.GetType(), "Opl");

                if (property.Property == oplProp.Property)
                { return Resources.Method; }
            }

            // assign
            else if (operatorType == OperatorTypes.Assign) {
                DesignerPropertyInfo opr2Prop = DesignerProperty.GetDesignerProperty(_obj.GetType(), "Opr2");

                if (property.Property == opr2Prop.Property)
                { return Resources.Right; }
            }

            // compute
            else if (operatorType >= OperatorTypes.Add && operatorType <= OperatorTypes.Div) {
            }

            // compare
            else if (operatorType >= OperatorTypes.Equal && operatorType <= OperatorTypes.LessEqual) {
                DesignerPropertyInfo opr2Prop = DesignerProperty.GetDesignerProperty(_obj.GetType(), "Opr2");

                if (property.Property == opr2Prop.Property)
                { return Resources.Right; }
            }

            return base.GetLabel(property);
        }
开发者ID:675492062,项目名称:behaviac,代码行数:33,代码来源:AttachActionUIPolicy.cs


示例5: ShouldAddProperty

        public override bool ShouldAddProperty(DesignerPropertyInfo property) {
            if (_obj != null) {
                OperatorTypes operatorType = (OperatorTypes)GetProperty(_obj, "Operator");

                DesignerPropertyInfo oplProp = DesignerProperty.GetDesignerProperty(_obj.GetType(), "Opl");
                DesignerPropertyInfo opr1Prop = DesignerProperty.GetDesignerProperty(_obj.GetType(), "Opr1");
                DesignerPropertyInfo operatorProp = DesignerProperty.GetDesignerProperty(_obj.GetType(), "Operator");
                DesignerPropertyInfo opr2Prop = DesignerProperty.GetDesignerProperty(_obj.GetType(), "Opr2");

                // action
                if (this.isAction()) {
                    return property.Property != opr1Prop.Property &&
                           property.Property != operatorProp.Property &&
                           property.Property != opr2Prop.Property;
                }

                // assign
                else if (operatorType == OperatorTypes.Assign) {
                    return property.Property != opr1Prop.Property;
                }

                // compute
                else if (operatorType >= OperatorTypes.Add && operatorType <= OperatorTypes.Div) {
                }

                // compare
                else if (operatorType >= OperatorTypes.Equal && operatorType <= OperatorTypes.LessEqual) {
                    return property.Property != opr1Prop.Property;
                }
            }

            return true;
        }
开发者ID:675492062,项目名称:behaviac,代码行数:33,代码来源:AttachActionUIPolicy.cs


示例6: Update

        public override void Update(object sender, DesignerPropertyInfo property)
        {
            if (_obj != null)
            {
                DesignerPropertyEditor oplEditor = GetEditor(_obj, "Opl");
                Debug.Check(oplEditor != null);
                if (oplEditor == sender)
                {
                    VariableDef opl = (VariableDef)GetProperty(_obj, "Opl");

                    if (opl != null)
                    {
                        RightValueDef opr = (RightValueDef)GetProperty(_obj, "Opr");

                        if (opr != null && opl.ValueType != opr.ValueType)
                        {
                            DesignerPropertyEditor oprEditor = GetEditor(_obj, "Opr");
                            Debug.Check(oprEditor != null);

                            oprEditor.Clear();
                        }
                    }
                }
            }
        }
开发者ID:XyzalZhang,项目名称:behaviac,代码行数:25,代码来源:AssignmentUIPolicy.cs


示例7: SetProperty

        public override void SetProperty(DesignerPropertyInfo property, object obj) {
            base.SetProperty(property, obj);

            DesignerBoolean boolAtt = property.Attribute as DesignerBoolean;

            if (boolAtt != null)
            { checkBox.Checked = (bool)property.Property.GetValue(obj, null); }
        }
开发者ID:675492062,项目名称:behaviac,代码行数:8,代码来源:DesignerBooleanEditor.cs


示例8: SetProperty

        public override void SetProperty(DesignerPropertyInfo property, object obj) {
            base.SetProperty(property, obj);

            object value = property.GetValue(obj);

            if (value != null)
            { setProperty(value, property.Attribute.DisplayName, property.Attribute.HasFlags(DesignerProperty.DesignerFlags.ReadOnly), obj); }

            else
            { update(); }
        }
开发者ID:675492062,项目名称:behaviac,代码行数:11,代码来源:DesignerCompositeEditor.cs


示例9: GetLabel

        public override string GetLabel(DesignerPropertyInfo property)
        {
            OperatorTypes operatorType = (OperatorTypes)GetProperty(_obj, "Operator");

            // compare
            if (operatorType >= OperatorTypes.Equal && operatorType <= OperatorTypes.LessEqual)
            {
                DesignerPropertyInfo opr2Prop = DesignerProperty.GetDesignerProperty(_obj.GetType(), "Opr2");
                if (property.Property == opr2Prop.Property)
                    return Resources.Right;
            }

            return base.GetLabel(property);
        }
开发者ID:675492062,项目名称:behaviac,代码行数:14,代码来源:TransitionUIPolicy.cs


示例10: ShouldAddProperty

        public override bool ShouldAddProperty(DesignerPropertyInfo property)
        {
            if (_obj != null)
            {
                if (Plugin.IsQueryFiltered)
                {
                    DesignerPropertyInfo domainsProp = DesignerProperty.GetDesignerProperty(_obj.GetType(), "Domains");
                    DesignerPropertyInfo descriptorRefsProp = DesignerProperty.GetDesignerProperty(_obj.GetType(), "DescriptorRefs");

                    return property.Property != domainsProp.Property &&
                        property.Property != descriptorRefsProp.Property;
                }
            }

            return true;
        }
开发者ID:Just4F,项目名称:behaviac,代码行数:16,代码来源:BehaviorUIPolicy.cs


示例11: SetProperty

        public override void SetProperty(DesignerPropertyInfo property, object obj) {
            base.SetProperty(property, obj);

            object v = property.Property.GetValue(obj, null);

            if (v != null) {
                if (Plugin.IsCharType(v.GetType())) {
                    textBox.MaxLength = 1;
                }

                textBox.Text = trimQuotes(v.ToString());

            } else {
                Debug.Check(false);
            }
        }
开发者ID:675492062,项目名称:behaviac,代码行数:16,代码来源:DesignerStringEditor.cs


示例12: ShouldAddProperty

        public override bool ShouldAddProperty(DesignerPropertyInfo property)
        {
            if (_obj != null)
            {
                DesignerPropertyInfo binaryOperator = DesignerProperty.GetDesignerProperty(_obj.GetType(), "BinaryOperator");
                if (property.Property == binaryOperator.Property)
                {
                    Attachments.Attachment attach = _obj as Attachments.Attachment;
                    if (attach != null && attach.Node != null && attach.Node.Attachments != null
                        && attach.Node.Attachments.Count > 0 && attach.Node.Attachments[0] == attach)
                    {
                        return false;
                    }
                }
            }

            return base.ShouldAddProperty(property);
        }
开发者ID:675492062,项目名称:behaviac,代码行数:18,代码来源:PreconditionUIPolicy.cs


示例13: SetProperty

        public override void SetProperty(DesignerPropertyInfo property, object obj)
        {
            base.SetProperty(property, obj);

            _resetMethods = false;

            DesignerRightValueEnum enumAttRV = _property.Attribute as DesignerRightValueEnum;

            this.FilterType = null;
            if (enumAttRV != null && enumAttRV.DependedProperty != "")
            {
                Type objType = _object.GetType();
                PropertyInfo pi = objType.GetProperty(enumAttRV.DependedProperty);
                object propMember = pi.GetValue(_object, null);
                VariableDef var = propMember as VariableDef;
                if (var != null)
                {
                    this.FilterType = var.GetValueType();
                }
                else
                {
                    MethodDef method = propMember as MethodDef;
                    if (method != null)
                    {
                        this.FilterType = method.ReturnType;
                    }
                    else
                    {
                        RightValueDef varRVp = propMember as RightValueDef;
                        if (varRVp != null)
                        {
                            this.FilterType = varRVp.ValueType;
                        }
                    }
                }
            }
            else
            {
                this.FilterType = _property.Attribute.FilterType;
            }

            setComboBox();
        }
开发者ID:KeyleXiao,项目名称:behaviac,代码行数:43,代码来源:DesignerMethodEnumEditor.cs


示例14: Update

        public override void Update(object sender, DesignerPropertyInfo property)
        {
            if (_obj != null)
            {
                DesignerPropertyEditor statusPhaseEditor = GetEditor(_obj, "TransitionPhase");
                Debug.Check(statusPhaseEditor != null);

                PluginBehaviac.Events.AlwaysTransition at = this._obj as PluginBehaviac.Events.AlwaysTransition;
                if (at.Node is PluginBehaviac.Nodes.FSMReferencedBehavior)
                {
                    //
                }
                else
                {
                    statusPhaseEditor.Enabled = false;

                    //ResultOption is set to be SUCCESS by default
                    SetProperty(_obj, "TransitionPhase", PluginBehaviac.Events.ETransitionPhase.ETP_Always);
                }
            }
        }
开发者ID:Just4F,项目名称:behaviac,代码行数:21,代码来源:AlwaysTransitionUIPolicy.cs


示例15: ShouldAddProperty

        public override bool ShouldAddProperty(DesignerPropertyInfo property)
        {
            if (_obj != null)
            {
                OperatorTypes operatorType = (OperatorTypes)GetProperty(_obj, "Operator");
                DesignerPropertyInfo opr1Prop = DesignerProperty.GetDesignerProperty(_obj.GetType(), "Opr1");


                DesignerPropertyInfo oplProp = DesignerProperty.GetDesignerProperty(_obj.GetType(), "Opl");
                DesignerPropertyInfo operatorProp = DesignerProperty.GetDesignerProperty(_obj.GetType(), "Operator");
                DesignerPropertyInfo opr2Prop = DesignerProperty.GetDesignerProperty(_obj.GetType(), "Opr2");

                // compare
                if (operatorType >= OperatorTypes.Equal && operatorType <= OperatorTypes.LessEqual)
                {
                    return property.Property != opr1Prop.Property;
                }
            }

            return true;
        }
开发者ID:675492062,项目名称:behaviac,代码行数:21,代码来源:TransitionUIPolicy.cs


示例16: Update

        public override void Update(object sender, DesignerPropertyInfo property)
        {
            if (_obj != null)
            {
                BaseNode p = _obj as BaseNode;
                if (p != null)
                {
                    bool bHTN = false;
                    while (p != null)
                    {
                        if (p.Parent != null && p.Parent.ToString() == "Branch")
                        {
                            bHTN = true;
                            break;
                        }

                        p = p.Parent;
                    }

                    //hide policy configs if for HTN
                    {
                        DesignerPropertyEditor FailurePolicyEditor = GetEditor(_obj, "FailurePolicy");
                        Debug.Check(FailurePolicyEditor != null);
                        FailurePolicyEditor.Visible = !bHTN;

                        DesignerPropertyEditor SuccessPolicyEditor = GetEditor(_obj, "SuccessPolicy");
                        Debug.Check(SuccessPolicyEditor != null);
                        SuccessPolicyEditor.Visible = !bHTN;

                        DesignerPropertyEditor ExitPolicyEditor = GetEditor(_obj, "ExitPolicy");
                        Debug.Check(ExitPolicyEditor != null);
                        ExitPolicyEditor.Visible = !bHTN;

                        DesignerPropertyEditor ChildFinishPolicyEditor = GetEditor(_obj, "ChildFinishPolicy");
                        Debug.Check(ChildFinishPolicyEditor != null);
                        ChildFinishPolicyEditor.Visible = !bHTN;
                    }
                }
            }
        }
开发者ID:Just4F,项目名称:behaviac,代码行数:40,代码来源:ParallelUIPolicy.cs


示例17: Update

        public override void Update(object sender, DesignerPropertyInfo property)
        {
            if (_obj != null) {
                DesignerPropertyEditor resultOptionEditor = GetEditor(_obj, "ResultOption");
                DesignerPropertyEditor resultFunctorEditor = GetEditor(_obj, "ResultFunctor");
                Debug.Check(resultOptionEditor != null && resultFunctorEditor != null);

                MethodDef method = GetProperty(_obj, "Method") as MethodDef;
                MethodDef checkMethod = GetProperty(_obj, "ResultFunctor") as MethodDef;

                if (method == null || method.NativeReturnType == "behaviac::EBTStatus") {
                    resultOptionEditor.Enabled = false;
                    resultFunctorEditor.Enabled = false;

                    //ResultOption is set to be SUCCESS by default
                    SetProperty(_obj, "ResultOption", EBTStatus.BT_INVALID);

                } else {
                    bool enableMethod = true;
                    object prop = GetProperty(_obj, "ResultOption");

                    if (prop is EBTStatus) {
                        EBTStatus checkStatusdProp = (EBTStatus)prop;

                        if (EBTStatus.BT_INVALID != checkStatusdProp)
                        { enableMethod = false; }
                    }

                    resultOptionEditor.Enabled = true;
                    resultFunctorEditor.Enabled = enableMethod;
                }

                if (!resultFunctorEditor.Enabled) {
                    SetProperty(_obj, "ResultFunctor", null);
                    resultFunctorEditor.Clear();
                }
            }
        }
开发者ID:Just4F,项目名称:behaviac,代码行数:38,代码来源:ActionUIPolicy.cs


示例18: ShouldAddProperty

        public override bool ShouldAddProperty(DesignerPropertyInfo property)
        {
            if (_obj != null)
            {
                DesignerPropertyInfo oplProp = DesignerProperty.GetDesignerProperty(_obj.GetType(), "Opl");
                DesignerPropertyInfo opr1Prop = DesignerProperty.GetDesignerProperty(_obj.GetType(), "Opr1");
                DesignerPropertyInfo operatorProp = DesignerProperty.GetDesignerProperty(_obj.GetType(), "Operator");
                DesignerPropertyInfo opr2Prop = DesignerProperty.GetDesignerProperty(_obj.GetType(), "Opr2");

                if (oplProp.Property != null)
                {
                    RightValueDef rv = oplProp.GetValue(_obj) as RightValueDef;
                    if (rv != null && rv.IsMethod && rv.Method != null)
                    {
                        return property.Property != opr1Prop.Property &&
                            property.Property != operatorProp.Property &&
                            property.Property != opr2Prop.Property;
                    }
                }
            }

            return base.ShouldAddProperty(property);
        }
开发者ID:675492062,项目名称:behaviac,代码行数:23,代码来源:EffectorUIPolicy.cs


示例19: OnPropertyValueChanged

        public override void OnPropertyValueChanged(DesignerPropertyInfo property) {
            if (property.Property.Name == "Prototype") {
                List <ParInfo> pars = ((Behavior)(this.Behavior)).LocalVars;

                bool bLoop = true;

                //remove old added local variables
                while (bLoop) {
                    int index = pars.FindIndex((p) => p.Name.IndexOf(LOCAL_TASK_PARAM_PRE) != -1);

                    if (index != -1) {
                        pars.RemoveAt(index);

                    } else {
                        bLoop = false;
                    }
                }

                for (int i = 0; i < this._task.Params.Count; ++i) {
                    var param = this._task.Params[i];
                    string par_name = string.Format("{0}{1}", LOCAL_TASK_PARAM_PRE, i);

                    ParInfo par = new ParInfo(this, this.Behavior != null ? this.Behavior.AgentType : null);

                    par.IsAddedAutomatically = true;
                    par.Name = par_name;
                    par.DisplayName = param.DisplayName;
                    par.TypeName = param.Type.FullName;
                    par.Variable = new VariableDef(param.Value);
                    par.Description = param.Description;
                    par.Display = false;

                    pars.Add(par);
                }
            }
        }
开发者ID:675492062,项目名称:behaviac,代码行数:36,代码来源:Task.cs


示例20: GetParam

        public Param GetParam(string paramName, Type strutType, object obj, DesignerPropertyInfo param)
        {
            int indexInArray = -1;

            if (!_structParams.ContainsKey(paramName))
            {
                StructParam_t ps0 = new StructParam_t();
                _structParams[paramName] = ps0;
                ps0.type = obj.GetType();

                IList<DesignerPropertyInfo> properties = DesignerProperty.GetDesignerProperties(strutType, DesignerProperty.SortByDisplayOrder);
                foreach (DesignerPropertyInfo property in properties)
                {
                    object member = property.GetValue(obj);

                    Param v = new Param(property, obj);
                    _structParams[paramName].AddParam(-1, v);
                }
            }

            StructParam_t ps1 = _structParams[paramName] as StructParam_t;
            Debug.Check(ps1 != null);

            if (ps1.type == obj.GetType())
            {
                List<Param> ps = _structParams[paramName].GetParams(indexInArray);

                if (ps != null)
                {
                    foreach (Param p in ps)
                    {
                        if (p.Name == param.Property.Name && p.Type == param.Property.PropertyType)
                        {
                            return p;
                        }
                    }

                }
                else
                {
                    Debug.Check(true);
                }
            }

            return null;
        }
开发者ID:Just4F,项目名称:behaviac,代码行数:46,代码来源:DataType.cs



注:本文中的Behaviac.Design.Attributes.DesignerPropertyInfo类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# Nodes.Node类代码示例发布时间:2022-05-24
下一篇:
C# Design.PropertyDef类代码示例发布时间:2022-05-24
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap