Exemple #1
0
        /// <summary>
        /// Paint grass, mountains, ...
        /// </summary>
        private void PaintNonVillage(Graphics g, Point game, Rectangle mapVillage)
        {
            DrawerBase finalCache = _drawerFactoryStrategy.CreateNonVillageDrawer(game, mapVillage);

            if (finalCache != null)
            {
                finalCache.PaintVillage(g, mapVillage);
            }
        }
Exemple #2
0
        /// <summary>
        /// Draws a village on the map
        /// </summary>
        /// <param name="g">The graphics object</param>
        /// <param name="game">The game location of the village</param>
        /// <param name="mapVillage">Where and how big to draw the village</param>
        private void Paint(Graphics g, Point game, Rectangle mapVillage)
        {
            if (!(game.X >= 0 && game.X < 1000 && game.Y >= 0 && game.Y < 1000))
            {
                return;
            }

            Village    village;
            DrawerBase finalCache = null;

            if (World.Default.Villages.TryGetValue(game, out village))
            {
                Marker marker = _markers.GetMarker(Settings, village);
                if (marker != null)
                {
                    // Paint village icon/shape
                    BackgroundDrawerData mainData = World.Default.Views.GetBackgroundDrawerData(village, marker);
                    if (mainData != null)
                    {
                        finalCache = _drawerFactoryStrategy.CreateVillageDrawer(village.Bonus, mainData, marker);
                        if (finalCache != null)
                        {
                            finalCache.PaintVillage(g, mapVillage);

                            if (_drawerFactoryStrategy.SupportDecorators && village.Type != VillageType.None)
                            {
                                // Paint extra village decorators
                                foreach (DrawerBase decorator in World.Default.Views.GetDecoratorDrawers(_drawerFactoryStrategy, village, mainData))
                                {
                                    decorator.PaintVillage(g, mapVillage);
                                }
                            }
                        }
                    }
                }
            }

            if (finalCache == null)
            {
                PaintNonVillage(g, game, mapVillage);
            }
        }