public StageDocument AddStage(string name)
        {
            var stagePath = FileStructure.CreateStagePath(name);

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

            openStages.Add(name, stage);

            var info = new StageLinkInfo {
                Name = name, StagePath = stagePath
            };

            Project.AddStage(info);

            ViewModelMediator.Current.GetEvent <StageAddedEventArgs>().Raise(this, new StageAddedEventArgs()
            {
                Stage = info
            });

            Dirty = true;

            return(stage);
        }
 public void SaveStage(StageDocument stage)
 {
     var stageWriter = _writerProvider.GetStageWriter();
     stageWriter.Save(stage.Info);
     stage.Dirty = false;
     SaveTileset(stage.Tileset);
 }
 public StageDocument StageByName(string name)
 {
     if (openStages.ContainsKey(name)) return openStages[name];
     foreach (var info in Project.Stages)
     {
         if (info.Name == name)
         {
             StageDocument stage = _stageFactory.Load(this, info);
             openStages.Add(name, stage);
             return stage;
         }
     }
     return null;
 }
Esempio n. 4
0
        public void ChangeStage(string stageName)
        {
            try
            {
                var nextStage = _project.StageByName(stageName);

                _stage = nextStage;

                ViewModelMediator.Current.GetEvent<StageChangedEventArgs>().Raise(this, new StageChangedEventArgs(_stage));
            }
            catch (GameXmlException ex)
            {
                CustomMessageBox.ShowError(ex.Message, this.Project.Name);
            }
        }
 public StageDocument StageByName(string name)
 {
     if (openStages.ContainsKey(name))
     {
         return(openStages[name]);
     }
     foreach (var info in Project.Stages)
     {
         if (info.Name == name)
         {
             StageDocument stage = new StageDocument(this, info);
             openStages.Add(name, stage);
             return(stage);
         }
     }
     return(null);
 }
        private void StageChanged(object sender, StageChangedEventArgs e)
        {
            _currentStage = e.Stage;

            OnPropertyChanged("HasStage");
        }
Esempio n. 7
0
 public StageDocument StageByName(string name)
 {
     if (openStages.ContainsKey(name)) return openStages[name];
     foreach (var info in Project.Stages)
     {
         if (info.Name == name)
         {
             StageDocument stage = new StageDocument(this, info);
             openStages.Add(name, stage);
             return stage;
         }
     }
     return null;
 }
Esempio n. 8
0
        public StageDocument AddStage(string name)
        {
            var stagePath = FileStructure.CreateStagePath(name);

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

            openStages.Add(name, stage);

            var info = new StageLinkInfo { Name = name, StagePath = stagePath };
            Project.AddStage(info);

            ViewModelMediator.Current.GetEvent<StageAddedEventArgs>().Raise(this, new StageAddedEventArgs() { Stage = info });

            Dirty = true;

            return stage;
        }
 public ScreenDocument(ScreenInfo screen, StageDocument stage)
 {
     Stage       = stage;
     this.screen = screen;
 }
 private void StageChanged(object sender, StageChangedEventArgs e)
 {
     _stage = e.Stage;
     if (_stage != null)
     {
         Name = _stage.Name;
         Track = (uint)_stage.MusicTrack;
     }
 }
Esempio n. 11
0
        private void SetStage(StageDocument stage)
        {
            _tileset = stage.Tileset.Tileset;
            ((App)App.Current).AnimateTileset(_tileset);

            ChangeTile(_tileset.FirstOrDefault());

            if (PropertyChanged != null)
            {
                PropertyChanged(this, new PropertyChangedEventArgs("Tiles"));
            }
        }
Esempio n. 12
0
 public ScreenDocument(ScreenInfo screen, StageDocument stage)
 {
     Stage = stage;
     this.screen = screen;
 }
Esempio n. 13
0
 public StageChangedEventArgs(StageDocument stage)
 {
     Stage = stage;
 }
        private void SetStage(StageDocument stage)
        {
            SetTileset(stage.Tileset);

            ChangeTile(_tileset.Tiles.FirstOrDefault());

            OnPropertyChanged("Tiles");
        }
        private void StageChanged(object sender, StageChangedEventArgs e)
        {
            _currentStage = e.Stage;

            if (_currentStage != null)
            {
                var player = _currentStage.Project.EntityByName("Player");
                if (player != null)
                {
                    _playerSprite = SpriteModel.ForEntity(player, _currentStage.Project);
                }
            }

            OnPropertyChanged("HasStage");
        }