public void Init(MapEditorController controller, MapEditorFullModel model)
        {
            this.controller = controller;

            context = model.GetScenario();
            model.ScenarioChangedEvent += this.ChangeScenario;
        }
        public TileUI(MapEditorController controller, CellComponent observable)
        {
            InitializeComponent();
            this.controller = controller;
            this.cell = observable;

            // Initialize Image
            if (observable != null)
            {
                // Register for TileChange event.
                observable.TileChangedEvent += this.ChangeTile;
                observable.UnitAddedEvent += this.UnitAddedToCell;
                observable.UnitRemovedEvent += this.UnitRemovedFromCell;

                TileFactory tf = TileFactory.Instance;
                this.Image = tf.getBitmapImproved(observable.GetTile());

                foreach (ModelComponent m in observable.EntitiesContainedWithin)
                {
                    if (m is UnitComponent)
                    {
                        UnitUI unitUI = new UnitUI(controller, m as UnitComponent);
                        Controls.Add(unitUI);
                        unitUI.MouseClick += TileUI_MouseDown;
                    }
                }
            }

            AllowDrop = true;
        }
        public void Init(MapEditorController controller, MapEditorFullModel model)
        {
            this.controller = controller;

            context = model.GetScenario();
            model.ScenarioChangedEvent += this.ChangeScenario;
        }
예제 #4
0
        public TileUI(MapEditorController controller, CellComponent observable)
        {
            InitializeComponent();
            this.controller = controller;
            this.cell       = observable;

            // Initialize Image
            if (observable != null)
            {
                // Register for TileChange event.
                observable.TileChangedEvent += this.ChangeTile;
                observable.UnitAddedEvent   += this.UnitAddedToCell;
                observable.UnitRemovedEvent += this.UnitRemovedFromCell;

                TileFactory tf = TileFactory.Instance;
                this.Image = tf.getBitmapImproved(observable.GetTile());

                foreach (ModelComponent m in observable.EntitiesContainedWithin)
                {
                    if (m is UnitComponent)
                    {
                        UnitUI unitUI = new UnitUI(controller, m as UnitComponent);
                        Controls.Add(unitUI);
                        unitUI.MouseClick += TileUI_MouseDown;
                    }
                }
            }



            AllowDrop = true;
        }
        public MapEditorView()
        {
            InitializeComponent();

            // Create the model.
            MapEditorFullModel model = new MapEditorFullModel();
            this.controller = new MapEditorController(model);
            controller.view = this;
            // Further initialize pieces of UI.
            tilePalette.loadImageList();
            tilePalette.setController(controller);
            mapViewComposite.Init(controller, model);
            unitPalette.Init(controller, model);
            buildingPalette1.Init(controller, model);
        }
        public MapEditorView()
        {
            InitializeComponent();

            // Create the model.
            MapEditorFullModel model = new MapEditorFullModel();

            this.controller = new MapEditorController(model);
            controller.view = this;
            // Further initialize pieces of UI.
            tilePalette.loadImageList();
            tilePalette.setController(controller);
            mapViewComposite.Init(controller, model);
            unitPalette.Init(controller, model);
            buildingPalette1.Init(controller, model);
        }
        public BuildingUI(MapEditorController controller, Building building)
        {
            InitializeComponent();

            this.controller = controller;
            this.building   = building;

            // Initialize Image
            if (building != null)
            {
                // TODO: Register for move events.

                // Get Image
                BitmapManager manager = BitmapManager.Instance;
                this.Image = manager.getBitmap(building.Type);
            }
        }
        public UnitUI(MapEditorController controller, UnitComponent unit)
        {
            InitializeComponent();

            this.controller = controller;
            this.unit       = unit;

            // Initialize Image
            if (unit != null)
            {
                // TODO: Register for move events.

                // Get Image
                BitmapManager manager = BitmapManager.Instance;
                this.Image = manager.getBitmap(unit.Type);
            }
        }
        public UnitUI(MapEditorController controller, UnitComponent unit)
        {
            InitializeComponent();

            this.controller = controller;
            this.unit = unit;

            // Initialize Image
            if (unit != null)
            {
                // TODO: Register for move events.

                // Get Image
                BitmapManager manager = BitmapManager.Instance;
                this.Image = manager.getBitmap(unit.Type);
            }
        }
        public BuildingUI(MapEditorController controller, Building building)
        {
            InitializeComponent();

            this.controller = controller;
            this.building = building;

            // Initialize Image
            if (building != null)
            {
                // TODO: Register for move events.

                // Get Image
                BitmapManager manager = BitmapManager.Instance;
                this.Image = manager.getBitmap(building.Type);
            }
        }
        public MapEditorView()
        {
            InitializeComponent();
            MapEditorModelOld      model     = new MapEditorModelOld();
            ImprovedMapEditorModel goodModel = new ImprovedMapEditorModel();

            this.controller = new MapEditorController(goodModel);
            // TODO Add all other views
            tilePalette.loadImageList();
            tilePalette.setController(controller);
            scenarioView1.setController(controller);
            model.register(tilePalette);
            model.register(scenarioView1);

            // TODO Remove this code, testing purposes only
            this.controller.createNewScenario();
            scenarioView1.SetScenario(goodModel.GetScenario());
            goodModel.RegisterObserver(scenarioView1);
            goodModel.GetScenario().GetGameWorld().NotifyAll();
        }
 public void setController(MapEditorController controller)
 {
     this.controller = controller;
 }
예제 #13
0
 public void setController(MapEditorController controller)
 {
     this.controller = controller;
 }
 public void Init(MapEditorController controller, MapEditorFullModel model)
 {
     this.controller = controller;
     SetScenario(model.GetScenario());
     model.ScenarioChangedEvent += new ZRTSModel.EventHandlers.ScenarioChangedHandler(ChangeScenario);
 }
 public void Init(MapEditorController controller, MapEditorFullModel model)
 {
     this.controller = controller;
     SetScenario(model.GetScenario());
     model.ScenarioChangedEvent += new ZRTSModel.EventHandlers.ScenarioChangedHandler(ChangeScenario);
 }