mirror of
https://github.com/osukey/osukey.git
synced 2025-08-08 09:03:50 +09:00
Merge branch 'master' into argon-hit-lighting-peppy-take
This commit is contained in:
@ -67,21 +67,18 @@ namespace osu.Game.Rulesets.Osu.Skinning.Argon
|
|||||||
outerGradient = new Circle // renders the outer bright gradient
|
outerGradient = new Circle // renders the outer bright gradient
|
||||||
{
|
{
|
||||||
Size = new Vector2(OUTER_GRADIENT_SIZE),
|
Size = new Vector2(OUTER_GRADIENT_SIZE),
|
||||||
Alpha = 1,
|
|
||||||
Anchor = Anchor.Centre,
|
Anchor = Anchor.Centre,
|
||||||
Origin = Anchor.Centre,
|
Origin = Anchor.Centre,
|
||||||
},
|
},
|
||||||
innerGradient = new Circle // renders the inner bright gradient
|
innerGradient = new Circle // renders the inner bright gradient
|
||||||
{
|
{
|
||||||
Size = new Vector2(INNER_GRADIENT_SIZE),
|
Size = new Vector2(INNER_GRADIENT_SIZE),
|
||||||
Alpha = 1,
|
|
||||||
Anchor = Anchor.Centre,
|
Anchor = Anchor.Centre,
|
||||||
Origin = Anchor.Centre,
|
Origin = Anchor.Centre,
|
||||||
},
|
},
|
||||||
innerFill = new Circle // renders the inner dark fill
|
innerFill = new Circle // renders the inner dark fill
|
||||||
{
|
{
|
||||||
Size = new Vector2(INNER_FILL_SIZE),
|
Size = new Vector2(INNER_FILL_SIZE),
|
||||||
Alpha = 1,
|
|
||||||
Anchor = Anchor.Centre,
|
Anchor = Anchor.Centre,
|
||||||
Origin = Anchor.Centre,
|
Origin = Anchor.Centre,
|
||||||
},
|
},
|
||||||
@ -128,14 +125,18 @@ namespace osu.Game.Rulesets.Osu.Skinning.Argon
|
|||||||
|
|
||||||
// Accent colour may be changed many times during a paused gameplay state.
|
// Accent colour may be changed many times during a paused gameplay state.
|
||||||
// Schedule the change to avoid transforms piling up.
|
// Schedule the change to avoid transforms piling up.
|
||||||
Scheduler.AddOnce(updateStateTransforms);
|
Scheduler.AddOnce(() =>
|
||||||
|
{
|
||||||
|
ApplyTransformsAt(double.MinValue, true);
|
||||||
|
ClearTransformsAfter(double.MinValue, true);
|
||||||
|
|
||||||
|
updateStateTransforms(drawableObject, drawableObject.State.Value);
|
||||||
|
});
|
||||||
}, true);
|
}, true);
|
||||||
|
|
||||||
drawableObject.ApplyCustomUpdateState += updateStateTransforms;
|
drawableObject.ApplyCustomUpdateState += updateStateTransforms;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void updateStateTransforms() => updateStateTransforms(drawableObject, drawableObject.State.Value);
|
|
||||||
|
|
||||||
private void updateStateTransforms(DrawableHitObject drawableHitObject, ArmedState state)
|
private void updateStateTransforms(DrawableHitObject drawableHitObject, ArmedState state)
|
||||||
{
|
{
|
||||||
using (BeginAbsoluteSequence(drawableObject.HitStateUpdateTime))
|
using (BeginAbsoluteSequence(drawableObject.HitStateUpdateTime))
|
||||||
|
@ -35,6 +35,7 @@ namespace osu.Game.Tests.Visual.Background
|
|||||||
base.LoadComplete();
|
base.LoadComplete();
|
||||||
|
|
||||||
AddSliderStep("Triangle scale", 0f, 10f, 1f, s => triangles.TriangleScale = s);
|
AddSliderStep("Triangle scale", 0f, 10f, 1f, s => triangles.TriangleScale = s);
|
||||||
|
AddSliderStep("Seed", 0, 1000, 0, s => triangles.Reset(s));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -6,6 +6,7 @@ using System.Linq;
|
|||||||
using NUnit.Framework;
|
using NUnit.Framework;
|
||||||
using osu.Framework.Allocation;
|
using osu.Framework.Allocation;
|
||||||
using osu.Framework.Testing;
|
using osu.Framework.Testing;
|
||||||
|
using osu.Game.Configuration;
|
||||||
using osu.Game.Online.API.Requests.Responses;
|
using osu.Game.Online.API.Requests.Responses;
|
||||||
using osu.Game.Overlays;
|
using osu.Game.Overlays;
|
||||||
using osu.Game.Overlays.Profile;
|
using osu.Game.Overlays.Profile;
|
||||||
@ -19,6 +20,9 @@ namespace osu.Game.Tests.Visual.Online
|
|||||||
[Cached]
|
[Cached]
|
||||||
private readonly OverlayColourProvider colourProvider = new OverlayColourProvider(OverlayColourScheme.Green);
|
private readonly OverlayColourProvider colourProvider = new OverlayColourProvider(OverlayColourScheme.Green);
|
||||||
|
|
||||||
|
[Resolved]
|
||||||
|
private OsuConfigManager configManager { get; set; } = null!;
|
||||||
|
|
||||||
private ProfileHeader header = null!;
|
private ProfileHeader header = null!;
|
||||||
|
|
||||||
[SetUpSteps]
|
[SetUpSteps]
|
||||||
@ -33,6 +37,22 @@ namespace osu.Game.Tests.Visual.Online
|
|||||||
AddStep("Show example user", () => header.User.Value = new UserProfileData(TestSceneUserProfileOverlay.TEST_USER, new OsuRuleset().RulesetInfo));
|
AddStep("Show example user", () => header.User.Value = new UserProfileData(TestSceneUserProfileOverlay.TEST_USER, new OsuRuleset().RulesetInfo));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[Test]
|
||||||
|
public void TestProfileCoverExpanded()
|
||||||
|
{
|
||||||
|
AddStep("Set cover to expanded", () => configManager.SetValue(OsuSetting.ProfileCoverExpanded, true));
|
||||||
|
AddStep("Show example user", () => header.User.Value = new UserProfileData(TestSceneUserProfileOverlay.TEST_USER, new OsuRuleset().RulesetInfo));
|
||||||
|
AddUntilStep("Cover is expanded", () => header.ChildrenOfType<UserCoverBackground>().Single().Height, () => Is.GreaterThan(0));
|
||||||
|
}
|
||||||
|
|
||||||
|
[Test]
|
||||||
|
public void TestProfileCoverCollapsed()
|
||||||
|
{
|
||||||
|
AddStep("Set cover to collapsed", () => configManager.SetValue(OsuSetting.ProfileCoverExpanded, false));
|
||||||
|
AddStep("Show example user", () => header.User.Value = new UserProfileData(TestSceneUserProfileOverlay.TEST_USER, new OsuRuleset().RulesetInfo));
|
||||||
|
AddUntilStep("Cover is collapsed", () => header.ChildrenOfType<UserCoverBackground>().Single().Height, () => Is.EqualTo(0));
|
||||||
|
}
|
||||||
|
|
||||||
[Test]
|
[Test]
|
||||||
public void TestOnlineState()
|
public void TestOnlineState()
|
||||||
{
|
{
|
||||||
|
@ -82,7 +82,7 @@ namespace osu.Game.Tests.Visual.Online
|
|||||||
{
|
{
|
||||||
Username = @"Somebody",
|
Username = @"Somebody",
|
||||||
Id = 1,
|
Id = 1,
|
||||||
CountryCode = CountryCode.Unknown,
|
CountryCode = CountryCode.JP,
|
||||||
CoverUrl = @"https://osu.ppy.sh/images/headers/profile-covers/c1.jpg",
|
CoverUrl = @"https://osu.ppy.sh/images/headers/profile-covers/c1.jpg",
|
||||||
JoinDate = DateTimeOffset.Now.AddDays(-1),
|
JoinDate = DateTimeOffset.Now.AddDays(-1),
|
||||||
LastVisit = DateTimeOffset.Now,
|
LastVisit = DateTimeOffset.Now,
|
||||||
@ -143,7 +143,8 @@ namespace osu.Game.Tests.Visual.Online
|
|||||||
{
|
{
|
||||||
Available = 10,
|
Available = 10,
|
||||||
Total = 50
|
Total = 50
|
||||||
}
|
},
|
||||||
|
SupportLevel = 2,
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -58,8 +58,12 @@ namespace osu.Game.Configuration
|
|||||||
|
|
||||||
SetDefault(OsuSetting.BeatmapListingCardSize, BeatmapCardSize.Normal);
|
SetDefault(OsuSetting.BeatmapListingCardSize, BeatmapCardSize.Normal);
|
||||||
|
|
||||||
|
SetDefault(OsuSetting.ProfileCoverExpanded, true);
|
||||||
|
|
||||||
SetDefault(OsuSetting.ToolbarClockDisplayMode, ToolbarClockDisplayMode.Full);
|
SetDefault(OsuSetting.ToolbarClockDisplayMode, ToolbarClockDisplayMode.Full);
|
||||||
|
|
||||||
|
SetDefault(OsuSetting.SongSelectBackgroundBlur, true);
|
||||||
|
|
||||||
// Online settings
|
// Online settings
|
||||||
SetDefault(OsuSetting.Username, string.Empty);
|
SetDefault(OsuSetting.Username, string.Empty);
|
||||||
SetDefault(OsuSetting.Token, string.Empty);
|
SetDefault(OsuSetting.Token, string.Empty);
|
||||||
@ -339,6 +343,7 @@ namespace osu.Game.Configuration
|
|||||||
ChatDisplayHeight,
|
ChatDisplayHeight,
|
||||||
BeatmapListingCardSize,
|
BeatmapListingCardSize,
|
||||||
ToolbarClockDisplayMode,
|
ToolbarClockDisplayMode,
|
||||||
|
SongSelectBackgroundBlur,
|
||||||
Version,
|
Version,
|
||||||
ShowFirstRunSetup,
|
ShowFirstRunSetup,
|
||||||
ShowConvertedBeatmaps,
|
ShowConvertedBeatmaps,
|
||||||
@ -375,5 +380,6 @@ namespace osu.Game.Configuration
|
|||||||
LastProcessedMetadataId,
|
LastProcessedMetadataId,
|
||||||
SafeAreaConsiderations,
|
SafeAreaConsiderations,
|
||||||
ComboColourNormalisationAmount,
|
ComboColourNormalisationAmount,
|
||||||
|
ProfileCoverExpanded,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -31,12 +31,6 @@ namespace osu.Game.Graphics.Backgrounds
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
private const float equilateral_triangle_ratio = 0.866f;
|
private const float equilateral_triangle_ratio = 0.866f;
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// How many screen-space pixels are smoothed over.
|
|
||||||
/// Same behavior as Sprite's EdgeSmoothness.
|
|
||||||
/// </summary>
|
|
||||||
private const float edge_smoothness = 1;
|
|
||||||
|
|
||||||
private Color4 colourLight = Color4.White;
|
private Color4 colourLight = Color4.White;
|
||||||
|
|
||||||
public Color4 ColourLight
|
public Color4 ColourLight
|
||||||
@ -115,7 +109,7 @@ namespace osu.Game.Graphics.Backgrounds
|
|||||||
private void load(IRenderer renderer, ShaderManager shaders)
|
private void load(IRenderer renderer, ShaderManager shaders)
|
||||||
{
|
{
|
||||||
texture = renderer.WhitePixel;
|
texture = renderer.WhitePixel;
|
||||||
shader = shaders.Load(VertexShaderDescriptor.TEXTURE_2, FragmentShaderDescriptor.TEXTURE);
|
shader = shaders.Load(VertexShaderDescriptor.TEXTURE_2, "TriangleBorder");
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override void LoadComplete()
|
protected override void LoadComplete()
|
||||||
@ -252,14 +246,17 @@ namespace osu.Game.Graphics.Backgrounds
|
|||||||
|
|
||||||
private class TrianglesDrawNode : DrawNode
|
private class TrianglesDrawNode : DrawNode
|
||||||
{
|
{
|
||||||
|
private float fill = 1f;
|
||||||
|
|
||||||
protected new Triangles Source => (Triangles)base.Source;
|
protected new Triangles Source => (Triangles)base.Source;
|
||||||
|
|
||||||
private IShader shader;
|
private IShader shader;
|
||||||
private Texture texture;
|
private Texture texture;
|
||||||
|
|
||||||
private readonly List<TriangleParticle> parts = new List<TriangleParticle>();
|
private readonly List<TriangleParticle> parts = new List<TriangleParticle>();
|
||||||
private Vector2 size;
|
private readonly Vector2 triangleSize = new Vector2(1f, equilateral_triangle_ratio) * triangle_size;
|
||||||
|
|
||||||
|
private Vector2 size;
|
||||||
private IVertexBatch<TexturedVertex2D> vertexBatch;
|
private IVertexBatch<TexturedVertex2D> vertexBatch;
|
||||||
|
|
||||||
public TrianglesDrawNode(Triangles source)
|
public TrianglesDrawNode(Triangles source)
|
||||||
@ -290,29 +287,28 @@ namespace osu.Game.Graphics.Backgrounds
|
|||||||
}
|
}
|
||||||
|
|
||||||
shader.Bind();
|
shader.Bind();
|
||||||
|
shader.GetUniform<float>("thickness").UpdateValue(ref fill);
|
||||||
Vector2 localInflationAmount = edge_smoothness * DrawInfo.MatrixInverse.ExtractScale().Xy;
|
|
||||||
|
|
||||||
foreach (TriangleParticle particle in parts)
|
foreach (TriangleParticle particle in parts)
|
||||||
{
|
{
|
||||||
var offset = triangle_size * new Vector2(particle.Scale * 0.5f, particle.Scale * equilateral_triangle_ratio);
|
Vector2 relativeSize = Vector2.Divide(triangleSize * particle.Scale, size);
|
||||||
|
|
||||||
var triangle = new Triangle(
|
Vector2 topLeft = particle.Position - new Vector2(relativeSize.X * 0.5f, 0f);
|
||||||
Vector2Extensions.Transform(particle.Position * size, DrawInfo.Matrix),
|
Vector2 topRight = topLeft + new Vector2(relativeSize.X, 0f);
|
||||||
Vector2Extensions.Transform(particle.Position * size + offset, DrawInfo.Matrix),
|
Vector2 bottomLeft = topLeft + new Vector2(0f, relativeSize.Y);
|
||||||
Vector2Extensions.Transform(particle.Position * size + new Vector2(-offset.X, offset.Y), DrawInfo.Matrix)
|
Vector2 bottomRight = bottomLeft + new Vector2(relativeSize.X, 0f);
|
||||||
|
|
||||||
|
var drawQuad = new Quad(
|
||||||
|
Vector2Extensions.Transform(topLeft * size, DrawInfo.Matrix),
|
||||||
|
Vector2Extensions.Transform(topRight * size, DrawInfo.Matrix),
|
||||||
|
Vector2Extensions.Transform(bottomLeft * size, DrawInfo.Matrix),
|
||||||
|
Vector2Extensions.Transform(bottomRight * size, DrawInfo.Matrix)
|
||||||
);
|
);
|
||||||
|
|
||||||
ColourInfo colourInfo = DrawColourInfo.Colour;
|
ColourInfo colourInfo = DrawColourInfo.Colour;
|
||||||
colourInfo.ApplyChild(particle.Colour);
|
colourInfo.ApplyChild(particle.Colour);
|
||||||
|
|
||||||
renderer.DrawTriangle(
|
renderer.DrawQuad(texture, drawQuad, colourInfo, vertexAction: vertexBatch.AddAction);
|
||||||
texture,
|
|
||||||
triangle,
|
|
||||||
colourInfo,
|
|
||||||
null,
|
|
||||||
vertexBatch.AddAction,
|
|
||||||
Vector2.Divide(localInflationAmount, new Vector2(2 * offset.X, offset.Y)));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
shader.Unbind();
|
shader.Unbind();
|
||||||
|
@ -5,7 +5,6 @@ using osu.Framework.Allocation;
|
|||||||
using osu.Framework.Audio;
|
using osu.Framework.Audio;
|
||||||
using osu.Framework.Audio.Sample;
|
using osu.Framework.Audio.Sample;
|
||||||
using osu.Framework.Bindables;
|
using osu.Framework.Bindables;
|
||||||
using osu.Framework.Extensions.Color4Extensions;
|
|
||||||
using osu.Framework.Graphics;
|
using osu.Framework.Graphics;
|
||||||
using osu.Framework.Graphics.Sprites;
|
using osu.Framework.Graphics.Sprites;
|
||||||
using osu.Framework.Localisation;
|
using osu.Framework.Localisation;
|
||||||
@ -15,11 +14,11 @@ using osuTK;
|
|||||||
|
|
||||||
namespace osu.Game.Overlays.Profile.Header.Components
|
namespace osu.Game.Overlays.Profile.Header.Components
|
||||||
{
|
{
|
||||||
public partial class ExpandDetailsButton : ProfileHeaderButton
|
public partial class ToggleCoverButton : ProfileHeaderButton
|
||||||
{
|
{
|
||||||
public readonly BindableBool DetailsVisible = new BindableBool();
|
public readonly BindableBool CoverExpanded = new BindableBool(true);
|
||||||
|
|
||||||
public override LocalisableString TooltipText => DetailsVisible.Value ? CommonStrings.ButtonsCollapse : CommonStrings.ButtonsExpand;
|
public override LocalisableString TooltipText => CoverExpanded.Value ? UsersStrings.ShowCoverTo0 : UsersStrings.ShowCoverTo1;
|
||||||
|
|
||||||
private SpriteIcon icon = null!;
|
private SpriteIcon icon = null!;
|
||||||
private Sample? sampleOpen;
|
private Sample? sampleOpen;
|
||||||
@ -27,12 +26,12 @@ namespace osu.Game.Overlays.Profile.Header.Components
|
|||||||
|
|
||||||
protected override HoverSounds CreateHoverSounds(HoverSampleSet sampleSet) => new HoverClickSounds();
|
protected override HoverSounds CreateHoverSounds(HoverSampleSet sampleSet) => new HoverClickSounds();
|
||||||
|
|
||||||
public ExpandDetailsButton()
|
public ToggleCoverButton()
|
||||||
{
|
{
|
||||||
Action = () =>
|
Action = () =>
|
||||||
{
|
{
|
||||||
DetailsVisible.Toggle();
|
CoverExpanded.Toggle();
|
||||||
(DetailsVisible.Value ? sampleOpen : sampleClose)?.Play();
|
(CoverExpanded.Value ? sampleOpen : sampleClose)?.Play();
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -40,19 +39,21 @@ namespace osu.Game.Overlays.Profile.Header.Components
|
|||||||
private void load(OverlayColourProvider colourProvider, AudioManager audio)
|
private void load(OverlayColourProvider colourProvider, AudioManager audio)
|
||||||
{
|
{
|
||||||
IdleColour = colourProvider.Background2;
|
IdleColour = colourProvider.Background2;
|
||||||
HoverColour = colourProvider.Background2.Lighten(0.2f);
|
HoverColour = colourProvider.Background1;
|
||||||
|
|
||||||
sampleOpen = audio.Samples.Get(@"UI/dropdown-open");
|
sampleOpen = audio.Samples.Get(@"UI/dropdown-open");
|
||||||
sampleClose = audio.Samples.Get(@"UI/dropdown-close");
|
sampleClose = audio.Samples.Get(@"UI/dropdown-close");
|
||||||
|
|
||||||
|
AutoSizeAxes = Axes.None;
|
||||||
|
Size = new Vector2(30);
|
||||||
Child = icon = new SpriteIcon
|
Child = icon = new SpriteIcon
|
||||||
{
|
{
|
||||||
Anchor = Anchor.Centre,
|
Anchor = Anchor.Centre,
|
||||||
Origin = Anchor.Centre,
|
Origin = Anchor.Centre,
|
||||||
Size = new Vector2(20, 12)
|
Size = new Vector2(10.5f, 12)
|
||||||
};
|
};
|
||||||
|
|
||||||
DetailsVisible.BindValueChanged(visible => updateState(visible.NewValue), true);
|
CoverExpanded.BindValueChanged(visible => updateState(visible.NewValue), true);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void updateState(bool detailsVisible) => icon.Icon = detailsVisible ? FontAwesome.Solid.ChevronUp : FontAwesome.Solid.ChevronDown;
|
private void updateState(bool detailsVisible) => icon.Icon = detailsVisible ? FontAwesome.Solid.ChevronUp : FontAwesome.Solid.ChevronDown;
|
@ -7,13 +7,16 @@ using osu.Framework.Extensions;
|
|||||||
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.Effects;
|
||||||
using osu.Framework.Graphics.Shapes;
|
using osu.Framework.Graphics.Shapes;
|
||||||
|
using osu.Game.Configuration;
|
||||||
using osu.Game.Graphics;
|
using osu.Game.Graphics;
|
||||||
using osu.Game.Graphics.Sprites;
|
using osu.Game.Graphics.Sprites;
|
||||||
using osu.Game.Graphics.Cursor;
|
using osu.Game.Graphics.Cursor;
|
||||||
using osu.Game.Graphics.UserInterface;
|
using osu.Game.Graphics.UserInterface;
|
||||||
using osu.Game.Online.API;
|
using osu.Game.Online.API;
|
||||||
using osu.Game.Overlays.Profile.Header.Components;
|
using osu.Game.Overlays.Profile.Header.Components;
|
||||||
|
using osu.Game.Users;
|
||||||
using osu.Game.Users.Drawables;
|
using osu.Game.Users.Drawables;
|
||||||
using osuTK;
|
using osuTK;
|
||||||
|
|
||||||
@ -21,13 +24,15 @@ namespace osu.Game.Overlays.Profile.Header
|
|||||||
{
|
{
|
||||||
public partial class TopHeaderContainer : CompositeDrawable
|
public partial class TopHeaderContainer : CompositeDrawable
|
||||||
{
|
{
|
||||||
private const float avatar_size = 110;
|
private const float content_height = 65;
|
||||||
|
private const float vertical_padding = 10;
|
||||||
|
|
||||||
public readonly Bindable<UserProfileData?> User = new Bindable<UserProfileData?>();
|
public readonly Bindable<UserProfileData?> User = new Bindable<UserProfileData?>();
|
||||||
|
|
||||||
[Resolved]
|
[Resolved]
|
||||||
private IAPIProvider api { get; set; } = null!;
|
private IAPIProvider api { get; set; } = null!;
|
||||||
|
|
||||||
|
private UserCoverBackground cover = null!;
|
||||||
private SupporterIcon supporterTag = null!;
|
private SupporterIcon supporterTag = null!;
|
||||||
private UpdateableAvatar avatar = null!;
|
private UpdateableAvatar avatar = null!;
|
||||||
private OsuSpriteText usernameText = null!;
|
private OsuSpriteText usernameText = null!;
|
||||||
@ -36,11 +41,19 @@ namespace osu.Game.Overlays.Profile.Header
|
|||||||
private UpdateableFlag userFlag = null!;
|
private UpdateableFlag userFlag = null!;
|
||||||
private OsuSpriteText userCountryText = null!;
|
private OsuSpriteText userCountryText = null!;
|
||||||
private GroupBadgeFlow groupBadgeFlow = null!;
|
private GroupBadgeFlow groupBadgeFlow = null!;
|
||||||
|
private ToggleCoverButton coverToggle = null!;
|
||||||
|
|
||||||
|
private Bindable<bool> coverExpanded = null!;
|
||||||
|
|
||||||
|
private FillFlowContainer flow = null!;
|
||||||
|
|
||||||
[BackgroundDependencyLoader]
|
[BackgroundDependencyLoader]
|
||||||
private void load(OverlayColourProvider colourProvider)
|
private void load(OverlayColourProvider colourProvider, OsuConfigManager configManager)
|
||||||
{
|
{
|
||||||
Height = 150;
|
RelativeSizeAxes = Axes.X;
|
||||||
|
AutoSizeAxes = Axes.Y;
|
||||||
|
|
||||||
|
coverExpanded = configManager.GetBindable<bool>(OsuSetting.ProfileCoverExpanded);
|
||||||
|
|
||||||
InternalChildren = new Drawable[]
|
InternalChildren = new Drawable[]
|
||||||
{
|
{
|
||||||
@ -50,49 +63,78 @@ namespace osu.Game.Overlays.Profile.Header
|
|||||||
Colour = colourProvider.Background4,
|
Colour = colourProvider.Background4,
|
||||||
},
|
},
|
||||||
new FillFlowContainer
|
new FillFlowContainer
|
||||||
|
{
|
||||||
|
RelativeSizeAxes = Axes.X,
|
||||||
|
AutoSizeAxes = Axes.Y,
|
||||||
|
Direction = FillDirection.Vertical,
|
||||||
|
Children = new Drawable[]
|
||||||
|
{
|
||||||
|
cover = new ProfileCoverBackground
|
||||||
|
{
|
||||||
|
RelativeSizeAxes = Axes.X,
|
||||||
|
},
|
||||||
|
new Container
|
||||||
|
{
|
||||||
|
RelativeSizeAxes = Axes.X,
|
||||||
|
AutoSizeAxes = Axes.Y,
|
||||||
|
Children = new Drawable[]
|
||||||
|
{
|
||||||
|
flow = new FillFlowContainer
|
||||||
{
|
{
|
||||||
Direction = FillDirection.Horizontal,
|
Direction = FillDirection.Horizontal,
|
||||||
Margin = new MarginPadding { Left = UserProfileOverlay.CONTENT_X_MARGIN },
|
Padding = new MarginPadding
|
||||||
Height = avatar_size,
|
{
|
||||||
AutoSizeAxes = Axes.X,
|
Left = UserProfileOverlay.CONTENT_X_MARGIN,
|
||||||
Anchor = Anchor.CentreLeft,
|
Vertical = vertical_padding
|
||||||
Origin = Anchor.CentreLeft,
|
},
|
||||||
|
Height = content_height + 2 * vertical_padding,
|
||||||
|
RelativeSizeAxes = Axes.X,
|
||||||
Children = new Drawable[]
|
Children = new Drawable[]
|
||||||
{
|
{
|
||||||
avatar = new UpdateableAvatar(isInteractive: false, showGuestOnNull: false)
|
avatar = new UpdateableAvatar(isInteractive: false, showGuestOnNull: false)
|
||||||
{
|
{
|
||||||
Size = new Vector2(avatar_size),
|
Anchor = Anchor.BottomLeft,
|
||||||
|
Origin = Anchor.BottomLeft,
|
||||||
Masking = true,
|
Masking = true,
|
||||||
CornerRadius = avatar_size * 0.25f,
|
EdgeEffect = new EdgeEffectParameters
|
||||||
|
{
|
||||||
|
Type = EdgeEffectType.Shadow,
|
||||||
|
Offset = new Vector2(0, 1),
|
||||||
|
Radius = 3,
|
||||||
|
Colour = Colour4.Black.Opacity(0.25f),
|
||||||
|
}
|
||||||
},
|
},
|
||||||
new OsuContextMenuContainer
|
new OsuContextMenuContainer
|
||||||
{
|
{
|
||||||
|
Anchor = Anchor.BottomLeft,
|
||||||
|
Origin = Anchor.BottomLeft,
|
||||||
RelativeSizeAxes = Axes.Y,
|
RelativeSizeAxes = Axes.Y,
|
||||||
AutoSizeAxes = Axes.X,
|
AutoSizeAxes = Axes.X,
|
||||||
Child = new Container
|
Child = new FillFlowContainer
|
||||||
{
|
|
||||||
RelativeSizeAxes = Axes.Y,
|
|
||||||
AutoSizeAxes = Axes.X,
|
|
||||||
Padding = new MarginPadding { Left = 10 },
|
|
||||||
Children = new Drawable[]
|
|
||||||
{
|
|
||||||
new FillFlowContainer
|
|
||||||
{
|
{
|
||||||
AutoSizeAxes = Axes.Both,
|
AutoSizeAxes = Axes.Both,
|
||||||
Direction = FillDirection.Vertical,
|
Direction = FillDirection.Vertical,
|
||||||
|
Anchor = Anchor.CentreLeft,
|
||||||
|
Origin = Anchor.CentreLeft,
|
||||||
Children = new Drawable[]
|
Children = new Drawable[]
|
||||||
{
|
{
|
||||||
new FillFlowContainer
|
new FillFlowContainer
|
||||||
{
|
{
|
||||||
AutoSizeAxes = Axes.Both,
|
AutoSizeAxes = Axes.Both,
|
||||||
Direction = FillDirection.Horizontal,
|
Direction = FillDirection.Horizontal,
|
||||||
Spacing = new Vector2(5),
|
Spacing = new Vector2(5, 0),
|
||||||
Children = new Drawable[]
|
Children = new Drawable[]
|
||||||
{
|
{
|
||||||
usernameText = new OsuSpriteText
|
usernameText = new OsuSpriteText
|
||||||
{
|
{
|
||||||
Font = OsuFont.GetFont(size: 24, weight: FontWeight.Regular)
|
Font = OsuFont.GetFont(size: 24, weight: FontWeight.Regular)
|
||||||
},
|
},
|
||||||
|
supporterTag = new SupporterIcon
|
||||||
|
{
|
||||||
|
Anchor = Anchor.CentreLeft,
|
||||||
|
Origin = Anchor.CentreLeft,
|
||||||
|
Height = 15,
|
||||||
|
},
|
||||||
openUserExternally = new ExternalLinkButton
|
openUserExternally = new ExternalLinkButton
|
||||||
{
|
{
|
||||||
Anchor = Anchor.CentreLeft,
|
Anchor = Anchor.CentreLeft,
|
||||||
@ -102,39 +144,17 @@ namespace osu.Game.Overlays.Profile.Header
|
|||||||
{
|
{
|
||||||
Anchor = Anchor.CentreLeft,
|
Anchor = Anchor.CentreLeft,
|
||||||
Origin = Anchor.CentreLeft,
|
Origin = Anchor.CentreLeft,
|
||||||
}
|
},
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
titleText = new OsuSpriteText
|
titleText = new OsuSpriteText
|
||||||
{
|
{
|
||||||
Font = OsuFont.GetFont(size: 18, weight: FontWeight.Regular)
|
Font = OsuFont.GetFont(size: 16, weight: FontWeight.Regular),
|
||||||
},
|
Margin = new MarginPadding { Bottom = 5 }
|
||||||
}
|
|
||||||
},
|
|
||||||
new FillFlowContainer
|
|
||||||
{
|
|
||||||
Origin = Anchor.BottomLeft,
|
|
||||||
Anchor = Anchor.BottomLeft,
|
|
||||||
Direction = FillDirection.Vertical,
|
|
||||||
AutoSizeAxes = Axes.Both,
|
|
||||||
Children = new Drawable[]
|
|
||||||
{
|
|
||||||
supporterTag = new SupporterIcon
|
|
||||||
{
|
|
||||||
Height = 20,
|
|
||||||
Margin = new MarginPadding { Top = 5 }
|
|
||||||
},
|
|
||||||
new Box
|
|
||||||
{
|
|
||||||
RelativeSizeAxes = Axes.X,
|
|
||||||
Height = 1.5f,
|
|
||||||
Margin = new MarginPadding { Top = 10 },
|
|
||||||
Colour = colourProvider.Light1,
|
|
||||||
},
|
},
|
||||||
new FillFlowContainer
|
new FillFlowContainer
|
||||||
{
|
{
|
||||||
AutoSizeAxes = Axes.Both,
|
AutoSizeAxes = Axes.Both,
|
||||||
Margin = new MarginPadding { Top = 5 },
|
|
||||||
Direction = FillDirection.Horizontal,
|
Direction = FillDirection.Horizontal,
|
||||||
Children = new Drawable[]
|
Children = new Drawable[]
|
||||||
{
|
{
|
||||||
@ -145,30 +165,46 @@ namespace osu.Game.Overlays.Profile.Header
|
|||||||
},
|
},
|
||||||
userCountryText = new OsuSpriteText
|
userCountryText = new OsuSpriteText
|
||||||
{
|
{
|
||||||
Font = OsuFont.GetFont(size: 17.5f, weight: FontWeight.Regular),
|
Font = OsuFont.GetFont(size: 14f, weight: FontWeight.Regular),
|
||||||
Margin = new MarginPadding { Left = 10 },
|
Margin = new MarginPadding { Left = 5 },
|
||||||
Origin = Anchor.CentreLeft,
|
Origin = Anchor.CentreLeft,
|
||||||
Anchor = Anchor.CentreLeft,
|
Anchor = Anchor.CentreLeft,
|
||||||
Colour = colourProvider.Light1,
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
},
|
||||||
|
},
|
||||||
}
|
}
|
||||||
|
},
|
||||||
|
coverToggle = new ToggleCoverButton
|
||||||
|
{
|
||||||
|
Anchor = Anchor.CentreRight,
|
||||||
|
Origin = Anchor.CentreRight,
|
||||||
|
Margin = new MarginPadding { Right = 10 },
|
||||||
|
CoverExpanded = { BindTarget = coverExpanded }
|
||||||
}
|
}
|
||||||
}
|
},
|
||||||
}
|
},
|
||||||
}
|
},
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
}
|
||||||
|
|
||||||
User.BindValueChanged(user => updateUser(user.NewValue));
|
protected override void LoadComplete()
|
||||||
|
{
|
||||||
|
base.LoadComplete();
|
||||||
|
|
||||||
|
User.BindValueChanged(user => updateUser(user.NewValue), true);
|
||||||
|
coverExpanded.BindValueChanged(_ => updateCoverState(), true);
|
||||||
|
FinishTransforms(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void updateUser(UserProfileData? data)
|
private void updateUser(UserProfileData? data)
|
||||||
{
|
{
|
||||||
var user = data?.User;
|
var user = data?.User;
|
||||||
|
|
||||||
|
cover.User = user;
|
||||||
avatar.User = user;
|
avatar.User = user;
|
||||||
usernameText.Text = user?.Username ?? string.Empty;
|
usernameText.Text = user?.Username ?? string.Empty;
|
||||||
openUserExternally.Link = $@"{api.WebsiteRootUrl}/users/{user?.Id ?? 0}";
|
openUserExternally.Link = $@"{api.WebsiteRootUrl}/users/{user?.Id ?? 0}";
|
||||||
@ -179,5 +215,27 @@ namespace osu.Game.Overlays.Profile.Header
|
|||||||
titleText.Colour = Color4Extensions.FromHex(user?.Colour ?? "fff");
|
titleText.Colour = Color4Extensions.FromHex(user?.Colour ?? "fff");
|
||||||
groupBadgeFlow.User.Value = user;
|
groupBadgeFlow.User.Value = user;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void updateCoverState()
|
||||||
|
{
|
||||||
|
const float transition_duration = 500;
|
||||||
|
|
||||||
|
bool expanded = coverToggle.CoverExpanded.Value;
|
||||||
|
|
||||||
|
cover.ResizeHeightTo(expanded ? 250 : 0, transition_duration, Easing.OutQuint);
|
||||||
|
avatar.ResizeTo(new Vector2(expanded ? 120 : content_height), transition_duration, Easing.OutQuint);
|
||||||
|
avatar.TransformTo(nameof(avatar.CornerRadius), expanded ? 40f : 20f, transition_duration, Easing.OutQuint);
|
||||||
|
flow.TransformTo(nameof(flow.Spacing), new Vector2(expanded ? 20f : 10f), transition_duration, Easing.OutQuint);
|
||||||
|
}
|
||||||
|
|
||||||
|
private partial class ProfileCoverBackground : UserCoverBackground
|
||||||
|
{
|
||||||
|
protected override double LoadDelay => 0;
|
||||||
|
|
||||||
|
public ProfileCoverBackground()
|
||||||
|
{
|
||||||
|
Masking = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -3,23 +3,17 @@
|
|||||||
|
|
||||||
using System.Diagnostics;
|
using System.Diagnostics;
|
||||||
using osu.Framework.Bindables;
|
using osu.Framework.Bindables;
|
||||||
using osu.Framework.Extensions.Color4Extensions;
|
|
||||||
using osu.Framework.Graphics;
|
using osu.Framework.Graphics;
|
||||||
using osu.Framework.Graphics.Colour;
|
|
||||||
using osu.Framework.Graphics.Containers;
|
using osu.Framework.Graphics.Containers;
|
||||||
using osu.Framework.Graphics.Shapes;
|
|
||||||
using osu.Framework.Localisation;
|
using osu.Framework.Localisation;
|
||||||
using osu.Game.Overlays.Profile.Header;
|
using osu.Game.Overlays.Profile.Header;
|
||||||
using osu.Game.Overlays.Profile.Header.Components;
|
using osu.Game.Overlays.Profile.Header.Components;
|
||||||
using osu.Game.Resources.Localisation.Web;
|
using osu.Game.Resources.Localisation.Web;
|
||||||
using osu.Game.Users;
|
|
||||||
|
|
||||||
namespace osu.Game.Overlays.Profile
|
namespace osu.Game.Overlays.Profile
|
||||||
{
|
{
|
||||||
public partial class ProfileHeader : TabControlOverlayHeader<LocalisableString>
|
public partial class ProfileHeader : TabControlOverlayHeader<LocalisableString>
|
||||||
{
|
{
|
||||||
private UserCoverBackground coverContainer = null!;
|
|
||||||
|
|
||||||
public Bindable<UserProfileData?> User = new Bindable<UserProfileData?>();
|
public Bindable<UserProfileData?> User = new Bindable<UserProfileData?>();
|
||||||
|
|
||||||
private CentreHeaderContainer centreHeaderContainer;
|
private CentreHeaderContainer centreHeaderContainer;
|
||||||
@ -29,8 +23,6 @@ namespace osu.Game.Overlays.Profile
|
|||||||
{
|
{
|
||||||
ContentSidePadding = UserProfileOverlay.CONTENT_X_MARGIN;
|
ContentSidePadding = UserProfileOverlay.CONTENT_X_MARGIN;
|
||||||
|
|
||||||
User.ValueChanged += e => updateDisplay(e.NewValue);
|
|
||||||
|
|
||||||
TabControl.AddItem(LayoutStrings.HeaderUsersShow);
|
TabControl.AddItem(LayoutStrings.HeaderUsersShow);
|
||||||
|
|
||||||
// todo: pending implementation.
|
// todo: pending implementation.
|
||||||
@ -41,25 +33,7 @@ namespace osu.Game.Overlays.Profile
|
|||||||
Debug.Assert(detailHeaderContainer != null);
|
Debug.Assert(detailHeaderContainer != null);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override Drawable CreateBackground() =>
|
protected override Drawable CreateBackground() => Empty();
|
||||||
new Container
|
|
||||||
{
|
|
||||||
RelativeSizeAxes = Axes.X,
|
|
||||||
Height = 150,
|
|
||||||
Masking = true,
|
|
||||||
Children = new Drawable[]
|
|
||||||
{
|
|
||||||
coverContainer = new ProfileCoverBackground
|
|
||||||
{
|
|
||||||
RelativeSizeAxes = Axes.Both,
|
|
||||||
},
|
|
||||||
new Box
|
|
||||||
{
|
|
||||||
RelativeSizeAxes = Axes.Both,
|
|
||||||
Colour = ColourInfo.GradientVertical(Color4Extensions.FromHex("222").Opacity(0.8f), Color4Extensions.FromHex("222").Opacity(0.2f))
|
|
||||||
},
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
protected override Drawable CreateContent() => new FillFlowContainer
|
protected override Drawable CreateContent() => new FillFlowContainer
|
||||||
{
|
{
|
||||||
@ -103,8 +77,6 @@ namespace osu.Game.Overlays.Profile
|
|||||||
User = { BindTarget = User }
|
User = { BindTarget = User }
|
||||||
};
|
};
|
||||||
|
|
||||||
private void updateDisplay(UserProfileData? user) => coverContainer.User = user?.User;
|
|
||||||
|
|
||||||
private partial class ProfileHeaderTitle : OverlayTitle
|
private partial class ProfileHeaderTitle : OverlayTitle
|
||||||
{
|
{
|
||||||
public ProfileHeaderTitle()
|
public ProfileHeaderTitle()
|
||||||
@ -113,10 +85,5 @@ namespace osu.Game.Overlays.Profile
|
|||||||
IconTexture = "Icons/Hexacons/profile";
|
IconTexture = "Icons/Hexacons/profile";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private partial class ProfileCoverBackground : UserCoverBackground
|
|
||||||
{
|
|
||||||
protected override double LoadDelay => 0;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -42,6 +42,12 @@ namespace osu.Game.Overlays.Settings.Sections.UserInterface
|
|||||||
LabelText = UserInterfaceStrings.ModSelectHotkeyStyle,
|
LabelText = UserInterfaceStrings.ModSelectHotkeyStyle,
|
||||||
Current = config.GetBindable<ModSelectHotkeyStyle>(OsuSetting.ModSelectHotkeyStyle),
|
Current = config.GetBindable<ModSelectHotkeyStyle>(OsuSetting.ModSelectHotkeyStyle),
|
||||||
ClassicDefault = ModSelectHotkeyStyle.Classic
|
ClassicDefault = ModSelectHotkeyStyle.Classic
|
||||||
|
},
|
||||||
|
new SettingsCheckbox
|
||||||
|
{
|
||||||
|
LabelText = GameplaySettingsStrings.BackgroundBlur,
|
||||||
|
Current = config.GetBindable<bool>(OsuSetting.SongSelectBackgroundBlur),
|
||||||
|
ClassicDefault = false,
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
@ -35,6 +35,7 @@ using osu.Game.Collections;
|
|||||||
using osu.Game.Graphics.UserInterface;
|
using osu.Game.Graphics.UserInterface;
|
||||||
using System.Diagnostics;
|
using System.Diagnostics;
|
||||||
using osu.Framework.Extensions.ObjectExtensions;
|
using osu.Framework.Extensions.ObjectExtensions;
|
||||||
|
using osu.Game.Configuration;
|
||||||
using osu.Game.Screens.Play;
|
using osu.Game.Screens.Play;
|
||||||
using osu.Game.Skinning;
|
using osu.Game.Skinning;
|
||||||
|
|
||||||
@ -124,9 +125,20 @@ namespace osu.Game.Screens.Select
|
|||||||
[Resolved]
|
[Resolved]
|
||||||
internal IOverlayManager? OverlayManager { get; private set; }
|
internal IOverlayManager? OverlayManager { get; private set; }
|
||||||
|
|
||||||
|
private Bindable<bool> configBackgroundBlur { get; set; } = new BindableBool();
|
||||||
|
|
||||||
[BackgroundDependencyLoader(true)]
|
[BackgroundDependencyLoader(true)]
|
||||||
private void load(AudioManager audio, OsuColour colours, ManageCollectionsDialog? manageCollectionsDialog, DifficultyRecommender? recommender)
|
private void load(AudioManager audio, OsuColour colours, ManageCollectionsDialog? manageCollectionsDialog, DifficultyRecommender? recommender, OsuConfigManager config)
|
||||||
{
|
{
|
||||||
|
configBackgroundBlur = config.GetBindable<bool>(OsuSetting.SongSelectBackgroundBlur);
|
||||||
|
configBackgroundBlur.BindValueChanged(e =>
|
||||||
|
{
|
||||||
|
if (!this.IsCurrentScreen())
|
||||||
|
return;
|
||||||
|
|
||||||
|
ApplyToBackground(b => b.BlurAmount.Value = e.NewValue ? BACKGROUND_BLUR : 0);
|
||||||
|
});
|
||||||
|
|
||||||
LoadComponentAsync(Carousel = new BeatmapCarousel
|
LoadComponentAsync(Carousel = new BeatmapCarousel
|
||||||
{
|
{
|
||||||
AllowSelection = false, // delay any selection until our bindables are ready to make a good choice.
|
AllowSelection = false, // delay any selection until our bindables are ready to make a good choice.
|
||||||
@ -742,7 +754,7 @@ namespace osu.Game.Screens.Select
|
|||||||
ApplyToBackground(backgroundModeBeatmap =>
|
ApplyToBackground(backgroundModeBeatmap =>
|
||||||
{
|
{
|
||||||
backgroundModeBeatmap.Beatmap = beatmap;
|
backgroundModeBeatmap.Beatmap = beatmap;
|
||||||
backgroundModeBeatmap.BlurAmount.Value = BACKGROUND_BLUR;
|
backgroundModeBeatmap.BlurAmount.Value = configBackgroundBlur.Value ? BACKGROUND_BLUR : 0f;
|
||||||
backgroundModeBeatmap.FadeColour(Color4.White, 250);
|
backgroundModeBeatmap.FadeColour(Color4.White, 250);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user