1
0
mirror of https://github.com/ppy/osu.git synced 2024-11-11 17:07:38 +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
{
get
@ -379,7 +374,7 @@ namespace osu.Game.Online.Leaderboards
List<MenuItem> items = new List<MenuItem>();
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();
}

View File

@ -104,7 +104,7 @@ namespace osu.Game.Screens.Select.Leaderboards
ScoreSelected = s => ScoreSelected?.Invoke(s)
});
scoreManager.ItemRemoved += deleteLocalScore;
scoreManager.ItemRemoved += onScoreRemoved;
}
protected override void Reset()
@ -113,15 +113,7 @@ namespace osu.Game.Screens.Select.Leaderboards
TopScore = null;
}
protected override void Dispose(bool isDisposing)
{
base.Dispose(isDisposing);
if (scoreManager != null)
{
scoreManager.ItemRemoved -= deleteLocalScore;
}
}
private void onScoreRemoved(ScoreInfo score) => Schedule(RefreshScores);
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;
}
}
}