Esempio n. 1
0
        /// <summary>
        /// Draws the brush onto the given screen at the given tile location.
        /// Returns an "undo brush" - a brush of all tiles that were overwritten.
        /// Returns null if no tiles were changed.
        /// </summary>
        public ITileBrush DrawOn(ScreenDocument screen, int tile_x, int tile_y)
        {
            TileBrush undo    = new TileBrush(Width, Height);
            bool      changed = false;

            foreach (TileBrushCell[] col in cells)
            {
                foreach (TileBrushCell cell in col)
                {
                    var old = screen.TileAt(cell.x + tile_x, cell.y + tile_y);

                    if (old == null)
                    {
                        continue;
                    }
                    undo.AddTile(old, cell.x, cell.y);
                    if (old.Id != cell.tile.Id)
                    {
                        changed = true;
                        screen.ChangeTile(cell.x + tile_x, cell.y + tile_y, cell.tile.Id);
                    }
                }
            }

            if (changed)
            {
                return(undo);
            }
            return(null);
        }
Esempio n. 2
0
        private void ScreenRenamed(string oldName, string newName)
        {
            if (!screens.ContainsKey(oldName))
            {
                return;
            }
            ScreenDocument doc = screens[oldName];

            screens.Remove(oldName);
            screens.Add(newName, doc);
            if (map.StartScreen == oldName)
            {
                map.StartScreen = newName;
            }
            foreach (var join in Joins)
            {
                if (join.screenOne == oldName)
                {
                    join.screenOne = newName;
                }
                if (join.screenTwo == oldName)
                {
                    join.screenTwo = newName;
                }
            }
            Dirty = true;
        }
Esempio n. 3
0
        public void AddScreen(string name, int tile_width, int tile_height)
        {
            var screen = new MegaMan.Common.ScreenInfo(name, Tileset);

            int[][] tiles = new int[tile_height][];
            for (int y = 0; y < tile_height; y++)
            {
                tiles[y] = new int[tile_width];
            }

            screen.Layers.Add(new ScreenLayerInfo(name, new TileLayer(tiles, Tileset, 0, 0), new List <EntityPlacement>(), new List <ScreenLayerKeyframe>()));

            map.Screens.Add(name, screen);

            if (StartScreen == null)
            {
                StartScreen = map.Screens.Keys.First();
            }

            ScreenDocument doc = WrapScreen(screen);

            // now I can do things like fire an event... how useful!
            if (ScreenAdded != null)
            {
                ScreenAdded(doc);
            }

            Save();
        }
Esempio n. 4
0
        private ScreenDocument WrapScreen(MegaMan.Common.ScreenInfo screen)
        {
            ScreenDocument doc = new ScreenDocument(screen, this);

            screens.Add(screen.Name, doc);
            doc.Renamed     += ScreenRenamed;
            doc.TileChanged += () => Dirty = true;
            return(doc);
        }
Esempio n. 5
0
        // this implies editing a screen
        private ScreenProp(ScreenDocument screen)
        {
            InitializeComponent();

            this.screen = screen;
            stage = screen.Stage;

            textName.Text = screen.Name;
            widthField.Value = screen.Width;
            heightField.Value = screen.Height;
        }
Esempio n. 6
0
        // this implies editing a screen
        private ScreenProp(ScreenDocument screen)
        {
            InitializeComponent();

            this.screen = screen;
            stage       = screen.Stage;

            textName.Text     = screen.Name;
            widthField.Value  = screen.Width;
            heightField.Value = screen.Height;
        }
Esempio n. 7
0
        private ScreenDrawingSurface CreateScreenSurface(ScreenDocument screen)
        {
            var surface = new ScreenDrawingSurface(screen);

            surfaces.Add(screen.Name, surface);
            screen.Renamed    += this.RenameSurface;
            screen.Resized    += (w, h) => this.AlignScreenSurfaces();
            surface.Edited    += new EventHandler <ScreenEditEventArgs>(surface_Edited);
            surface.Activated += () => { ActiveSurface = surface; };

            this.Controls.Add(surface);
            joinOverlay.Add(surface);
            return(surface);
        }
Esempio n. 8
0
        public void RunTestFromStage(ScreenDocument screen, Point location)
        {
            if (enginePath == null || !File.Exists(enginePath))
            {
                loadEnginePath();
            }

            string args = String.Format("\"{0}\" \"Stage\\{1}\" \"{2}\" \"{3},{4}\"",
                                        activeProject.Project.GameFile,
                                        screen.Stage.Name,
                                        screen.Name,
                                        location.X.ToString(),
                                        location.Y.ToString());

            Process.Start(enginePath, args);
        }
Esempio n. 9
0
        public virtual ITileBrush DrawOn(ScreenDocument screen, int tile_x, int tile_y)
        {
            var old = screen.TileAt(tile_x, tile_y);

            if (old == null)
            {
                return(null);
            }

            if (old.Id == tile.Id)
            {
                return(null);
            }

            screen.ChangeTile(tile_x, tile_y, tile.Id);
            return(new SingleTileBrush(old));
        }
