Merge branch 'master' into fix-taiko-doublehits

This commit is contained in:
Dean Herbert 2018-09-28 18:57:02 +09:00 committed by GitHub
commit a355d342d4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
7 changed files with 27 additions and 18 deletions

View File

@ -72,7 +72,8 @@ private void onNewResult(DrawableHitObject judgedObject, JudgementResult result)
DrawableOsuJudgement explosion = new DrawableOsuJudgement(result, judgedObject)
{
Origin = Anchor.Centre,
Position = ((OsuHitObject)judgedObject.HitObject).StackedEndPosition
Position = ((OsuHitObject)judgedObject.HitObject).StackedEndPosition,
Scale = new Vector2(((OsuHitObject)judgedObject.HitObject).Scale * 1.65f)
};
judgementLayer.Add(explosion);

View File

@ -282,17 +282,19 @@ public TModel Import(TModel item, ArchiveReader archive = null)
/// Is a no-op for already deleted items.
/// </summary>
/// <param name="item">The item to delete.</param>
public void Delete(TModel item)
/// <returns>false if no operation was performed</returns>
public bool Delete(TModel item)
{
using (ContextFactory.GetForWrite())
{
// re-fetch the model on the import context.
var foundModel = queryModel().Include(s => s.Files).ThenInclude(f => f.FileInfo).First(s => s.ID == item.ID);
var foundModel = queryModel().Include(s => s.Files).ThenInclude(f => f.FileInfo).FirstOrDefault(s => s.ID == item.ID);
if (foundModel.DeletePending) return;
if (foundModel == null || foundModel.DeletePending) return false;
if (ModelStore.Delete(foundModel))
Files.Dereference(foundModel.Files.Select(f => f.FileInfo).ToArray());
return true;
}
}

View File

@ -37,7 +37,7 @@ public async Task ImportAsync(string path)
return;
}
if (importer.HandledExtensions.Contains(Path.GetExtension(path)))
if (importer.HandledExtensions.Contains(Path.GetExtension(path)?.ToLowerInvariant()))
importer.Import(path);
}
}

View File

@ -154,7 +154,7 @@ private void load()
dependencies.Cache(RulesetStore = new RulesetStore(contextFactory));
dependencies.Cache(FileStore = new FileStore(contextFactory, Host.Storage));
dependencies.Cache(BeatmapManager = new BeatmapManager(Host.Storage, contextFactory, RulesetStore, api, Audio, Host));
dependencies.Cache(ScoreStore = new ScoreStore(Host.Storage, contextFactory, Host, BeatmapManager, RulesetStore));
dependencies.Cache(ScoreStore = new ScoreStore(contextFactory, Host, BeatmapManager, RulesetStore));
dependencies.Cache(KeyBindingStore = new KeyBindingStore(contextFactory, RulesetStore));
dependencies.Cache(SettingsStore = new SettingsStore(contextFactory));
dependencies.Cache(RulesetConfigCache = new RulesetConfigCache(SettingsStore));
@ -243,7 +243,7 @@ public override void SetHost(GameHost host)
public void Import(params string[] paths)
{
var extension = Path.GetExtension(paths.First());
var extension = Path.GetExtension(paths.First())?.ToLowerInvariant();
foreach (var importer in fileImporters)
if (importer.HandledExtensions.Contains(extension)) importer.Import(paths);

View File

@ -65,13 +65,15 @@ protected override void LoadComplete()
this.FadeInFromZero(100, Easing.OutQuint);
var origScale = Scale;
switch (Result.Type)
{
case HitResult.None:
break;
case HitResult.Miss:
this.ScaleTo(1.6f);
this.ScaleTo(1, 100, Easing.In);
this.ScaleTo(origScale * 1.6f);
this.ScaleTo(origScale, 100, Easing.In);
this.MoveToOffset(new Vector2(0, 100), 800, Easing.InQuint);
this.RotateTo(40, 800, Easing.InQuint);
@ -79,8 +81,8 @@ protected override void LoadComplete()
this.Delay(600).FadeOut(200);
break;
default:
this.ScaleTo(0.9f);
this.ScaleTo(1, 500, Easing.OutElastic);
this.ScaleTo(origScale * 0.9f);
this.ScaleTo(origScale, 500, Easing.OutElastic);
this.Delay(100).FadeOut(400);
break;

View File

@ -3,6 +3,7 @@
using System;
using System.IO;
using osu.Framework.Logging;
using osu.Framework.Platform;
using osu.Game.Beatmaps;
using osu.Game.Database;
@ -13,8 +14,6 @@ namespace osu.Game.Rulesets.Scoring
{
public class ScoreStore : DatabaseBackedStore, ICanAcceptFiles
{
private readonly Storage storage;
private readonly BeatmapManager beatmaps;
private readonly RulesetStore rulesets;
@ -25,9 +24,8 @@ public class ScoreStore : DatabaseBackedStore, ICanAcceptFiles
// ReSharper disable once NotAccessedField.Local (we should keep a reference to this so it is not finalised)
private ScoreIPCChannel ipc;
public ScoreStore(Storage storage, DatabaseContextFactory factory, IIpcHost importHost = null, BeatmapManager beatmaps = null, RulesetStore rulesets = null) : base(factory)
public ScoreStore(DatabaseContextFactory factory, IIpcHost importHost = null, BeatmapManager beatmaps = null, RulesetStore rulesets = null) : base(factory)
{
this.storage = storage;
this.beatmaps = beatmaps;
this.rulesets = rulesets;
@ -49,8 +47,14 @@ public void Import(params string[] paths)
public Score ReadReplayFile(string replayFilename)
{
using (Stream s = storage.GetStream(Path.Combine(replay_folder, replayFilename)))
return new DatabasedLegacyScoreParser(rulesets, beatmaps).Parse(s);
if (File.Exists(replayFilename))
{
using (var stream = File.OpenRead(replayFilename))
return new DatabasedLegacyScoreParser(rulesets, beatmaps).Parse(stream);
}
Logger.Log($"Replay file {replayFilename} cannot be found", LoggingTarget.Information, LogLevel.Error);
return null;
}
}
}

View File

@ -536,7 +536,7 @@ private void carouselBeatmapsLoaded()
private void delete(BeatmapSetInfo beatmap)
{
if (beatmap == null) return;
if (beatmap == null || beatmap.ID <= 0) return;
dialogOverlay?.Push(new BeatmapDeleteDialog(beatmap));
}