示例#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(true);

                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.Drawable.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(false);
                }

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

                ApplyResult(r => r.Type = hitResult);
            }
        }
示例#2
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());

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

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