Merge branch 'master' into sudden-death

This commit is contained in:
Dan Balasescu 2017-11-21 17:37:40 +09:00 committed by GitHub
commit c39e76fdea
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
7 changed files with 105 additions and 105 deletions

View File

@ -45,8 +45,8 @@ namespace osu.Game.Graphics.Containers
double currentTrackTime = track.Length > 0 ? track.CurrentTime + EarlyActivationMilliseconds : Clock.CurrentTime; double currentTrackTime = track.Length > 0 ? track.CurrentTime + EarlyActivationMilliseconds : Clock.CurrentTime;
TimingControlPoint timingPoint = Beatmap.Value.Beatmap.ControlPointInfo.TimingPointAt(currentTrackTime); TimingControlPoint timingPoint = beatmap.ControlPointInfo.TimingPointAt(currentTrackTime);
EffectControlPoint effectPoint = Beatmap.Value.Beatmap.ControlPointInfo.EffectPointAt(currentTrackTime); EffectControlPoint effectPoint = beatmap.ControlPointInfo.EffectPointAt(currentTrackTime);
if (timingPoint.BeatLength == 0) if (timingPoint.BeatLength == 0)
return; return;
@ -67,7 +67,7 @@ namespace osu.Game.Graphics.Containers
return; return;
using (BeginDelayedSequence(-TimeSinceLastBeat, true)) using (BeginDelayedSequence(-TimeSinceLastBeat, true))
OnNewBeat(beatIndex, timingPoint, effectPoint, Beatmap.Value.Track.CurrentAmplitudes); OnNewBeat(beatIndex, timingPoint, effectPoint, track.CurrentAmplitudes);
lastBeat = beatIndex; lastBeat = beatIndex;
lastTimingPoint = timingPoint; lastTimingPoint = timingPoint;

View File

@ -37,7 +37,7 @@ namespace osu.Game.Overlays
private const float bottom_black_area_height = 55; private const float bottom_black_area_height = 55;
private Drawable currentBackground; private Drawable background;
private ProgressBar progressBar; private ProgressBar progressBar;
private IconButton prevButton; private IconButton prevButton;
@ -120,7 +120,7 @@ namespace osu.Game.Overlays
}, },
Children = new[] Children = new[]
{ {
currentBackground = new Background(), background = new Background(),
title = new OsuSpriteText title = new OsuSpriteText
{ {
Origin = Anchor.BottomCentre, Origin = Anchor.BottomCentre,
@ -334,6 +334,7 @@ namespace osu.Game.Overlays
pendingBeatmapSwitch = Schedule(delegate pendingBeatmapSwitch = Schedule(delegate
{ {
// todo: this can likely be replaced with WorkingBeatmap.GetBeatmapAsync()
Task.Run(() => Task.Run(() =>
{ {
if (beatmap?.Beatmap == null) //this is not needed if a placeholder exists if (beatmap?.Beatmap == null) //this is not needed if a placeholder exists
@ -352,29 +353,26 @@ namespace osu.Game.Overlays
} }
}); });
playerContainer.Add(new AsyncLoadWrapper(new Background(beatmap) LoadComponentAsync(new Background(beatmap) { Depth = float.MaxValue }, newBackground =>
{
OnLoadComplete = newBackground =>
{ {
switch (direction) switch (direction)
{ {
case TransformDirection.Next: case TransformDirection.Next:
newBackground.Position = new Vector2(400, 0); newBackground.Position = new Vector2(400, 0);
newBackground.MoveToX(0, 500, Easing.OutCubic); newBackground.MoveToX(0, 500, Easing.OutCubic);
currentBackground.MoveToX(-400, 500, Easing.OutCubic); background.MoveToX(-400, 500, Easing.OutCubic);
break; break;
case TransformDirection.Prev: case TransformDirection.Prev:
newBackground.Position = new Vector2(-400, 0); newBackground.Position = new Vector2(-400, 0);
newBackground.MoveToX(0, 500, Easing.OutCubic); newBackground.MoveToX(0, 500, Easing.OutCubic);
currentBackground.MoveToX(400, 500, Easing.OutCubic); background.MoveToX(400, 500, Easing.OutCubic);
break; break;
} }
currentBackground.Expire();
currentBackground = newBackground; background.Expire();
} background = newBackground;
})
{ playerContainer.Add(newBackground);
Depth = float.MaxValue,
}); });
}); });
} }

