mirror of
https://github.com/ppy/osu.git
synced 2025-01-28 22:06:08 +08:00
Merge branch 'master' into fix-ctb-2b-diffcalc
This commit is contained in:
commit
173a543853
@ -87,14 +87,6 @@ namespace osu.Game.Overlays.Profile.Header
|
|||||||
|
|
||||||
addSpacer(topLinkContainer);
|
addSpacer(topLinkContainer);
|
||||||
|
|
||||||
if (user.PlayStyles?.Length > 0)
|
|
||||||
{
|
|
||||||
topLinkContainer.AddText("Plays with ");
|
|
||||||
topLinkContainer.AddText(string.Join(", ", user.PlayStyles.Select(style => style.GetDescription())), embolden);
|
|
||||||
|
|
||||||
addSpacer(topLinkContainer);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (user.LastVisit.HasValue)
|
if (user.LastVisit.HasValue)
|
||||||
{
|
{
|
||||||
topLinkContainer.AddText("Last seen ");
|
topLinkContainer.AddText("Last seen ");
|
||||||
@ -103,6 +95,14 @@ namespace osu.Game.Overlays.Profile.Header
|
|||||||
addSpacer(topLinkContainer);
|
addSpacer(topLinkContainer);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (user.PlayStyles?.Length > 0)
|
||||||
|
{
|
||||||
|
topLinkContainer.AddText("Plays with ");
|
||||||
|
topLinkContainer.AddText(string.Join(", ", user.PlayStyles.Select(style => style.GetDescription())), embolden);
|
||||||
|
|
||||||
|
addSpacer(topLinkContainer);
|
||||||
|
}
|
||||||
|
|
||||||
topLinkContainer.AddText("Contributed ");
|
topLinkContainer.AddText("Contributed ");
|
||||||
topLinkContainer.AddLink($@"{user.PostCount:#,##0} forum posts", $"https://osu.ppy.sh/users/{user.Id}/posts", creationParameters: embolden);
|
topLinkContainer.AddLink($@"{user.PostCount:#,##0} forum posts", $"https://osu.ppy.sh/users/{user.Id}/posts", creationParameters: embolden);
|
||||||
|
|
||||||
|
@ -4,21 +4,20 @@
|
|||||||
using System;
|
using System;
|
||||||
using osu.Framework.Allocation;
|
using osu.Framework.Allocation;
|
||||||
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.Colour;
|
||||||
using osu.Framework.Graphics.Containers;
|
using osu.Framework.Graphics.Containers;
|
||||||
using osu.Framework.Graphics.Shapes;
|
|
||||||
using osu.Framework.Graphics.Sprites;
|
using osu.Framework.Graphics.Sprites;
|
||||||
using osu.Framework.Graphics.UserInterface;
|
using osu.Framework.Graphics.UserInterface;
|
||||||
using osu.Framework.Input.Events;
|
using osu.Framework.Input.Events;
|
||||||
using osu.Game.Graphics;
|
using osu.Game.Graphics;
|
||||||
|
using osu.Game.Graphics.UserInterface;
|
||||||
using osuTK;
|
using osuTK;
|
||||||
using osuTK.Graphics;
|
using osuTK.Graphics;
|
||||||
|
|
||||||
namespace osu.Game.Overlays.Volume
|
namespace osu.Game.Overlays.Volume
|
||||||
{
|
{
|
||||||
public class MuteButton : Container, IHasCurrentValue<bool>
|
public class MuteButton : OsuButton, IHasCurrentValue<bool>
|
||||||
{
|
{
|
||||||
private readonly Bindable<bool> current = new Bindable<bool>();
|
private readonly Bindable<bool> current = new Bindable<bool>();
|
||||||
|
|
||||||
@ -36,63 +35,57 @@ namespace osu.Game.Overlays.Volume
|
|||||||
}
|
}
|
||||||
|
|
||||||
private Color4 hoveredColour, unhoveredColour;
|
private Color4 hoveredColour, unhoveredColour;
|
||||||
|
|
||||||
private const float width = 100;
|
private const float width = 100;
|
||||||
public const float HEIGHT = 35;
|
public const float HEIGHT = 35;
|
||||||
|
|
||||||
public MuteButton()
|
public MuteButton()
|
||||||
{
|
{
|
||||||
Masking = true;
|
Content.BorderThickness = 3;
|
||||||
BorderThickness = 3;
|
Content.CornerRadius = HEIGHT / 2;
|
||||||
CornerRadius = HEIGHT / 2;
|
|
||||||
Size = new Vector2(width, HEIGHT);
|
Size = new Vector2(width, HEIGHT);
|
||||||
|
|
||||||
|
Action = () => Current.Value = !Current.Value;
|
||||||
}
|
}
|
||||||
|
|
||||||
[BackgroundDependencyLoader]
|
[BackgroundDependencyLoader]
|
||||||
private void load(OsuColour colours)
|
private void load(OsuColour colours)
|
||||||
{
|
{
|
||||||
hoveredColour = colours.YellowDark;
|
hoveredColour = colours.YellowDark;
|
||||||
BorderColour = unhoveredColour = colours.Gray1.Opacity(0.9f);
|
|
||||||
|
Content.BorderColour = unhoveredColour = colours.Gray1;
|
||||||
|
BackgroundColour = colours.Gray1;
|
||||||
|
|
||||||
SpriteIcon icon;
|
SpriteIcon icon;
|
||||||
|
|
||||||
AddRange(new Drawable[]
|
AddRange(new Drawable[]
|
||||||
{
|
{
|
||||||
new Box
|
|
||||||
{
|
|
||||||
RelativeSizeAxes = Axes.Both,
|
|
||||||
Colour = colours.Gray1,
|
|
||||||
Alpha = 0.9f,
|
|
||||||
},
|
|
||||||
icon = new SpriteIcon
|
icon = new SpriteIcon
|
||||||
{
|
{
|
||||||
Anchor = Anchor.CentreLeft,
|
Anchor = Anchor.Centre,
|
||||||
Origin = Anchor.CentreLeft,
|
Origin = Anchor.Centre,
|
||||||
Size = new Vector2(20),
|
Size = new Vector2(20),
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
Current.ValueChanged += muted =>
|
Current.ValueChanged += muted =>
|
||||||
{
|
{
|
||||||
icon.Icon = muted.NewValue ? FontAwesome.Solid.VolumeOff : FontAwesome.Solid.VolumeUp;
|
icon.Icon = muted.NewValue ? FontAwesome.Solid.VolumeMute : FontAwesome.Solid.VolumeUp;
|
||||||
icon.Margin = new MarginPadding { Left = muted.NewValue ? width / 2 - 15 : width / 2 - 10 }; //Magic numbers to line up both icons because they're different widths
|
|
||||||
};
|
};
|
||||||
|
|
||||||
Current.TriggerChange();
|
Current.TriggerChange();
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override bool OnHover(HoverEvent e)
|
protected override bool OnHover(HoverEvent e)
|
||||||
{
|
{
|
||||||
this.TransformTo<MuteButton, SRGBColour>("BorderColour", hoveredColour, 500, Easing.OutQuint);
|
Content.TransformTo<Container<Drawable>, SRGBColour>("BorderColour", hoveredColour, 500, Easing.OutQuint);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override void OnHoverLost(HoverLostEvent e)
|
protected override void OnHoverLost(HoverLostEvent e)
|
||||||
{
|
{
|
||||||
this.TransformTo<MuteButton, SRGBColour>("BorderColour", unhoveredColour, 500, Easing.OutQuint);
|
Content.TransformTo<Container<Drawable>, SRGBColour>("BorderColour", unhoveredColour, 500, Easing.OutQuint);
|
||||||
}
|
|
||||||
|
|
||||||
protected override bool OnClick(ClickEvent e)
|
|
||||||
{
|
|
||||||
Current.Value = !Current.Value;
|
|
||||||
return true;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user