private void updateCount(object sender, NotifyCollectionChangedEventArgs e) { count.Clear(); count.AddText(Playlist.Count.ToLocalisableString(), s => s.Font = s.Font.With(weight: FontWeight.Bold)); count.AddText(" "); count.AddText("Beatmap".ToQuantity(Playlist.Count, ShowQuantityAs.None)); }
private void updateCount() { int activeItems = Playlist.Count > 0 || PlaylistItemStats.Value == null // For now, use the playlist as the source of truth if it has any items. // This allows the count to display correctly on the room screen (after joining a room). ? Playlist.Count(i => !i.Expired) : PlaylistItemStats.Value.CountActive; count.Clear(); count.AddText(activeItems.ToLocalisableString(), s => s.Font = s.Font.With(weight: FontWeight.Bold)); count.AddText(" "); count.AddText("Beatmap".ToQuantity(activeItems, ShowQuantityAs.None)); }
private void skinChanged() { headerText.Clear(); headerText.AddParagraph("Skin editor", cp => cp.Font = OsuFont.Default.With(size: 24)); headerText.NewParagraph(); headerText.AddText("Currently editing ", cp => { cp.Font = OsuFont.Default.With(size: 12); cp.Colour = colours.Yellow; }); headerText.AddText($"{currentSkin.Value.SkinInfo}", cp => { cp.Font = OsuFont.Default.With(size: 12, weight: FontWeight.Bold); cp.Colour = colours.Yellow; }); skins.EnsureMutableSkin(); hasBegunMutating = true; }
protected override void OnRoomUpdated() { base.OnRoomUpdated(); rankFlow.Clear(); if (Room == null || Room.Users.All(u => u.User == null)) { rankFlow.AddText("-"); return; } int minRank = Room.Users.Select(u => u.User?.Statistics.GlobalRank ?? 0).DefaultIfEmpty(0).Min(); int maxRank = Room.Users.Select(u => u.User?.Statistics.GlobalRank ?? 0).DefaultIfEmpty(0).Max(); rankFlow.AddText("#"); rankFlow.AddText(minRank.ToString("#,0"), s => s.Font = s.Font.With(weight: FontWeight.Bold)); rankFlow.AddText(" - "); rankFlow.AddText("#"); rankFlow.AddText(maxRank.ToString("#,0"), s => s.Font = s.Font.With(weight: FontWeight.Bold)); }
private void onQueueModeChanged(ValueChangedEvent <QueueMode> mode) { textFlow.Clear(); textFlow.AddText(mode.NewValue.GetLocalisableDescription()); }
private void onMatchTypeChanged(ValueChangedEvent <MatchType> type) { textFlow.Clear(); textFlow.AddText(type.NewValue.GetLocalisableDescription()); }
private void showResults() { mainArea.Clear(); resultsArea.Clear(); settings.Hide(); var displayMode = host.Window?.CurrentDisplayMode.Value; string exclusive = "unknown"; if (host.Window is WindowsWindow windowsWindow) { exclusive = windowsWindow.FullscreenCapability.ToString(); } statusText.Clear(); float successRate = (float)correctAtCurrentDifficulty / attemptsAtCurrentDifficulty; bool isPass = successRate == 1; statusText.AddParagraph($"You scored {correctAtCurrentDifficulty} out of {attemptsAtCurrentDifficulty} ({successRate:0%})!", cp => cp.Colour = isPass ? colours.Green : colours.Red); statusText.AddParagraph($"Level {DifficultyLevel} ({mapDifficultyToTargetFrameRate(DifficultyLevel):N0} Hz)", cp => cp.Font = OsuFont.Default.With(size: 24)); statusText.AddParagraph(string.Empty); statusText.AddParagraph(string.Empty); statusText.AddIcon(isPass ? FontAwesome.Regular.CheckCircle : FontAwesome.Regular.TimesCircle, cp => cp.Colour = isPass ? colours.Green : colours.Red); statusText.AddParagraph(string.Empty); if (!isPass && DifficultyLevel > 1) { statusText.AddParagraph("To complete certification, the difficulty level will now decrease until you can get 20 rounds correct in a row!", cp => cp.Font = OsuFont.Default.With(size: 24, weight: FontWeight.SemiBold)); statusText.AddParagraph(string.Empty); } statusText.AddParagraph($"Polling: {pollingMax} Hz Monitor: {displayMode?.RefreshRate ?? 0:N0} Hz Exclusive: {exclusive}", cp => cp.Font = OsuFont.Default.With(size: 15, weight: FontWeight.SemiBold)); statusText.AddParagraph($"Input: {host.InputThread.Clock.FramesPerSecond} Hz " + $"Update: {host.UpdateThread.Clock.FramesPerSecond} Hz " + $"Draw: {host.DrawThread.Clock.FramesPerSecond} Hz" , cp => cp.Font = OsuFont.Default.With(size: 15, weight: FontWeight.SemiBold)); if (isCertifying && isPass) { showCertifiedScreen(); return; } string cannotIncreaseReason = string.Empty; if (mapDifficultyToTargetFrameRate(DifficultyLevel + 1) > target_host_update_frames) { cannotIncreaseReason = "You've reached the maximum level."; } else if (mapDifficultyToTargetFrameRate(DifficultyLevel + 1) > Clock.FramesPerSecond) { cannotIncreaseReason = "Game is not running fast enough to test this level"; } FillFlowContainer buttonFlow; resultsArea.Add(buttonFlow = new FillFlowContainer { RelativeSizeAxes = Axes.X, AutoSizeAxes = Axes.Y, Anchor = Anchor.BottomLeft, Origin = Anchor.BottomLeft, Spacing = new Vector2(20), Padding = new MarginPadding(20), }); if (isPass) { buttonFlow.Add(new ButtonWithKeyBind(Key.Enter) { Text = "Continue to next level", BackgroundColour = colours.Green, Anchor = Anchor.Centre, Origin = Anchor.Centre, Action = () => changeDifficulty(DifficultyLevel + 1), Enabled = { Value = string.IsNullOrEmpty(cannotIncreaseReason) }, TooltipText = cannotIncreaseReason }); } else { if (DifficultyLevel == 1) { buttonFlow.Add(new ButtonWithKeyBind(Key.Enter) { Text = "Retry", TooltipText = "Are you even trying..?", BackgroundColour = colours.Pink2, Anchor = Anchor.Centre, Origin = Anchor.Centre, Action = () => { isCertifying = false; changeDifficulty(1); }, }); } else { buttonFlow.Add(new ButtonWithKeyBind(Key.Enter) { Text = "Begin certification at last level", BackgroundColour = colours.Yellow, Anchor = Anchor.Centre, Origin = Anchor.Centre, Action = () => { isCertifying = true; changeDifficulty(DifficultyLevel - 1); }, TooltipText = isPass ? $"Chain {rounds_to_complete_certified} rounds to confirm your perception!" : "You've reached your limits. Go to the previous level to complete certification!", }); } } }