Esempio n. 10
0
        public ScreenDrawingSurface(ScreenDocument screen)
        {
            Screen = screen;
            SizeMode = PictureBoxSizeMode.StretchImage;

            BackColor = SystemColors.Control;
            BackgroundImageLayout = ImageLayout.None;

            BuildLayers();

            Screen.Resized += (w, h) => ResizeLayers();

            Program.AnimateTick += Animate;
            Program.FrameTick += SelectionAnimate;

            RedrawJoins();
            ReDrawAll();

            MainForm.Instance.DrawOptionToggled += ReDrawMaster;

            selectionPen = new Pen(Color.LimeGreen, 2);
            selectionPen.DashPattern = new float[] { 3, 2 };
        }
Esempio n. 11
0
        public ScreenDrawingSurface(ScreenDocument screen)
        {
            Screen   = screen;
            SizeMode = PictureBoxSizeMode.StretchImage;

            BackColor             = SystemColors.Control;
            BackgroundImageLayout = ImageLayout.None;

            BuildLayers();

            Screen.Resized += (w, h) => ResizeLayers();

            Program.AnimateTick += Animate;
            Program.FrameTick   += SelectionAnimate;

            RedrawJoins();
            ReDrawAll();

            MainForm.Instance.DrawOptionToggled += ReDrawMaster;

            selectionPen             = new Pen(Color.LimeGreen, 2);
            selectionPen.DashPattern = new float[] { 3, 2 };
        }
Esempio n. 12
0
        public void RunTestFromStage(ScreenDocument screen, Point location)
        {
            if (enginePath == null || !File.Exists(enginePath))
            {
                loadEnginePath();
            }

            string args = String.Format("\"{0}\" \"Stage\\{1}\" \"{2}\" \"{3},{4}\"",
                activeProject.Project.GameFile,
                screen.Stage.Name,
                screen.Name,
                location.X.ToString(),
                location.Y.ToString());

            Process.Start(enginePath, args);
        }
Esempio n. 13
0
        private ScreenDrawingSurface CreateScreenSurface(ScreenDocument screen)
        {
            var surface = new ScreenDrawingSurface(screen);
            surfaces.Add(screen.Name, surface);
            screen.Renamed += this.RenameSurface;
            screen.Resized += (w, h) => this.AlignScreenSurfaces();
            surface.Edited += new EventHandler<ScreenEditEventArgs>(surface_Edited);
            surface.Activated += () => { ActiveSurface = surface; };

            this.Controls.Add(surface);
            joinOverlay.Add(surface);
            return surface;
        }
Esempio n. 14
0
        /// <summary>
        /// Draws the brush onto the given screen at the given tile location.
        /// Returns an "undo brush" - a brush of all tiles that were overwritten.
        /// Returns null if no tiles were changed.
        /// </summary>
        public ITileBrush DrawOn(ScreenDocument screen, int tile_x, int tile_y)
        {
            TileBrush undo = new TileBrush(Width, Height);
            bool changed = false;
            foreach (TileBrushCell[] col in cells) {
                foreach (TileBrushCell cell in col) {
                    var old = screen.TileAt(cell.x + tile_x, cell.y + tile_y);

                    if (old == null)
                        continue;
                    undo.AddTile(old, cell.x, cell.y);
                    if (old.Id != cell.tile.Id) {
                        changed = true;
                        screen.ChangeTile(cell.x + tile_x, cell.y + tile_y, cell.tile.Id);
                    }
                }
            }

            if (changed) return undo;
            return null;
        }
Esempio n. 15
0
        public virtual ITileBrush DrawOn(ScreenDocument screen, int tile_x, int tile_y)
        {
            var old = screen.TileAt(tile_x, tile_y);

            if (old == null)
            {
                return null;
            }

            if (old.Id == tile.Id)
            {
                return null;
            }

            screen.ChangeTile(tile_x, tile_y, tile.Id);
            return new SingleTileBrush(old);
        }
Esempio n. 16
0
 private ScreenDocument WrapScreen(MegaMan.Common.Screen screen)
 {
     ScreenDocument doc = new ScreenDocument(screen, this);
     screens.Add(screen.Name, doc);
     doc.Renamed += ScreenRenamed;
     doc.TileChanged += () => Dirty = true;
     return doc;
 }
Esempio n. 17
0
 public static void EditScreen(ScreenDocument screen)
 {
     new ScreenProp(screen).Show();
 }
Esempio n. 18
0
 public ScreenNodeHandler(ProjectEditor project, TreeNode node, ScreenDocument screen) : base(project, node)
 {
     this.screen = screen;
 }
 public ScreenNodeHandler(ProjectEditor project, TreeNode node, ScreenDocument screen)
     : base(project, node)
 {
     this.screen = screen;
 }
Esempio n. 20
0
 public static void EditScreen(ScreenDocument screen)
 {
     new ScreenProp(screen).Show();
 }