Пример #1
0
        protected override Drawable CreateContent()
        {
            var container = new FillFlowContainer
            {
                AutoSizeAxes = Axes.Both,
                Direction    = FillDirection.Horizontal,
                Child        = counter = new StatisticCounter
                {
                    Anchor = Anchor.TopCentre,
                    Origin = Anchor.TopCentre
                }
            };

            if (maxCount != null)
            {
                container.Add(new OsuSpriteText
                {
                    Anchor  = Anchor.BottomCentre,
                    Origin  = Anchor.BottomCentre,
                    Font    = OsuFont.Torus.With(size: 12, fixedWidth: true),
                    Spacing = new Vector2(-2, 0),
                    Text    = $"/{maxCount}"
                });
            }

            return(container);
        }
Пример #2
0
        public HUDOverlay(ScoreProcessor scoreProcessor, RulesetContainer rulesetContainer, WorkingBeatmap working, IClock offsetClock, IAdjustableClock adjustableClock)
        {
            RelativeSizeAxes = Axes.Both;

            Add(content = new Container
            {
                RelativeSizeAxes = Axes.Both,

                Children = new Drawable[]
                {
                    ComboCounter          = CreateComboCounter(),
                    ScoreCounter          = CreateScoreCounter(),
                    AccuracyCounter       = CreateAccuracyCounter(),
                    HealthDisplay         = CreateHealthDisplay(),
                    Progress              = CreateProgress(),
                    ModDisplay            = CreateModsContainer(),
                    PlayerSettingsOverlay = CreatePlayerSettingsOverlay(),
                    new FillFlowContainer
                    {
                        Anchor       = Anchor.BottomRight,
                        Origin       = Anchor.BottomRight,
                        Position     = -new Vector2(5, TwoLayerButton.SIZE_RETRACTED.Y),
                        AutoSizeAxes = Axes.Both,
                        Direction    = FillDirection.Vertical,
                        Children     = new Drawable[]
                        {
                            KeyCounter = CreateKeyCounter(adjustableClock as IFrameBasedClock),
                            HoldToQuit = CreateQuitButton(),
                        }
                    }
                }
            });

            BindProcessor(scoreProcessor);
            BindRulesetContainer(rulesetContainer);

            Progress.Objects      = rulesetContainer.Objects;
            Progress.AudioClock   = offsetClock;
            Progress.AllowSeeking = rulesetContainer.HasReplayLoaded;
            Progress.OnSeek       = pos => adjustableClock.Seek(pos);

            ModDisplay.Current.BindTo(working.Mods);

            PlayerSettingsOverlay.PlaybackSettings.AdjustableClock = adjustableClock;
        }
Пример #3
0
 protected override Drawable CreateContent() => counter = new StatisticCounter
 {
     Anchor = Anchor.TopCentre,
     Origin = Anchor.TopCentre
 };
Пример #4
0
 protected override Drawable CreateContent() => counter = new Counter();
