コード例 #1
0
        internal override void UpdateInput()
        {
            if (GameBase.SixtyFramesPerSecondFrame)
            {
                if ((!InputManager.ReplayMode && KeyboardHandler.IsKeyDown(BindingManager.For(Bindings.OsuSmoke))) ||
                    (InputManager.ReplayMode && InputManager.CurrentReplayFrame != null && (InputManager.CurrentReplayFrame.buttonState & pButtonState.Smoke) > 0))
                {
                    float distance = lastSmokeSprite != null?Vector2.Distance(lastSmokeSprite.Position, InputManager.CursorPosition) : 0;

                    float acceptedWidth = Math.Max(2, lastSmokeSprite != null ? (lastSmokeSprite.DrawWidth * 0.625f * GameBase.WindowManager.Ratio) / 4f : 0);
                    int   steps         = Math.Max(1, (int)(distance / acceptedWidth));

                    Vector2 end = InputManager.CursorPosition;
                    if (lastSmokeSprite == null || lastSmokeSprite.Position != end)
                    {
                        Vector2 start = lastSmokeSprite != null ? lastSmokeSprite.Position + Vector2.Normalize(end - lastSmokeSprite.Position) * Math.Min(distance, acceptedWidth) : InputManager.CursorPosition;

                        for (int j = 0; j < steps; j++)
                        {
                            pSprite smoke = new pSprite(t_smoke, Fields.NativeStandardScale, Origins.Centre, Clocks.Game, Vector2.Lerp(start, end, (float)j / steps), 1, false, Color.White);
                            smoke.Additive = true;
                            smoke.Alpha    = 0.6f;
                            smoke.Scale    = 0.5f;
                            smoke.Rotation = RNG.NextSingle(10f);
                            smoke.RotateTo(smoke.Rotation + RNG.NextSingle(-0.25f, 0.25f), 500, EasingTypes.Out);
                            smoke.ScaleTo(smoke.Scale * 1f, 2000, EasingTypes.Out);
                            smoke.FadeOut(4000);

                            player.spriteManagerBelowHitObjectsWidescreen.Add(smoke);
                            lastSmokeTrailLength.Add(smoke);
                            lastSmokeSprite = smoke;
                        }
                    }

                    if (lastSmokeTrailLength.Count > 50 && Vector2.Distance(lastSmokeSprite.Position, lastSmokeTrailLength[0].Position) < 10)
                    {
                        endTrail();
                    }
                }
                else
                {
                    endTrail();
                    lastSmokeSprite = null;
                }
            }

            base.UpdateInput();
        }
コード例 #2
0
        internal void SetStatus(bool status, Mods specificStatus = Mods.None, bool playSound = true)
        {
            Sprites.ForEach(s =>
            {
                s.FadeOut(100);
                s.ScaleTo(1, 400, EasingTypes.OutElastic);
                s.RotateTo(0, 400, EasingTypes.OutElastic);
            });

            Mods lastState = State;

            if (!status)
            {
                State = Mods.None;
                Sprites[0].FadeIn(100);
            }
            else
            {
                pSprite match = Sprites.Find(s => s.TagNumeric == (int)specificStatus);
                if (match == null || specificStatus == Mods.None)
                {
                    match = Sprites[0];
                }

                State = (Mods)match.TagNumeric;

                match.FadeIn(100);
                match.ScaleTo(1.2f, 400, EasingTypes.OutElastic);
                match.RotateTo(0.1f, 400, EasingTypes.OutElastic);
            }

            glow.FadeTo(State == Mods.None ? 0 : 0.2f, 100);

            if (lastState != State && playSound)
            {
                AudioEngine.Click(null, State != Mods.None ? @"check-on" : @"check-off");
            }

            if (StateChanged != null)
            {
                StateChanged(this, null);
            }
        }
コード例 #3
0
ファイル: Results.cs プロジェクト: indefined/osu-stream
        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);
            }
        }