From 9ad87ee5dc421eb1208d07b1d4b5356a130a383c Mon Sep 17 00:00:00 2001 From: Jamie Taylor Date: Thu, 27 May 2021 15:04:22 +0900 Subject: [PATCH 01/23] add sfx for results screen + sound design tool --- .../Visual/Ranking/TestSceneAccuracyCircle.cs | 2 +- .../SoundDesign/TestSceneAccuracyCircle.cs | 969 ++++++++++++++++++ .../Expanded/Accuracy/AccuracyCircle.cs | 374 ++++++- .../Expanded/ExpandedPanelMiddleContent.cs | 2 +- osu.Game/Screens/Ranking/ResultsScreen.cs | 7 - 5 files changed, 1343 insertions(+), 11 deletions(-) create mode 100644 osu.Game.Tests/Visual/SoundDesign/TestSceneAccuracyCircle.cs diff --git a/osu.Game.Tests/Visual/Ranking/TestSceneAccuracyCircle.cs b/osu.Game.Tests/Visual/Ranking/TestSceneAccuracyCircle.cs index f305b7255e..a5e2f02f31 100644 --- a/osu.Game.Tests/Visual/Ranking/TestSceneAccuracyCircle.cs +++ b/osu.Game.Tests/Visual/Ranking/TestSceneAccuracyCircle.cs @@ -55,7 +55,7 @@ namespace osu.Game.Tests.Visual.Ranking } } }, - new AccuracyCircle(score) + new AccuracyCircle(score, true) { Anchor = Anchor.Centre, Origin = Anchor.Centre, diff --git a/osu.Game.Tests/Visual/SoundDesign/TestSceneAccuracyCircle.cs b/osu.Game.Tests/Visual/SoundDesign/TestSceneAccuracyCircle.cs new file mode 100644 index 0000000000..c7ff7f9760 --- /dev/null +++ b/osu.Game.Tests/Visual/SoundDesign/TestSceneAccuracyCircle.cs @@ -0,0 +1,969 @@ +// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. +// See the LICENCE file in the repository root for full licence text. + +using System; +using System.Collections.Generic; +using System.IO; +using Newtonsoft.Json; +using NUnit.Framework; +using osu.Framework.Allocation; +using osu.Framework.Audio; +using osu.Framework.Bindables; +using osu.Framework.Extensions.Color4Extensions; +using osu.Framework.Graphics; +using osu.Framework.Graphics.Audio; +using osu.Framework.Graphics.Colour; +using osu.Framework.Graphics.Containers; +using osu.Framework.Graphics.Shapes; +using osu.Framework.Platform; +using osu.Game.Configuration; +using osu.Game.Graphics; +using osu.Game.Graphics.Containers; +using osu.Game.Graphics.Sprites; +using osu.Game.Graphics.UserInterface; +using osu.Game.Graphics.UserInterfaceV2; +using osu.Game.Overlays; +using osu.Game.Overlays.Settings; +using osu.Game.Rulesets.Mods; +using osu.Game.Rulesets.Osu; +using osu.Game.Rulesets.Osu.Mods; +using osu.Game.Rulesets.Scoring; +using osu.Game.Scoring; +using osu.Game.Screens.Ranking.Expanded.Accuracy; +using osu.Game.Tests.Beatmaps; +using osu.Game.Users; +using osuTK; + +namespace osu.Game.Tests.Visual.SoundDesign +{ + [Serializable] + public class TestSceneAccuracyCircle : OsuTestScene + { + [Resolved] + private AudioManager audioManager { get; set; } + + [Resolved] + private OsuColour colours { get; set; } + + private DrawableSample previewSampleChannel; + private AccuracyCircleAudioSettings settings = new AccuracyCircleAudioSettings(); + private OsuTextBox saveFilename; + + private Storage presetStorage; + private FileSelector presetFileSelector; + + private Bindable sampleLoadTarget = new Bindable(); + private Bindable selectedSampleName = new Bindable(); + + private Container accuracyCircle; + + private enum SampleLoadTarget + { + ScoreTick, + BadgeDink, + BadgeDinkMax, + Swoosh, + ImpactD, + ImpactC, + ImpactB, + ImpactA, + ImpactS, + ImpactSS, + ApplauseD, + ApplauseC, + ApplauseB, + ApplauseA, + ApplauseS, + ApplauseSS, + }; + + private enum SectionTabs + { + [System.ComponentModel.Description("Score Ticks")] + ScoreTicks, + + [System.ComponentModel.Description("Badge Dinks")] + BadgeDinks, + + [System.ComponentModel.Description("Swoosh")] + Swoosh, + + [System.ComponentModel.Description("Impact")] + Impact, + + [System.ComponentModel.Description("Applause")] + Applause, + + [System.ComponentModel.Description("Preset")] + Preset + } + + private OsuTabControl tabSelector; + + private Dictionary tabContainers = new Dictionary(); + private FillFlowContainer sampleSelectContainer; + + private FileSelector sampleFileSelector; + + [BackgroundDependencyLoader] + private void load(GameHost host) + { + presetStorage = host.Storage.GetStorageForDirectory("presets"); + + Children = new Drawable[] + { + new FillFlowContainer + { + RelativeSizeAxes = Axes.Both, + Direction = FillDirection.Horizontal, + Children = new Drawable[] + { + new Container + { + RelativeSizeAxes = Axes.Both, + Width = 0.5f, + Children = new Drawable[] + { + new Box + { + RelativeSizeAxes = Axes.Both, + Colour = Color4Extensions.FromHex("222") + }, + new OsuScrollContainer + { + RelativeSizeAxes = Axes.Both, + ScrollbarVisible = false, + Child = new FillFlowContainer + { + AutoSizeAxes = Axes.Y, + RelativeSizeAxes = Axes.X, + Direction = FillDirection.Vertical, + Spacing = new Vector2(0, 10), + Padding = new MarginPadding(10), + Children = new Drawable[] + { + tabSelector = new OsuTabControl + { + RelativeSizeAxes = Axes.X, + Width = 1f, + Height = 24, + }, + + #region score ticks + + // ==================== SCORE TICKS ==================== + tabContainers[SectionTabs.ScoreTicks] = new FillFlowContainer + { + AutoSizeAxes = Axes.Y, + RelativeSizeAxes = Axes.X, + Direction = FillDirection.Vertical, + Spacing = new Vector2(0, 10), + Width = 1f, + Children = new Drawable[] + { + new SettingsCheckbox + { + LabelText = "Play Ticks", + Current = { BindTarget = settings.PlayTicks } + }, + new SettingsSlider + { + LabelText = "Tick Volume (Start)", + Current = { BindTarget = settings.TickVolumeStart } + }, + new SettingsSlider + { + LabelText = "Tick Volume (End)", + Current = { BindTarget = settings.TickVolumeEnd } + }, + new SettingsSlider + { + LabelText = "ScoreTick Start Debounce Rate", + Current = { BindTarget = settings.TickDebounceStart } + }, + new SettingsSlider + { + LabelText = "ScoreTick End Debounce Rate", + Current = { BindTarget = settings.TickDebounceEnd } + }, + new OsuSpriteText + { + Padding = new MarginPadding { Left = SettingsPanel.CONTENT_MARGINS }, + Text = "ScoreTick Rate Easing:" + }, + new SettingsEnumDropdown + { + Current = { BindTarget = settings.TickRateEasing } + }, + new SettingsSlider + { + LabelText = "ScoreTick Pitch Factor", + Current = { BindTarget = settings.TickPitchFactor } + }, + new OsuSpriteText + { + Padding = new MarginPadding { Left = SettingsPanel.CONTENT_MARGINS }, + Text = "Pitch Easing:" + }, + new SettingsEnumDropdown + { + Current = { BindTarget = settings.TickPitchEasing } + }, + new OsuSpriteText + { + Padding = new MarginPadding { Left = SettingsPanel.CONTENT_MARGINS }, + Text = "Volume Easing:" + }, + new SettingsEnumDropdown + { + Current = { BindTarget = settings.TickVolumeEasing } + }, + new OsuSpriteText + { + Padding = new MarginPadding { Left = SettingsPanel.CONTENT_MARGINS }, + Text = "Tick Sample:" + }, + new OsuSpriteText + { + Padding = new MarginPadding { Left = SettingsPanel.CONTENT_MARGINS * 2 }, + Current = { BindTarget = settings.TickSampleName } + } + } + }, + + #endregion + + #region badge dinks + + // ==================== BADGE DINKS ==================== + tabContainers[SectionTabs.BadgeDinks] = new FillFlowContainer + { + Alpha = 0, + AutoSizeAxes = Axes.Y, + RelativeSizeAxes = Axes.X, + Direction = FillDirection.Vertical, + Spacing = new Vector2(0, 10), + Width = 1f, + Children = new Drawable[] + { + new SettingsCheckbox + { + LabelText = "Play BadgeSounds", + Current = { BindTarget = settings.PlayBadgeSounds } + }, + new SettingsSlider + { + LabelText = "Badge Dink Volume", + Current = { BindTarget = settings.BadgeDinkVolume } + }, + new OsuSpriteText + { + Font = OsuFont.GetFont(), + Text = "Badge Dink Sample:", + Padding = new MarginPadding { Left = SettingsPanel.CONTENT_MARGINS }, + }, + new OsuSpriteText + { + Font = OsuFont.GetFont(size: 12), + Current = { BindTarget = settings.BadgeSampleName }, + Padding = new MarginPadding { Left = SettingsPanel.CONTENT_MARGINS * 2f }, + }, + new OsuSpriteText + { + Font = OsuFont.GetFont(), + Text = "Badge Max Dink Sample:", + Padding = new MarginPadding { Left = SettingsPanel.CONTENT_MARGINS }, + }, + new OsuSpriteText + { + Font = OsuFont.GetFont(size: 12), + Current = { BindTarget = settings.BadgeMaxSampleName }, + Padding = new MarginPadding { Left = SettingsPanel.CONTENT_MARGINS * 2f }, + } + } + }, + + #endregion + + #region swoosh + + // ==================== SWOOSHES ==================== + tabContainers[SectionTabs.Swoosh] = new FillFlowContainer + { + Alpha = 0, + AutoSizeAxes = Axes.Y, + RelativeSizeAxes = Axes.X, + Direction = FillDirection.Vertical, + Spacing = new Vector2(0, 10), + Width = 1f, + Children = new Drawable[] + { + new SettingsCheckbox + { + LabelText = "Play Swoosh", + Current = { BindTarget = settings.PlaySwooshSound } + }, + new SettingsSlider + { + LabelText = "Swoosh Volume", + Current = { BindTarget = settings.SwooshVolume } + }, + new SettingsSlider + { + LabelText = "Swoosh Pre-Delay (ms)", + Current = { BindTarget = settings.SwooshPreDelay } + }, + new OsuSpriteText + { + Font = OsuFont.GetFont(), + Text = "Swoosh Sample:", + Padding = new MarginPadding { Left = SettingsPanel.CONTENT_MARGINS }, + }, + new OsuSpriteText + { + Font = OsuFont.GetFont(size: 12), + Current = { BindTarget = settings.SwooshSampleName }, + Padding = new MarginPadding { Left = SettingsPanel.CONTENT_MARGINS * 2f }, + } + } + }, + + #endregion + + #region impact + + // ==================== IMPACT ==================== + tabContainers[SectionTabs.Impact] = new FillFlowContainer + { + Alpha = 0, + AutoSizeAxes = Axes.Y, + RelativeSizeAxes = Axes.X, + Direction = FillDirection.Vertical, + Spacing = new Vector2(0, 10), + Width = 1f, + Children = new Drawable[] + { + new SettingsCheckbox + { + LabelText = "Play Impact", + Current = { BindTarget = settings.PlayImpact } + }, + new SettingsSlider + { + LabelText = "Impact Volume", + Current = { BindTarget = settings.ImpactVolume } + }, + new OsuSpriteText + { + Font = OsuFont.GetFont(), + Text = "Grade D Sample:", + Padding = new MarginPadding { Left = SettingsPanel.CONTENT_MARGINS }, + }, + new OsuSpriteText + { + Font = OsuFont.GetFont(size: 12), + Current = { BindTarget = settings.ImpactGradeDSampleName }, + Padding = new MarginPadding { Left = SettingsPanel.CONTENT_MARGINS * 2f }, + }, + new OsuSpriteText + { + Font = OsuFont.GetFont(), + Text = "Grade C Sample:", + Padding = new MarginPadding { Left = SettingsPanel.CONTENT_MARGINS }, + }, + new OsuSpriteText + { + Font = OsuFont.GetFont(size: 12), + Current = { BindTarget = settings.ImpactGradeCSampleName }, + Padding = new MarginPadding { Left = SettingsPanel.CONTENT_MARGINS * 2f }, + }, + new OsuSpriteText + { + Font = OsuFont.GetFont(), + Text = "Grade B Sample:", + Padding = new MarginPadding { Left = SettingsPanel.CONTENT_MARGINS }, + }, + new OsuSpriteText + { + Font = OsuFont.GetFont(size: 12), + Current = { BindTarget = settings.ImpactGradeBSampleName }, + Padding = new MarginPadding { Left = SettingsPanel.CONTENT_MARGINS * 2f }, + }, + new OsuSpriteText + { + Font = OsuFont.GetFont(), + Text = "Grade A Sample:", + Padding = new MarginPadding { Left = SettingsPanel.CONTENT_MARGINS }, + }, + new OsuSpriteText + { + Font = OsuFont.GetFont(size: 12), + Current = { BindTarget = settings.ImpactGradeASampleName }, + Padding = new MarginPadding { Left = SettingsPanel.CONTENT_MARGINS * 2f }, + }, + new OsuSpriteText + { + Font = OsuFont.GetFont(), + Text = "Grade S Sample:", + Padding = new MarginPadding { Left = SettingsPanel.CONTENT_MARGINS }, + }, + new OsuSpriteText + { + Font = OsuFont.GetFont(size: 12), + Current = { BindTarget = settings.ImpactGradeSSampleName }, + Padding = new MarginPadding { Left = SettingsPanel.CONTENT_MARGINS * 2f }, + }, + new OsuSpriteText + { + Font = OsuFont.GetFont(), + Text = "Grade SS Sample:", + Padding = new MarginPadding { Left = SettingsPanel.CONTENT_MARGINS }, + }, + new OsuSpriteText + { + Font = OsuFont.GetFont(size: 12), + Current = { BindTarget = settings.ImpactGradeSSSampleName }, + Padding = new MarginPadding { Left = SettingsPanel.CONTENT_MARGINS * 2f }, + } + } + }, + + #endregion + + #region applause + + // ==================== APPLAUSE ==================== + tabContainers[SectionTabs.Applause] = new FillFlowContainer + { + Alpha = 0, + AutoSizeAxes = Axes.Y, + RelativeSizeAxes = Axes.X, + Direction = FillDirection.Vertical, + Spacing = new Vector2(0, 10), + Width = 1f, + Children = new Drawable[] + { + new SettingsCheckbox + { + LabelText = "Play Applause", + Current = { BindTarget = settings.PlayApplause } + }, + new SettingsSlider + { + LabelText = "Applause Volume", + Current = { BindTarget = settings.ApplauseVolume } + }, + new SettingsSlider + { + LabelText = "Applause Delay (ms)", + Current = { BindTarget = settings.ApplauseDelay } + }, + new OsuSpriteText + { + Font = OsuFont.GetFont(), + Text = "Grade D Sample:", + Padding = new MarginPadding { Left = SettingsPanel.CONTENT_MARGINS }, + }, + new OsuSpriteText + { + Font = OsuFont.GetFont(size: 12), + Current = { BindTarget = settings.ApplauseGradeDSampleName }, + Padding = new MarginPadding { Left = SettingsPanel.CONTENT_MARGINS * 2f }, + }, + new OsuSpriteText + { + Font = OsuFont.GetFont(), + Text = "Grade C Sample:", + Padding = new MarginPadding { Left = SettingsPanel.CONTENT_MARGINS }, + }, + new OsuSpriteText + { + Font = OsuFont.GetFont(size: 12), + Current = { BindTarget = settings.ApplauseGradeCSampleName }, + Padding = new MarginPadding { Left = SettingsPanel.CONTENT_MARGINS * 2f }, + }, + new OsuSpriteText + { + Font = OsuFont.GetFont(), + Text = "Grade B Sample:", + Padding = new MarginPadding { Left = SettingsPanel.CONTENT_MARGINS }, + }, + new OsuSpriteText + { + Font = OsuFont.GetFont(size: 12), + Current = { BindTarget = settings.ApplauseGradeBSampleName }, + Padding = new MarginPadding { Left = SettingsPanel.CONTENT_MARGINS * 2f }, + }, + new OsuSpriteText + { + Font = OsuFont.GetFont(), + Text = "Grade A Sample:", + Padding = new MarginPadding { Left = SettingsPanel.CONTENT_MARGINS }, + }, + new OsuSpriteText + { + Font = OsuFont.GetFont(size: 12), + Current = { BindTarget = settings.ApplauseGradeASampleName }, + Padding = new MarginPadding { Left = SettingsPanel.CONTENT_MARGINS * 2f }, + }, + new OsuSpriteText + { + Font = OsuFont.GetFont(), + Text = "Grade S Sample:", + Padding = new MarginPadding { Left = SettingsPanel.CONTENT_MARGINS }, + }, + new OsuSpriteText + { + Font = OsuFont.GetFont(size: 12), + Current = { BindTarget = settings.ApplauseGradeSSampleName }, + Padding = new MarginPadding { Left = SettingsPanel.CONTENT_MARGINS * 2f }, + }, + new OsuSpriteText + { + Font = OsuFont.GetFont(), + Text = "Grade SS Sample:", + Padding = new MarginPadding { Left = SettingsPanel.CONTENT_MARGINS }, + }, + new OsuSpriteText + { + Font = OsuFont.GetFont(size: 12), + Current = { BindTarget = settings.ApplauseGradeSSSampleName }, + Padding = new MarginPadding { Left = SettingsPanel.CONTENT_MARGINS * 2f }, + } + } + }, + + #endregion + + #region preset + + // ==================== PRESET ==================== + tabContainers[SectionTabs.Preset] = new FillFlowContainer + { + Alpha = 0, + AutoSizeAxes = Axes.Y, + RelativeSizeAxes = Axes.X, + Direction = FillDirection.Vertical, + Spacing = new Vector2(0, 10), + Width = 1f, + Children = new Drawable[] + { + new OsuSpriteText + { + Font = OsuFont.Default.With(size: 24), + Text = "Load", + Colour = colours.Yellow + }, + presetFileSelector = new FileSelector(presetStorage.GetFullPath(string.Empty)) + { + RelativeSizeAxes = Axes.X, + Height = 300, + }, + new OsuSpriteText + { + Font = OsuFont.Default.With(size: 24), + Text = "Save", + Colour = colours.Yellow + }, + saveFilename = new OsuTextBox + { + PlaceholderText = "New preset filename", + RelativeSizeAxes = Axes.X, + }, + new TriangleButton + { + Text = "Save", + Action = savePreset, + RelativeSizeAxes = Axes.X, + }, + } + }, + + #endregion + + #region fileselector + + // ==================== SAMPLE SELECTOR ==================== + sampleSelectContainer = new FillFlowContainer + { + AutoSizeAxes = Axes.Y, + RelativeSizeAxes = Axes.X, + Direction = FillDirection.Vertical, + Padding = new MarginPadding(10) + { + Top = 20, + }, + Width = 1f, + Children = new Drawable[] + { + new OsuSpriteText + { + Font = OsuFont.Default.With(size: 20), + Text = "Load Sample", + Colour = colours.Yellow + }, + sampleFileSelector = new FileSelector("/Users/jamie/Sandbox/derp/Samples/Results") + { + RelativeSizeAxes = Axes.X, + Height = 300, + }, + new TriangleButton + { + Text = "Refresh", + Action = refreshSampleBrowser, + RelativeSizeAxes = Axes.X, + }, + new SettingsEnumDropdown + { + Current = { BindTarget = sampleLoadTarget } + }, + new TriangleButton + { + Text = "Load Sample", + Action = loadSample, + RelativeSizeAxes = Axes.X, + } + } + } + + #endregion + } + } + } + } + }, + new Container + { + RelativeSizeAxes = Axes.Both, + Width = 0.5f, + Children = new Drawable[] + { + new Box + { + Anchor = Anchor.Centre, + Origin = Anchor.Centre, + RelativeSizeAxes = Axes.Both, + Colour = ColourInfo.GradientVertical(Color4Extensions.FromHex("#555"), Color4Extensions.FromHex("#333")) + }, + new FillFlowContainer + { + RelativeSizeAxes = Axes.Both, + Height = 0.5f, + Children = new[] + { + new TriangleButton + { + Text = "Low D Rank", + Action = CreateLowRankDCircle, + RelativeSizeAxes = Axes.X, + Width = 0.25f, + }, + new TriangleButton + { + Text = "D Rank", + Action = CreateDRankCircle, + RelativeSizeAxes = Axes.X, + Width = 0.25f, + }, + new TriangleButton + { + Text = "C Rank", + Action = CreateCRankCircle, + RelativeSizeAxes = Axes.X, + Width = 0.25f, + }, + new TriangleButton + { + Text = "B Rank", + Action = CreateBRankCircle, + RelativeSizeAxes = Axes.X, + Width = 0.25f, + }, + new TriangleButton + { + Text = "A Rank", + Action = CreateARankCircle, + RelativeSizeAxes = Axes.X, + Width = 0.25f, + }, + new TriangleButton + { + Text = "S Rank", + Action = CreateSRankCircle, + RelativeSizeAxes = Axes.X, + Width = 0.25f, + }, + new TriangleButton + { + Text = "Almost SS Rank", + Action = CreateAlmostSSRankCircle, + RelativeSizeAxes = Axes.X, + Width = 0.25f, + }, + new TriangleButton + { + Text = "SS Rank", + Action = CreateSSRankCircle, + RelativeSizeAxes = Axes.X, + Width = 0.25f, + }, + } + }, + accuracyCircle = new Container + { + RelativeSizeAxes = Axes.Both, + // Child = CreateRankDCircle() + } + } + } + } + }, + }; + + presetFileSelector.CurrentFile.ValueChanged += value => + { + string path = value.NewValue.FullName; + + loadPreset(path); + saveFilename.Text = Path.GetFileNameWithoutExtension(path); + }; + + sampleFileSelector.CurrentFile.ValueChanged += value => + { + var sample = Path.GetFileNameWithoutExtension(value.NewValue.Name); + + previewSampleChannel?.Dispose(); + previewSampleChannel = new DrawableSample(audioManager.Samples.Get($"Results/{sample}")); + previewSampleChannel?.Play(); + + selectedSampleName.Value = sample; + }; + + tabSelector.Current.ValueChanged += tab => + { + tabContainers[tab.OldValue].Hide(); + tabContainers[tab.NewValue].Show(); + + switch (tab.NewValue) + { + case SectionTabs.Preset: + sampleSelectContainer.Hide(); + break; + + case SectionTabs.Impact: + sampleLoadTarget.Value = SampleLoadTarget.ImpactD; + sampleSelectContainer.Show(); + break; + + case SectionTabs.Swoosh: + sampleLoadTarget.Value = SampleLoadTarget.Swoosh; + sampleSelectContainer.Show(); + break; + + case SectionTabs.BadgeDinks: + sampleLoadTarget.Value = SampleLoadTarget.BadgeDink; + sampleSelectContainer.Show(); + break; + + case SectionTabs.ScoreTicks: + sampleLoadTarget.Value = SampleLoadTarget.ScoreTick; + sampleSelectContainer.Show(); + break; + + case SectionTabs.Applause: + sampleLoadTarget.Value = SampleLoadTarget.ApplauseD; + sampleSelectContainer.Show(); + break; + } + }; + } + + #region rank scenarios + + [Test] + public void TestDoNothing() => AddStep("show", () => + { + /* do nothing */ + }); + + [Test] + public void TestLowDRank() => AddStep("show", CreateLowRankDCircle); + + [Test] + public void TestDRank() => AddStep("show", CreateDRankCircle); + + [Test] + public void TestCRank() => AddStep("show", CreateCRankCircle); + + [Test] + public void TestBRank() => AddStep("show", CreateBRankCircle); + + [Test] + public void TestARank() => AddStep("show", CreateARankCircle); + + [Test] + public void TestSRank() => AddStep("show", CreateSRankCircle); + + [Test] + public void TestAlmostSSRank() => AddStep("show", CreateAlmostSSRankCircle); + + [Test] + public void TestSSRank() => AddStep("show", CreateSSRankCircle); + + #endregion + + public void CreateLowRankDCircle() => + accuracyCircle.Child = CreateAccuracyCircle(createScore(0.2, ScoreRank.D)); + + public void CreateDRankCircle() => + accuracyCircle.Child = CreateAccuracyCircle(createScore(0.5, ScoreRank.D)); + + public void CreateCRankCircle() => + accuracyCircle.Child = CreateAccuracyCircle(createScore(0.75, ScoreRank.C)); + + public void CreateBRankCircle() => + accuracyCircle.Child = CreateAccuracyCircle(createScore(0.85, ScoreRank.B)); + + public void CreateARankCircle() => + accuracyCircle.Child = CreateAccuracyCircle(createScore(0.925, ScoreRank.A)); + + public void CreateSRankCircle() => + accuracyCircle.Child = CreateAccuracyCircle(createScore(0.975, ScoreRank.S)); + + public void CreateAlmostSSRankCircle() => + accuracyCircle.Child = CreateAccuracyCircle(createScore(0.9999, ScoreRank.S)); + + public void CreateSSRankCircle() => + accuracyCircle.Child = CreateAccuracyCircle(createScore(1, ScoreRank.X)); + + public AccuracyCircle CreateAccuracyCircle(ScoreInfo score) + { + var newAccuracyCircle = new AccuracyCircle(score, true) + { + Anchor = Anchor.Centre, + Origin = Anchor.Centre, + Size = new Vector2(230), + }; + + newAccuracyCircle.BindAudioSettings(settings); + + return newAccuracyCircle; + } + + private void savePreset() + { + string path = presetStorage.GetFullPath($"{saveFilename.Text}.json", true); + File.WriteAllText(path, JsonConvert.SerializeObject(settings)); + presetFileSelector.CurrentFile.Value = new FileInfo(path); + } + + private void loadPreset(string filename) + { + var saved = JsonConvert.DeserializeObject(File.ReadAllText(presetStorage.GetFullPath(filename))); + + foreach (var (_, prop) in saved.GetSettingsSourceProperties()) + { + var targetBindable = (IBindable)prop.GetValue(settings); + var sourceBindable = (IBindable)prop.GetValue(saved); + + ((IParseable)targetBindable)?.Parse(sourceBindable); + } + } + + private void refreshSampleBrowser() => + sampleFileSelector.CurrentPath.Value = new DirectoryInfo(sampleFileSelector.CurrentPath.Value.FullName); + + private void loadSample() + { + switch (sampleLoadTarget.Value) + { + case SampleLoadTarget.Swoosh: + settings.SwooshSampleName.Value = selectedSampleName.Value; + break; + + case SampleLoadTarget.ScoreTick: + settings.TickSampleName.Value = selectedSampleName.Value; + break; + + case SampleLoadTarget.BadgeDink: + settings.BadgeSampleName.Value = selectedSampleName.Value; + break; + + case SampleLoadTarget.BadgeDinkMax: + settings.BadgeMaxSampleName.Value = selectedSampleName.Value; + break; + + case SampleLoadTarget.ImpactD: + settings.ImpactGradeDSampleName.Value = selectedSampleName.Value; + break; + + case SampleLoadTarget.ImpactC: + settings.ImpactGradeCSampleName.Value = selectedSampleName.Value; + break; + + case SampleLoadTarget.ImpactB: + settings.ImpactGradeBSampleName.Value = selectedSampleName.Value; + break; + + case SampleLoadTarget.ImpactA: + settings.ImpactGradeASampleName.Value = selectedSampleName.Value; + break; + + case SampleLoadTarget.ImpactS: + settings.ImpactGradeSSampleName.Value = selectedSampleName.Value; + break; + + case SampleLoadTarget.ImpactSS: + settings.ImpactGradeSSSampleName.Value = selectedSampleName.Value; + break; + + case SampleLoadTarget.ApplauseD: + settings.ApplauseGradeDSampleName.Value = selectedSampleName.Value; + break; + + case SampleLoadTarget.ApplauseC: + settings.ApplauseGradeCSampleName.Value = selectedSampleName.Value; + break; + + case SampleLoadTarget.ApplauseB: + settings.ApplauseGradeBSampleName.Value = selectedSampleName.Value; + break; + + case SampleLoadTarget.ApplauseA: + settings.ApplauseGradeASampleName.Value = selectedSampleName.Value; + break; + + case SampleLoadTarget.ApplauseS: + settings.ApplauseGradeSSampleName.Value = selectedSampleName.Value; + break; + + case SampleLoadTarget.ApplauseSS: + settings.ApplauseGradeSSSampleName.Value = selectedSampleName.Value; + break; + } + } + + private ScoreInfo createScore(double accuracy = 0.95, ScoreRank rank = ScoreRank.S) => new ScoreInfo + { + User = new User + { + Id = 2, + Username = "peppy", + }, + Beatmap = new TestBeatmap(new OsuRuleset().RulesetInfo).BeatmapInfo, + Mods = new Mod[] { new OsuModHardRock(), new OsuModDoubleTime() }, + TotalScore = 2845370, + Accuracy = accuracy, + MaxCombo = 999, + Rank = rank, + Date = DateTimeOffset.Now, + Statistics = + { + { HitResult.Miss, 1 }, + { HitResult.Meh, 50 }, + { HitResult.Good, 100 }, + { HitResult.Great, 300 }, + } + }; + } +} diff --git a/osu.Game/Screens/Ranking/Expanded/Accuracy/AccuracyCircle.cs b/osu.Game/Screens/Ranking/Expanded/Accuracy/AccuracyCircle.cs index c70b4dd35b..82f2bc8c29 100644 --- a/osu.Game/Screens/Ranking/Expanded/Accuracy/AccuracyCircle.cs +++ b/osu.Game/Screens/Ranking/Expanded/Accuracy/AccuracyCircle.cs @@ -3,13 +3,18 @@ using System; using System.Linq; +using JetBrains.Annotations; using osu.Framework.Allocation; using osu.Framework.Audio; +using osu.Framework.Bindables; using osu.Framework.Extensions.Color4Extensions; using osu.Framework.Graphics; +using osu.Framework.Graphics.Audio; using osu.Framework.Graphics.Colour; using osu.Framework.Graphics.Containers; +using osu.Framework.Platform; using osu.Framework.Utils; +using osu.Game.Configuration; using osu.Game.Graphics; using osu.Game.Rulesets.Mods; using osu.Game.Scoring; @@ -79,14 +84,69 @@ namespace osu.Game.Screens.Ranking.Expanded.Accuracy private Container badges; private RankText rankText; - public AccuracyCircle(ScoreInfo score) + private DrawableSample scoreTickSound; + private DrawableSample badgeTickSound; + private DrawableSample badgeMaxSound; + private DrawableSample swooshUpSound; + private DrawableSample rankDImpactSound; + private DrawableSample rankBImpactSound; + private DrawableSample rankCImpactSound; + private DrawableSample rankAImpactSound; + private DrawableSample rankSImpactSound; + private DrawableSample rankSSImpactSound; + private DrawableSample rankDApplauseSound; + private DrawableSample rankBApplauseSound; + private DrawableSample rankCApplauseSound; + private DrawableSample rankAApplauseSound; + private DrawableSample rankSApplauseSound; + private DrawableSample rankSSApplauseSound; + + private Bindable tickPlaybackRate = new Bindable(); + private double lastTickPlaybackTime; + private bool isTicking; + + private AudioManager audioManager; + + public AccuracyCircleAudioSettings AudioSettings = new AccuracyCircleAudioSettings(); + + private readonly bool withFlair; + + public AccuracyCircle(ScoreInfo score, bool withFlair) { this.score = score; + this.withFlair = withFlair; + } + + public void BindAudioSettings(AccuracyCircleAudioSettings audioSettings) + { + foreach (var (_, prop) in audioSettings.GetSettingsSourceProperties()) + { + var targetBindable = (IBindable)prop.GetValue(AudioSettings); + var sourceBindable = (IBindable)prop.GetValue(audioSettings); + + targetBindable?.BindTo(sourceBindable); + } + } + + private void loadSample(ref DrawableSample target, string sampleName, [CanBeNull] BindableDouble volumeBindable = null) + { + if (IsDisposed) return; + + target?.Expire(); + AddInternal(target = new DrawableSample(audioManager.Samples.Get($"Results/{sampleName}")) + { + Frequency = { Value = 1.0 } + }); + + if (volumeBindable != null) + target.Volume.BindTarget = volumeBindable; } [BackgroundDependencyLoader] - private void load(AudioManager audio) + private void load(AudioManager audio, GameHost host) { + audioManager = audio; + InternalChildren = new Drawable[] { new SmoothCircularProgress @@ -204,6 +264,35 @@ namespace osu.Game.Screens.Ranking.Expanded.Accuracy }, rankText = new RankText(score.Rank) }; + + if (withFlair) + { + tickPlaybackRate = new Bindable(AudioSettings.TickDebounceStart.Value); + + // score ticks + AudioSettings.TickSampleName.BindValueChanged(sample => loadSample(ref scoreTickSound, sample.NewValue), true); + AudioSettings.SwooshSampleName.BindValueChanged(sample => loadSample(ref swooshUpSound, sample.NewValue, AudioSettings.SwooshVolume), true); + + // badge sounds + AudioSettings.BadgeSampleName.BindValueChanged(sample => loadSample(ref badgeTickSound, sample.NewValue, AudioSettings.BadgeDinkVolume), true); + AudioSettings.BadgeMaxSampleName.BindValueChanged(sample => loadSample(ref badgeMaxSound, sample.NewValue, AudioSettings.BadgeDinkVolume), true); + + // impacts + AudioSettings.ImpactGradeDSampleName.BindValueChanged(sample => loadSample(ref rankDImpactSound, sample.NewValue, AudioSettings.ImpactVolume), true); + AudioSettings.ImpactGradeCSampleName.BindValueChanged(sample => loadSample(ref rankCImpactSound, sample.NewValue, AudioSettings.ImpactVolume), true); + AudioSettings.ImpactGradeBSampleName.BindValueChanged(sample => loadSample(ref rankBImpactSound, sample.NewValue, AudioSettings.ImpactVolume), true); + AudioSettings.ImpactGradeASampleName.BindValueChanged(sample => loadSample(ref rankAImpactSound, sample.NewValue, AudioSettings.ImpactVolume), true); + AudioSettings.ImpactGradeSSampleName.BindValueChanged(sample => loadSample(ref rankSImpactSound, sample.NewValue, AudioSettings.ImpactVolume), true); + AudioSettings.ImpactGradeSSSampleName.BindValueChanged(sample => loadSample(ref rankSSImpactSound, sample.NewValue, AudioSettings.ImpactVolume), true); + + // applause + AudioSettings.ApplauseGradeDSampleName.BindValueChanged(sample => loadSample(ref rankDApplauseSound, sample.NewValue, AudioSettings.ApplauseVolume), true); + AudioSettings.ApplauseGradeCSampleName.BindValueChanged(sample => loadSample(ref rankCApplauseSound, sample.NewValue, AudioSettings.ApplauseVolume), true); + AudioSettings.ApplauseGradeBSampleName.BindValueChanged(sample => loadSample(ref rankBApplauseSound, sample.NewValue, AudioSettings.ApplauseVolume), true); + AudioSettings.ApplauseGradeASampleName.BindValueChanged(sample => loadSample(ref rankAApplauseSound, sample.NewValue, AudioSettings.ApplauseVolume), true); + AudioSettings.ApplauseGradeSSampleName.BindValueChanged(sample => loadSample(ref rankSApplauseSound, sample.NewValue, AudioSettings.ApplauseVolume), true); + AudioSettings.ApplauseGradeSSSampleName.BindValueChanged(sample => loadSample(ref rankSSApplauseSound, sample.NewValue, AudioSettings.ApplauseVolume), true); + } } private ScoreRank getRank(ScoreRank rank) @@ -214,12 +303,29 @@ namespace osu.Game.Screens.Ranking.Expanded.Accuracy return rank; } + protected override void Update() + { + base.Update(); + + if (!AudioSettings.PlayTicks.Value || !isTicking) return; + + bool enoughTimePassedSinceLastPlayback = Clock.CurrentTime - lastTickPlaybackTime >= tickPlaybackRate.Value; + + if (!enoughTimePassedSinceLastPlayback) return; + + scoreTickSound?.Play(); + lastTickPlaybackTime = Clock.CurrentTime; + } + protected override void LoadComplete() { base.LoadComplete(); this.ScaleTo(0).Then().ScaleTo(1, APPEAR_DURATION, Easing.OutQuint); + if (AudioSettings.PlaySwooshSound.Value) + this.Delay(AudioSettings.SwooshPreDelay.Value).Schedule(() => swooshUpSound?.Play()); + using (BeginDelayedSequence(RANK_CIRCLE_TRANSFORM_DELAY, true)) innerMask.FillTo(1f, RANK_CIRCLE_TRANSFORM_DURATION, ACCURACY_TRANSFORM_EASING); @@ -229,6 +335,22 @@ namespace osu.Game.Screens.Ranking.Expanded.Accuracy accuracyCircle.FillTo(targetAccuracy, ACCURACY_TRANSFORM_DURATION, ACCURACY_TRANSFORM_EASING); + if (AudioSettings.PlayTicks.Value) + { + scoreTickSound?.FrequencyTo(1 + (targetAccuracy * AudioSettings.TickPitchFactor.Value), ACCURACY_TRANSFORM_DURATION, AudioSettings.TickPitchEasing.Value); + scoreTickSound?.VolumeTo(AudioSettings.TickVolumeStart.Value).Then().VolumeTo(AudioSettings.TickVolumeEnd.Value, ACCURACY_TRANSFORM_DURATION, AudioSettings.TickVolumeEasing.Value); + this.TransformBindableTo(tickPlaybackRate, AudioSettings.TickDebounceEnd.Value, ACCURACY_TRANSFORM_DURATION, AudioSettings.TickRateEasing.Value); + } + + Schedule(() => + { + if (!AudioSettings.PlayTicks.Value) return; + + isTicking = true; + }); + + int badgeNum = 0; + foreach (var badge in badges) { if (badge.Accuracy > score.Accuracy) @@ -237,12 +359,100 @@ namespace osu.Game.Screens.Ranking.Expanded.Accuracy using (BeginDelayedSequence(inverseEasing(ACCURACY_TRANSFORM_EASING, Math.Min(1 - virtual_ss_percentage, badge.Accuracy) / targetAccuracy) * ACCURACY_TRANSFORM_DURATION, true)) { badge.Appear(); + Schedule(() => + { + if (badgeTickSound == null || badgeMaxSound == null || !AudioSettings.PlayBadgeSounds.Value) return; + + if (badgeNum < (badges.Count - 1)) + { + badgeTickSound.Frequency.Value = 1 + (badgeNum++ * 0.05); + badgeTickSound?.Play(); + } + else + { + badgeMaxSound.Frequency.Value = 1 + (badgeNum++ * 0.05); + badgeMaxSound?.Play(); + isTicking = false; + } + }); } } using (BeginDelayedSequence(TEXT_APPEAR_DELAY, true)) { rankText.Appear(); + Schedule(() => + { + isTicking = false; + + if (!AudioSettings.PlayImpact.Value) return; + + switch (score.Rank) + { + case ScoreRank.D: + rankDImpactSound?.Play(); + break; + + case ScoreRank.C: + rankCImpactSound?.Play(); + break; + + case ScoreRank.B: + rankBImpactSound?.Play(); + break; + + case ScoreRank.A: + rankAImpactSound?.Play(); + break; + + case ScoreRank.S: + case ScoreRank.SH: + rankSImpactSound?.Play(); + break; + + case ScoreRank.X: + case ScoreRank.XH: + rankSSImpactSound?.Play(); + break; + } + }); + + using (BeginDelayedSequence(AudioSettings.ApplauseDelay.Value)) + { + if (!AudioSettings.PlayApplause.Value) return; + + Schedule(() => + { + switch (score.Rank) + { + case ScoreRank.D: + rankDApplauseSound?.Play(); + break; + + case ScoreRank.C: + rankCApplauseSound?.Play(); + break; + + case ScoreRank.B: + rankBApplauseSound?.Play(); + break; + + case ScoreRank.A: + rankAApplauseSound?.Play(); + break; + + case ScoreRank.S: + case ScoreRank.SH: + rankSApplauseSound?.Play(); + break; + + case ScoreRank.X: + case ScoreRank.XH: + rankSSApplauseSound?.Play(); + break; + } + }); + } } } } @@ -266,4 +476,164 @@ namespace osu.Game.Screens.Ranking.Expanded.Accuracy return test; } } + + public class AccuracyCircleAudioSettings + { + [SettingSource("setting")] + public Bindable PlayTicks { get; } = new Bindable(true); + + [SettingSource("setting")] + public Bindable TickSampleName { get; } = new Bindable("badge-dink-2"); + + [SettingSource("setting")] + public Bindable PlayBadgeSounds { get; } = new Bindable(true); + + [SettingSource("setting")] + public Bindable BadgeSampleName { get; } = new Bindable("badge-dink-3"); + + [SettingSource("setting")] + public Bindable BadgeMaxSampleName { get; } = new Bindable("badge-dink-8"); + + [SettingSource("setting")] + public Bindable PlaySwooshSound { get; } = new Bindable(true); + + [SettingSource("setting")] + public Bindable SwooshSampleName { get; } = new Bindable("swoosh-up-2"); + + [SettingSource("setting")] + public Bindable PlayImpact { get; } = new Bindable(true); + + [SettingSource("setting")] + public Bindable ImpactGradeDSampleName { get; } = new Bindable("rank-impact-d-1"); + + [SettingSource("setting")] + public Bindable ImpactGradeCSampleName { get; } = new Bindable("rank-impact-c-3"); + + [SettingSource("setting")] + public Bindable ImpactGradeBSampleName { get; } = new Bindable("rank-impact-b-3"); + + [SettingSource("setting")] + public Bindable ImpactGradeASampleName { get; } = new Bindable("rank-impact-a-3"); + + [SettingSource("setting")] + public Bindable ImpactGradeSSampleName { get; } = new Bindable("rank-impact-s-3"); + + [SettingSource("setting")] + public Bindable ImpactGradeSSSampleName { get; } = new Bindable("rank-impact-s-3"); + + [SettingSource("setting")] + public Bindable PlayApplause { get; } = new Bindable(true); + + [SettingSource("setting")] + public BindableDouble ApplauseVolume { get; } = new BindableDouble(1) + { + MinValue = 0, + MaxValue = 1, + Precision = 0.1, + }; + + [SettingSource("setting")] + public BindableDouble ApplauseDelay { get; } = new BindableDouble(545) + { + MinValue = 0, + MaxValue = 10000, + Precision = 1, + }; + + [SettingSource("setting")] + public Bindable ApplauseGradeDSampleName { get; } = new Bindable("rank-applause-d-1"); + + [SettingSource("setting")] + public Bindable ApplauseGradeCSampleName { get; } = new Bindable("rank-applause-c-1"); + + [SettingSource("setting")] + public Bindable ApplauseGradeBSampleName { get; } = new Bindable("rank-applause-b-1"); + + [SettingSource("setting")] + public Bindable ApplauseGradeASampleName { get; } = new Bindable("rank-applause-a-1"); + + [SettingSource("setting")] + public Bindable ApplauseGradeSSampleName { get; } = new Bindable("rank-applause-s-1"); + + [SettingSource("setting")] + public Bindable ApplauseGradeSSSampleName { get; } = new Bindable("rank-applause-s-1"); + + [SettingSource("setting")] + public BindableDouble TickPitchFactor { get; } = new BindableDouble(1) + { + MinValue = 0, + MaxValue = 3, + Precision = 0.1, + }; + + [SettingSource("setting")] + public BindableDouble TickDebounceStart { get; } = new BindableDouble(10) + { + MinValue = 1, + MaxValue = 100, + }; + + [SettingSource("setting")] + public BindableDouble TickDebounceEnd { get; } = new BindableDouble(400) + { + MinValue = 100, + MaxValue = 1000, + }; + + [SettingSource("setting")] + public BindableDouble SwooshPreDelay { get; } = new BindableDouble(450) + { + MinValue = -1000, + MaxValue = 1000, + }; + + [SettingSource("setting")] + public Bindable TickRateEasing { get; } = new Bindable(Easing.None); + + [SettingSource("setting")] + public Bindable TickPitchEasing { get; } = new Bindable(Easing.None); + + [SettingSource("setting")] + public Bindable TickVolumeEasing { get; } = new Bindable(Easing.OutSine); + + [SettingSource("setting")] + public BindableDouble TickVolumeStart { get; } = new BindableDouble(0.6) + { + MinValue = 0, + MaxValue = 1, + Precision = 0.1, + }; + + [SettingSource("setting")] + public BindableDouble TickVolumeEnd { get; } = new BindableDouble(1.0) + { + MinValue = 0, + MaxValue = 1, + Precision = 0.1, + }; + + [SettingSource("setting")] + public BindableDouble ImpactVolume { get; } = new BindableDouble(1.0) + { + MinValue = 0, + MaxValue = 1, + Precision = 0.1, + }; + + [SettingSource("setting")] + public BindableDouble BadgeDinkVolume { get; } = new BindableDouble(0.5) + { + MinValue = 0, + MaxValue = 1, + Precision = 0.1, + }; + + [SettingSource("setting")] + public BindableDouble SwooshVolume { get; } = new BindableDouble(0.5) + { + MinValue = 0, + MaxValue = 1, + Precision = 0.1, + }; + } } diff --git a/osu.Game/Screens/Ranking/Expanded/ExpandedPanelMiddleContent.cs b/osu.Game/Screens/Ranking/Expanded/ExpandedPanelMiddleContent.cs index 4895240314..6a6b39b61c 100644 --- a/osu.Game/Screens/Ranking/Expanded/ExpandedPanelMiddleContent.cs +++ b/osu.Game/Screens/Ranking/Expanded/ExpandedPanelMiddleContent.cs @@ -122,7 +122,7 @@ namespace osu.Game.Screens.Ranking.Expanded Margin = new MarginPadding { Top = 40 }, RelativeSizeAxes = Axes.X, Height = 230, - Child = new AccuracyCircle(score) + Child = new AccuracyCircle(score, withFlair) { Anchor = Anchor.Centre, Origin = Anchor.Centre, diff --git a/osu.Game/Screens/Ranking/ResultsScreen.cs b/osu.Game/Screens/Ranking/ResultsScreen.cs index a0ea27b640..95dd9f72a8 100644 --- a/osu.Game/Screens/Ranking/ResultsScreen.cs +++ b/osu.Game/Screens/Ranking/ResultsScreen.cs @@ -156,13 +156,6 @@ namespace osu.Game.Screens.Ranking bool shouldFlair = player != null && !Score.Mods.Any(m => m is ModAutoplay); ScorePanelList.AddScore(Score, shouldFlair); - - if (shouldFlair) - { - AddInternal(applauseSound = Score.Rank >= ScoreRank.A - ? new SkinnableSound(new SampleInfo("Results/rankpass", "applause")) - : new SkinnableSound(new SampleInfo("Results/rankfail"))); - } } if (allowWatchingReplay) From 30eff8cc2ac400be81c2acc3caea416b4b86cf23 Mon Sep 17 00:00:00 2001 From: Jamie Taylor Date: Thu, 27 May 2021 15:10:37 +0900 Subject: [PATCH 02/23] remove overlapping/legacy applause --- osu.Game/Screens/Ranking/ResultsScreen.cs | 13 ------------- 1 file changed, 13 deletions(-) diff --git a/osu.Game/Screens/Ranking/ResultsScreen.cs b/osu.Game/Screens/Ranking/ResultsScreen.cs index 95dd9f72a8..c1f5d92d17 100644 --- a/osu.Game/Screens/Ranking/ResultsScreen.cs +++ b/osu.Game/Screens/Ranking/ResultsScreen.cs @@ -12,7 +12,6 @@ using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Shapes; using osu.Framework.Input.Bindings; using osu.Framework.Screens; -using osu.Game.Audio; using osu.Game.Graphics.Containers; using osu.Game.Graphics.UserInterface; using osu.Game.Input.Bindings; @@ -20,20 +19,13 @@ using osu.Game.Online.API; using osu.Game.Rulesets.Mods; using osu.Game.Scoring; using osu.Game.Screens.Play; -using osu.Game.Screens.Ranking.Expanded.Accuracy; using osu.Game.Screens.Ranking.Statistics; -using osu.Game.Skinning; using osuTK; namespace osu.Game.Screens.Ranking { public abstract class ResultsScreen : ScreenWithBeatmapBackground, IKeyBindingHandler { - /// - /// Delay before the default applause sound should be played, in order to match the grade display timing in . - /// - public const double APPLAUSE_DELAY = AccuracyCircle.ACCURACY_TRANSFORM_DELAY + AccuracyCircle.TEXT_APPEAR_DELAY + ScorePanel.RESIZE_DURATION + ScorePanel.TOP_LAYER_EXPAND_DELAY - 1440; - protected const float BACKGROUND_BLUR = 20; private static readonly float screen_height = 768 - TwoLayerButton.SIZE_EXTENDED.Y; @@ -64,8 +56,6 @@ namespace osu.Game.Screens.Ranking private readonly bool allowRetry; private readonly bool allowWatchingReplay; - private SkinnableSound applauseSound; - protected ResultsScreen(ScoreInfo score, bool allowRetry, bool allowWatchingReplay = true) { Score = score; @@ -193,9 +183,6 @@ namespace osu.Game.Screens.Ranking api.Queue(req); statisticsPanel.State.BindValueChanged(onStatisticsStateChanged, true); - - using (BeginDelayedSequence(APPLAUSE_DELAY)) - Schedule(() => applauseSound?.Play()); } protected override void Update() From 63e5bc454315ba36c1d011c0b2deeb19fe9757c6 Mon Sep 17 00:00:00 2001 From: Jamie Taylor Date: Thu, 27 May 2021 16:37:08 +0900 Subject: [PATCH 03/23] update sample names and timings --- .../Expanded/Accuracy/AccuracyCircle.cs | 70 +++++++++---------- 1 file changed, 35 insertions(+), 35 deletions(-) diff --git a/osu.Game/Screens/Ranking/Expanded/Accuracy/AccuracyCircle.cs b/osu.Game/Screens/Ranking/Expanded/Accuracy/AccuracyCircle.cs index 82f2bc8c29..0a2442015e 100644 --- a/osu.Game/Screens/Ranking/Expanded/Accuracy/AccuracyCircle.cs +++ b/osu.Game/Screens/Ranking/Expanded/Accuracy/AccuracyCircle.cs @@ -483,53 +483,53 @@ namespace osu.Game.Screens.Ranking.Expanded.Accuracy public Bindable PlayTicks { get; } = new Bindable(true); [SettingSource("setting")] - public Bindable TickSampleName { get; } = new Bindable("badge-dink-2"); + public Bindable TickSampleName { get; } = new Bindable("score-tick"); [SettingSource("setting")] public Bindable PlayBadgeSounds { get; } = new Bindable(true); [SettingSource("setting")] - public Bindable BadgeSampleName { get; } = new Bindable("badge-dink-3"); + public Bindable BadgeSampleName { get; } = new Bindable("badge-dink"); [SettingSource("setting")] - public Bindable BadgeMaxSampleName { get; } = new Bindable("badge-dink-8"); + public Bindable BadgeMaxSampleName { get; } = new Bindable("badge-dink-max"); [SettingSource("setting")] public Bindable PlaySwooshSound { get; } = new Bindable(true); [SettingSource("setting")] - public Bindable SwooshSampleName { get; } = new Bindable("swoosh-up-2"); + public Bindable SwooshSampleName { get; } = new Bindable("swoosh-up"); [SettingSource("setting")] public Bindable PlayImpact { get; } = new Bindable(true); [SettingSource("setting")] - public Bindable ImpactGradeDSampleName { get; } = new Bindable("rank-impact-d-1"); + public Bindable ImpactGradeDSampleName { get; } = new Bindable("rank-impact-fail-d"); [SettingSource("setting")] - public Bindable ImpactGradeCSampleName { get; } = new Bindable("rank-impact-c-3"); + public Bindable ImpactGradeCSampleName { get; } = new Bindable("rank-impact-fail"); [SettingSource("setting")] - public Bindable ImpactGradeBSampleName { get; } = new Bindable("rank-impact-b-3"); + public Bindable ImpactGradeBSampleName { get; } = new Bindable("rank-impact-fail"); [SettingSource("setting")] - public Bindable ImpactGradeASampleName { get; } = new Bindable("rank-impact-a-3"); + public Bindable ImpactGradeASampleName { get; } = new Bindable("rank-impact-pass"); [SettingSource("setting")] - public Bindable ImpactGradeSSampleName { get; } = new Bindable("rank-impact-s-3"); + public Bindable ImpactGradeSSampleName { get; } = new Bindable("rank-impact-pass"); [SettingSource("setting")] - public Bindable ImpactGradeSSSampleName { get; } = new Bindable("rank-impact-s-3"); + public Bindable ImpactGradeSSSampleName { get; } = new Bindable("rank-impact-pass-ss"); [SettingSource("setting")] public Bindable PlayApplause { get; } = new Bindable(true); [SettingSource("setting")] - public BindableDouble ApplauseVolume { get; } = new BindableDouble(1) + public BindableDouble ApplauseVolume { get; } = new BindableDouble(0.8) { MinValue = 0, MaxValue = 1, - Precision = 0.1, + Precision = 0.1 }; [SettingSource("setting")] @@ -537,61 +537,61 @@ namespace osu.Game.Screens.Ranking.Expanded.Accuracy { MinValue = 0, MaxValue = 10000, - Precision = 1, + Precision = 1 }; [SettingSource("setting")] - public Bindable ApplauseGradeDSampleName { get; } = new Bindable("rank-applause-d-1"); + public Bindable ApplauseGradeDSampleName { get; } = new Bindable("applause-d"); [SettingSource("setting")] - public Bindable ApplauseGradeCSampleName { get; } = new Bindable("rank-applause-c-1"); + public Bindable ApplauseGradeCSampleName { get; } = new Bindable("applause-c"); [SettingSource("setting")] - public Bindable ApplauseGradeBSampleName { get; } = new Bindable("rank-applause-b-1"); + public Bindable ApplauseGradeBSampleName { get; } = new Bindable("applause-b"); [SettingSource("setting")] - public Bindable ApplauseGradeASampleName { get; } = new Bindable("rank-applause-a-1"); + public Bindable ApplauseGradeASampleName { get; } = new Bindable("applause-a"); [SettingSource("setting")] - public Bindable ApplauseGradeSSampleName { get; } = new Bindable("rank-applause-s-1"); + public Bindable ApplauseGradeSSampleName { get; } = new Bindable("applause-s"); [SettingSource("setting")] - public Bindable ApplauseGradeSSSampleName { get; } = new Bindable("rank-applause-s-1"); + public Bindable ApplauseGradeSSSampleName { get; } = new Bindable("applause-s"); [SettingSource("setting")] public BindableDouble TickPitchFactor { get; } = new BindableDouble(1) { MinValue = 0, MaxValue = 3, - Precision = 0.1, + Precision = 0.1 }; [SettingSource("setting")] - public BindableDouble TickDebounceStart { get; } = new BindableDouble(10) + public BindableDouble TickDebounceStart { get; } = new BindableDouble(18) { MinValue = 1, - MaxValue = 100, + MaxValue = 100 }; [SettingSource("setting")] - public BindableDouble TickDebounceEnd { get; } = new BindableDouble(400) + public BindableDouble TickDebounceEnd { get; } = new BindableDouble(300) { MinValue = 100, - MaxValue = 1000, + MaxValue = 1000 }; [SettingSource("setting")] - public BindableDouble SwooshPreDelay { get; } = new BindableDouble(450) + public BindableDouble SwooshPreDelay { get; } = new BindableDouble(443) { MinValue = -1000, - MaxValue = 1000, + MaxValue = 1000 }; [SettingSource("setting")] - public Bindable TickRateEasing { get; } = new Bindable(Easing.None); + public Bindable TickRateEasing { get; } = new Bindable(Easing.OutSine); [SettingSource("setting")] - public Bindable TickPitchEasing { get; } = new Bindable(Easing.None); + public Bindable TickPitchEasing { get; } = new Bindable(Easing.OutSine); [SettingSource("setting")] public Bindable TickVolumeEasing { get; } = new Bindable(Easing.OutSine); @@ -601,7 +601,7 @@ namespace osu.Game.Screens.Ranking.Expanded.Accuracy { MinValue = 0, MaxValue = 1, - Precision = 0.1, + Precision = 0.1 }; [SettingSource("setting")] @@ -609,7 +609,7 @@ namespace osu.Game.Screens.Ranking.Expanded.Accuracy { MinValue = 0, MaxValue = 1, - Precision = 0.1, + Precision = 0.1 }; [SettingSource("setting")] @@ -617,23 +617,23 @@ namespace osu.Game.Screens.Ranking.Expanded.Accuracy { MinValue = 0, MaxValue = 1, - Precision = 0.1, + Precision = 0.1 }; [SettingSource("setting")] - public BindableDouble BadgeDinkVolume { get; } = new BindableDouble(0.5) + public BindableDouble BadgeDinkVolume { get; } = new BindableDouble(1) { MinValue = 0, MaxValue = 1, - Precision = 0.1, + Precision = 0.1 }; [SettingSource("setting")] - public BindableDouble SwooshVolume { get; } = new BindableDouble(0.5) + public BindableDouble SwooshVolume { get; } = new BindableDouble(0.4) { MinValue = 0, MaxValue = 1, - Precision = 0.1, + Precision = 0.1 }; } } From 8dc595d201919233a09c78bcaec2816bb846cada Mon Sep 17 00:00:00 2001 From: Jamie Taylor Date: Fri, 28 May 2021 19:27:55 +0900 Subject: [PATCH 04/23] move result screen samples to DefaultSkin --- .../SoundDesign/TestSceneAccuracyCircle.cs | 164 +++++++- .../Expanded/Accuracy/AccuracyCircle.cs | 360 +++++------------- osu.Game/Skinning/DefaultSkin.cs | 55 +++ osu.Game/Skinning/GameplaySkinSamples.cs | 29 ++ osu.Game/Skinning/LegacySkin.cs | 38 ++ 5 files changed, 387 insertions(+), 259 deletions(-) create mode 100644 osu.Game/Skinning/GameplaySkinSamples.cs diff --git a/osu.Game.Tests/Visual/SoundDesign/TestSceneAccuracyCircle.cs b/osu.Game.Tests/Visual/SoundDesign/TestSceneAccuracyCircle.cs index c7ff7f9760..e630bb5983 100644 --- a/osu.Game.Tests/Visual/SoundDesign/TestSceneAccuracyCircle.cs +++ b/osu.Game.Tests/Visual/SoundDesign/TestSceneAccuracyCircle.cs @@ -36,7 +36,6 @@ using osuTK; namespace osu.Game.Tests.Visual.SoundDesign { - [Serializable] public class TestSceneAccuracyCircle : OsuTestScene { [Resolved] @@ -845,7 +844,7 @@ namespace osu.Game.Tests.Visual.SoundDesign Size = new Vector2(230), }; - newAccuracyCircle.BindAudioSettings(settings); + // newAccuracyCircle.BindAudioSettings(settings); return newAccuracyCircle; } @@ -966,4 +965,165 @@ namespace osu.Game.Tests.Visual.SoundDesign } }; } + + [Serializable] + public class AccuracyCircleAudioSettings + { + [SettingSource("setting")] + public Bindable PlayTicks { get; } = new Bindable(true); + + [SettingSource("setting")] + public Bindable TickSampleName { get; } = new Bindable("score-tick"); + + [SettingSource("setting")] + public Bindable PlayBadgeSounds { get; } = new Bindable(true); + + [SettingSource("setting")] + public Bindable BadgeSampleName { get; } = new Bindable("badge-dink"); + + [SettingSource("setting")] + public Bindable BadgeMaxSampleName { get; } = new Bindable("badge-dink-max"); + + [SettingSource("setting")] + public Bindable PlaySwooshSound { get; } = new Bindable(true); + + [SettingSource("setting")] + public Bindable SwooshSampleName { get; } = new Bindable("swoosh-up"); + + [SettingSource("setting")] + public Bindable PlayImpact { get; } = new Bindable(true); + + [SettingSource("setting")] + public Bindable ImpactGradeDSampleName { get; } = new Bindable("rank-impact-fail-d"); + + [SettingSource("setting")] + public Bindable ImpactGradeCSampleName { get; } = new Bindable("rank-impact-fail"); + + [SettingSource("setting")] + public Bindable ImpactGradeBSampleName { get; } = new Bindable("rank-impact-fail"); + + [SettingSource("setting")] + public Bindable ImpactGradeASampleName { get; } = new Bindable("rank-impact-pass"); + + [SettingSource("setting")] + public Bindable ImpactGradeSSampleName { get; } = new Bindable("rank-impact-pass"); + + [SettingSource("setting")] + public Bindable ImpactGradeSSSampleName { get; } = new Bindable("rank-impact-pass-ss"); + + [SettingSource("setting")] + public Bindable PlayApplause { get; } = new Bindable(true); + + [SettingSource("setting")] + public BindableDouble ApplauseVolume { get; } = new BindableDouble(0.8) + { + MinValue = 0, + MaxValue = 1, + Precision = 0.1 + }; + + [SettingSource("setting")] + public BindableDouble ApplauseDelay { get; } = new BindableDouble(545) + { + MinValue = 0, + MaxValue = 10000, + Precision = 1 + }; + + [SettingSource("setting")] + public Bindable ApplauseGradeDSampleName { get; } = new Bindable("applause-d"); + + [SettingSource("setting")] + public Bindable ApplauseGradeCSampleName { get; } = new Bindable("applause-c"); + + [SettingSource("setting")] + public Bindable ApplauseGradeBSampleName { get; } = new Bindable("applause-b"); + + [SettingSource("setting")] + public Bindable ApplauseGradeASampleName { get; } = new Bindable("applause-a"); + + [SettingSource("setting")] + public Bindable ApplauseGradeSSampleName { get; } = new Bindable("applause-s"); + + [SettingSource("setting")] + public Bindable ApplauseGradeSSSampleName { get; } = new Bindable("applause-s"); + + [SettingSource("setting")] + public BindableDouble TickPitchFactor { get; } = new BindableDouble(1) + { + MinValue = 0, + MaxValue = 3, + Precision = 0.1 + }; + + [SettingSource("setting")] + public BindableDouble TickDebounceStart { get; } = new BindableDouble(18) + { + MinValue = 1, + MaxValue = 100 + }; + + [SettingSource("setting")] + public BindableDouble TickDebounceEnd { get; } = new BindableDouble(300) + { + MinValue = 100, + MaxValue = 1000 + }; + + [SettingSource("setting")] + public BindableDouble SwooshPreDelay { get; } = new BindableDouble(443) + { + MinValue = -1000, + MaxValue = 1000 + }; + + [SettingSource("setting")] + public Bindable TickRateEasing { get; } = new Bindable(Easing.OutSine); + + [SettingSource("setting")] + public Bindable TickPitchEasing { get; } = new Bindable(Easing.OutSine); + + [SettingSource("setting")] + public Bindable TickVolumeEasing { get; } = new Bindable(Easing.OutSine); + + [SettingSource("setting")] + public BindableDouble TickVolumeStart { get; } = new BindableDouble(0.6) + { + MinValue = 0, + MaxValue = 1, + Precision = 0.1 + }; + + [SettingSource("setting")] + public BindableDouble TickVolumeEnd { get; } = new BindableDouble(1.0) + { + MinValue = 0, + MaxValue = 1, + Precision = 0.1 + }; + + [SettingSource("setting")] + public BindableDouble ImpactVolume { get; } = new BindableDouble(1.0) + { + MinValue = 0, + MaxValue = 1, + Precision = 0.1 + }; + + [SettingSource("setting")] + public BindableDouble BadgeDinkVolume { get; } = new BindableDouble(1) + { + MinValue = 0, + MaxValue = 1, + Precision = 0.1 + }; + + [SettingSource("setting")] + public BindableDouble SwooshVolume { get; } = new BindableDouble(0.4) + { + MinValue = 0, + MaxValue = 1, + Precision = 0.1 + }; + } } diff --git a/osu.Game/Screens/Ranking/Expanded/Accuracy/AccuracyCircle.cs b/osu.Game/Screens/Ranking/Expanded/Accuracy/AccuracyCircle.cs index 0a2442015e..5cf41513c8 100644 --- a/osu.Game/Screens/Ranking/Expanded/Accuracy/AccuracyCircle.cs +++ b/osu.Game/Screens/Ranking/Expanded/Accuracy/AccuracyCircle.cs @@ -3,7 +3,6 @@ using System; using System.Linq; -using JetBrains.Annotations; using osu.Framework.Allocation; using osu.Framework.Audio; using osu.Framework.Bindables; @@ -12,12 +11,13 @@ using osu.Framework.Graphics; using osu.Framework.Graphics.Audio; using osu.Framework.Graphics.Colour; using osu.Framework.Graphics.Containers; +using osu.Framework.Logging; using osu.Framework.Platform; using osu.Framework.Utils; -using osu.Game.Configuration; using osu.Game.Graphics; using osu.Game.Rulesets.Mods; using osu.Game.Scoring; +using osu.Game.Skinning; using osuTK; namespace osu.Game.Screens.Ranking.Expanded.Accuracy @@ -77,6 +77,27 @@ namespace osu.Game.Screens.Ranking.Expanded.Accuracy /// public static readonly Easing ACCURACY_TRANSFORM_EASING = Easing.OutPow10; + // audio sfx parameters + public bool PlayTicks = true; + public bool PlayBadgeSounds = true; + public bool PlaySwooshSound = true; + public bool PlayImpact = true; + public bool PlayApplause = true; + public double ApplauseVolume = 0.8f; + public double ApplauseDelay = 545f; + public double TickPitchFactor = 1f; + public double TickDebounceStart = 18f; + public double TickDebounceEnd = 300f; + public double SwooshPreDelay = 443f; + public Easing TickRateEasing = Easing.OutSine; + public Easing TickPitchEasing = Easing.OutSine; + public Easing TickVolumeEasing = Easing.OutSine; + public double TickVolumeStart = 0.6f; + public double TickVolumeEnd = 1.0f; + public double ImpactVolume = 1.0f; + public double BadgeDinkVolume = 1f; + public double SwooshVolume = 0.4f; + private readonly ScoreInfo score; private SmoothCircularProgress accuracyCircle; @@ -107,8 +128,6 @@ namespace osu.Game.Screens.Ranking.Expanded.Accuracy private AudioManager audioManager; - public AccuracyCircleAudioSettings AudioSettings = new AccuracyCircleAudioSettings(); - private readonly bool withFlair; public AccuracyCircle(ScoreInfo score, bool withFlair) @@ -117,33 +136,8 @@ namespace osu.Game.Screens.Ranking.Expanded.Accuracy this.withFlair = withFlair; } - public void BindAudioSettings(AccuracyCircleAudioSettings audioSettings) - { - foreach (var (_, prop) in audioSettings.GetSettingsSourceProperties()) - { - var targetBindable = (IBindable)prop.GetValue(AudioSettings); - var sourceBindable = (IBindable)prop.GetValue(audioSettings); - - targetBindable?.BindTo(sourceBindable); - } - } - - private void loadSample(ref DrawableSample target, string sampleName, [CanBeNull] BindableDouble volumeBindable = null) - { - if (IsDisposed) return; - - target?.Expire(); - AddInternal(target = new DrawableSample(audioManager.Samples.Get($"Results/{sampleName}")) - { - Frequency = { Value = 1.0 } - }); - - if (volumeBindable != null) - target.Volume.BindTarget = volumeBindable; - } - [BackgroundDependencyLoader] - private void load(AudioManager audio, GameHost host) + private void load(AudioManager audio, GameHost host, ISkinSource skin) { audioManager = audio; @@ -267,31 +261,27 @@ namespace osu.Game.Screens.Ranking.Expanded.Accuracy if (withFlair) { - tickPlaybackRate = new Bindable(AudioSettings.TickDebounceStart.Value); + tickPlaybackRate = new Bindable(TickDebounceStart); - // score ticks - AudioSettings.TickSampleName.BindValueChanged(sample => loadSample(ref scoreTickSound, sample.NewValue), true); - AudioSettings.SwooshSampleName.BindValueChanged(sample => loadSample(ref swooshUpSound, sample.NewValue, AudioSettings.SwooshVolume), true); - - // badge sounds - AudioSettings.BadgeSampleName.BindValueChanged(sample => loadSample(ref badgeTickSound, sample.NewValue, AudioSettings.BadgeDinkVolume), true); - AudioSettings.BadgeMaxSampleName.BindValueChanged(sample => loadSample(ref badgeMaxSound, sample.NewValue, AudioSettings.BadgeDinkVolume), true); - - // impacts - AudioSettings.ImpactGradeDSampleName.BindValueChanged(sample => loadSample(ref rankDImpactSound, sample.NewValue, AudioSettings.ImpactVolume), true); - AudioSettings.ImpactGradeCSampleName.BindValueChanged(sample => loadSample(ref rankCImpactSound, sample.NewValue, AudioSettings.ImpactVolume), true); - AudioSettings.ImpactGradeBSampleName.BindValueChanged(sample => loadSample(ref rankBImpactSound, sample.NewValue, AudioSettings.ImpactVolume), true); - AudioSettings.ImpactGradeASampleName.BindValueChanged(sample => loadSample(ref rankAImpactSound, sample.NewValue, AudioSettings.ImpactVolume), true); - AudioSettings.ImpactGradeSSampleName.BindValueChanged(sample => loadSample(ref rankSImpactSound, sample.NewValue, AudioSettings.ImpactVolume), true); - AudioSettings.ImpactGradeSSSampleName.BindValueChanged(sample => loadSample(ref rankSSImpactSound, sample.NewValue, AudioSettings.ImpactVolume), true); - - // applause - AudioSettings.ApplauseGradeDSampleName.BindValueChanged(sample => loadSample(ref rankDApplauseSound, sample.NewValue, AudioSettings.ApplauseVolume), true); - AudioSettings.ApplauseGradeCSampleName.BindValueChanged(sample => loadSample(ref rankCApplauseSound, sample.NewValue, AudioSettings.ApplauseVolume), true); - AudioSettings.ApplauseGradeBSampleName.BindValueChanged(sample => loadSample(ref rankBApplauseSound, sample.NewValue, AudioSettings.ApplauseVolume), true); - AudioSettings.ApplauseGradeASampleName.BindValueChanged(sample => loadSample(ref rankAApplauseSound, sample.NewValue, AudioSettings.ApplauseVolume), true); - AudioSettings.ApplauseGradeSSampleName.BindValueChanged(sample => loadSample(ref rankSApplauseSound, sample.NewValue, AudioSettings.ApplauseVolume), true); - AudioSettings.ApplauseGradeSSSampleName.BindValueChanged(sample => loadSample(ref rankSSApplauseSound, sample.NewValue, AudioSettings.ApplauseVolume), true); + AddRangeInternal(new Drawable[] + { + scoreTickSound = skin.GetDrawableComponent(new GameplaySkinComponent(GameplaySkinSamples.ResultScoreTick)) as DrawableSample, + badgeTickSound = skin.GetDrawableComponent(new GameplaySkinComponent(GameplaySkinSamples.ResultBadgeTick)) as DrawableSample, + badgeMaxSound = skin.GetDrawableComponent(new GameplaySkinComponent(GameplaySkinSamples.ResultBadgeTickMax)) as DrawableSample, + swooshUpSound = skin.GetDrawableComponent(new GameplaySkinComponent(GameplaySkinSamples.ResultSwooshUp)) as DrawableSample, + rankDImpactSound = skin.GetDrawableComponent(new GameplaySkinComponent(GameplaySkinSamples.ResultRank_D)) as DrawableSample, + rankBImpactSound = skin.GetDrawableComponent(new GameplaySkinComponent(GameplaySkinSamples.ResultRank_B)) as DrawableSample, + rankCImpactSound = skin.GetDrawableComponent(new GameplaySkinComponent(GameplaySkinSamples.ResultRank_C)) as DrawableSample, + rankAImpactSound = skin.GetDrawableComponent(new GameplaySkinComponent(GameplaySkinSamples.ResultRank_A)) as DrawableSample, + rankSImpactSound = skin.GetDrawableComponent(new GameplaySkinComponent(GameplaySkinSamples.ResultRank_S)) as DrawableSample, + rankSSImpactSound = skin.GetDrawableComponent(new GameplaySkinComponent(GameplaySkinSamples.ResultRank_SS)) as DrawableSample, + rankDApplauseSound = skin.GetDrawableComponent(new GameplaySkinComponent(GameplaySkinSamples.ResultApplause_D)) as DrawableSample, + rankBApplauseSound = skin.GetDrawableComponent(new GameplaySkinComponent(GameplaySkinSamples.ResultApplause_B)) as DrawableSample, + rankCApplauseSound = skin.GetDrawableComponent(new GameplaySkinComponent(GameplaySkinSamples.ResultApplause_C)) as DrawableSample, + rankAApplauseSound = skin.GetDrawableComponent(new GameplaySkinComponent(GameplaySkinSamples.ResultApplause_A)) as DrawableSample, + rankSApplauseSound = skin.GetDrawableComponent(new GameplaySkinComponent(GameplaySkinSamples.ResultApplause_S)) as DrawableSample, + rankSSApplauseSound = skin.GetDrawableComponent(new GameplaySkinComponent(GameplaySkinSamples.ResultApplause_SS)) as DrawableSample + }); } } @@ -307,13 +297,13 @@ namespace osu.Game.Screens.Ranking.Expanded.Accuracy { base.Update(); - if (!AudioSettings.PlayTicks.Value || !isTicking) return; + if (!PlayTicks || !isTicking) return; bool enoughTimePassedSinceLastPlayback = Clock.CurrentTime - lastTickPlaybackTime >= tickPlaybackRate.Value; if (!enoughTimePassedSinceLastPlayback) return; - scoreTickSound?.Play(); + Schedule(() => scoreTickSound?.Play()); lastTickPlaybackTime = Clock.CurrentTime; } @@ -323,28 +313,35 @@ namespace osu.Game.Screens.Ranking.Expanded.Accuracy this.ScaleTo(0).Then().ScaleTo(1, APPEAR_DURATION, Easing.OutQuint); - if (AudioSettings.PlaySwooshSound.Value) - this.Delay(AudioSettings.SwooshPreDelay.Value).Schedule(() => swooshUpSound?.Play()); + if (PlaySwooshSound && swooshUpSound != null) + { + this.Delay(SwooshPreDelay).Schedule(() => + { + swooshUpSound.Volume.Value = SwooshVolume; + swooshUpSound.Play(); + }); + } - using (BeginDelayedSequence(RANK_CIRCLE_TRANSFORM_DELAY, true)) + using (BeginDelayedSequence(RANK_CIRCLE_TRANSFORM_DELAY)) innerMask.FillTo(1f, RANK_CIRCLE_TRANSFORM_DURATION, ACCURACY_TRANSFORM_EASING); - using (BeginDelayedSequence(ACCURACY_TRANSFORM_DELAY, true)) + using (BeginDelayedSequence(ACCURACY_TRANSFORM_DELAY)) { double targetAccuracy = score.Rank == ScoreRank.X || score.Rank == ScoreRank.XH ? 1 : Math.Min(1 - virtual_ss_percentage, score.Accuracy); accuracyCircle.FillTo(targetAccuracy, ACCURACY_TRANSFORM_DURATION, ACCURACY_TRANSFORM_EASING); - if (AudioSettings.PlayTicks.Value) - { - scoreTickSound?.FrequencyTo(1 + (targetAccuracy * AudioSettings.TickPitchFactor.Value), ACCURACY_TRANSFORM_DURATION, AudioSettings.TickPitchEasing.Value); - scoreTickSound?.VolumeTo(AudioSettings.TickVolumeStart.Value).Then().VolumeTo(AudioSettings.TickVolumeEnd.Value, ACCURACY_TRANSFORM_DURATION, AudioSettings.TickVolumeEasing.Value); - this.TransformBindableTo(tickPlaybackRate, AudioSettings.TickDebounceEnd.Value, ACCURACY_TRANSFORM_DURATION, AudioSettings.TickRateEasing.Value); - } - Schedule(() => { - if (!AudioSettings.PlayTicks.Value) return; + if (!PlayTicks) return; + + if (scoreTickSound != null) + { + // doesn't work + scoreTickSound.FrequencyTo(1).Then().FrequencyTo(1 + targetAccuracy * TickPitchFactor, ACCURACY_TRANSFORM_DURATION, TickPitchEasing); + scoreTickSound.VolumeTo(TickVolumeStart).Then().VolumeTo(TickVolumeEnd, ACCURACY_TRANSFORM_DURATION, TickVolumeEasing); + this.TransformBindableTo(tickPlaybackRate, TickDebounceEnd, ACCURACY_TRANSFORM_DURATION, TickRateEasing); + } isTicking = true; }); @@ -359,98 +356,107 @@ namespace osu.Game.Screens.Ranking.Expanded.Accuracy using (BeginDelayedSequence(inverseEasing(ACCURACY_TRANSFORM_EASING, Math.Min(1 - virtual_ss_percentage, badge.Accuracy) / targetAccuracy) * ACCURACY_TRANSFORM_DURATION, true)) { badge.Appear(); + + if (!PlayBadgeSounds) return; + Schedule(() => { - if (badgeTickSound == null || badgeMaxSound == null || !AudioSettings.PlayBadgeSounds.Value) return; - - if (badgeNum < (badges.Count - 1)) - { - badgeTickSound.Frequency.Value = 1 + (badgeNum++ * 0.05); - badgeTickSound?.Play(); - } - else - { - badgeMaxSound.Frequency.Value = 1 + (badgeNum++ * 0.05); - badgeMaxSound?.Play(); - isTicking = false; - } + DrawableSample dink = badgeNum < badges.Count - 1 ? badgeTickSound : badgeMaxSound; + dink.FrequencyTo(1 + badgeNum++ * 0.05); + dink.VolumeTo(BadgeDinkVolume); + dink.Play(); }); } } - using (BeginDelayedSequence(TEXT_APPEAR_DELAY, true)) + using (BeginDelayedSequence(TEXT_APPEAR_DELAY)) { rankText.Appear(); + Schedule(() => { isTicking = false; - if (!AudioSettings.PlayImpact.Value) return; + if (!PlayImpact) return; + + DrawableSample impact = null; switch (score.Rank) { case ScoreRank.D: - rankDImpactSound?.Play(); + impact = rankDImpactSound; break; case ScoreRank.C: - rankCImpactSound?.Play(); + impact = rankCImpactSound; break; case ScoreRank.B: - rankBImpactSound?.Play(); + impact = rankBImpactSound; break; case ScoreRank.A: - rankAImpactSound?.Play(); + impact = rankAImpactSound; break; case ScoreRank.S: case ScoreRank.SH: - rankSImpactSound?.Play(); + impact = rankSImpactSound; break; case ScoreRank.X: case ScoreRank.XH: - rankSSImpactSound?.Play(); + impact = rankSSImpactSound; break; } + + if (impact == null) return; + + impact.Volume.Value = ImpactVolume; + impact.Play(); }); - using (BeginDelayedSequence(AudioSettings.ApplauseDelay.Value)) + using (BeginDelayedSequence(ApplauseDelay)) { - if (!AudioSettings.PlayApplause.Value) return; + if (!PlayApplause) return; Schedule(() => { + DrawableSample applause = null; + switch (score.Rank) { case ScoreRank.D: - rankDApplauseSound?.Play(); + applause = rankDApplauseSound; break; case ScoreRank.C: - rankCApplauseSound?.Play(); + applause = rankCApplauseSound; break; case ScoreRank.B: - rankBApplauseSound?.Play(); + applause = rankBApplauseSound; break; case ScoreRank.A: - rankAApplauseSound?.Play(); + applause = rankAApplauseSound; break; case ScoreRank.S: case ScoreRank.SH: - rankSApplauseSound?.Play(); + applause = rankSApplauseSound; break; case ScoreRank.X: case ScoreRank.XH: - rankSSApplauseSound?.Play(); + applause = rankSSApplauseSound; break; } + + if (applause == null) return; + + applause.Volume.Value = ApplauseVolume; + applause.Play(); }); } } @@ -476,164 +482,4 @@ namespace osu.Game.Screens.Ranking.Expanded.Accuracy return test; } } - - public class AccuracyCircleAudioSettings - { - [SettingSource("setting")] - public Bindable PlayTicks { get; } = new Bindable(true); - - [SettingSource("setting")] - public Bindable TickSampleName { get; } = new Bindable("score-tick"); - - [SettingSource("setting")] - public Bindable PlayBadgeSounds { get; } = new Bindable(true); - - [SettingSource("setting")] - public Bindable BadgeSampleName { get; } = new Bindable("badge-dink"); - - [SettingSource("setting")] - public Bindable BadgeMaxSampleName { get; } = new Bindable("badge-dink-max"); - - [SettingSource("setting")] - public Bindable PlaySwooshSound { get; } = new Bindable(true); - - [SettingSource("setting")] - public Bindable SwooshSampleName { get; } = new Bindable("swoosh-up"); - - [SettingSource("setting")] - public Bindable PlayImpact { get; } = new Bindable(true); - - [SettingSource("setting")] - public Bindable ImpactGradeDSampleName { get; } = new Bindable("rank-impact-fail-d"); - - [SettingSource("setting")] - public Bindable ImpactGradeCSampleName { get; } = new Bindable("rank-impact-fail"); - - [SettingSource("setting")] - public Bindable ImpactGradeBSampleName { get; } = new Bindable("rank-impact-fail"); - - [SettingSource("setting")] - public Bindable ImpactGradeASampleName { get; } = new Bindable("rank-impact-pass"); - - [SettingSource("setting")] - public Bindable ImpactGradeSSampleName { get; } = new Bindable("rank-impact-pass"); - - [SettingSource("setting")] - public Bindable ImpactGradeSSSampleName { get; } = new Bindable("rank-impact-pass-ss"); - - [SettingSource("setting")] - public Bindable PlayApplause { get; } = new Bindable(true); - - [SettingSource("setting")] - public BindableDouble ApplauseVolume { get; } = new BindableDouble(0.8) - { - MinValue = 0, - MaxValue = 1, - Precision = 0.1 - }; - - [SettingSource("setting")] - public BindableDouble ApplauseDelay { get; } = new BindableDouble(545) - { - MinValue = 0, - MaxValue = 10000, - Precision = 1 - }; - - [SettingSource("setting")] - public Bindable ApplauseGradeDSampleName { get; } = new Bindable("applause-d"); - - [SettingSource("setting")] - public Bindable ApplauseGradeCSampleName { get; } = new Bindable("applause-c"); - - [SettingSource("setting")] - public Bindable ApplauseGradeBSampleName { get; } = new Bindable("applause-b"); - - [SettingSource("setting")] - public Bindable ApplauseGradeASampleName { get; } = new Bindable("applause-a"); - - [SettingSource("setting")] - public Bindable ApplauseGradeSSampleName { get; } = new Bindable("applause-s"); - - [SettingSource("setting")] - public Bindable ApplauseGradeSSSampleName { get; } = new Bindable("applause-s"); - - [SettingSource("setting")] - public BindableDouble TickPitchFactor { get; } = new BindableDouble(1) - { - MinValue = 0, - MaxValue = 3, - Precision = 0.1 - }; - - [SettingSource("setting")] - public BindableDouble TickDebounceStart { get; } = new BindableDouble(18) - { - MinValue = 1, - MaxValue = 100 - }; - - [SettingSource("setting")] - public BindableDouble TickDebounceEnd { get; } = new BindableDouble(300) - { - MinValue = 100, - MaxValue = 1000 - }; - - [SettingSource("setting")] - public BindableDouble SwooshPreDelay { get; } = new BindableDouble(443) - { - MinValue = -1000, - MaxValue = 1000 - }; - - [SettingSource("setting")] - public Bindable TickRateEasing { get; } = new Bindable(Easing.OutSine); - - [SettingSource("setting")] - public Bindable TickPitchEasing { get; } = new Bindable(Easing.OutSine); - - [SettingSource("setting")] - public Bindable TickVolumeEasing { get; } = new Bindable(Easing.OutSine); - - [SettingSource("setting")] - public BindableDouble TickVolumeStart { get; } = new BindableDouble(0.6) - { - MinValue = 0, - MaxValue = 1, - Precision = 0.1 - }; - - [SettingSource("setting")] - public BindableDouble TickVolumeEnd { get; } = new BindableDouble(1.0) - { - MinValue = 0, - MaxValue = 1, - Precision = 0.1 - }; - - [SettingSource("setting")] - public BindableDouble ImpactVolume { get; } = new BindableDouble(1.0) - { - MinValue = 0, - MaxValue = 1, - Precision = 0.1 - }; - - [SettingSource("setting")] - public BindableDouble BadgeDinkVolume { get; } = new BindableDouble(1) - { - MinValue = 0, - MaxValue = 1, - Precision = 0.1 - }; - - [SettingSource("setting")] - public BindableDouble SwooshVolume { get; } = new BindableDouble(0.4) - { - MinValue = 0, - MaxValue = 1, - Precision = 0.1 - }; - } } diff --git a/osu.Game/Skinning/DefaultSkin.cs b/osu.Game/Skinning/DefaultSkin.cs index a17a052b97..a745a65103 100644 --- a/osu.Game/Skinning/DefaultSkin.cs +++ b/osu.Game/Skinning/DefaultSkin.cs @@ -7,6 +7,7 @@ using JetBrains.Annotations; using osu.Framework.Audio.Sample; using osu.Framework.Bindables; using osu.Framework.Graphics; +using osu.Framework.Graphics.Audio; using osu.Framework.Graphics.OpenGL.Textures; using osu.Framework.Graphics.Textures; using osu.Game.Audio; @@ -58,6 +59,60 @@ namespace osu.Game.Skinning switch (component) { + case GameplaySkinComponent sample: + switch (sample.Component) + { + case GameplaySkinSamples.ResultScoreTick: + return new DrawableSample(GetSample(new SampleInfo("Results/score-tick"))); + + case GameplaySkinSamples.ResultBadgeTick: + return new DrawableSample(GetSample(new SampleInfo("Results/badge-dink"))); + + case GameplaySkinSamples.ResultBadgeTickMax: + return new DrawableSample(GetSample(new SampleInfo("Results/badge-dink-max"))); + + case GameplaySkinSamples.ResultSwooshUp: + return new DrawableSample(GetSample(new SampleInfo("Results/swoosh-up"))); + + case GameplaySkinSamples.ResultRank_D: + return new DrawableSample(GetSample(new SampleInfo("Results/rank-impact-fail-d"))); + + case GameplaySkinSamples.ResultRank_B: + return new DrawableSample(GetSample(new SampleInfo("Results/rank-impact-fail"))); + + case GameplaySkinSamples.ResultRank_C: + return new DrawableSample(GetSample(new SampleInfo("Results/rank-impact-fail"))); + + case GameplaySkinSamples.ResultRank_A: + return new DrawableSample(GetSample(new SampleInfo("Results/rank-impact-pass"))); + + case GameplaySkinSamples.ResultRank_S: + return new DrawableSample(GetSample(new SampleInfo("Results/rank-impact-pass"))); + + case GameplaySkinSamples.ResultRank_SS: + return new DrawableSample(GetSample(new SampleInfo("Results/rank-impact-pass-ss"))); + + case GameplaySkinSamples.ResultApplause_D: + return new DrawableSample(GetSample(new SampleInfo("Results/applause-d"))); + + case GameplaySkinSamples.ResultApplause_B: + return new DrawableSample(GetSample(new SampleInfo("Results/applause-b"))); + + case GameplaySkinSamples.ResultApplause_C: + return new DrawableSample(GetSample(new SampleInfo("Results/applause-c"))); + + case GameplaySkinSamples.ResultApplause_A: + return new DrawableSample(GetSample(new SampleInfo("Results/applause-a"))); + + case GameplaySkinSamples.ResultApplause_S: + return new DrawableSample(GetSample(new SampleInfo("Results/applause-s"))); + + case GameplaySkinSamples.ResultApplause_SS: + return new DrawableSample(GetSample(new SampleInfo("Results/applause-s"))); + } + + break; + case SkinnableTargetComponent target: switch (target.Target) { diff --git a/osu.Game/Skinning/GameplaySkinSamples.cs b/osu.Game/Skinning/GameplaySkinSamples.cs new file mode 100644 index 0000000000..895e95e0a9 --- /dev/null +++ b/osu.Game/Skinning/GameplaySkinSamples.cs @@ -0,0 +1,29 @@ +// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. +// See the LICENCE file in the repository root for full licence text. + +namespace osu.Game.Skinning +{ + public enum GameplaySkinSamples + { + // legacy + Applause, + + // results screen + ResultScoreTick, + ResultBadgeTick, + ResultBadgeTickMax, + ResultSwooshUp, + ResultRank_D, + ResultRank_B, + ResultRank_C, + ResultRank_A, + ResultRank_S, + ResultRank_SS, + ResultApplause_D, + ResultApplause_B, + ResultApplause_C, + ResultApplause_A, + ResultApplause_S, + ResultApplause_SS + } +} diff --git a/osu.Game/Skinning/LegacySkin.cs b/osu.Game/Skinning/LegacySkin.cs index 98cc5c8fd8..a484516217 100644 --- a/osu.Game/Skinning/LegacySkin.cs +++ b/osu.Game/Skinning/LegacySkin.cs @@ -10,6 +10,7 @@ using JetBrains.Annotations; using osu.Framework.Audio.Sample; using osu.Framework.Bindables; using osu.Framework.Graphics; +using osu.Framework.Graphics.Audio; using osu.Framework.Graphics.OpenGL.Textures; using osu.Framework.Graphics.Textures; using osu.Framework.IO.Stores; @@ -395,6 +396,43 @@ namespace osu.Game.Skinning return null; + case GameplaySkinComponent sampleComponent: + var applause = GetSample(new SampleInfo("applause")); + + switch (sampleComponent.Component) + { + case GameplaySkinSamples.Applause: + if (applause != null) + return new DrawableSample(applause); + + break; + + case GameplaySkinSamples.ResultScoreTick: + case GameplaySkinSamples.ResultBadgeTick: + case GameplaySkinSamples.ResultBadgeTickMax: + case GameplaySkinSamples.ResultSwooshUp: + case GameplaySkinSamples.ResultRank_D: + case GameplaySkinSamples.ResultRank_B: + case GameplaySkinSamples.ResultRank_C: + case GameplaySkinSamples.ResultRank_A: + case GameplaySkinSamples.ResultRank_S: + case GameplaySkinSamples.ResultRank_SS: + case GameplaySkinSamples.ResultApplause_D: + case GameplaySkinSamples.ResultApplause_B: + case GameplaySkinSamples.ResultApplause_C: + case GameplaySkinSamples.ResultApplause_A: + case GameplaySkinSamples.ResultApplause_S: + case GameplaySkinSamples.ResultApplause_SS: + if (applause != null) + // Legacy skins don't have sounds for the result screen, but may instead have an 'applause' sound. + // This lets a legacy skin's applause sound play instead of result screen sounds (as to not play over each other) + return Drawable.Empty(); + + break; + } + + break; + case HUDSkinComponent hudComponent: { if (!this.HasFont(LegacyFont.Score)) From ed012a724b8480f4d23530aa9c67c2ef37ce41f0 Mon Sep 17 00:00:00 2001 From: Jamie Taylor Date: Wed, 2 Jun 2021 12:49:00 +0900 Subject: [PATCH 05/23] refactor from using public variables --- .../Expanded/Accuracy/AccuracyCircle.cs | 89 +++++++++---------- 1 file changed, 44 insertions(+), 45 deletions(-) diff --git a/osu.Game/Screens/Ranking/Expanded/Accuracy/AccuracyCircle.cs b/osu.Game/Screens/Ranking/Expanded/Accuracy/AccuracyCircle.cs index 5cf41513c8..8060b28d50 100644 --- a/osu.Game/Screens/Ranking/Expanded/Accuracy/AccuracyCircle.cs +++ b/osu.Game/Screens/Ranking/Expanded/Accuracy/AccuracyCircle.cs @@ -11,7 +11,6 @@ using osu.Framework.Graphics; using osu.Framework.Graphics.Audio; using osu.Framework.Graphics.Colour; using osu.Framework.Graphics.Containers; -using osu.Framework.Logging; using osu.Framework.Platform; using osu.Framework.Utils; using osu.Game.Graphics; @@ -77,26 +76,33 @@ namespace osu.Game.Screens.Ranking.Expanded.Accuracy /// public static readonly Easing ACCURACY_TRANSFORM_EASING = Easing.OutPow10; - // audio sfx parameters - public bool PlayTicks = true; - public bool PlayBadgeSounds = true; - public bool PlaySwooshSound = true; - public bool PlayImpact = true; - public bool PlayApplause = true; - public double ApplauseVolume = 0.8f; - public double ApplauseDelay = 545f; - public double TickPitchFactor = 1f; - public double TickDebounceStart = 18f; - public double TickDebounceEnd = 300f; - public double SwooshPreDelay = 443f; - public Easing TickRateEasing = Easing.OutSine; - public Easing TickPitchEasing = Easing.OutSine; - public Easing TickVolumeEasing = Easing.OutSine; - public double TickVolumeStart = 0.6f; - public double TickVolumeEnd = 1.0f; - public double ImpactVolume = 1.0f; - public double BadgeDinkVolume = 1f; - public double SwooshVolume = 0.4f; + #region Sound Effect Playback Parameters + + // swoosh-up + private const double sfx_swoosh_pre_delay = 443f; + private const double sfx_swoosh_volume = 0.4f; + + // score ticks + private const double sfx_score_tick_debounce_rate_start = 18f; + private const double sfx_score_tick_debounce_rate_end = 300f; + private const Easing sfx_score_tick_debounce_rate_easing = Easing.OutSine; + private const double sfx_score_tick_volume_start = 0.6f; + private const double sfx_score_tick_volume_end = 1.0f; + private const Easing sfx_score_tick_volume_easing = Easing.OutSine; + private const Easing sfx_score_tick_pitch_easing = Easing.OutSine; + + // badge dinks + private const double sfx_badge_dink_volume = 1f; + + // impact + private const double sfx_rank_impact_volume = 1.0f; + + // applause + private const bool sfx_applause_enabled = true; + private const double sfx_applause_pre_delay = 545f; + private const double sfx_applause_volume = 0.8f; + + #endregion private readonly ScoreInfo score; @@ -126,8 +132,6 @@ namespace osu.Game.Screens.Ranking.Expanded.Accuracy private double lastTickPlaybackTime; private bool isTicking; - private AudioManager audioManager; - private readonly bool withFlair; public AccuracyCircle(ScoreInfo score, bool withFlair) @@ -137,10 +141,8 @@ namespace osu.Game.Screens.Ranking.Expanded.Accuracy } [BackgroundDependencyLoader] - private void load(AudioManager audio, GameHost host, ISkinSource skin) + private void load(GameHost host, ISkinSource skin) { - audioManager = audio; - InternalChildren = new Drawable[] { new SmoothCircularProgress @@ -261,7 +263,7 @@ namespace osu.Game.Screens.Ranking.Expanded.Accuracy if (withFlair) { - tickPlaybackRate = new Bindable(TickDebounceStart); + tickPlaybackRate = new Bindable(sfx_score_tick_debounce_rate_start); AddRangeInternal(new Drawable[] { @@ -297,7 +299,7 @@ namespace osu.Game.Screens.Ranking.Expanded.Accuracy { base.Update(); - if (!PlayTicks || !isTicking) return; + if (!isTicking) return; bool enoughTimePassedSinceLastPlayback = Clock.CurrentTime - lastTickPlaybackTime >= tickPlaybackRate.Value; @@ -313,11 +315,11 @@ namespace osu.Game.Screens.Ranking.Expanded.Accuracy this.ScaleTo(0).Then().ScaleTo(1, APPEAR_DURATION, Easing.OutQuint); - if (PlaySwooshSound && swooshUpSound != null) + if (swooshUpSound != null) { - this.Delay(SwooshPreDelay).Schedule(() => + this.Delay(sfx_swoosh_pre_delay).Schedule(() => { - swooshUpSound.Volume.Value = SwooshVolume; + swooshUpSound.VolumeTo(sfx_swoosh_volume); swooshUpSound.Play(); }); } @@ -333,14 +335,12 @@ namespace osu.Game.Screens.Ranking.Expanded.Accuracy Schedule(() => { - if (!PlayTicks) return; - if (scoreTickSound != null) { // doesn't work - scoreTickSound.FrequencyTo(1).Then().FrequencyTo(1 + targetAccuracy * TickPitchFactor, ACCURACY_TRANSFORM_DURATION, TickPitchEasing); - scoreTickSound.VolumeTo(TickVolumeStart).Then().VolumeTo(TickVolumeEnd, ACCURACY_TRANSFORM_DURATION, TickVolumeEasing); - this.TransformBindableTo(tickPlaybackRate, TickDebounceEnd, ACCURACY_TRANSFORM_DURATION, TickRateEasing); + scoreTickSound.FrequencyTo(1).Then().FrequencyTo(1 + targetAccuracy, ACCURACY_TRANSFORM_DURATION, sfx_score_tick_pitch_easing); + scoreTickSound.VolumeTo(sfx_score_tick_volume_start).Then().VolumeTo(sfx_score_tick_volume_end, ACCURACY_TRANSFORM_DURATION, sfx_score_tick_volume_easing); + this.TransformBindableTo(tickPlaybackRate, sfx_score_tick_debounce_rate_end, ACCURACY_TRANSFORM_DURATION, sfx_score_tick_debounce_rate_easing); } isTicking = true; @@ -357,13 +357,14 @@ namespace osu.Game.Screens.Ranking.Expanded.Accuracy { badge.Appear(); - if (!PlayBadgeSounds) return; - Schedule(() => { DrawableSample dink = badgeNum < badges.Count - 1 ? badgeTickSound : badgeMaxSound; + + if (dink == null) return; + dink.FrequencyTo(1 + badgeNum++ * 0.05); - dink.VolumeTo(BadgeDinkVolume); + dink.VolumeTo(sfx_badge_dink_volume); dink.Play(); }); } @@ -377,8 +378,6 @@ namespace osu.Game.Screens.Ranking.Expanded.Accuracy { isTicking = false; - if (!PlayImpact) return; - DrawableSample impact = null; switch (score.Rank) @@ -412,13 +411,13 @@ namespace osu.Game.Screens.Ranking.Expanded.Accuracy if (impact == null) return; - impact.Volume.Value = ImpactVolume; + impact.VolumeTo(sfx_rank_impact_volume); impact.Play(); }); - using (BeginDelayedSequence(ApplauseDelay)) + using (BeginDelayedSequence(sfx_applause_pre_delay)) { - if (!PlayApplause) return; + if (!sfx_applause_enabled) return; Schedule(() => { @@ -455,7 +454,7 @@ namespace osu.Game.Screens.Ranking.Expanded.Accuracy if (applause == null) return; - applause.Volume.Value = ApplauseVolume; + applause.VolumeTo(sfx_applause_volume); applause.Play(); }); } From 582360d0c80d9e1f9d111b51acf847c6de5c4e53 Mon Sep 17 00:00:00 2001 From: Jamie Taylor Date: Wed, 2 Jun 2021 16:57:09 +0900 Subject: [PATCH 06/23] only load the required impact/applause samples --- .../Expanded/Accuracy/AccuracyCircle.cs | 188 +++++++----------- 1 file changed, 67 insertions(+), 121 deletions(-) diff --git a/osu.Game/Screens/Ranking/Expanded/Accuracy/AccuracyCircle.cs b/osu.Game/Screens/Ranking/Expanded/Accuracy/AccuracyCircle.cs index 8060b28d50..ac5c8dbed8 100644 --- a/osu.Game/Screens/Ranking/Expanded/Accuracy/AccuracyCircle.cs +++ b/osu.Game/Screens/Ranking/Expanded/Accuracy/AccuracyCircle.cs @@ -98,7 +98,6 @@ namespace osu.Game.Screens.Ranking.Expanded.Accuracy private const double sfx_rank_impact_volume = 1.0f; // applause - private const bool sfx_applause_enabled = true; private const double sfx_applause_pre_delay = 545f; private const double sfx_applause_volume = 0.8f; @@ -115,29 +114,19 @@ namespace osu.Game.Screens.Ranking.Expanded.Accuracy private DrawableSample badgeTickSound; private DrawableSample badgeMaxSound; private DrawableSample swooshUpSound; - private DrawableSample rankDImpactSound; - private DrawableSample rankBImpactSound; - private DrawableSample rankCImpactSound; - private DrawableSample rankAImpactSound; - private DrawableSample rankSImpactSound; - private DrawableSample rankSSImpactSound; - private DrawableSample rankDApplauseSound; - private DrawableSample rankBApplauseSound; - private DrawableSample rankCApplauseSound; - private DrawableSample rankAApplauseSound; - private DrawableSample rankSApplauseSound; - private DrawableSample rankSSApplauseSound; + private DrawableSample rankImpactSound; + private DrawableSample rankApplauseSound; private Bindable tickPlaybackRate = new Bindable(); private double lastTickPlaybackTime; private bool isTicking; - private readonly bool withFlair; + private readonly bool sfxEnabled; - public AccuracyCircle(ScoreInfo score, bool withFlair) + public AccuracyCircle(ScoreInfo score, bool sfxEnabled = false) { this.score = score; - this.withFlair = withFlair; + this.sfxEnabled = sfxEnabled; } [BackgroundDependencyLoader] @@ -261,28 +250,53 @@ namespace osu.Game.Screens.Ranking.Expanded.Accuracy rankText = new RankText(score.Rank) }; - if (withFlair) + if (sfxEnabled) { tickPlaybackRate = new Bindable(sfx_score_tick_debounce_rate_start); + switch (score.Rank) + { + case ScoreRank.D: + rankImpactSound = skin.GetDrawableComponent(new GameplaySkinComponent(GameplaySkinSamples.ResultRank_D)) as DrawableSample; + rankApplauseSound = skin.GetDrawableComponent(new GameplaySkinComponent(GameplaySkinSamples.ResultApplause_D)) as DrawableSample; + break; + + case ScoreRank.C: + rankImpactSound = skin.GetDrawableComponent(new GameplaySkinComponent(GameplaySkinSamples.ResultRank_C)) as DrawableSample; + rankApplauseSound = skin.GetDrawableComponent(new GameplaySkinComponent(GameplaySkinSamples.ResultApplause_C)) as DrawableSample; + break; + + case ScoreRank.B: + rankImpactSound = skin.GetDrawableComponent(new GameplaySkinComponent(GameplaySkinSamples.ResultRank_B)) as DrawableSample; + rankApplauseSound = skin.GetDrawableComponent(new GameplaySkinComponent(GameplaySkinSamples.ResultApplause_B)) as DrawableSample; + break; + + case ScoreRank.A: + rankImpactSound = skin.GetDrawableComponent(new GameplaySkinComponent(GameplaySkinSamples.ResultRank_A)) as DrawableSample; + rankApplauseSound = skin.GetDrawableComponent(new GameplaySkinComponent(GameplaySkinSamples.ResultApplause_A)) as DrawableSample; + break; + + case ScoreRank.S: + case ScoreRank.SH: + rankImpactSound = skin.GetDrawableComponent(new GameplaySkinComponent(GameplaySkinSamples.ResultRank_S)) as DrawableSample; + rankApplauseSound = skin.GetDrawableComponent(new GameplaySkinComponent(GameplaySkinSamples.ResultApplause_S)) as DrawableSample; + break; + + case ScoreRank.X: + case ScoreRank.XH: + rankImpactSound = skin.GetDrawableComponent(new GameplaySkinComponent(GameplaySkinSamples.ResultRank_SS)) as DrawableSample; + rankApplauseSound = skin.GetDrawableComponent(new GameplaySkinComponent(GameplaySkinSamples.ResultApplause_SS)) as DrawableSample; + break; + } + AddRangeInternal(new Drawable[] { + rankImpactSound, + rankApplauseSound, scoreTickSound = skin.GetDrawableComponent(new GameplaySkinComponent(GameplaySkinSamples.ResultScoreTick)) as DrawableSample, badgeTickSound = skin.GetDrawableComponent(new GameplaySkinComponent(GameplaySkinSamples.ResultBadgeTick)) as DrawableSample, badgeMaxSound = skin.GetDrawableComponent(new GameplaySkinComponent(GameplaySkinSamples.ResultBadgeTickMax)) as DrawableSample, - swooshUpSound = skin.GetDrawableComponent(new GameplaySkinComponent(GameplaySkinSamples.ResultSwooshUp)) as DrawableSample, - rankDImpactSound = skin.GetDrawableComponent(new GameplaySkinComponent(GameplaySkinSamples.ResultRank_D)) as DrawableSample, - rankBImpactSound = skin.GetDrawableComponent(new GameplaySkinComponent(GameplaySkinSamples.ResultRank_B)) as DrawableSample, - rankCImpactSound = skin.GetDrawableComponent(new GameplaySkinComponent(GameplaySkinSamples.ResultRank_C)) as DrawableSample, - rankAImpactSound = skin.GetDrawableComponent(new GameplaySkinComponent(GameplaySkinSamples.ResultRank_A)) as DrawableSample, - rankSImpactSound = skin.GetDrawableComponent(new GameplaySkinComponent(GameplaySkinSamples.ResultRank_S)) as DrawableSample, - rankSSImpactSound = skin.GetDrawableComponent(new GameplaySkinComponent(GameplaySkinSamples.ResultRank_SS)) as DrawableSample, - rankDApplauseSound = skin.GetDrawableComponent(new GameplaySkinComponent(GameplaySkinSamples.ResultApplause_D)) as DrawableSample, - rankBApplauseSound = skin.GetDrawableComponent(new GameplaySkinComponent(GameplaySkinSamples.ResultApplause_B)) as DrawableSample, - rankCApplauseSound = skin.GetDrawableComponent(new GameplaySkinComponent(GameplaySkinSamples.ResultApplause_C)) as DrawableSample, - rankAApplauseSound = skin.GetDrawableComponent(new GameplaySkinComponent(GameplaySkinSamples.ResultApplause_A)) as DrawableSample, - rankSApplauseSound = skin.GetDrawableComponent(new GameplaySkinComponent(GameplaySkinSamples.ResultApplause_S)) as DrawableSample, - rankSSApplauseSound = skin.GetDrawableComponent(new GameplaySkinComponent(GameplaySkinSamples.ResultApplause_SS)) as DrawableSample + swooshUpSound = skin.GetDrawableComponent(new GameplaySkinComponent(GameplaySkinSamples.ResultSwooshUp)) as DrawableSample }); } } @@ -315,7 +329,7 @@ namespace osu.Game.Screens.Ranking.Expanded.Accuracy this.ScaleTo(0).Then().ScaleTo(1, APPEAR_DURATION, Easing.OutQuint); - if (swooshUpSound != null) + if (sfxEnabled) { this.Delay(sfx_swoosh_pre_delay).Schedule(() => { @@ -333,18 +347,17 @@ namespace osu.Game.Screens.Ranking.Expanded.Accuracy accuracyCircle.FillTo(targetAccuracy, ACCURACY_TRANSFORM_DURATION, ACCURACY_TRANSFORM_EASING); - Schedule(() => + if (sfxEnabled) { - if (scoreTickSound != null) + Schedule(() => { - // doesn't work - scoreTickSound.FrequencyTo(1).Then().FrequencyTo(1 + targetAccuracy, ACCURACY_TRANSFORM_DURATION, sfx_score_tick_pitch_easing); + scoreTickSound.FrequencyTo(1 + targetAccuracy, ACCURACY_TRANSFORM_DURATION, sfx_score_tick_pitch_easing); scoreTickSound.VolumeTo(sfx_score_tick_volume_start).Then().VolumeTo(sfx_score_tick_volume_end, ACCURACY_TRANSFORM_DURATION, sfx_score_tick_volume_easing); this.TransformBindableTo(tickPlaybackRate, sfx_score_tick_debounce_rate_end, ACCURACY_TRANSFORM_DURATION, sfx_score_tick_debounce_rate_easing); - } - isTicking = true; - }); + isTicking = true; + }); + } int badgeNum = 0; @@ -353,20 +366,20 @@ namespace osu.Game.Screens.Ranking.Expanded.Accuracy if (badge.Accuracy > score.Accuracy) continue; - using (BeginDelayedSequence(inverseEasing(ACCURACY_TRANSFORM_EASING, Math.Min(1 - virtual_ss_percentage, badge.Accuracy) / targetAccuracy) * ACCURACY_TRANSFORM_DURATION, true)) + using (BeginDelayedSequence(inverseEasing(ACCURACY_TRANSFORM_EASING, Math.Min(1 - virtual_ss_percentage, badge.Accuracy) / targetAccuracy) * ACCURACY_TRANSFORM_DURATION)) { badge.Appear(); - Schedule(() => + if (sfxEnabled) { - DrawableSample dink = badgeNum < badges.Count - 1 ? badgeTickSound : badgeMaxSound; - - if (dink == null) return; - - dink.FrequencyTo(1 + badgeNum++ * 0.05); - dink.VolumeTo(sfx_badge_dink_volume); - dink.Play(); - }); + Schedule(() => + { + DrawableSample dink = badgeNum < badges.Count - 1 ? badgeTickSound : badgeMaxSound; + dink.FrequencyTo(1 + badgeNum++ * 0.05); + dink.VolumeTo(sfx_badge_dink_volume); + dink.Play(); + }); + } } } @@ -374,88 +387,21 @@ namespace osu.Game.Screens.Ranking.Expanded.Accuracy { rankText.Appear(); + if (!sfxEnabled) return; + Schedule(() => { isTicking = false; - - DrawableSample impact = null; - - switch (score.Rank) - { - case ScoreRank.D: - impact = rankDImpactSound; - break; - - case ScoreRank.C: - impact = rankCImpactSound; - break; - - case ScoreRank.B: - impact = rankBImpactSound; - break; - - case ScoreRank.A: - impact = rankAImpactSound; - break; - - case ScoreRank.S: - case ScoreRank.SH: - impact = rankSImpactSound; - break; - - case ScoreRank.X: - case ScoreRank.XH: - impact = rankSSImpactSound; - break; - } - - if (impact == null) return; - - impact.VolumeTo(sfx_rank_impact_volume); - impact.Play(); + rankImpactSound.VolumeTo(sfx_rank_impact_volume); + rankImpactSound.Play(); }); using (BeginDelayedSequence(sfx_applause_pre_delay)) { - if (!sfx_applause_enabled) return; - Schedule(() => { - DrawableSample applause = null; - - switch (score.Rank) - { - case ScoreRank.D: - applause = rankDApplauseSound; - break; - - case ScoreRank.C: - applause = rankCApplauseSound; - break; - - case ScoreRank.B: - applause = rankBApplauseSound; - break; - - case ScoreRank.A: - applause = rankAApplauseSound; - break; - - case ScoreRank.S: - case ScoreRank.SH: - applause = rankSApplauseSound; - break; - - case ScoreRank.X: - case ScoreRank.XH: - applause = rankSSApplauseSound; - break; - } - - if (applause == null) return; - - applause.VolumeTo(sfx_applause_volume); - applause.Play(); + rankApplauseSound.VolumeTo(sfx_applause_volume); + rankApplauseSound.Play(); }); } } From 054de675ff1979af4923658c0b0b3beb19a8a054 Mon Sep 17 00:00:00 2001 From: Jamie Taylor Date: Thu, 3 Jun 2021 15:31:34 +0900 Subject: [PATCH 07/23] allow skinned 'applause' sample to override results screen sfx --- .../Expanded/Accuracy/AccuracyCircle.cs | 106 ++++++++++-------- 1 file changed, 61 insertions(+), 45 deletions(-) diff --git a/osu.Game/Screens/Ranking/Expanded/Accuracy/AccuracyCircle.cs b/osu.Game/Screens/Ranking/Expanded/Accuracy/AccuracyCircle.cs index ac5c8dbed8..af43477e84 100644 --- a/osu.Game/Screens/Ranking/Expanded/Accuracy/AccuracyCircle.cs +++ b/osu.Game/Screens/Ranking/Expanded/Accuracy/AccuracyCircle.cs @@ -116,12 +116,14 @@ namespace osu.Game.Screens.Ranking.Expanded.Accuracy private DrawableSample swooshUpSound; private DrawableSample rankImpactSound; private DrawableSample rankApplauseSound; + private DrawableSample legacySkinApplauseSound; private Bindable tickPlaybackRate = new Bindable(); private double lastTickPlaybackTime; private bool isTicking; private readonly bool sfxEnabled; + private bool legacySkin => legacySkinApplauseSound != null; public AccuracyCircle(ScoreInfo score, bool sfxEnabled = false) { @@ -252,52 +254,62 @@ namespace osu.Game.Screens.Ranking.Expanded.Accuracy if (sfxEnabled) { - tickPlaybackRate = new Bindable(sfx_score_tick_debounce_rate_start); + Drawable legacySkinApplause = skin.GetDrawableComponent(new GameplaySkinComponent(GameplaySkinSamples.Applause)); - switch (score.Rank) + if (legacySkinApplause != null) { - case ScoreRank.D: - rankImpactSound = skin.GetDrawableComponent(new GameplaySkinComponent(GameplaySkinSamples.ResultRank_D)) as DrawableSample; - rankApplauseSound = skin.GetDrawableComponent(new GameplaySkinComponent(GameplaySkinSamples.ResultApplause_D)) as DrawableSample; - break; - - case ScoreRank.C: - rankImpactSound = skin.GetDrawableComponent(new GameplaySkinComponent(GameplaySkinSamples.ResultRank_C)) as DrawableSample; - rankApplauseSound = skin.GetDrawableComponent(new GameplaySkinComponent(GameplaySkinSamples.ResultApplause_C)) as DrawableSample; - break; - - case ScoreRank.B: - rankImpactSound = skin.GetDrawableComponent(new GameplaySkinComponent(GameplaySkinSamples.ResultRank_B)) as DrawableSample; - rankApplauseSound = skin.GetDrawableComponent(new GameplaySkinComponent(GameplaySkinSamples.ResultApplause_B)) as DrawableSample; - break; - - case ScoreRank.A: - rankImpactSound = skin.GetDrawableComponent(new GameplaySkinComponent(GameplaySkinSamples.ResultRank_A)) as DrawableSample; - rankApplauseSound = skin.GetDrawableComponent(new GameplaySkinComponent(GameplaySkinSamples.ResultApplause_A)) as DrawableSample; - break; - - case ScoreRank.S: - case ScoreRank.SH: - rankImpactSound = skin.GetDrawableComponent(new GameplaySkinComponent(GameplaySkinSamples.ResultRank_S)) as DrawableSample; - rankApplauseSound = skin.GetDrawableComponent(new GameplaySkinComponent(GameplaySkinSamples.ResultApplause_S)) as DrawableSample; - break; - - case ScoreRank.X: - case ScoreRank.XH: - rankImpactSound = skin.GetDrawableComponent(new GameplaySkinComponent(GameplaySkinSamples.ResultRank_SS)) as DrawableSample; - rankApplauseSound = skin.GetDrawableComponent(new GameplaySkinComponent(GameplaySkinSamples.ResultApplause_SS)) as DrawableSample; - break; + AddInternal(legacySkinApplause); + legacySkinApplauseSound = legacySkinApplause as DrawableSample; } - - AddRangeInternal(new Drawable[] + else { - rankImpactSound, - rankApplauseSound, - scoreTickSound = skin.GetDrawableComponent(new GameplaySkinComponent(GameplaySkinSamples.ResultScoreTick)) as DrawableSample, - badgeTickSound = skin.GetDrawableComponent(new GameplaySkinComponent(GameplaySkinSamples.ResultBadgeTick)) as DrawableSample, - badgeMaxSound = skin.GetDrawableComponent(new GameplaySkinComponent(GameplaySkinSamples.ResultBadgeTickMax)) as DrawableSample, - swooshUpSound = skin.GetDrawableComponent(new GameplaySkinComponent(GameplaySkinSamples.ResultSwooshUp)) as DrawableSample - }); + tickPlaybackRate = new Bindable(sfx_score_tick_debounce_rate_start); + + switch (score.Rank) + { + case ScoreRank.D: + rankImpactSound = skin.GetDrawableComponent(new GameplaySkinComponent(GameplaySkinSamples.ResultRank_D)) as DrawableSample; + rankApplauseSound = skin.GetDrawableComponent(new GameplaySkinComponent(GameplaySkinSamples.ResultApplause_D)) as DrawableSample; + break; + + case ScoreRank.C: + rankImpactSound = skin.GetDrawableComponent(new GameplaySkinComponent(GameplaySkinSamples.ResultRank_C)) as DrawableSample; + rankApplauseSound = skin.GetDrawableComponent(new GameplaySkinComponent(GameplaySkinSamples.ResultApplause_C)) as DrawableSample; + break; + + case ScoreRank.B: + rankImpactSound = skin.GetDrawableComponent(new GameplaySkinComponent(GameplaySkinSamples.ResultRank_B)) as DrawableSample; + rankApplauseSound = skin.GetDrawableComponent(new GameplaySkinComponent(GameplaySkinSamples.ResultApplause_B)) as DrawableSample; + break; + + case ScoreRank.A: + rankImpactSound = skin.GetDrawableComponent(new GameplaySkinComponent(GameplaySkinSamples.ResultRank_A)) as DrawableSample; + rankApplauseSound = skin.GetDrawableComponent(new GameplaySkinComponent(GameplaySkinSamples.ResultApplause_A)) as DrawableSample; + break; + + case ScoreRank.S: + case ScoreRank.SH: + rankImpactSound = skin.GetDrawableComponent(new GameplaySkinComponent(GameplaySkinSamples.ResultRank_S)) as DrawableSample; + rankApplauseSound = skin.GetDrawableComponent(new GameplaySkinComponent(GameplaySkinSamples.ResultApplause_S)) as DrawableSample; + break; + + case ScoreRank.X: + case ScoreRank.XH: + rankImpactSound = skin.GetDrawableComponent(new GameplaySkinComponent(GameplaySkinSamples.ResultRank_SS)) as DrawableSample; + rankApplauseSound = skin.GetDrawableComponent(new GameplaySkinComponent(GameplaySkinSamples.ResultApplause_SS)) as DrawableSample; + break; + } + + AddRangeInternal(new Drawable[] + { + rankImpactSound, + rankApplauseSound, + scoreTickSound = skin.GetDrawableComponent(new GameplaySkinComponent(GameplaySkinSamples.ResultScoreTick)) as DrawableSample, + badgeTickSound = skin.GetDrawableComponent(new GameplaySkinComponent(GameplaySkinSamples.ResultBadgeTick)) as DrawableSample, + badgeMaxSound = skin.GetDrawableComponent(new GameplaySkinComponent(GameplaySkinSamples.ResultBadgeTickMax)) as DrawableSample, + swooshUpSound = skin.GetDrawableComponent(new GameplaySkinComponent(GameplaySkinSamples.ResultSwooshUp)) as DrawableSample + }); + } } } @@ -329,7 +341,7 @@ namespace osu.Game.Screens.Ranking.Expanded.Accuracy this.ScaleTo(0).Then().ScaleTo(1, APPEAR_DURATION, Easing.OutQuint); - if (sfxEnabled) + if (sfxEnabled && !legacySkin) { this.Delay(sfx_swoosh_pre_delay).Schedule(() => { @@ -347,7 +359,7 @@ namespace osu.Game.Screens.Ranking.Expanded.Accuracy accuracyCircle.FillTo(targetAccuracy, ACCURACY_TRANSFORM_DURATION, ACCURACY_TRANSFORM_EASING); - if (sfxEnabled) + if (sfxEnabled && !legacySkin) { Schedule(() => { @@ -370,7 +382,7 @@ namespace osu.Game.Screens.Ranking.Expanded.Accuracy { badge.Appear(); - if (sfxEnabled) + if (sfxEnabled && !legacySkin) { Schedule(() => { @@ -389,6 +401,10 @@ namespace osu.Game.Screens.Ranking.Expanded.Accuracy if (!sfxEnabled) return; + legacySkinApplauseSound?.Play(); + + if (legacySkin) return; + Schedule(() => { isTicking = false; From 49fbd35e91a1c64b1ebb988590fee7bc26e788ef Mon Sep 17 00:00:00 2001 From: Jamie Taylor Date: Fri, 4 Jun 2021 11:58:11 +0900 Subject: [PATCH 08/23] remove sound design tool --- .../SoundDesign/TestSceneAccuracyCircle.cs | 1129 ----------------- 1 file changed, 1129 deletions(-) delete mode 100644 osu.Game.Tests/Visual/SoundDesign/TestSceneAccuracyCircle.cs diff --git a/osu.Game.Tests/Visual/SoundDesign/TestSceneAccuracyCircle.cs b/osu.Game.Tests/Visual/SoundDesign/TestSceneAccuracyCircle.cs deleted file mode 100644 index e630bb5983..0000000000 --- a/osu.Game.Tests/Visual/SoundDesign/TestSceneAccuracyCircle.cs +++ /dev/null @@ -1,1129 +0,0 @@ -// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. -// See the LICENCE file in the repository root for full licence text. - -using System; -using System.Collections.Generic; -using System.IO; -using Newtonsoft.Json; -using NUnit.Framework; -using osu.Framework.Allocation; -using osu.Framework.Audio; -using osu.Framework.Bindables; -using osu.Framework.Extensions.Color4Extensions; -using osu.Framework.Graphics; -using osu.Framework.Graphics.Audio; -using osu.Framework.Graphics.Colour; -using osu.Framework.Graphics.Containers; -using osu.Framework.Graphics.Shapes; -using osu.Framework.Platform; -using osu.Game.Configuration; -using osu.Game.Graphics; -using osu.Game.Graphics.Containers; -using osu.Game.Graphics.Sprites; -using osu.Game.Graphics.UserInterface; -using osu.Game.Graphics.UserInterfaceV2; -using osu.Game.Overlays; -using osu.Game.Overlays.Settings; -using osu.Game.Rulesets.Mods; -using osu.Game.Rulesets.Osu; -using osu.Game.Rulesets.Osu.Mods; -using osu.Game.Rulesets.Scoring; -using osu.Game.Scoring; -using osu.Game.Screens.Ranking.Expanded.Accuracy; -using osu.Game.Tests.Beatmaps; -using osu.Game.Users; -using osuTK; - -namespace osu.Game.Tests.Visual.SoundDesign -{ - public class TestSceneAccuracyCircle : OsuTestScene - { - [Resolved] - private AudioManager audioManager { get; set; } - - [Resolved] - private OsuColour colours { get; set; } - - private DrawableSample previewSampleChannel; - private AccuracyCircleAudioSettings settings = new AccuracyCircleAudioSettings(); - private OsuTextBox saveFilename; - - private Storage presetStorage; - private FileSelector presetFileSelector; - - private Bindable sampleLoadTarget = new Bindable(); - private Bindable selectedSampleName = new Bindable(); - - private Container accuracyCircle; - - private enum SampleLoadTarget - { - ScoreTick, - BadgeDink, - BadgeDinkMax, - Swoosh, - ImpactD, - ImpactC, - ImpactB, - ImpactA, - ImpactS, - ImpactSS, - ApplauseD, - ApplauseC, - ApplauseB, - ApplauseA, - ApplauseS, - ApplauseSS, - }; - - private enum SectionTabs - { - [System.ComponentModel.Description("Score Ticks")] - ScoreTicks, - - [System.ComponentModel.Description("Badge Dinks")] - BadgeDinks, - - [System.ComponentModel.Description("Swoosh")] - Swoosh, - - [System.ComponentModel.Description("Impact")] - Impact, - - [System.ComponentModel.Description("Applause")] - Applause, - - [System.ComponentModel.Description("Preset")] - Preset - } - - private OsuTabControl tabSelector; - - private Dictionary tabContainers = new Dictionary(); - private FillFlowContainer sampleSelectContainer; - - private FileSelector sampleFileSelector; - - [BackgroundDependencyLoader] - private void load(GameHost host) - { - presetStorage = host.Storage.GetStorageForDirectory("presets"); - - Children = new Drawable[] - { - new FillFlowContainer - { - RelativeSizeAxes = Axes.Both, - Direction = FillDirection.Horizontal, - Children = new Drawable[] - { - new Container - { - RelativeSizeAxes = Axes.Both, - Width = 0.5f, - Children = new Drawable[] - { - new Box - { - RelativeSizeAxes = Axes.Both, - Colour = Color4Extensions.FromHex("222") - }, - new OsuScrollContainer - { - RelativeSizeAxes = Axes.Both, - ScrollbarVisible = false, - Child = new FillFlowContainer - { - AutoSizeAxes = Axes.Y, - RelativeSizeAxes = Axes.X, - Direction = FillDirection.Vertical, - Spacing = new Vector2(0, 10), - Padding = new MarginPadding(10), - Children = new Drawable[] - { - tabSelector = new OsuTabControl - { - RelativeSizeAxes = Axes.X, - Width = 1f, - Height = 24, - }, - - #region score ticks - - // ==================== SCORE TICKS ==================== - tabContainers[SectionTabs.ScoreTicks] = new FillFlowContainer - { - AutoSizeAxes = Axes.Y, - RelativeSizeAxes = Axes.X, - Direction = FillDirection.Vertical, - Spacing = new Vector2(0, 10), - Width = 1f, - Children = new Drawable[] - { - new SettingsCheckbox - { - LabelText = "Play Ticks", - Current = { BindTarget = settings.PlayTicks } - }, - new SettingsSlider - { - LabelText = "Tick Volume (Start)", - Current = { BindTarget = settings.TickVolumeStart } - }, - new SettingsSlider - { - LabelText = "Tick Volume (End)", - Current = { BindTarget = settings.TickVolumeEnd } - }, - new SettingsSlider - { - LabelText = "ScoreTick Start Debounce Rate", - Current = { BindTarget = settings.TickDebounceStart } - }, - new SettingsSlider - { - LabelText = "ScoreTick End Debounce Rate", - Current = { BindTarget = settings.TickDebounceEnd } - }, - new OsuSpriteText - { - Padding = new MarginPadding { Left = SettingsPanel.CONTENT_MARGINS }, - Text = "ScoreTick Rate Easing:" - }, - new SettingsEnumDropdown - { - Current = { BindTarget = settings.TickRateEasing } - }, - new SettingsSlider - { - LabelText = "ScoreTick Pitch Factor", - Current = { BindTarget = settings.TickPitchFactor } - }, - new OsuSpriteText - { - Padding = new MarginPadding { Left = SettingsPanel.CONTENT_MARGINS }, - Text = "Pitch Easing:" - }, - new SettingsEnumDropdown - { - Current = { BindTarget = settings.TickPitchEasing } - }, - new OsuSpriteText - { - Padding = new MarginPadding { Left = SettingsPanel.CONTENT_MARGINS }, - Text = "Volume Easing:" - }, - new SettingsEnumDropdown - { - Current = { BindTarget = settings.TickVolumeEasing } - }, - new OsuSpriteText - { - Padding = new MarginPadding { Left = SettingsPanel.CONTENT_MARGINS }, - Text = "Tick Sample:" - }, - new OsuSpriteText - { - Padding = new MarginPadding { Left = SettingsPanel.CONTENT_MARGINS * 2 }, - Current = { BindTarget = settings.TickSampleName } - } - } - }, - - #endregion - - #region badge dinks - - // ==================== BADGE DINKS ==================== - tabContainers[SectionTabs.BadgeDinks] = new FillFlowContainer - { - Alpha = 0, - AutoSizeAxes = Axes.Y, - RelativeSizeAxes = Axes.X, - Direction = FillDirection.Vertical, - Spacing = new Vector2(0, 10), - Width = 1f, - Children = new Drawable[] - { - new SettingsCheckbox - { - LabelText = "Play BadgeSounds", - Current = { BindTarget = settings.PlayBadgeSounds } - }, - new SettingsSlider - { - LabelText = "Badge Dink Volume", - Current = { BindTarget = settings.BadgeDinkVolume } - }, - new OsuSpriteText - { - Font = OsuFont.GetFont(), - Text = "Badge Dink Sample:", - Padding = new MarginPadding { Left = SettingsPanel.CONTENT_MARGINS }, - }, - new OsuSpriteText - { - Font = OsuFont.GetFont(size: 12), - Current = { BindTarget = settings.BadgeSampleName }, - Padding = new MarginPadding { Left = SettingsPanel.CONTENT_MARGINS * 2f }, - }, - new OsuSpriteText - { - Font = OsuFont.GetFont(), - Text = "Badge Max Dink Sample:", - Padding = new MarginPadding { Left = SettingsPanel.CONTENT_MARGINS }, - }, - new OsuSpriteText - { - Font = OsuFont.GetFont(size: 12), - Current = { BindTarget = settings.BadgeMaxSampleName }, - Padding = new MarginPadding { Left = SettingsPanel.CONTENT_MARGINS * 2f }, - } - } - }, - - #endregion - - #region swoosh - - // ==================== SWOOSHES ==================== - tabContainers[SectionTabs.Swoosh] = new FillFlowContainer - { - Alpha = 0, - AutoSizeAxes = Axes.Y, - RelativeSizeAxes = Axes.X, - Direction = FillDirection.Vertical, - Spacing = new Vector2(0, 10), - Width = 1f, - Children = new Drawable[] - { - new SettingsCheckbox - { - LabelText = "Play Swoosh", - Current = { BindTarget = settings.PlaySwooshSound } - }, - new SettingsSlider - { - LabelText = "Swoosh Volume", - Current = { BindTarget = settings.SwooshVolume } - }, - new SettingsSlider - { - LabelText = "Swoosh Pre-Delay (ms)", - Current = { BindTarget = settings.SwooshPreDelay } - }, - new OsuSpriteText - { - Font = OsuFont.GetFont(), - Text = "Swoosh Sample:", - Padding = new MarginPadding { Left = SettingsPanel.CONTENT_MARGINS }, - }, - new OsuSpriteText - { - Font = OsuFont.GetFont(size: 12), - Current = { BindTarget = settings.SwooshSampleName }, - Padding = new MarginPadding { Left = SettingsPanel.CONTENT_MARGINS * 2f }, - } - } - }, - - #endregion - - #region impact - - // ==================== IMPACT ==================== - tabContainers[SectionTabs.Impact] = new FillFlowContainer - { - Alpha = 0, - AutoSizeAxes = Axes.Y, - RelativeSizeAxes = Axes.X, - Direction = FillDirection.Vertical, - Spacing = new Vector2(0, 10), - Width = 1f, - Children = new Drawable[] - { - new SettingsCheckbox - { - LabelText = "Play Impact", - Current = { BindTarget = settings.PlayImpact } - }, - new SettingsSlider - { - LabelText = "Impact Volume", - Current = { BindTarget = settings.ImpactVolume } - }, - new OsuSpriteText - { - Font = OsuFont.GetFont(), - Text = "Grade D Sample:", - Padding = new MarginPadding { Left = SettingsPanel.CONTENT_MARGINS }, - }, - new OsuSpriteText - { - Font = OsuFont.GetFont(size: 12), - Current = { BindTarget = settings.ImpactGradeDSampleName }, - Padding = new MarginPadding { Left = SettingsPanel.CONTENT_MARGINS * 2f }, - }, - new OsuSpriteText - { - Font = OsuFont.GetFont(), - Text = "Grade C Sample:", - Padding = new MarginPadding { Left = SettingsPanel.CONTENT_MARGINS }, - }, - new OsuSpriteText - { - Font = OsuFont.GetFont(size: 12), - Current = { BindTarget = settings.ImpactGradeCSampleName }, - Padding = new MarginPadding { Left = SettingsPanel.CONTENT_MARGINS * 2f }, - }, - new OsuSpriteText - { - Font = OsuFont.GetFont(), - Text = "Grade B Sample:", - Padding = new MarginPadding { Left = SettingsPanel.CONTENT_MARGINS }, - }, - new OsuSpriteText - { - Font = OsuFont.GetFont(size: 12), - Current = { BindTarget = settings.ImpactGradeBSampleName }, - Padding = new MarginPadding { Left = SettingsPanel.CONTENT_MARGINS * 2f }, - }, - new OsuSpriteText - { - Font = OsuFont.GetFont(), - Text = "Grade A Sample:", - Padding = new MarginPadding { Left = SettingsPanel.CONTENT_MARGINS }, - }, - new OsuSpriteText - { - Font = OsuFont.GetFont(size: 12), - Current = { BindTarget = settings.ImpactGradeASampleName }, - Padding = new MarginPadding { Left = SettingsPanel.CONTENT_MARGINS * 2f }, - }, - new OsuSpriteText - { - Font = OsuFont.GetFont(), - Text = "Grade S Sample:", - Padding = new MarginPadding { Left = SettingsPanel.CONTENT_MARGINS }, - }, - new OsuSpriteText - { - Font = OsuFont.GetFont(size: 12), - Current = { BindTarget = settings.ImpactGradeSSampleName }, - Padding = new MarginPadding { Left = SettingsPanel.CONTENT_MARGINS * 2f }, - }, - new OsuSpriteText - { - Font = OsuFont.GetFont(), - Text = "Grade SS Sample:", - Padding = new MarginPadding { Left = SettingsPanel.CONTENT_MARGINS }, - }, - new OsuSpriteText - { - Font = OsuFont.GetFont(size: 12), - Current = { BindTarget = settings.ImpactGradeSSSampleName }, - Padding = new MarginPadding { Left = SettingsPanel.CONTENT_MARGINS * 2f }, - } - } - }, - - #endregion - - #region applause - - // ==================== APPLAUSE ==================== - tabContainers[SectionTabs.Applause] = new FillFlowContainer - { - Alpha = 0, - AutoSizeAxes = Axes.Y, - RelativeSizeAxes = Axes.X, - Direction = FillDirection.Vertical, - Spacing = new Vector2(0, 10), - Width = 1f, - Children = new Drawable[] - { - new SettingsCheckbox - { - LabelText = "Play Applause", - Current = { BindTarget = settings.PlayApplause } - }, - new SettingsSlider - { - LabelText = "Applause Volume", - Current = { BindTarget = settings.ApplauseVolume } - }, - new SettingsSlider - { - LabelText = "Applause Delay (ms)", - Current = { BindTarget = settings.ApplauseDelay } - }, - new OsuSpriteText - { - Font = OsuFont.GetFont(), - Text = "Grade D Sample:", - Padding = new MarginPadding { Left = SettingsPanel.CONTENT_MARGINS }, - }, - new OsuSpriteText - { - Font = OsuFont.GetFont(size: 12), - Current = { BindTarget = settings.ApplauseGradeDSampleName }, - Padding = new MarginPadding { Left = SettingsPanel.CONTENT_MARGINS * 2f }, - }, - new OsuSpriteText - { - Font = OsuFont.GetFont(), - Text = "Grade C Sample:", - Padding = new MarginPadding { Left = SettingsPanel.CONTENT_MARGINS }, - }, - new OsuSpriteText - { - Font = OsuFont.GetFont(size: 12), - Current = { BindTarget = settings.ApplauseGradeCSampleName }, - Padding = new MarginPadding { Left = SettingsPanel.CONTENT_MARGINS * 2f }, - }, - new OsuSpriteText - { - Font = OsuFont.GetFont(), - Text = "Grade B Sample:", - Padding = new MarginPadding { Left = SettingsPanel.CONTENT_MARGINS }, - }, - new OsuSpriteText - { - Font = OsuFont.GetFont(size: 12), - Current = { BindTarget = settings.ApplauseGradeBSampleName }, - Padding = new MarginPadding { Left = SettingsPanel.CONTENT_MARGINS * 2f }, - }, - new OsuSpriteText - { - Font = OsuFont.GetFont(), - Text = "Grade A Sample:", - Padding = new MarginPadding { Left = SettingsPanel.CONTENT_MARGINS }, - }, - new OsuSpriteText - { - Font = OsuFont.GetFont(size: 12), - Current = { BindTarget = settings.ApplauseGradeASampleName }, - Padding = new MarginPadding { Left = SettingsPanel.CONTENT_MARGINS * 2f }, - }, - new OsuSpriteText - { - Font = OsuFont.GetFont(), - Text = "Grade S Sample:", - Padding = new MarginPadding { Left = SettingsPanel.CONTENT_MARGINS }, - }, - new OsuSpriteText - { - Font = OsuFont.GetFont(size: 12), - Current = { BindTarget = settings.ApplauseGradeSSampleName }, - Padding = new MarginPadding { Left = SettingsPanel.CONTENT_MARGINS * 2f }, - }, - new OsuSpriteText - { - Font = OsuFont.GetFont(), - Text = "Grade SS Sample:", - Padding = new MarginPadding { Left = SettingsPanel.CONTENT_MARGINS }, - }, - new OsuSpriteText - { - Font = OsuFont.GetFont(size: 12), - Current = { BindTarget = settings.ApplauseGradeSSSampleName }, - Padding = new MarginPadding { Left = SettingsPanel.CONTENT_MARGINS * 2f }, - } - } - }, - - #endregion - - #region preset - - // ==================== PRESET ==================== - tabContainers[SectionTabs.Preset] = new FillFlowContainer - { - Alpha = 0, - AutoSizeAxes = Axes.Y, - RelativeSizeAxes = Axes.X, - Direction = FillDirection.Vertical, - Spacing = new Vector2(0, 10), - Width = 1f, - Children = new Drawable[] - { - new OsuSpriteText - { - Font = OsuFont.Default.With(size: 24), - Text = "Load", - Colour = colours.Yellow - }, - presetFileSelector = new FileSelector(presetStorage.GetFullPath(string.Empty)) - { - RelativeSizeAxes = Axes.X, - Height = 300, - }, - new OsuSpriteText - { - Font = OsuFont.Default.With(size: 24), - Text = "Save", - Colour = colours.Yellow - }, - saveFilename = new OsuTextBox - { - PlaceholderText = "New preset filename", - RelativeSizeAxes = Axes.X, - }, - new TriangleButton - { - Text = "Save", - Action = savePreset, - RelativeSizeAxes = Axes.X, - }, - } - }, - - #endregion - - #region fileselector - - // ==================== SAMPLE SELECTOR ==================== - sampleSelectContainer = new FillFlowContainer - { - AutoSizeAxes = Axes.Y, - RelativeSizeAxes = Axes.X, - Direction = FillDirection.Vertical, - Padding = new MarginPadding(10) - { - Top = 20, - }, - Width = 1f, - Children = new Drawable[] - { - new OsuSpriteText - { - Font = OsuFont.Default.With(size: 20), - Text = "Load Sample", - Colour = colours.Yellow - }, - sampleFileSelector = new FileSelector("/Users/jamie/Sandbox/derp/Samples/Results") - { - RelativeSizeAxes = Axes.X, - Height = 300, - }, - new TriangleButton - { - Text = "Refresh", - Action = refreshSampleBrowser, - RelativeSizeAxes = Axes.X, - }, - new SettingsEnumDropdown - { - Current = { BindTarget = sampleLoadTarget } - }, - new TriangleButton - { - Text = "Load Sample", - Action = loadSample, - RelativeSizeAxes = Axes.X, - } - } - } - - #endregion - } - } - } - } - }, - new Container - { - RelativeSizeAxes = Axes.Both, - Width = 0.5f, - Children = new Drawable[] - { - new Box - { - Anchor = Anchor.Centre, - Origin = Anchor.Centre, - RelativeSizeAxes = Axes.Both, - Colour = ColourInfo.GradientVertical(Color4Extensions.FromHex("#555"), Color4Extensions.FromHex("#333")) - }, - new FillFlowContainer - { - RelativeSizeAxes = Axes.Both, - Height = 0.5f, - Children = new[] - { - new TriangleButton - { - Text = "Low D Rank", - Action = CreateLowRankDCircle, - RelativeSizeAxes = Axes.X, - Width = 0.25f, - }, - new TriangleButton - { - Text = "D Rank", - Action = CreateDRankCircle, - RelativeSizeAxes = Axes.X, - Width = 0.25f, - }, - new TriangleButton - { - Text = "C Rank", - Action = CreateCRankCircle, - RelativeSizeAxes = Axes.X, - Width = 0.25f, - }, - new TriangleButton - { - Text = "B Rank", - Action = CreateBRankCircle, - RelativeSizeAxes = Axes.X, - Width = 0.25f, - }, - new TriangleButton - { - Text = "A Rank", - Action = CreateARankCircle, - RelativeSizeAxes = Axes.X, - Width = 0.25f, - }, - new TriangleButton - { - Text = "S Rank", - Action = CreateSRankCircle, - RelativeSizeAxes = Axes.X, - Width = 0.25f, - }, - new TriangleButton - { - Text = "Almost SS Rank", - Action = CreateAlmostSSRankCircle, - RelativeSizeAxes = Axes.X, - Width = 0.25f, - }, - new TriangleButton - { - Text = "SS Rank", - Action = CreateSSRankCircle, - RelativeSizeAxes = Axes.X, - Width = 0.25f, - }, - } - }, - accuracyCircle = new Container - { - RelativeSizeAxes = Axes.Both, - // Child = CreateRankDCircle() - } - } - } - } - }, - }; - - presetFileSelector.CurrentFile.ValueChanged += value => - { - string path = value.NewValue.FullName; - - loadPreset(path); - saveFilename.Text = Path.GetFileNameWithoutExtension(path); - }; - - sampleFileSelector.CurrentFile.ValueChanged += value => - { - var sample = Path.GetFileNameWithoutExtension(value.NewValue.Name); - - previewSampleChannel?.Dispose(); - previewSampleChannel = new DrawableSample(audioManager.Samples.Get($"Results/{sample}")); - previewSampleChannel?.Play(); - - selectedSampleName.Value = sample; - }; - - tabSelector.Current.ValueChanged += tab => - { - tabContainers[tab.OldValue].Hide(); - tabContainers[tab.NewValue].Show(); - - switch (tab.NewValue) - { - case SectionTabs.Preset: - sampleSelectContainer.Hide(); - break; - - case SectionTabs.Impact: - sampleLoadTarget.Value = SampleLoadTarget.ImpactD; - sampleSelectContainer.Show(); - break; - - case SectionTabs.Swoosh: - sampleLoadTarget.Value = SampleLoadTarget.Swoosh; - sampleSelectContainer.Show(); - break; - - case SectionTabs.BadgeDinks: - sampleLoadTarget.Value = SampleLoadTarget.BadgeDink; - sampleSelectContainer.Show(); - break; - - case SectionTabs.ScoreTicks: - sampleLoadTarget.Value = SampleLoadTarget.ScoreTick; - sampleSelectContainer.Show(); - break; - - case SectionTabs.Applause: - sampleLoadTarget.Value = SampleLoadTarget.ApplauseD; - sampleSelectContainer.Show(); - break; - } - }; - } - - #region rank scenarios - - [Test] - public void TestDoNothing() => AddStep("show", () => - { - /* do nothing */ - }); - - [Test] - public void TestLowDRank() => AddStep("show", CreateLowRankDCircle); - - [Test] - public void TestDRank() => AddStep("show", CreateDRankCircle); - - [Test] - public void TestCRank() => AddStep("show", CreateCRankCircle); - - [Test] - public void TestBRank() => AddStep("show", CreateBRankCircle); - - [Test] - public void TestARank() => AddStep("show", CreateARankCircle); - - [Test] - public void TestSRank() => AddStep("show", CreateSRankCircle); - - [Test] - public void TestAlmostSSRank() => AddStep("show", CreateAlmostSSRankCircle); - - [Test] - public void TestSSRank() => AddStep("show", CreateSSRankCircle); - - #endregion - - public void CreateLowRankDCircle() => - accuracyCircle.Child = CreateAccuracyCircle(createScore(0.2, ScoreRank.D)); - - public void CreateDRankCircle() => - accuracyCircle.Child = CreateAccuracyCircle(createScore(0.5, ScoreRank.D)); - - public void CreateCRankCircle() => - accuracyCircle.Child = CreateAccuracyCircle(createScore(0.75, ScoreRank.C)); - - public void CreateBRankCircle() => - accuracyCircle.Child = CreateAccuracyCircle(createScore(0.85, ScoreRank.B)); - - public void CreateARankCircle() => - accuracyCircle.Child = CreateAccuracyCircle(createScore(0.925, ScoreRank.A)); - - public void CreateSRankCircle() => - accuracyCircle.Child = CreateAccuracyCircle(createScore(0.975, ScoreRank.S)); - - public void CreateAlmostSSRankCircle() => - accuracyCircle.Child = CreateAccuracyCircle(createScore(0.9999, ScoreRank.S)); - - public void CreateSSRankCircle() => - accuracyCircle.Child = CreateAccuracyCircle(createScore(1, ScoreRank.X)); - - public AccuracyCircle CreateAccuracyCircle(ScoreInfo score) - { - var newAccuracyCircle = new AccuracyCircle(score, true) - { - Anchor = Anchor.Centre, - Origin = Anchor.Centre, - Size = new Vector2(230), - }; - - // newAccuracyCircle.BindAudioSettings(settings); - - return newAccuracyCircle; - } - - private void savePreset() - { - string path = presetStorage.GetFullPath($"{saveFilename.Text}.json", true); - File.WriteAllText(path, JsonConvert.SerializeObject(settings)); - presetFileSelector.CurrentFile.Value = new FileInfo(path); - } - - private void loadPreset(string filename) - { - var saved = JsonConvert.DeserializeObject(File.ReadAllText(presetStorage.GetFullPath(filename))); - - foreach (var (_, prop) in saved.GetSettingsSourceProperties()) - { - var targetBindable = (IBindable)prop.GetValue(settings); - var sourceBindable = (IBindable)prop.GetValue(saved); - - ((IParseable)targetBindable)?.Parse(sourceBindable); - } - } - - private void refreshSampleBrowser() => - sampleFileSelector.CurrentPath.Value = new DirectoryInfo(sampleFileSelector.CurrentPath.Value.FullName); - - private void loadSample() - { - switch (sampleLoadTarget.Value) - { - case SampleLoadTarget.Swoosh: - settings.SwooshSampleName.Value = selectedSampleName.Value; - break; - - case SampleLoadTarget.ScoreTick: - settings.TickSampleName.Value = selectedSampleName.Value; - break; - - case SampleLoadTarget.BadgeDink: - settings.BadgeSampleName.Value = selectedSampleName.Value; - break; - - case SampleLoadTarget.BadgeDinkMax: - settings.BadgeMaxSampleName.Value = selectedSampleName.Value; - break; - - case SampleLoadTarget.ImpactD: - settings.ImpactGradeDSampleName.Value = selectedSampleName.Value; - break; - - case SampleLoadTarget.ImpactC: - settings.ImpactGradeCSampleName.Value = selectedSampleName.Value; - break; - - case SampleLoadTarget.ImpactB: - settings.ImpactGradeBSampleName.Value = selectedSampleName.Value; - break; - - case SampleLoadTarget.ImpactA: - settings.ImpactGradeASampleName.Value = selectedSampleName.Value; - break; - - case SampleLoadTarget.ImpactS: - settings.ImpactGradeSSampleName.Value = selectedSampleName.Value; - break; - - case SampleLoadTarget.ImpactSS: - settings.ImpactGradeSSSampleName.Value = selectedSampleName.Value; - break; - - case SampleLoadTarget.ApplauseD: - settings.ApplauseGradeDSampleName.Value = selectedSampleName.Value; - break; - - case SampleLoadTarget.ApplauseC: - settings.ApplauseGradeCSampleName.Value = selectedSampleName.Value; - break; - - case SampleLoadTarget.ApplauseB: - settings.ApplauseGradeBSampleName.Value = selectedSampleName.Value; - break; - - case SampleLoadTarget.ApplauseA: - settings.ApplauseGradeASampleName.Value = selectedSampleName.Value; - break; - - case SampleLoadTarget.ApplauseS: - settings.ApplauseGradeSSampleName.Value = selectedSampleName.Value; - break; - - case SampleLoadTarget.ApplauseSS: - settings.ApplauseGradeSSSampleName.Value = selectedSampleName.Value; - break; - } - } - - private ScoreInfo createScore(double accuracy = 0.95, ScoreRank rank = ScoreRank.S) => new ScoreInfo - { - User = new User - { - Id = 2, - Username = "peppy", - }, - Beatmap = new TestBeatmap(new OsuRuleset().RulesetInfo).BeatmapInfo, - Mods = new Mod[] { new OsuModHardRock(), new OsuModDoubleTime() }, - TotalScore = 2845370, - Accuracy = accuracy, - MaxCombo = 999, - Rank = rank, - Date = DateTimeOffset.Now, - Statistics = - { - { HitResult.Miss, 1 }, - { HitResult.Meh, 50 }, - { HitResult.Good, 100 }, - { HitResult.Great, 300 }, - } - }; - } - - [Serializable] - public class AccuracyCircleAudioSettings - { - [SettingSource("setting")] - public Bindable PlayTicks { get; } = new Bindable(true); - - [SettingSource("setting")] - public Bindable TickSampleName { get; } = new Bindable("score-tick"); - - [SettingSource("setting")] - public Bindable PlayBadgeSounds { get; } = new Bindable(true); - - [SettingSource("setting")] - public Bindable BadgeSampleName { get; } = new Bindable("badge-dink"); - - [SettingSource("setting")] - public Bindable BadgeMaxSampleName { get; } = new Bindable("badge-dink-max"); - - [SettingSource("setting")] - public Bindable PlaySwooshSound { get; } = new Bindable(true); - - [SettingSource("setting")] - public Bindable SwooshSampleName { get; } = new Bindable("swoosh-up"); - - [SettingSource("setting")] - public Bindable PlayImpact { get; } = new Bindable(true); - - [SettingSource("setting")] - public Bindable ImpactGradeDSampleName { get; } = new Bindable("rank-impact-fail-d"); - - [SettingSource("setting")] - public Bindable ImpactGradeCSampleName { get; } = new Bindable("rank-impact-fail"); - - [SettingSource("setting")] - public Bindable ImpactGradeBSampleName { get; } = new Bindable("rank-impact-fail"); - - [SettingSource("setting")] - public Bindable ImpactGradeASampleName { get; } = new Bindable("rank-impact-pass"); - - [SettingSource("setting")] - public Bindable ImpactGradeSSampleName { get; } = new Bindable("rank-impact-pass"); - - [SettingSource("setting")] - public Bindable ImpactGradeSSSampleName { get; } = new Bindable("rank-impact-pass-ss"); - - [SettingSource("setting")] - public Bindable PlayApplause { get; } = new Bindable(true); - - [SettingSource("setting")] - public BindableDouble ApplauseVolume { get; } = new BindableDouble(0.8) - { - MinValue = 0, - MaxValue = 1, - Precision = 0.1 - }; - - [SettingSource("setting")] - public BindableDouble ApplauseDelay { get; } = new BindableDouble(545) - { - MinValue = 0, - MaxValue = 10000, - Precision = 1 - }; - - [SettingSource("setting")] - public Bindable ApplauseGradeDSampleName { get; } = new Bindable("applause-d"); - - [SettingSource("setting")] - public Bindable ApplauseGradeCSampleName { get; } = new Bindable("applause-c"); - - [SettingSource("setting")] - public Bindable ApplauseGradeBSampleName { get; } = new Bindable("applause-b"); - - [SettingSource("setting")] - public Bindable ApplauseGradeASampleName { get; } = new Bindable("applause-a"); - - [SettingSource("setting")] - public Bindable ApplauseGradeSSampleName { get; } = new Bindable("applause-s"); - - [SettingSource("setting")] - public Bindable ApplauseGradeSSSampleName { get; } = new Bindable("applause-s"); - - [SettingSource("setting")] - public BindableDouble TickPitchFactor { get; } = new BindableDouble(1) - { - MinValue = 0, - MaxValue = 3, - Precision = 0.1 - }; - - [SettingSource("setting")] - public BindableDouble TickDebounceStart { get; } = new BindableDouble(18) - { - MinValue = 1, - MaxValue = 100 - }; - - [SettingSource("setting")] - public BindableDouble TickDebounceEnd { get; } = new BindableDouble(300) - { - MinValue = 100, - MaxValue = 1000 - }; - - [SettingSource("setting")] - public BindableDouble SwooshPreDelay { get; } = new BindableDouble(443) - { - MinValue = -1000, - MaxValue = 1000 - }; - - [SettingSource("setting")] - public Bindable TickRateEasing { get; } = new Bindable(Easing.OutSine); - - [SettingSource("setting")] - public Bindable TickPitchEasing { get; } = new Bindable(Easing.OutSine); - - [SettingSource("setting")] - public Bindable TickVolumeEasing { get; } = new Bindable(Easing.OutSine); - - [SettingSource("setting")] - public BindableDouble TickVolumeStart { get; } = new BindableDouble(0.6) - { - MinValue = 0, - MaxValue = 1, - Precision = 0.1 - }; - - [SettingSource("setting")] - public BindableDouble TickVolumeEnd { get; } = new BindableDouble(1.0) - { - MinValue = 0, - MaxValue = 1, - Precision = 0.1 - }; - - [SettingSource("setting")] - public BindableDouble ImpactVolume { get; } = new BindableDouble(1.0) - { - MinValue = 0, - MaxValue = 1, - Precision = 0.1 - }; - - [SettingSource("setting")] - public BindableDouble BadgeDinkVolume { get; } = new BindableDouble(1) - { - MinValue = 0, - MaxValue = 1, - Precision = 0.1 - }; - - [SettingSource("setting")] - public BindableDouble SwooshVolume { get; } = new BindableDouble(0.4) - { - MinValue = 0, - MaxValue = 1, - Precision = 0.1 - }; - } -} From 5fa93661522841c3188a17724518616beed31335 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Fri, 4 Jun 2021 16:22:16 +0900 Subject: [PATCH 09/23] Update resources --- osu.Android.props | 2 +- osu.Game/osu.Game.csproj | 2 +- osu.iOS.props | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/osu.Android.props b/osu.Android.props index 3d51357d8b..17b07b4695 100644 --- a/osu.Android.props +++ b/osu.Android.props @@ -51,7 +51,7 @@ - + diff --git a/osu.Game/osu.Game.csproj b/osu.Game/osu.Game.csproj index d299ba4fda..7e0fc38f58 100644 --- a/osu.Game/osu.Game.csproj +++ b/osu.Game/osu.Game.csproj @@ -35,7 +35,7 @@ runtime; build; native; contentfiles; analyzers; buildtransitive - + diff --git a/osu.iOS.props b/osu.iOS.props index 9e178b267a..41fadb245e 100644 --- a/osu.iOS.props +++ b/osu.iOS.props @@ -71,7 +71,7 @@ - + From 50819ef91fb84d441d790f27ba3843b66734d73b Mon Sep 17 00:00:00 2001 From: Jamie Taylor Date: Fri, 4 Jun 2021 16:41:52 +0900 Subject: [PATCH 10/23] use a dictionary for sample lookups instead --- osu.Game/Skinning/DefaultSkin.cs | 73 ++++++++++---------------------- osu.Game/Skinning/LegacySkin.cs | 2 +- 2 files changed, 24 insertions(+), 51 deletions(-) diff --git a/osu.Game/Skinning/DefaultSkin.cs b/osu.Game/Skinning/DefaultSkin.cs index a745a65103..9aecccee14 100644 --- a/osu.Game/Skinning/DefaultSkin.cs +++ b/osu.Game/Skinning/DefaultSkin.cs @@ -25,6 +25,27 @@ namespace osu.Game.Skinning { private readonly IStorageResourceProvider resources; + private static readonly IReadOnlyDictionary sample_mapping + = new Dictionary + { + { GameplaySkinSamples.ResultScoreTick, @"Results/score-tick" }, + { GameplaySkinSamples.ResultBadgeTick, @"Results/badge-dink" }, + { GameplaySkinSamples.ResultBadgeTickMax, @"Results/badge-dink-max" }, + { GameplaySkinSamples.ResultSwooshUp, @"Results/swoosh-up" }, + { GameplaySkinSamples.ResultRank_D, @"Results/rank-impact-fail-d" }, + { GameplaySkinSamples.ResultRank_B, @"Results/rank-impact-fail" }, + { GameplaySkinSamples.ResultRank_C, @"Results/rank-impact-fail" }, + { GameplaySkinSamples.ResultRank_A, @"Results/rank-impact-pass" }, + { GameplaySkinSamples.ResultRank_S, @"Results/rank-impact-pass" }, + { GameplaySkinSamples.ResultRank_SS, @"Results/rank-impact-pass-ss" }, + { GameplaySkinSamples.ResultApplause_D, @"Results/applause-d" }, + { GameplaySkinSamples.ResultApplause_B, @"Results/applause-b" }, + { GameplaySkinSamples.ResultApplause_C, @"Results/applause-c" }, + { GameplaySkinSamples.ResultApplause_A, @"Results/applause-a" }, + { GameplaySkinSamples.ResultApplause_S, @"Results/applause-s" }, + { GameplaySkinSamples.ResultApplause_SS, @"Results/applause-s" } + }; + public DefaultSkin(IStorageResourceProvider resources) : this(SkinInfo.Default, resources) { @@ -60,56 +81,8 @@ namespace osu.Game.Skinning switch (component) { case GameplaySkinComponent sample: - switch (sample.Component) - { - case GameplaySkinSamples.ResultScoreTick: - return new DrawableSample(GetSample(new SampleInfo("Results/score-tick"))); - - case GameplaySkinSamples.ResultBadgeTick: - return new DrawableSample(GetSample(new SampleInfo("Results/badge-dink"))); - - case GameplaySkinSamples.ResultBadgeTickMax: - return new DrawableSample(GetSample(new SampleInfo("Results/badge-dink-max"))); - - case GameplaySkinSamples.ResultSwooshUp: - return new DrawableSample(GetSample(new SampleInfo("Results/swoosh-up"))); - - case GameplaySkinSamples.ResultRank_D: - return new DrawableSample(GetSample(new SampleInfo("Results/rank-impact-fail-d"))); - - case GameplaySkinSamples.ResultRank_B: - return new DrawableSample(GetSample(new SampleInfo("Results/rank-impact-fail"))); - - case GameplaySkinSamples.ResultRank_C: - return new DrawableSample(GetSample(new SampleInfo("Results/rank-impact-fail"))); - - case GameplaySkinSamples.ResultRank_A: - return new DrawableSample(GetSample(new SampleInfo("Results/rank-impact-pass"))); - - case GameplaySkinSamples.ResultRank_S: - return new DrawableSample(GetSample(new SampleInfo("Results/rank-impact-pass"))); - - case GameplaySkinSamples.ResultRank_SS: - return new DrawableSample(GetSample(new SampleInfo("Results/rank-impact-pass-ss"))); - - case GameplaySkinSamples.ResultApplause_D: - return new DrawableSample(GetSample(new SampleInfo("Results/applause-d"))); - - case GameplaySkinSamples.ResultApplause_B: - return new DrawableSample(GetSample(new SampleInfo("Results/applause-b"))); - - case GameplaySkinSamples.ResultApplause_C: - return new DrawableSample(GetSample(new SampleInfo("Results/applause-c"))); - - case GameplaySkinSamples.ResultApplause_A: - return new DrawableSample(GetSample(new SampleInfo("Results/applause-a"))); - - case GameplaySkinSamples.ResultApplause_S: - return new DrawableSample(GetSample(new SampleInfo("Results/applause-s"))); - - case GameplaySkinSamples.ResultApplause_SS: - return new DrawableSample(GetSample(new SampleInfo("Results/applause-s"))); - } + if (sample_mapping.ContainsKey(sample.Component)) + return new DrawableSample(GetSample(new SampleInfo(sample_mapping[sample.Component]))); break; diff --git a/osu.Game/Skinning/LegacySkin.cs b/osu.Game/Skinning/LegacySkin.cs index a484516217..9fcfd646d5 100644 --- a/osu.Game/Skinning/LegacySkin.cs +++ b/osu.Game/Skinning/LegacySkin.cs @@ -425,7 +425,7 @@ namespace osu.Game.Skinning case GameplaySkinSamples.ResultApplause_SS: if (applause != null) // Legacy skins don't have sounds for the result screen, but may instead have an 'applause' sound. - // This lets a legacy skin's applause sound play instead of result screen sounds (as to not play over each other) + // This lets a legacy skin's applause sound play instead of result screen sounds (as to not play over each other) return Drawable.Empty(); break; From 330bb7cb450f346b6cbb64a2a4f262c61624090d Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Wed, 9 Jun 2021 18:15:45 +0900 Subject: [PATCH 11/23] Remove unnecessary skin lookup logic --- .../Expanded/Accuracy/AccuracyCircle.cs | 123 ++++++++---------- osu.Game/Skinning/DefaultSkin.cs | 28 ---- osu.Game/Skinning/GameplaySkinSamples.cs | 29 ----- osu.Game/Skinning/LegacySkin.cs | 38 ------ 4 files changed, 54 insertions(+), 164 deletions(-) delete mode 100644 osu.Game/Skinning/GameplaySkinSamples.cs diff --git a/osu.Game/Screens/Ranking/Expanded/Accuracy/AccuracyCircle.cs b/osu.Game/Screens/Ranking/Expanded/Accuracy/AccuracyCircle.cs index af43477e84..2348a0891f 100644 --- a/osu.Game/Screens/Ranking/Expanded/Accuracy/AccuracyCircle.cs +++ b/osu.Game/Screens/Ranking/Expanded/Accuracy/AccuracyCircle.cs @@ -8,11 +8,11 @@ using osu.Framework.Audio; using osu.Framework.Bindables; using osu.Framework.Extensions.Color4Extensions; using osu.Framework.Graphics; -using osu.Framework.Graphics.Audio; using osu.Framework.Graphics.Colour; using osu.Framework.Graphics.Containers; using osu.Framework.Platform; using osu.Framework.Utils; +using osu.Game.Audio; using osu.Game.Graphics; using osu.Game.Rulesets.Mods; using osu.Game.Scoring; @@ -110,20 +110,18 @@ namespace osu.Game.Screens.Ranking.Expanded.Accuracy private Container badges; private RankText rankText; - private DrawableSample scoreTickSound; - private DrawableSample badgeTickSound; - private DrawableSample badgeMaxSound; - private DrawableSample swooshUpSound; - private DrawableSample rankImpactSound; - private DrawableSample rankApplauseSound; - private DrawableSample legacySkinApplauseSound; + private PoolableSkinnableSample scoreTickSound; + private PoolableSkinnableSample badgeTickSound; + private PoolableSkinnableSample badgeMaxSound; + private PoolableSkinnableSample swooshUpSound; + private PoolableSkinnableSample rankImpactSound; + private PoolableSkinnableSample rankApplauseSound; private Bindable tickPlaybackRate = new Bindable(); private double lastTickPlaybackTime; private bool isTicking; private readonly bool sfxEnabled; - private bool legacySkin => legacySkinApplauseSound != null; public AccuracyCircle(ScoreInfo score, bool sfxEnabled = false) { @@ -254,62 +252,52 @@ namespace osu.Game.Screens.Ranking.Expanded.Accuracy if (sfxEnabled) { - Drawable legacySkinApplause = skin.GetDrawableComponent(new GameplaySkinComponent(GameplaySkinSamples.Applause)); + tickPlaybackRate = new Bindable(sfx_score_tick_debounce_rate_start); - if (legacySkinApplause != null) + switch (score.Rank) { - AddInternal(legacySkinApplause); - legacySkinApplauseSound = legacySkinApplause as DrawableSample; + case ScoreRank.D: + rankImpactSound = new PoolableSkinnableSample(new SampleInfo(@"Results/rank-impact-fail-d")); + rankApplauseSound = new PoolableSkinnableSample(new SampleInfo(@"applause", @"Results/applause-d")); + break; + + case ScoreRank.C: + rankImpactSound = new PoolableSkinnableSample(new SampleInfo(@"Results/rank-impact-fail")); + rankApplauseSound = new PoolableSkinnableSample(new SampleInfo(@"applause", @"Results/applause-c")); + break; + + case ScoreRank.B: + rankImpactSound = new PoolableSkinnableSample(new SampleInfo(@"Results/rank-impact-fail")); + rankApplauseSound = new PoolableSkinnableSample(new SampleInfo(@"applause", @"Results/applause-b")); + break; + + case ScoreRank.A: + rankImpactSound = new PoolableSkinnableSample(new SampleInfo(@"Results/rank-impact-pass")); + rankApplauseSound = new PoolableSkinnableSample(new SampleInfo(@"applause", @"Results/applause-a")); + break; + + case ScoreRank.S: + case ScoreRank.SH: + rankImpactSound = new PoolableSkinnableSample(new SampleInfo(@"Results/rank-impact-pass")); + rankApplauseSound = new PoolableSkinnableSample(new SampleInfo(@"applause", @"Results/applause-s")); + break; + + case ScoreRank.X: + case ScoreRank.XH: + rankImpactSound = new PoolableSkinnableSample(new SampleInfo(@"Results/rank-impact-pass-ss")); + rankApplauseSound = new PoolableSkinnableSample(new SampleInfo(@"applause", @"Results/applause-s")); + break; } - else + + AddRangeInternal(new Drawable[] { - tickPlaybackRate = new Bindable(sfx_score_tick_debounce_rate_start); - - switch (score.Rank) - { - case ScoreRank.D: - rankImpactSound = skin.GetDrawableComponent(new GameplaySkinComponent(GameplaySkinSamples.ResultRank_D)) as DrawableSample; - rankApplauseSound = skin.GetDrawableComponent(new GameplaySkinComponent(GameplaySkinSamples.ResultApplause_D)) as DrawableSample; - break; - - case ScoreRank.C: - rankImpactSound = skin.GetDrawableComponent(new GameplaySkinComponent(GameplaySkinSamples.ResultRank_C)) as DrawableSample; - rankApplauseSound = skin.GetDrawableComponent(new GameplaySkinComponent(GameplaySkinSamples.ResultApplause_C)) as DrawableSample; - break; - - case ScoreRank.B: - rankImpactSound = skin.GetDrawableComponent(new GameplaySkinComponent(GameplaySkinSamples.ResultRank_B)) as DrawableSample; - rankApplauseSound = skin.GetDrawableComponent(new GameplaySkinComponent(GameplaySkinSamples.ResultApplause_B)) as DrawableSample; - break; - - case ScoreRank.A: - rankImpactSound = skin.GetDrawableComponent(new GameplaySkinComponent(GameplaySkinSamples.ResultRank_A)) as DrawableSample; - rankApplauseSound = skin.GetDrawableComponent(new GameplaySkinComponent(GameplaySkinSamples.ResultApplause_A)) as DrawableSample; - break; - - case ScoreRank.S: - case ScoreRank.SH: - rankImpactSound = skin.GetDrawableComponent(new GameplaySkinComponent(GameplaySkinSamples.ResultRank_S)) as DrawableSample; - rankApplauseSound = skin.GetDrawableComponent(new GameplaySkinComponent(GameplaySkinSamples.ResultApplause_S)) as DrawableSample; - break; - - case ScoreRank.X: - case ScoreRank.XH: - rankImpactSound = skin.GetDrawableComponent(new GameplaySkinComponent(GameplaySkinSamples.ResultRank_SS)) as DrawableSample; - rankApplauseSound = skin.GetDrawableComponent(new GameplaySkinComponent(GameplaySkinSamples.ResultApplause_SS)) as DrawableSample; - break; - } - - AddRangeInternal(new Drawable[] - { - rankImpactSound, - rankApplauseSound, - scoreTickSound = skin.GetDrawableComponent(new GameplaySkinComponent(GameplaySkinSamples.ResultScoreTick)) as DrawableSample, - badgeTickSound = skin.GetDrawableComponent(new GameplaySkinComponent(GameplaySkinSamples.ResultBadgeTick)) as DrawableSample, - badgeMaxSound = skin.GetDrawableComponent(new GameplaySkinComponent(GameplaySkinSamples.ResultBadgeTickMax)) as DrawableSample, - swooshUpSound = skin.GetDrawableComponent(new GameplaySkinComponent(GameplaySkinSamples.ResultSwooshUp)) as DrawableSample - }); - } + rankImpactSound, + rankApplauseSound, + scoreTickSound = new PoolableSkinnableSample(new SampleInfo(@"Results/score-tick")), + badgeTickSound = new PoolableSkinnableSample(new SampleInfo(@"Results/badge-dink")), + badgeMaxSound = new PoolableSkinnableSample(new SampleInfo(@"Results/badge-dink-max")), + swooshUpSound = new PoolableSkinnableSample(new SampleInfo(@"Results/swoosh-up")), + }); } } @@ -341,7 +329,7 @@ namespace osu.Game.Screens.Ranking.Expanded.Accuracy this.ScaleTo(0).Then().ScaleTo(1, APPEAR_DURATION, Easing.OutQuint); - if (sfxEnabled && !legacySkin) + if (sfxEnabled) { this.Delay(sfx_swoosh_pre_delay).Schedule(() => { @@ -359,7 +347,7 @@ namespace osu.Game.Screens.Ranking.Expanded.Accuracy accuracyCircle.FillTo(targetAccuracy, ACCURACY_TRANSFORM_DURATION, ACCURACY_TRANSFORM_EASING); - if (sfxEnabled && !legacySkin) + if (sfxEnabled) { Schedule(() => { @@ -382,11 +370,12 @@ namespace osu.Game.Screens.Ranking.Expanded.Accuracy { badge.Appear(); - if (sfxEnabled && !legacySkin) + if (sfxEnabled) { Schedule(() => { - DrawableSample dink = badgeNum < badges.Count - 1 ? badgeTickSound : badgeMaxSound; + var dink = badgeNum < badges.Count - 1 ? badgeTickSound : badgeMaxSound; + dink.FrequencyTo(1 + badgeNum++ * 0.05); dink.VolumeTo(sfx_badge_dink_volume); dink.Play(); @@ -401,10 +390,6 @@ namespace osu.Game.Screens.Ranking.Expanded.Accuracy if (!sfxEnabled) return; - legacySkinApplauseSound?.Play(); - - if (legacySkin) return; - Schedule(() => { isTicking = false; diff --git a/osu.Game/Skinning/DefaultSkin.cs b/osu.Game/Skinning/DefaultSkin.cs index 46a8fef8d2..893819b2c2 100644 --- a/osu.Game/Skinning/DefaultSkin.cs +++ b/osu.Game/Skinning/DefaultSkin.cs @@ -7,7 +7,6 @@ using JetBrains.Annotations; using osu.Framework.Audio.Sample; using osu.Framework.Bindables; using osu.Framework.Graphics; -using osu.Framework.Graphics.Audio; using osu.Framework.Graphics.OpenGL.Textures; using osu.Framework.Graphics.Textures; using osu.Game.Audio; @@ -25,27 +24,6 @@ namespace osu.Game.Skinning { private readonly IStorageResourceProvider resources; - private static readonly IReadOnlyDictionary sample_mapping - = new Dictionary - { - { GameplaySkinSamples.ResultScoreTick, @"Results/score-tick" }, - { GameplaySkinSamples.ResultBadgeTick, @"Results/badge-dink" }, - { GameplaySkinSamples.ResultBadgeTickMax, @"Results/badge-dink-max" }, - { GameplaySkinSamples.ResultSwooshUp, @"Results/swoosh-up" }, - { GameplaySkinSamples.ResultRank_D, @"Results/rank-impact-fail-d" }, - { GameplaySkinSamples.ResultRank_B, @"Results/rank-impact-fail" }, - { GameplaySkinSamples.ResultRank_C, @"Results/rank-impact-fail" }, - { GameplaySkinSamples.ResultRank_A, @"Results/rank-impact-pass" }, - { GameplaySkinSamples.ResultRank_S, @"Results/rank-impact-pass" }, - { GameplaySkinSamples.ResultRank_SS, @"Results/rank-impact-pass-ss" }, - { GameplaySkinSamples.ResultApplause_D, @"Results/applause-d" }, - { GameplaySkinSamples.ResultApplause_B, @"Results/applause-b" }, - { GameplaySkinSamples.ResultApplause_C, @"Results/applause-c" }, - { GameplaySkinSamples.ResultApplause_A, @"Results/applause-a" }, - { GameplaySkinSamples.ResultApplause_S, @"Results/applause-s" }, - { GameplaySkinSamples.ResultApplause_SS, @"Results/applause-s" } - }; - public DefaultSkin(IStorageResourceProvider resources) : this(SkinInfo.Default, resources) { @@ -80,12 +58,6 @@ namespace osu.Game.Skinning switch (component) { - case GameplaySkinComponent sample: - if (sample_mapping.ContainsKey(sample.Component)) - return new DrawableSample(GetSample(new SampleInfo(sample_mapping[sample.Component]))); - - break; - case SkinnableTargetComponent target: switch (target.Target) { diff --git a/osu.Game/Skinning/GameplaySkinSamples.cs b/osu.Game/Skinning/GameplaySkinSamples.cs deleted file mode 100644 index 895e95e0a9..0000000000 --- a/osu.Game/Skinning/GameplaySkinSamples.cs +++ /dev/null @@ -1,29 +0,0 @@ -// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. -// See the LICENCE file in the repository root for full licence text. - -namespace osu.Game.Skinning -{ - public enum GameplaySkinSamples - { - // legacy - Applause, - - // results screen - ResultScoreTick, - ResultBadgeTick, - ResultBadgeTickMax, - ResultSwooshUp, - ResultRank_D, - ResultRank_B, - ResultRank_C, - ResultRank_A, - ResultRank_S, - ResultRank_SS, - ResultApplause_D, - ResultApplause_B, - ResultApplause_C, - ResultApplause_A, - ResultApplause_S, - ResultApplause_SS - } -} diff --git a/osu.Game/Skinning/LegacySkin.cs b/osu.Game/Skinning/LegacySkin.cs index 38ae65d133..e255fbae81 100644 --- a/osu.Game/Skinning/LegacySkin.cs +++ b/osu.Game/Skinning/LegacySkin.cs @@ -10,7 +10,6 @@ using JetBrains.Annotations; using osu.Framework.Audio.Sample; using osu.Framework.Bindables; using osu.Framework.Graphics; -using osu.Framework.Graphics.Audio; using osu.Framework.Graphics.OpenGL.Textures; using osu.Framework.Graphics.Textures; using osu.Framework.IO.Stores; @@ -397,43 +396,6 @@ namespace osu.Game.Skinning return null; - case GameplaySkinComponent sampleComponent: - var applause = GetSample(new SampleInfo("applause")); - - switch (sampleComponent.Component) - { - case GameplaySkinSamples.Applause: - if (applause != null) - return new DrawableSample(applause); - - break; - - case GameplaySkinSamples.ResultScoreTick: - case GameplaySkinSamples.ResultBadgeTick: - case GameplaySkinSamples.ResultBadgeTickMax: - case GameplaySkinSamples.ResultSwooshUp: - case GameplaySkinSamples.ResultRank_D: - case GameplaySkinSamples.ResultRank_B: - case GameplaySkinSamples.ResultRank_C: - case GameplaySkinSamples.ResultRank_A: - case GameplaySkinSamples.ResultRank_S: - case GameplaySkinSamples.ResultRank_SS: - case GameplaySkinSamples.ResultApplause_D: - case GameplaySkinSamples.ResultApplause_B: - case GameplaySkinSamples.ResultApplause_C: - case GameplaySkinSamples.ResultApplause_A: - case GameplaySkinSamples.ResultApplause_S: - case GameplaySkinSamples.ResultApplause_SS: - if (applause != null) - // Legacy skins don't have sounds for the result screen, but may instead have an 'applause' sound. - // This lets a legacy skin's applause sound play instead of result screen sounds (as to not play over each other) - return Drawable.Empty(); - - break; - } - - break; - case GameplaySkinComponent resultComponent: // TODO: this should be inside the judgement pieces. Func createDrawable = () => getJudgementAnimation(resultComponent.Component); From 21a63efd7808a4c91647cc98846835f464890993 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Wed, 9 Jun 2021 18:46:38 +0900 Subject: [PATCH 12/23] Rename variable back to `withFlair` to match parent class --- .../Ranking/Expanded/Accuracy/AccuracyCircle.cs | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/osu.Game/Screens/Ranking/Expanded/Accuracy/AccuracyCircle.cs b/osu.Game/Screens/Ranking/Expanded/Accuracy/AccuracyCircle.cs index 2348a0891f..6ef509f40a 100644 --- a/osu.Game/Screens/Ranking/Expanded/Accuracy/AccuracyCircle.cs +++ b/osu.Game/Screens/Ranking/Expanded/Accuracy/AccuracyCircle.cs @@ -121,12 +121,12 @@ namespace osu.Game.Screens.Ranking.Expanded.Accuracy private double lastTickPlaybackTime; private bool isTicking; - private readonly bool sfxEnabled; + private readonly bool withFlair; - public AccuracyCircle(ScoreInfo score, bool sfxEnabled = false) + public AccuracyCircle(ScoreInfo score, bool withFlair = false) { this.score = score; - this.sfxEnabled = sfxEnabled; + this.withFlair = withFlair; } [BackgroundDependencyLoader] @@ -250,7 +250,7 @@ namespace osu.Game.Screens.Ranking.Expanded.Accuracy rankText = new RankText(score.Rank) }; - if (sfxEnabled) + if (withFlair) { tickPlaybackRate = new Bindable(sfx_score_tick_debounce_rate_start); @@ -329,7 +329,7 @@ namespace osu.Game.Screens.Ranking.Expanded.Accuracy this.ScaleTo(0).Then().ScaleTo(1, APPEAR_DURATION, Easing.OutQuint); - if (sfxEnabled) + if (withFlair) { this.Delay(sfx_swoosh_pre_delay).Schedule(() => { @@ -347,7 +347,7 @@ namespace osu.Game.Screens.Ranking.Expanded.Accuracy accuracyCircle.FillTo(targetAccuracy, ACCURACY_TRANSFORM_DURATION, ACCURACY_TRANSFORM_EASING); - if (sfxEnabled) + if (withFlair) { Schedule(() => { @@ -370,7 +370,7 @@ namespace osu.Game.Screens.Ranking.Expanded.Accuracy { badge.Appear(); - if (sfxEnabled) + if (withFlair) { Schedule(() => { @@ -388,7 +388,7 @@ namespace osu.Game.Screens.Ranking.Expanded.Accuracy { rankText.Appear(); - if (!sfxEnabled) return; + if (!withFlair) return; Schedule(() => { From 489a5a3c1d58c96985b4ef2c16ac261f90e19254 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Wed, 9 Jun 2021 19:01:05 +0900 Subject: [PATCH 13/23] Add back missing space in csproj --- osu.Game/osu.Game.csproj | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu.Game/osu.Game.csproj b/osu.Game/osu.Game.csproj index ae3644d5cb..c80c58b87c 100644 --- a/osu.Game/osu.Game.csproj +++ b/osu.Game/osu.Game.csproj @@ -35,7 +35,7 @@ runtime; build; native; contentfiles; analyzers; buildtransitive - + From 499aba95c09ade2ec85d8ed0a1a0bda41c1c0dee Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Wed, 9 Jun 2021 19:06:37 +0900 Subject: [PATCH 14/23] Simplify sample construction logic and move private functions down --- .../Expanded/Accuracy/AccuracyCircle.cs | 105 +++++++++++------- 1 file changed, 64 insertions(+), 41 deletions(-) diff --git a/osu.Game/Screens/Ranking/Expanded/Accuracy/AccuracyCircle.cs b/osu.Game/Screens/Ranking/Expanded/Accuracy/AccuracyCircle.cs index 6ef509f40a..b8afdb98b2 100644 --- a/osu.Game/Screens/Ranking/Expanded/Accuracy/AccuracyCircle.cs +++ b/osu.Game/Screens/Ranking/Expanded/Accuracy/AccuracyCircle.cs @@ -254,45 +254,10 @@ namespace osu.Game.Screens.Ranking.Expanded.Accuracy { tickPlaybackRate = new Bindable(sfx_score_tick_debounce_rate_start); - switch (score.Rank) - { - case ScoreRank.D: - rankImpactSound = new PoolableSkinnableSample(new SampleInfo(@"Results/rank-impact-fail-d")); - rankApplauseSound = new PoolableSkinnableSample(new SampleInfo(@"applause", @"Results/applause-d")); - break; - - case ScoreRank.C: - rankImpactSound = new PoolableSkinnableSample(new SampleInfo(@"Results/rank-impact-fail")); - rankApplauseSound = new PoolableSkinnableSample(new SampleInfo(@"applause", @"Results/applause-c")); - break; - - case ScoreRank.B: - rankImpactSound = new PoolableSkinnableSample(new SampleInfo(@"Results/rank-impact-fail")); - rankApplauseSound = new PoolableSkinnableSample(new SampleInfo(@"applause", @"Results/applause-b")); - break; - - case ScoreRank.A: - rankImpactSound = new PoolableSkinnableSample(new SampleInfo(@"Results/rank-impact-pass")); - rankApplauseSound = new PoolableSkinnableSample(new SampleInfo(@"applause", @"Results/applause-a")); - break; - - case ScoreRank.S: - case ScoreRank.SH: - rankImpactSound = new PoolableSkinnableSample(new SampleInfo(@"Results/rank-impact-pass")); - rankApplauseSound = new PoolableSkinnableSample(new SampleInfo(@"applause", @"Results/applause-s")); - break; - - case ScoreRank.X: - case ScoreRank.XH: - rankImpactSound = new PoolableSkinnableSample(new SampleInfo(@"Results/rank-impact-pass-ss")); - rankApplauseSound = new PoolableSkinnableSample(new SampleInfo(@"applause", @"Results/applause-s")); - break; - } - AddRangeInternal(new Drawable[] { - rankImpactSound, - rankApplauseSound, + rankImpactSound = new PoolableSkinnableSample(new SampleInfo(impactSampleName)), + rankApplauseSound = new PoolableSkinnableSample(new SampleInfo(@"applause", applauseSampleName)), scoreTickSound = new PoolableSkinnableSample(new SampleInfo(@"Results/score-tick")), badgeTickSound = new PoolableSkinnableSample(new SampleInfo(@"Results/badge-dink")), badgeMaxSound = new PoolableSkinnableSample(new SampleInfo(@"Results/badge-dink-max")), @@ -301,12 +266,32 @@ namespace osu.Game.Screens.Ranking.Expanded.Accuracy } } - private ScoreRank getRank(ScoreRank rank) + private string applauseSampleName { - foreach (var mod in score.Mods.OfType()) - rank = mod.AdjustRank(rank, score.Accuracy); + get + { + switch (score.Rank) + { + default: + case ScoreRank.D: + return @"Results/rank-applause-d"; - return rank; + case ScoreRank.C: + return @"Results/rank-applause-c"; + + case ScoreRank.B: + return @"Results/rank-applause-b"; + + case ScoreRank.A: + return @"Results/rank-applause-a"; + + case ScoreRank.S: + case ScoreRank.SH: + case ScoreRank.X: + case ScoreRank.XH: + return @"Results/rank-applause-s"; + } + } } protected override void Update() @@ -409,6 +394,44 @@ namespace osu.Game.Screens.Ranking.Expanded.Accuracy } } + private string impactSampleName + { + get + { + switch (score.Rank) + { + default: + case ScoreRank.D: + return @"Results/rank-impact-fail-d"; + + case ScoreRank.C: + return @"Results/rank-impact-fail"; + + case ScoreRank.B: + return @"Results/rank-impact-fail"; + + case ScoreRank.A: + return @"Results/rank-impact-pass"; + + case ScoreRank.S: + case ScoreRank.SH: + return @"Results/rank-impact-pass"; + + case ScoreRank.X: + case ScoreRank.XH: + return @"Results/rank-impact-pass-ss"; + } + } + } + + private ScoreRank getRank(ScoreRank rank) + { + foreach (var mod in score.Mods.OfType()) + rank = mod.AdjustRank(rank, score.Accuracy); + + return rank; + } + private double inverseEasing(Easing easing, double targetValue) { double test = 0; From 81cecac90b05244025eee59e0be4f019bedd9a60 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Wed, 9 Jun 2021 19:09:00 +0900 Subject: [PATCH 15/23] Move tick rate initialisation to earlier --- osu.Game/Screens/Ranking/Expanded/Accuracy/AccuracyCircle.cs | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/osu.Game/Screens/Ranking/Expanded/Accuracy/AccuracyCircle.cs b/osu.Game/Screens/Ranking/Expanded/Accuracy/AccuracyCircle.cs index b8afdb98b2..f62f8bfb72 100644 --- a/osu.Game/Screens/Ranking/Expanded/Accuracy/AccuracyCircle.cs +++ b/osu.Game/Screens/Ranking/Expanded/Accuracy/AccuracyCircle.cs @@ -117,7 +117,8 @@ namespace osu.Game.Screens.Ranking.Expanded.Accuracy private PoolableSkinnableSample rankImpactSound; private PoolableSkinnableSample rankApplauseSound; - private Bindable tickPlaybackRate = new Bindable(); + private readonly Bindable tickPlaybackRate = new Bindable(sfx_score_tick_debounce_rate_start); + private double lastTickPlaybackTime; private bool isTicking; @@ -252,8 +253,6 @@ namespace osu.Game.Screens.Ranking.Expanded.Accuracy if (withFlair) { - tickPlaybackRate = new Bindable(sfx_score_tick_debounce_rate_start); - AddRangeInternal(new Drawable[] { rankImpactSound = new PoolableSkinnableSample(new SampleInfo(impactSampleName)), From cb4f366651d5e1c0457296f675bfe2ed29c05f0c Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Wed, 9 Jun 2021 19:15:55 +0900 Subject: [PATCH 16/23] Move forgotten private function down more --- .../Expanded/Accuracy/AccuracyCircle.cs | 56 +++++++++---------- 1 file changed, 28 insertions(+), 28 deletions(-) diff --git a/osu.Game/Screens/Ranking/Expanded/Accuracy/AccuracyCircle.cs b/osu.Game/Screens/Ranking/Expanded/Accuracy/AccuracyCircle.cs index f62f8bfb72..eff0fa442d 100644 --- a/osu.Game/Screens/Ranking/Expanded/Accuracy/AccuracyCircle.cs +++ b/osu.Game/Screens/Ranking/Expanded/Accuracy/AccuracyCircle.cs @@ -265,34 +265,6 @@ namespace osu.Game.Screens.Ranking.Expanded.Accuracy } } - private string applauseSampleName - { - get - { - switch (score.Rank) - { - default: - case ScoreRank.D: - return @"Results/rank-applause-d"; - - case ScoreRank.C: - return @"Results/rank-applause-c"; - - case ScoreRank.B: - return @"Results/rank-applause-b"; - - case ScoreRank.A: - return @"Results/rank-applause-a"; - - case ScoreRank.S: - case ScoreRank.SH: - case ScoreRank.X: - case ScoreRank.XH: - return @"Results/rank-applause-s"; - } - } - } - protected override void Update() { base.Update(); @@ -393,6 +365,34 @@ namespace osu.Game.Screens.Ranking.Expanded.Accuracy } } + private string applauseSampleName + { + get + { + switch (score.Rank) + { + default: + case ScoreRank.D: + return @"Results/rank-applause-d"; + + case ScoreRank.C: + return @"Results/rank-applause-c"; + + case ScoreRank.B: + return @"Results/rank-applause-b"; + + case ScoreRank.A: + return @"Results/rank-applause-a"; + + case ScoreRank.S: + case ScoreRank.SH: + case ScoreRank.X: + case ScoreRank.XH: + return @"Results/rank-applause-s"; + } + } + } + private string impactSampleName { get From 57bc34f224a11b56b7105d8791b379da47481c61 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Wed, 9 Jun 2021 19:24:30 +0900 Subject: [PATCH 17/23] Move `const`s closer to usage --- .../Expanded/Accuracy/AccuracyCircle.cs | 58 +++++++------------ 1 file changed, 21 insertions(+), 37 deletions(-) diff --git a/osu.Game/Screens/Ranking/Expanded/Accuracy/AccuracyCircle.cs b/osu.Game/Screens/Ranking/Expanded/Accuracy/AccuracyCircle.cs index eff0fa442d..de488f2eb9 100644 --- a/osu.Game/Screens/Ranking/Expanded/Accuracy/AccuracyCircle.cs +++ b/osu.Game/Screens/Ranking/Expanded/Accuracy/AccuracyCircle.cs @@ -76,33 +76,6 @@ namespace osu.Game.Screens.Ranking.Expanded.Accuracy /// public static readonly Easing ACCURACY_TRANSFORM_EASING = Easing.OutPow10; - #region Sound Effect Playback Parameters - - // swoosh-up - private const double sfx_swoosh_pre_delay = 443f; - private const double sfx_swoosh_volume = 0.4f; - - // score ticks - private const double sfx_score_tick_debounce_rate_start = 18f; - private const double sfx_score_tick_debounce_rate_end = 300f; - private const Easing sfx_score_tick_debounce_rate_easing = Easing.OutSine; - private const double sfx_score_tick_volume_start = 0.6f; - private const double sfx_score_tick_volume_end = 1.0f; - private const Easing sfx_score_tick_volume_easing = Easing.OutSine; - private const Easing sfx_score_tick_pitch_easing = Easing.OutSine; - - // badge dinks - private const double sfx_badge_dink_volume = 1f; - - // impact - private const double sfx_rank_impact_volume = 1.0f; - - // applause - private const double sfx_applause_pre_delay = 545f; - private const double sfx_applause_volume = 0.8f; - - #endregion - private readonly ScoreInfo score; private SmoothCircularProgress accuracyCircle; @@ -117,7 +90,7 @@ namespace osu.Game.Screens.Ranking.Expanded.Accuracy private PoolableSkinnableSample rankImpactSound; private PoolableSkinnableSample rankApplauseSound; - private readonly Bindable tickPlaybackRate = new Bindable(sfx_score_tick_debounce_rate_start); + private readonly Bindable tickPlaybackRate = new Bindable(); private double lastTickPlaybackTime; private bool isTicking; @@ -287,9 +260,12 @@ namespace osu.Game.Screens.Ranking.Expanded.Accuracy if (withFlair) { - this.Delay(sfx_swoosh_pre_delay).Schedule(() => + const double swoosh_pre_delay = 443f; + const double swoosh_volume = 0.4f; + + this.Delay(swoosh_pre_delay).Schedule(() => { - swooshUpSound.VolumeTo(sfx_swoosh_volume); + swooshUpSound.VolumeTo(swoosh_volume); swooshUpSound.Play(); }); } @@ -307,9 +283,16 @@ namespace osu.Game.Screens.Ranking.Expanded.Accuracy { Schedule(() => { - scoreTickSound.FrequencyTo(1 + targetAccuracy, ACCURACY_TRANSFORM_DURATION, sfx_score_tick_pitch_easing); - scoreTickSound.VolumeTo(sfx_score_tick_volume_start).Then().VolumeTo(sfx_score_tick_volume_end, ACCURACY_TRANSFORM_DURATION, sfx_score_tick_volume_easing); - this.TransformBindableTo(tickPlaybackRate, sfx_score_tick_debounce_rate_end, ACCURACY_TRANSFORM_DURATION, sfx_score_tick_debounce_rate_easing); + const double score_tick_debounce_rate_start = 18f; + const double score_tick_debounce_rate_end = 300f; + const double score_tick_volume_start = 0.6f; + const double score_tick_volume_end = 1.0f; + + this.TransformBindableTo(tickPlaybackRate, score_tick_debounce_rate_start); + this.TransformBindableTo(tickPlaybackRate, score_tick_debounce_rate_end, ACCURACY_TRANSFORM_DURATION, Easing.OutSine); + + scoreTickSound.FrequencyTo(1 + targetAccuracy, ACCURACY_TRANSFORM_DURATION, Easing.OutSine); + scoreTickSound.VolumeTo(score_tick_volume_start).Then().VolumeTo(score_tick_volume_end, ACCURACY_TRANSFORM_DURATION, Easing.OutSine); isTicking = true; }); @@ -333,7 +316,6 @@ namespace osu.Game.Screens.Ranking.Expanded.Accuracy var dink = badgeNum < badges.Count - 1 ? badgeTickSound : badgeMaxSound; dink.FrequencyTo(1 + badgeNum++ * 0.05); - dink.VolumeTo(sfx_badge_dink_volume); dink.Play(); }); } @@ -349,15 +331,17 @@ namespace osu.Game.Screens.Ranking.Expanded.Accuracy Schedule(() => { isTicking = false; - rankImpactSound.VolumeTo(sfx_rank_impact_volume); rankImpactSound.Play(); }); - using (BeginDelayedSequence(sfx_applause_pre_delay)) + const double applause_pre_delay = 545f; + const double applause_volume = 0.8f; + + using (BeginDelayedSequence(applause_pre_delay)) { Schedule(() => { - rankApplauseSound.VolumeTo(sfx_applause_volume); + rankApplauseSound.VolumeTo(applause_volume); rankApplauseSound.Play(); }); } From c8947daee3865ef7a86bb0fae9f4794870669a0b Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Wed, 9 Jun 2021 19:27:43 +0900 Subject: [PATCH 18/23] Add back another missing space... --- osu.iOS.props | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu.iOS.props b/osu.iOS.props index 6b9aaeafa9..42d197d106 100644 --- a/osu.iOS.props +++ b/osu.iOS.props @@ -71,7 +71,7 @@ - + From 7d86dafd4f0ee0f76c4f8753f57ca4e4488cdb12 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Wed, 9 Jun 2021 19:31:53 +0900 Subject: [PATCH 19/23] Simplify tick calculation/playback method --- .../Expanded/Accuracy/AccuracyCircle.cs | 25 ++++++++----------- 1 file changed, 11 insertions(+), 14 deletions(-) diff --git a/osu.Game/Screens/Ranking/Expanded/Accuracy/AccuracyCircle.cs b/osu.Game/Screens/Ranking/Expanded/Accuracy/AccuracyCircle.cs index de488f2eb9..8ec76b2b18 100644 --- a/osu.Game/Screens/Ranking/Expanded/Accuracy/AccuracyCircle.cs +++ b/osu.Game/Screens/Ranking/Expanded/Accuracy/AccuracyCircle.cs @@ -238,20 +238,6 @@ namespace osu.Game.Screens.Ranking.Expanded.Accuracy } } - protected override void Update() - { - base.Update(); - - if (!isTicking) return; - - bool enoughTimePassedSinceLastPlayback = Clock.CurrentTime - lastTickPlaybackTime >= tickPlaybackRate.Value; - - if (!enoughTimePassedSinceLastPlayback) return; - - Schedule(() => scoreTickSound?.Play()); - lastTickPlaybackTime = Clock.CurrentTime; - } - protected override void LoadComplete() { base.LoadComplete(); @@ -349,6 +335,17 @@ namespace osu.Game.Screens.Ranking.Expanded.Accuracy } } + protected override void Update() + { + base.Update(); + + if (isTicking && Clock.CurrentTime - lastTickPlaybackTime >= tickPlaybackRate.Value) + { + scoreTickSound?.Play(); + lastTickPlaybackTime = Clock.CurrentTime; + } + } + private string applauseSampleName { get From 31b46afa7139477b9acfb73de002734ff647d431 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Wed, 9 Jun 2021 19:35:05 +0900 Subject: [PATCH 20/23] Fix wrong naming scheme for applause samples --- .../Ranking/Expanded/Accuracy/AccuracyCircle.cs | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/osu.Game/Screens/Ranking/Expanded/Accuracy/AccuracyCircle.cs b/osu.Game/Screens/Ranking/Expanded/Accuracy/AccuracyCircle.cs index 8ec76b2b18..87c8f95bfa 100644 --- a/osu.Game/Screens/Ranking/Expanded/Accuracy/AccuracyCircle.cs +++ b/osu.Game/Screens/Ranking/Expanded/Accuracy/AccuracyCircle.cs @@ -354,22 +354,22 @@ namespace osu.Game.Screens.Ranking.Expanded.Accuracy { default: case ScoreRank.D: - return @"Results/rank-applause-d"; + return @"Results/applause-d"; case ScoreRank.C: - return @"Results/rank-applause-c"; + return @"Results/applause-c"; case ScoreRank.B: - return @"Results/rank-applause-b"; + return @"Results/applause-b"; case ScoreRank.A: - return @"Results/rank-applause-a"; + return @"Results/applause-a"; case ScoreRank.S: case ScoreRank.SH: case ScoreRank.X: case ScoreRank.XH: - return @"Results/rank-applause-s"; + return @"Results/applause-s"; } } } From 209d217024bdd1d37ab63e47f6d9a3dafb6e90b0 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Thu, 10 Jun 2021 12:37:56 +0900 Subject: [PATCH 21/23] Remove unused using statement --- osu.Game/Screens/Ranking/ResultsScreen.cs | 1 - 1 file changed, 1 deletion(-) diff --git a/osu.Game/Screens/Ranking/ResultsScreen.cs b/osu.Game/Screens/Ranking/ResultsScreen.cs index 9ec6b9c5b1..9f61b081f5 100644 --- a/osu.Game/Screens/Ranking/ResultsScreen.cs +++ b/osu.Game/Screens/Ranking/ResultsScreen.cs @@ -12,7 +12,6 @@ using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Shapes; using osu.Framework.Input.Bindings; using osu.Framework.Screens; -using osu.Game.Audio; using osu.Game.Graphics; using osu.Game.Graphics.Containers; using osu.Game.Graphics.UserInterface; From 4f8000a5744703d8235df2054ac4da7ed4d8a531 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Thu, 10 Jun 2021 17:29:36 +0900 Subject: [PATCH 22/23] Combine cases which return the same value --- osu.Game/Screens/Ranking/Expanded/Accuracy/AccuracyCircle.cs | 4 ---- 1 file changed, 4 deletions(-) diff --git a/osu.Game/Screens/Ranking/Expanded/Accuracy/AccuracyCircle.cs b/osu.Game/Screens/Ranking/Expanded/Accuracy/AccuracyCircle.cs index 87c8f95bfa..73e5334739 100644 --- a/osu.Game/Screens/Ranking/Expanded/Accuracy/AccuracyCircle.cs +++ b/osu.Game/Screens/Ranking/Expanded/Accuracy/AccuracyCircle.cs @@ -385,14 +385,10 @@ namespace osu.Game.Screens.Ranking.Expanded.Accuracy return @"Results/rank-impact-fail-d"; case ScoreRank.C: - return @"Results/rank-impact-fail"; - case ScoreRank.B: return @"Results/rank-impact-fail"; case ScoreRank.A: - return @"Results/rank-impact-pass"; - case ScoreRank.S: case ScoreRank.SH: return @"Results/rank-impact-pass"; From 0667354fbd7e98c0727effb8b9e8b6c11905f245 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Thu, 10 Jun 2021 17:30:04 +0900 Subject: [PATCH 23/23] Remove unused resolved `skin` --- osu.Game/Screens/Ranking/Expanded/Accuracy/AccuracyCircle.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu.Game/Screens/Ranking/Expanded/Accuracy/AccuracyCircle.cs b/osu.Game/Screens/Ranking/Expanded/Accuracy/AccuracyCircle.cs index 73e5334739..635be60549 100644 --- a/osu.Game/Screens/Ranking/Expanded/Accuracy/AccuracyCircle.cs +++ b/osu.Game/Screens/Ranking/Expanded/Accuracy/AccuracyCircle.cs @@ -104,7 +104,7 @@ namespace osu.Game.Screens.Ranking.Expanded.Accuracy } [BackgroundDependencyLoader] - private void load(GameHost host, ISkinSource skin) + private void load(GameHost host) { InternalChildren = new Drawable[] {