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
4 changed files with 60 additions and 48 deletions

View File

@ -66,6 +66,7 @@ namespace osu.Game.Beatmaps
if (beatmapSet.DeletePending) return false; if (beatmapSet.DeletePending) return false;
beatmapSet.DeletePending = true; beatmapSet.DeletePending = true;
context.Update(beatmapSet);
context.SaveChanges(); context.SaveChanges();
BeatmapSetRemoved?.Invoke(beatmapSet); BeatmapSetRemoved?.Invoke(beatmapSet);
@ -84,6 +85,7 @@ namespace osu.Game.Beatmaps
if (!beatmapSet.DeletePending) return false; if (!beatmapSet.DeletePending) return false;
beatmapSet.DeletePending = false; beatmapSet.DeletePending = false;
context.Update(beatmapSet);
context.SaveChanges(); context.SaveChanges();
BeatmapSetAdded?.Invoke(beatmapSet); BeatmapSetAdded?.Invoke(beatmapSet);
@ -102,6 +104,7 @@ namespace osu.Game.Beatmaps
if (beatmap.Hidden) return false; if (beatmap.Hidden) return false;
beatmap.Hidden = true; beatmap.Hidden = true;
context.Update(beatmap);
context.SaveChanges(); context.SaveChanges();
BeatmapHidden?.Invoke(beatmap); BeatmapHidden?.Invoke(beatmap);
@ -120,6 +123,7 @@ namespace osu.Game.Beatmaps
if (!beatmap.Hidden) return false; if (!beatmap.Hidden) return false;
beatmap.Hidden = false; beatmap.Hidden = false;
context.Update(beatmap);
context.SaveChanges(); context.SaveChanges();
BeatmapRestored?.Invoke(beatmap); BeatmapRestored?.Invoke(beatmap);
@ -137,7 +141,7 @@ namespace osu.Game.Beatmaps
// metadata is M-N so we can't rely on cascades // metadata is M-N so we can't rely on cascades
context.BeatmapMetadata.RemoveRange(purgeable.Select(s => s.Metadata)); 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. // 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))); 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 public float Progress
{ {
get { return progressBar.Progress; } get { return progressBar.Progress; }
set set { Schedule(() => progressBar.Progress = value); }
{
progressBar.Progress = value;
}
} }
protected override void LoadComplete() protected override void LoadComplete()
@ -44,41 +41,44 @@ namespace osu.Game.Overlays.Notifications
get { return state; } get { return state; }
set set
{ {
bool stateChanged = state != value; Schedule(() =>
state = value;
if (IsLoaded)
{ {
switch (state) bool stateChanged = state != value;
{ state = value;
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) if (IsLoaded)
{
switch (state)
{ {
case ProgressNotificationState.Completed: switch (state)
NotificationContent.MoveToY(-DrawSize.Y / 2, 200, Easing.OutQuint); {
this.FadeOut(200).Finally(d => Completed()); case ProgressNotificationState.Queued:
break; 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, Completed,
Cancelled Cancelled
} }
} }

View File

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

View File

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