public static void DrawArea(IMapComponent component) { if (component == null) { return; } Console.WriteLine("Drawing ..."); component.Draw(0, 0); Console.WriteLine("==============\n"); }
public static void DrawArea(IMapComponent component) { if (component == null) { throw new ArgumentNullException(); } Console.WriteLine("Drawing ..."); component.Draw(0, 0); Console.WriteLine("==========="); }
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; }
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(); }
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(); }
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(); }
public void AddComponent(IMapComponent component) { _components.Add(component); component.Parent = this; }
public void AddComponent(int nodeID, IMapComponent component) { this.Areas[nodeID].components[component.GetType()] = component; }
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(); }
public override CityBuilder BuildDistrict(IMapComponent component) { Component.AddComponent(component, 0, 0); return(this); }
public abstract CityBuilder BuildDistrict(IMapComponent component);
public override DistrictBuilder BuildRoad(IMapComponent component) { Component.AddComponent(component, 0, 0); return(this); }
public abstract DistrictBuilder BuildHouseArea(IMapComponent component);
public abstract DistrictBuilder BuildRoad(IMapComponent component);
public abstract DistrictBuilder BuildPark(IMapComponent component);