Esempio n. 1
0
        private void FillArenasCollection(ArenaCollection arenasCollection, SkinDefinitionContext skinDefinitionContext)
        {
            var arenasElementsByType = GetArenasGroupedByType();

            foreach (var arenaGroup in arenasElementsByType)
            {
                var arenaType = skinDefinitionContext.GetArenaType(arenaGroup.Key);

                var arena = new Arena(arenaType.Id, arenaType.Name, arenaGroup.Value.Any(element => ConvertDynamicValue <bool>(element.newGame) == true));

                foreach (var arenaLayoutElement in arenaGroup.Value)
                {
                    //make sure the JPVisible attribute is always there
                    var attributes = JsonUtils.ExtractAllAttributes((JObject)arenaLayoutElement);
                    if (!attributes.Any(a => a.Name == JsonNames.jpVisible))
                    {
                        attributes.Add(new AttributeValue(JsonNames.jpVisible, "false"));
                    }

                    var arenaLayout = new ArenaLayout(ExtractPlayerStatus(arenaLayoutElement.playerStatus), attributes);

                    FillArenaLayout(arenaLayout, arenaLayoutElement, skinDefinitionContext);

                    arena.Layouts.Add(arenaLayout);
                }

                arenasCollection.Add(arena);
            }
        }
Esempio n. 2
0
        private void FillArenasCollection(ArenaCollection arenasCollection, SkinDefinitionContext skinDefinitionContext)
        {
            var arenasElementsByType = ReadArenasXmlElements().Where(element => XmlValues.lobby != element.GetAttributeValue(XmlNames.type))
                                       .GroupBy(element => element.GetAttributeValue <int>(XmlNames.type))
                                       .ToDictionary(g => g.Key, g => g.ToList());

            foreach (var arenaGroup in arenasElementsByType)
            {
                var arenaType = skinDefinitionContext.GetArenaType(arenaGroup.Key);

                var arena = new Arena(arenaType.Id, arenaType.Name, arenaGroup.Value.Any(element => element.GetAttributeValue(XmlNames.newGame, false) == true));

                foreach (var arenaXmlElement in arenaGroup.Value)
                {
                    //make sure the JPVisible attribute is always there
                    var attributes = arenaXmlElement.ExtractAllAttributes();
                    if (!attributes.Any(a => a.Name == XmlNames.JPVisible))
                    {
                        attributes.Add(new AttributeValue(XmlNames.JPVisible, "false"));
                    }

                    var arenaLayout = new ArenaLayout(arenaXmlElement.GetAttributeValue(XmlNames.playerStatus),
                                                      attributes);



                    FillArenaLayout(arenaLayout, arenaXmlElement, skinDefinitionContext);

                    arena.Layouts.Add(arenaLayout);
                }



                arenasCollection.Add(arena);
            }
        }