mirror of
https://github.com/osukey/osukey.git
synced 2025-07-01 00:09:55 +09:00
Merge remote-tracking branch 'upstream/master' into pr/EVAST9919/6082
This commit is contained in:
@ -1,4 +1,4 @@
|
||||
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
|
||||
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
|
||||
// See the LICENCE file in the repository root for full licence text.
|
||||
|
||||
using osu.Framework.Graphics.UserInterface;
|
||||
@ -8,24 +8,20 @@ using osuTK;
|
||||
using osu.Framework.Graphics.Shapes;
|
||||
using osuTK.Graphics;
|
||||
using osu.Framework.Graphics.Colour;
|
||||
using osu.Framework.Bindables;
|
||||
using osu.Framework.Extensions.Color4Extensions;
|
||||
|
||||
namespace osu.Game.Graphics.UserInterface
|
||||
{
|
||||
public class GradientLineTabControl<TModel> : PageTabControl<TModel>
|
||||
public abstract class GradientLineTabControl<TModel> : PageTabControl<TModel>
|
||||
{
|
||||
protected override Dropdown<TModel> CreateDropdown() => null;
|
||||
|
||||
protected Color4 LineColour
|
||||
{
|
||||
get => line.MainColour.Value;
|
||||
set => line.MainColour.Value = value;
|
||||
get => line.Colour;
|
||||
set => line.Colour = value;
|
||||
}
|
||||
|
||||
private readonly GradientLine line;
|
||||
|
||||
public GradientLineTabControl()
|
||||
protected GradientLineTabControl()
|
||||
{
|
||||
RelativeSizeAxes = Axes.X;
|
||||
|
||||
@ -36,6 +32,8 @@ namespace osu.Game.Graphics.UserInterface
|
||||
});
|
||||
}
|
||||
|
||||
protected override Dropdown<TModel> CreateDropdown() => null;
|
||||
|
||||
protected override TabFillFlowContainer CreateTabFlow() => new TabFillFlowContainer
|
||||
{
|
||||
Anchor = Anchor.BottomCentre,
|
||||
@ -48,12 +46,6 @@ namespace osu.Game.Graphics.UserInterface
|
||||
|
||||
private class GradientLine : GridContainer
|
||||
{
|
||||
public readonly Bindable<Color4> MainColour = new Bindable<Color4>();
|
||||
|
||||
private readonly Box left;
|
||||
private readonly Box middle;
|
||||
private readonly Box right;
|
||||
|
||||
public GradientLine()
|
||||
{
|
||||
RelativeSizeAxes = Axes.X;
|
||||
@ -70,34 +62,23 @@ namespace osu.Game.Graphics.UserInterface
|
||||
{
|
||||
new Drawable[]
|
||||
{
|
||||
left = new Box
|
||||
new Box
|
||||
{
|
||||
RelativeSizeAxes = Axes.Both,
|
||||
Colour = ColourInfo.GradientHorizontal(Color4.Transparent, Color4.White)
|
||||
},
|
||||
new Box
|
||||
{
|
||||
RelativeSizeAxes = Axes.Both,
|
||||
},
|
||||
middle = new Box
|
||||
{
|
||||
RelativeSizeAxes = Axes.Both,
|
||||
},
|
||||
right = new Box
|
||||
new Box
|
||||
{
|
||||
RelativeSizeAxes = Axes.Both,
|
||||
Colour = ColourInfo.GradientHorizontal(Color4.White, Color4.Transparent)
|
||||
},
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
protected override void LoadComplete()
|
||||
{
|
||||
MainColour.BindValueChanged(onColourChanged, true);
|
||||
base.LoadComplete();
|
||||
}
|
||||
|
||||
private void onColourChanged(ValueChangedEvent<Color4> colour)
|
||||
{
|
||||
left.Colour = ColourInfo.GradientHorizontal(colour.NewValue.Opacity(0), colour.NewValue);
|
||||
middle.Colour = colour.NewValue;
|
||||
right.Colour = ColourInfo.GradientHorizontal(colour.NewValue, colour.NewValue.Opacity(0));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user