Пример #5
0
        private void load(BeatmapDifficultyCache beatmapDifficultyCache)
        {
            var    beatmap  = score.BeatmapInfo;
            var    metadata = beatmap.BeatmapSet?.Metadata ?? beatmap.Metadata;
            string creator  = metadata.Author.Username;

            var topStatistics = new List <StatisticDisplay>
            {
                new AccuracyStatistic(score.Accuracy),
                new ComboStatistic(score.MaxCombo, !score.Statistics.TryGetValue(HitResult.Miss, out int missCount) || missCount == 0),
                new PerformanceStatistic(score),
            };

            var bottomStatistics = new List <HitResultStatistic>();

            foreach (var result in score.GetStatisticsForDisplay())
            {
                bottomStatistics.Add(new HitResultStatistic(result));
            }

            statisticDisplays.AddRange(topStatistics);
            statisticDisplays.AddRange(bottomStatistics);

            var starDifficulty = beatmapDifficultyCache.GetDifficultyAsync(beatmap, score.Ruleset, score.Mods).GetResultSafely();

            AddInternal(new FillFlowContainer
            {
                RelativeSizeAxes = Axes.Both,
                Direction        = FillDirection.Vertical,
                Spacing          = new Vector2(20),
                Children         = new Drawable[]
                {
                    new FillFlowContainer
                    {
                        Anchor           = Anchor.TopCentre,
                        Origin           = Anchor.TopCentre,
                        RelativeSizeAxes = Axes.X,
                        AutoSizeAxes     = Axes.Y,
                        Direction        = FillDirection.Vertical,
                        Children         = new Drawable[]
                        {
                            new OsuSpriteText
                            {
                                Anchor   = Anchor.TopCentre,
                                Origin   = Anchor.TopCentre,
                                Text     = new RomanisableString(metadata.TitleUnicode, metadata.Title),
                                Font     = OsuFont.Torus.With(size: 20, weight: FontWeight.SemiBold),
                                MaxWidth = ScorePanel.EXPANDED_WIDTH - padding * 2,
                                Truncate = true,
                            },
                            new OsuSpriteText
                            {
                                Anchor   = Anchor.TopCentre,
                                Origin   = Anchor.TopCentre,
                                Text     = new RomanisableString(metadata.ArtistUnicode, metadata.Artist),
                                Font     = OsuFont.Torus.With(size: 14, weight: FontWeight.SemiBold),
                                MaxWidth = ScorePanel.EXPANDED_WIDTH - padding * 2,
                                Truncate = true,
                            },
                            new Container
                            {
                                Anchor = Anchor.TopCentre,
                                Origin = Anchor.TopCentre,
                                Margin = new MarginPadding {
                                    Top = 40
                                },
                                RelativeSizeAxes = Axes.X,
                                Height           = 230,
                                Child            = new AccuracyCircle(score, withFlair)
                                {
                                    Anchor           = Anchor.Centre,
                                    Origin           = Anchor.Centre,
                                    RelativeSizeAxes = Axes.Both,
                                    FillMode         = FillMode.Fit,
                                }
                            },
                            scoreCounter = new TotalScoreCounter
                            {
                                Margin = new MarginPadding {
                                    Top = 0, Bottom = 5
                                },
                                Current       = { Value = 0 },
                                Alpha         = 0,
                                AlwaysPresent = true
                            },
                            starAndModDisplay = new FillFlowContainer
                            {
                                Anchor       = Anchor.TopCentre,
                                Origin       = Anchor.TopCentre,
                                AutoSizeAxes = Axes.Both,
                                Spacing      = new Vector2(5, 0),
                            },
                            new FillFlowContainer
                            {
                                Anchor       = Anchor.TopCentre,
                                Origin       = Anchor.TopCentre,
                                Direction    = FillDirection.Vertical,
                                AutoSizeAxes = Axes.Both,
                                Children     = new Drawable[]
                                {
                                    new OsuSpriteText
                                    {
                                        Anchor = Anchor.TopCentre,
                                        Origin = Anchor.TopCentre,
                                        Text   = beatmap.DifficultyName,
                                        Font   = OsuFont.Torus.With(size: 16, weight: FontWeight.SemiBold),
                                    },
                                    new OsuTextFlowContainer(s => s.Font = OsuFont.Torus.With(size: 12))
                                    {
                                        Anchor       = Anchor.TopCentre,
                                        Origin       = Anchor.TopCentre,
                                        AutoSizeAxes = Axes.Both,
                                        Direction    = FillDirection.Horizontal,
                                    }.With(t =>
                                    {
                                        if (!string.IsNullOrEmpty(creator))
                                        {
                                            t.AddText("mapped by ");
                                            t.AddText(creator, s => s.Font = s.Font.With(weight: FontWeight.SemiBold));
                                        }
                                    })
                                }
                            },
                        }
                    },
                    new FillFlowContainer
                    {
                        RelativeSizeAxes = Axes.X,
                        AutoSizeAxes     = Axes.Y,
                        Direction        = FillDirection.Vertical,
                        Spacing          = new Vector2(0, 5),
                        Children         = new Drawable[]
                        {
                            new GridContainer
                            {
                                RelativeSizeAxes = Axes.X,
                                AutoSizeAxes     = Axes.Y,
                                Content          = new[] { topStatistics.Cast <Drawable>().ToArray() },
                                RowDimensions    = new[]
                                {
                                    new Dimension(GridSizeMode.AutoSize),
                                }
                            },
                            new GridContainer
                            {
                                RelativeSizeAxes = Axes.X,
                                AutoSizeAxes     = Axes.Y,
                                Content          = new[] { bottomStatistics.Where(s => s.Result <= HitResult.Perfect).ToArray() },
                                RowDimensions    = new[]
                                {
                                    new Dimension(GridSizeMode.AutoSize),
                                }
                            },
                            new GridContainer
                            {
                                RelativeSizeAxes = Axes.X,
                                AutoSizeAxes     = Axes.Y,
                                Content          = new[] { bottomStatistics.Where(s => s.Result > HitResult.Perfect).ToArray() },
                                RowDimensions    = new[]
                                {
                                    new Dimension(GridSizeMode.AutoSize),
                                }
                            }
                        }
                    }
                }
            });

            if (score.Date != default)
            {
                AddInternal(new PlayedOnText(score.Date));
            }

            if (starDifficulty != null)
            {
                starAndModDisplay.Add(new StarRatingDisplay(starDifficulty.Value)
                {
                    Anchor = Anchor.CentreLeft,
                    Origin = Anchor.CentreLeft
                });
            }

            if (score.Mods.Any())
            {
                starAndModDisplay.Add(new ModDisplay
                {
                    Anchor        = Anchor.CentreLeft,
                    Origin        = Anchor.CentreLeft,
                    ExpansionMode = ExpansionMode.AlwaysExpanded,
                    Scale         = new Vector2(0.5f),
                    Current       = { Value = score.Mods }
                });
            }
        }
Пример #6
0
 public void Remove(RollingCounter value)
 {
     base.List.Remove(value as Object);
 }
Пример #7
0
 public RollingCounter Add(RollingCounter value)
 {
     base.List.Add(value as object);
     return(value);
 }