コード例 #1
0
ファイル: Node.ErrorCheck.cs プロジェクト: chkob/behaviac-old
            /// <summary>
            /// Creates a result from the error check.
            /// </summary>
            /// <param name="node">The node we checked.</param>
            /// <param name="level">The type of message we want to post.</param>
            /// <param name="description">The posted message.</param>
            public ErrorCheck(Node node, ErrorCheckLevel level, string description)
            {
                _node        = node;
                _level       = level;
                _description = description;

                if (_node != null)
                {
                    _description = string.Format("{0}({1}) : {2}", _node.Label, _node.Id, description);
                }
            }
コード例 #2
0
ファイル: Action.cs プロジェクト: raptoravis/behaviac1
        public override void CheckForErrors(BehaviorNode rootBehavior, List <ErrorCheck> result)
        {
            if (this.Method == null
#if USE_NOOP
                || this.Method == MethodDef.Noop
#endif//#if USE_NOOP
                )
            {
                result.Add(new Node.ErrorCheck(this, ErrorCheckLevel.Error, Resources.NoMethod));
            }
            else
            {
                bool isParamCompleted = true;
                foreach (MethodDef.Param param in this.Method.Params)
                {
                    if (param.Value == null)
                    {
                        isParamCompleted = false;
                        break;
                    }
                }
                if (!isParamCompleted)
                {
                    result.Add(new Node.ErrorCheck(this, ErrorCheckLevel.Error, Resources.NoParam));
                }

                if (this.Method.NativeReturnType != "behaviac::EBTStatus")
                {
                    if (EBTStatus.BT_INVALID == this.ResultOption)
                    {
                        if (this.ResultFunctor == null)
                        {
                            ErrorCheckLevel checkLevel = ms_NoResultTreatAsError ? ErrorCheckLevel.Error : ErrorCheckLevel.Warning;
                            result.Add(new Node.ErrorCheck(this, checkLevel, Resources.NoResultFunctor));
                        }
                        else if (!Plugin.IsMatchedStatusMethod(this.Method, this.ResultFunctor))
                        {
                            result.Add(new Node.ErrorCheck(this, ErrorCheckLevel.Error, Resources.WrongResultFunctor));
                        }
                    }
                }
            }

            base.CheckForErrors(rootBehavior, result);
        }
コード例 #3
0
        public override void CheckForErrors(BehaviorNode rootBehavior, List <ErrorCheck> result)
        {
            if (this.Method == null
#if USE_NOOP
                || this.Method == MethodDef.Noop
#endif//#if USE_NOOP
                )
            {
                bool bAllowNullMethod             = false;
                System.Reflection.PropertyInfo fi = this.GetType().GetProperty("Method");
                Attribute[] attributes            = (Attribute[])fi.GetCustomAttributes(typeof(DesignerMethodEnum), false);

                if (attributes.Length > 0)
                {
                    DesignerMethodEnum designerProperty = ((DesignerMethodEnum)attributes[0]);

                    if ((designerProperty.MethodType & MethodType.AllowNullMethod) == MethodType.AllowNullMethod)
                    {
                        bAllowNullMethod = true;
                    }
                }

                if (!bAllowNullMethod)
                {
                    result.Add(new Node.ErrorCheck(this, ErrorCheckLevel.Error, Resources.NoMethod));
                }
            }
            else
            {
                bool isParamCompleted = true;

                foreach (MethodDef.Param param in this.Method.Params)
                {
                    if (param.Value == null)
                    {
                        isParamCompleted = false;
                        break;
                    }
                }

                if (!isParamCompleted)
                {
                    result.Add(new Node.ErrorCheck(this, ErrorCheckLevel.Error, Resources.NoParam));
                }

                if (this.Method.NativeReturnType != "behaviac::EBTStatus")
                {
                    if (EBTStatus.BT_INVALID == this.ResultOption)
                    {
                        if (this.ResultFunctor == null)
                        {
                            ErrorCheckLevel checkLevel = ms_NoResultTreatAsError ? ErrorCheckLevel.Error : ErrorCheckLevel.Warning;
                            result.Add(new Node.ErrorCheck(this, checkLevel, Resources.NoResultFunctor));
                        }
                        else if (!Plugin.IsMatchedStatusMethod(this.Method, this.ResultFunctor))
                        {
                            result.Add(new Node.ErrorCheck(this, ErrorCheckLevel.Error, Resources.WrongResultFunctor));
                        }
                    }
                }
            }

            base.CheckForErrors(rootBehavior, result);
        }
コード例 #4
0
ファイル: Node.ErrorCheck.cs プロジェクト: yh821/Zombie
 /// <summary>
 /// Creates a result from the error check.
 /// </summary>
 /// <param name="node">The node we checked.</param>
 /// <param name="level">The type of message we want to post.</param>
 /// <param name="description">The posted message.</param>
 public ErrorCheck(Node node, ErrorCheckLevel level, string description)
 {
     _node        = node;
     _level       = level;
     _description = description;
 }
コード例 #5
0
ファイル: Node.ErrorCheck.cs プロジェクト: KeyleXiao/behaviac
 public ErrorCheck(Node node, string label, ErrorCheckLevel level, string description)
 {
     _node = node;
     _level = level;
     _description = label + " : " + description;
 }
コード例 #6
0
ファイル: Plugin.cs プロジェクト: wuzhen/behaviac
        public static List<Node.ErrorCheck> GetErrorChecks(List<Node.ErrorCheck> errorChecks, ErrorCheckLevel errorLevel = ErrorCheckLevel.Error)
        {
            List<Node.ErrorCheck> errors = new List<Node.ErrorCheck>();
            foreach(Node.ErrorCheck error in errorChecks) {
                if (errorLevel == error.Level)
                { errors.Add(error); }
            }

            return errors;
        }
コード例 #7
0
			/// <summary>
			/// Creates a result from the error check.
			/// </summary>
			/// <param name="node">The node we checked.</param>
			/// <param name="level">The type of message we want to post.</param>
			/// <param name="description">The posted message.</param>
			public ErrorCheck(Node node, ErrorCheckLevel level, string description)
			{
				_node= node;
				_level= level;
				_description= description;
			}
コード例 #8
0
ファイル: Node.ErrorCheck.cs プロジェクト: 675492062/behaviac
 public ErrorCheck(Node node, int id, string label, ErrorCheckLevel level, string description) {
     _node = node;
     _level = level;
     _description = string.Format("{0}({1}) : {2}", label, id, description);
 }
コード例 #9
0
ファイル: Node.ErrorCheck.cs プロジェクト: 675492062/behaviac
            /// <summary>
            /// Creates a result from the error check.
            /// </summary>
            /// <param name="node">The node we checked.</param>
            /// <param name="level">The type of message we want to post.</param>
            /// <param name="description">The posted message.</param>
            public ErrorCheck(Node node, ErrorCheckLevel level, string description) {
                _node = node;
                _level = level;
                _description = description;

                if (_node != null)
                    _description = string.Format("{0}({1}) : {2}", _node.Label, _node.Id, description);
            }
コード例 #10
0
ファイル: Node.ErrorCheck.cs プロジェクト: chkob/behaviac-old
 public ErrorCheck(Node node, int id, string label, ErrorCheckLevel level, string description)
 {
     _node        = node;
     _level       = level;
     _description = string.Format("{0}({1}) : {2}", label, id, description);
 }
コード例 #11
0
 public ErrorCheck(Node node, string label, ErrorCheckLevel level, string description)
 {
     _node        = node;
     _level       = level;
     _description = label + " : " + description;
 }