Move logic to LoadComplete instead

This commit is contained in:
Jamie Taylor 2021-02-11 09:57:14 +09:00
parent 63e6ec1c9f
commit c12c09ec4d

View File

@ -28,8 +28,6 @@ namespace osu.Game.Overlays.OSD
private SampleChannel sampleOff; private SampleChannel sampleOff;
private SampleChannel sampleChange; private SampleChannel sampleChange;
private bool playedSample;
public TrackedSettingToast(SettingDescription description) public TrackedSettingToast(SettingDescription description)
: base(description.Name, description.Value, description.Shortcut) : base(description.Name, description.Value, description.Shortcut)
{ {
@ -77,11 +75,9 @@ namespace osu.Game.Overlays.OSD
optionLights.Add(new OptionLight { Glowing = i == selectedOption }); optionLights.Add(new OptionLight { Glowing = i == selectedOption });
} }
protected override void Update() protected override void LoadComplete()
{ {
base.Update(); base.LoadComplete();
if (playedSample) return;
if (optionCount == 1) if (optionCount == 1)
{ {
@ -97,8 +93,6 @@ namespace osu.Game.Overlays.OSD
sampleChange.Frequency.Value = 1 + (double)selectedOption / (optionCount - 1) * 0.25f; sampleChange.Frequency.Value = 1 + (double)selectedOption / (optionCount - 1) * 0.25f;
sampleChange.Play(); sampleChange.Play();
} }
playedSample = true;
} }
[BackgroundDependencyLoader] [BackgroundDependencyLoader]