Exemplo n.º 1
0
        public override void Dispose()
        {
            Instance = null;

            if (whoosh != null)
            {
                whoosh.Reserved   = false;
                whoosh.Disposable = true;
                whoosh            = null;
            }

            base.Dispose();
        }
Exemplo n.º 2
0
        internal static void UpdateStoreNotify()
        {
            MenuBackground mb = Instance;

            if (mb == null || mb.awesomeStartTime <= 0)
            {
                return;
            }

            if (StoreMode.HasNewStoreItems)
            {
                mb.storeNew.Bypass = false;
            }
        }
Exemplo n.º 3
0
        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;
        }
Exemplo n.º 4
0
        public MenuBackground()
        {
            Instance = this;

            if (AudioEngine.Effect != null)
            {
                whoosh = AudioEngine.Effect.LoadBuffer(AudioEngine.LoadSample(OsuSamples.MenuWhoosh), 1, false, true);
            }

            EndStopLenience  = 0.5f;
            EndBufferZone    = 0;
            AutomaticHeight  = false;
            Scrollbar        = false;
            ExactCoordinates = false;
            LockHorizontal   = false;
            CheckSpritesAreOnScreenBeforeRendering = false;

            rectangleLineLeft  = new Line(new Vector2(114, 55) - centre, new Vector2(169, 362) - centre);
            rectangleLineRight = new Line(new Vector2(-100, -855) - centre, new Vector2(1200, 250) - centre);

            //if (!GameBase.IsSlowDevice)
            {
                rectBorder = new pQuad(
                    rectangleLineLeft.p1 + new Vector2(-2, -2),
                    new Vector2(444 + 2, 172 - 2) - centre,
                    rectangleLineLeft.p2 + new Vector2(-2, 2),
                    new Vector2(528 + 3, 297 + 2) - centre,
                    true, 0.4f, new Color4(21, 21, 22, 255));
                rectBorder.AlphaBlend = false;
                rectBorder.Field      = FieldTypes.StandardSnapCentre;
                rectBorder.Origin     = OriginTypes.Centre;
                Add(rectBorder);
            }

            rect = new pQuad(
                rectangleLineLeft.p1,
                new Vector2(444, 172) - centre,
                rectangleLineLeft.p2,
                new Vector2(528, 297) - centre,
                true, 0.42f, new Color4(33, 35, 42, 255));
            rect.Field      = FieldTypes.StandardSnapCentre;
            rect.AlphaBlend = false;
            rect.Origin     = OriginTypes.Centre;
            rect.Colours    = new[]
            {
                new Color4(40, 43, 52, 255),
                new Color4(38, 40, 48, 255),
                new Color4(41, 43, 51, 255),
                new Color4(29, 30, 34, 255)
            };
            Add(rect);

            pTexture specialTexture = TextureManager.Load(OsuTexture.menu_item_background);

            specialTexture.X++;
            specialTexture.Width -= 2;

            yellow = new pQuad(
                Vector2.Zero,
                Vector2.Zero,
                Vector2.Zero,
                Vector2.Zero,
                true, 0.5f, new Color4(254, 242, 0, 255));
            yellow.Tag             = yellow.Colour;
            yellow.HandleClickOnUp = true;
            yellow.Texture         = specialTexture;
            yellow.Field           = FieldTypes.StandardSnapCentre;
            yellow.Origin          = OriginTypes.Centre;
            yellow.OnClick        += Option_OnClick;
            yellow.OnHover        += Option_OnHover;
            yellow.OnHoverLost    += Option_OnHoverLost;
            Add(yellow);
            lines.Add(yellow);

            orange = new pQuad(
                Vector2.Zero,
                Vector2.Zero,
                Vector2.Zero,
                Vector2.Zero,
                true, 0.5f, new Color4(255, 102, 0, 255));
            orange.Tag             = orange.Colour;
            orange.HandleClickOnUp = true;
            orange.Texture         = specialTexture;
            orange.Field           = FieldTypes.StandardSnapCentre;
            orange.Origin          = OriginTypes.Centre;
            orange.OnClick        += Option_OnClick;
            orange.OnHover        += Option_OnHover;
            orange.OnHoverLost    += Option_OnHoverLost;

            Add(orange);
            lines.Add(orange);

            blue = new pQuad(
                Vector2.Zero,
                Vector2.Zero,
                Vector2.Zero,
                Vector2.Zero,
                true, 0.5f, new Color4(0, 192, 245, 255));
            blue.Tag             = blue.Colour;
            blue.HandleClickOnUp = true;
            blue.Texture         = specialTexture;
            blue.Field           = FieldTypes.StandardSnapCentre;
            blue.Origin          = OriginTypes.Centre;
            blue.OnClick        += Option_OnClick;
            blue.OnHover        += Option_OnHover;
            blue.OnHoverLost    += Option_OnHoverLost;
            Add(blue);
            lines.Add(blue);

            pink = new pQuad(
                Vector2.Zero,
                Vector2.Zero,
                Vector2.Zero,
                Vector2.Zero,
                true, 0.5f, new Color4(237, 0, 140, 255));
            pink.Texture         = specialTexture;
            pink.Tag             = pink.Colour;
            pink.HandleClickOnUp = true;
            pink.Field           = FieldTypes.StandardSnapCentre;
            pink.Origin          = OriginTypes.Centre;
            pink.OnClick        += Option_OnClick;
            pink.OnHover        += Option_OnHover;
            pink.OnHoverLost    += Option_OnHoverLost;
            lines.Add(pink);
            Add(pink);

            ScaleScalar = 1.4f;

            pSprite text = new pSprite(TextureManager.Load(OsuTexture.menu_tutorial), new Vector2(-66, 3));

            text.Field       = FieldTypes.StandardSnapCentre;
            text.Origin      = OriginTypes.Centre;
            text.Rotation    = -rotation_offset;
            text.ScaleScalar = 1 / scale_offset;
            text.Alpha       = 0;
            Add(text);
            textSprites.Add(text);

            text             = new pSprite(TextureManager.Load(OsuTexture.menu_play), new Vector2(-48, 23.5f));
            text.Field       = FieldTypes.StandardSnapCentre;
            text.Origin      = OriginTypes.Centre;
            text.Rotation    = -rotation_offset;
            text.ScaleScalar = 1 / scale_offset;
            text.Alpha       = 0;
            Add(text);
            textSprites.Add(text);

            text             = new pSprite(TextureManager.Load(OsuTexture.menu_store), new Vector2(-43, 48));
            text.Field       = FieldTypes.StandardSnapCentre;
            text.Origin      = OriginTypes.Centre;
            text.Rotation    = -rotation_offset;
            text.ScaleScalar = 1 / scale_offset;
            text.Alpha       = 0;
            Add(text);
            textSprites.Add(text);


            storeNew             = new pSprite(TextureManager.Load(OsuTexture.new_notify), new Vector2(-17, 30));
            storeNew.Field       = FieldTypes.StandardSnapCentre;
            storeNew.Origin      = OriginTypes.Centre;
            storeNew.Rotation    = -rotation_offset;
            storeNew.ScaleScalar = 1 / scale_offset;
            storeNew.Alpha       = 0;
            storeNew.Transform(new TransformationF(TransformationType.Scale, storeNew.ScaleScalar * 0.8f, storeNew.ScaleScalar, 0, 600, EasingTypes.In)
            {
                Looping = true, LoopDelay = 600
            });
            storeNew.Transform(new TransformationF(TransformationType.Scale, storeNew.ScaleScalar, storeNew.ScaleScalar * 0.8f, 600, 1200, EasingTypes.Out)
            {
                Looping = true, LoopDelay = 600
            });
            storeNew.Bypass = true;
            textSprites.Add(storeNew);
            Add(storeNew);


            text             = new pSprite(TextureManager.Load(OsuTexture.menu_options), new Vector2(-44, 74));
            text.Field       = FieldTypes.StandardSnapCentre;
            text.Origin      = OriginTypes.Centre;
            text.Rotation    = -rotation_offset;
            text.ScaleScalar = 1 / scale_offset;
            text.Alpha       = 0;
            Add(text);
            textSprites.Add(text);
        }