mirror of
https://github.com/ppy/osu.git
synced 2024-11-11 14:17:26 +08:00
Initial design update pass
This commit is contained in:
parent
0e68620f70
commit
1484ae19f0
@ -12,7 +12,6 @@ using osu.Framework.Graphics.Shapes;
|
||||
using osu.Framework.Localisation;
|
||||
using osu.Framework.Logging;
|
||||
using osu.Framework.Threading;
|
||||
using osu.Game.Graphics;
|
||||
using osu.Game.Graphics.Containers;
|
||||
using osu.Game.Overlays.Notifications;
|
||||
using osu.Game.Resources.Localisation.Web;
|
||||
@ -35,6 +34,9 @@ namespace osu.Game.Overlays
|
||||
[Resolved]
|
||||
private AudioManager audio { get; set; } = null!;
|
||||
|
||||
[Cached]
|
||||
private OverlayColourProvider colourProvider = new OverlayColourProvider(OverlayColourScheme.Purple);
|
||||
|
||||
private readonly IBindable<Visibility> firstRunSetupVisibility = new Bindable<Visibility>();
|
||||
|
||||
[BackgroundDependencyLoader]
|
||||
@ -49,7 +51,7 @@ namespace osu.Game.Overlays
|
||||
new Box
|
||||
{
|
||||
RelativeSizeAxes = Axes.Both,
|
||||
Colour = OsuColour.Gray(0.05f),
|
||||
Colour = colourProvider.Background4,
|
||||
},
|
||||
new OsuScrollContainer
|
||||
{
|
||||
|
@ -12,7 +12,6 @@ using osu.Framework.Graphics.Shapes;
|
||||
using osu.Framework.Graphics.Sprites;
|
||||
using osu.Framework.Input.Events;
|
||||
using osu.Framework.Localisation;
|
||||
using osu.Game.Graphics;
|
||||
using osu.Game.Graphics.Containers;
|
||||
using osuTK;
|
||||
using osuTK.Graphics;
|
||||
@ -46,8 +45,9 @@ namespace osu.Game.Overlays.Notifications
|
||||
public virtual string PopInSampleName => "UI/notification-pop-in";
|
||||
|
||||
protected NotificationLight Light;
|
||||
private readonly CloseButton closeButton;
|
||||
|
||||
protected Container IconContent;
|
||||
|
||||
private readonly Container content;
|
||||
|
||||
protected override Container<Drawable> Content => content;
|
||||
@ -61,7 +61,7 @@ namespace osu.Game.Overlays.Notifications
|
||||
RelativeSizeAxes = Axes.X;
|
||||
AutoSizeAxes = Axes.Y;
|
||||
|
||||
AddRangeInternal(new Drawable[]
|
||||
InternalChildren = new Drawable[]
|
||||
{
|
||||
Light = new NotificationLight
|
||||
{
|
||||
@ -79,64 +79,68 @@ namespace osu.Game.Overlays.Notifications
|
||||
AutoSizeEasing = Easing.OutQuint,
|
||||
Children = new Drawable[]
|
||||
{
|
||||
new Box
|
||||
{
|
||||
RelativeSizeAxes = Axes.Both,
|
||||
Colour = Color4.White,
|
||||
},
|
||||
new Container
|
||||
new GridContainer
|
||||
{
|
||||
RelativeSizeAxes = Axes.X,
|
||||
Padding = new MarginPadding(5),
|
||||
AutoSizeAxes = Axes.Y,
|
||||
Children = new Drawable[]
|
||||
RowDimensions = new[]
|
||||
{
|
||||
IconContent = new Container
|
||||
{
|
||||
Size = new Vector2(40),
|
||||
Masking = true,
|
||||
CornerRadius = 5,
|
||||
},
|
||||
content = new Container
|
||||
{
|
||||
RelativeSizeAxes = Axes.X,
|
||||
AutoSizeAxes = Axes.Y,
|
||||
Padding = new MarginPadding
|
||||
{
|
||||
Left = 45,
|
||||
Right = 30
|
||||
},
|
||||
}
|
||||
}
|
||||
},
|
||||
closeButton = new CloseButton
|
||||
{
|
||||
Alpha = 0,
|
||||
Action = Close,
|
||||
Anchor = Anchor.CentreRight,
|
||||
Origin = Anchor.CentreRight,
|
||||
Margin = new MarginPadding
|
||||
{
|
||||
Right = 5
|
||||
new Dimension(GridSizeMode.AutoSize, minSize: 60)
|
||||
},
|
||||
}
|
||||
ColumnDimensions = new[]
|
||||
{
|
||||
new Dimension(GridSizeMode.AutoSize),
|
||||
new Dimension(),
|
||||
new Dimension(GridSizeMode.AutoSize),
|
||||
},
|
||||
Content = new[]
|
||||
{
|
||||
new Drawable[]
|
||||
{
|
||||
IconContent = new Container
|
||||
{
|
||||
Width = 40,
|
||||
RelativeSizeAxes = Axes.Y,
|
||||
},
|
||||
new Container
|
||||
{
|
||||
RelativeSizeAxes = Axes.X,
|
||||
AutoSizeAxes = Axes.Y,
|
||||
Padding = new MarginPadding(10),
|
||||
Children = new Drawable[]
|
||||
{
|
||||
content = new Container
|
||||
{
|
||||
RelativeSizeAxes = Axes.X,
|
||||
AutoSizeAxes = Axes.Y,
|
||||
},
|
||||
}
|
||||
},
|
||||
new CloseButton
|
||||
{
|
||||
Action = Close,
|
||||
Anchor = Anchor.TopRight,
|
||||
Origin = Anchor.TopRight,
|
||||
}
|
||||
}
|
||||
},
|
||||
},
|
||||
}
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
[BackgroundDependencyLoader]
|
||||
private void load(OverlayColourProvider colourProvider)
|
||||
{
|
||||
NotificationContent.Add(new Box
|
||||
{
|
||||
RelativeSizeAxes = Axes.Both,
|
||||
Colour = colourProvider.Background3,
|
||||
Depth = float.MaxValue
|
||||
});
|
||||
}
|
||||
|
||||
protected override bool OnHover(HoverEvent e)
|
||||
{
|
||||
closeButton.FadeIn(75);
|
||||
return base.OnHover(e);
|
||||
}
|
||||
|
||||
protected override void OnHoverLost(HoverLostEvent e)
|
||||
{
|
||||
closeButton.FadeOut(75);
|
||||
base.OnHoverLost(e);
|
||||
}
|
||||
|
||||
protected override bool OnClick(ClickEvent e)
|
||||
{
|
||||
if (Activated?.Invoke() ?? true)
|
||||
@ -150,6 +154,7 @@ namespace osu.Game.Overlays.Notifications
|
||||
base.LoadComplete();
|
||||
|
||||
this.FadeInFromZero(200);
|
||||
|
||||
NotificationContent.MoveToX(DrawSize.X);
|
||||
NotificationContent.MoveToX(0, 500, Easing.OutQuint);
|
||||
}
|
||||
@ -169,40 +174,48 @@ namespace osu.Game.Overlays.Notifications
|
||||
|
||||
private class CloseButton : OsuClickableContainer
|
||||
{
|
||||
private Color4 hoverColour;
|
||||
private SpriteIcon icon = null!;
|
||||
private Box background = null!;
|
||||
|
||||
public CloseButton()
|
||||
[Resolved]
|
||||
private OverlayColourProvider colourProvider { get; set; } = null!;
|
||||
|
||||
[BackgroundDependencyLoader]
|
||||
private void load()
|
||||
{
|
||||
Colour = OsuColour.Gray(0.2f);
|
||||
AutoSizeAxes = Axes.Both;
|
||||
RelativeSizeAxes = Axes.Y;
|
||||
Width = 24;
|
||||
|
||||
Children = new[]
|
||||
Children = new Drawable[]
|
||||
{
|
||||
new SpriteIcon
|
||||
background = new Box
|
||||
{
|
||||
Colour = colourProvider.Background4,
|
||||
Alpha = 0,
|
||||
RelativeSizeAxes = Axes.Both,
|
||||
},
|
||||
icon = new SpriteIcon
|
||||
{
|
||||
Anchor = Anchor.Centre,
|
||||
Origin = Anchor.Centre,
|
||||
Icon = FontAwesome.Solid.TimesCircle,
|
||||
Size = new Vector2(20),
|
||||
Icon = FontAwesome.Solid.Check,
|
||||
Size = new Vector2(12),
|
||||
Colour = colourProvider.Foreground1,
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
[BackgroundDependencyLoader]
|
||||
private void load(OsuColour colours)
|
||||
{
|
||||
hoverColour = colours.Yellow;
|
||||
}
|
||||
|
||||
protected override bool OnHover(HoverEvent e)
|
||||
{
|
||||
this.FadeColour(hoverColour, 200);
|
||||
background.FadeIn(200);
|
||||
icon.FadeColour(colourProvider.Content1, 200);
|
||||
return base.OnHover(e);
|
||||
}
|
||||
|
||||
protected override void OnHoverLost(HoverLostEvent e)
|
||||
{
|
||||
this.FadeColour(OsuColour.Gray(0.2f), 200);
|
||||
background.FadeOut(200);
|
||||
icon.FadeColour(colourProvider.Foreground1, 200);
|
||||
base.OnHoverLost(e);
|
||||
}
|
||||
}
|
||||
|
@ -57,7 +57,7 @@ namespace osu.Game.Overlays.Notifications
|
||||
set
|
||||
{
|
||||
progress = value;
|
||||
Scheduler.AddOnce(updateProgress, progress);
|
||||
Scheduler.AddOnce(p => progressBar.Progress = p, progress);
|
||||
}
|
||||
}
|
||||
|
||||
@ -174,7 +174,6 @@ namespace osu.Game.Overlays.Notifications
|
||||
{
|
||||
Content.Add(textDrawable = new OsuTextFlowContainer
|
||||
{
|
||||
Colour = OsuColour.Gray(128),
|
||||
AutoSizeAxes = Axes.Y,
|
||||
RelativeSizeAxes = Axes.X,
|
||||
});
|
||||
|
@ -3,7 +3,6 @@
|
||||
|
||||
using osu.Framework.Allocation;
|
||||
using osu.Framework.Graphics;
|
||||
using osu.Framework.Graphics.Colour;
|
||||
using osu.Framework.Graphics.Containers;
|
||||
using osu.Framework.Graphics.Shapes;
|
||||
using osu.Framework.Graphics.Sprites;
|
||||
@ -24,7 +23,8 @@ namespace osu.Game.Overlays.Notifications
|
||||
set
|
||||
{
|
||||
text = value;
|
||||
textDrawable.Text = text;
|
||||
if (textDrawable != null)
|
||||
textDrawable.Text = text;
|
||||
}
|
||||
}
|
||||
|
||||
@ -36,48 +36,46 @@ namespace osu.Game.Overlays.Notifications
|
||||
set
|
||||
{
|
||||
icon = value;
|
||||
iconDrawable.Icon = icon;
|
||||
if (iconDrawable != null)
|
||||
iconDrawable.Icon = icon;
|
||||
}
|
||||
}
|
||||
|
||||
private readonly TextFlowContainer textDrawable;
|
||||
private readonly SpriteIcon iconDrawable;
|
||||
protected Box IconBackground = null!;
|
||||
|
||||
protected Box IconBackground;
|
||||
private TextFlowContainer? textDrawable;
|
||||
|
||||
public SimpleNotification()
|
||||
private SpriteIcon? iconDrawable;
|
||||
|
||||
[BackgroundDependencyLoader]
|
||||
private void load(OsuColour colours, OverlayColourProvider colourProvider)
|
||||
{
|
||||
Light.Colour = colours.Green;
|
||||
|
||||
IconContent.AddRange(new Drawable[]
|
||||
{
|
||||
IconBackground = new Box
|
||||
{
|
||||
RelativeSizeAxes = Axes.Both,
|
||||
Colour = ColourInfo.GradientVertical(OsuColour.Gray(0.2f), OsuColour.Gray(0.6f))
|
||||
Colour = colourProvider.Background5,
|
||||
},
|
||||
iconDrawable = new SpriteIcon
|
||||
{
|
||||
Anchor = Anchor.Centre,
|
||||
Origin = Anchor.Centre,
|
||||
Icon = icon,
|
||||
Size = new Vector2(20),
|
||||
Size = new Vector2(16),
|
||||
}
|
||||
});
|
||||
|
||||
Content.Add(textDrawable = new OsuTextFlowContainer(t => t.Font = t.Font.With(size: 14))
|
||||
Content.Add(textDrawable = new OsuTextFlowContainer(t => t.Font = t.Font.With(size: 14, weight: FontWeight.Medium))
|
||||
{
|
||||
Colour = OsuColour.Gray(128),
|
||||
AutoSizeAxes = Axes.Y,
|
||||
RelativeSizeAxes = Axes.X,
|
||||
Text = text
|
||||
});
|
||||
}
|
||||
|
||||
[BackgroundDependencyLoader]
|
||||
private void load(OsuColour colours)
|
||||
{
|
||||
Light.Colour = colours.Green;
|
||||
}
|
||||
|
||||
public override bool Read
|
||||
{
|
||||
get => base.Read;
|
||||
|
Loading…
Reference in New Issue
Block a user