mirror of
https://github.com/ppy/osu.git
synced 2024-12-14 10:12:54 +08:00
Merge branch 'master' into fix-rewind-bug
This commit is contained in:
commit
cabb4dfaa8
@ -7,12 +7,15 @@ using NUnit.Framework;
|
|||||||
using osu.Framework.Allocation;
|
using osu.Framework.Allocation;
|
||||||
using osu.Framework.Extensions.IEnumerableExtensions;
|
using osu.Framework.Extensions.IEnumerableExtensions;
|
||||||
using osu.Framework.Graphics;
|
using osu.Framework.Graphics;
|
||||||
|
using osu.Framework.Graphics.Shapes;
|
||||||
using osu.Framework.Testing;
|
using osu.Framework.Testing;
|
||||||
|
using osu.Framework.Utils;
|
||||||
using osu.Game.Rulesets.Osu;
|
using osu.Game.Rulesets.Osu;
|
||||||
using osu.Game.Rulesets.UI;
|
using osu.Game.Rulesets.UI;
|
||||||
using osu.Game.Screens.Play;
|
using osu.Game.Screens.Play;
|
||||||
using osu.Game.Screens.Play.HUD;
|
using osu.Game.Screens.Play.HUD;
|
||||||
using osu.Game.Skinning;
|
using osu.Game.Skinning;
|
||||||
|
using osuTK.Graphics;
|
||||||
|
|
||||||
namespace osu.Game.Tests.Visual.Gameplay
|
namespace osu.Game.Tests.Visual.Gameplay
|
||||||
{
|
{
|
||||||
@ -21,6 +24,8 @@ namespace osu.Game.Tests.Visual.Gameplay
|
|||||||
{
|
{
|
||||||
private GameplayClockContainer gameplayClockContainer = null!;
|
private GameplayClockContainer gameplayClockContainer = null!;
|
||||||
|
|
||||||
|
private Box background = null!;
|
||||||
|
|
||||||
private const double skip_target_time = -2000;
|
private const double skip_target_time = -2000;
|
||||||
|
|
||||||
[BackgroundDependencyLoader]
|
[BackgroundDependencyLoader]
|
||||||
@ -30,11 +35,20 @@ namespace osu.Game.Tests.Visual.Gameplay
|
|||||||
|
|
||||||
FrameStabilityContainer frameStabilityContainer;
|
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);
|
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);
|
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) =>
|
private void applyToArgonProgress(Action<ArgonSongProgress> action) =>
|
||||||
this.ChildrenOfType<ArgonSongProgress>().ForEach(action);
|
this.ChildrenOfType<ArgonSongProgress>().ForEach(action);
|
||||||
|
|
||||||
|
@ -95,7 +95,6 @@ namespace osu.Game.Screens.Play.HUD
|
|||||||
private void updateGraphVisibility()
|
private void updateGraphVisibility()
|
||||||
{
|
{
|
||||||
graph.FadeTo(ShowGraph.Value ? 1 : 0, 200, Easing.In);
|
graph.FadeTo(ShowGraph.Value ? 1 : 0, 200, Easing.In);
|
||||||
bar.ShowBackground = !ShowGraph.Value;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override void Update()
|
protected override void Update()
|
||||||
|
@ -14,7 +14,6 @@ using osu.Framework.Threading;
|
|||||||
using osu.Framework.Utils;
|
using osu.Framework.Utils;
|
||||||
using osu.Game.Graphics;
|
using osu.Game.Graphics;
|
||||||
using osuTK;
|
using osuTK;
|
||||||
using osuTK.Graphics;
|
|
||||||
|
|
||||||
namespace osu.Game.Screens.Play.HUD
|
namespace osu.Game.Screens.Play.HUD
|
||||||
{
|
{
|
||||||
@ -32,18 +31,8 @@ namespace osu.Game.Screens.Play.HUD
|
|||||||
|
|
||||||
private readonly Box background;
|
private readonly Box background;
|
||||||
|
|
||||||
private readonly BindableBool showBackground = new BindableBool();
|
|
||||||
|
|
||||||
private readonly ColourInfo mainColour;
|
private readonly ColourInfo mainColour;
|
||||||
private readonly ColourInfo mainColourDarkened;
|
|
||||||
private ColourInfo catchUpColour;
|
private ColourInfo catchUpColour;
|
||||||
private ColourInfo catchUpColourDarkened;
|
|
||||||
|
|
||||||
public bool ShowBackground
|
|
||||||
{
|
|
||||||
get => showBackground.Value;
|
|
||||||
set => showBackground.Value = value;
|
|
||||||
}
|
|
||||||
|
|
||||||
public double StartTime
|
public double StartTime
|
||||||
{
|
{
|
||||||
@ -95,7 +84,7 @@ namespace osu.Game.Screens.Play.HUD
|
|||||||
{
|
{
|
||||||
RelativeSizeAxes = Axes.Both,
|
RelativeSizeAxes = Axes.Both,
|
||||||
Alpha = 0,
|
Alpha = 0,
|
||||||
Colour = Colour4.White.Darken(1 + 1 / 4f)
|
Colour = OsuColour.Gray(0.2f),
|
||||||
},
|
},
|
||||||
catchupBar = new RoundedBar
|
catchupBar = new RoundedBar
|
||||||
{
|
{
|
||||||
@ -112,12 +101,10 @@ namespace osu.Game.Screens.Play.HUD
|
|||||||
Anchor = Anchor.BottomLeft,
|
Anchor = Anchor.BottomLeft,
|
||||||
Origin = Anchor.BottomLeft,
|
Origin = Anchor.BottomLeft,
|
||||||
CornerRadius = 5,
|
CornerRadius = 5,
|
||||||
AccentColour = mainColour = Color4.White,
|
AccentColour = mainColour = OsuColour.Gray(0.9f),
|
||||||
RelativeSizeAxes = Axes.Both
|
RelativeSizeAxes = Axes.Both
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
mainColourDarkened = Colour4.White.Darken(1 / 3f);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void setupAlternateValue()
|
private void setupAlternateValue()
|
||||||
@ -141,16 +128,15 @@ namespace osu.Game.Screens.Play.HUD
|
|||||||
[BackgroundDependencyLoader]
|
[BackgroundDependencyLoader]
|
||||||
private void load(OsuColour colours)
|
private void load(OsuColour colours)
|
||||||
{
|
{
|
||||||
catchUpColour = colours.BlueLight;
|
catchUpColour = colours.BlueDark;
|
||||||
catchUpColourDarkened = colours.BlueDark;
|
|
||||||
|
|
||||||
showBackground.BindValueChanged(_ => updateBackground(), true);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void updateBackground()
|
protected override void LoadComplete()
|
||||||
{
|
{
|
||||||
background.FadeTo(showBackground.Value ? 1 / 4f : 0, 200, Easing.In);
|
base.LoadComplete();
|
||||||
playfieldBar.TransformTo(nameof(playfieldBar.AccentColour), ShowBackground ? mainColour : mainColourDarkened, 200, Easing.In);
|
|
||||||
|
background.FadeTo(0.3f, 200, Easing.In);
|
||||||
|
playfieldBar.TransformTo(nameof(playfieldBar.AccentColour), mainColour, 200, Easing.In);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override bool OnHover(HoverEvent e)
|
protected override bool OnHover(HoverEvent e)
|
||||||
@ -190,8 +176,8 @@ namespace osu.Game.Screens.Play.HUD
|
|||||||
|
|
||||||
catchupBar.AccentColour = Interpolation.ValueAt(
|
catchupBar.AccentColour = Interpolation.ValueAt(
|
||||||
Math.Min(timeDelta, colour_transition_threshold),
|
Math.Min(timeDelta, colour_transition_threshold),
|
||||||
ShowBackground ? mainColour : mainColourDarkened,
|
mainColour,
|
||||||
ShowBackground ? catchUpColour : catchUpColourDarkened,
|
catchUpColour,
|
||||||
0, colour_transition_threshold,
|
0, colour_transition_threshold,
|
||||||
Easing.OutQuint);
|
Easing.OutQuint);
|
||||||
|
|
||||||
|
@ -4,8 +4,10 @@
|
|||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Diagnostics;
|
using System.Diagnostics;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
|
using osu.Framework.Extensions.Color4Extensions;
|
||||||
using osu.Framework.Graphics;
|
using osu.Framework.Graphics;
|
||||||
using osu.Game.Beatmaps;
|
using osu.Game.Beatmaps;
|
||||||
|
using osu.Game.Graphics;
|
||||||
using osu.Game.Rulesets.Objects;
|
using osu.Game.Rulesets.Objects;
|
||||||
using osu.Game.Graphics.UserInterface;
|
using osu.Game.Graphics.UserInterface;
|
||||||
|
|
||||||
@ -13,6 +15,10 @@ namespace osu.Game.Screens.Play.HUD
|
|||||||
{
|
{
|
||||||
public partial class ArgonSongProgressGraph : SegmentedGraph<int>
|
public partial class ArgonSongProgressGraph : SegmentedGraph<int>
|
||||||
{
|
{
|
||||||
|
private const int tier_count = 5;
|
||||||
|
|
||||||
|
private const int display_granularity = 200;
|
||||||
|
|
||||||
private IEnumerable<HitObject>? objects;
|
private IEnumerable<HitObject>? objects;
|
||||||
|
|
||||||
public IEnumerable<HitObject> Objects
|
public IEnumerable<HitObject> Objects
|
||||||
@ -21,8 +27,7 @@ namespace osu.Game.Screens.Play.HUD
|
|||||||
{
|
{
|
||||||
objects = value;
|
objects = value;
|
||||||
|
|
||||||
const int granularity = 200;
|
int[] values = new int[display_granularity];
|
||||||
int[] values = new int[granularity];
|
|
||||||
|
|
||||||
if (!objects.Any())
|
if (!objects.Any())
|
||||||
return;
|
return;
|
||||||
@ -32,7 +37,7 @@ namespace osu.Game.Screens.Play.HUD
|
|||||||
if (lastHit == 0)
|
if (lastHit == 0)
|
||||||
lastHit = objects.Last().StartTime;
|
lastHit = objects.Last().StartTime;
|
||||||
|
|
||||||
double interval = (lastHit - firstHit + 1) / granularity;
|
double interval = (lastHit - firstHit + 1) / display_granularity;
|
||||||
|
|
||||||
foreach (var h in objects)
|
foreach (var h in objects)
|
||||||
{
|
{
|
||||||
@ -51,12 +56,12 @@ namespace osu.Game.Screens.Play.HUD
|
|||||||
}
|
}
|
||||||
|
|
||||||
public ArgonSongProgressGraph()
|
public ArgonSongProgressGraph()
|
||||||
: base(5)
|
: base(tier_count)
|
||||||
{
|
{
|
||||||
var colours = new List<Colour4>();
|
var colours = new List<Colour4>();
|
||||||
|
|
||||||
for (int i = 0; i < 5; i++)
|
for (int i = 0; i < tier_count; i++)
|
||||||
colours.Add(Colour4.White.Darken(1 + 1 / 5f).Opacity(1 / 5f));
|
colours.Add(OsuColour.Gray(0.2f).Opacity(0.1f));
|
||||||
|
|
||||||
TierColours = colours;
|
TierColours = colours;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user