mirror of
https://github.com/ppy/osu.git
synced 2025-01-13 14:12:56 +08:00
Merge branch 'master' into hud/kc-skinnable
This commit is contained in:
commit
aba8219d06
@ -15,7 +15,7 @@
|
||||
]
|
||||
},
|
||||
"codefilesanity": {
|
||||
"version": "0.0.36",
|
||||
"version": "0.0.37",
|
||||
"commands": [
|
||||
"CodeFileSanity"
|
||||
]
|
||||
|
@ -7,12 +7,15 @@ using NUnit.Framework;
|
||||
using osu.Framework.Allocation;
|
||||
using osu.Framework.Extensions.IEnumerableExtensions;
|
||||
using osu.Framework.Graphics;
|
||||
using osu.Framework.Graphics.Shapes;
|
||||
using osu.Framework.Testing;
|
||||
using osu.Framework.Utils;
|
||||
using osu.Game.Rulesets.Osu;
|
||||
using osu.Game.Rulesets.UI;
|
||||
using osu.Game.Screens.Play;
|
||||
using osu.Game.Screens.Play.HUD;
|
||||
using osu.Game.Skinning;
|
||||
using osuTK.Graphics;
|
||||
|
||||
namespace osu.Game.Tests.Visual.Gameplay
|
||||
{
|
||||
@ -21,6 +24,8 @@ namespace osu.Game.Tests.Visual.Gameplay
|
||||
{
|
||||
private GameplayClockContainer gameplayClockContainer = null!;
|
||||
|
||||
private Box background = null!;
|
||||
|
||||
private const double skip_target_time = -2000;
|
||||
|
||||
[BackgroundDependencyLoader]
|
||||
@ -30,11 +35,20 @@ namespace osu.Game.Tests.Visual.Gameplay
|
||||
|
||||
FrameStabilityContainer frameStabilityContainer;
|
||||
|
||||
Add(gameplayClockContainer = new MasterGameplayClockContainer(Beatmap.Value, skip_target_time)
|
||||
AddRange(new Drawable[]
|
||||
{
|
||||
Child = frameStabilityContainer = new FrameStabilityContainer
|
||||
background = new Box
|
||||
{
|
||||
MaxCatchUpFrames = 1
|
||||
Colour = Color4.Black,
|
||||
RelativeSizeAxes = Axes.Both,
|
||||
Depth = float.MaxValue
|
||||
},
|
||||
gameplayClockContainer = new MasterGameplayClockContainer(Beatmap.Value, skip_target_time)
|
||||
{
|
||||
Child = frameStabilityContainer = new FrameStabilityContainer
|
||||
{
|
||||
MaxCatchUpFrames = 1
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
@ -71,9 +85,20 @@ namespace osu.Game.Tests.Visual.Gameplay
|
||||
applyToArgonProgress(s => s.ShowGraph.Value = b);
|
||||
});
|
||||
|
||||
AddStep("set white background", () => background.FadeColour(Color4.White, 200, Easing.OutQuint));
|
||||
AddStep("randomise background colour", () => background.FadeColour(new Colour4(RNG.NextSingle(), RNG.NextSingle(), RNG.NextSingle(), 1), 200, Easing.OutQuint));
|
||||
|
||||
AddStep("stop", gameplayClockContainer.Stop);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void TestSeekToKnownTime()
|
||||
{
|
||||
AddStep("seek to known time", () => gameplayClockContainer.Seek(60000));
|
||||
AddWaitStep("wait some for seek", 15);
|
||||
AddStep("stop", () => gameplayClockContainer.Stop());
|
||||
}
|
||||
|
||||
private void applyToArgonProgress(Action<ArgonSongProgress> action) =>
|
||||
this.ChildrenOfType<ArgonSongProgress>().ForEach(action);
|
||||
|
||||
|
@ -453,6 +453,25 @@ namespace osu.Game.Tests.Visual.SongSelect
|
||||
AddStep("Un-filter", () => carousel.Filter(new FilterCriteria(), false));
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void TestRewindToDeletedBeatmap()
|
||||
{
|
||||
loadBeatmaps();
|
||||
|
||||
var firstAdded = TestResources.CreateTestBeatmapSetInfo();
|
||||
|
||||
AddStep("add new set", () => carousel.UpdateBeatmapSet(firstAdded));
|
||||
AddStep("select set", () => carousel.SelectBeatmap(firstAdded.Beatmaps.First()));
|
||||
|
||||
nextRandom();
|
||||
|
||||
AddStep("delete set", () => carousel.RemoveBeatmapSet(firstAdded));
|
||||
|
||||
prevRandom();
|
||||
|
||||
AddAssert("deleted set not selected", () => carousel.SelectedBeatmapSet?.Equals(firstAdded) == false);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Test adding and removing beatmap sets
|
||||
/// </summary>
|
||||
|
@ -95,7 +95,6 @@ namespace osu.Game.Screens.Play.HUD
|
||||
private void updateGraphVisibility()
|
||||
{
|
||||
graph.FadeTo(ShowGraph.Value ? 1 : 0, 200, Easing.In);
|
||||
bar.ShowBackground = !ShowGraph.Value;
|
||||
}
|
||||
|
||||
protected override void Update()
|
||||
|
@ -14,7 +14,6 @@ using osu.Framework.Threading;
|
||||
using osu.Framework.Utils;
|
||||
using osu.Game.Graphics;
|
||||
using osuTK;
|
||||
using osuTK.Graphics;
|
||||
|
||||
namespace osu.Game.Screens.Play.HUD
|
||||
{
|
||||
@ -32,18 +31,8 @@ namespace osu.Game.Screens.Play.HUD
|
||||
|
||||
private readonly Box background;
|
||||
|
||||
private readonly BindableBool showBackground = new BindableBool();
|
||||
|
||||
private readonly ColourInfo mainColour;
|
||||
private readonly ColourInfo mainColourDarkened;
|
||||
private ColourInfo catchUpColour;
|
||||
private ColourInfo catchUpColourDarkened;
|
||||
|
||||
public bool ShowBackground
|
||||
{
|
||||
get => showBackground.Value;
|
||||
set => showBackground.Value = value;
|
||||
}
|
||||
|
||||
public double StartTime
|
||||
{
|
||||
@ -95,7 +84,7 @@ namespace osu.Game.Screens.Play.HUD
|
||||
{
|
||||
RelativeSizeAxes = Axes.Both,
|
||||
Alpha = 0,
|
||||
Colour = Colour4.White.Darken(1 + 1 / 4f)
|
||||
Colour = OsuColour.Gray(0.2f),
|
||||
},
|
||||
catchupBar = new RoundedBar
|
||||
{
|
||||
@ -112,12 +101,10 @@ namespace osu.Game.Screens.Play.HUD
|
||||
Anchor = Anchor.BottomLeft,
|
||||
Origin = Anchor.BottomLeft,
|
||||
CornerRadius = 5,
|
||||
AccentColour = mainColour = Color4.White,
|
||||
AccentColour = mainColour = OsuColour.Gray(0.9f),
|
||||
RelativeSizeAxes = Axes.Both
|
||||
},
|
||||
};
|
||||
|
||||
mainColourDarkened = Colour4.White.Darken(1 / 3f);
|
||||
}
|
||||
|
||||
private void setupAlternateValue()
|
||||
@ -141,16 +128,15 @@ namespace osu.Game.Screens.Play.HUD
|
||||
[BackgroundDependencyLoader]
|
||||
private void load(OsuColour colours)
|
||||
{
|
||||
catchUpColour = colours.BlueLight;
|
||||
catchUpColourDarkened = colours.BlueDark;
|
||||
|
||||
showBackground.BindValueChanged(_ => updateBackground(), true);
|
||||
catchUpColour = colours.BlueDark;
|
||||
}
|
||||
|
||||
private void updateBackground()
|
||||
protected override void LoadComplete()
|
||||
{
|
||||
background.FadeTo(showBackground.Value ? 1 / 4f : 0, 200, Easing.In);
|
||||
playfieldBar.TransformTo(nameof(playfieldBar.AccentColour), ShowBackground ? mainColour : mainColourDarkened, 200, Easing.In);
|
||||
base.LoadComplete();
|
||||
|
||||
background.FadeTo(0.3f, 200, Easing.In);
|
||||
playfieldBar.TransformTo(nameof(playfieldBar.AccentColour), mainColour, 200, Easing.In);
|
||||
}
|
||||
|
||||
protected override bool OnHover(HoverEvent e)
|
||||
@ -190,8 +176,8 @@ namespace osu.Game.Screens.Play.HUD
|
||||
|
||||
catchupBar.AccentColour = Interpolation.ValueAt(
|
||||
Math.Min(timeDelta, colour_transition_threshold),
|
||||
ShowBackground ? mainColour : mainColourDarkened,
|
||||
ShowBackground ? catchUpColour : catchUpColourDarkened,
|
||||
mainColour,
|
||||
catchUpColour,
|
||||
0, colour_transition_threshold,
|
||||
Easing.OutQuint);
|
||||
|
||||
|
@ -4,8 +4,10 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics;
|
||||
using System.Linq;
|
||||
using osu.Framework.Extensions.Color4Extensions;
|
||||
using osu.Framework.Graphics;
|
||||
using osu.Game.Beatmaps;
|
||||
using osu.Game.Graphics;
|
||||
using osu.Game.Rulesets.Objects;
|
||||
using osu.Game.Graphics.UserInterface;
|
||||
|
||||
@ -13,6 +15,10 @@ namespace osu.Game.Screens.Play.HUD
|
||||
{
|
||||
public partial class ArgonSongProgressGraph : SegmentedGraph<int>
|
||||
{
|
||||
private const int tier_count = 5;
|
||||
|
||||
private const int display_granularity = 200;
|
||||
|
||||
private IEnumerable<HitObject>? objects;
|
||||
|
||||
public IEnumerable<HitObject> Objects
|
||||
@ -21,8 +27,7 @@ namespace osu.Game.Screens.Play.HUD
|
||||
{
|
||||
objects = value;
|
||||
|
||||
const int granularity = 200;
|
||||
int[] values = new int[granularity];
|
||||
int[] values = new int[display_granularity];
|
||||
|
||||
if (!objects.Any())
|
||||
return;
|
||||
@ -32,7 +37,7 @@ namespace osu.Game.Screens.Play.HUD
|
||||
if (lastHit == 0)
|
||||
lastHit = objects.Last().StartTime;
|
||||
|
||||
double interval = (lastHit - firstHit + 1) / granularity;
|
||||
double interval = (lastHit - firstHit + 1) / display_granularity;
|
||||
|
||||
foreach (var h in objects)
|
||||
{
|
||||
@ -51,12 +56,12 @@ namespace osu.Game.Screens.Play.HUD
|
||||
}
|
||||
|
||||
public ArgonSongProgressGraph()
|
||||
: base(5)
|
||||
: base(tier_count)
|
||||
{
|
||||
var colours = new List<Colour4>();
|
||||
|
||||
for (int i = 0; i < 5; i++)
|
||||
colours.Add(Colour4.White.Darken(1 + 1 / 5f).Opacity(1 / 5f));
|
||||
for (int i = 0; i < tier_count; i++)
|
||||
colours.Add(OsuColour.Gray(0.2f).Opacity(0.1f));
|
||||
|
||||
TierColours = colours;
|
||||
}
|
||||
|
@ -155,7 +155,7 @@ namespace osu.Game.Screens.Select
|
||||
|
||||
public Bindable<RandomSelectAlgorithm> RandomAlgorithm = new Bindable<RandomSelectAlgorithm>();
|
||||
private readonly List<CarouselBeatmapSet> previouslyVisitedRandomSets = new List<CarouselBeatmapSet>();
|
||||
private readonly Stack<CarouselBeatmap> randomSelectedBeatmaps = new Stack<CarouselBeatmap>();
|
||||
private readonly List<CarouselBeatmap> randomSelectedBeatmaps = new List<CarouselBeatmap>();
|
||||
|
||||
private CarouselRoot root;
|
||||
|
||||
@ -348,6 +348,11 @@ namespace osu.Game.Screens.Select
|
||||
if (!root.BeatmapSetsByID.TryGetValue(beatmapSetID, out var existingSet))
|
||||
return;
|
||||
|
||||
foreach (var beatmap in existingSet.Beatmaps)
|
||||
randomSelectedBeatmaps.Remove(beatmap);
|
||||
|
||||
previouslyVisitedRandomSets.Remove(existingSet);
|
||||
|
||||
root.RemoveItem(existingSet);
|
||||
itemsCache.Invalidate();
|
||||
|
||||
@ -501,7 +506,7 @@ namespace osu.Game.Screens.Select
|
||||
|
||||
if (selectedBeatmap != null && selectedBeatmapSet != null)
|
||||
{
|
||||
randomSelectedBeatmaps.Push(selectedBeatmap);
|
||||
randomSelectedBeatmaps.Add(selectedBeatmap);
|
||||
|
||||
// when performing a random, we want to add the current set to the previously visited list
|
||||
// else the user may be "randomised" to the existing selection.
|
||||
@ -538,9 +543,10 @@ namespace osu.Game.Screens.Select
|
||||
{
|
||||
while (randomSelectedBeatmaps.Any())
|
||||
{
|
||||
var beatmap = randomSelectedBeatmaps.Pop();
|
||||
var beatmap = randomSelectedBeatmaps[^1];
|
||||
randomSelectedBeatmaps.Remove(beatmap);
|
||||
|
||||
if (!beatmap.Filtered.Value)
|
||||
if (!beatmap.Filtered.Value && beatmap.BeatmapInfo.BeatmapSet?.DeletePending != true)
|
||||
{
|
||||
if (selectedBeatmapSet != null)
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user