Exemplo n.º 1
0
        public static void DrawArea(IMapComponent component)
        {
            if (component == null)
            {
                return;
            }

            Console.WriteLine("Drawing ...");
            component.Draw(0, 0);
            Console.WriteLine("==============\n");
        }
Exemplo n.º 2
0
        public static void DrawArea(IMapComponent component)
        {
            if (component == null)
            {
                throw  new ArgumentNullException();
            }

            Console.WriteLine("Drawing ...");
            component.Draw(0, 0);
            Console.WriteLine("===========");
        }
Exemplo n.º 3
0
        public void AddComponent(IMapComponent component, int x, int y)
        {
            var container = new ComponentContainer
            {
                X         = x,
                Y         = y,
                Component = component
            };

            _components.Add(container);
            component.Parent = this;
        }
Exemplo n.º 4
0
        protected override void Initialize()
        {
            _editArea = new AreaRectangle(100, 50, 400, 450, new Color(255, 255, 255, 100));

            App.Register();
            _mouseComponent    = DependencyInjection.Resolve <IMouseComponent>();
            _mouseInput        = DependencyInjection.Resolve <IMouseInput>();
            _mouseDrawer       = DependencyInjection.Resolve <IMouseDrawer>();
            _settings          = DependencyInjection.Resolve <ISettings>();
            _map               = DependencyInjection.Resolve <IMapComponent>();
            _keyboardComponent = DependencyInjection.Resolve <IKeyboardComponent>();

            base.Initialize();
        }
Exemplo n.º 5
0
        private static void Main()
        {
            IMapComponent city = BuidCity();

            DrawArea(city);

            IMapComponent road = city.FindChild("Main Street");

            DrawArea(road);

            IMapComponent house = city.FindChild("House 2");

            DrawArea(house);

            Console.ReadLine();
        }
Exemplo n.º 6
0
        private static void Main()
        {
            IMapComponent city = BuildCity(FlyweightComponentFactory.Instance);

            DrawArea(city);

            IMapComponent road = city.FindChild("Main Street");

            DrawArea(road);

            IMapComponent house = city.FindChild("City Park");

            DrawArea(house);

            Console.WriteLine($"Total trees instances : {FlyweightComponentFactory.Instance.TotalTrees}");
            Console.WriteLine($"Total roads instances : {FlyweightComponentFactory.Instance.TotalRoads}");

            Console.Read();
        }
Exemplo n.º 7
0
 public void AddComponent(IMapComponent component)
 {
     _components.Add(component);
     component.Parent = this;
 }
Exemplo n.º 8
0
 public void AddComponent(int nodeID, IMapComponent component)
 {
     this.Areas[nodeID].components[component.GetType()] = component;
 }
Exemplo n.º 9
0
        protected override void Initialize()
        {
            _editArea = new AreaRectangle(100, 50, 400, 450, new Color(255, 255, 255, 100));

            App.Register();
            _mouseComponent = DependencyInjection.Resolve<IMouseComponent>();
            _mouseInput = DependencyInjection.Resolve<IMouseInput>();
            _mouseDrawer = DependencyInjection.Resolve<IMouseDrawer>();
            _settings = DependencyInjection.Resolve<ISettings>();
            _map = DependencyInjection.Resolve<IMapComponent>();
            _keyboardComponent = DependencyInjection.Resolve<IKeyboardComponent>();

            base.Initialize();
        }
Exemplo n.º 10
0
 public override CityBuilder BuildDistrict(IMapComponent component)
 {
     Component.AddComponent(component, 0, 0);
     return(this);
 }
Exemplo n.º 11
0
 public abstract CityBuilder BuildDistrict(IMapComponent component);
Exemplo n.º 12
0
 public override DistrictBuilder BuildRoad(IMapComponent component)
 {
     Component.AddComponent(component, 0, 0);
     return(this);
 }
Exemplo n.º 13
0
 public abstract DistrictBuilder BuildHouseArea(IMapComponent component);
Exemplo n.º 14
0
 public abstract DistrictBuilder BuildRoad(IMapComponent component);
Exemplo n.º 15
0
 public abstract DistrictBuilder BuildPark(IMapComponent component);