Exemplo n.º 1
0
        public static ConditionalDefinition DeserializeConditional(XmlNode node, bool isTextBlock)
        {
            ConditionalDefinition ret = new ConditionalDefinition();

            foreach (XmlNode subNode in node.ChildNodes)
            {
                if (SkipNode(subNode))
                {
                    continue;
                }
                if (subNode.Name == "switch")
                {
                    ret.switchProperty = subNode.Attributes["property"].Value;
                    foreach (XmlNode switchNode in subNode.ChildNodes)
                    {
                        if (SkipNode(switchNode))
                        {
                            continue;
                        }
                        if (switchNode.Name == "default")
                        {
                            ret.elseNode = DeserializeCase(switchNode, isTextBlock);
                        }
                        if (switchNode.Name == "case")
                        {
                            CaseDefinition switchCase = DeserializeCase(switchNode, isTextBlock);
                            ret.switchNodeList.Add(switchCase);
                        }
                    }
                }
                else
                {
                    if (ret.ifNode != null && subNode.Name == "if")
                    {
                        //when there are two if cases, ignore all but the first
                        //TODO: properly split apart conditional from switch in the XSD to enforce 1 minimum if
                        continue;
                    }
                    if (ret.ifNode == null && subNode.Name == "elseif")
                    {
                        //when there's no if case, convert the first elif to an if
                        ret.ifNode = DeserializeCase(subNode, isTextBlock);
                        continue;
                    }
                    if (subNode.Name == "if")
                    {
                        ret.ifNode = DeserializeCase(subNode, isTextBlock);
                    }
                    if (subNode.Name == "elseif")
                    {
                        ret.elseifNodeList.Add(DeserializeCase(subNode, isTextBlock));
                    }
                    if (subNode.Name == "else")
                    {
                        ret.elseNode = DeserializeCase(subNode, isTextBlock);
                    }
                }
            }
            return(ret);
        }
    private void CalculateTier(ConditionalDefinition <T> definition)
    {
        ConditionalTier <T>[] tiers = definition.Tiers;
        foreach (ConditionalTier <T> conditionalTier in tiers)
        {
            if (ConditionsMeetForTier(conditionalTier))
            {
                Tier = conditionalTier;
                AnalyticsTierName = (string.IsNullOrEmpty(conditionalTier.AnalyticsName) ? conditionalTier.name : conditionalTier.AnalyticsName);
                break;
            }
        }
        string key = $"cp.ConditionalPropertyLogged.{base.Key}";

        if (PlayerPrefs.GetInt(key, 0) == 0 && definition.SendAnalytics)
        {
            PlayerPrefs.SetInt(key, 1);
            if (Service.IsSet <ICPSwrveService>())
            {
                string str  = base.Key.ToLower();
                string tier = AnalyticsTierName.ToLower();
                Service.Get <ICPSwrveService>().Action("game." + str, tier);
            }
        }
    }
Exemplo n.º 3
0
    public ConditionalConfiguration(ConditionalDefinition[] definitionDataList)
    {
        int num = definitionDataList.Length;

        for (int i = 0; i < num; i++)
        {
            ConditionalDefinition conditionalDefinition = definitionDataList[i];
            properties[conditionalDefinition.name] = conditionalDefinition.GenerateProperty();
        }
    }
Exemplo n.º 4
0
        public ConditionalBlockModel(IdeCollection <IdeBaseItem> source) : base(source) //new
        {
            var _conditonalDefinition = new ConditionalDefinition();

            _wrapper = new LinkDefinition.LinkWrapper()
            {
                Conditional = _conditonalDefinition
            };

            Items = new IdeCollection <IdeBaseItem>(this, typeof(IBaseConditionalCase));
            Items.CollectionChanged += (a, b) =>
            {
                BuildConditionalDefinitions(b);
            };
            Items.Add(new IfCaseModel(Items));
            AddElseIfCommand = new RelayCommand(AddElseIf);
            AddElseCommand   = new RelayCommand(AddElse);
        }
Exemplo n.º 5
0
        public SwitchBlockModel(IdeCollection <IdeBaseItem> source) : base(source) //new
        {
            var _conditonalDefinition = new ConditionalDefinition();

            _wrapper = new LinkDefinition.LinkWrapper()
            {
                Conditional = _conditonalDefinition
            };

            Items = new IdeCollection <IdeBaseItem>(this);
            Items.CollectionChanged += (a, b) =>
            {
                BuildSwitchDefinitions(b);
            };
            Property = (PropertyItemModel)CustomProperties.First();
            Messenger.Default.Register <CustomPropertyChangedMessage>(this, action => CustomPropertyChanged(action));
            AddCaseCommand    = new RelayCommand(AddCase);
            AddDefaultCommand = new RelayCommand(AddDefault);
        }
Exemplo n.º 6
0
        public static LinkDefinition.LinkWrapper DeserializeLinkWrapper(XmlNode node, bool isTextBlock)
        {
            var ret = new LinkDefinition.LinkWrapper();

            if (node.Name == "link")
            {
                LinkDefinition link = DeserializeLink(node, isTextBlock);
                ret.Link = link;
            }
            if (node.Name == "conditional")
            {
                ConditionalDefinition conditional = DeserializeConditional(node, isTextBlock);
                ret.Conditional = conditional;
            }
            if (node.Name == "artoverlay")
            {
                BlockDefinition b = DeserializeArtOverlayBlock(node);
                ret.CardArtCrop = b;
            }
            return(ret);
        }
Exemplo n.º 7
0
 public ConditionalDefinitionDto(ConditionalDefinition conditionalDefinition)
 {
     _conditionalDefinition = conditionalDefinition;
 }
Exemplo n.º 8
0
 public ConditionalDefinitionDto(MethodDefinition methodDefinition, int instructionNumber)
 {
     _conditionalDefinition = new ConditionalDefinition(methodDefinition, instructionNumber);
 }
 public ConditionalProperty(ConditionalDefinition <T> definition)
 {
     base.Key     = definition.name;
     defaultValue = definition.DefaultValue;
     CalculateTier(definition);
 }