Beispiel #1
0
        protected override void CheckForResult(bool userTriggered, double timeOffset)
        {
            if (userTriggered)
            {
                DrawableSwellTick nextTick = null;

                foreach (var t in ticks)
                {
                    if (!t.IsHit)
                    {
                        nextTick = t;
                        break;
                    }
                }

                nextTick?.TriggerResult(HitResult.Great);

                var numHits = ticks.Count(r => r.IsHit);

                var completion = (float)numHits / HitObject.RequiredHits;

                expandingRing
                .FadeTo(expandingRing.Alpha + Math.Clamp(completion / 16, 0.1f, 0.6f), 50)
                .Then()
                .FadeTo(completion / 8, 2000, Easing.OutQuint);

                MainPiece.RotateTo((float)(completion * HitObject.Duration / 8), 4000, Easing.OutQuint);

                expandingRing.ScaleTo(1f + Math.Min(target_ring_scale - 1f, (target_ring_scale - 1f) * completion * 1.3f), 260, Easing.OutQuint);

                if (numHits == HitObject.RequiredHits)
                {
                    ApplyResult(r => r.Type = HitResult.Great);
                }
            }
            else
            {
                if (timeOffset < 0)
                {
                    return;
                }

                int numHits = 0;

                foreach (var tick in ticks)
                {
                    if (tick.IsHit)
                    {
                        numHits++;
                        continue;
                    }

                    tick.TriggerResult(HitResult.Miss);
                }

                var hitResult = numHits > HitObject.RequiredHits / 2 ? HitResult.Good : HitResult.Miss;

                ApplyResult(r => r.Type = hitResult);
            }
        }
Beispiel #2
0
 public DrawableDrumRoll(DrumRoll drumRoll)
     : base(drumRoll)
 {
     RelativeSizeAxes            = Axes.Y;
     MainPiece.Add(tickContainer = new Container <DrawableDrumRollTick> {
         RelativeSizeAxes = Axes.Both
     });
 }
        private void onNewResult(DrawableHitObject obj, JudgementResult result)
        {
            if (!(obj is DrawableDrumRollTick))
                return;

            if (result.Type > HitResult.Miss)
                rollingHits++;
            else
                rollingHits--;

            rollingHits = MathHelper.Clamp(rollingHits, 0, rolling_hits_for_engaged_colour);

            Color4 newColour = Interpolation.ValueAt((float)rollingHits / rolling_hits_for_engaged_colour, colourIdle, colourEngaged, 0, 1);
            MainPiece.FadeAccent(newColour, 100);
        }
Beispiel #4
0
        public DrawableDrumRoll(DrumRoll drumRoll)
            : base(drumRoll)
        {
            foreach (var tick in drumRoll.Ticks)
            {
                var newTick = new DrawableDrumRollTick(tick)
                {
                    X = (float)((tick.StartTime - HitObject.StartTime) / HitObject.Duration)
                };

                newTick.OnJudgement += onTickJudgement;

                AddNested(newTick);
                MainPiece.Add(newTick);
            }
        }
Beispiel #5
0
        private void onTickJudgement(DrawableHitObject obj, Judgement judgement)
        {
            if (judgement.Result > HitResult.Miss)
            {
                rollingHits++;
            }
            else
            {
                rollingHits--;
            }

            rollingHits = MathHelper.Clamp(rollingHits, 0, rolling_hits_for_dark_accent);

            Color4 newAccent = Interpolation.ValueAt((float)rollingHits / rolling_hits_for_dark_accent, AccentColour, accentDarkColour, 0, 1);

            MainPiece.FadeAccent(newAccent, 100);
        }
        private void onTickJudgement(DrawableHitObject obj, Judgement judgement)
        {
            if (judgement.Result > HitResult.Miss)
            {
                rollingHits++;
            }
            else
            {
                rollingHits--;
            }

            rollingHits = MathHelper.Clamp(rollingHits, 0, rolling_hits_for_engaged_colour);

            Color4 newColour = Interpolation.ValueAt((float)rollingHits / rolling_hits_for_engaged_colour, colourIdle, colourEngaged, 0, 1);

            MainPiece.FadeAccent(newColour, 100);
        }
Beispiel #7
0
        public DrawableDrumRoll(DrumRoll drumRoll)
            : base(drumRoll)
        {
            RelativeSizeAxes = Axes.Y;

            Container <DrawableDrumRollTick> tickContainer;

            MainPiece.Add(tickContainer = new Container <DrawableDrumRollTick> {
                RelativeSizeAxes = Axes.Both
            });

            foreach (var tick in drumRoll.NestedHitObjects.OfType <DrumRollTick>())
            {
                var newTick = new DrawableDrumRollTick(tick);
                newTick.OnNewResult += onNewTickResult;

                AddNested(newTick);
                tickContainer.Add(newTick);
            }
        }
