public SongOfIce() { graphics = new GraphicsDeviceManager(this); Content.RootDirectory = "Content"; this.Window.Title = "Song of Ice"; IsMouseVisible = true; particleManager = new ParticleSystemManager(); mainMenu = new Menu(this); metas = LevelFactory.CreateDefaultMetaLevelList(); InitializeLevelLockStatus(); /* Fullscreen Options */ if (windowed) { graphics.PreferredBackBufferWidth = 1024; graphics.PreferredBackBufferHeight = 768; } else { graphics.PreparingDeviceSettings += new EventHandler<PreparingDeviceSettingsEventArgs>(graphics_PreparingDeviceSettings); graphics.IsFullScreen = true; } currentView = mainMenu; }
internal void SwitchToLevel(MetaLevel meta) { Level level = LevelFactory.CreateLevelFromMetaLevel(meta, this); if (level == null) { return; } if (state == GameState.MENU) { /* Transition from the menu to the level. Don't dispose MENU. */ currentLevel = level; currentLevel.Load(); mainMenu.Sound = false; state = GameState.LEVEL; } else if (state == GameState.LEVEL) { /* Transition from the prior level to the new level. Dispose resources immediately. */ if (currentLevel != null) { currentLevel.Unload(); } currentLevel = level; currentLevel.Load(); } currentView = currentLevel; currentView.Sound = true; }
public void SwitchToMenu() { if (state == GameState.MENU) { /* No-op */ } else if (state == GameState.LEVEL) { /* Transition from the prior level to the new level. Dispose resources immediately. */ if (currentLevel != null) { currentLevel.Unload(); } currentLevel = null; state = GameState.MENU; } mainMenu.Sound = true; currentView = mainMenu; }