mirror of
https://github.com/ppy/osu.git
synced 2024-12-19 09:33:02 +08:00
Merge branch 'Private_Messages' of https://github.com/miterosan/osu into Private_Messages
This commit is contained in:
commit
4927abfde5
@ -35,11 +35,13 @@ namespace osu.Game.Database
|
||||
|
||||
/// <summary>
|
||||
/// Fired when a new <see cref="TModel"/> becomes available in the database.
|
||||
/// This is not guaranteed to run on the update thread.
|
||||
/// </summary>
|
||||
public event Action<TModel> ItemAdded;
|
||||
|
||||
/// <summary>
|
||||
/// Fired when a <see cref="TModel"/> is removed from the database.
|
||||
/// This is not guaranteed to run on the update thread.
|
||||
/// </summary>
|
||||
public event Action<TModel> ItemRemoved;
|
||||
|
||||
|
@ -246,11 +246,11 @@ namespace osu.Game.Overlays.BeatmapSet
|
||||
if (beatmaps != null) beatmaps.ItemAdded -= handleBeatmapAdd;
|
||||
}
|
||||
|
||||
private void handleBeatmapAdd(BeatmapSetInfo beatmap)
|
||||
private void handleBeatmapAdd(BeatmapSetInfo beatmap) => Schedule(() =>
|
||||
{
|
||||
if (beatmap.OnlineBeatmapSetID == BeatmapSet?.OnlineBeatmapSetID)
|
||||
downloadButtonsContainer.FadeOut(transition_duration);
|
||||
}
|
||||
});
|
||||
|
||||
private void download(bool noVideo)
|
||||
{
|
||||
|
@ -188,12 +188,12 @@ namespace osu.Game.Overlays
|
||||
beatmaps.ItemAdded += setAdded;
|
||||
}
|
||||
|
||||
private void setAdded(BeatmapSetInfo set)
|
||||
private void setAdded(BeatmapSetInfo set) => Schedule(() =>
|
||||
{
|
||||
// if a new map was imported, we should remove it from search results (download completed etc.)
|
||||
panels?.FirstOrDefault(p => p.SetInfo.OnlineBeatmapSetID == set.OnlineBeatmapSetID)?.FadeOut(400).Expire();
|
||||
BeatmapSets = BeatmapSets?.Where(b => b.OnlineBeatmapSetID != set.OnlineBeatmapSetID);
|
||||
}
|
||||
});
|
||||
|
||||
private void updateResultCounts()
|
||||
{
|
||||
@ -323,6 +323,14 @@ namespace osu.Game.Overlays
|
||||
|
||||
private int distinctCount(List<string> list) => list.Distinct().ToArray().Length;
|
||||
|
||||
protected override void Dispose(bool isDisposing)
|
||||
{
|
||||
base.Dispose(isDisposing);
|
||||
|
||||
if (beatmaps != null)
|
||||
beatmaps.ItemAdded -= setAdded;
|
||||
}
|
||||
|
||||
public class ResultCounts
|
||||
{
|
||||
public readonly int Artists;
|
||||
|
@ -74,8 +74,8 @@ namespace osu.Game.Overlays.Music
|
||||
},
|
||||
};
|
||||
|
||||
beatmaps.ItemAdded += list.AddBeatmapSet;
|
||||
beatmaps.ItemRemoved += list.RemoveBeatmapSet;
|
||||
beatmaps.ItemAdded += handleBeatmapAdded;
|
||||
beatmaps.ItemRemoved += handleBeatmapRemoved;
|
||||
|
||||
list.BeatmapSets = beatmaps.GetAllUsableBeatmapSets();
|
||||
|
||||
@ -95,6 +95,9 @@ namespace osu.Game.Overlays.Music
|
||||
beatmapBacking.TriggerChange();
|
||||
}
|
||||
|
||||
private void handleBeatmapAdded(BeatmapSetInfo setInfo) => Schedule(() => list.AddBeatmapSet(setInfo));
|
||||
private void handleBeatmapRemoved(BeatmapSetInfo setInfo) => Schedule(() => list.RemoveBeatmapSet(setInfo));
|
||||
|
||||
protected override void PopIn()
|
||||
{
|
||||
filter.Search.HoldFocus = true;
|
||||
@ -153,6 +156,17 @@ namespace osu.Game.Overlays.Music
|
||||
|
||||
track.Restart();
|
||||
}
|
||||
|
||||
protected override void Dispose(bool isDisposing)
|
||||
{
|
||||
base.Dispose(isDisposing);
|
||||
|
||||
if (beatmaps != null)
|
||||
{
|
||||
beatmaps.ItemAdded -= handleBeatmapAdded;
|
||||
beatmaps.ItemRemoved -= handleBeatmapRemoved;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//todo: placeholder
|
||||
|
@ -21,9 +21,13 @@ namespace osu.Game.Overlays.Settings.Sections
|
||||
|
||||
public override FontAwesome Icon => FontAwesome.fa_paint_brush;
|
||||
|
||||
private SkinManager skins;
|
||||
|
||||
[BackgroundDependencyLoader]
|
||||
private void load(OsuConfigManager config, SkinManager skins)
|
||||
{
|
||||
this.skins = skins;
|
||||
|
||||
FlowContent.Spacing = new Vector2(0, 5);
|
||||
Children = new Drawable[]
|
||||
{
|
||||
@ -47,15 +51,29 @@ namespace osu.Game.Overlays.Settings.Sections
|
||||
},
|
||||
};
|
||||
|
||||
void reloadSkins() => skinDropdown.Items = skins.GetAllUsableSkins().Select(s => new KeyValuePair<string, int>(s.ToString(), s.ID));
|
||||
skins.ItemAdded += _ => reloadSkins();
|
||||
skins.ItemRemoved += _ => reloadSkins();
|
||||
skins.ItemAdded += onItemsChanged;
|
||||
skins.ItemRemoved += onItemsChanged;
|
||||
|
||||
reloadSkins();
|
||||
|
||||
skinDropdown.Bindable = config.GetBindable<int>(OsuSetting.Skin);
|
||||
}
|
||||
|
||||
private void reloadSkins() => skinDropdown.Items = skins.GetAllUsableSkins().Select(s => new KeyValuePair<string, int>(s.ToString(), s.ID));
|
||||
|
||||
private void onItemsChanged(SkinInfo _) => Schedule(reloadSkins);
|
||||
|
||||
protected override void Dispose(bool isDisposing)
|
||||
{
|
||||
base.Dispose(isDisposing);
|
||||
|
||||
if (skins != null)
|
||||
{
|
||||
skins.ItemAdded -= onItemsChanged;
|
||||
skins.ItemRemoved -= onItemsChanged;
|
||||
}
|
||||
}
|
||||
|
||||
private class SizeSlider : OsuSliderBar<double>
|
||||
{
|
||||
public override string TooltipText => Current.Value.ToString(@"0.##x");
|
||||
|
Loading…
Reference in New Issue
Block a user