public Pract_Edit(Practise practise) { InitializeComponent(); this.practise = practise; controls = new List <Control>() { name, address, employeer, phone, date_end }; date_end.DisplayDateStart = DateTime.Today; name.Text = practise.name; address.Text = practise.address; employeer.Text = practise.employeer; phone.Text = practise.phone; date_end.Text = practise.date_end; // EventHandler's name.TextChanged += Controls_Listener; address.TextChanged += Controls_Listener; employeer.TextChanged += Controls_Listener; phone.TextChanged += Controls_Listener; date_end.SelectedDateChanged += Controls_Listener; }
public async Task <IActionResult> PutPractise(int?id, Practise practise) { if (id != practise.PractiseID) { return(BadRequest()); } _context.Entry(practise).State = EntityState.Modified; try { await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!PractiseExists(id)) { return(NotFound()); } else { throw; } } return(NoContent()); }
private void StartButton_Click(object sender, EventArgs e) { mainContext.Practises.Add(Practise.Start_Practise(current_Branch, current_Worker)); mainContext.SaveChanges(); Update_Grid(); MessageText.Text = "New Practice Saved"; }
protected void Controls_Listener(object sender, EventArgs e) { if (sender is ComboBox && ((Control)sender).Name.Equals("contract_org")) { Practise Selected_Pract = Helper.OPractise.Single(i => i.name.Equals(((ComboBox)sender).SelectedItem)); contract_empl.Text = Selected_Pract.employeer.ToString(); } btnNext.IsEnabled = Helper.Controls_Listener(controls); }
public void StartPractise(IVocabulary vocabulary) { var practise = new Practise(_shuffleAlgorithm, vocabulary); var moderator = new Moderator(practise); moderator.QuestionUpdated = () => QuestionUpdated(moderator); moderator.PractiseCompleted = () => PractiseCompleted(moderator); moderator.StartPractise(); }
public async Task <ActionResult <Practise> > DeletePractise(int?id) { Practise practise = _context.Practise.Include(y => y.Shot) .SingleOrDefault(x => x.PractiseID == id); foreach (var item in practise.Shot.ToList()) { _context.Shot.Remove(item); } _context.Practise.Remove(practise); _context.SaveChanges(); return(Ok(practise)); }
public void InsertTrainingInfo(Practise client) { using (UnitOfWork uow = new UnitOfWork()) { Practise practiseDb = new Practise(); practiseDb.UserId = client.UserId; practiseDb.Category = client.Category; practiseDb.Level = client.Level; practiseDb.Points = client.Points; practiseDb.DatePlayed = DateTime.UtcNow; uow.PractiseRepository.Insert(practiseDb); uow.Save(); } }
private void Filter_Grid_By_Branch_Worker(Branch b, Worker w) { current_Practises = mainContext.Practises.Include(practise => practise.Branch).Include(practise => practise.Worker). Where(practise => practise.Worker == w).Where(practise => practise.Branch == b).ToList <Practise>(); MainGrid.DataSource = Build_Table(current_Practises); current_Practise = current_Practises.Where(practise => practise.Is_Current == true).FirstOrDefault(); if (current_Practise == null) { Enable_Start(); } else { Enable_Finish(); } SetWorkerLabels(w); SetBranchLabels(b); }
public async Task <ActionResult <Practise> > PostPractise(Practise practise) { try { if (practise.PractiseID == null) { practise.UserID = User.Claims.First(c => c.Type == "UserID").Value; _context.Practise.Add(practise); } else { practise.UserID = User.Claims.First(c => c.Type == "UserID").Value; _context.Entry(practise).State = EntityState.Modified; } foreach (var item in practise.Shot) { if (item.ShotID == null || item.ShotID < 0) { _context.Shot.Add(item); } else { _context.Entry(item).State = EntityState.Modified; } } _context.SaveChanges(); return(Ok()); } catch (Exception ex) { throw ex; } }
public static void fill_db() { using (var db = new MyContext()) { Branch b1 = new Branch("Apteka", "Ul AAAA"); Branch b2 = new Branch("Punkt", "Al CCCC"); Pharmacist p1 = new Pharmacist("Pharmac1", "*****@*****.**", DateTime.Now.AddYears(-5), 1000, 5); Pharmacist p2 = new Pharmacist("Pharmac2", "*****@*****.**", DateTime.Now.AddYears(-10), 2000, 3); Assistant a1 = new Assistant("Assistant1", "*****@*****.**", DateTime.Now.AddYears(-5), 500); Assistant a2 = new Assistant("Assistant2", "*****@*****.**", DateTime.Now.AddYears(-8), 800, 40); a1.setPharmacist(p1); a2.setPharmacist(p2); Practise pr1 = new Practise(b1, p1, DateTime.Now.AddYears(-3), DateTime.Now.AddYears(-2), "Good"); Practise pr2 = new Practise(b1, p1, DateTime.Now.AddYears(-1), DateTime.Now.AddDays(-1), "Bad"); Practise pr3 = new Practise(b1, p1, DateTime.Now); Practise pr4 = new Practise(b2, p1, DateTime.Now.AddYears(-4), DateTime.Now.AddYears(-3), "Horrible"); Practise pr5 = new Practise(b2, p2, DateTime.Now.AddYears(-1), DateTime.Now.AddDays(-1), "Perfect"); Practise pr6 = new Practise(b2, p2, DateTime.Now); db.Workers.Add(p1); db.Workers.Add(p2); db.Workers.Add(a1); db.Workers.Add(a2); db.Branches.Add(b1); db.Branches.Add(b2); db.Practises.Add(pr1); db.Practises.Add(pr2); db.Practises.Add(pr3); db.Practises.Add(pr4); db.Practises.Add(pr5); db.Practises.Add(pr6); db.SaveChanges(); } }
/// <summary> /// Unload graphics content used by the game. /// </summary> public override void Unload() { //for (int i = 0; i < 100; i++) //{ // queueBullet.queue.Clear(); //} if (Guide.IsTrialMode) { if (Config.Coins > 5000) Config.Coins = 5000; } else { if (Config.Coins > 10000) Config.Coins = 10000; } foreach (Node node in Node.Nodes) { node.Remove(); } //GameStateManagementGame.Instance.soundManager.UnloadContent(); level1 = null; level2 = null; level3 = null; level4 = null; level5 = null; level6 = null; practise = null; Bar.Bars.Clear(); PlayerShip.PlayerShips.Clear(); Timer.Timers.Clear(); SpriteSheet.SpriteSheets.Clear(); Node.Nodes.Clear(); Enemy.Enemies.Clear(); Buddy.Buddys.Clear(); Projectile.Projectiles.Clear(); enemyProjectile.EnemyProjectiles.Clear(); AIProjectile.AIProjectiles.Clear(); queueBullet.queue.Clear(); EnemyPlayerShip.EnemyPlayerShips.Clear(); levelTimeColorInterval.Stop(); Player.Ship = null; Player.EnemyPlayer = null; //PlayerShip.PlayerShips = null; //EnemyPlayerShip.EnemyPlayerShips = null; //Node.RemoveDead(); //levelContent.Unload(); //content.Unload(); //#if WINDOWS_PHONE // Microsoft.Phone.Shell.PhoneApplicationService.Current.State.Remove("PlayerPosition"); // Microsoft.Phone.Shell.PhoneApplicationService.Current.State.Remove("EnemyPosition"); //#endif Config.EnemySpeed = 6; //ScreenManager.ScreenManagerInput = true; Guide.IsScreenSaverEnabled = true; GC.Collect(); }
/// <summary> /// Load graphics content for the game. /// </summary> public override void Activate(bool instancePreserved) { if (!instancePreserved) { if (content == null) content = new ContentManager(ScreenManager.Game.Services, "Content"); //Example message box for error display //List<string> MBOPTIONS = new List<string>(); //MBOPTIONS.Add("OK"); //string msg = "Text that was typed on the keyboard will be displayed here.\nClick OK to continue..."; //Guide.BeginShowMessageBox("Pause", msg, MBOPTIONS, 0, MessageBoxIcon.Alert, null, null); // if memory leak, try using a new content manager and unloading. //ContentManager levelContent = new ContentManager(services, "Content"); //extensions.initialise_texture(ScreenManager.SpriteBatch); Config.timeDropChance = 200; Config.shieldDropChance = 8 + (int)Math.Round(((float)8 / 100) * Config.PowerupDropChance); Config.projectileDropChance = 38 + (int)Math.Round(((float)38 / 100) * Config.PowerupDropChance); Config.missileDropChance = 68 + (int)Math.Round(((float)68 / 100) * Config.PowerupDropChance); Config.firerateDropChance = 128 + (int)Math.Round(((float)128 / 100) * Config.PowerupDropChance); Config.laserDropChance = 188 + (int)Math.Round(((float)158 / 100) * Config.PowerupDropChance); //Config.projectileDropChance = 68 + (int)Math.Round(((float)38 / 100) * Config.PowerupDropChance); //Config.missileDropChance = 98 + (int)Math.Round(((float)68 / 100) * Config.PowerupDropChance); //Config.firerateDropChance = 158 + (int)Math.Round(((float)128 / 100) * Config.PowerupDropChance); //Config.laserDropChance = 218 + (int)Math.Round(((float)158 / 100) * Config.PowerupDropChance); multiplierTracker = 2; Config.KillStreak = 0; Config.KillStreakBuildpoints = 0; Config.Score = 0; Config.Multi = 1; Config.AIScore = 0; Config.AIMulti = 1; Config.EmemiesKilled = 0; Config.CoinsCollected = 0; Config.EnemySpeed = 6; playerLives = Config.PlayerLives; playerAbilityUses = Config.PlayerSpecialAbilityUses; KillStreakBarBackground = new Bar(200, 20, new Color(0, 0, 0, 128)); KillStreakBarBackground.Position = new Vector2(300, 455); KillStreakBarBackground.Percent = 1f; KillStreakBar = new Bar(200, 20, new Color(0,128,0,128)); KillStreakBar.Position = new Vector2(300, 455); laserCharges = "0"; thumbstick = content.Load<Texture2D>("thumbstick2"); //introExtermination = content.Load<Texture2D>(@"Gamescreens\AlterEgo"); phaserTexture = content.Load<Texture2D>(@"phaser"); levelTimeColorInterval = new Timer(); levelTimeColorInterval.Fire += new NotifyHandler(levelTimeColorInterval_Fire); switch (Config.Level) { case LevelSelect.One: stars = content.Load<Texture2D>(@"Background\Stars3"); backgroundClouds2 = content.Load<Texture2D>(@"Background\BackgroundClouds2"); musicLevel1 = content.Load<Song>(@"Music\throughthestars"); musicLevel1 = content.Load<Song>(@"Music\throughthestars"); levelTime = 300; break; case LevelSelect.Two: stars = content.Load<Texture2D>(@"Background\Stars2"); //backgroundClouds2 = content.Load<Texture2D>(@"Background\cloudlayer2"); backgroundClouds2 = content.Load<Texture2D>(@"Background\BackgroundClouds2"); musicLevel1 = content.Load<Song>(@"Music\galacticstruggle"); levelTime = 300; levelTimeColor = Color.Green; break; case LevelSelect.Three: //stars = content.Load<Texture2D>(@"Background\stars"); //backgroundClouds2 = content.Load<Texture2D>(@"Background\nova2"); //backgroundClouds1 = content.Load<Texture2D>(@"Background\stars4"); stars = content.Load<Texture2D>(@"Background\Stars8"); backgroundClouds2 = content.Load<Texture2D>(@"Background\stars7"); backgroundClouds1 = content.Load<Texture2D>(@"Background\cloudlayer2"); musicLevel1 = content.Load<Song>(@"Music\survival"); levelTime = 300; playerLives = 3; respawnTime = TimeSpan.FromSeconds(5); break; case LevelSelect.Four: stars = content.Load<Texture2D>(@"Background\stars"); backgroundClouds2 = content.Load<Texture2D>(@"Background\stars10"); backgroundClouds1 = content.Load<Texture2D>(@"Background\stars7"); musicLevel1 = content.Load<Song>(@"Music\holo"); levelTime = 300; playerLives = 3; respawnTime = TimeSpan.FromSeconds(5); break; case LevelSelect.Five: //stars = content.Load<Texture2D>(@"Background\Stars5"); //backgroundClouds2 = content.Load<Texture2D>(@"Background\Stars4"); //backgroundClouds1 = content.Load<Texture2D>(@"Background\cloudlayer2"); stars = content.Load<Texture2D>(@"Background\Stars5"); backgroundClouds2 = content.Load<Texture2D>(@"Background\Stars4"); backgroundClouds1 = content.Load<Texture2D>(@"Background\stars7"); musicLevel1 = content.Load<Song>(@"Music\giantrobotsfighting"); levelTime = 60; break; case LevelSelect.Six: stars = content.Load<Texture2D>(@"Background\stars"); backgroundClouds2 = content.Load<Texture2D>(@"Background\nova2"); backgroundClouds1 = content.Load<Texture2D>(@"Background\stars4"); musicLevel1 = content.Load<Song>(@"Music\AgainstTheOdds"); levelTime = 300; break; case LevelSelect.Practise: //UIdescription = content.Load<Texture2D>(@"Gamescreens\UIdescription"); stars = content.Load<Texture2D>(@"Background\Stars3"); backgroundClouds2 = content.Load<Texture2D>(@"Background\BackgroundClouds2"); musicLevel1 = content.Load<Song>(@"Music\throughthestars"); levelTime = 300; break; } font = content.Load<SpriteFont>(@"Fonts\Tahoma14"); floatingScoreFont = content.Load<SpriteFont>(@"Fonts\Andy22"); floatingPowerupFont = content.Load<SpriteFont>(@"Fonts\Andy22"); floatingMultiplierMsgFont = content.Load<SpriteFont>(@"Fonts\Andy48"); andy14 = content.Load<SpriteFont>(@"Fonts\Andy14"); andy18 = content.Load<SpriteFont>(@"Fonts\Andy18"); andy22 = content.Load<SpriteFont>(@"Fonts\Andy22"); andy48 = content.Load<SpriteFont>(@"Fonts\Andy48"); SpriteSheet.LoadContent(content, ScreenManager.GraphicsDevice); cam = new Camera2D(ScreenManager.GraphicsDevice, worldBounds.Right, worldBounds.Bottom); //GameStateManagementGame.Instance.soundManager.LoadSound("Shot3", @"SoundEffects\Shot3"); //GameStateManagementGame.Instance.soundManager.LoadSound("coin", @"SoundEffects\coin"); //GameStateManagementGame.Instance.soundManager.LoadSound("ShipSpawn", @"SoundEffects\ShipSpawn"); //GameStateManagementGame.Instance.soundManager.LoadSound("ShipExplode", @"SoundEffects\ShipExplode"); Player.SpawnShip(); //Player = new Player(); switch (Config.Level) { case LevelSelect.One: level1 = new Level1(); break; case LevelSelect.Two: level2 = new Level2(); break; case LevelSelect.Three: level3 = new Level3(); Player.SpawnEnemyShip(); break; case LevelSelect.Four: level4 = new Level4(); Player.SpawnEnemyShip(); break; case LevelSelect.Five: level5 = new Level5(); break; case LevelSelect.Six: level6 = new Level6(); break; case LevelSelect.Practise: practise = new Practise(); break; } //bud = new BuddyMissile(Config.BuddySpriteSheet); //bud.Position = Player.Ship.Position; //if (Player.Ship == null) //{ // Player.SpawnShip(); //} //ParticleEngineEffect = new ParticleEffects(graphicsDeviceManager, cam, GraphicsDevice); ParticleEffects.Initialize(ScreenManager.GraphicsDeviceManager, ScreenManager.GraphicsDevice); //ParticleEngineEffect.LoadContent(content); ParticleEffects.LoadContent(content); FloatingScoreList = new SpriteFontFloatScores(); //FloatingScore = new SpriteFontFloatScore(); //FloatingScore.Color = Color.Green; //FloatingScore.Score = "+"; //FloatingScore.SpriteFont = floatingScoreFont; //FloatingScore.LifeSpan = 1000f; //FloatingScore.SizeTime = 500f; //FloatingScore.ShadowEffect = false; //FloatingScore.EndPosition = new Vector2(20, -20); FloatingPowerupText = new SpriteFontFloatScore(); FloatingPowerupText.Color = Color.White; FloatingPowerupText.Score = "+"; FloatingPowerupText.SpriteFont = floatingPowerupFont; FloatingPowerupText.LifeSpan = 1000f; FloatingPowerupText.SizeTime = 500f; FloatingPowerupText.ShadowEffect = false; FloatingPowerupText.EndPosition = new Vector2(20, -20); FloatingPowerupText.LayerDepth = 0.7f; FloatingMultiplierText = new SpriteFontFloatScore(); FloatingMultiplierText.Color = Color.White; FloatingMultiplierText.Score = "Multiplyer"; FloatingMultiplierText.SpriteFont = floatingMultiplierMsgFont; FloatingMultiplierText.LifeSpan = 1000f; FloatingMultiplierText.SizeTime = 500f; FloatingMultiplierText.ShadowEffect = true; FloatingMultiplierText.EndPosition = Vector2.Zero; FloatingPowerupText.LayerDepth = 1.0f; //if (queueBullet.queue.Count < 1) //{ // for (int i = 0; i < 100; i++) // { // queueBullet.queue.Enqueue(new queueBullet(Config.BulletSheetEnergyPurple)); // } //} if (Config.MusicOn && MediaPlayer.GameHasControl) GameStateManagementGame.Instance.musicManager.Play(musicLevel1); //GameStateManagementGame.Instance.musicManager.Stop(); Bar.Texture = content.Load<Texture2D>("Textures/Fill22"); multiHud = new Sprite(Config.MultiHud); multiHud.Scale = 0.5f; multiHud.Color = Color.Green; multi = (Math.Round(Config.Multi, 2)).ToString() + "x"; healthHud = new Sprite(Config.MultiHud); healthHud.Scale = 0.3f; healthHud.Color = Color.Red; shieldHud = new Sprite(Config.MultiHud); shieldHud.Scale = 0.5f; shieldHud.Color = Color.RoyalBlue; AImultiHud = new Sprite(Config.MultiHud); AImultiHud.Scale = 0.5f; AImultiHud.Color = Color.Green; AImulti = (Math.Round(Config.AIMulti, 2)).ToString() + "x"; AIHealthHud = new Sprite(Config.MultiHud); AIHealthHud.Scale = 0.3f; AIHealthHud.Color = Color.Red; AIShieldHud = new Sprite(Config.MultiHud); AIShieldHud.Scale = 0.5f; AIShieldHud.Color = Color.RoyalBlue; GC.Collect(); // once the load has finished, we use ResetElapsedTime to tell the game's // timing mechanism that we have just finished a very long frame, and that // it should not try to catch up. ScreenManager.Game.ResetElapsedTime(); } //#if WINDOWS_PHONE // if (Microsoft.Phone.Shell.PhoneApplicationService.Current.State.ContainsKey("PlayerPosition")) // { // playerPosition = (Vector2)Microsoft.Phone.Shell.PhoneApplicationService.Current.State["PlayerPosition"]; // enemyPosition = (Vector2)Microsoft.Phone.Shell.PhoneApplicationService.Current.State["EnemyPosition"]; // } //#endif }
protected override void OnNavigatedFrom(NavigationEventArgs e) { // Stop the timer timer.Stop(); // Set the sharing mode of the graphics device to turn off XNA rendering SharedGraphicsDeviceManager.Current.GraphicsDevice.SetSharingMode(false); //for (int i = 0; i < 100; i++) //{ // queueBullet.queue.Clear(); //} //if (Guide.IsTrialMode) //{ // if (Config.Coins > 5000) // Config.Coins = 5000; //} //else //{ //if (Config.Coins > 10000) // Config.Coins = 10000; //} foreach (Node node in Node.Nodes) { node.Remove(); } //GameStateManagementGame.Instance.soundManager.UnloadContent(); level1 = null; level2 = null; level3 = null; level4 = null; level5 = null; level6 = null; practise = null; Bar.Bars.Clear(); PlayerShip.PlayerShips.Clear(); Timer.Timers.Clear(); SpriteSheet.SpriteSheets.Clear(); Node.Nodes.Clear(); Enemy.Enemies.Clear(); Buddy.Buddys.Clear(); Projectile.Projectiles.Clear(); enemyProjectile.EnemyProjectiles.Clear(); AIProjectile.AIProjectiles.Clear(); queueBullet.queue.Clear(); EnemyPlayerShip.EnemyPlayerShips.Clear(); levelTimeColorInterval.Stop(); Player.Ship = null; Player.EnemyPlayer = null; //PlayerShip.PlayerShips = null; //EnemyPlayerShip.EnemyPlayerShips = null; //Node.RemoveDead(); //levelContent.Unload(); //content.Unload(); //#if WINDOWS_PHONE // Microsoft.Phone.Shell.PhoneApplicationService.Current.State.Remove("PlayerPosition"); // Microsoft.Phone.Shell.PhoneApplicationService.Current.State.Remove("EnemyPosition"); //#endif Config.EnemySpeed = 6; //ScreenManager.ScreenManagerInput = true; //Guide.IsScreenSaverEnabled = true; AccelerometerHelper.Instance.Active = false; PhoneApplicationService.Current.UserIdleDetectionMode = IdleDetectionMode.Enabled; GC.Collect(); (Application.Current as App).TryPlayBackgroundMusic(0); base.OnNavigatedFrom(e); }
protected override void OnNavigatedTo(NavigationEventArgs e) { // Set the sharing mode of the graphics device to turn on XNA rendering SharedGraphicsDeviceManager.Current.GraphicsDevice.SetSharingMode(true); //MainPage.myGame.GameManager.SinglePlayerTools.StartPractice(null); // Create a new SpriteBatch, which can be used to draw textures. spriteBatch = new SpriteBatch(SharedGraphicsDeviceManager.Current.GraphicsDevice); Config.timeDropChance = 200; Config.shieldDropChance = 8 + (int)Math.Round(((float)8 / 100) * Config.PowerupDropChance); Config.projectileDropChance = 38 + (int)Math.Round(((float)38 / 100) * Config.PowerupDropChance); Config.missileDropChance = 68 + (int)Math.Round(((float)68 / 100) * Config.PowerupDropChance); Config.firerateDropChance = 128 + (int)Math.Round(((float)128 / 100) * Config.PowerupDropChance); Config.laserDropChance = 188 + (int)Math.Round(((float)158 / 100) * Config.PowerupDropChance); //Config.projectileDropChance = 68 + (int)Math.Round(((float)38 / 100) * Config.PowerupDropChance); //Config.missileDropChance = 98 + (int)Math.Round(((float)68 / 100) * Config.PowerupDropChance); //Config.firerateDropChance = 158 + (int)Math.Round(((float)128 / 100) * Config.PowerupDropChance); //Config.laserDropChance = 218 + (int)Math.Round(((float)158 / 100) * Config.PowerupDropChance); Config.CoinsCollected = 0; multiplierTracker = 2; Config.KillStreak = 0; Config.KillStreakBuildpoints = 0; Config.Score = 0; Config.Multi = 1; Config.AIScore = 0; Config.AIMulti = 1; Config.EmemiesKilled = 0; Config.CoinsCollected = 0; Config.EnemySpeed = 6; playerLives = Config.PlayerLives; playerAbilityUses = Config.PlayerSpecialAbilityUses; if (Config.boostPrepared > 0) { playerAbilityUses++; Config.boostPrepared--; } if (Config.boostShieldsUp > 0) { boostShieldsUpActive = true; } if (Config.boostLastStand > 0) { boostLastStandActive = true; } KillStreakBarBackground = new Bar(200, 20, new Color(0, 0, 0, 128)); KillStreakBarBackground.Position = new Vector2(300, 455); KillStreakBarBackground.Percent = 1f; KillStreakBar = new Bar(200, 20, new Color(0, 128, 0, 128)); KillStreakBar.Position = new Vector2(300, 455); laserCharges = "0"; thumbstick = contentManager.Load<Texture2D>("thumbstick2"); //thumbstick = content.Load<Texture2D>("thumbstick2"); //introExtermination = content.Load<Texture2D>(@"Gamescreens\AlterEgo"); phaserTexture = contentManager.Load<Texture2D>(@"phaser"); levelTimeColorInterval = new Timer(); levelTimeColorInterval.Fire += new NotifyHandler(levelTimeColorInterval_Fire); switch (Config.Level) { case LevelSelect.One: stars = contentManager.Load<Texture2D>(@"Background\Stars3"); backgroundClouds2 = contentManager.Load<Texture2D>(@"Background\BackgroundClouds2"); //musicLevel1 = contentManager.Load<Song>(@"Music\throughthestars"); //musicLevel1 = contentManager.Load<Song>(@"Music\throughthestars"); levelTime = 300; (Application.Current as App).TryPlayBackgroundMusic(1); break; case LevelSelect.Two: stars = contentManager.Load<Texture2D>(@"Background\Stars2"); //backgroundClouds2 = content.Load<Texture2D>(@"Background\cloudlayer2"); backgroundClouds2 = contentManager.Load<Texture2D>(@"Background\BackgroundClouds2"); //musicLevel1 = contentManager.Load<Song>(@"Music\galacticstruggle"); levelTime = 300; levelTimeColor = Color.Green; (Application.Current as App).TryPlayBackgroundMusic(2); break; case LevelSelect.Three: //stars = content.Load<Texture2D>(@"Background\stars"); //backgroundClouds2 = content.Load<Texture2D>(@"Background\nova2"); //backgroundClouds1 = content.Load<Texture2D>(@"Background\stars4"); stars = contentManager.Load<Texture2D>(@"Background\Stars8"); backgroundClouds2 = contentManager.Load<Texture2D>(@"Background\stars7"); backgroundClouds1 = contentManager.Load<Texture2D>(@"Background\cloudlayer2"); //musicLevel1 = contentManager.Load<Song>(@"Music\survival"); levelTime = 300; playerLives = 3; respawnTime = TimeSpan.FromSeconds(5); (Application.Current as App).TryPlayBackgroundMusic(3); break; case LevelSelect.Four: stars = contentManager.Load<Texture2D>(@"Background\stars"); backgroundClouds2 = contentManager.Load<Texture2D>(@"Background\stars10"); backgroundClouds1 = contentManager.Load<Texture2D>(@"Background\stars7"); //musicLevel1 = contentManager.Load<Song>(@"Music\holo"); levelTime = 300; playerLives = 3; respawnTime = TimeSpan.FromSeconds(5); (Application.Current as App).TryPlayBackgroundMusic(4); break; case LevelSelect.Five: //stars = content.Load<Texture2D>(@"Background\Stars5"); //backgroundClouds2 = content.Load<Texture2D>(@"Background\Stars4"); //backgroundClouds1 = content.Load<Texture2D>(@"Background\cloudlayer2"); stars = contentManager.Load<Texture2D>(@"Background\Stars5"); backgroundClouds2 = contentManager.Load<Texture2D>(@"Background\Stars4"); backgroundClouds1 = contentManager.Load<Texture2D>(@"Background\stars7"); //musicLevel1 = contentManager.Load<Song>(@"Music\giantrobotsfighting"); levelTime = 60; (Application.Current as App).TryPlayBackgroundMusic(5); break; case LevelSelect.Six: stars = contentManager.Load<Texture2D>(@"Background\stars"); backgroundClouds2 = contentManager.Load<Texture2D>(@"Background\nova2"); backgroundClouds1 = contentManager.Load<Texture2D>(@"Background\stars4"); //musicLevel1 = contentManager.Load<Song>(@"Music\AgainstTheOdds"); levelTime = 300; (Application.Current as App).TryPlayBackgroundMusic(6); break; case LevelSelect.Practise: //UIdescription = content.Load<Texture2D>(@"Gamescreens\UIdescription"); stars = contentManager.Load<Texture2D>(@"Background\Stars3"); backgroundClouds2 = contentManager.Load<Texture2D>(@"Background\BackgroundClouds2"); //musicLevel1 = contentManager.Load<Song>(@"Music\throughthestars"); levelTime = 300; (Application.Current as App).TryPlayBackgroundMusic(1); break; } font = contentManager.Load<SpriteFont>(@"Fonts\Tahoma14"); floatingScoreFont = contentManager.Load<SpriteFont>(@"Fonts\Andy22"); floatingPowerupFont = contentManager.Load<SpriteFont>(@"Fonts\Andy22"); floatingMultiplierMsgFont = contentManager.Load<SpriteFont>(@"Fonts\Andy48"); andy14 = contentManager.Load<SpriteFont>(@"Fonts\Andy14"); andy18 = contentManager.Load<SpriteFont>(@"Fonts\Andy18"); andy22 = contentManager.Load<SpriteFont>(@"Fonts\Andy22"); andy48 = contentManager.Load<SpriteFont>(@"Fonts\Andy48"); SpriteSheet.LoadContent(contentManager, SharedGraphicsDeviceManager.Current.GraphicsDevice); cam = new Camera2D(SharedGraphicsDeviceManager.Current.GraphicsDevice, worldBounds.Right, worldBounds.Bottom); //GameStateManagementGame.Instance.soundManager.LoadSound("Shot3", @"SoundEffects\Shot3"); //GameStateManagementGame.Instance.soundManager.LoadSound("coin", @"SoundEffects\coin"); //GameStateManagementGame.Instance.soundManager.LoadSound("ShipSpawn", @"SoundEffects\ShipSpawn"); //GameStateManagementGame.Instance.soundManager.LoadSound("ShipExplode", @"SoundEffects\ShipExplode"); Player.SpawnShip(); //Player = new Player(); switch (Config.Level) { case LevelSelect.One: level1 = new Level1(); break; case LevelSelect.Two: level2 = new Level2(); break; case LevelSelect.Three: level3 = new Level3(); Player.SpawnEnemyShip(); break; case LevelSelect.Four: level4 = new Level4(); Player.SpawnEnemyShip(); break; case LevelSelect.Five: level5 = new Level5(); break; case LevelSelect.Six: level6 = new Level6(); break; case LevelSelect.Practise: practise = new Practise(); break; } //bud = new BuddyMissile(Config.BuddySpriteSheet); //bud.Position = Player.Ship.Position; //if (Player.Ship == null) //{ // Player.SpawnShip(); //} //ParticleEngineEffect = new ParticleEffects(graphicsDeviceManager, cam, GraphicsDevice); ParticleEffects.Initialize(SharedGraphicsDeviceManager.Current, SharedGraphicsDeviceManager.Current.GraphicsDevice); //ParticleEngineEffect.LoadContent(content); ParticleEffects.LoadContent(contentManager); FloatingScoreList = new SpriteFontFloatScores(); //FloatingScore = new SpriteFontFloatScore(); //FloatingScore.Color = Color.Green; //FloatingScore.Score = "+"; //FloatingScore.SpriteFont = floatingScoreFont; //FloatingScore.LifeSpan = 1000f; //FloatingScore.SizeTime = 500f; //FloatingScore.ShadowEffect = false; //FloatingScore.EndPosition = new Vector2(20, -20); FloatingPowerupText = new SpriteFontFloatScore(); FloatingPowerupText.Color = Color.White; FloatingPowerupText.Score = "+"; FloatingPowerupText.SpriteFont = floatingPowerupFont; FloatingPowerupText.LifeSpan = 1000f; FloatingPowerupText.SizeTime = 500f; FloatingPowerupText.ShadowEffect = false; FloatingPowerupText.EndPosition = new Vector2(20, -20); FloatingPowerupText.LayerDepth = 0.7f; FloatingMultiplierText = new SpriteFontFloatScore(); FloatingMultiplierText.Color = Color.Green; FloatingMultiplierText.Score = "Multiplyer"; FloatingMultiplierText.SpriteFont = floatingMultiplierMsgFont; FloatingMultiplierText.LifeSpan = 1000f; FloatingMultiplierText.SizeTime = 500f; FloatingMultiplierText.ShadowEffect = true; FloatingMultiplierText.EndPosition = Vector2.Zero; FloatingPowerupText.LayerDepth = 1.0f; //if (queueBullet.queue.Count < 1) //{ // for (int i = 0; i < 100; i++) // { // queueBullet.queue.Enqueue(new queueBullet(Config.BulletSheetEnergyPurple)); // } //} //if (Config.MusicOn && MediaPlayer.GameHasControl) // GameStateManagementGame.Instance.musicManager.Play(musicLevel1); //GameStateManagementGame.Instance.musicManager.Stop(); Bar.Texture = contentManager.Load<Texture2D>("Textures/Fill22"); multiHud = new Sprite(Config.MultiHud); multiHud.Scale = 0.5f; multiHud.Color = Color.Green; multi = (Math.Round(Config.Multi, 2)).ToString() + "x"; healthHud = new Sprite(Config.MultiHud); healthHud.Scale = 0.3f; healthHud.Color = Color.Red; shieldHud = new Sprite(Config.MultiHud); shieldHud.Scale = 0.5f; shieldHud.Color = Color.RoyalBlue; AImultiHud = new Sprite(Config.MultiHud); AImultiHud.Scale = 0.5f; AImultiHud.Color = Color.Green; AImulti = (Math.Round(Config.AIMulti, 2)).ToString() + "x"; AIHealthHud = new Sprite(Config.MultiHud); AIHealthHud.Scale = 0.3f; AIHealthHud.Color = Color.Red; AIShieldHud = new Sprite(Config.MultiHud); AIShieldHud.Scale = 0.5f; AIShieldHud.Color = Color.RoyalBlue; GC.Collect(); // once the load has finished, we use ResetElapsedTime to tell the game's // timing mechanism that we have just finished a very long frame, and that // it should not try to catch up. //ScreenManager.Game.ResetElapsedTime(); // Start the timer timer.Start(); if (Config.ControlOption == 3) AccelerometerHelper.Instance.Active = true; PhoneApplicationService.Current.UserIdleDetectionMode = IdleDetectionMode.Disabled; base.OnNavigatedTo(e); }