1
0
mirror of https://github.com/ppy/osu.git synced 2025-01-14 20:32:55 +08:00

Cleanup methods/events

This commit is contained in:
smoogipoo 2020-01-06 17:20:09 +09:00
parent ee15967c4a
commit 4a7f5f98df
2 changed files with 8 additions and 18 deletions

View File

@ -367,11 +367,6 @@ namespace osu.Game.Online.Leaderboards
} }
} }
protected virtual void DeleteLocalScore(ScoreInfo score)
{
dialogOverlay?.Push(new LocalScoreDeleteDialog(score));
}
public MenuItem[] ContextMenuItems public MenuItem[] ContextMenuItems
{ {
get get
@ -379,7 +374,7 @@ namespace osu.Game.Online.Leaderboards
List<MenuItem> items = new List<MenuItem>(); List<MenuItem> items = new List<MenuItem>();
if (score.ID != 0) if (score.ID != 0)
items.Add(new OsuMenuItem("Delete", MenuItemType.Destructive, () => DeleteLocalScore(score))); items.Add(new OsuMenuItem("Delete", MenuItemType.Destructive, () => dialogOverlay?.Push(new LocalScoreDeleteDialog(score))));
return items.ToArray(); return items.ToArray();
} }

View File

@ -104,7 +104,7 @@ namespace osu.Game.Screens.Select.Leaderboards
ScoreSelected = s => ScoreSelected?.Invoke(s) ScoreSelected = s => ScoreSelected?.Invoke(s)
}); });
scoreManager.ItemRemoved += deleteLocalScore; scoreManager.ItemRemoved += onScoreRemoved;
} }
protected override void Reset() protected override void Reset()
@ -113,15 +113,7 @@ namespace osu.Game.Screens.Select.Leaderboards
TopScore = null; TopScore = null;
} }
protected override void Dispose(bool isDisposing) private void onScoreRemoved(ScoreInfo score) => Schedule(RefreshScores);
{
base.Dispose(isDisposing);
if (scoreManager != null)
{
scoreManager.ItemRemoved -= deleteLocalScore;
}
}
protected override bool IsOnlineScope => Scope != BeatmapLeaderboardScope.Local; protected override bool IsOnlineScope => Scope != BeatmapLeaderboardScope.Local;
@ -204,9 +196,12 @@ namespace osu.Game.Screens.Select.Leaderboards
}; };
} }
private void deleteLocalScore(ScoreInfo score) protected override void Dispose(bool isDisposing)
{ {
Schedule(RefreshScores); base.Dispose(isDisposing);
if (scoreManager != null)
scoreManager.ItemRemoved -= onScoreRemoved;
} }
} }
} }