Beispiel #8
0
        public DrawableDrumRoll(DrumRoll drumRoll)
            : base(drumRoll)
        {
            Width = (float)HitObject.Duration;

            Container <DrawableDrumRollTick> tickContainer;

            MainPiece.Add(tickContainer = new Container <DrawableDrumRollTick>
            {
                RelativeSizeAxes    = Axes.Both,
                RelativeChildOffset = new Vector2((float)HitObject.StartTime, 0),
                RelativeChildSize   = new Vector2((float)HitObject.Duration, 1)
            });

            foreach (var tick in drumRoll.NestedHitObjects.OfType <DrumRollTick>())
            {
                var newTick = new DrawableDrumRollTick(tick);
                newTick.OnJudgement += onTickJudgement;

                AddNested(newTick);
                tickContainer.Add(newTick);
            }
        }
Beispiel #9
0
 public DrawableRimHitStrong(Hit hit)
     : base(hit)
 {
     MainPiece.Add(new RimHitSymbolPiece());
 }
Beispiel #10
0
 public DrawableCentreHit(Hit hit)
     : base(hit)
 {
     MainPiece.Add(new CentreHitSymbolPiece());
 }
Beispiel #11
0
        public DrawableSwell(Swell swell)
            : base(swell)
        {
            FillMode = FillMode.Fit;

            Content.Add(bodyContainer = new Container
            {
                RelativeSizeAxes = Axes.Both,
                Depth            = 1,
                Children         = new Drawable[]
                {
                    expandingRing = new CircularContainer
                    {
                        Name             = "Expanding ring",
                        Anchor           = Anchor.Centre,
                        Origin           = Anchor.Centre,
                        Alpha            = 0,
                        RelativeSizeAxes = Axes.Both,
                        Blending         = BlendingMode.Additive,
                        Masking          = true,
                        Children         = new[]
                        {
                            new Box
                            {
                                RelativeSizeAxes = Axes.Both,
                                Alpha            = inner_ring_alpha,
                            }
                        }
                    },
                    targetRing = new CircularContainer
                    {
                        Name             = "Target ring (thick border)",
                        Anchor           = Anchor.Centre,
                        Origin           = Anchor.Centre,
                        RelativeSizeAxes = Axes.Both,
                        Masking          = true,
                        BorderThickness  = target_ring_thick_border,
                        Blending         = BlendingMode.Additive,
                        Children         = new Drawable[]
                        {
                            new Box
                            {
                                RelativeSizeAxes = Axes.Both,
                                Alpha            = 0,
                                AlwaysPresent    = true
                            },
                            new CircularContainer
                            {
                                Name             = "Target ring (thin border)",
                                Anchor           = Anchor.Centre,
                                Origin           = Anchor.Centre,
                                RelativeSizeAxes = Axes.Both,
                                Masking          = true,
                                BorderThickness  = target_ring_thin_border,
                                BorderColour     = Color4.White,
                                Children         = new[]
                                {
                                    new Box
                                    {
                                        RelativeSizeAxes = Axes.Both,
                                        Alpha            = 0,
                                        AlwaysPresent    = true
                                    }
                                }
                            }
                        }
                    }
                }
            });

            MainPiece.Add(symbol = new SwellSymbolPiece());
        }
Beispiel #12
0
        public DrawableSwell(Swell swell)
            : base(swell)
        {
            FillMode = FillMode.Fit;

            Content.Add(bodyContainer = new Container
            {
                RelativeSizeAxes = Axes.Both,
                Depth            = 1,
                Children         = new Drawable[]
                {
                    expandingRing = new CircularContainer
                    {
                        Name             = "Expanding ring",
                        Anchor           = Anchor.Centre,
                        Origin           = Anchor.Centre,
                        Alpha            = 0,
                        RelativeSizeAxes = Axes.Both,
                        Blending         = BlendingParameters.Additive,
                        Masking          = true,
                        Children         = new[]
                        {
                            new Box
                            {
                                RelativeSizeAxes = Axes.Both,
                                Alpha            = inner_ring_alpha,
                            }
                        }
                    },
                    targetRing = new CircularContainer
                    {
                        Name             = "Target ring (thick border)",
                        Anchor           = Anchor.Centre,
                        Origin           = Anchor.Centre,
                        RelativeSizeAxes = Axes.Both,
                        Masking          = true,
                        BorderThickness  = target_ring_thick_border,
                        Blending         = BlendingParameters.Additive,
                        Children         = new Drawable[]
                        {
                            new Box
                            {
                                RelativeSizeAxes = Axes.Both,
                                Alpha            = 0,
                                AlwaysPresent    = true
                            },
                            new CircularContainer
                            {
                                Name             = "Target ring (thin border)",
                                Anchor           = Anchor.Centre,
                                Origin           = Anchor.Centre,
                                RelativeSizeAxes = Axes.Both,
                                Masking          = true,
                                BorderThickness  = target_ring_thin_border,
                                BorderColour     = Color4.White,
                                Children         = new[]
                                {
                                    new Box
                                    {
                                        RelativeSizeAxes = Axes.Both,
                                        Alpha            = 0,
                                        AlwaysPresent    = true
                                    }
                                }
                            }
                        }
                    }
                }
            });

            MainPiece.Add(symbol = new SwellSymbolPiece());

            foreach (var tick in HitObject.NestedHitObjects.OfType <SwellTick>())
            {
                var vis = new DrawableSwellTick(tick);

                ticks.Add(vis);
                AddInternal(vis);
                AddNested(vis);
            }
        }