ChangeTileset() public method

public ChangeTileset ( string path ) : void
path string
return void
Exemplo n.º 1
0
        public StageDocument AddStage(string name, string tilesetPath)
        {
            string stageDir = Path.Combine(BaseDir, "stages");

            if (!Directory.Exists(stageDir))
            {
                Directory.CreateDirectory(stageDir);
            }
            string stagePath = Path.Combine(stageDir, name);

            if (!Directory.Exists(stagePath))
            {
                Directory.CreateDirectory(stagePath);
            }

            var stage = new StageDocument(this)
            {
                Path = FilePath.FromAbsolute(stagePath, this.BaseDir),
                Name = name
            };

            stage.ChangeTileset(tilesetPath);

            stage.Save();

            openStages.Add(name, stage);

            var info = new StageLinkInfo {
                Name = name, StagePath = FilePath.FromAbsolute(stagePath, BaseDir)
            };

            Project.AddStage(info);

            Save(); // need to save the reference to the new stage

            if (StageAdded != null)
            {
                StageAdded(stage);
            }

            return(stage);
        }
Exemplo n.º 2
0
        private bool Save()
        {
            if (stage == null) // new
            {
                try
                {
                    stage = project.AddStage(nameField.Text, tilesetField.Text);
                }
                catch (Exception)
                {
                    MessageBox.Show("There was an error creating the stage.\nPerhaps your tileset path is incorrect?", "CME Level Editor", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                    return(false);
                }
            }
            else
            {
                stage.Name = nameField.Text;
                try
                {
                    stage.ChangeTileset(tilesetField.Text);
                }
                catch
                {
                    MessageBox.Show("The tileset specified could not be loaded. Sorry.", "CME Project Editor", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    return(false);
                }
            }
            if (introField.Text != "")
            {
                stage.MusicIntro = FilePath.FromAbsolute(introField.Text, stage.Path.BasePath);
            }
            if (loopField.Text != "")
            {
                stage.MusicLoop = FilePath.FromAbsolute(loopField.Text, stage.Path.BasePath);
            }

            return(true);
        }
Exemplo n.º 3
0
        public StageDocument AddStage(string name, string tilesetPath)
        {
            string stageDir = Path.Combine(BaseDir, "stages");
            if (!Directory.Exists(stageDir))
            {
                Directory.CreateDirectory(stageDir);
            }
            string stagePath = Path.Combine(stageDir, name);
            if (!Directory.Exists(stagePath))
            {
                Directory.CreateDirectory(stagePath);
            }

            var stage = new StageDocument(this)
            {
                Path = FilePath.FromAbsolute(stagePath, this.BaseDir),
                Name = name
            };
            stage.ChangeTileset(tilesetPath);

            stage.Save();

            openStages.Add(name, stage);

            var info = new StageInfo {Name = name, StagePath = FilePath.FromAbsolute(stagePath, BaseDir)};
            Project.AddStage(info);

            Save(); // need to save the reference to the new stage

            if (StageAdded != null) StageAdded(stage);

            return stage;
        }