mirror of
https://github.com/ppy/osu.git
synced 2025-01-14 02:13:21 +08:00
Remove many now unnecessary null-checks
This commit is contained in:
parent
21d07428fe
commit
64ebc01a3b
@ -35,7 +35,7 @@ namespace osu.Game.Graphics.Containers
|
||||
|
||||
protected override void Update()
|
||||
{
|
||||
var track = Beatmap.Value?.Track;
|
||||
var track = Beatmap.Value.Track;
|
||||
|
||||
if (track == null)
|
||||
return;
|
||||
|
@ -86,13 +86,15 @@ namespace osu.Game.Screens.Menu
|
||||
|
||||
private void updateAmplitudes()
|
||||
{
|
||||
float[] temporalAmplitudes = beatmap.Value?.Track?.CurrentAmplitudes.FrequencyAmplitudes ?? new float[256];
|
||||
var track = beatmap.Value.Track;
|
||||
|
||||
var effect = beatmap.Value?.Beatmap.ControlPointInfo.EffectPointAt(beatmap.Value.Track?.CurrentTime ?? Time.Current);
|
||||
float[] temporalAmplitudes = track?.CurrentAmplitudes.FrequencyAmplitudes ?? new float[256];
|
||||
|
||||
var effect = beatmap.Value.Beatmap.ControlPointInfo.EffectPointAt(track?.CurrentTime ?? Time.Current);
|
||||
|
||||
for (int i = 0; i < bars_per_visualiser; i++)
|
||||
{
|
||||
if (beatmap?.Value?.Track?.IsRunning ?? false)
|
||||
if (track?.IsRunning ?? false)
|
||||
{
|
||||
float targetAmplitude = temporalAmplitudes[(i + indexOffset) % bars_per_visualiser] * (effect?.KiaiMode == true ? 1 : 0.5f);
|
||||
if (targetAmplitude > frequencyAmplitudes[i])
|
||||
|
@ -275,7 +275,7 @@ namespace osu.Game.Screens.Menu
|
||||
const float scale_adjust_cutoff = 0.4f;
|
||||
const float velocity_adjust_cutoff = 0.98f;
|
||||
|
||||
var maxAmplitude = lastBeatIndex >= 0 ? Beatmap.Value?.Track?.CurrentAmplitudes.Maximum ?? 0 : 0;
|
||||
var maxAmplitude = lastBeatIndex >= 0 ? Beatmap.Value.Track?.CurrentAmplitudes.Maximum ?? 0 : 0;
|
||||
logoAmplitudeContainer.ScaleTo(1 - Math.Max(0, maxAmplitude - scale_adjust_cutoff) * 0.04f, 75, EasingTypes.OutQuint);
|
||||
|
||||
if (maxAmplitude > velocity_adjust_cutoff)
|
||||
|
@ -81,10 +81,11 @@ namespace osu.Game.Screens.Play
|
||||
|
||||
try
|
||||
{
|
||||
if (Beatmap.Value == null)
|
||||
if (!Beatmap.Value.WithStoryboard)
|
||||
// we need to ensure the storyboard is loaded.
|
||||
Beatmap.Value = beatmaps.GetWorkingBeatmap(BeatmapInfo, withStoryboard: true);
|
||||
|
||||
if (Beatmap.Value?.Beatmap == null)
|
||||
if (Beatmap.Value.Beatmap == null)
|
||||
throw new InvalidOperationException("Beatmap was not loaded");
|
||||
|
||||
ruleset = osu?.Ruleset.Value ?? Beatmap.Value.BeatmapInfo.Ruleset;
|
||||
|
@ -165,7 +165,7 @@ namespace osu.Game.Screens.Ranking
|
||||
{
|
||||
RelativeSizeAxes = Axes.Both,
|
||||
Alpha = 0.2f,
|
||||
Texture = Beatmap.Value?.Background,
|
||||
Texture = Beatmap.Value.Background,
|
||||
Anchor = Anchor.Centre,
|
||||
Origin = Anchor.Centre,
|
||||
FillMode = FillMode.Fill
|
||||
|
@ -59,14 +59,14 @@ namespace osu.Game.Screens.Select
|
||||
{
|
||||
if (!IsCurrentScreen) return;
|
||||
|
||||
beatmap?.Mods.BindTo(modSelect.SelectedMods);
|
||||
beatmap.Mods.BindTo(modSelect.SelectedMods);
|
||||
|
||||
if (Beatmap.Value?.Track != null)
|
||||
if (Beatmap.Value.Track != null)
|
||||
Beatmap.Value.Track.Looping = false;
|
||||
|
||||
beatmapDetails.Beatmap = beatmap;
|
||||
|
||||
if (beatmap?.Track != null)
|
||||
if (beatmap.Track != null)
|
||||
beatmap.Track.Looping = true;
|
||||
}
|
||||
|
||||
@ -97,7 +97,7 @@ namespace osu.Game.Screens.Select
|
||||
if (base.OnExiting(next))
|
||||
return true;
|
||||
|
||||
if (Beatmap.Value?.Track != null)
|
||||
if (Beatmap.Value.Track != null)
|
||||
Beatmap.Value.Track.Looping = false;
|
||||
|
||||
return false;
|
||||
|
@ -224,7 +224,7 @@ namespace osu.Game.Screens.Select
|
||||
if (beatmap.Equals(beatmapNoDebounce))
|
||||
return;
|
||||
|
||||
bool preview = beatmap.BeatmapSetInfoID != Beatmap.Value?.BeatmapInfo.BeatmapSetInfoID;
|
||||
bool preview = beatmap.BeatmapSetInfoID != Beatmap.Value.BeatmapInfo.BeatmapSetInfoID;
|
||||
|
||||
if (beatmap.BeatmapSetInfoID == beatmapNoDebounce?.BeatmapSetInfoID)
|
||||
sampleChangeDifficulty.Play();
|
||||
@ -347,15 +347,12 @@ namespace osu.Game.Screens.Select
|
||||
|
||||
private void ensurePlayingSelected(bool preview = false)
|
||||
{
|
||||
Track track = Beatmap.Value?.Track;
|
||||
Track track = Beatmap.Value.Track;
|
||||
|
||||
trackManager.SetExclusive(track);
|
||||
|
||||
if (track != null)
|
||||
{
|
||||
if (preview) track.Seek(Beatmap.Value.Metadata.PreviewTime);
|
||||
track.Start();
|
||||
}
|
||||
if (preview) track.Seek(Beatmap.Value.Metadata.PreviewTime);
|
||||
track.Start();
|
||||
}
|
||||
|
||||
private void removeBeatmapSet(BeatmapSetInfo beatmapSet)
|
||||
|
Loading…
Reference in New Issue
Block a user