Пример #1
0
        /// <summary>
        /// Sets the activation condition expression for the build complex gateway
        /// </summary>
        /// <param name="conditionExpression">  the activation condition expression to set </param>
        /// <returns> the builder object </returns>
        public virtual B activationCondition(string conditionExpression)
        {
            ActivationCondition activationCondition = createInstance(typeof(ActivationCondition));

            activationCondition.TextContent = conditionExpression;
            element.ActivationCondition     = activationCondition;
            return(myself);
        }
Пример #2
0
        public static IActivationCondition CompileFilterCondition(FilterElement element, IEnumerable <Declaration> declarations)
        {
            var optimizer           = new ExpressionMultiParameterOptimizer <Func <object[], bool> >();
            var optimizedExpression = optimizer.CompactParameters(element.Expression, 0);
            var @delegate           = optimizedExpression.Compile();
            var fastDelegate        = Create(@delegate, element.Expression.Parameters.Count);
            var factMap             = IndexMap.CreateMap(element.Imports, declarations);
            var expression          = new ActivationCondition(element.Expression, fastDelegate, factMap);

            return(expression);
        }
Пример #3
0
        static public int CheckActivationCondition(ActivationCondition actCon)
        {
            int res = -1;

            if (actCon.ActivationMethodName == "מתוזמנת")
            {
                if (actCon.DistanceOrTimeParam == DateTime.Now.ToShortTimeString())
                {
                    res = ChangeDeviceStatus(actCon.CreatedByUserId, actCon.DeviceId, actCon.RoomId, actCon.TurnOn, 2, actCon.ActivationParam.ToString(), actCon.ConditionId.ToString());
                }
            }

            return(res);
        }
Пример #4
0
    //Проверить условия для появления варианта диалога
    bool CheckDialogOptionConditions(int optionNum)
    {
        bool isActive = true;

        for (int i = 0; i < nodes[currentNode].options[optionNum].conditions.Length; i++)
        {
            ActivationCondition currentCondition = nodes[currentNode].options[optionNum].conditions[i].condition;

            bool bValue;
            switch (currentCondition)
            {
            case ActivationCondition.QUEST_IS_ACTIVE:
                bValue   = Managers.questMgr.QuestIsActive(nodes[currentNode].options[optionNum].conditions[i].questID);
                isActive = isActive & bValue;
                break;

            case ActivationCondition.HAVE_AN_ITEM:
                bValue   = Managers.inventory.HaveAnItem(nodes[currentNode].options[optionNum].conditions[i].requiredItem);
                isActive = isActive & bValue;

                break;

            case ActivationCondition.NPC_IS_DEAD:
                bValue = false;
                NPC_Manager npc = nodes[currentNode].options[optionNum].conditions[i].npc;
                if (npc != null)
                {
                    bValue = npc.IsDead();
                }
                isActive = isActive & bValue;

                break;

            case ActivationCondition.QUEST_IS_COMPLETED:
                bValue   = Managers.questMgr.QuestIsComleted(nodes[currentNode].options[optionNum].conditions[i].questID);
                isActive = isActive & bValue;
                break;
            }
        }

        return(isActive);
    }
Пример #5
0
 static public JsonData GetActivationConditionDetails(ActivationCondition actCon)
 {
     return(DBService.GetActivationConditionDetails(actCon));
 }
Пример #6
0
 protected abstract void Process(StatusEffectInstance effect, ActivationCondition condition);
Пример #7
0
 public abstract bool IsValidCondition(ActivationCondition condition);
Пример #8
0
 bool CheckCondition(ActivationCondition condition)
 {
     return(conditions.Contains(condition));
 }