private void ButtonRestart_OnClick(object sender, EventArgs e) { pSprite s = sender as pSprite; s.AdditiveFlash(500, 1); Director.ChangeMode(OsuMode.Play); AudioEngine.PlaySample(OsuSamples.MenuHit); }
internal void SetDisplay(int countdown) { bool didChangeTexture = true; switch (countdown) { case 0: text.Texture = TextureManager.Load(OsuTexture.countdown_go); spriteManager.FadeOut(400); AudioEngine.PlaySample(OsuSamples.countgo); HasFinished = true; break; case 1: text.Texture = TextureManager.Load(OsuTexture.countdown_1); AudioEngine.PlaySample(OsuSamples.count1); break; case 2: text.Texture = TextureManager.Load(OsuTexture.countdown_2); AudioEngine.PlaySample(OsuSamples.count2); break; case 3: text.Texture = TextureManager.Load(OsuTexture.countdown_3); AudioEngine.PlaySample(OsuSamples.count3); break; case 4: case 5: case 6: case 7: text.Texture = TextureManager.Load(OsuTexture.countdown_ready); if (spriteManager.Alpha == 0) { spriteManager.FadeIn(200); } didChangeTexture = countdown == 7; break; default: return; } if (countdown < 4) { text.Transformations.RemoveAll(t => t is TransformationBounce); background.Transformations.RemoveAll(t => t is TransformationBounce); text.Transform(new TransformationBounce(Clock.AudioTime, Clock.AudioTime + 300, Math.Max(1, text.ScaleScalar), 0.2f, 3)); background.Transform(new TransformationBounce(Clock.AudioTime, Clock.AudioTime + 300, Math.Max(1, background.ScaleScalar), 0.2f, 3)); if (OnPulse != null) { OnPulse(); } } if (didChangeTexture) { pDrawable flash = text.AdditiveFlash(300, 0.5f); flash.Transform(new TransformationF(TransformationType.Scale, 1, 1.2f, Clock.AudioTime, Clock.AudioTime + 400)); flash.Transform(new TransformationF(TransformationType.Rotation, 0, 0.1f, Clock.AudioTime, Clock.AudioTime + 400)); } }
private void AddControls(NotificationStyle style) { const int button_height = 95; switch (style) { case NotificationStyle.Okay: { pDrawable additiveButton = null; okayButton = new pSprite(TextureManager.Load(OsuTexture.notification_button_ok), new Vector2(0, button_height)) { Field = FieldTypes.StandardSnapCentre, Origin = OriginTypes.Centre, Clocking = ClockTypes.Game, DimImmune = true, DrawDepth = 0.99f, HandleClickOnUp = true }; okayButton.OnHover += delegate { additiveButton = okayButton.AdditiveFlash(10000, 0.4f); }; okayButton.OnHoverLost += delegate { if (additiveButton != null) { additiveButton.FadeOut(100); } }; okayButton.OnClick += delegate { dismiss(true); }; Add(okayButton); pText okayText = new pText(LocalisationManager.GetString(OsuString.Okay), 24, new Vector2(0, button_height), Vector2.Zero, 1, true, Color4.White, true) { Field = FieldTypes.StandardSnapCentre, Origin = OriginTypes.Centre, Clocking = ClockTypes.Game, DimImmune = true }; Add(okayText); } break; case NotificationStyle.YesNo: { pDrawable additiveButton = null; okayButton = new pSprite(TextureManager.Load(OsuTexture.notification_button_yes), new Vector2(-140, button_height)) { Field = FieldTypes.StandardSnapCentre, Origin = OriginTypes.Centre, Clocking = ClockTypes.Game, DimImmune = true, DrawDepth = 0.99f, HandleClickOnUp = true }; okayButton.OnHover += delegate { additiveButton = okayButton.AdditiveFlash(10000, 0.4f); }; okayButton.OnHoverLost += delegate { if (additiveButton != null) { additiveButton.FadeOut(100); } }; okayButton.OnClick += delegate { dismiss(true); }; Add(okayButton); pText okayText = new pText(LocalisationManager.GetString(OsuString.Yes), 24, new Vector2(-140, button_height), Vector2.Zero, 1, true, Color4.White, true) { Field = FieldTypes.StandardSnapCentre, Origin = OriginTypes.Centre, Clocking = ClockTypes.Game, DimImmune = true }; Add(okayText); } { pDrawable additiveButton = null; cancelButton = new pSprite(TextureManager.Load(OsuTexture.notification_button_no), new Vector2(140, button_height)) { Field = FieldTypes.StandardSnapCentre, Origin = OriginTypes.Centre, Clocking = ClockTypes.Game, DimImmune = true, DrawDepth = 0.99f, HandleClickOnUp = true }; cancelButton.OnHover += delegate { additiveButton = cancelButton.AdditiveFlash(10000, 0.4f); }; cancelButton.OnHoverLost += delegate { if (additiveButton != null) { additiveButton.FadeOut(100); } }; cancelButton.OnClick += delegate { dismiss(false); }; Add(cancelButton); pText cancelText = new pText(LocalisationManager.GetString(OsuString.No), 24, new Vector2(140, button_height), Vector2.Zero, 1, true, Color4.White, true) { Field = FieldTypes.StandardSnapCentre, Origin = OriginTypes.Centre, Clocking = ClockTypes.Game, DimImmune = true }; Add(cancelText); } break; } }
/// <summary> /// Updates the states of mode selection arrows depending on the current mode selection. /// </summary> private void updateModeSelectionArrows(bool isNewDifficulty = true) { bool hasPrevious = false; bool hasNext = false; string text = null; velocity = 0; switch (Player.Difficulty) { case Difficulty.Easy: hasNext = true; difficultySelectOffset = mode_button_width; text = LocalisationManager.GetString(OsuString.YouCantFail); background.FadeColour(new Color4(110, 110, 110, 255), 500); break; case Difficulty.Normal: hasPrevious = true; hasNext = true; difficultySelectOffset = 0; text = LocalisationManager.GetString(OsuString.DynamicStreamSwitching); background.FadeColour(new Color4(70, 70, 70, 255), 500); break; case Difficulty.Expert: hasPrevious = true; difficultySelectOffset = -mode_button_width; text = LocalisationManager.GetString(OsuString.NotForTheFaintHearted); background.FadeColour(new Color4(30, 30, 30, 255), 500); break; } s_ModeArrowLeft.Colour = hasPrevious ? Color4.White : Color4.DarkGray; s_ModeArrowRight.Colour = hasNext ? Color4.White : Color4.DarkGray; if (isNewDifficulty || bmi == null) { if (s_ModeDescriptionText.Text != text) { s_ModeDescriptionText.MoveTo(new Vector2(-20, s_ModeDescriptionText.Position.Y), 100, EasingTypes.Out); s_ModeDescriptionText.FadeOut(100); } GameBase.Scheduler.Add(delegate { //could have hit the back button really fast. if (State == SelectState.DifficultySelect) { if (s_ModeDescriptionText.Text != text) { s_ModeDescriptionText.Text = text; s_ModeDescriptionText.Position = new Vector2(20, s_ModeDescriptionText.Position.Y); s_ModeDescriptionText.MoveTo(new Vector2(0, s_ModeDescriptionText.Position.Y), 100, EasingTypes.In); s_ModeDescriptionText.FadeInFromZero(300); } bmi = BeatmapDatabase.GetDifficultyInfo(Player.Beatmap, Player.Difficulty); s_ScoreInfo.Transform(new TransformationBounce(Clock.ModeTime, Clock.ModeTime + 200, 1, 0.05f, 2)); s_ScoreInfo.Text = LocalisationManager.GetString(OsuString.PlayCount) + " " + bmi.Playcount.ToString().PadLeft(3, '0') + '\n' + LocalisationManager.GetString(OsuString.HighScore) + " "; if (bmi.HighScore == null) { s_ScoreInfo.Text += @"000000"; s_ScoreRank.Texture = null; } else { s_ScoreInfo.Text += bmi.HighScore.totalScore.ToString().PadLeft(6, '0'); s_ScoreRank.Texture = bmi.HighScore.RankingTextureSmall; } if (s_ScoreRank.Texture != null) { s_ScoreRank.AdditiveFlash(500, 0.5f); s_ScoreInfo.MoveTo(new Vector2(GameBase.SuperWidePadding + 40, 64), 200, EasingTypes.In); } else { s_ScoreInfo.MoveTo(new Vector2(GameBase.SuperWidePadding, 64), 200, EasingTypes.In); } } }, 100); } }
private void Director_OnTransitionEnded() { //hit -> combo -> accuracy -> spin int time = cameFromSongSelect ? 0 : 500; int increment = cameFromSongSelect ? 0 : 500; GameBase.Scheduler.Add(delegate { AudioEngine.PlaySample(OsuSamples.RankingBam); countScoreHit.ShowInt(RankableScore.hitScore, 6); countScoreHit.AdditiveFlash(500, 1); addedScore += RankableScore.hitScore; countTotalScore.ShowInt(addedScore, 6, true); countTotalScore.FlashColour(Color4.White, 1000); }, time); time += increment; GameBase.Scheduler.Add(delegate { AudioEngine.PlaySample(OsuSamples.RankingBam); countScoreCombo.ShowInt(RankableScore.comboBonusScore, 6); countScoreCombo.AdditiveFlash(500, 1); addedScore += RankableScore.comboBonusScore; countTotalScore.ShowInt(addedScore, 6, true); countTotalScore.FlashColour(Color4.White, 1000); }, time); time += increment; GameBase.Scheduler.Add(delegate { AudioEngine.PlaySample(OsuSamples.RankingBam); countScoreAccuracy.ShowInt(RankableScore.accuracyBonusScore, 6); countScoreAccuracy.AdditiveFlash(500, 1); addedScore += RankableScore.accuracyBonusScore; countTotalScore.ShowInt(addedScore, 6, true); countTotalScore.FlashColour(Color4.White, 1000); }, time); time += increment; GameBase.Scheduler.Add(delegate { AudioEngine.PlaySample(OsuSamples.RankingBam); countScoreSpin.ShowInt(RankableScore.spinnerBonusScore, 6); countScoreSpin.AdditiveFlash(500, 1); addedScore += RankableScore.spinnerBonusScore; countTotalScore.ShowInt(addedScore, 6, true); countTotalScore.FlashColour(Color4.White, 1000); }, time); time += increment; GameBase.Scheduler.Add(delegate { if (RankableScore.Ranking == Rank.D) { AudioEngine.PlaySample(OsuSamples.RankFail); rankGraphic.FadeIn(2000); rankGraphic.ScaleScalar = 0.7f; rankGraphic.ScaleTo(1, 1400, EasingTypes.In); GameBase.Scheduler.Add(delegate { int interval = 100; rankGraphic.Transform(new TransformationF(TransformationType.Rotation, 0, 0.3f, Clock.Time, Clock.Time + interval)); rankGraphic.Transform(new TransformationF(TransformationType.Rotation, 0.3f, -0.3f, Clock.Time + interval, Clock.Time + interval * 3)); rankGraphic.Transform(new TransformationF(TransformationType.Rotation, -0.3f, 0, Clock.Time + interval * 3, Clock.Time + interval * 4)); }, 1550); } else { AudioEngine.PlaySample(OsuSamples.RankPass); rankGraphic.FadeIn(4000); GameBase.Scheduler.Add(delegate { rankGraphic.Transformations.Clear(); rankGraphic.Alpha = 1; rankGraphic.AdditiveFlash(1500, 1); }, 1400); } }, time); time += increment + 1200; if (isPersonalBest) { GameBase.Scheduler.Add(delegate { pSprite personalBest = new pSprite(TextureManager.Load(OsuTexture.personalbest), FieldTypes.StandardSnapBottomRight, OriginTypes.Centre, ClockTypes.Mode, new Vector2(80, 250), 1, true, Color4.White); personalBest.FadeInFromZero(250); personalBest.ScaleScalar = 1.6f; personalBest.RotateTo(0.2f, 250); personalBest.ScaleTo(1, 250, EasingTypes.Out); GameBase.Scheduler.Add(delegate { personalBest.AdditiveFlash(1000, 1).ScaleTo(1.05f, 1000); }, 250); layer1.Add(personalBest); }, time); } time += increment; if (!cameFromSongSelect) { GameBase.Scheduler.Add(finishDisplaying, time); } }