예제 #1
0
        public DrawerBase GetDecoratorDrawer(DrawerFactoryBase drawerFactory, Village village, BackgroundDrawerData mainData)
        {
            DecoratorDrawerData data = _cache
                                       .Where(x => village.Type.HasFlag(x.Key))
                                       .Select(x => x.Value)
                                       .FirstOrDefault();

            if (data == null)
            {
                return(null);
            }

            return(drawerFactory.CreateVillageDecoratorDrawer(data, mainData));
        }
예제 #2
0
        public Display(DisplaySettings settings, bool isMiniMap, Map map, ref Location location)
            : this(settings, map)
        {
            // Validate zoom or we have a potential divide by zero etc
            if (isMiniMap)
            {
                ZoomInfo zoom = DrawerFactoryBase.CreateMiniMapZoom(location.Zoom);
                location = zoom.Validate(location);

                _drawerFactoryStrategy = DrawerFactoryBase.CreateMiniMap(location.Zoom);
            }
            else
            {
                ZoomInfo zoom = DrawerFactoryBase.CreateZoom(location.Display, location.Zoom);
                location = ValidateZoom(zoom, location);

                _drawerFactoryStrategy = DrawerFactoryBase.Create(location.Display, location.Zoom, settings.Scenery);
            }

            // TODO: make this lazy. Setting here = crash
            // Is fixed by calling UpdateLocation after Map.Location is set
            //_visibleRectangle = GetGameRectangle();
        }
예제 #3
0
 public IEnumerable <DrawerBase> GetDecoratorDrawers(DrawerFactoryBase drawerFactory, Village village, BackgroundDrawerData mainData)
 {
     return(_decorators
            .Select(decorator => decorator.GetDecoratorDrawer(drawerFactory, village, mainData))
            .Where(drawer => drawer != null));
 }