View File

@ -32,9 +32,7 @@ namespace osu.Game.Screens.Backgrounds
Schedule(() => Schedule(() =>
{ {
var newBackground = new BeatmapBackground(beatmap); LoadComponentAsync(new BeatmapBackground(beatmap), b =>
LoadComponentAsync(newBackground, delegate
{ {
float newDepth = 0; float newDepth = 0;
if (background != null) if (background != null)
@ -45,8 +43,8 @@ namespace osu.Game.Screens.Backgrounds
background.Expire(); background.Expire();
} }
newBackground.Depth = newDepth; b.Depth = newDepth;
Add(background = newBackground); Add(background = b);
background.BlurSigma = blurTarget; background.BlurSigma = blurTarget;
}); });
}); });

View File

@ -85,7 +85,7 @@ namespace osu.Game.Screens.Menu
private void updateAmplitudes() private void updateAmplitudes()
{ {
var track = beatmap.Value.Track; var track = beatmap.Value.TrackLoaded ? beatmap.Value.Track : null;
float[] temporalAmplitudes = track?.CurrentAmplitudes.FrequencyAmplitudes ?? new float[256]; float[] temporalAmplitudes = track?.CurrentAmplitudes.FrequencyAmplitudes ?? new float[256];

View File

@ -26,7 +26,7 @@ namespace osu.Game.Screens.Select
{ {
private static readonly Vector2 wedged_container_shear = new Vector2(0.15f, 0); private static readonly Vector2 wedged_container_shear = new Vector2(0.15f, 0);
private Drawable beatmapInfoContainer; private Drawable info;
public BeatmapInfoWedge() public BeatmapInfoWedge()
{ {
@ -65,56 +65,62 @@ namespace osu.Game.Screens.Select
public void UpdateBeatmap(WorkingBeatmap beatmap) public void UpdateBeatmap(WorkingBeatmap beatmap)
{ {
var lastContainer = beatmapInfoContainer; LoadComponentAsync(new BufferedWedgeInfo(beatmap)
float newDepth = lastContainer?.Depth + 1 ?? 0;
Add(beatmapInfoContainer = new AsyncLoadWrapper(
new BufferedWedgeInfo(beatmap)
{ {
Shear = -Shear, Shear = -Shear,
OnLoadComplete = d => Depth = info?.Depth + 1 ?? 0,
}, newInfo =>
{ {
// ensure we ourselves are visible if not already.
if (!IsPresent)
this.FadeIn(250); this.FadeIn(250);
lastContainer?.FadeOut(250); info?.FadeOut(250);
lastContainer?.Expire(); info?.Expire();
}
}) Add(info = newInfo);
{
Depth = newDepth,
}); });
} }
public class BufferedWedgeInfo : BufferedContainer public class BufferedWedgeInfo : BufferedContainer
{ {
public BufferedWedgeInfo(WorkingBeatmap beatmap) private readonly WorkingBeatmap working;
public BufferedWedgeInfo(WorkingBeatmap working)
{ {
BeatmapInfo beatmapInfo = beatmap.BeatmapInfo; this.working = working;
BeatmapMetadata metadata = beatmapInfo.Metadata ?? beatmap.BeatmapSetInfo?.Metadata ?? new BeatmapMetadata(); }
[BackgroundDependencyLoader]
private void load()
{
BeatmapInfo beatmapInfo = working.BeatmapInfo;
BeatmapMetadata metadata = beatmapInfo.Metadata ?? working.BeatmapSetInfo?.Metadata ?? new BeatmapMetadata();
Beatmap beatmap = working.Beatmap;
List<InfoLabel> labels = new List<InfoLabel>(); List<InfoLabel> labels = new List<InfoLabel>();
if (beatmap.Beatmap != null) if (beatmap != null)
{ {
HitObject lastObject = beatmap.Beatmap.HitObjects.LastOrDefault(); HitObject lastObject = beatmap.HitObjects.LastOrDefault();
double endTime = (lastObject as IHasEndTime)?.EndTime ?? lastObject?.StartTime ?? 0; double endTime = (lastObject as IHasEndTime)?.EndTime ?? lastObject?.StartTime ?? 0;
labels.Add(new InfoLabel(new BeatmapStatistic labels.Add(new InfoLabel(new BeatmapStatistic
{ {
Name = "Length", Name = "Length",
Icon = FontAwesome.fa_clock_o, Icon = FontAwesome.fa_clock_o,
Content = beatmap.Beatmap.HitObjects.Count == 0 ? "-" : TimeSpan.FromMilliseconds(endTime - beatmap.Beatmap.HitObjects.First().StartTime).ToString(@"m\:ss"), Content = beatmap.HitObjects.Count == 0 ? "-" : TimeSpan.FromMilliseconds(endTime - beatmap.HitObjects.First().StartTime).ToString(@"m\:ss"),
})); }));
labels.Add(new InfoLabel(new BeatmapStatistic labels.Add(new InfoLabel(new BeatmapStatistic
{ {
Name = "BPM", Name = "BPM",
Icon = FontAwesome.fa_circle, Icon = FontAwesome.fa_circle,
Content = getBPMRange(beatmap.Beatmap), Content = getBPMRange(beatmap),
})); }));
//get statistics from the current ruleset. //get statistics from the current ruleset.
labels.AddRange(beatmapInfo.Ruleset.CreateInstance().GetBeatmapStatistics(beatmap).Select(s => new InfoLabel(s))); labels.AddRange(beatmapInfo.Ruleset.CreateInstance().GetBeatmapStatistics(working).Select(s => new InfoLabel(s)));
} }
PixelSnapping = true; PixelSnapping = true;
@ -140,7 +146,7 @@ namespace osu.Game.Screens.Select
Children = new[] Children = new[]
{ {
// Zoomed-in and cropped beatmap background // Zoomed-in and cropped beatmap background
new BeatmapBackgroundSprite(beatmap) new BeatmapBackgroundSprite(working)
{ {
RelativeSizeAxes = Axes.Both, RelativeSizeAxes = Axes.Both,
Anchor = Anchor.Centre, Anchor = Anchor.Centre,
@ -149,7 +155,7 @@ namespace osu.Game.Screens.Select
}, },
}, },
}, },
new DifficultyColourBar(beatmap.BeatmapInfo) new DifficultyColourBar(beatmapInfo)
{ {
RelativeSizeAxes = Axes.Y, RelativeSizeAxes = Axes.Y,
Width = 20, Width = 20,
@ -275,7 +281,8 @@ namespace osu.Game.Screens.Select
private class DifficultyColourBar : DifficultyColouredContainer private class DifficultyColourBar : DifficultyColouredContainer
{ {
public DifficultyColourBar(BeatmapInfo beatmap) : base(beatmap) public DifficultyColourBar(BeatmapInfo beatmap)
: base(beatmap)
{ {
} }

View File

@ -1,7 +1,6 @@
// Copyright (c) 2007-2017 ppy Pty Ltd <contact@ppy.sh>. // Copyright (c) 2007-2017 ppy Pty Ltd <contact@ppy.sh>.
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
using System;
using System.Linq; using System.Linq;
using OpenTK; using OpenTK;
using OpenTK.Graphics; using OpenTK.Graphics;
@ -24,8 +23,6 @@ namespace osu.Game.Screens.Select.Leaderboards
{ {
public static readonly float HEIGHT = 60; public static readonly float HEIGHT = 60;
public event Action<Visibility> StateChanged;
public readonly int RankPosition; public readonly int RankPosition;
public readonly Score Score; public readonly Score Score;