Exemple #1
0
 public static void CreateStage(ProjectEditor project)
 {
     var form = new StageProp();
     form.project = project;
     form.Text = "New Stage Properties";
     form.Show();
 }
Exemple #2
0
        public static ProjectEditor FromFile(string path)
        {
            var p = new ProjectEditor();

            //p.Project.Load(path);
            p.LoadIncludes();
            return(p);
        }
Exemple #3
0
        public static void CreateStage(ProjectEditor project)
        {
            var form = new StageProp();

            form.project = project;
            form.Text    = "New Stage Properties";
            form.Show();
        }
        public StageDocument(ProjectEditor project, string basepath, string filepath)
        {
            Project = project;
            map = new Map(FilePath.FromAbsolute(filepath, basepath));

            // wrap all map screens in screendocuments
            // this should be the only time MegaMan.Screen's are touched directly
            foreach (var pair in map.Screens)
            {
                WrapScreen(pair.Value);
            }
        }
        public StageDocument(ProjectEditor project, string basepath, string filepath)
        {
            Project = project;
            map     = new StageInfo(FilePath.FromAbsolute(filepath, basepath));

            // wrap all map screens in screendocuments
            // this should be the only time MegaMan.Screen's are touched directly
            foreach (var pair in map.Screens)
            {
                WrapScreen(pair.Value);
            }
        }
        public ProjectProperties(ProjectEditor project)
        {
            InitializeComponent();

            editor = project;
            Text = project.Name + " Properties";
            textName.Text = project.Name;
            textAuthor.Text = project.Author;
            textWidth.Text = project.ScreenWidth.ToString();
            textHeight.Text = project.ScreenHeight.ToString();

            panelLocation.Visible = false;
            Height -= panelLocation.Height;
        }
        public ProjectProperties(ProjectEditor project)
        {
            InitializeComponent();

            editor          = project;
            Text            = project.Name + " Properties";
            textName.Text   = project.Name;
            textAuthor.Text = project.Author;
            textWidth.Text  = project.ScreenWidth.ToString();
            textHeight.Text = project.ScreenHeight.ToString();

            panelLocation.Visible = false;
            Height -= panelLocation.Height;
        }
        private void buttonOK_Click(object sender, EventArgs e)
        {
            int width, height;

            if (!int.TryParse(textWidth.Text, out width) || !int.TryParse(textHeight.Text, out height))
            {
                MessageBox.Show("Positive integers are required for screen size.", "CME Project Editor", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return;
            }

            bool gameNew = (editor == null);

            if (gameNew)
            {
                string baseDir = System.IO.Path.Combine(textDir.Text, textName.Text);
                if (System.IO.Directory.Exists(baseDir))
                {
                    MessageBox.Show(
                        String.Format("Could not create the project because a directory named {0} already exists at the specified location.", textName.Text),
                        "CME Project Editor", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    return;
                }

                try
                {
                    System.IO.Directory.CreateDirectory(baseDir);
                }
                catch
                {
                    MessageBox.Show(
                        "Could not create the project because the system was unable to create a directory at the specified location.",
                        "CME Project Editor", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    return;
                }

                editor = ProjectEditor.CreateNew();
            }

            editor.Name         = (textName.Text == "")? "Untitled" : textName.Text;
            editor.Author       = textAuthor.Text;
            editor.ScreenWidth  = lastWidth;
            editor.ScreenHeight = lastHeight;

            if (gameNew)
            {
                editor.Save();
                MainForm.Instance.projectForm.AddProject(editor);
            }
            Close();
        }
Exemple #9
0
        public void FocusScreen(StageDocument stage)
        {
            if (stage != activeStage)
            {
                ActiveStage = stage;
                ChangeTileset(stage.Tileset);
                brushForm.ChangeTileset(stage.Tileset);

                if (stage.Project != activeProject)
                {
                    activeProject = stage.Project;
                    entityForm.LoadEntities(stage.Project);
                }
            }
        }
        public StageSelectEdit(ProjectEditor editor)
        {
            project = editor.Project;

            InitializeComponent();
            this.stageSelect = project.StageSelects.FirstOrDefault();
            this.preview.Image = new Bitmap(project.ScreenWidth, project.ScreenHeight);

            bossX.Value = stageSelect.BossSpacingHorizontal;
            bossY.Value = stageSelect.BossSpacingVertical;

            comboSlot.SelectedIndex = -1;
            foreach (var stage in project.Stages) comboStages.Items.Add(stage.Name);

            if (stageSelect.Background != null)
            {
                textBackground.Text = stageSelect.Background.Absolute;
                try
                {
                    this.background = (Bitmap)Image.FromFile(stageSelect.Background.Absolute);
                    this.background.SetResolution(this.preview.Image.HorizontalResolution, this.preview.Image.VerticalResolution);
                }
                catch
                {
                    this.textBackground.Text = "";
                }
            }

            if (stageSelect.Music != null)
            {

            }

            if (stageSelect.ChangeSound != null)
            {
                if (stageSelect.ChangeSound.Type == AudioType.Wav)
                {
                    textSound.Text = stageSelect.ChangeSound.Path.Absolute;
                }
            }

            ReDraw();
        }
Exemple #11
0
        private void OpenProject(string gamefile)
        {
            ProjectEditor project;

            try
            {
                project = ProjectEditor.FromFile(gamefile);
            }
            catch
            {
                MessageBox.Show("The selected file could not be loaded. Perhaps it was created with a different version of this editor.",
                                "CME Project Editor", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return;
            }

            projectForm.AddProject(project);
            entityForm.LoadEntities(project);
            AddRecentFile(gamefile);
            ActiveProject = project;
        }
        public void AddProject(ProjectEditor project)
        {
            var projectNode = projectView.Nodes.Add(project.Name);
            projectNode.NodeFont = new Font(FontFamily.GenericSansSerif, 8, FontStyle.Bold);
            projectNode.Tag = new ProjectNodeHandler(project, projectNode);

            var stagesNode = projectNode.Nodes.Add("Stages");
            stagesNode.ImageIndex = 0;
            foreach (var stage in project.StageNames)
            {
                var stagenode = stagesNode.Nodes.Add(stage);
                stagenode.ImageIndex = stagenode.SelectedImageIndex = 2;
                stagenode.Tag = new StageNodeHandler(project, stagenode, stage);
            }

            project.StageAdded += stage =>
            {
                var stagenode = stagesNode.Nodes.Add(stage.Name);
                stagenode.ImageIndex = stagenode.SelectedImageIndex = 2;
                stagenode.Tag = new StageNodeHandler(project, stagenode, stage);
            };
        }
        public void AddProject(ProjectEditor project)
        {
            var projectNode = projectView.Nodes.Add(project.Name);

            projectNode.NodeFont = new Font(FontFamily.GenericSansSerif, 8, FontStyle.Bold);
            projectNode.Tag      = new ProjectNodeHandler(project, projectNode);

            var stagesNode = projectNode.Nodes.Add("Stages");

            stagesNode.ImageIndex = 0;
            foreach (var stage in project.StageNames)
            {
                var stagenode = stagesNode.Nodes.Add(stage);
                stagenode.ImageIndex = stagenode.SelectedImageIndex = 2;
                stagenode.Tag        = new StageNodeHandler(project, stagenode, stage);
            }

            project.StageAdded += stage =>
            {
                var stagenode = stagesNode.Nodes.Add(stage.Name);
                stagenode.ImageIndex = stagenode.SelectedImageIndex = 2;
                stagenode.Tag        = new StageNodeHandler(project, stagenode, stage);
            };
        }
        private void buttonOK_Click(object sender, EventArgs e)
        {
            int width, height;
            if (!int.TryParse(textWidth.Text, out width) || !int.TryParse(textHeight.Text, out height))
            {
                MessageBox.Show("Positive integers are required for screen size.", "CME Project Editor", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return;
            }

            bool gameNew = (editor == null);
            if (gameNew)
            {
                string baseDir = System.IO.Path.Combine(textDir.Text, textName.Text);
                if (System.IO.Directory.Exists(baseDir))
                {
                    MessageBox.Show(
                        String.Format("Could not create the project because a directory named {0} already exists at the specified location.", textName.Text),
                        "CME Project Editor", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    return;
                }

                try
                {
                    System.IO.Directory.CreateDirectory(baseDir);
                }
                catch
                {
                    MessageBox.Show(
                        "Could not create the project because the system was unable to create a directory at the specified location.",
                        "CME Project Editor", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    return;
                }

                editor = ProjectEditor.CreateNew();
            }

            editor.Name = (textName.Text == "")? "Untitled" : textName.Text;
            editor.Author = textAuthor.Text;
            editor.ScreenWidth = lastWidth;
            editor.ScreenHeight = lastHeight;

            if (gameNew)
            {
                editor.Save();
                MainForm.Instance.projectForm.AddProject(editor);
            }
            Close();
        }
 public StageDocument(ProjectEditor project)
 {
     Project = project;
     map = new Map();
 }
 public StageDocument(ProjectEditor project)
 {
     Project = project;
     map = new StageInfo();
 }
Exemple #17
0
 public StageNodeHandler(ProjectEditor project, TreeNode node, StageDocument stage) : base(project, node)
 {
     Stage     = stage;
     stageName = stage.Name;
 }
Exemple #18
0
 public StageNodeHandler(ProjectEditor project, TreeNode node, string stageName) : base(project, node)
 {
     Stage          = null;
     this.stageName = stageName;
 }
 public static ProjectEditor CreateNew()
 {
     var p = new ProjectEditor();
     return p;
 }
Exemple #20
0
        public static ProjectEditor CreateNew()
        {
            var p = new ProjectEditor();

            return(p);
        }
 public ScreenNodeHandler(ProjectEditor project, TreeNode node, ScreenDocument screen)
     : base(project, node)
 {
     this.screen = screen;
 }
 protected ProjectTreeHandler(ProjectEditor project, TreeNode node)
 {
     Project = project;
     parentNode = node;
 }
 public StageNodeHandler(ProjectEditor project, TreeNode node, StageDocument stage)
     : base(project, node)
 {
     Stage = stage;
     stageName = stage.Name;
 }
 public StageNodeHandler(ProjectEditor project, TreeNode node, string stageName)
     : base(project, node)
 {
     Stage = null;
     this.stageName = stageName;
 }
 public void LoadEntities(ProjectEditor project)
 {
     entityList.DataSource = project.Entities.ToList();
     entityList.DisplayMember = "Name";
 }
 public static ProjectEditor FromFile(string path)
 {
     var p = new ProjectEditor();
     p.Project.Load(path);
     p.LoadIncludes();
     return p;
 }
Exemple #27
0
 public void LoadEntities(ProjectEditor project)
 {
     entityList.DataSource    = project.Entities.ToList();
     entityList.DisplayMember = "Name";
 }
 public StageDocument(ProjectEditor project)
 {
     Project = project;
     map     = new StageInfo();
 }
Exemple #29
0
 protected ProjectTreeHandler(ProjectEditor project, TreeNode node)
 {
     Project    = project;
     parentNode = node;
 }
 public ProjectNodeHandler(ProjectEditor project, TreeNode node)
     : base(project, node)
 {
 }
Exemple #31
0
 public ProjectNodeHandler(ProjectEditor project, TreeNode node) : base(project, node)
 {
 }
        public void FocusScreen(StageDocument stage)
        {
            if (stage != activeStage)
            {
                ActiveStage = stage;
                ChangeTileset(stage.Tileset);
                brushForm.ChangeTileset(stage.Tileset);

                if (stage.Project != activeProject)
                {
                    activeProject = stage.Project;
                    entityForm.LoadEntities(stage.Project);
                }
            }
        }
Exemple #33
0
 public ScreenNodeHandler(ProjectEditor project, TreeNode node, ScreenDocument screen) : base(project, node)
 {
     this.screen = screen;
 }