예제 #1
0
        private void _ProjectPanel_NewLevelClicked()
        {
            NewLevelResult newLevelResult = NewLevelWindow.Show(_levelService, _worldService);

            if (newLevelResult != null)
            {
                _levelService.AddLevel(newLevelResult.Level, newLevelResult.WorldInfo);
            }
            _projectService.SaveProject();
        }
예제 #2
0
        public static NewLevelResult Show(LevelService levelService, WorldService worldService)
        {
            Level          newLevel       = null;
            NewLevelResult newLevelResult = null;

            NewLevelWindow window = new NewLevelWindow(levelService, worldService);

            window.WindowStartupLocation = WindowStartupLocation.CenterOwner;
            window.ShowDialog();


            if (window.DialogResult == true)
            {
                newLevel = new Level();
                newLevel.AnimationType        = window.BaseLevel.AnimationType;
                newLevel.Effects              = window.BaseLevel.Effects;
                newLevel.EventType            = window.BaseLevel.EventType;
                newLevel.StaticTileTableIndex = window.BaseLevel.StaticTileTableIndex;
                newLevel.Id            = Guid.NewGuid();
                newLevel.MusicValue    = window.BaseLevel.MusicValue;
                newLevel.Name          = window.LevelName;
                newLevel.PaletteEffect = window.BaseLevel.PaletteEffect;
                newLevel.PaletteId     = window.BaseLevel.PaletteId;
                newLevel.ScreenLength  = window.BaseLevel.ScreenLength;
                newLevel.ScrollType    = window.BaseLevel.ScrollType;
                newLevel.StartX        = window.BaseLevel.StartX;
                newLevel.StartY        = window.BaseLevel.StartY;
                newLevel.TileSetIndex  = window.BaseLevel.TileSetIndex;

                newLevelResult           = new NewLevelResult();
                newLevelResult.Level     = newLevel;
                newLevelResult.LevelInfo = new LevelInfo()
                {
                    Name = newLevel.Name, SublevelsInfo = new List <LevelInfo>()
                };
                newLevelResult.WorldInfo = window.HostWorld;

                return(newLevelResult);
            }

            return(newLevelResult);
        }