예제 #1
0
        //public void Immobilizing(ref BaseCharacterModel CharacterModel, float deltaTime)
        //{

        //}

        //public void Blinding(ref BaseCharacterModel CharacterModel, float deltaTime)
        //{

        //}

        //public void KnokingDown(ref BaseCharacterModel CharacterModel, float deltaTime)
        //{

        //}

        //public void Stuning(ref BaseCharacterModel CharacterModel, float deltaTime)
        //{

        //}

        //public void Poison(ref BaseCharacterModel CharacterModel, float deltaTime)
        //{

        //}

        //public void Weak(ref BaseCharacterModel CharacterModel, float deltaTime)
        //{

        //}

        #endregion

        #endregion

        #region Изменение статуса состояний

        /// <summary>
        ///     Вызывается каждый раз при изменении статуса состояния
        /// </summary>
        /// <param name="Args">Содержит информацию об изменившемся статусе</param>
        private void ConditionStatusHasChanged(ConditionArgs Args)
        {
            if ((Args.ConditionName == "Alive") & (Args.ConditionStatus == false))
            {
                CharacterDeathStatus();
            }

            else
            {
                if (Args.ConditionStatus == false)
                {
                    ActiveConditionsCheck();
                }

                else
                {
                    if (!Conditions.CurrentConditionStatus(Args.ConditionName))
                    {
                        ConditionsUpdateEvent += ConditionsMethods[Args.ConditionName];
                    }
                    else
                    {
                        ConditionTimers[Args.ConditionName] = 0;
                    }

                    ActiveConditionsCheck();
                }
            }
        }
        public bool Evaluate(ConditionArgs args)
        {
            if (args == null)
            {
                throw new ArgumentNullException("args");
            }

            //TODO
            return(false);
        }
        public bool Evaluate(ConditionArgs args)
        {
            if (args == null)
            {
                throw new ArgumentNullException("args");
            }

            //TODO
            return false;
        }
        /// <summary>
        /// Evaluate handler condition
        /// </summary>
        /// <param name="args"></param>
        /// <returns></returns>
        public bool Evaluate(ConditionArgs args)
        {
            bool isMatch = false;

            IHttpHandler handler = (HttpContext.Current != null ?
                                        HttpContext.Current.CurrentHandler :
                                        null);

            if (handler != null && _handlerType != null) {
                isMatch = handler.GetType().Equals(_handlerType);
            }

            return isMatch;
        }
        /// <summary>
        /// Evaluate handler condition
        /// </summary>
        /// <param name="args"></param>
        /// <returns></returns>
        public bool Evaluate(ConditionArgs args)
        {
            bool isMatch = false;

            IHttpHandler handler = (HttpContext.Current != null ?
                                    HttpContext.Current.CurrentHandler :
                                    null);

            if (handler != null && _handlerType != null)
            {
                isMatch = handler.GetType().Equals(_handlerType);
            }

            return(isMatch);
        }
예제 #6
0
        /// <summary>
        /// Verify URL condition
        /// </summary>
        /// <param name="args"></param>
        /// <returns></returns>
        public bool Evaluate(ConditionArgs args)
        {
            if (args == null)
            {
                throw new ArgumentNullException();
            }


            HttpRequest request = HttpContext.Current != null ? HttpContext.Current.Request : null;

            if (request != null)
            {
                return(_url.IsMatch(request.Url.ToString()));
            }
            return(false);
        }
예제 #7
0
        /// <summary>
        /// Test if the current user identity and roles matches
        /// </summary>
        /// <returns></returns>
        public bool Evaluate(ConditionArgs args)
        {
            if (args == null)
            {
                throw new ArgumentNullException("args");
            }

            // Get user identity
            IPrincipal userPrincipal = Esapi.SecurityConfiguration.CurrentUser;
            IIdentity  userIdentity  = (userPrincipal != null ? userPrincipal.Identity : null);

            if (userIdentity == null)
            {
                return(false);
            }

            // Get user name
            string userName = userIdentity.Name;

            if (string.IsNullOrEmpty(userName))
            {
                return(false);
            }

            // Match user name
            if (!_userName.IsMatch(userName))
            {
                return(false);
            }

            // Match roles
            foreach (string role in _roles)
            {
                if (!userPrincipal.IsInRole(role))
                {
                    return(false);
                }
            }

            // Roles match
            return(true);
        }
예제 #8
0
    /// <summary>
    /// 生成行为节点
    /// </summary>
    /// <param name="paramsPacker">行为数据</param>
    /// <returns>行为节点类</returns>
    public override IFormula GetFormula(FormulaParamsPacker paramsPacker)
    {
        IFormula result = null;

        // 数据本地化
        var myCondition     = Condition;
        var myConditionArgs = ConditionArgs.Replace(" ", "").Split('_');

        var check = registerCondition[myCondition];

        // 创建行为
        result = new Formula((callback, scope) =>
        {
            // 如果符合条件则执行子级技能
            // 否则继续
            if (check(paramsPacker, myConditionArgs))
            {
                // 获取子级技能
                if (SubFormulaItem != null)
                {
                    // 执行子级技能
                    var subSkill      = new SkillInfo(paramsPacker.SkillNum);
                    subSkill.DataList = paramsPacker.DataList;
                    subSkill.AddActionFormulaItem(SubFormulaItem);
                    SkillManager.Single.DoSkillInfo(subSkill, paramsPacker, true);
                }
            }
            else if (IsBreak > 0)
            {
                // 跳出其后面的所有流程
                result.CanMoveNext = false;
            }
        }, FormulaType);


        return(result);
    }
        /// <summary>
        ///     Verify URL condition
        /// </summary>
        /// <param name="args"></param>
        /// <returns></returns>
        public bool Evaluate(ConditionArgs args)
        {
            if (args == null)
            {
                throw new ArgumentNullException();
            }

            HttpRequest request = HttpContext.Current != null ? HttpContext.Current.Request : null;
            if (request != null)
            {
                return this._url.IsMatch(request.Url.ToString());
            }
            return false;
        }
예제 #10
0
 /// <summary>
 /// Eval
 /// </summary>
 /// <param name="args"></param>
 /// <returns></returns>
 public bool Evaluate(ConditionArgs args)
 {
     return(_value);
 }
        /// <summary>
        ///     Test if the current user identity and roles matches
        /// </summary>
        /// <returns></returns>
        public bool Evaluate(ConditionArgs args)
        {
            if (args == null)
            {
                throw new ArgumentNullException("args");
            }

            // Get user identity
            IPrincipal userPrincipal = Esapi.SecurityConfiguration.CurrentUser;
            IIdentity userIdentity = (userPrincipal != null ? userPrincipal.Identity : null);

            if (userIdentity == null)
            {
                return false;
            }

            // Get user name
            string userName = userIdentity.Name;
            if (string.IsNullOrEmpty(userName))
            {
                return false;
            }

            // Match user name
            if (!this._userName.IsMatch(userName))
            {
                return false;
            }

            // Match roles
            foreach (string role in this._roles)
            {
                if (!userPrincipal.IsInRole(role))
                {
                    return false;
                }
            }

            // Roles match
            return true;
        }
 /// <summary>
 /// Eval
 /// </summary>
 /// <param name="args"></param>
 /// <returns></returns>
 public bool Evaluate(ConditionArgs args)
 {
     return _value;
 }
예제 #13
0
 public override bool Passed(ConditionArgs args)
 {
     return(args.ShipAbilityHost.State.Force > 0);
 }