mirror of
https://github.com/ppy/osu.git
synced 2025-01-06 07:02:54 +08:00
Merge pull request #1069 from peppy/notification-improvements
Improvements to (progress) notifications
This commit is contained in:
commit
bc21798e41
@ -63,6 +63,8 @@ namespace osu.Game.Overlays.Notifications
|
|||||||
Masking = true,
|
Masking = true,
|
||||||
RelativeSizeAxes = Axes.X,
|
RelativeSizeAxes = Axes.X,
|
||||||
AutoSizeAxes = Axes.Y,
|
AutoSizeAxes = Axes.Y,
|
||||||
|
AutoSizeDuration = 400,
|
||||||
|
AutoSizeEasing = Easing.OutQuint,
|
||||||
Children = new Drawable[]
|
Children = new Drawable[]
|
||||||
{
|
{
|
||||||
new Box
|
new Box
|
||||||
@ -74,7 +76,7 @@ namespace osu.Game.Overlays.Notifications
|
|||||||
{
|
{
|
||||||
RelativeSizeAxes = Axes.X,
|
RelativeSizeAxes = Axes.X,
|
||||||
Padding = new MarginPadding(5),
|
Padding = new MarginPadding(5),
|
||||||
Height = 60,
|
AutoSizeAxes = Axes.Y,
|
||||||
Children = new Drawable[]
|
Children = new Drawable[]
|
||||||
{
|
{
|
||||||
IconContent = new Container
|
IconContent = new Container
|
||||||
|
@ -6,9 +6,7 @@ using osu.Framework.Allocation;
|
|||||||
using osu.Framework.Graphics;
|
using osu.Framework.Graphics;
|
||||||
using osu.Framework.Graphics.Containers;
|
using osu.Framework.Graphics.Containers;
|
||||||
using osu.Framework.Graphics.Shapes;
|
using osu.Framework.Graphics.Shapes;
|
||||||
using osu.Framework.Graphics.Sprites;
|
|
||||||
using osu.Game.Graphics;
|
using osu.Game.Graphics;
|
||||||
using osu.Game.Graphics.Sprites;
|
|
||||||
using OpenTK;
|
using OpenTK;
|
||||||
using OpenTK.Graphics;
|
using OpenTK.Graphics;
|
||||||
|
|
||||||
@ -18,10 +16,9 @@ namespace osu.Game.Overlays.Notifications
|
|||||||
{
|
{
|
||||||
public string Text
|
public string Text
|
||||||
{
|
{
|
||||||
get { return textDrawable.Text; }
|
|
||||||
set
|
set
|
||||||
{
|
{
|
||||||
textDrawable.Text = value;
|
Schedule(() => textDrawable.Text = value);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -90,7 +87,7 @@ namespace osu.Game.Overlays.Notifications
|
|||||||
protected virtual Notification CreateCompletionNotification() => new ProgressCompletionNotification
|
protected virtual Notification CreateCompletionNotification() => new ProgressCompletionNotification
|
||||||
{
|
{
|
||||||
Activated = CompletionClickAction,
|
Activated = CompletionClickAction,
|
||||||
Text = $"Task \"{Text}\" has completed!"
|
Text = "Task has completed!"
|
||||||
};
|
};
|
||||||
|
|
||||||
protected virtual void Completed()
|
protected virtual void Completed()
|
||||||
@ -106,7 +103,7 @@ namespace osu.Game.Overlays.Notifications
|
|||||||
private Color4 colourActive;
|
private Color4 colourActive;
|
||||||
private Color4 colourCancelled;
|
private Color4 colourCancelled;
|
||||||
|
|
||||||
private readonly SpriteText textDrawable;
|
private readonly TextFlowContainer textDrawable;
|
||||||
|
|
||||||
public ProgressNotification()
|
public ProgressNotification()
|
||||||
{
|
{
|
||||||
@ -115,9 +112,11 @@ namespace osu.Game.Overlays.Notifications
|
|||||||
RelativeSizeAxes = Axes.Both,
|
RelativeSizeAxes = Axes.Both,
|
||||||
});
|
});
|
||||||
|
|
||||||
Content.Add(textDrawable = new OsuSpriteText
|
Content.Add(textDrawable = new TextFlowContainer(t =>
|
||||||
|
{
|
||||||
|
t.TextSize = 16;
|
||||||
|
})
|
||||||
{
|
{
|
||||||
TextSize = 16,
|
|
||||||
Colour = OsuColour.Gray(128),
|
Colour = OsuColour.Gray(128),
|
||||||
AutoSizeAxes = Axes.Y,
|
AutoSizeAxes = Axes.Y,
|
||||||
RelativeSizeAxes = Axes.X,
|
RelativeSizeAxes = Axes.X,
|
||||||
@ -131,6 +130,9 @@ namespace osu.Game.Overlays.Notifications
|
|||||||
});
|
});
|
||||||
|
|
||||||
State = ProgressNotificationState.Queued;
|
State = ProgressNotificationState.Queued;
|
||||||
|
|
||||||
|
// don't close on click by default.
|
||||||
|
Activated = () => false;
|
||||||
}
|
}
|
||||||
|
|
||||||
[BackgroundDependencyLoader]
|
[BackgroundDependencyLoader]
|
||||||
@ -167,7 +169,7 @@ namespace osu.Game.Overlays.Notifications
|
|||||||
|
|
||||||
private class ProgressBar : Container
|
private class ProgressBar : Container
|
||||||
{
|
{
|
||||||
private Box box;
|
private readonly Box box;
|
||||||
|
|
||||||
private Color4 colourActive;
|
private Color4 colourActive;
|
||||||
private Color4 colourInactive;
|
private Color4 colourInactive;
|
||||||
@ -197,15 +199,8 @@ namespace osu.Game.Overlays.Notifications
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public ProgressBar()
|
||||||
[BackgroundDependencyLoader]
|
|
||||||
private void load(OsuColour colours)
|
|
||||||
{
|
{
|
||||||
colourActive = colours.Blue;
|
|
||||||
Colour = colourInactive = OsuColour.Gray(0.5f);
|
|
||||||
|
|
||||||
Height = 5;
|
|
||||||
|
|
||||||
Children = new[]
|
Children = new[]
|
||||||
{
|
{
|
||||||
box = new Box
|
box = new Box
|
||||||
@ -215,6 +210,15 @@ namespace osu.Game.Overlays.Notifications
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
[BackgroundDependencyLoader]
|
||||||
|
private void load(OsuColour colours)
|
||||||
|
{
|
||||||
|
colourActive = colours.Blue;
|
||||||
|
Colour = colourInactive = OsuColour.Gray(0.5f);
|
||||||
|
Height = 5;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user