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