protected virtual void endLevel() { MediaSystem.StopSiren(); MediaSystem.PlaySoundEffect(SFXOptions.Win); overlay = new OpeningOverlay(true); results = new ResultsScreen(time, BoxesDestroyed, score, levelNumber, CompletionData); ending = true; color = new Color(0, 0, 0, 0); timer = new Timer(2500, onTimerFired, false); timer.Start(); TemporarilyMuteVoice = false; screenSpace = new Rectangle(0, 0, (int)RenderingDevice.Width, (int)RenderingDevice.Height); }
private void OnThirdFire() { level++; MediaSystem.PlaySoundEffect(SFXOptions.Result_Da); timer = new Timer(500, OnFourthFire, false); timer.Start(); }
public void Draw() { RenderingDevice.SpriteBatch.Begin(SpriteSortMode.Immediate, null, SamplerState.LinearClamp, null, null); if(level == 0) RenderingDevice.SpriteBatch.Draw(Resources.EmptyTex, screenSpace, color); if(level >= 1) RenderingDevice.SpriteBatch.DrawString(Resources.BiggerFont, "Results: Level " + (levelNumber > 11 ? "D" + (levelNumber - 11) : levelNumber.ToString()), new Vector2(RenderingDevice.Width * 0.5f, RenderingDevice.Height * 0.15f), Color.White, 0, Resources.BiggerFont.MeasureString("Results: Level " + (levelNumber > 11 ? "D" + (levelNumber - 11) : levelNumber.ToString())) * 0.5f, RenderingDevice.TextureScaleFactor, SpriteEffects.None, 0); if(level >= 2) { if(levelNumber != 11) { RenderingDevice.SpriteBatch.DrawString(Resources.Font, "Time Taken:", new Vector2(RenderingDevice.Width * 0.25f, RenderingDevice.Height * 0.4f), Color.White, 0, new Vector2(Resources.Font.MeasureString("Time Taken:").X, 0), RenderingDevice.TextureScaleFactor, SpriteEffects.None, 0); RenderingDevice.SpriteBatch.DrawString(Resources.Font, "Boxes Lost:", new Vector2(RenderingDevice.Width * 0.25f, RenderingDevice.Height * 0.55f), Color.White, 0, new Vector2(Resources.Font.MeasureString("Boxes Lost:").X, 0), RenderingDevice.TextureScaleFactor, SpriteEffects.None, 0); RenderingDevice.SpriteBatch.DrawString(Resources.Font, "Score:", new Vector2(RenderingDevice.Width * 0.25f, RenderingDevice.Height * 0.7f), Color.White, 0, new Vector2(Resources.Font.MeasureString("Score:").X, 0), RenderingDevice.TextureScaleFactor, SpriteEffects.None, 0); } else { RenderingDevice.SpriteBatch.DrawString(Resources.Font, "Completed:", new Vector2(RenderingDevice.Width * 0.25f, RenderingDevice.Height * 0.5f), Color.White, 0, new Vector2(Resources.Font.MeasureString("Completed:").X, 0), RenderingDevice.TextureScaleFactor, SpriteEffects.None, 0); RenderingDevice.SpriteBatch.DrawString(Resources.Font, "Time Taken:", new Vector2(RenderingDevice.Width * 0.25f, RenderingDevice.Height * 0.65f), Color.White, 0, new Vector2(Resources.Font.MeasureString("Time Taken:").X, 0), RenderingDevice.TextureScaleFactor, SpriteEffects.None, 0); } } if(level >= 3) { string t = convertTimeSpan(time); if(levelNumber != 11) { float constant = Input.WindowsOptions.HighScoreMode ? 0.65f : 0.4f; RenderingDevice.SpriteBatch.DrawString(Resources.Font, t, new Vector2(RenderingDevice.Width * constant, RenderingDevice.Height * 0.4f), Color.White, 0, Vector2.Zero, RenderingDevice.TextureScaleFactor, SpriteEffects.None, 0); RenderingDevice.SpriteBatch.DrawString(Resources.Font, lost.ToString(), new Vector2(RenderingDevice.Width * constant, RenderingDevice.Height * 0.55f), Color.White, 0, Vector2.Zero, RenderingDevice.TextureScaleFactor, SpriteEffects.None, 0); RenderingDevice.SpriteBatch.DrawString(Resources.Font, score.ToString(), new Vector2(RenderingDevice.Width * constant, RenderingDevice.Height * 0.7f), Color.White, 0, Vector2.Zero, RenderingDevice.TextureScaleFactor, SpriteEffects.None, 0); if(!Input.WindowsOptions.HighScoreMode) { RenderingDevice.SpriteBatch.DrawString(Resources.Font, "(target: " + convertTimeSpan(completionData.ThreeStarTime) + ")", new Vector2(RenderingDevice.Width * 0.45f, RenderingDevice.Height * 0.4f), Color.White, 0, Vector2.Zero, RenderingDevice.TextureScaleFactor, SpriteEffects.None, 0); RenderingDevice.SpriteBatch.DrawString(Resources.Font, "(max allowed: " + completionData.ThreeStarBoxes + ")", new Vector2(RenderingDevice.Width * 0.45f, RenderingDevice.Height * 0.55f), Color.White, 0, Vector2.Zero, RenderingDevice.TextureScaleFactor, SpriteEffects.None, 0); RenderingDevice.SpriteBatch.DrawString(Resources.Font, "(target: " + completionData.ThreeStarScore + ")", new Vector2(RenderingDevice.Width * 0.45f, RenderingDevice.Height * 0.7f), Color.White, 0, Vector2.Zero, RenderingDevice.TextureScaleFactor, SpriteEffects.None, 0); } else if(level == 3) { level++; timer = new Timer(500, OnFifthFire, false); timer.Start(); } } else { RenderingDevice.SpriteBatch.DrawString(Resources.Font, "Yes", new Vector2(RenderingDevice.Width * 0.5f, RenderingDevice.Height * 0.5f), Color.White, 0, new Vector2(Resources.Font.MeasureString("Yes").X * 0.5f * RenderingDevice.TextureScaleFactor.X, 0), RenderingDevice.TextureScaleFactor, SpriteEffects.None, 0); RenderingDevice.SpriteBatch.DrawString(Resources.Font, t, new Vector2(RenderingDevice.Width * 0.5f, RenderingDevice.Height * 0.65f), Color.White, 0, new Vector2(Resources.Font.MeasureString(t).X * 0.5f * RenderingDevice.TextureScaleFactor.X, 0), RenderingDevice.TextureScaleFactor, SpriteEffects.None, 0); } } if(level >= 4 && (!Input.WindowsOptions.HighScoreMode || levelNumber == 11)) { Rectangle r = new Rectangle(39, 36, 39, 36); if(levelNumber != 11) { if(time <= completionData.ThreeStarTime) { RenderingDevice.SpriteBatch.Draw(Resources.starTex, new Vector2(RenderingDevice.Width * 0.75f, RenderingDevice.Height * 0.4f), r, Color.White, 0, new Vector2(r.Width * 0.5f, 0), RenderingDevice.TextureScaleFactor, SpriteEffects.None, 0); if(GameManager.Manager.CurrentSave.LevelData[levelNumber].TimeStarNumber != LevelSelectData.Stars.Three) RenderingDevice.SpriteBatch.Draw(Resources.Plus1, new Vector2(RenderingDevice.Width * 0.75f + r.Width * 0.5f * RenderingDevice.TextureScaleFactor.X, RenderingDevice.Height * 0.4f), null, Color.White, 0, new Vector2(Resources.Plus1.Width, Resources.Plus1.Height) * 0.5f, RenderingDevice.TextureScaleFactor, SpriteEffects.None, 0); } else RenderingDevice.SpriteBatch.Draw(Resources.starTex, new Vector2(RenderingDevice.Width * 0.75f, RenderingDevice.Height * 0.4f), new Rectangle(0, 0, r.Width, r.Height), Color.White, 0, new Vector2(r.Width * 0.5f, 0), RenderingDevice.TextureScaleFactor, SpriteEffects.None, 0); if(lost <= completionData.ThreeStarBoxes) { RenderingDevice.SpriteBatch.Draw(Resources.starTex, new Vector2(RenderingDevice.Width * 0.75f, RenderingDevice.Height * 0.55f), r, Color.White, 0, new Vector2(r.Width * 0.5f, 0), RenderingDevice.TextureScaleFactor, SpriteEffects.None, 0); if(GameManager.Manager.CurrentSave.LevelData[levelNumber].BoxStarNumber != LevelSelectData.Stars.Three) RenderingDevice.SpriteBatch.Draw(Resources.Plus1, new Vector2(RenderingDevice.Width * 0.75f + r.Width * 0.5f * RenderingDevice.TextureScaleFactor.X, RenderingDevice.Height * 0.55f), null, Color.White, 0, new Vector2(Resources.Plus1.Width, Resources.Plus1.Height) * 0.5f, RenderingDevice.TextureScaleFactor, SpriteEffects.None, 0); } else RenderingDevice.SpriteBatch.Draw(Resources.starTex, new Vector2(RenderingDevice.Width * 0.75f, RenderingDevice.Height * 0.55f), new Rectangle(0, 0, r.Width, r.Height), Color.White, 0, new Vector2(r.Width * 0.5f, 0), RenderingDevice.TextureScaleFactor, SpriteEffects.None, 0); if(score >= completionData.ThreeStarScore) { RenderingDevice.SpriteBatch.Draw(Resources.starTex, new Vector2(RenderingDevice.Width * 0.75f, RenderingDevice.Height * 0.7f), r, Color.White, 0, new Vector2(r.Width * 0.5f, 0), RenderingDevice.TextureScaleFactor, SpriteEffects.None, 0); if(GameManager.Manager.CurrentSave.LevelData[levelNumber].ScoreStarNumber != LevelSelectData.Stars.Three) RenderingDevice.SpriteBatch.Draw(Resources.Plus1, new Vector2(RenderingDevice.Width * 0.75f + r.Width * 0.5f * RenderingDevice.TextureScaleFactor.X, RenderingDevice.Height * 0.7f), null, Color.White, 0, new Vector2(Resources.Plus1.Width, Resources.Plus1.Height) * 0.5f, RenderingDevice.TextureScaleFactor, SpriteEffects.None, 0); } else RenderingDevice.SpriteBatch.Draw(Resources.starTex, new Vector2(RenderingDevice.Width * 0.75f, RenderingDevice.Height * 0.7f), new Rectangle(0, 0, r.Width, r.Height), Color.White, 0, new Vector2(r.Width * 0.5f, 0), RenderingDevice.TextureScaleFactor, SpriteEffects.None, 0); } else { RenderingDevice.SpriteBatch.Draw(Resources.starTex, new Vector2(RenderingDevice.Width * 0.75f, RenderingDevice.Height * 0.5f), r, Color.White, 0, new Vector2(r.Width * 0.5f, 0), RenderingDevice.TextureScaleFactor, SpriteEffects.None, 0); if(!GameManager.Manager.CurrentSave.LevelData[levelNumber].Completed) RenderingDevice.SpriteBatch.Draw(Resources.Plus1, new Vector2(RenderingDevice.Width * 0.75f + r.Width * 0.5f * RenderingDevice.TextureScaleFactor.X, RenderingDevice.Height * 0.5f), null, Color.White, 0, new Vector2(Resources.Plus1.Width, Resources.Plus1.Height) * 0.5f, RenderingDevice.TextureScaleFactor, SpriteEffects.None, 0); } } if(level >= 5) { Vector2 screenSpot = new Vector2(RenderingDevice.Width * 0.5f, RenderingDevice.Height * 0.9f); Vector2 textLength = Resources.Font.MeasureString("Press to continue"); RenderingDevice.SpriteBatch.DrawString(Resources.Font, "Press to continue", screenSpot, Color.LightGray, 0, textLength * 0.5f, RenderingDevice.TextureScaleFactor, SpriteEffects.None, 0); if(Input.ControlScheme == ControlScheme.Keyboard) SymbolWriter.WriteKeyboardIcon(Input.WindowsOptions.SelectionKey, screenSpot, new Vector2((textLength.X * 0.5f + SymbolWriter.IconCenter.X * 1.5f - Resources.Font.MeasureString("Press ").X), SymbolWriter.IconCenter.Y), true); else SymbolWriter.WriteXboxIcon(Input.XboxOptions.SelectionKey, screenSpot, new Vector2((textLength.X * 0.5f + SymbolWriter.IconCenter.X * 1.5f - Resources.Font.MeasureString("Press ").X), SymbolWriter.IconCenter.Y), true); } RenderingDevice.SpriteBatch.End(); }
private void OnFirstFire() { level++; MediaSystem.PlaySoundEffect(SFXOptions.Result_Da); timer = new Timer(1500, OnSecondFire, false); timer.Start(); }
public ResultsScreen(TimeSpan timeTaken, int boxesLost, int score, int level, LevelCompletionData data) { this.levelNumber = level; completionData = data; time = new TimeSpan(timeTaken.Ticks); lost = boxesLost; this.score = score; //plane = Resources.resultsPlane; timer = new Timer(3000, OnFirstFire, false); entity = new BEPUphysics.Entities.Prefabs.Box(Vector3.Zero, 20, 20, 1); //transforms = new Matrix[plane.Bones.Count]; screenSpace = new Rectangle(0, 0, (int)RenderingDevice.Width, (int)RenderingDevice.Height); color = new Color(0, 0, 0, 255); }