Exemple #1
0
 public void notify(MapEditorModelOld model)
 {
     if (model.SelectionType == SelectionType.Tile)
     {
         currentlyDisplayedTileType = model.TileTypeSelected;
         TileFactory tf = TileFactory.Instance;
         tilePreview.Image = tf.getBitmap(currentlyDisplayedTileType);
     }
     else
     {
         currentlyDisplayedTileType = null;
         tilePreview.Image          = null;
     }
 }
 public void notify(MapEditorModelOld model)
 {
     if (model.SelectionType == SelectionType.Tile)
     {
         currentlyDisplayedTileType = model.TileTypeSelected;
         TileFactory tf = TileFactory.Instance;
         tilePreview.Image = tf.getBitmap(currentlyDisplayedTileType);
     }
     else
     {
         currentlyDisplayedTileType = null;
         tilePreview.Image = null;
     }
 }
        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();
        }
Exemple #4
0
 public void update(MapEditorModelOld model)
 {
     /*TileFactory tf = TileFactory.Instance;
      *
      * Bitmap pg = new Bitmap(800,600);
      * Graphics gr = Graphics.FromImage(pg);
      *
      * Map map = model.scenario.getGameWorld().map;
      *
      * // TODO: Change to include the scrolling model.
      * for (int x = 0; x < map.width; x++) {
      *  for (int y = 0; y < map.height; y++) {
      *      if (map.cells[x, y] != null && map.cells[x,y].tile != null && map.cells[x,y].tile.tileType != null)
      *          gr.DrawImage(tf.getBitmap(map.cells[x,y].tile.tileType), x * 16, y * 16,16,16);
      *      else
      *          gr.DrawRectangle(new Pen(Color.Black), x * 16, y * 16, 16, 16);
      *  }
      * }
      * pictureBox1.Image = pg;*/
 }
 public MapEditorController(ImprovedMapEditorModel model)
 {
     this.model         = null;
     this.improvedModel = model;
 }
 public MapEditorController(MapEditorModelOld model)
 {
     this.model         = model;
     this.improvedModel = new ImprovedMapEditorModel();
 }
 public void notify(MapEditorModelOld model)
 {
     update(model);
 }
        public void update(MapEditorModelOld model)
        {
            /*TileFactory tf = TileFactory.Instance;

            Bitmap pg = new Bitmap(800,600);
            Graphics gr = Graphics.FromImage(pg);

            Map map = model.scenario.getGameWorld().map;

            // TODO: Change to include the scrolling model.
            for (int x = 0; x < map.width; x++) {
                for (int y = 0; y < map.height; y++) {
                    if (map.cells[x, y] != null && map.cells[x,y].tile != null && map.cells[x,y].tile.tileType != null)
                        gr.DrawImage(tf.getBitmap(map.cells[x,y].tile.tileType), x * 16, y * 16,16,16);
                    else
                        gr.DrawRectangle(new Pen(Color.Black), x * 16, y * 16, 16, 16);
                }
            }
            pictureBox1.Image = pg;*/
        }
Exemple #9
0
 public void notify(MapEditorModelOld model)
 {
     update(model);
 }
 public MapEditorController(ImprovedMapEditorModel model)
 {
     this.model = null;
     this.improvedModel = model;
 }
 public MapEditorController(MapEditorModelOld model)
 {
     this.model = model;
     this.improvedModel = new ImprovedMapEditorModel();
 }