1
0
mirror of https://github.com/ppy/osu.git synced 2025-02-15 10:22:56 +08:00

Merge remote-tracking branch 'upstream/master' into db-migration-fixes

This commit is contained in:
Dean Herbert 2017-10-21 00:15:21 +09:00
commit 270f984ae7
4 changed files with 60 additions and 48 deletions

View File

@ -66,6 +66,7 @@ namespace osu.Game.Beatmaps
if (beatmapSet.DeletePending) return false;
beatmapSet.DeletePending = true;
context.Update(beatmapSet);
context.SaveChanges();
BeatmapSetRemoved?.Invoke(beatmapSet);
@ -84,6 +85,7 @@ namespace osu.Game.Beatmaps
if (!beatmapSet.DeletePending) return false;
beatmapSet.DeletePending = false;
context.Update(beatmapSet);
context.SaveChanges();
BeatmapSetAdded?.Invoke(beatmapSet);
@ -102,6 +104,7 @@ namespace osu.Game.Beatmaps
if (beatmap.Hidden) return false;
beatmap.Hidden = true;
context.Update(beatmap);
context.SaveChanges();
BeatmapHidden?.Invoke(beatmap);
@ -120,6 +123,7 @@ namespace osu.Game.Beatmaps
if (!beatmap.Hidden) return false;
beatmap.Hidden = false;
context.Update(beatmap);
context.SaveChanges();
BeatmapRestored?.Invoke(beatmap);
@ -137,7 +141,7 @@ namespace osu.Game.Beatmaps
// metadata is M-N so we can't rely on cascades
context.BeatmapMetadata.RemoveRange(purgeable.Select(s => s.Metadata));
context.BeatmapMetadata.RemoveRange(purgeable.SelectMany(s => s.Beatmaps.Select(b => b.Metadata)));
context.BeatmapMetadata.RemoveRange(purgeable.SelectMany(s => s.Beatmaps.Select(b => b.Metadata).Where(m => m != null)));
// todo: we can probably make cascades work here with a FK in BeatmapDifficulty. just make to make it work correctly.
context.BeatmapDifficulty.RemoveRange(purgeable.SelectMany(s => s.Beatmaps.Select(b => b.BaseDifficulty)));

View File

@ -25,10 +25,7 @@ namespace osu.Game.Overlays.Notifications
public float Progress
{
get { return progressBar.Progress; }
set
{
progressBar.Progress = value;
}
set { Schedule(() => progressBar.Progress = value); }
}
protected override void LoadComplete()
@ -44,41 +41,44 @@ namespace osu.Game.Overlays.Notifications
get { return state; }
set
{
bool stateChanged = state != value;
state = value;
if (IsLoaded)
Schedule(() =>
{
switch (state)
{
case ProgressNotificationState.Queued:
Light.Colour = colourQueued;
Light.Pulsate = false;
progressBar.Active = false;
break;
case ProgressNotificationState.Active:
Light.Colour = colourActive;
Light.Pulsate = true;
progressBar.Active = true;
break;
case ProgressNotificationState.Cancelled:
Light.Colour = colourCancelled;
Light.Pulsate = false;
progressBar.Active = false;
break;
}
}
bool stateChanged = state != value;
state = value;
if (stateChanged)
{
switch (state)
if (IsLoaded)
{
case ProgressNotificationState.Completed:
NotificationContent.MoveToY(-DrawSize.Y / 2, 200, Easing.OutQuint);
this.FadeOut(200).Finally(d => Completed());
break;
switch (state)
{
case ProgressNotificationState.Queued:
Light.Colour = colourQueued;
Light.Pulsate = false;
progressBar.Active = false;
break;
case ProgressNotificationState.Active:
Light.Colour = colourActive;
Light.Pulsate = true;
progressBar.Active = true;
break;
case ProgressNotificationState.Cancelled:
Light.Colour = colourCancelled;
Light.Pulsate = false;
progressBar.Active = false;
break;
}
}
}
if (stateChanged)
{
switch (state)
{
case ProgressNotificationState.Completed:
NotificationContent.MoveToY(-DrawSize.Y / 2, 200, Easing.OutQuint);
this.FadeOut(200).Finally(d => Completed());
break;
}
}
});
}
}
@ -232,4 +232,4 @@ namespace osu.Game.Overlays.Notifications
Completed,
Cancelled
}
}
}

View File

@ -52,7 +52,7 @@ namespace osu.Game.Screens.Select
Schedule(() =>
{
foreach (var g in newGroups)
addGroup(g);
if (g != null) addGroup(g);
computeYPositions();
BeatmapsChanged?.Invoke();
@ -101,6 +101,9 @@ namespace osu.Game.Screens.Select
{
var group = createGroup(beatmapSet);
if (group == null)
return;
addGroup(group);
computeYPositions();
if (selectedGroup == null)
@ -124,19 +127,23 @@ namespace osu.Game.Screens.Select
if (group == null)
return;
var newGroup = createGroup(set);
int i = groups.IndexOf(group);
groups.RemoveAt(i);
groups.Insert(i, newGroup);
if (selectedGroup == group && newGroup.BeatmapPanels.Count == 0)
var newGroup = createGroup(set);
if (newGroup != null)
groups.Insert(i, newGroup);
bool hadSelection = selectedGroup == group;
if (hadSelection && newGroup == null)
selectedGroup = null;
Filter(null, false);
//check if we can/need to maintain our current selection.
if (selectedGroup == group && newGroup.BeatmapPanels.Count > 0)
if (hadSelection && newGroup != null)
{
var newSelection =
newGroup.BeatmapPanels.Find(p => p.Beatmap.ID == selectedPanel?.Beatmap.ID) ??
@ -335,6 +342,9 @@ namespace osu.Game.Screens.Select
private BeatmapGroup createGroup(BeatmapSetInfo beatmapSet)
{
if (beatmapSet.Beatmaps.All(b => b.Hidden))
return null;
foreach (var b in beatmapSet.Beatmaps)
{
if (b.Metadata == null)

View File

@ -66,13 +66,11 @@ namespace osu.Game.Tests.Visual
progressingNotifications.RemoveAll(n => n.State == ProgressNotificationState.Completed);
while (progressingNotifications.Count(n => n.State == ProgressNotificationState.Active) < 3)
if (progressingNotifications.Count(n => n.State == ProgressNotificationState.Active) < 3)
{
var p = progressingNotifications.FirstOrDefault(n => n.IsAlive && n.State == ProgressNotificationState.Queued);
if (p == null)
break;
p.State = ProgressNotificationState.Active;
if (p != null)
p.State = ProgressNotificationState.Active;
}
foreach (var n in progressingNotifications.FindAll(n => n.State == ProgressNotificationState.Active))