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

@ -30,7 +30,7 @@ namespace osu.Game.Rulesets.Osu
}; };
public override IEnumerable<BeatmapStatistic> GetBeatmapStatistics(WorkingBeatmap beatmap) => new[] public override IEnumerable<BeatmapStatistic> GetBeatmapStatistics(WorkingBeatmap beatmap) => new[]
{ {
new BeatmapStatistic new BeatmapStatistic
{ {
Name = @"Circle count", Name = @"Circle count",

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:
{ newBackground.Position = new Vector2(400, 0);
case TransformDirection.Next: newBackground.MoveToX(0, 500, Easing.OutCubic);
newBackground.Position = new Vector2(400, 0); background.MoveToX(-400, 500, Easing.OutCubic);
newBackground.MoveToX(0, 500, Easing.OutCubic); break;
currentBackground.MoveToX(-400, 500, Easing.OutCubic); case TransformDirection.Prev:
break; newBackground.Position = new Vector2(-400, 0);
case TransformDirection.Prev: newBackground.MoveToX(0, 500, Easing.OutCubic);
newBackground.Position = new Vector2(-400, 0); background.MoveToX(400, 500, Easing.OutCubic);
newBackground.MoveToX(0, 500, Easing.OutCubic); break;
currentBackground.MoveToX(400, 500, Easing.OutCubic);
break;
}
currentBackground.Expire();
currentBackground = newBackground;
} }
})
{ background.Expire();
Depth = float.MaxValue, background = newBackground;
playerContainer.Add(newBackground);
}); });
}); });
} }

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,
OnLoadComplete = d =>
{
this.FadeIn(250);
lastContainer?.FadeOut(250);
lastContainer?.Expire();
}
})
{ {
Depth = newDepth, Shear = -Shear,
Depth = info?.Depth + 1 ?? 0,
}, newInfo =>
{
// ensure we ourselves are visible if not already.
if (!IsPresent)
this.FadeIn(250);
info?.FadeOut(250);
info?.Expire();
Add(info = newInfo);
}); });
} }
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,
@ -206,13 +212,13 @@ namespace osu.Game.Screens.Select
Font = @"Exo2.0-Medium", Font = @"Exo2.0-Medium",
Text = "mapped by ", Text = "mapped by ",
TextSize = 15, TextSize = 15,
}, },
new OsuSpriteText new OsuSpriteText
{ {
Font = @"Exo2.0-Bold", Font = @"Exo2.0-Bold",
Text = metadata.Author.Username, Text = metadata.Author.Username,
TextSize = 15, TextSize = 15,
}, },
} }
}, },
new FillFlowContainer new FillFlowContainer
@ -244,38 +250,39 @@ namespace osu.Game.Screens.Select
AutoSizeAxes = Axes.Both; AutoSizeAxes = Axes.Both;
Children = new Drawable[] Children = new Drawable[]
{ {
new SpriteIcon new SpriteIcon
{ {
Icon = FontAwesome.fa_square, Icon = FontAwesome.fa_square,
Origin = Anchor.Centre, Origin = Anchor.Centre,
Colour = new Color4(68, 17, 136, 255), Colour = new Color4(68, 17, 136, 255),
Rotation = 45, Rotation = 45,
Size = new Vector2(20), Size = new Vector2(20),
}, },
new SpriteIcon new SpriteIcon
{ {
Icon = statistic.Icon, Icon = statistic.Icon,
Origin = Anchor.Centre, Origin = Anchor.Centre,
Colour = new Color4(255, 221, 85, 255), Colour = new Color4(255, 221, 85, 255),
Scale = new Vector2(0.8f), Scale = new Vector2(0.8f),
Size = new Vector2(20), Size = new Vector2(20),
}, },
new OsuSpriteText new OsuSpriteText
{ {
Margin = new MarginPadding { Left = 13 }, Margin = new MarginPadding { Left = 13 },
Font = @"Exo2.0-Bold", Font = @"Exo2.0-Bold",
Colour = new Color4(255, 221, 85, 255), Colour = new Color4(255, 221, 85, 255),
Text = statistic.Content, Text = statistic.Content,
TextSize = 17, TextSize = 17,
Origin = Anchor.CentreLeft Origin = Anchor.CentreLeft
}, },
}; };
} }
} }
private class DifficultyColourBar : DifficultyColouredContainer private class DifficultyColourBar : DifficultyColouredContainer
{ {
public DifficultyColourBar(BeatmapInfo beatmap) : base(beatmap) public DifficultyColourBar(BeatmapInfo beatmap)
: base(beatmap)
{ {
} }
@ -286,21 +293,21 @@ namespace osu.Game.Screens.Select
Children = new Drawable[] Children = new Drawable[]
{ {
new Box new Box
{ {
RelativeSizeAxes = Axes.Both, RelativeSizeAxes = Axes.Both,
Colour = AccentColour, Colour = AccentColour,
Width = full_opacity_ratio, Width = full_opacity_ratio,
}, },
new Box new Box
{ {
RelativeSizeAxes = Axes.Both, RelativeSizeAxes = Axes.Both,
RelativePositionAxes = Axes.Both, RelativePositionAxes = Axes.Both,
Colour = AccentColour, Colour = AccentColour,
Alpha = 0.5f, Alpha = 0.5f,
X = full_opacity_ratio, X = full_opacity_ratio,
Width = 1 - full_opacity_ratio, Width = 1 - full_opacity_ratio,
} }
}; };
} }
} }

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;