예제 #1
0
            public HitPoint(HitPointType pointType, AccuracyHeatmap heatmap)
            {
                this.pointType = pointType;
                this.heatmap   = heatmap;

                RelativeSizeAxes = Axes.Both;
                Alpha            = 1;
            }
예제 #2
0
        private void load()
        {
            InternalChild = new Container
            {
                Anchor           = Anchor.Centre,
                Origin           = Anchor.Centre,
                RelativeSizeAxes = Axes.Both,
                FillMode         = FillMode.Fit,
                Children         = new Drawable[]
                {
                    new CircularContainer
                    {
                        Anchor           = Anchor.Centre,
                        Origin           = Anchor.Centre,
                        RelativeSizeAxes = Axes.Both,
                        Size             = new Vector2(inner_portion),
                        Masking          = true,
                        BorderThickness  = line_thickness,
                        BorderColour     = Color4.White,
                        Child            = new Box
                        {
                            RelativeSizeAxes = Axes.Both,
                            Colour           = Color4Extensions.FromHex("#202624")
                        }
                    },
                    new Container
                    {
                        RelativeSizeAxes = Axes.Both,
                        Children         = new Drawable[]
                        {
                            new Container
                            {
                                RelativeSizeAxes = Axes.Both,
                                Padding          = new MarginPadding(1),
                                Child            = new Container
                                {
                                    RelativeSizeAxes = Axes.Both,
                                    Masking          = true,
                                    Children         = new Drawable[]
                                    {
                                        new Box
                                        {
                                            Anchor           = Anchor.Centre,
                                            Origin           = Anchor.Centre,
                                            EdgeSmoothness   = new Vector2(1),
                                            RelativeSizeAxes = Axes.Y,
                                            Height           = 2, // We're rotating along a diagonal - we don't really care how big this is.
                                            Width            = line_thickness / 2,
                                            Rotation         = -rotation,
                                            Alpha            = 0.3f,
                                        },
                                        new Box
                                        {
                                            Anchor           = Anchor.Centre,
                                            Origin           = Anchor.Centre,
                                            EdgeSmoothness   = new Vector2(1),
                                            RelativeSizeAxes = Axes.Y,
                                            Height           = 2,                  // We're rotating along a diagonal - we don't really care how big this is.
                                            Width            = line_thickness / 2, // adjust for edgesmoothness
                                            Rotation         = rotation
                                        },
                                    }
                                },
                            },
                            new Box
                            {
                                Anchor         = Anchor.TopRight,
                                Origin         = Anchor.TopRight,
                                Width          = 10,
                                EdgeSmoothness = new Vector2(1),
                                Height         = line_thickness / 2, // adjust for edgesmoothness
                            },
                            new Box
                            {
                                Anchor         = Anchor.TopRight,
                                Origin         = Anchor.TopRight,
                                EdgeSmoothness = new Vector2(1),
                                Width          = line_thickness / 2, // adjust for edgesmoothness
                                Height         = 10,
                            }
                        }
                    },
                    bufferedGrid = new BufferedContainer
                    {
                        RelativeSizeAxes      = Axes.Both,
                        CacheDrawnFrameBuffer = true,
                        BackgroundColour      = Color4Extensions.FromHex("#202624").Opacity(0),
                        Child = pointGrid = new GridContainer
                        {
                            RelativeSizeAxes = Axes.Both
                        }
                    },
                }
            };

            Vector2 centre      = new Vector2(points_per_dimension) / 2;
            float   innerRadius = centre.X * inner_portion;

            Drawable[][] points = new Drawable[points_per_dimension][];

            for (int r = 0; r < points_per_dimension; r++)
            {
                points[r] = new Drawable[points_per_dimension];

                for (int c = 0; c < points_per_dimension; c++)
                {
                    HitPointType pointType = Vector2.Distance(new Vector2(c, r), centre) <= innerRadius
                        ? HitPointType.Hit
                        : HitPointType.Miss;

                    var point = new HitPoint(pointType, this)
                    {
                        BaseColour = pointType == HitPointType.Hit ? new Color4(102, 255, 204, 255) : new Color4(255, 102, 102, 255)
                    };

                    points[r][c] = point;
                }
            }

            pointGrid.Content = points;

            if (score.HitEvents == null || score.HitEvents.Count == 0)
            {
                return;
            }

            // Todo: This should probably not be done like this.
            float radius = OsuHitObject.OBJECT_RADIUS * (1.0f - 0.7f * (playableBeatmap.Difficulty.CircleSize - 5) / 5) / 2;

            foreach (var e in score.HitEvents.Where(e => e.HitObject is HitCircle && !(e.HitObject is SliderTailCircle)))
            {
                if (e.LastHitObject == null || e.Position == null)
                {
                    continue;
                }

                AddPoint(((OsuHitObject)e.LastHitObject).StackedEndPosition, ((OsuHitObject)e.HitObject).StackedEndPosition, e.Position.Value, radius);
            }
        }