mirror of
https://github.com/ppy/osu.git
synced 2025-01-14 02:22:56 +08:00
refactor(ArgonSongProgress): reorder layering and make density graph visible for past time
This commit is contained in:
parent
66441d4421
commit
d91aa341e5
@ -5,6 +5,7 @@ using System.Collections.Generic;
|
||||
using osu.Framework.Allocation;
|
||||
using osu.Framework.Bindables;
|
||||
using osu.Framework.Graphics;
|
||||
using osu.Framework.Graphics.Containers;
|
||||
using osu.Framework.Timing;
|
||||
using osu.Game.Configuration;
|
||||
using osu.Game.Graphics;
|
||||
@ -18,6 +19,7 @@ namespace osu.Game.Screens.Play.HUD
|
||||
private readonly SongProgressInfo info;
|
||||
private readonly ArgonSongProgressGraph graph;
|
||||
private readonly ArgonSongProgressBar bar;
|
||||
private readonly Container graphContainer;
|
||||
|
||||
private const float bar_height = 10;
|
||||
|
||||
@ -38,6 +40,8 @@ namespace osu.Game.Screens.Play.HUD
|
||||
{
|
||||
Anchor = Anchor.BottomCentre;
|
||||
Origin = Anchor.BottomCentre;
|
||||
Masking = true;
|
||||
CornerRadius = 5;
|
||||
Children = new Drawable[]
|
||||
{
|
||||
info = new SongProgressInfo
|
||||
@ -48,20 +52,27 @@ namespace osu.Game.Screens.Play.HUD
|
||||
RelativeSizeAxes = Axes.X,
|
||||
ShowProgress = false
|
||||
},
|
||||
graph = new ArgonSongProgressGraph
|
||||
{
|
||||
Name = "Difficulty graph",
|
||||
Origin = Anchor.BottomLeft,
|
||||
Anchor = Anchor.BottomLeft,
|
||||
RelativeSizeAxes = Axes.X,
|
||||
},
|
||||
bar = new ArgonSongProgressBar(bar_height)
|
||||
{
|
||||
Name = "Seek bar",
|
||||
Origin = Anchor.BottomLeft,
|
||||
Anchor = Anchor.BottomLeft,
|
||||
OnSeek = time => player?.Seek(time),
|
||||
}
|
||||
},
|
||||
graphContainer = new Container
|
||||
{
|
||||
Anchor = Anchor.BottomLeft,
|
||||
Origin = Anchor.BottomLeft,
|
||||
Masking = true,
|
||||
CornerRadius = 5,
|
||||
Child = graph = new ArgonSongProgressGraph
|
||||
{
|
||||
Name = "Difficulty graph",
|
||||
RelativeSizeAxes = Axes.Both,
|
||||
Blending = BlendingParameters.Additive
|
||||
},
|
||||
RelativeSizeAxes = Axes.X,
|
||||
},
|
||||
};
|
||||
RelativeSizeAxes = Axes.X;
|
||||
}
|
||||
@ -111,7 +122,7 @@ namespace osu.Game.Screens.Play.HUD
|
||||
{
|
||||
base.Update();
|
||||
Height = bar.Height + bar_height + info.Height;
|
||||
graph.Height = bar.Height;
|
||||
graphContainer.Height = bar.Height;
|
||||
}
|
||||
|
||||
protected override void PopIn()
|
||||
|
@ -4,6 +4,7 @@
|
||||
using System;
|
||||
using osu.Framework.Allocation;
|
||||
using osu.Framework.Bindables;
|
||||
using osu.Framework.Extensions.Color4Extensions;
|
||||
using osu.Framework.Graphics;
|
||||
using osu.Framework.Graphics.Colour;
|
||||
using osu.Framework.Graphics.Containers;
|
||||
@ -30,12 +31,19 @@ namespace osu.Game.Screens.Play.HUD
|
||||
|
||||
private readonly BindableBool showBackground = new BindableBool();
|
||||
|
||||
private readonly ColourInfo mainColour;
|
||||
private readonly ColourInfo mainColourDarkened;
|
||||
private ColourInfo altColour;
|
||||
private ColourInfo altColourDarkened;
|
||||
|
||||
public bool ShowBackground
|
||||
{
|
||||
get => showBackground.Value;
|
||||
set => showBackground.Value = value;
|
||||
}
|
||||
|
||||
public BindableBool Darken = new BindableBool();
|
||||
|
||||
private const float alpha_threshold = 2500;
|
||||
|
||||
public Action<double>? OnSeek { get; set; }
|
||||
@ -91,6 +99,7 @@ namespace osu.Game.Screens.Play.HUD
|
||||
{
|
||||
RelativeSizeAxes = Axes.Both,
|
||||
Alpha = 0,
|
||||
Colour = Colour4.White.Darken(1 + 1 / 4f)
|
||||
},
|
||||
catchupBar = new RoundedBar
|
||||
{
|
||||
@ -107,11 +116,12 @@ namespace osu.Game.Screens.Play.HUD
|
||||
Anchor = Anchor.BottomLeft,
|
||||
Origin = Anchor.BottomLeft,
|
||||
CornerRadius = 5,
|
||||
AccentColour = Color4.White,
|
||||
AccentColour = mainColour = Color4.White,
|
||||
RelativeSizeAxes = Axes.Both
|
||||
},
|
||||
};
|
||||
catchupBaseDepth = catchupBar.Depth;
|
||||
mainColourDarkened = Colour4.White.Darken(1 / 3f);
|
||||
}
|
||||
|
||||
private void setupAlternateValue()
|
||||
@ -135,13 +145,16 @@ namespace osu.Game.Screens.Play.HUD
|
||||
[BackgroundDependencyLoader]
|
||||
private void load(OsuColour colours)
|
||||
{
|
||||
catchupBar.AccentColour = colours.BlueLight;
|
||||
catchupBar.AccentColour = altColour = colours.BlueLight;
|
||||
altColourDarkened = colours.BlueLight.Darken(1 / 3f);
|
||||
showBackground.BindValueChanged(_ => updateBackground(), true);
|
||||
}
|
||||
|
||||
private void updateBackground()
|
||||
{
|
||||
background.FadeTo(showBackground.Value ? 1 : 0, 200, Easing.In);
|
||||
background.FadeTo(showBackground.Value ? 1 / 4f : 0, 200, Easing.In);
|
||||
catchupBar.TransformTo(nameof(catchupBar.AccentColour), ShowBackground ? altColour : altColourDarkened, 200, Easing.In);
|
||||
playfieldBar.TransformTo(nameof(playfieldBar.AccentColour), ShowBackground ? mainColour : mainColourDarkened, 200, Easing.In);
|
||||
}
|
||||
|
||||
protected override bool OnHover(HoverEvent e)
|
||||
|
@ -20,7 +20,7 @@ namespace osu.Game.Screens.Play.HUD
|
||||
{
|
||||
objects = value;
|
||||
|
||||
const int granularity = 300;
|
||||
const int granularity = 200;
|
||||
int[] values = new int[granularity];
|
||||
|
||||
if (!objects.Any())
|
||||
@ -56,7 +56,7 @@ namespace osu.Game.Screens.Play.HUD
|
||||
var colours = new List<Colour4>();
|
||||
|
||||
for (int i = 0; i < 5; i++)
|
||||
colours.Add(Colour4.White.Opacity(1 / 5f * 0.85f));
|
||||
colours.Add(Colour4.White.Darken(1 + 1 / 5f).Opacity(1 / 5f));
|
||||
|
||||
TierColours = colours;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user