mirror of
https://github.com/ppy/osu.git
synced 2025-01-12 17:23:22 +08:00
Merge branch 'master' into master
This commit is contained in:
commit
e503878956
@ -28,8 +28,8 @@
|
||||
<ItemGroup Label="Package References">
|
||||
<PackageReference Include="System.IO.Packaging" Version="4.5.0" />
|
||||
<PackageReference Include="ppy.squirrel.windows" Version="1.8.0.5" />
|
||||
<PackageReference Include="Microsoft.EntityFrameworkCore.Sqlite" Version="2.1.1" />
|
||||
<PackageReference Include="Microsoft.EntityFrameworkCore.Design" Version="2.1.1" />
|
||||
<PackageReference Include="Microsoft.EntityFrameworkCore.Sqlite" Version="2.1.2" />
|
||||
<PackageReference Include="Microsoft.EntityFrameworkCore.Design" Version="2.1.2" />
|
||||
</ItemGroup>
|
||||
<ItemGroup Label="Resources">
|
||||
<EmbeddedResource Include="lazer.ico" />
|
||||
|
@ -26,11 +26,11 @@ namespace osu.Game.Rulesets.Mania.UI
|
||||
throw new ArgumentException("Can't have zero or fewer stages.");
|
||||
|
||||
GridContainer playfieldGrid;
|
||||
InternalChild = playfieldGrid = new GridContainer
|
||||
AddInternal(playfieldGrid = new GridContainer
|
||||
{
|
||||
RelativeSizeAxes = Axes.Both,
|
||||
Content = new[] { new Drawable[stageDefinitions.Count] }
|
||||
};
|
||||
});
|
||||
|
||||
var normalColumnAction = ManiaAction.Key1;
|
||||
var specialColumnAction = ManiaAction.Special1;
|
||||
|
@ -28,7 +28,7 @@ namespace osu.Game.Rulesets.Osu.Mods
|
||||
|
||||
const float relax_leniency = 3;
|
||||
|
||||
foreach (var drawable in playfield.HitObjects.AliveObjects)
|
||||
foreach (var drawable in playfield.HitObjectContainer.AliveObjects)
|
||||
{
|
||||
if (!(drawable is DrawableOsuHitObject osuHit))
|
||||
continue;
|
||||
|
@ -61,7 +61,7 @@ namespace osu.Game.Rulesets.Osu.UI
|
||||
|
||||
public override void PostProcess()
|
||||
{
|
||||
connectionLayer.HitObjects = HitObjects.Objects.Select(d => d.HitObject).OfType<OsuHitObject>();
|
||||
connectionLayer.HitObjects = HitObjectContainer.Objects.Select(d => d.HitObject).OfType<OsuHitObject>();
|
||||
}
|
||||
|
||||
private void onNewResult(DrawableHitObject judgedObject, JudgementResult result)
|
||||
|
@ -319,17 +319,17 @@ namespace osu.Game.Beatmaps
|
||||
/// <summary>
|
||||
/// This is a temporary method and will likely be replaced by a full-fledged (and more correctly placed) migration process in the future.
|
||||
/// </summary>
|
||||
public async Task ImportFromStable()
|
||||
public Task ImportFromStable()
|
||||
{
|
||||
var stable = GetStableStorage?.Invoke();
|
||||
|
||||
if (stable == null)
|
||||
{
|
||||
Logger.Log("No osu!stable installation available!", LoggingTarget.Information, LogLevel.Error);
|
||||
return;
|
||||
return Task.CompletedTask;
|
||||
}
|
||||
|
||||
await Task.Factory.StartNew(() => Import(stable.GetDirectories("Songs").Select(f => stable.GetFullPath(f)).ToArray()), TaskCreationOptions.LongRunning);
|
||||
return Task.Factory.StartNew(() => Import(stable.GetDirectories("Songs").Select(f => stable.GetFullPath(f)).ToArray()), TaskCreationOptions.LongRunning);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
@ -67,7 +67,7 @@ namespace osu.Game.Beatmaps
|
||||
|
||||
public bool BeatmapLoaded => beatmap.IsResultAvailable;
|
||||
public IBeatmap Beatmap => beatmap.Value.Result;
|
||||
public async Task<IBeatmap> GetBeatmapAsync() => await beatmap.Value;
|
||||
public Task<IBeatmap> GetBeatmapAsync() => beatmap.Value;
|
||||
private readonly AsyncLazy<IBeatmap> beatmap;
|
||||
|
||||
private IBeatmap populateBeatmap()
|
||||
@ -138,14 +138,14 @@ namespace osu.Game.Beatmaps
|
||||
|
||||
public bool BackgroundLoaded => background.IsResultAvailable;
|
||||
public Texture Background => background.Value.Result;
|
||||
public async Task<Texture> GetBackgroundAsync() => await background.Value;
|
||||
public Task<Texture> GetBackgroundAsync() => background.Value;
|
||||
private AsyncLazy<Texture> background;
|
||||
|
||||
private Texture populateBackground() => GetBackground();
|
||||
|
||||
public bool TrackLoaded => track.IsResultAvailable;
|
||||
public Track Track => track.Value.Result;
|
||||
public async Task<Track> GetTrackAsync() => await track.Value;
|
||||
public Task<Track> GetTrackAsync() => track.Value;
|
||||
private AsyncLazy<Track> track;
|
||||
|
||||
private Track populateTrack()
|
||||
@ -158,21 +158,21 @@ namespace osu.Game.Beatmaps
|
||||
|
||||
public bool WaveformLoaded => waveform.IsResultAvailable;
|
||||
public Waveform Waveform => waveform.Value.Result;
|
||||
public async Task<Waveform> GetWaveformAsync() => await waveform.Value;
|
||||
public Task<Waveform> GetWaveformAsync() => waveform.Value;
|
||||
private readonly AsyncLazy<Waveform> waveform;
|
||||
|
||||
private Waveform populateWaveform() => GetWaveform();
|
||||
|
||||
public bool StoryboardLoaded => storyboard.IsResultAvailable;
|
||||
public Storyboard Storyboard => storyboard.Value.Result;
|
||||
public async Task<Storyboard> GetStoryboardAsync() => await storyboard.Value;
|
||||
public Task<Storyboard> GetStoryboardAsync() => storyboard.Value;
|
||||
private readonly AsyncLazy<Storyboard> storyboard;
|
||||
|
||||
private Storyboard populateStoryboard() => GetStoryboard();
|
||||
|
||||
public bool SkinLoaded => skin.IsResultAvailable;
|
||||
public Skin Skin => skin.Value.Result;
|
||||
public async Task<Skin> GetSkinAsync() => await skin.Value;
|
||||
public Task<Skin> GetSkinAsync() => skin.Value;
|
||||
private readonly AsyncLazy<Skin> skin;
|
||||
|
||||
private Skin populateSkin() => GetSkin();
|
||||
|
@ -71,7 +71,7 @@ namespace osu.Game.Graphics
|
||||
|
||||
private volatile int screenShotTasks;
|
||||
|
||||
public async Task TakeScreenshotAsync() => await Task.Run(async () =>
|
||||
public Task TakeScreenshotAsync() => Task.Run(async () =>
|
||||
{
|
||||
Interlocked.Increment(ref screenShotTasks);
|
||||
|
||||
|
@ -71,7 +71,7 @@ namespace osu.Game.Graphics
|
||||
|
||||
if (loadableIcon == loadedIcon) return;
|
||||
|
||||
var texture = store?.Get(((char)loadableIcon).ToString());
|
||||
var texture = store.Get(((char)loadableIcon).ToString());
|
||||
|
||||
spriteMain.Texture = texture;
|
||||
spriteShadow.Texture = texture;
|
||||
@ -129,7 +129,7 @@ namespace osu.Game.Graphics
|
||||
if (icon == value) return;
|
||||
|
||||
icon = value;
|
||||
if (IsLoaded)
|
||||
if (LoadState == LoadState.Loaded)
|
||||
updateTexture();
|
||||
}
|
||||
}
|
||||
|
@ -3,6 +3,7 @@
|
||||
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Threading.Tasks;
|
||||
using osu.Framework.IO.Stores;
|
||||
|
||||
namespace osu.Game.IO.Archives
|
||||
@ -28,7 +29,9 @@ namespace osu.Game.IO.Archives
|
||||
|
||||
public abstract IEnumerable<string> Filenames { get; }
|
||||
|
||||
public virtual byte[] Get(string name)
|
||||
public virtual byte[] Get(string name) => GetAsync(name).Result;
|
||||
|
||||
public async Task<byte[]> GetAsync(string name)
|
||||
{
|
||||
using (Stream input = GetStream(name))
|
||||
{
|
||||
@ -36,7 +39,7 @@ namespace osu.Game.IO.Archives
|
||||
return null;
|
||||
|
||||
byte[] buffer = new byte[input.Length];
|
||||
input.Read(buffer, 0, buffer.Length);
|
||||
await input.ReadAsync(buffer, 0, buffer.Length);
|
||||
return buffer;
|
||||
}
|
||||
}
|
||||
|
@ -506,22 +506,24 @@ namespace osu.Game
|
||||
// we could avoid the need for scheduling altogether.
|
||||
Schedule(() =>
|
||||
{
|
||||
if (asyncLoadStream != null)
|
||||
var previousLoadStream = asyncLoadStream;
|
||||
|
||||
//chain with existing load stream
|
||||
asyncLoadStream = Task.Run(async () =>
|
||||
{
|
||||
//chain with existing load stream
|
||||
asyncLoadStream = asyncLoadStream.ContinueWith(async t =>
|
||||
if (previousLoadStream != null)
|
||||
await previousLoadStream;
|
||||
|
||||
try
|
||||
{
|
||||
try
|
||||
{
|
||||
await LoadComponentAsync(d, add);
|
||||
}
|
||||
catch (OperationCanceledException)
|
||||
{
|
||||
}
|
||||
});
|
||||
}
|
||||
else
|
||||
asyncLoadStream = LoadComponentAsync(d, add);
|
||||
Logger.Log($"Loading {d}...", LoggingTarget.Debug);
|
||||
await LoadComponentAsync(d, add);
|
||||
Logger.Log($"Loaded {d}!", LoggingTarget.Debug);
|
||||
}
|
||||
catch (OperationCanceledException)
|
||||
{
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
|
@ -240,6 +240,15 @@ namespace osu.Game.Overlays
|
||||
});
|
||||
}
|
||||
|
||||
protected override void PopIn()
|
||||
{
|
||||
base.PopIn();
|
||||
|
||||
// Queries are allowed to be run only on the first pop-in
|
||||
if (getSetsRequest == null)
|
||||
Scheduler.AddOnce(updateSearch);
|
||||
}
|
||||
|
||||
private SearchBeatmapSetsRequest getSetsRequest;
|
||||
|
||||
private readonly Bindable<string> currentQuery = new Bindable<string>();
|
||||
@ -251,16 +260,22 @@ namespace osu.Game.Overlays
|
||||
{
|
||||
queryChangedDebounce?.Cancel();
|
||||
|
||||
if (!IsLoaded) return;
|
||||
if (!IsLoaded)
|
||||
return;
|
||||
|
||||
if (State == Visibility.Hidden)
|
||||
return;
|
||||
|
||||
BeatmapSets = null;
|
||||
ResultAmounts = null;
|
||||
|
||||
getSetsRequest?.Cancel();
|
||||
|
||||
if (api == null) return;
|
||||
if (api == null)
|
||||
return;
|
||||
|
||||
if (Header.Tabs.Current.Value == DirectTab.Search && (Filter.Search.Text == string.Empty || currentQuery == string.Empty)) return;
|
||||
if (Header.Tabs.Current.Value == DirectTab.Search && (Filter.Search.Text == string.Empty || currentQuery == string.Empty))
|
||||
return;
|
||||
|
||||
previewTrackManager.StopAnyPlaying(this);
|
||||
|
||||
|
@ -19,12 +19,12 @@ namespace osu.Game.Rulesets.UI
|
||||
/// <summary>
|
||||
/// The <see cref="DrawableHitObject"/> contained in this Playfield.
|
||||
/// </summary>
|
||||
public HitObjectContainer HitObjects { get; private set; }
|
||||
public HitObjectContainer HitObjectContainer { get; private set; }
|
||||
|
||||
/// <summary>
|
||||
/// All the <see cref="DrawableHitObject"/>s contained in this <see cref="Playfield"/> and all <see cref="NestedPlayfields"/>.
|
||||
/// </summary>
|
||||
public IEnumerable<DrawableHitObject> AllHitObjects => HitObjects?.Objects.Concat(NestedPlayfields.SelectMany(p => p.AllHitObjects)) ?? Enumerable.Empty<DrawableHitObject>();
|
||||
public IEnumerable<DrawableHitObject> AllHitObjects => HitObjectContainer?.Objects.Concat(NestedPlayfields.SelectMany(p => p.AllHitObjects)) ?? Enumerable.Empty<DrawableHitObject>();
|
||||
|
||||
/// <summary>
|
||||
/// All <see cref="Playfield"/>s nested inside this <see cref="Playfield"/>.
|
||||
@ -60,10 +60,10 @@ namespace osu.Game.Rulesets.UI
|
||||
{
|
||||
this.beatmap = beatmap.Value;
|
||||
|
||||
HitObjects = CreateHitObjectContainer();
|
||||
HitObjects.RelativeSizeAxes = Axes.Both;
|
||||
HitObjectContainer = CreateHitObjectContainer();
|
||||
HitObjectContainer.RelativeSizeAxes = Axes.Both;
|
||||
|
||||
Add(HitObjects);
|
||||
Add(HitObjectContainer);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@ -75,13 +75,13 @@ namespace osu.Game.Rulesets.UI
|
||||
/// Adds a DrawableHitObject to this Playfield.
|
||||
/// </summary>
|
||||
/// <param name="h">The DrawableHitObject to add.</param>
|
||||
public virtual void Add(DrawableHitObject h) => HitObjects.Add(h);
|
||||
public virtual void Add(DrawableHitObject h) => HitObjectContainer.Add(h);
|
||||
|
||||
/// <summary>
|
||||
/// Remove a DrawableHitObject from this Playfield.
|
||||
/// </summary>
|
||||
/// <param name="h">The DrawableHitObject to remove.</param>
|
||||
public virtual void Remove(DrawableHitObject h) => HitObjects.Remove(h);
|
||||
public virtual void Remove(DrawableHitObject h) => HitObjectContainer.Remove(h);
|
||||
|
||||
/// <summary>
|
||||
/// Registers a <see cref="Playfield"/> as a nested <see cref="Playfield"/>.
|
||||
|
@ -306,7 +306,7 @@ namespace osu.Game.Rulesets.UI
|
||||
Playfield.PostProcess();
|
||||
|
||||
foreach (var mod in Mods.OfType<IApplicableToDrawableHitObjects>())
|
||||
mod.ApplyToDrawableHitObjects(Playfield.HitObjects.Objects);
|
||||
mod.ApplyToDrawableHitObjects(Playfield.HitObjectContainer.Objects);
|
||||
}
|
||||
|
||||
protected override void Update()
|
||||
|
@ -55,7 +55,7 @@ namespace osu.Game.Rulesets.UI.Scrolling
|
||||
/// <summary>
|
||||
/// The container that contains the <see cref="DrawableHitObject"/>s.
|
||||
/// </summary>
|
||||
public new ScrollingHitObjectContainer HitObjects => (ScrollingHitObjectContainer)base.HitObjects;
|
||||
public new ScrollingHitObjectContainer HitObjects => (ScrollingHitObjectContainer)HitObjectContainer;
|
||||
|
||||
/// <summary>
|
||||
/// The direction in which <see cref="DrawableHitObject"/>s in this <see cref="ScrollingPlayfield"/> should scroll.
|
||||
|
@ -64,32 +64,36 @@ namespace osu.Game.Screens.Select
|
||||
|
||||
public IEnumerable<BeatmapSetInfo> BeatmapSets
|
||||
{
|
||||
get { return beatmapSets.Select(g => g.BeatmapSet); }
|
||||
set
|
||||
get => beatmapSets.Select(g => g.BeatmapSet);
|
||||
set => loadBeatmapSets(() => value);
|
||||
}
|
||||
|
||||
public void LoadBeatmapSetsFromManager(BeatmapManager manager) => loadBeatmapSets(manager.GetAllUsableBeatmapSetsEnumerable);
|
||||
|
||||
private void loadBeatmapSets(Func<IEnumerable<BeatmapSetInfo>> beatmapSets)
|
||||
{
|
||||
CarouselRoot newRoot = new CarouselRoot(this);
|
||||
|
||||
Task.Run(() =>
|
||||
{
|
||||
CarouselRoot newRoot = new CarouselRoot(this);
|
||||
beatmapSets().Select(createCarouselSet).Where(g => g != null).ForEach(newRoot.AddChild);
|
||||
newRoot.Filter(activeCriteria);
|
||||
|
||||
Task.Run(() =>
|
||||
// preload drawables as the ctor overhead is quite high currently.
|
||||
var _ = newRoot.Drawables;
|
||||
}).ContinueWith(_ => Schedule(() =>
|
||||
{
|
||||
root = newRoot;
|
||||
scrollableContent.Clear(false);
|
||||
itemsCache.Invalidate();
|
||||
scrollPositionCache.Invalidate();
|
||||
|
||||
Schedule(() =>
|
||||
{
|
||||
value.Select(createCarouselSet).Where(g => g != null).ForEach(newRoot.AddChild);
|
||||
newRoot.Filter(activeCriteria);
|
||||
|
||||
// preload drawables as the ctor overhead is quite high currently.
|
||||
var _ = newRoot.Drawables;
|
||||
}).ContinueWith(_ => Schedule(() =>
|
||||
{
|
||||
root = newRoot;
|
||||
scrollableContent.Clear(false);
|
||||
itemsCache.Invalidate();
|
||||
scrollPositionCache.Invalidate();
|
||||
|
||||
Schedule(() =>
|
||||
{
|
||||
BeatmapSetsChanged?.Invoke();
|
||||
initialLoadComplete = true;
|
||||
});
|
||||
}));
|
||||
}
|
||||
BeatmapSetsChanged?.Invoke();
|
||||
initialLoadComplete = true;
|
||||
});
|
||||
}));
|
||||
}
|
||||
|
||||
private readonly List<float> yPositions = new List<float>();
|
||||
|
@ -41,7 +41,10 @@ namespace osu.Game.Screens.Select.Leaderboards
|
||||
updateTexture();
|
||||
}
|
||||
|
||||
private void updateTexture() => rankSprite.Texture = textures.Get($@"Grades/{Rank.GetDescription()}");
|
||||
private void updateTexture()
|
||||
{
|
||||
rankSprite.Texture = textures.Get($@"Grades/{Rank.GetDescription()}");
|
||||
}
|
||||
|
||||
public void UpdateRank(ScoreRank newRank)
|
||||
{
|
||||
|
@ -221,7 +221,7 @@ namespace osu.Game.Screens.Select
|
||||
sampleChangeDifficulty = audio.Sample.Get(@"SongSelect/select-difficulty");
|
||||
sampleChangeBeatmap = audio.Sample.Get(@"SongSelect/select-expand");
|
||||
|
||||
Carousel.BeatmapSets = this.beatmaps.GetAllUsableBeatmapSetsEnumerable();
|
||||
Carousel.LoadBeatmapSetsFromManager(this.beatmaps);
|
||||
}
|
||||
|
||||
public void Edit(BeatmapInfo beatmap)
|
||||
|
@ -4,6 +4,7 @@
|
||||
using System;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
using osu.Framework.Audio;
|
||||
using osu.Framework.Audio.Sample;
|
||||
using osu.Framework.Graphics;
|
||||
@ -108,10 +109,12 @@ namespace osu.Game.Skinning
|
||||
return path == null ? null : underlyingStore.GetStream(path);
|
||||
}
|
||||
|
||||
byte[] IResourceStore<byte[]>.Get(string name)
|
||||
byte[] IResourceStore<byte[]>.Get(string name) => GetAsync(name).Result;
|
||||
|
||||
public Task<byte[]> GetAsync(string name)
|
||||
{
|
||||
string path = getPathForFile(name);
|
||||
return path == null ? null : underlyingStore.Get(path);
|
||||
return path == null ? Task.FromResult<byte[]>(null) : underlyingStore.GetAsync(path);
|
||||
}
|
||||
|
||||
#region IDisposable Support
|
||||
|
@ -15,10 +15,10 @@
|
||||
</ItemGroup>
|
||||
<ItemGroup Label="Package References">
|
||||
<PackageReference Include="Humanizer" Version="2.4.2" />
|
||||
<PackageReference Include="Microsoft.EntityFrameworkCore.Sqlite" Version="2.1.1" />
|
||||
<PackageReference Include="Microsoft.EntityFrameworkCore.Sqlite.Core" Version="2.1.1" />
|
||||
<PackageReference Include="Microsoft.EntityFrameworkCore.Sqlite" Version="2.1.2" />
|
||||
<PackageReference Include="Microsoft.EntityFrameworkCore.Sqlite.Core" Version="2.1.2" />
|
||||
<PackageReference Include="Newtonsoft.Json" Version="11.0.2" />
|
||||
<PackageReference Include="ppy.osu.Framework" Version="2018.824.0" />
|
||||
<PackageReference Include="ppy.osu.Framework" Version="2018.901.0" />
|
||||
<PackageReference Include="SharpCompress" Version="0.22.0" />
|
||||
<PackageReference Include="NUnit" Version="3.10.1" />
|
||||
<PackageReference Include="SharpRaven" Version="2.4.0" />
|
||||
|
@ -11,7 +11,7 @@
|
||||
<ProjectReference Include="..\osu-resources\osu.Game.Resources\osu.Game.Resources.csproj" />
|
||||
</ItemGroup>
|
||||
<ItemGroup Label="Package References">
|
||||
<PackageReference Include="Microsoft.EntityFrameworkCore.Sqlite" Version="2.1.1" />
|
||||
<PackageReference Include="Microsoft.EntityFrameworkCore.Sqlite" Version="2.1.2" />
|
||||
<PackageReference Include="DeepEqual" Version="1.6.0" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
|
Loading…
Reference in New Issue
Block a user