mirror of
https://github.com/ppy/osu.git
synced 2025-01-15 07:22:55 +08:00
Merge branch 'fix-ImportBeatmapTest' of https://github.com/ekrctb/osu into fix-ImportBeatmapTest
This commit is contained in:
commit
94a22fb43d
@ -53,7 +53,7 @@ namespace osu.Game.Tests.Visual
|
|||||||
AddStep("show", () =>
|
AddStep("show", () =>
|
||||||
{
|
{
|
||||||
infoWedge.State = Visibility.Visible;
|
infoWedge.State = Visibility.Visible;
|
||||||
infoWedge.UpdateBeatmap(beatmap);
|
infoWedge.Beatmap = beatmap;
|
||||||
});
|
});
|
||||||
|
|
||||||
// select part is redundant, but wait for load isn't
|
// select part is redundant, but wait for load isn't
|
||||||
@ -133,7 +133,7 @@ namespace osu.Game.Tests.Visual
|
|||||||
AddStep($"select {b.Metadata.Title} beatmap", () =>
|
AddStep($"select {b.Metadata.Title} beatmap", () =>
|
||||||
{
|
{
|
||||||
infoBefore = infoWedge.Info;
|
infoBefore = infoWedge.Info;
|
||||||
infoWedge.UpdateBeatmap(beatmap.Value = new TestWorkingBeatmap(b));
|
infoWedge.Beatmap = beatmap.Value = new TestWorkingBeatmap(b);
|
||||||
});
|
});
|
||||||
|
|
||||||
AddUntilStep(() => infoWedge.Info != infoBefore, "wait for async load");
|
AddUntilStep(() => infoWedge.Info != infoBefore, "wait for async load");
|
||||||
@ -144,7 +144,7 @@ namespace osu.Game.Tests.Visual
|
|||||||
AddStep("select null beatmap", () =>
|
AddStep("select null beatmap", () =>
|
||||||
{
|
{
|
||||||
beatmap.Value = beatmap.Default;
|
beatmap.Value = beatmap.Default;
|
||||||
infoWedge.UpdateBeatmap(beatmap);
|
infoWedge.Beatmap = beatmap;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
115
osu.Game.Tests/Visual/TestCaseLoaderAnimation.cs
Normal file
115
osu.Game.Tests/Visual/TestCaseLoaderAnimation.cs
Normal file
@ -0,0 +1,115 @@
|
|||||||
|
// Copyright (c) 2007-2018 ppy Pty Ltd <contact@ppy.sh>.
|
||||||
|
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
|
||||||
|
|
||||||
|
using NUnit.Framework;
|
||||||
|
using osu.Framework.Graphics;
|
||||||
|
using osu.Framework.Graphics.Shapes;
|
||||||
|
using osu.Game.Screens;
|
||||||
|
using osu.Game.Screens.Menu;
|
||||||
|
using OpenTK.Graphics;
|
||||||
|
|
||||||
|
namespace osu.Game.Tests.Visual
|
||||||
|
{
|
||||||
|
[TestFixture]
|
||||||
|
public class TestCaseLoaderAnimation : OsuTestCase
|
||||||
|
{
|
||||||
|
private TestLoader loader;
|
||||||
|
|
||||||
|
protected override void LoadComplete()
|
||||||
|
{
|
||||||
|
base.LoadComplete();
|
||||||
|
|
||||||
|
// required to preload the logo in a headless run (so it doesn't delay the loading itself).
|
||||||
|
Add(new OsuLogo());
|
||||||
|
|
||||||
|
bool logoVisible = false;
|
||||||
|
AddStep("almost instant display", () => Child = loader = new TestLoader(250));
|
||||||
|
AddUntilStep(() =>
|
||||||
|
{
|
||||||
|
logoVisible = loader.Logo?.Alpha > 0;
|
||||||
|
return loader.Logo != null && loader.ScreenLoaded;
|
||||||
|
}, "loaded");
|
||||||
|
AddAssert("logo not visible", () => !logoVisible);
|
||||||
|
|
||||||
|
AddStep("short load", () => Child = loader = new TestLoader(800));
|
||||||
|
AddUntilStep(() =>
|
||||||
|
{
|
||||||
|
logoVisible = loader.Logo?.Alpha > 0;
|
||||||
|
return loader.Logo != null && loader.ScreenLoaded;
|
||||||
|
}, "loaded");
|
||||||
|
AddAssert("logo visible", () => logoVisible);
|
||||||
|
AddUntilStep(() => loader.Logo?.Alpha == 0, "logo gone");
|
||||||
|
|
||||||
|
AddStep("longer load", () => Child = loader = new TestLoader(1400));
|
||||||
|
AddUntilStep(() =>
|
||||||
|
{
|
||||||
|
logoVisible = loader.Logo?.Alpha > 0;
|
||||||
|
return loader.Logo != null && loader.ScreenLoaded;
|
||||||
|
}, "loaded");
|
||||||
|
AddAssert("logo visible", () => logoVisible);
|
||||||
|
AddUntilStep(() => loader.Logo?.Alpha == 0, "logo gone");
|
||||||
|
}
|
||||||
|
|
||||||
|
private class TestLoader : Loader
|
||||||
|
{
|
||||||
|
private readonly double delay;
|
||||||
|
|
||||||
|
public OsuLogo Logo;
|
||||||
|
private TestScreen screen;
|
||||||
|
|
||||||
|
public bool ScreenLoaded => screen.IsCurrentScreen;
|
||||||
|
|
||||||
|
public TestLoader(double delay)
|
||||||
|
{
|
||||||
|
this.delay = delay;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected override void LogoArriving(OsuLogo logo, bool resuming)
|
||||||
|
{
|
||||||
|
Logo = logo;
|
||||||
|
base.LogoArriving(logo, resuming);
|
||||||
|
}
|
||||||
|
|
||||||
|
protected override OsuScreen CreateLoadableScreen() => screen = new TestScreen();
|
||||||
|
protected override ShaderPrecompiler CreateShaderPrecompiler() => new TestShaderPrecompiler(delay);
|
||||||
|
|
||||||
|
private class TestShaderPrecompiler : ShaderPrecompiler
|
||||||
|
{
|
||||||
|
private readonly double delay;
|
||||||
|
private double startTime;
|
||||||
|
|
||||||
|
public TestShaderPrecompiler(double delay)
|
||||||
|
{
|
||||||
|
this.delay = delay;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected override void LoadComplete()
|
||||||
|
{
|
||||||
|
base.LoadComplete();
|
||||||
|
startTime = Time.Current;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected override bool AllLoaded => Time.Current > startTime + delay;
|
||||||
|
}
|
||||||
|
|
||||||
|
private class TestScreen : OsuScreen
|
||||||
|
{
|
||||||
|
public TestScreen()
|
||||||
|
{
|
||||||
|
Child = new Box
|
||||||
|
{
|
||||||
|
RelativeSizeAxes = Axes.Both,
|
||||||
|
Colour = Color4.DarkSlateGray,
|
||||||
|
Alpha = 0,
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
protected override void LogoArriving(OsuLogo logo, bool resuming)
|
||||||
|
{
|
||||||
|
base.LogoArriving(logo, resuming);
|
||||||
|
Child.FadeInFromZero(200);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -170,7 +170,7 @@ namespace osu.Game.Beatmaps
|
|||||||
{
|
{
|
||||||
if (error is OperationCanceledException) return;
|
if (error is OperationCanceledException) return;
|
||||||
|
|
||||||
downloadNotification.State = ProgressNotificationState.Completed;
|
downloadNotification.State = ProgressNotificationState.Cancelled;
|
||||||
Logger.Error(error, "Beatmap download failed!");
|
Logger.Error(error, "Beatmap download failed!");
|
||||||
currentDownloads.Remove(request);
|
currentDownloads.Remove(request);
|
||||||
};
|
};
|
||||||
|
@ -73,6 +73,7 @@ namespace osu.Game.Online.API
|
|||||||
throw new TimeoutException(@"API request timeout hit");
|
throw new TimeoutException(@"API request timeout hit");
|
||||||
|
|
||||||
WebRequest = CreateWebRequest();
|
WebRequest = CreateWebRequest();
|
||||||
|
WebRequest.Failed += Fail;
|
||||||
WebRequest.AllowRetryOnTimeout = false;
|
WebRequest.AllowRetryOnTimeout = false;
|
||||||
WebRequest.AddHeader("Authorization", $"Bearer {api.AccessToken}");
|
WebRequest.AddHeader("Authorization", $"Bearer {api.AccessToken}");
|
||||||
|
|
||||||
|
@ -21,7 +21,7 @@ namespace osu.Game.Overlays.BeatmapSet
|
|||||||
private const float metadata_width = 225;
|
private const float metadata_width = 225;
|
||||||
private const float spacing = 20;
|
private const float spacing = 20;
|
||||||
|
|
||||||
private readonly MetadataSection description, source, tags;
|
private readonly MetadataSection source, tags;
|
||||||
private readonly Box successRateBackground;
|
private readonly Box successRateBackground;
|
||||||
private readonly SuccessRate successRate;
|
private readonly SuccessRate successRate;
|
||||||
|
|
||||||
@ -83,7 +83,7 @@ namespace osu.Game.Overlays.BeatmapSet
|
|||||||
Child = new Container
|
Child = new Container
|
||||||
{
|
{
|
||||||
RelativeSizeAxes = Axes.Both,
|
RelativeSizeAxes = Axes.Both,
|
||||||
Child = description = new MetadataSection("Description"),
|
Child = new MetadataSection("Description"),
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
new Container
|
new Container
|
||||||
@ -135,8 +135,6 @@ namespace osu.Game.Overlays.BeatmapSet
|
|||||||
private void load(OsuColour colours)
|
private void load(OsuColour colours)
|
||||||
{
|
{
|
||||||
successRateBackground.Colour = colours.GrayE;
|
successRateBackground.Colour = colours.GrayE;
|
||||||
source.TextColour = description.TextColour = colours.Gray5;
|
|
||||||
tags.TextColour = colours.BlueDark;
|
|
||||||
|
|
||||||
updateDisplay();
|
updateDisplay();
|
||||||
}
|
}
|
||||||
@ -195,7 +193,7 @@ namespace osu.Game.Overlays.BeatmapSet
|
|||||||
[BackgroundDependencyLoader]
|
[BackgroundDependencyLoader]
|
||||||
private void load(OsuColour colours)
|
private void load(OsuColour colours)
|
||||||
{
|
{
|
||||||
header.Colour = colours.Gray5;
|
header.Colour = textFlow.Colour = colours.Gray5;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,7 +1,6 @@
|
|||||||
// Copyright (c) 2007-2018 ppy Pty Ltd <contact@ppy.sh>.
|
// Copyright (c) 2007-2018 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.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using osu.Framework.Allocation;
|
using osu.Framework.Allocation;
|
||||||
@ -30,43 +29,48 @@ namespace osu.Game.Screens
|
|||||||
{
|
{
|
||||||
base.LogoArriving(logo, resuming);
|
base.LogoArriving(logo, resuming);
|
||||||
|
|
||||||
|
logo.BeatMatching = false;
|
||||||
logo.Triangles = false;
|
logo.Triangles = false;
|
||||||
logo.Origin = Anchor.BottomRight;
|
logo.Origin = Anchor.BottomRight;
|
||||||
logo.Anchor = Anchor.BottomRight;
|
logo.Anchor = Anchor.BottomRight;
|
||||||
logo.Position = new Vector2(-40);
|
logo.Position = new Vector2(-40);
|
||||||
logo.Scale = new Vector2(0.2f);
|
logo.Scale = new Vector2(0.2f);
|
||||||
|
|
||||||
logo.FadeInFromZero(5000, Easing.OutQuint);
|
logo.Delay(500).FadeInFromZero(1000, Easing.OutQuint);
|
||||||
}
|
|
||||||
|
|
||||||
private OsuScreen loadScreen;
|
|
||||||
private ShaderPrecompiler precompiler;
|
|
||||||
|
|
||||||
protected override void OnEntering(Screen last)
|
|
||||||
{
|
|
||||||
base.OnEntering(last);
|
|
||||||
|
|
||||||
LoadComponentAsync(precompiler = new ShaderPrecompiler(loadIfReady), Add);
|
|
||||||
LoadComponentAsync(loadScreen = showDisclaimer ? (OsuScreen)new Disclaimer() : new Intro(), s => loadIfReady());
|
|
||||||
}
|
|
||||||
|
|
||||||
private void loadIfReady()
|
|
||||||
{
|
|
||||||
if (ChildScreen == loadScreen) return;
|
|
||||||
|
|
||||||
if (loadScreen.LoadState != LoadState.Ready)
|
|
||||||
return;
|
|
||||||
|
|
||||||
if (!precompiler.FinishedCompiling)
|
|
||||||
return;
|
|
||||||
|
|
||||||
Push(loadScreen);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override void LogoSuspending(OsuLogo logo)
|
protected override void LogoSuspending(OsuLogo logo)
|
||||||
{
|
{
|
||||||
base.LogoSuspending(logo);
|
base.LogoSuspending(logo);
|
||||||
logo.FadeOut(100);
|
logo.FadeOut(logo.Alpha * 400);
|
||||||
|
}
|
||||||
|
|
||||||
|
private OsuScreen loadableScreen;
|
||||||
|
private ShaderPrecompiler precompiler;
|
||||||
|
|
||||||
|
protected virtual OsuScreen CreateLoadableScreen() => showDisclaimer ? (OsuScreen)new Disclaimer() : new Intro();
|
||||||
|
|
||||||
|
protected virtual ShaderPrecompiler CreateShaderPrecompiler() => new ShaderPrecompiler();
|
||||||
|
|
||||||
|
protected override void OnEntering(Screen last)
|
||||||
|
{
|
||||||
|
base.OnEntering(last);
|
||||||
|
|
||||||
|
LoadComponentAsync(precompiler = CreateShaderPrecompiler(), Add);
|
||||||
|
LoadComponentAsync(loadableScreen = CreateLoadableScreen());
|
||||||
|
|
||||||
|
checkIfLoaded();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void checkIfLoaded()
|
||||||
|
{
|
||||||
|
if (loadableScreen.LoadState != LoadState.Ready || !precompiler.FinishedCompiling)
|
||||||
|
{
|
||||||
|
Schedule(checkIfLoaded);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
Push(loadableScreen);
|
||||||
}
|
}
|
||||||
|
|
||||||
[BackgroundDependencyLoader]
|
[BackgroundDependencyLoader]
|
||||||
@ -80,16 +84,10 @@ namespace osu.Game.Screens
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public class ShaderPrecompiler : Drawable
|
public class ShaderPrecompiler : Drawable
|
||||||
{
|
{
|
||||||
private readonly Action onLoaded;
|
|
||||||
private readonly List<Shader> loadTargets = new List<Shader>();
|
private readonly List<Shader> loadTargets = new List<Shader>();
|
||||||
|
|
||||||
public bool FinishedCompiling { get; private set; }
|
public bool FinishedCompiling { get; private set; }
|
||||||
|
|
||||||
public ShaderPrecompiler(Action onLoaded)
|
|
||||||
{
|
|
||||||
this.onLoaded = onLoaded;
|
|
||||||
}
|
|
||||||
|
|
||||||
[BackgroundDependencyLoader]
|
[BackgroundDependencyLoader]
|
||||||
private void load(ShaderManager manager)
|
private void load(ShaderManager manager)
|
||||||
{
|
{
|
||||||
@ -103,16 +101,17 @@ namespace osu.Game.Screens
|
|||||||
loadTargets.Add(manager.Load(VertexShaderDescriptor.TEXTURE_3, FragmentShaderDescriptor.TEXTURE));
|
loadTargets.Add(manager.Load(VertexShaderDescriptor.TEXTURE_3, FragmentShaderDescriptor.TEXTURE));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected virtual bool AllLoaded => loadTargets.All(s => s.Loaded);
|
||||||
|
|
||||||
protected override void Update()
|
protected override void Update()
|
||||||
{
|
{
|
||||||
base.Update();
|
base.Update();
|
||||||
|
|
||||||
// if our target is null we are done.
|
// if our target is null we are done.
|
||||||
if (loadTargets.All(s => s.Loaded))
|
if (AllLoaded)
|
||||||
{
|
{
|
||||||
FinishedCompiling = true;
|
FinishedCompiling = true;
|
||||||
Expire();
|
Expire();
|
||||||
onLoaded?.Invoke();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -79,10 +79,17 @@ namespace osu.Game.Screens.Menu
|
|||||||
seeya = audio.Sample.Get(@"seeya");
|
seeya = audio.Sample.Get(@"seeya");
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override void OnEntering(Screen last)
|
private const double delay_step_one = 2300;
|
||||||
{
|
private const double delay_step_two = 600;
|
||||||
base.OnEntering(last);
|
|
||||||
|
|
||||||
|
public const int EXIT_DELAY = 3000;
|
||||||
|
|
||||||
|
protected override void LogoArriving(OsuLogo logo, bool resuming)
|
||||||
|
{
|
||||||
|
base.LogoArriving(logo, resuming);
|
||||||
|
|
||||||
|
if (!resuming)
|
||||||
|
{
|
||||||
Game.Beatmap.Value = beatmap;
|
Game.Beatmap.Value = beatmap;
|
||||||
|
|
||||||
if (menuVoice)
|
if (menuVoice)
|
||||||
@ -104,15 +111,6 @@ namespace osu.Game.Screens.Menu
|
|||||||
}, delay_step_two);
|
}, delay_step_two);
|
||||||
}
|
}
|
||||||
|
|
||||||
private const double delay_step_one = 2300;
|
|
||||||
private const double delay_step_two = 600;
|
|
||||||
|
|
||||||
public const int EXIT_DELAY = 3000;
|
|
||||||
|
|
||||||
protected override void LogoArriving(OsuLogo logo, bool resuming)
|
|
||||||
{
|
|
||||||
base.LogoArriving(logo, resuming);
|
|
||||||
|
|
||||||
logo.RelativePositionAxes = Axes.Both;
|
logo.RelativePositionAxes = Axes.Both;
|
||||||
logo.Colour = Color4.White;
|
logo.Colour = Color4.White;
|
||||||
logo.Ripple = false;
|
logo.Ripple = false;
|
||||||
|
@ -24,8 +24,8 @@ namespace osu.Game.Screens.Menu
|
|||||||
|
|
||||||
private readonly Bindable<WorkingBeatmap> beatmap = new Bindable<WorkingBeatmap>();
|
private readonly Bindable<WorkingBeatmap> beatmap = new Bindable<WorkingBeatmap>();
|
||||||
|
|
||||||
private readonly Box leftBox;
|
private Box leftBox;
|
||||||
private readonly Box rightBox;
|
private Box rightBox;
|
||||||
|
|
||||||
private const float amplitude_dead_zone = 0.25f;
|
private const float amplitude_dead_zone = 0.25f;
|
||||||
private const float alpha_multiplier = (1 - amplitude_dead_zone) / 0.55f;
|
private const float alpha_multiplier = (1 - amplitude_dead_zone) / 0.55f;
|
||||||
@ -42,27 +42,6 @@ namespace osu.Game.Screens.Menu
|
|||||||
RelativeSizeAxes = Axes.Both;
|
RelativeSizeAxes = Axes.Both;
|
||||||
Anchor = Anchor.Centre;
|
Anchor = Anchor.Centre;
|
||||||
Origin = Anchor.Centre;
|
Origin = Anchor.Centre;
|
||||||
Children = new Drawable[]
|
|
||||||
{
|
|
||||||
leftBox = new Box
|
|
||||||
{
|
|
||||||
Anchor = Anchor.CentreLeft,
|
|
||||||
Origin = Anchor.CentreLeft,
|
|
||||||
RelativeSizeAxes = Axes.Y,
|
|
||||||
Width = box_width,
|
|
||||||
Alpha = 0,
|
|
||||||
Blending = BlendingMode.Additive,
|
|
||||||
},
|
|
||||||
rightBox = new Box
|
|
||||||
{
|
|
||||||
Anchor = Anchor.CentreRight,
|
|
||||||
Origin = Anchor.CentreRight,
|
|
||||||
RelativeSizeAxes = Axes.Y,
|
|
||||||
Width = box_width,
|
|
||||||
Alpha = 0,
|
|
||||||
Blending = BlendingMode.Additive,
|
|
||||||
}
|
|
||||||
};
|
|
||||||
}
|
}
|
||||||
|
|
||||||
[BackgroundDependencyLoader]
|
[BackgroundDependencyLoader]
|
||||||
@ -72,10 +51,34 @@ namespace osu.Game.Screens.Menu
|
|||||||
|
|
||||||
// linear colour looks better in this case, so let's use it for now.
|
// linear colour looks better in this case, so let's use it for now.
|
||||||
Color4 gradientDark = colours.Blue.Opacity(0).ToLinear();
|
Color4 gradientDark = colours.Blue.Opacity(0).ToLinear();
|
||||||
Color4 gradientLight = colours.Blue.Opacity(0.3f).ToLinear();
|
Color4 gradientLight = colours.Blue.Opacity(0.6f).ToLinear();
|
||||||
|
|
||||||
leftBox.Colour = ColourInfo.GradientHorizontal(gradientLight, gradientDark);
|
Children = new Drawable[]
|
||||||
rightBox.Colour = ColourInfo.GradientHorizontal(gradientDark, gradientLight);
|
{
|
||||||
|
leftBox = new Box
|
||||||
|
{
|
||||||
|
Anchor = Anchor.CentreLeft,
|
||||||
|
Origin = Anchor.CentreLeft,
|
||||||
|
RelativeSizeAxes = Axes.Y,
|
||||||
|
Width = box_width * 2,
|
||||||
|
// align off-screen to make sure our edges don't become visible during parallax.
|
||||||
|
X = -box_width,
|
||||||
|
Alpha = 0,
|
||||||
|
Blending = BlendingMode.Additive,
|
||||||
|
Colour = ColourInfo.GradientHorizontal(gradientLight, gradientDark)
|
||||||
|
},
|
||||||
|
rightBox = new Box
|
||||||
|
{
|
||||||
|
Anchor = Anchor.CentreRight,
|
||||||
|
Origin = Anchor.CentreRight,
|
||||||
|
RelativeSizeAxes = Axes.Y,
|
||||||
|
Width = box_width * 2,
|
||||||
|
X = box_width,
|
||||||
|
Alpha = 0,
|
||||||
|
Blending = BlendingMode.Additive,
|
||||||
|
Colour = ColourInfo.GradientHorizontal(gradientDark, gradientLight)
|
||||||
|
}
|
||||||
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override void OnNewBeat(int beatIndex, TimingControlPoint timingPoint, EffectControlPoint effectPoint, TrackAmplitudes amplitudes)
|
protected override void OnNewBeat(int beatIndex, TimingControlPoint timingPoint, EffectControlPoint effectPoint, TrackAmplitudes amplitudes)
|
||||||
|
@ -64,6 +64,8 @@ namespace osu.Game.Screens.Menu
|
|||||||
set { colourAndTriangles.FadeTo(value ? 1 : 0, transition_length, Easing.OutQuint); }
|
set { colourAndTriangles.FadeTo(value ? 1 : 0, transition_length, Easing.OutQuint); }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public bool BeatMatching = true;
|
||||||
|
|
||||||
public override bool ReceiveMouseInputAt(Vector2 screenSpacePos) => logoContainer.ReceiveMouseInputAt(screenSpacePos);
|
public override bool ReceiveMouseInputAt(Vector2 screenSpacePos) => logoContainer.ReceiveMouseInputAt(screenSpacePos);
|
||||||
|
|
||||||
public bool Ripple
|
public bool Ripple
|
||||||
@ -264,6 +266,8 @@ namespace osu.Game.Screens.Menu
|
|||||||
{
|
{
|
||||||
base.OnNewBeat(beatIndex, timingPoint, effectPoint, amplitudes);
|
base.OnNewBeat(beatIndex, timingPoint, effectPoint, amplitudes);
|
||||||
|
|
||||||
|
if (!BeatMatching) return;
|
||||||
|
|
||||||
lastBeatIndex = beatIndex;
|
lastBeatIndex = beatIndex;
|
||||||
|
|
||||||
var beatLength = timingPoint.BeatLength;
|
var beatLength = timingPoint.BeatLength;
|
||||||
|
@ -225,6 +225,7 @@ namespace osu.Game.Screens
|
|||||||
logo.Anchor = Anchor.TopLeft;
|
logo.Anchor = Anchor.TopLeft;
|
||||||
logo.Origin = Anchor.Centre;
|
logo.Origin = Anchor.Centre;
|
||||||
logo.RelativePositionAxes = Axes.None;
|
logo.RelativePositionAxes = Axes.None;
|
||||||
|
logo.BeatMatching = true;
|
||||||
logo.Triangles = true;
|
logo.Triangles = true;
|
||||||
logo.Ripple = true;
|
logo.Ripple = true;
|
||||||
}
|
}
|
||||||
|
@ -6,7 +6,6 @@ using OpenTK.Graphics;
|
|||||||
using osu.Framework.Allocation;
|
using osu.Framework.Allocation;
|
||||||
using osu.Framework.Graphics;
|
using osu.Framework.Graphics;
|
||||||
using osu.Framework.Graphics.Containers;
|
using osu.Framework.Graphics.Containers;
|
||||||
using osu.Game.Graphics;
|
|
||||||
using osu.Game.Graphics.Sprites;
|
using osu.Game.Graphics.Sprites;
|
||||||
using osu.Game.Graphics.UserInterface;
|
using osu.Game.Graphics.UserInterface;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
@ -120,14 +119,8 @@ namespace osu.Game.Screens.Select
|
|||||||
Margin = new MarginPadding { Top = spacing * 2 },
|
Margin = new MarginPadding { Top = spacing * 2 },
|
||||||
Children = new[]
|
Children = new[]
|
||||||
{
|
{
|
||||||
description = new MetadataSection("Description")
|
description = new MetadataSection("Description"),
|
||||||
{
|
source = new MetadataSection("Source"),
|
||||||
TextColour = Color4.White.Opacity(0.75f),
|
|
||||||
},
|
|
||||||
source = new MetadataSection("Source")
|
|
||||||
{
|
|
||||||
TextColour = Color4.White.Opacity(0.75f),
|
|
||||||
},
|
|
||||||
tags = new MetadataSection("Tags"),
|
tags = new MetadataSection("Tags"),
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
@ -164,10 +157,9 @@ namespace osu.Game.Screens.Select
|
|||||||
}
|
}
|
||||||
|
|
||||||
[BackgroundDependencyLoader]
|
[BackgroundDependencyLoader]
|
||||||
private void load(OsuColour colours, APIAccess api)
|
private void load(APIAccess api)
|
||||||
{
|
{
|
||||||
this.api = api;
|
this.api = api;
|
||||||
tags.TextColour = colours.Yellow;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override void UpdateAfterChildren()
|
protected override void UpdateAfterChildren()
|
||||||
@ -364,7 +356,7 @@ namespace osu.Game.Screens.Select
|
|||||||
{
|
{
|
||||||
RelativeSizeAxes = Axes.X,
|
RelativeSizeAxes = Axes.X,
|
||||||
AutoSizeAxes = Axes.Y,
|
AutoSizeAxes = Axes.Y,
|
||||||
Colour = textFlow.Colour,
|
Colour = Color4.White.Opacity(0.75f),
|
||||||
Text = text
|
Text = text
|
||||||
}, loaded =>
|
}, loaded =>
|
||||||
{
|
{
|
||||||
@ -375,12 +367,6 @@ namespace osu.Game.Screens.Select
|
|||||||
this.FadeIn(transition_duration);
|
this.FadeIn(transition_duration);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
public Color4 TextColour
|
|
||||||
{
|
|
||||||
get { return textFlow.Colour; }
|
|
||||||
set { textFlow.Colour = value; }
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private class DimmedLoadingAnimation : VisibilityContainer
|
private class DimmedLoadingAnimation : VisibilityContainer
|
||||||
|
@ -57,7 +57,7 @@ namespace osu.Game.Screens.Select
|
|||||||
{
|
{
|
||||||
if (osuGame != null)
|
if (osuGame != null)
|
||||||
ruleset.BindTo(osuGame.Ruleset);
|
ruleset.BindTo(osuGame.Ruleset);
|
||||||
ruleset.ValueChanged += updateRuleset;
|
ruleset.ValueChanged += _ => updateDisplay();
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override bool BlockPassThroughMouse => false;
|
protected override bool BlockPassThroughMouse => false;
|
||||||
@ -78,66 +78,76 @@ namespace osu.Game.Screens.Select
|
|||||||
|
|
||||||
private WorkingBeatmap beatmap;
|
private WorkingBeatmap beatmap;
|
||||||
|
|
||||||
public void UpdateBeatmap(WorkingBeatmap beatmap)
|
public WorkingBeatmap Beatmap
|
||||||
{
|
{
|
||||||
this.beatmap = beatmap;
|
get => beatmap;
|
||||||
loadBeatmap();
|
set
|
||||||
|
{
|
||||||
|
if (beatmap == value) return;
|
||||||
|
|
||||||
|
beatmap = value;
|
||||||
|
updateDisplay();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void updateRuleset(RulesetInfo ruleset) => loadBeatmap();
|
private BufferedWedgeInfo loadingInfo;
|
||||||
|
|
||||||
private void loadBeatmap()
|
private void updateDisplay()
|
||||||
{
|
{
|
||||||
void updateState()
|
void removeOldInfo()
|
||||||
{
|
{
|
||||||
State = beatmap == null ? Visibility.Hidden : Visibility.Visible;
|
State = beatmap == null ? Visibility.Hidden : Visibility.Visible;
|
||||||
|
|
||||||
Info?.FadeOut(250);
|
Info?.FadeOut(250);
|
||||||
Info?.Expire();
|
Info?.Expire();
|
||||||
|
Info = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (beatmap == null)
|
if (beatmap == null)
|
||||||
{
|
{
|
||||||
updateState();
|
removeOldInfo();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
LoadComponentAsync(new BufferedWedgeInfo(beatmap, ruleset.Value)
|
LoadComponentAsync(loadingInfo = new BufferedWedgeInfo(beatmap, ruleset.Value)
|
||||||
{
|
{
|
||||||
Shear = -Shear,
|
Shear = -Shear,
|
||||||
Depth = Info?.Depth + 1 ?? 0,
|
Depth = Info?.Depth + 1 ?? 0
|
||||||
}, newInfo =>
|
}, loaded =>
|
||||||
{
|
{
|
||||||
updateState();
|
// ensure we are the most recent loaded wedge.
|
||||||
Add(Info = newInfo);
|
if (loaded != loadingInfo) return;
|
||||||
|
|
||||||
|
removeOldInfo();
|
||||||
|
Add(Info = loaded);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
public class BufferedWedgeInfo : BufferedContainer
|
public class BufferedWedgeInfo : BufferedContainer
|
||||||
{
|
{
|
||||||
private readonly WorkingBeatmap working;
|
|
||||||
public OsuSpriteText VersionLabel { get; private set; }
|
public OsuSpriteText VersionLabel { get; private set; }
|
||||||
public OsuSpriteText TitleLabel { get; private set; }
|
public OsuSpriteText TitleLabel { get; private set; }
|
||||||
public OsuSpriteText ArtistLabel { get; private set; }
|
public OsuSpriteText ArtistLabel { get; private set; }
|
||||||
public FillFlowContainer MapperContainer { get; private set; }
|
public FillFlowContainer MapperContainer { get; private set; }
|
||||||
public FillFlowContainer InfoLabelContainer { get; private set; }
|
public FillFlowContainer InfoLabelContainer { get; private set; }
|
||||||
|
|
||||||
private UnicodeBindableString titleBinding;
|
private UnicodeBindableString titleBinding;
|
||||||
private UnicodeBindableString artistBinding;
|
private UnicodeBindableString artistBinding;
|
||||||
|
|
||||||
|
private readonly WorkingBeatmap beatmap;
|
||||||
private readonly RulesetInfo ruleset;
|
private readonly RulesetInfo ruleset;
|
||||||
|
|
||||||
public BufferedWedgeInfo(WorkingBeatmap working, RulesetInfo userRuleset)
|
public BufferedWedgeInfo(WorkingBeatmap beatmap, RulesetInfo userRuleset)
|
||||||
{
|
{
|
||||||
this.working = working;
|
this.beatmap = beatmap;
|
||||||
|
ruleset = userRuleset ?? beatmap.BeatmapInfo.Ruleset;
|
||||||
ruleset = userRuleset ?? working.BeatmapInfo.Ruleset;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
[BackgroundDependencyLoader]
|
[BackgroundDependencyLoader]
|
||||||
private void load(LocalisationEngine localisation)
|
private void load(LocalisationEngine localisation)
|
||||||
{
|
{
|
||||||
var beatmapInfo = working.BeatmapInfo;
|
var beatmapInfo = beatmap.BeatmapInfo;
|
||||||
var metadata = beatmapInfo.Metadata ?? working.BeatmapSetInfo?.Metadata ?? new BeatmapMetadata();
|
var metadata = beatmapInfo.Metadata ?? beatmap.BeatmapSetInfo?.Metadata ?? new BeatmapMetadata();
|
||||||
|
|
||||||
PixelSnapping = true;
|
PixelSnapping = true;
|
||||||
CacheDrawnFrameBuffer = true;
|
CacheDrawnFrameBuffer = true;
|
||||||
@ -165,7 +175,7 @@ namespace osu.Game.Screens.Select
|
|||||||
Children = new[]
|
Children = new[]
|
||||||
{
|
{
|
||||||
// Zoomed-in and cropped beatmap background
|
// Zoomed-in and cropped beatmap background
|
||||||
new BeatmapBackgroundSprite(working)
|
new BeatmapBackgroundSprite(beatmap)
|
||||||
{
|
{
|
||||||
RelativeSizeAxes = Axes.Both,
|
RelativeSizeAxes = Axes.Both,
|
||||||
Anchor = Anchor.Centre,
|
Anchor = Anchor.Centre,
|
||||||
@ -248,27 +258,27 @@ namespace osu.Game.Screens.Select
|
|||||||
|
|
||||||
private InfoLabel[] getInfoLabels()
|
private InfoLabel[] getInfoLabels()
|
||||||
{
|
{
|
||||||
var beatmap = working.Beatmap;
|
var b = beatmap.Beatmap;
|
||||||
|
|
||||||
List<InfoLabel> labels = new List<InfoLabel>();
|
List<InfoLabel> labels = new List<InfoLabel>();
|
||||||
|
|
||||||
if (beatmap?.HitObjects?.Any() == true)
|
if (b?.HitObjects?.Any() == true)
|
||||||
{
|
{
|
||||||
HitObject lastObject = beatmap.HitObjects.LastOrDefault();
|
HitObject lastObject = b.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 = TimeSpan.FromMilliseconds(endTime - beatmap.HitObjects.First().StartTime).ToString(@"m\:ss"),
|
Content = TimeSpan.FromMilliseconds(endTime - b.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),
|
Content = getBPMRange(b),
|
||||||
}));
|
}));
|
||||||
|
|
||||||
IBeatmap playableBeatmap;
|
IBeatmap playableBeatmap;
|
||||||
@ -276,12 +286,12 @@ namespace osu.Game.Screens.Select
|
|||||||
try
|
try
|
||||||
{
|
{
|
||||||
// Try to get the beatmap with the user's ruleset
|
// Try to get the beatmap with the user's ruleset
|
||||||
playableBeatmap = working.GetPlayableBeatmap(ruleset);
|
playableBeatmap = beatmap.GetPlayableBeatmap(ruleset);
|
||||||
}
|
}
|
||||||
catch (BeatmapInvalidForRulesetException)
|
catch (BeatmapInvalidForRulesetException)
|
||||||
{
|
{
|
||||||
// Can't be converted to the user's ruleset, so use the beatmap's own ruleset
|
// Can't be converted to the user's ruleset, so use the beatmap's own ruleset
|
||||||
playableBeatmap = working.GetPlayableBeatmap(working.BeatmapInfo.Ruleset);
|
playableBeatmap = beatmap.GetPlayableBeatmap(beatmap.BeatmapInfo.Ruleset);
|
||||||
}
|
}
|
||||||
|
|
||||||
labels.AddRange(playableBeatmap.GetStatistics().Select(s => new InfoLabel(s)));
|
labels.AddRange(playableBeatmap.GetStatistics().Select(s => new InfoLabel(s)));
|
||||||
|
@ -8,6 +8,7 @@ using osu.Framework.Allocation;
|
|||||||
using osu.Framework.Extensions.Color4Extensions;
|
using osu.Framework.Extensions.Color4Extensions;
|
||||||
using osu.Framework.Graphics;
|
using osu.Framework.Graphics;
|
||||||
using osu.Framework.Graphics.Containers;
|
using osu.Framework.Graphics.Containers;
|
||||||
|
using osu.Framework.Graphics.Cursor;
|
||||||
using osu.Framework.Graphics.Shapes;
|
using osu.Framework.Graphics.Shapes;
|
||||||
using osu.Framework.Input;
|
using osu.Framework.Input;
|
||||||
using osu.Game.Graphics;
|
using osu.Game.Graphics;
|
||||||
@ -142,6 +143,8 @@ namespace osu.Game.Screens.Select.Leaderboards
|
|||||||
{
|
{
|
||||||
flagBadgeContainer = new Container
|
flagBadgeContainer = new Container
|
||||||
{
|
{
|
||||||
|
Origin = Anchor.BottomLeft,
|
||||||
|
Anchor = Anchor.BottomLeft,
|
||||||
Size = new Vector2(87f, 20f),
|
Size = new Vector2(87f, 20f),
|
||||||
Masking = true,
|
Masking = true,
|
||||||
Children = new Drawable[]
|
Children = new Drawable[]
|
||||||
@ -155,14 +158,16 @@ namespace osu.Game.Screens.Select.Leaderboards
|
|||||||
},
|
},
|
||||||
new FillFlowContainer
|
new FillFlowContainer
|
||||||
{
|
{
|
||||||
|
Origin = Anchor.BottomLeft,
|
||||||
|
Anchor = Anchor.BottomLeft,
|
||||||
AutoSizeAxes = Axes.Both,
|
AutoSizeAxes = Axes.Both,
|
||||||
Direction = FillDirection.Horizontal,
|
Direction = FillDirection.Horizontal,
|
||||||
Spacing = new Vector2(10f, 0f),
|
Spacing = new Vector2(10f, 0f),
|
||||||
Margin = new MarginPadding { Left = edge_margin, },
|
Margin = new MarginPadding { Left = edge_margin },
|
||||||
Children = new Drawable[]
|
Children = new Drawable[]
|
||||||
{
|
{
|
||||||
maxCombo = new ScoreComponentLabel(FontAwesome.fa_link, Score.MaxCombo.ToString()),
|
maxCombo = new ScoreComponentLabel(FontAwesome.fa_link, Score.MaxCombo.ToString(), "Max Combo"),
|
||||||
accuracy = new ScoreComponentLabel(FontAwesome.fa_crosshairs, string.Format(Score.Accuracy % 1 == 0 ? @"{0:P0}" : @"{0:P2}", Score.Accuracy)),
|
accuracy = new ScoreComponentLabel(FontAwesome.fa_crosshairs, string.Format(Score.Accuracy % 1 == 0 ? @"{0:P0}" : @"{0:P2}", Score.Accuracy), "Accuracy"),
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
@ -305,37 +310,61 @@ namespace osu.Game.Screens.Select.Leaderboards
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private class ScoreComponentLabel : Container
|
private class ScoreComponentLabel : Container, IHasTooltip
|
||||||
{
|
{
|
||||||
public ScoreComponentLabel(FontAwesome icon, string value)
|
private const float icon_size = 20;
|
||||||
{
|
|
||||||
Anchor = Anchor.CentreLeft;
|
|
||||||
Origin = Anchor.CentreLeft;
|
|
||||||
Size = new Vector2(60f, 20f);
|
|
||||||
Padding = new MarginPadding { Top = 10f, };
|
|
||||||
|
|
||||||
|
private readonly string name;
|
||||||
|
private readonly FillFlowContainer content;
|
||||||
|
|
||||||
|
public override bool Contains(Vector2 screenSpacePos) => content.Contains(screenSpacePos);
|
||||||
|
|
||||||
|
public string TooltipText => name;
|
||||||
|
|
||||||
|
public ScoreComponentLabel(FontAwesome icon, string value, string name)
|
||||||
|
{
|
||||||
|
this.name = name;
|
||||||
|
AutoSizeAxes = Axes.Y;
|
||||||
|
Width = 60;
|
||||||
|
|
||||||
|
Child = content = new FillFlowContainer
|
||||||
|
{
|
||||||
|
AutoSizeAxes = Axes.Both,
|
||||||
|
Direction = FillDirection.Horizontal,
|
||||||
Children = new Drawable[]
|
Children = new Drawable[]
|
||||||
|
{
|
||||||
|
new Container
|
||||||
|
{
|
||||||
|
Anchor = Anchor.CentreLeft,
|
||||||
|
Origin = Anchor.CentreLeft,
|
||||||
|
AutoSizeAxes = Axes.Both,
|
||||||
|
Children = new[]
|
||||||
{
|
{
|
||||||
new SpriteIcon
|
new SpriteIcon
|
||||||
{
|
{
|
||||||
|
Anchor = Anchor.Centre,
|
||||||
Origin = Anchor.Centre,
|
Origin = Anchor.Centre,
|
||||||
Icon = FontAwesome.fa_square,
|
Size = new Vector2(icon_size),
|
||||||
Colour = OsuColour.FromHex(@"3087ac"),
|
|
||||||
Rotation = 45,
|
Rotation = 45,
|
||||||
Size = new Vector2(20),
|
Colour = OsuColour.FromHex(@"3087ac"),
|
||||||
|
Icon = FontAwesome.fa_square,
|
||||||
Shadow = true,
|
Shadow = true,
|
||||||
},
|
},
|
||||||
new SpriteIcon
|
new SpriteIcon
|
||||||
{
|
{
|
||||||
|
Anchor = Anchor.Centre,
|
||||||
Origin = Anchor.Centre,
|
Origin = Anchor.Centre,
|
||||||
Icon = icon,
|
Size = new Vector2(icon_size - 6),
|
||||||
Colour = OsuColour.FromHex(@"a4edff"),
|
Colour = OsuColour.FromHex(@"a4edff"),
|
||||||
Size = new Vector2(14),
|
Icon = icon,
|
||||||
|
},
|
||||||
|
},
|
||||||
},
|
},
|
||||||
new GlowingSpriteText(value, @"Exo2.0-Bold", 17, Color4.White, OsuColour.FromHex(@"83ccfa"))
|
new GlowingSpriteText(value, @"Exo2.0-Bold", 17, Color4.White, OsuColour.FromHex(@"83ccfa"))
|
||||||
{
|
{
|
||||||
|
Anchor = Anchor.CentreLeft,
|
||||||
Origin = Anchor.CentreLeft,
|
Origin = Anchor.CentreLeft,
|
||||||
Margin = new MarginPadding { Left = 15, },
|
},
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
@ -430,7 +430,7 @@ namespace osu.Game.Screens.Select
|
|||||||
backgroundModeBeatmap.FadeTo(1, 250);
|
backgroundModeBeatmap.FadeTo(1, 250);
|
||||||
}
|
}
|
||||||
|
|
||||||
beatmapInfoWedge.UpdateBeatmap(beatmap);
|
beatmapInfoWedge.Beatmap = beatmap;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void ensurePlayingSelected(bool preview = false)
|
private void ensurePlayingSelected(bool preview = false)
|
||||||
|
Loading…
Reference in New Issue
Block a user