Beispiel #1
0
        public override void ReadDrawerXml(XElement drawer)
        {
            DecoratorDrawerData.IconData  icon  = null;
            DecoratorDrawerData.ShapeData shape = null;

            var villageType = (VillageType)Enum.Parse(typeof(VillageType), drawer.Attribute("VillageType").Value);

            var xShape = drawer.Element("Shape");

            if (xShape != null)
            {
                shape = new DecoratorDrawerData.ShapeData(
                    xShape.Attribute("Drawer").Value,
                    XmlHelper.GetColor(xShape.Attribute("Color").Value));
            }

            var xIcon = drawer.Element("Icon");

            if (xIcon != null)
            {
                Color?backgroundColor  = null;
                var   xBackgroundColor = xIcon.Attribute("Background");
                if (xBackgroundColor != null)
                {
                    backgroundColor = XmlHelper.GetColor(xBackgroundColor.Value);
                }

                icon = new DecoratorDrawerData.IconData(
                    xIcon.Attribute("Icon").Value,
                    (IconOrientation)Enum.Parse(typeof(IconOrientation), xIcon.Attribute("Orientation").Value),
                    backgroundColor);
            }

            var data = new DecoratorDrawerData(shape, icon);

            _cache.Add(villageType, data);
        }
 public IconDrawerDecorator(DecoratorDrawerData.IconData data)
 {
     _data = data;
 }
 public IconDrawerDecorator(DecoratorDrawerData.IconData data)
 {
     _data = data;
 }