internal bool EarnCoin()
        {
            if (!GameBase.HasLogin)
            {
                return(true);
            }

            pSprite coin = coinSingular.Clone();

            coin.Position = InputManager.CursorPosition / GameBase.WindowManager.Ratio;
            coin.Depth    = 0.99f;
            coin.FadeOut(1500);

            spriteManagerDialog.Add(coin);
            physics.Add(coin, new Vector2((float)RNG.NextDouble() * 100, (float)RNG.NextDouble() * -100));

            pSprite coinShine = coinSingular.Clone();

            coinShine.Additive  = true;
            coinShine.OnUpdate += delegate { coinShine.Position = coin.Position; };
            coinShine.FadeOut(500);

            spriteManagerDialog.Add(coinShine);

            AudioEngine.PlaySample(@"coins-earn", 80);

            Count++;

            pWebRequest snr = new pWebRequest(string.Format(General.WEB_ROOT + "/web/coins.php?action=earn&u={0}&h={1}&c={2}&cs={3}", ConfigManager.sUsername, ConfigManager.sPassword, Count, Checksum));

            snr.Finished += snr_onFinish;
            snr.Perform();

            return(true);
        }
Exemple #2
0
        internal override void AddMeter(HitObject h, int?customDelta)
        {
            float error = customDelta ?? AudioEngine.Time - h.StartTime;

            nextFadeTime = AudioEngine.Time + fade_delay;

            Show();

            if (error < 0)
            {
                error = Math.Max(error, -ErrorRange);
            }
            else
            {
                error = Math.Min(error, ErrorRange);
            }

            float pos = error / ErrorRange * (Width / 2);

            floatingError = floatingError * 0.8f + pos * 0.2f;

            arrow.MoveTo(new Vector2(CentrePosition.X + floatingError, arrow.InitialPosition.Y), 800, EasingTypes.Out);

            error = Math.Abs(error);

            const float width = 3;
            pSprite     a     = centre.Clone();

            a.Clock         = Clocks.AudioOnce;
            a.AlwaysDraw    = false;
            a.Depth         = 0.85f;
            a.InitialColour = error < hitObjectManager.HitWindow300 ? colour300 : (error < hitObjectManager.HitWindow100 ? colour100 : colour50);
            a.Position.X    = CentrePosition.X + pos;
            a.VectorScale.X = width;
            a.Alpha         = 0.4f;
            a.Additive      = true;
            a.FadeOut(10000);
            spriteManager.Add(a);
        }
Exemple #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;
        }