public MatchCondition(JToken node) : base(node)
 {
     if (node["values"] != null)
     {
         this._Values = new List <StringValue>();
         foreach (var arrayNode in node["values"].Children())
         {
             this._Values.Add(ObjectFactory.Create <StringValue>(arrayNode));
         }
     }
     if (node["matchType"] != null)
     {
         this._MatchType = (MatchConditionType)StringEnum.Parse(typeof(MatchConditionType), node["matchType"].Value <string>());
     }
 }
Exemplo n.º 2
0
        public MatchConditionInfo(MatchCondition matchCondition)
        {
            if (matchCondition == null)
            {
                throw new ArgumentNullException(nameof(matchCondition));
            }

            Type         = matchCondition.type;
            TokenType    = matchCondition.tokenType;
            BoolValue    = matchCondition.boolValue;
            ResourceType = matchCondition.resourceType;
            Comparison   = matchCondition.comparison;
            Val          = matchCondition.val;
            Inverse      = matchCondition.inverse;

            TokenDefinitionID = matchCondition.tokenDefinition?.id ?? -1;
        }
Exemplo n.º 3
0
 public MatchConditionInfo(MatchConditionType type,
                           MatchConditionTokenType tokenType,
                           PuzzleResourceType resourceType,
                           NumberComparisonType comparison,
                           int val,
                           int tokenDefinitionID,
                           bool boolValue,
                           bool inverse)
 {
     Type              = type;
     TokenType         = tokenType;
     TokenDefinitionID = tokenDefinitionID;
     BoolValue         = boolValue;
     ResourceType      = resourceType;
     Comparison        = comparison;
     Val     = val;
     Inverse = inverse;
 }
        public MatchCondition(XmlElement node) : base(node)
        {
            foreach (XmlElement propertyNode in node.ChildNodes)
            {
                switch (propertyNode.Name)
                {
                case "values":
                    this._Values = new List <StringValue>();
                    foreach (XmlElement arrayNode in propertyNode.ChildNodes)
                    {
                        this._Values.Add(ObjectFactory.Create <StringValue>(arrayNode));
                    }
                    continue;

                case "matchType":
                    this._MatchType = (MatchConditionType)StringEnum.Parse(typeof(MatchConditionType), propertyNode.InnerText);
                    continue;
                }
            }
        }
Exemplo n.º 5
0
        public MatchConditionItem(string str)
        {
            if (!string.IsNullOrEmpty(str))
            {
                string[] list = str.Split('#');

                type = (MatchConditionType)Enum.Parse(typeof(MatchConditionType), list[0]);

                if (list.Length > 1)
                {
                    string[] list2 = list[1].Split('|');

                    if (list2.Length > 0)
                    {
                        args1 = float.Parse(list2[0]);
                    }

                    if (list2.Length > 1)
                    {
                        string[] data1 = list2[1].Split('_');
                        for (int i = 0; i < data1.Length; i++)
                        {
                            paramsList1.Add(float.Parse(data1[i]));
                        }
                    }

                    if (list2.Length > 2)
                    {
                        string[] data2 = list2[2].Split('_');
                        for (int i = 0; i < data2.Length; i++)
                        {
                            paramsList2.Add(float.Parse(data2[i]));
                        }
                    }
                }
            }
        }