internal void BeginSwitch(bool increase) { if (isSwitching) { return; } isSwitching = true; this.increase = increase; arrowSmall.ScaleScalar = 0.5f; arrowLarge.ScaleScalar = 1; spriteManager.Sprites.ForEach(s => s.Transformations.Clear()); text.ScaleScalar = 1; ((pSprite)text).Texture = TextureManager.Load(increase ? OsuTexture.stream_changing_up : OsuTexture.stream_changing_down); Transformation fadeIn = new TransformationF(TransformationType.Fade, 0, 1, Clock.ModeTime, Clock.ModeTime + 300); text.Transform(fadeIn); if (increase) { arrowSmall.Rotation = 0; arrowLarge.Rotation = 0; } else { arrowSmall.Rotation = MathHelper.Pi; arrowLarge.Rotation = MathHelper.Pi; } const int animation_length = 2000; Transformation smallMove = new TransformationV(new Vector2(0, increase ? 10 : -10), new Vector2(0, increase ? -10 : 10), Clock.ModeTime, Clock.ModeTime + animation_length); smallMove.Looping = true; Transformation largeMove = new TransformationV(new Vector2(0, increase ? 5 : -5), new Vector2(0, increase ? -5 : 5), Clock.ModeTime, Clock.ModeTime + animation_length); largeMove.Looping = true; Transformation fade1 = new TransformationF(TransformationType.Fade, 0, 0.5f, Clock.ModeTime, Clock.ModeTime + animation_length / 2) { Looping = true, LoopDelay = animation_length / 2 }; Transformation fade2 = new TransformationF(TransformationType.Fade, 0.5f, 0, Clock.ModeTime + animation_length / 2, Clock.ModeTime + animation_length) { Looping = true, LoopDelay = animation_length / 2 }; arrowLarge.Transform(largeMove, fade1, fade2); arrowSmall.Transform(smallMove, fade1, fade2); }
private void onStartButtonPressed(object sender, EventArgs args) { if (State == SelectState.Starting) { return; } if (Player.Difficulty == Difficulty.Expert && mapRequiresUnlock && !Player.Autoplay) { GameBase.Notify(LocalisationManager.GetString(OsuString.ExpertUnlock), delegate { pendingModeChange = false; }); return; } AudioEngine.PlaySample(OsuSamples.MenuHit); State = SelectState.Starting; pDrawable activatedSprite = null; switch (Player.Difficulty) { case Difficulty.Easy: s_ModeButtonStream.FadeOut(200); s_ModeButtonExpert.FadeOut(200); activatedSprite = s_ModeButtonEasy; break; case Difficulty.Normal: s_ModeButtonEasy.FadeOut(200); s_ModeButtonExpert.FadeOut(200); activatedSprite = s_ModeButtonStream; break; case Difficulty.Expert: s_ModeButtonStream.FadeOut(200); s_ModeButtonEasy.FadeOut(200); activatedSprite = s_ModeButtonExpert; break; } activatedSprite.Transform(new TransformationBounce(Clock.ModeTime, Clock.ModeTime + 500, 1.2f, 0.4f, 1)); activatedSprite.AdditiveFlash(800, 0.8f).Transform(new TransformationF(TransformationType.Scale, 1, 1.5f, Clock.Time, Clock.Time + 800, EasingTypes.In)); background.FlashColour(new Color4(200, 200, 200, 255), 800); s_ModeArrowLeft.FadeOut(200); s_ModeArrowRight.FadeOut(200); s_Footer.AdditiveFlash(500, 0.5f); GameBase.Scheduler.Add(delegate { Director.ChangeMode(OsuMode.Play); }, 800); }
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)); } }
public override void Initialize() { int initial_display = firstDisplay ? 2950 : 0; //spriteManagerBehind.Add(menuBackground); menuBackgroundNew = new MenuBackground(); menuBackgroundNew.Clocking = ClockTypes.Mode; const int logo_stuff_v_offset = -20; Transformation logoBounce = new TransformationBounce(initial_display, initial_display + 2000, 0.625f, 0.4f, 2); osuLogo = new pSprite(TextureManager.Load(OsuTexture.menu_osu), FieldTypes.StandardSnapCentre, OriginTypes.Centre, ClockTypes.Mode, new Vector2(0, logo_stuff_v_offset), 0.9f, true, Color4.White); osuLogo.Transform(logoBounce); osuLogo.OnClick += osuLogo_OnClick; menuBackgroundNew.Add(osuLogo); //gloss osuLogoGloss = new pSprite(TextureManager.Load(OsuTexture.menu_gloss), FieldTypes.StandardSnapCentre, OriginTypes.Centre, ClockTypes.Mode, new Vector2(0, logo_stuff_v_offset), 0.91f, true, Color4.White); osuLogoGloss.Additive = true; menuBackgroundNew.Add(osuLogoGloss); Transformation explosionFade = new TransformationF(TransformationType.Fade, 0, 1, initial_display + 500, initial_display + 700); pSprite explosion = new pSprite(TextureManager.Load(OsuTexture.menu_circle), FieldTypes.StandardSnapCentre, OriginTypes.Centre, ClockTypes.Mode, new Vector2(-90 * 0.625f, -90 * 0.625f + logo_stuff_v_offset), 0.8f, true, new Color4(112, 58, 144, 255)); explosion.ScaleScalar = sizeForExplosion(0); explosion.Transform(explosionFade); explosions.Add(explosion); menuBackgroundNew.Add(explosion); explosion = new pSprite(TextureManager.Load(OsuTexture.menu_circle), FieldTypes.StandardSnapCentre, OriginTypes.Centre, ClockTypes.Mode, new Vector2(170 * 0.625f, 10 * 0.625f + logo_stuff_v_offset), 0.8f, true, new Color4(242, 25, 138, 255)); explosion.ScaleScalar = sizeForExplosion(1); explosion.Transform(explosionFade); explosions.Add(explosion); menuBackgroundNew.Add(explosion); explosion = new pSprite(TextureManager.Load(OsuTexture.menu_circle), FieldTypes.StandardSnapCentre, OriginTypes.Centre, ClockTypes.Mode, new Vector2(-130 * 0.625f, 88 * 0.625f + logo_stuff_v_offset), 0.8f, true, new Color4(254, 148, 4, 255)); explosion.ScaleScalar = sizeForExplosion(2); explosion.Transform(explosionFade); explosions.Add(explosion); menuBackgroundNew.Add(explosion); Transformation fadeIn = new TransformationF(TransformationType.Fade, 0, 1, initial_display, initial_display); spriteManager.Sprites.ForEach(s => s.Transform(fadeIn)); stream = new pSprite(TextureManager.Load(OsuTexture.menu_stream), FieldTypes.StandardSnapCentre, OriginTypes.Centre, ClockTypes.Mode, new Vector2(0, 180), 0.95f, true, Color4.White); stream.Transform(new TransformationF(TransformationType.Fade, 0, 1, initial_display + 900, initial_display + 1300)); spriteManager.Add(stream); additiveStream = stream.Clone(); additiveStream.Additive = true; additiveStream.DrawDepth = 0.96f; additiveStream.Transform(new TransformationF(TransformationType.Fade, 0, 1, initial_display + 1000, initial_display + 1200) { Looping = true, LoopDelay = 5000 }); additiveStream.Transform(new TransformationF(TransformationType.Fade, 1, 0, initial_display + 1200, initial_display + 2000) { Looping = true, LoopDelay = 4400 }); spriteManager.Add(additiveStream); osuLogoSmall = new pSprite(TextureManager.Load(OsuTexture.menu_logo), FieldTypes.Standard, OriginTypes.TopLeft, ClockTypes.Mode, new Vector2(5, 5), 0.9f, true, Color4.White); osuLogoSmall.OnClick += delegate { if (State == MenuState.Select) { Director.ChangeMode(OsuMode.MainMenu); } }; osuLogoSmall.Alpha = 0; spriteManager.Add(osuLogoSmall); NewsButton = new NewsButton(); spriteManager.Add(NewsButton); NewsButton.Alpha = 0; menuBackgroundNew.Transform(fadeIn); osuLogo.Transform(fadeIn); InitializeBgm(); menuBackgroundNew.Transform(new TransformationBounce(initial_display, initial_display + 2000, menuBackgroundNew.ScaleScalar, 0.8f, 2)); if (firstDisplay) { pDrawable whiteLayer = pSprite.FullscreenWhitePixel; whiteLayer.Alpha = 0; whiteLayer.Clocking = ClockTypes.Mode; spriteManager.Add(whiteLayer); whiteLayer.Transform(new TransformationF(TransformationType.Fade, 0, 0.125f, 800, initial_display - 200)); whiteLayer.Transform(new TransformationF(TransformationType.Fade, 0.125f, 1f, initial_display - 200, initial_display)); whiteLayer.Transform(new TransformationF(TransformationType.Fade, 1, 0, initial_display, initial_display + 1200, EasingTypes.In)); pSprite headphones = new pSprite(TextureManager.Load(OsuTexture.menu_headphones), FieldTypes.StandardSnapCentre, OriginTypes.Centre, ClockTypes.Mode, new Vector2(0, 0), 0.9f, false, Color4.White); headphones.Additive = true; headphones.Transform(new TransformationF(TransformationType.Fade, 0, 1, 50, 200)); headphones.Transform(new TransformationF(TransformationType.Fade, 1, 1, 1000, initial_display)); spriteManager.Add(headphones); #if !DIST headphones.OnClick += delegate { GameBase.Mapper = true; pText t = new pText("ENABLED MAPPER MODE", 24, new Vector2(0, 30), 1, false, Color4.Red) { Field = FieldTypes.StandardSnapTopCentre, Origin = OriginTypes.Centre }; t.FadeOutFromOne(1500); spriteManager.Add(t); }; #endif pDrawable add = headphones.Clone(); add.Additive = true; add.Transform(new TransformationF(TransformationType.Fade, 0, 0.1f, 50, 200)); add.Transform(new TransformationF(TransformationType.Fade, 0.1f, 0.2f, 1000, initial_display)); add.Transform(new TransformationF(TransformationType.Scale, 1, 1.12f, 1000, initial_display, EasingTypes.Out)); spriteManager.Add(add); add = headphones.Clone(); add.Additive = true; add.Transform(new TransformationF(TransformationType.Fade, 0, 0.1f, 50, 200)); add.Transform(new TransformationF(TransformationType.Fade, 0.1f, 0.2f, 1000, initial_display)); add.Transform(new TransformationF(TransformationType.Scale, 1, 1.04f, 1000, initial_display, EasingTypes.Out)); spriteManager.Add(add); add = headphones.Clone(); add.Additive = true; add.Transform(new TransformationF(TransformationType.Fade, 0, 0.1f, 50, 200)); add.Transform(new TransformationF(TransformationType.Fade, 0.1f, 0.2f, 1000, initial_display)); add.Transform(new TransformationF(TransformationType.Scale, 1, 1.08f, 1000, initial_display, EasingTypes.Out)); spriteManager.Add(add); GameBase.Scheduler.Add(delegate { AudioEngine.PlaySample(OsuSamples.MainMenu_Intro); GameBase.Scheduler.Add(delegate { if (AudioEngine.Music != null) { AudioEngine.Music.Play(); } }, 2950); }, true); if (GameBase.Config.GetValue("firstrun", true)) { Notification notification = new Notification( LocalisationManager.GetString(OsuString.FirstRunWelcome), LocalisationManager.GetString(OsuString.FirstRunTutorial), NotificationStyle.YesNo, delegate(bool answer) { if (answer) { AudioEngine.PlaySample(OsuSamples.MenuHit); Director.ChangeMode(OsuMode.Tutorial); } GameBase.Config.SetValue("firstrun", false); GameBase.Config.SaveConfig(); }); GameBase.Scheduler.Add(delegate { GameBase.Notify(notification); }, initial_display + 1500); } } else { if (Director.LastOsuMode == OsuMode.Tutorial) { AudioEngine.Music.SeekTo(0); } AudioEngine.Music.Play(); } string username = GameBase.Config.GetValue <string>("username", null); bool hasAuth = GameBase.HasAuth; firstDisplay = false; }