diff --git a/osu.Game/Overlays/Notifications/Notification.cs b/osu.Game/Overlays/Notifications/Notification.cs index 9270e4e792..6faa79433e 100644 --- a/osu.Game/Overlays/Notifications/Notification.cs +++ b/osu.Game/Overlays/Notifications/Notification.cs @@ -53,8 +53,7 @@ namespace osu.Game.Overlays.Notifications } } - [BackgroundDependencyLoader] - private void load(OsuColour colours) + public Notification() { RelativeSizeAxes = Axes.X; AutoSizeAxes = Axes.Y; diff --git a/osu.Game/Overlays/Notifications/ProgressNotification.cs b/osu.Game/Overlays/Notifications/ProgressNotification.cs index b00204e166..8b0fc27d36 100644 --- a/osu.Game/Overlays/Notifications/ProgressNotification.cs +++ b/osu.Game/Overlays/Notifications/ProgressNotification.cs @@ -16,27 +16,21 @@ namespace osu.Game.Overlays.Notifications { public class ProgressNotification : Notification, IHasCompletionTarget { - private string text; public string Text { - get { return text; } + get { return textDrawable.Text; } set { - text = value; - if (IsLoaded) - textDrawable.Text = text; + textDrawable.Text = value; } } - private float progress; public float Progress { - get { return progress; } + get { return progressBar.Progress; } set { - progress = value; - if (IsLoaded) - progressBar.Progress = progress; + progressBar.Progress = value; } } @@ -46,7 +40,6 @@ namespace osu.Game.Overlays.Notifications //we may have received changes before we were displayed. State = state; - Progress = progress; } public virtual ProgressNotificationState State @@ -105,6 +98,7 @@ namespace osu.Game.Overlays.Notifications protected virtual void Completed() { + Expire(); CompletionTarget?.Invoke(CreateCompletionNotification()); } @@ -117,13 +111,8 @@ namespace osu.Game.Overlays.Notifications private SpriteText textDrawable; - [BackgroundDependencyLoader] - private void load(OsuColour colours) + public ProgressNotification() { - colourQueued = colours.YellowDark; - colourActive = colours.Blue; - colourCancelled = colours.Red; - IconContent.Add(new Box { RelativeSizeAxes = Axes.Both, @@ -135,7 +124,6 @@ namespace osu.Game.Overlays.Notifications Colour = OsuColour.Gray(128), AutoSizeAxes = Axes.Y, RelativeSizeAxes = Axes.X, - Text = text }); NotificationContent.Add(progressBar = new ProgressBar @@ -148,6 +136,14 @@ namespace osu.Game.Overlays.Notifications State = ProgressNotificationState.Queued; } + [BackgroundDependencyLoader] + private void load(OsuColour colours) + { + colourQueued = colours.YellowDark; + colourActive = colours.Blue; + colourCancelled = colours.Red; + } + public override void Close() { switch (State) diff --git a/osu.Game/Overlays/Notifications/SimpleNotification.cs b/osu.Game/Overlays/Notifications/SimpleNotification.cs index 52bd271252..cf16978c3e 100644 --- a/osu.Game/Overlays/Notifications/SimpleNotification.cs +++ b/osu.Game/Overlays/Notifications/SimpleNotification.cs @@ -18,8 +18,7 @@ namespace osu.Game.Overlays.Notifications set { text = value; - if (IsLoaded) - textDrawable.Text = text; + textDrawable.Text = text; } } @@ -30,17 +29,14 @@ namespace osu.Game.Overlays.Notifications set { icon = value; - if (IsLoaded) - iconDrawable.Icon = icon; + iconDrawable.Icon = icon; } } - private SpriteText textDrawable; private TextAwesome iconDrawable; - [BackgroundDependencyLoader] - private void load(OsuColour colours) + public SimpleNotification() { IconContent.Add(new Drawable[] { @@ -64,7 +60,11 @@ namespace osu.Game.Overlays.Notifications RelativeSizeAxes = Axes.X, Text = text }); + } + [BackgroundDependencyLoader] + private void load(OsuColour colours) + { Light.Colour = colours.Green; }