mirror of
https://github.com/ppy/osu.git
synced 2024-09-22 09:27:34 +08:00
Merge branch 'master' into mod_application
This commit is contained in:
commit
879a78156d
@ -1 +1 @@
|
|||||||
Subproject commit a50dd75b114da963c75e6a5314099d99140035b8
|
Subproject commit e52af1e5ada07468512e19c86b6dcd5a23fe3707
|
@ -1 +1 @@
|
|||||||
Subproject commit 39657fc6066ea3a141ac71cabf67ec9ebf24975c
|
Subproject commit 4f9ed4e703777ede98737c7e2af31efa4694c395
|
@ -21,16 +21,4 @@ Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/maste
|
|||||||
<startup>
|
<startup>
|
||||||
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5.2" />
|
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5.2" />
|
||||||
</startup>
|
</startup>
|
||||||
<runtime>
|
|
||||||
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
|
|
||||||
<dependentAssembly>
|
|
||||||
<assemblyIdentity name="Newtonsoft.Json" publicKeyToken="30ad4fe6b2a6aeed" culture="neutral" />
|
|
||||||
<bindingRedirect oldVersion="0.0.0.0-9.0.0.0" newVersion="9.0.0.0" />
|
|
||||||
</dependentAssembly>
|
|
||||||
<dependentAssembly>
|
|
||||||
<assemblyIdentity name="DeltaCompressionDotNet.MsDelta" publicKeyToken="46b2138a390abf55" culture="neutral" />
|
|
||||||
<bindingRedirect oldVersion="0.0.0.0-1.1.0.0" newVersion="1.1.0.0" />
|
|
||||||
</dependentAssembly>
|
|
||||||
</assemblyBinding>
|
|
||||||
</runtime>
|
|
||||||
</configuration>
|
</configuration>
|
@ -1,16 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
|
||||||
|
|
||||||
<!--
|
|
||||||
Copyright (c) 2007-2017 ppy Pty Ltd <contact@ppy.sh>.
|
|
||||||
Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
|
|
||||||
-->
|
|
||||||
<configuration>
|
|
||||||
<runtime>
|
|
||||||
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
|
|
||||||
<dependentAssembly>
|
|
||||||
<assemblyIdentity name="Newtonsoft.Json" publicKeyToken="30ad4fe6b2a6aeed" culture="neutral" />
|
|
||||||
<bindingRedirect oldVersion="0.0.0.0-9.0.0.0" newVersion="9.0.0.0" />
|
|
||||||
</dependentAssembly>
|
|
||||||
</assemblyBinding>
|
|
||||||
</runtime>
|
|
||||||
</configuration>
|
|
@ -100,7 +100,6 @@
|
|||||||
<None Include="..\osu.licenseheader">
|
<None Include="..\osu.licenseheader">
|
||||||
<Link>osu.licenseheader</Link>
|
<Link>osu.licenseheader</Link>
|
||||||
</None>
|
</None>
|
||||||
<None Include="app.config" />
|
|
||||||
<None Include="packages.config" />
|
<None Include="packages.config" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
|
@ -110,7 +110,7 @@ namespace osu.Desktop.VisualTests.Tests
|
|||||||
Beatmap = beatmap;
|
Beatmap = beatmap;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override BeatmapArchiveReader GetReader() => null;
|
protected override ArchiveReader GetReader() => null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,16 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
|
||||||
|
|
||||||
<!--
|
|
||||||
Copyright (c) 2007-2017 ppy Pty Ltd <contact@ppy.sh>.
|
|
||||||
Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
|
|
||||||
-->
|
|
||||||
<configuration>
|
|
||||||
<runtime>
|
|
||||||
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
|
|
||||||
<dependentAssembly>
|
|
||||||
<assemblyIdentity name="Newtonsoft.Json" publicKeyToken="30ad4fe6b2a6aeed" culture="neutral" />
|
|
||||||
<bindingRedirect oldVersion="0.0.0.0-9.0.0.0" newVersion="9.0.0.0" />
|
|
||||||
</dependentAssembly>
|
|
||||||
</assemblyBinding>
|
|
||||||
</runtime>
|
|
||||||
</configuration>
|
|
@ -23,6 +23,7 @@
|
|||||||
<SignAssembly>false</SignAssembly>
|
<SignAssembly>false</SignAssembly>
|
||||||
<TargetZone>LocalIntranet</TargetZone>
|
<TargetZone>LocalIntranet</TargetZone>
|
||||||
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
|
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
|
||||||
|
<AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
|
||||||
<PublishUrl>publish\</PublishUrl>
|
<PublishUrl>publish\</PublishUrl>
|
||||||
<Install>true</Install>
|
<Install>true</Install>
|
||||||
<InstallFrom>Disk</InstallFrom>
|
<InstallFrom>Disk</InstallFrom>
|
||||||
@ -114,7 +115,6 @@
|
|||||||
<None Include="..\osu.licenseheader">
|
<None Include="..\osu.licenseheader">
|
||||||
<Link>osu.licenseheader</Link>
|
<Link>osu.licenseheader</Link>
|
||||||
</None>
|
</None>
|
||||||
<None Include="app.config" />
|
|
||||||
<None Include="packages.config" />
|
<None Include="packages.config" />
|
||||||
<None Include="OpenTK.dll.config" />
|
<None Include="OpenTK.dll.config" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
@ -13,7 +13,7 @@ namespace osu.Desktop.Beatmaps.IO
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// Reads an extracted legacy beatmap from disk.
|
/// Reads an extracted legacy beatmap from disk.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public class LegacyFilesystemReader : BeatmapArchiveReader
|
public class LegacyFilesystemReader : ArchiveReader
|
||||||
{
|
{
|
||||||
public static void Register() => AddReader<LegacyFilesystemReader>((storage, path) => Directory.Exists(path));
|
public static void Register() => AddReader<LegacyFilesystemReader>((storage, path) => Directory.Exists(path));
|
||||||
|
|
||||||
|
@ -12,7 +12,6 @@ using System.Drawing;
|
|||||||
using System.IO;
|
using System.IO;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
using osu.Game.Screens.Menu;
|
using osu.Game.Screens.Menu;
|
||||||
using osu.Game.Beatmaps.IO;
|
|
||||||
|
|
||||||
namespace osu.Desktop
|
namespace osu.Desktop
|
||||||
{
|
{
|
||||||
@ -31,9 +30,9 @@ namespace osu.Desktop
|
|||||||
base.LoadComplete();
|
base.LoadComplete();
|
||||||
|
|
||||||
versionManager.LoadAsync(this);
|
versionManager.LoadAsync(this);
|
||||||
ModeChanged += m =>
|
ScreenChanged += s =>
|
||||||
{
|
{
|
||||||
if (!versionManager.IsAlive && m is Intro)
|
if (!versionManager.IsAlive && s is Intro)
|
||||||
Add(versionManager);
|
Add(versionManager);
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
@ -58,7 +57,7 @@ namespace osu.Desktop
|
|||||||
var dropData = (object[])e.Data.GetData(DataFormats.FileDrop);
|
var dropData = (object[])e.Data.GetData(DataFormats.FileDrop);
|
||||||
var filePaths = dropData.Select(f => f.ToString()).ToArray();
|
var filePaths = dropData.Select(f => f.ToString()).ToArray();
|
||||||
|
|
||||||
if (filePaths.All(f => Path.GetExtension(f) == BeatmapArchiveReader.OSZ_EXTENSION))
|
if (filePaths.All(f => Path.GetExtension(f) == @".osz"))
|
||||||
Task.Run(() => BeatmapDatabase.Import(filePaths));
|
Task.Run(() => BeatmapDatabase.Import(filePaths));
|
||||||
else if (filePaths.All(f => Path.GetExtension(f) == @".osr"))
|
else if (filePaths.All(f => Path.GetExtension(f) == @".osr"))
|
||||||
Task.Run(() =>
|
Task.Run(() =>
|
||||||
@ -68,7 +67,7 @@ namespace osu.Desktop
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
private static readonly string[] allowed_extensions = { BeatmapArchiveReader.OSZ_EXTENSION, @".osr" };
|
private static readonly string[] allowed_extensions = { @".osz", @".osr" };
|
||||||
|
|
||||||
private void dragEnter(DragEventArgs e)
|
private void dragEnter(DragEventArgs e)
|
||||||
{
|
{
|
||||||
|
@ -1,20 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
|
||||||
|
|
||||||
<!--
|
|
||||||
Copyright (c) 2007-2017 ppy Pty Ltd <contact@ppy.sh>.
|
|
||||||
Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
|
|
||||||
-->
|
|
||||||
<configuration>
|
|
||||||
<runtime>
|
|
||||||
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
|
|
||||||
<dependentAssembly>
|
|
||||||
<assemblyIdentity name="Newtonsoft.Json" publicKeyToken="30ad4fe6b2a6aeed" culture="neutral" />
|
|
||||||
<bindingRedirect oldVersion="0.0.0.0-9.0.0.0" newVersion="9.0.0.0" />
|
|
||||||
</dependentAssembly>
|
|
||||||
<dependentAssembly>
|
|
||||||
<assemblyIdentity name="DeltaCompressionDotNet.MsDelta" publicKeyToken="46b2138a390abf55" culture="neutral" />
|
|
||||||
<bindingRedirect oldVersion="0.0.0.0-1.1.0.0" newVersion="1.1.0.0" />
|
|
||||||
</dependentAssembly>
|
|
||||||
</assemblyBinding>
|
|
||||||
</runtime>
|
|
||||||
</configuration>
|
|
@ -23,6 +23,7 @@
|
|||||||
<SignAssembly>false</SignAssembly>
|
<SignAssembly>false</SignAssembly>
|
||||||
<TargetZone>LocalIntranet</TargetZone>
|
<TargetZone>LocalIntranet</TargetZone>
|
||||||
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
|
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
|
||||||
|
<AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
|
||||||
<PublishUrl>publish\</PublishUrl>
|
<PublishUrl>publish\</PublishUrl>
|
||||||
<Install>true</Install>
|
<Install>true</Install>
|
||||||
<InstallFrom>Disk</InstallFrom>
|
<InstallFrom>Disk</InstallFrom>
|
||||||
@ -153,7 +154,6 @@
|
|||||||
<None Include="..\osu.licenseheader">
|
<None Include="..\osu.licenseheader">
|
||||||
<Link>osu.licenseheader</Link>
|
<Link>osu.licenseheader</Link>
|
||||||
</None>
|
</None>
|
||||||
<None Include="app.config" />
|
|
||||||
<None Include="osu!.res" />
|
<None Include="osu!.res" />
|
||||||
<None Include="packages.config" />
|
<None Include="packages.config" />
|
||||||
<None Include="Properties\app.manifest" />
|
<None Include="Properties\app.manifest" />
|
||||||
|
@ -1,16 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
|
||||||
|
|
||||||
<!--
|
|
||||||
Copyright (c) 2007-2017 ppy Pty Ltd <contact@ppy.sh>.
|
|
||||||
Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
|
|
||||||
-->
|
|
||||||
<configuration>
|
|
||||||
<runtime>
|
|
||||||
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
|
|
||||||
<dependentAssembly>
|
|
||||||
<assemblyIdentity name="Newtonsoft.Json" publicKeyToken="30ad4fe6b2a6aeed" culture="neutral" />
|
|
||||||
<bindingRedirect oldVersion="0.0.0.0-9.0.0.0" newVersion="9.0.0.0" />
|
|
||||||
</dependentAssembly>
|
|
||||||
</assemblyBinding>
|
|
||||||
</runtime>
|
|
||||||
</configuration>
|
|
@ -81,7 +81,6 @@
|
|||||||
<None Include="..\osu.licenseheader">
|
<None Include="..\osu.licenseheader">
|
||||||
<Link>osu.licenseheader</Link>
|
<Link>osu.licenseheader</Link>
|
||||||
</None>
|
</None>
|
||||||
<None Include="app.config" />
|
|
||||||
<None Include="OpenTK.dll.config" />
|
<None Include="OpenTK.dll.config" />
|
||||||
<None Include="packages.config" />
|
<None Include="packages.config" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
@ -1,16 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
|
||||||
|
|
||||||
<!--
|
|
||||||
Copyright (c) 2007-2017 ppy Pty Ltd <contact@ppy.sh>.
|
|
||||||
Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
|
|
||||||
-->
|
|
||||||
<configuration>
|
|
||||||
<runtime>
|
|
||||||
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
|
|
||||||
<dependentAssembly>
|
|
||||||
<assemblyIdentity name="Newtonsoft.Json" publicKeyToken="30ad4fe6b2a6aeed" culture="neutral" />
|
|
||||||
<bindingRedirect oldVersion="0.0.0.0-9.0.0.0" newVersion="9.0.0.0" />
|
|
||||||
</dependentAssembly>
|
|
||||||
</assemblyBinding>
|
|
||||||
</runtime>
|
|
||||||
<startup><supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5" /></startup></configuration>
|
|
@ -100,7 +100,6 @@
|
|||||||
<None Include="..\osu.licenseheader">
|
<None Include="..\osu.licenseheader">
|
||||||
<Link>osu.licenseheader</Link>
|
<Link>osu.licenseheader</Link>
|
||||||
</None>
|
</None>
|
||||||
<None Include="app.config" />
|
|
||||||
<None Include="OpenTK.dll.config" />
|
<None Include="OpenTK.dll.config" />
|
||||||
<None Include="packages.config" />
|
<None Include="packages.config" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
@ -17,7 +17,6 @@ using osu.Game.Modes.Catch;
|
|||||||
using osu.Game.Modes.Mania;
|
using osu.Game.Modes.Mania;
|
||||||
using osu.Game.Modes.Osu;
|
using osu.Game.Modes.Osu;
|
||||||
using osu.Game.Modes.Taiko;
|
using osu.Game.Modes.Taiko;
|
||||||
using osu.Game.Beatmaps.IO;
|
|
||||||
|
|
||||||
namespace osu.Game.Tests.Beatmaps.IO
|
namespace osu.Game.Tests.Beatmaps.IO
|
||||||
{
|
{
|
||||||
@ -107,7 +106,7 @@ namespace osu.Game.Tests.Beatmaps.IO
|
|||||||
|
|
||||||
private string prepareTempCopy(string path)
|
private string prepareTempCopy(string path)
|
||||||
{
|
{
|
||||||
var temp = Path.GetTempPath() + Guid.NewGuid() + BeatmapArchiveReader.OSZ_EXTENSION;
|
var temp = Path.GetTempFileName();
|
||||||
return new FileInfo(path).CopyTo(temp, true).FullName;
|
return new FileInfo(path).CopyTo(temp, true).FullName;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,16 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
|
||||||
|
|
||||||
<!--
|
|
||||||
Copyright (c) 2007-2017 ppy Pty Ltd <contact@ppy.sh>.
|
|
||||||
Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
|
|
||||||
-->
|
|
||||||
<configuration>
|
|
||||||
<runtime>
|
|
||||||
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
|
|
||||||
<dependentAssembly>
|
|
||||||
<assemblyIdentity name="Newtonsoft.Json" publicKeyToken="30ad4fe6b2a6aeed" culture="neutral" />
|
|
||||||
<bindingRedirect oldVersion="0.0.0.0-9.0.0.0" newVersion="9.0.0.0" />
|
|
||||||
</dependentAssembly>
|
|
||||||
</assemblyBinding>
|
|
||||||
</runtime>
|
|
||||||
</configuration>
|
|
@ -52,7 +52,6 @@
|
|||||||
<None Include="..\osu.licenseheader">
|
<None Include="..\osu.licenseheader">
|
||||||
<Link>osu.licenseheader</Link>
|
<Link>osu.licenseheader</Link>
|
||||||
</None>
|
</None>
|
||||||
<None Include="app.config" />
|
|
||||||
<None Include="packages.config" />
|
<None Include="packages.config" />
|
||||||
<None Include="OpenTK.dll.config" />
|
<None Include="OpenTK.dll.config" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
@ -6,22 +6,23 @@ using System.Collections.Generic;
|
|||||||
using System.IO;
|
using System.IO;
|
||||||
using osu.Framework.IO.Stores;
|
using osu.Framework.IO.Stores;
|
||||||
using osu.Framework.Platform;
|
using osu.Framework.Platform;
|
||||||
|
using osu.Game.Database;
|
||||||
|
|
||||||
namespace osu.Game.IO
|
namespace osu.Game.Beatmaps.IO
|
||||||
{
|
{
|
||||||
public abstract class ArchiveReader : IDisposable, IResourceStore<byte[]>
|
public abstract class ArchiveReader : IDisposable, IResourceStore<byte[]>
|
||||||
{
|
{
|
||||||
protected class Reader
|
private class Reader
|
||||||
{
|
{
|
||||||
public Func<Storage, string, bool> Test { get; set; }
|
public Func<Storage, string, bool> Test { get; set; }
|
||||||
public Type Type { get; set; }
|
public Type Type { get; set; }
|
||||||
}
|
}
|
||||||
|
|
||||||
protected static List<Reader> Readers { get; } = new List<Reader>();
|
private static List<Reader> readers { get; } = new List<Reader>();
|
||||||
|
|
||||||
public static ArchiveReader GetReader(Storage storage, string path)
|
public static ArchiveReader GetReader(Storage storage, string path)
|
||||||
{
|
{
|
||||||
foreach (var reader in Readers)
|
foreach (var reader in readers)
|
||||||
{
|
{
|
||||||
if (reader.Test(storage, path))
|
if (reader.Test(storage, path))
|
||||||
return (ArchiveReader)Activator.CreateInstance(reader.Type, storage.GetStream(path));
|
return (ArchiveReader)Activator.CreateInstance(reader.Type, storage.GetStream(path));
|
||||||
@ -31,9 +32,24 @@ namespace osu.Game.IO
|
|||||||
|
|
||||||
protected static void AddReader<T>(Func<Storage, string, bool> test) where T : ArchiveReader
|
protected static void AddReader<T>(Func<Storage, string, bool> test) where T : ArchiveReader
|
||||||
{
|
{
|
||||||
Readers.Add(new Reader { Test = test, Type = typeof(T) });
|
readers.Add(new Reader { Test = test, Type = typeof(T) });
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Reads the beatmap metadata from this archive.
|
||||||
|
/// </summary>
|
||||||
|
public abstract BeatmapMetadata ReadMetadata();
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets a list of beatmap file names.
|
||||||
|
/// </summary>
|
||||||
|
public string[] BeatmapFilenames { get; protected set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// The storyboard filename. Null if no storyboard is present.
|
||||||
|
/// </summary>
|
||||||
|
public string StoryboardFilename { get; protected set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Opens a stream for reading a specific file from this archive.
|
/// Opens a stream for reading a specific file from this archive.
|
||||||
/// </summary>
|
/// </summary>
|
@ -1,44 +0,0 @@
|
|||||||
// Copyright (c) 2007-2017 ppy Pty Ltd <contact@ppy.sh>.
|
|
||||||
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
|
|
||||||
|
|
||||||
using System;
|
|
||||||
using osu.Framework.Logging;
|
|
||||||
using osu.Framework.Platform;
|
|
||||||
using osu.Game.Database;
|
|
||||||
using osu.Game.IO;
|
|
||||||
|
|
||||||
namespace osu.Game.Beatmaps.IO
|
|
||||||
{
|
|
||||||
public abstract class BeatmapArchiveReader : ArchiveReader
|
|
||||||
{
|
|
||||||
public const string OSZ_EXTENSION = @".osz";
|
|
||||||
|
|
||||||
public static BeatmapArchiveReader GetBeatmapArchiveReader(Storage storage, string path)
|
|
||||||
{
|
|
||||||
try
|
|
||||||
{
|
|
||||||
return (BeatmapArchiveReader)GetReader(storage, path);
|
|
||||||
}
|
|
||||||
catch (InvalidCastException e)
|
|
||||||
{
|
|
||||||
Logger.Error(e, "A tricky " + $@"{nameof(ArchiveReader)}" + " instance passed the test to be a " + $@"{nameof(BeatmapArchiveReader)}" + ", but it's really not");
|
|
||||||
throw;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Reads the beatmap metadata from this archive.
|
|
||||||
/// </summary>
|
|
||||||
public abstract BeatmapMetadata ReadMetadata();
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Gets a list of beatmap file names.
|
|
||||||
/// </summary>
|
|
||||||
public string[] BeatmapFilenames { get; protected set; }
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// The storyboard filename. Null if no storyboard is present.
|
|
||||||
/// </summary>
|
|
||||||
public string StoryboardFilename { get; protected set; }
|
|
||||||
}
|
|
||||||
}
|
|
@ -9,14 +9,14 @@ using osu.Game.Database;
|
|||||||
|
|
||||||
namespace osu.Game.Beatmaps.IO
|
namespace osu.Game.Beatmaps.IO
|
||||||
{
|
{
|
||||||
public sealed class OszArchiveReader : BeatmapArchiveReader
|
public sealed class OszArchiveReader : ArchiveReader
|
||||||
{
|
{
|
||||||
public static void Register()
|
public static void Register()
|
||||||
{
|
{
|
||||||
AddReader<OszArchiveReader>((storage, path) =>
|
AddReader<OszArchiveReader>((storage, path) =>
|
||||||
{
|
{
|
||||||
using (var stream = storage.GetStream(path))
|
using (var stream = storage.GetStream(path))
|
||||||
return Path.GetExtension(path) == OSZ_EXTENSION && ZipFile.IsZipFile(stream, false);
|
return ZipFile.IsZipFile(stream, false);
|
||||||
});
|
});
|
||||||
OsuLegacyDecoder.Register();
|
OsuLegacyDecoder.Register();
|
||||||
}
|
}
|
||||||
|
@ -33,7 +33,7 @@ namespace osu.Game.Beatmaps
|
|||||||
|
|
||||||
public readonly bool WithStoryboard;
|
public readonly bool WithStoryboard;
|
||||||
|
|
||||||
protected abstract BeatmapArchiveReader GetReader();
|
protected abstract ArchiveReader GetReader();
|
||||||
|
|
||||||
protected WorkingBeatmap(BeatmapInfo beatmapInfo, BeatmapSetInfo beatmapSetInfo, bool withStoryboard = false)
|
protected WorkingBeatmap(BeatmapInfo beatmapInfo, BeatmapSetInfo beatmapSetInfo, bool withStoryboard = false)
|
||||||
{
|
{
|
||||||
@ -101,7 +101,7 @@ namespace osu.Game.Beatmaps
|
|||||||
set { lock (beatmapLock) beatmap = value; }
|
set { lock (beatmapLock) beatmap = value; }
|
||||||
}
|
}
|
||||||
|
|
||||||
private BeatmapArchiveReader trackReader;
|
private ArchiveReader trackReader;
|
||||||
private Track track;
|
private Track track;
|
||||||
private object trackLock = new object();
|
private object trackLock = new object();
|
||||||
public Track Track
|
public Track Track
|
||||||
|
@ -177,7 +177,7 @@ namespace osu.Game.Database
|
|||||||
|
|
||||||
BeatmapMetadata metadata;
|
BeatmapMetadata metadata;
|
||||||
|
|
||||||
using (var reader = BeatmapArchiveReader.GetBeatmapArchiveReader(storage, path))
|
using (var reader = ArchiveReader.GetReader(storage, path))
|
||||||
metadata = reader.ReadMetadata();
|
metadata = reader.ReadMetadata();
|
||||||
|
|
||||||
if (File.Exists(path)) // Not always the case, i.e. for LegacyFilesystemReader
|
if (File.Exists(path)) // Not always the case, i.e. for LegacyFilesystemReader
|
||||||
@ -186,7 +186,7 @@ namespace osu.Game.Database
|
|||||||
{
|
{
|
||||||
hash = input.GetMd5Hash();
|
hash = input.GetMd5Hash();
|
||||||
input.Seek(0, SeekOrigin.Begin);
|
input.Seek(0, SeekOrigin.Begin);
|
||||||
path = Path.Combine(@"beatmaps", hash.Remove(1), hash.Remove(2), hash + BeatmapArchiveReader.OSZ_EXTENSION);
|
path = Path.Combine(@"beatmaps", hash.Remove(1), hash.Remove(2), hash);
|
||||||
if (!storage.Exists(path))
|
if (!storage.Exists(path))
|
||||||
using (var output = storage.GetStream(path, FileAccess.Write))
|
using (var output = storage.GetStream(path, FileAccess.Write))
|
||||||
input.CopyTo(output);
|
input.CopyTo(output);
|
||||||
@ -216,7 +216,7 @@ namespace osu.Game.Database
|
|||||||
Metadata = metadata
|
Metadata = metadata
|
||||||
};
|
};
|
||||||
|
|
||||||
using (var archive = BeatmapArchiveReader.GetBeatmapArchiveReader(storage, path))
|
using (var archive = ArchiveReader.GetReader(storage, path))
|
||||||
{
|
{
|
||||||
string[] mapNames = archive.BeatmapFilenames;
|
string[] mapNames = archive.BeatmapFilenames;
|
||||||
foreach (var name in mapNames)
|
foreach (var name in mapNames)
|
||||||
@ -268,12 +268,12 @@ namespace osu.Game.Database
|
|||||||
BeatmapSetRemoved?.Invoke(beatmapSet);
|
BeatmapSetRemoved?.Invoke(beatmapSet);
|
||||||
}
|
}
|
||||||
|
|
||||||
public BeatmapArchiveReader GetReader(BeatmapSetInfo beatmapSet)
|
public ArchiveReader GetReader(BeatmapSetInfo beatmapSet)
|
||||||
{
|
{
|
||||||
if (string.IsNullOrEmpty(beatmapSet.Path))
|
if (string.IsNullOrEmpty(beatmapSet.Path))
|
||||||
return null;
|
return null;
|
||||||
|
|
||||||
return BeatmapArchiveReader.GetBeatmapArchiveReader(storage, beatmapSet.Path);
|
return ArchiveReader.GetReader(storage, beatmapSet.Path);
|
||||||
}
|
}
|
||||||
|
|
||||||
public BeatmapSetInfo GetBeatmapSet(int id)
|
public BeatmapSetInfo GetBeatmapSet(int id)
|
||||||
@ -354,7 +354,7 @@ namespace osu.Game.Database
|
|||||||
this.database = database;
|
this.database = database;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override BeatmapArchiveReader GetReader() => database?.GetReader(BeatmapSetInfo);
|
protected override ArchiveReader GetReader() => database?.GetReader(BeatmapSetInfo);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -4,6 +4,7 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
|
using osu.Framework.Extensions.IEnumerableExtensions;
|
||||||
using osu.Framework.Input;
|
using osu.Framework.Input;
|
||||||
using osu.Framework.MathUtils;
|
using osu.Framework.MathUtils;
|
||||||
using osu.Game.Input.Handlers;
|
using osu.Game.Input.Handlers;
|
||||||
@ -95,24 +96,17 @@ namespace osu.Game.Modes
|
|||||||
|
|
||||||
public override List<InputState> GetPendingStates()
|
public override List<InputState> GetPendingStates()
|
||||||
{
|
{
|
||||||
|
var buttons = new HashSet<MouseButton>();
|
||||||
|
if (CurrentFrame?.MouseLeft ?? false)
|
||||||
|
buttons.Add(MouseButton.Left);
|
||||||
|
if (CurrentFrame?.MouseRight ?? false)
|
||||||
|
buttons.Add(MouseButton.Right);
|
||||||
|
|
||||||
return new List<InputState>
|
return new List<InputState>
|
||||||
{
|
{
|
||||||
new InputState
|
new InputState
|
||||||
{
|
{
|
||||||
Mouse = new ReplayMouseState(
|
Mouse = new ReplayMouseState(ToScreenSpace(position ?? Vector2.Zero), buttons),
|
||||||
ToScreenSpace(position ?? Vector2.Zero),
|
|
||||||
new List<MouseState.ButtonState>
|
|
||||||
{
|
|
||||||
new MouseState.ButtonState(MouseButton.Left)
|
|
||||||
{
|
|
||||||
State = CurrentFrame?.MouseLeft ?? false
|
|
||||||
},
|
|
||||||
new MouseState.ButtonState(MouseButton.Right)
|
|
||||||
{
|
|
||||||
State = CurrentFrame?.MouseRight ?? false
|
|
||||||
},
|
|
||||||
}
|
|
||||||
),
|
|
||||||
Keyboard = new ReplayKeyboardState(new List<Key>())
|
Keyboard = new ReplayKeyboardState(new List<Key>())
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
@ -171,10 +165,10 @@ namespace osu.Game.Modes
|
|||||||
|
|
||||||
private class ReplayMouseState : MouseState
|
private class ReplayMouseState : MouseState
|
||||||
{
|
{
|
||||||
public ReplayMouseState(Vector2 position, List<ButtonState> list)
|
public ReplayMouseState(Vector2 position, IEnumerable<MouseButton> list)
|
||||||
{
|
{
|
||||||
Position = position;
|
Position = position;
|
||||||
ButtonStates = list;
|
list.ForEach(b => PressedButtons.Add(b));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -258,13 +258,13 @@ namespace osu.Game
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
public event Action<Screen> ModeChanged;
|
public event Action<Screen> ScreenChanged;
|
||||||
|
|
||||||
private Container mainContent;
|
private Container mainContent;
|
||||||
|
|
||||||
private Container overlayContent;
|
private Container overlayContent;
|
||||||
|
|
||||||
private void modeChanged(Screen newScreen)
|
private void screenChanged(Screen newScreen)
|
||||||
{
|
{
|
||||||
//central game mode change logic.
|
//central game mode change logic.
|
||||||
if ((newScreen as OsuScreen)?.ShowOverlays != true)
|
if ((newScreen as OsuScreen)?.ShowOverlays != true)
|
||||||
@ -281,7 +281,7 @@ namespace osu.Game
|
|||||||
if (newScreen is MainMenu)
|
if (newScreen is MainMenu)
|
||||||
Cursor.FadeIn(100);
|
Cursor.FadeIn(100);
|
||||||
|
|
||||||
ModeChanged?.Invoke(newScreen);
|
ScreenChanged?.Invoke(newScreen);
|
||||||
|
|
||||||
if (newScreen == null)
|
if (newScreen == null)
|
||||||
Exit();
|
Exit();
|
||||||
@ -315,12 +315,12 @@ namespace osu.Game
|
|||||||
newScreen.ModePushed += screenAdded;
|
newScreen.ModePushed += screenAdded;
|
||||||
newScreen.Exited += screenRemoved;
|
newScreen.Exited += screenRemoved;
|
||||||
|
|
||||||
modeChanged(newScreen);
|
screenChanged(newScreen);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void screenRemoved(Screen newScreen)
|
private void screenRemoved(Screen newScreen)
|
||||||
{
|
{
|
||||||
modeChanged(newScreen);
|
screenChanged(newScreen);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -247,6 +247,8 @@ namespace osu.Game.Overlays
|
|||||||
|
|
||||||
if (current.Track.HasCompleted && !current.Track.Looping) next();
|
if (current.Track.HasCompleted && !current.Track.Looping) next();
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
playButton.Icon = FontAwesome.fa_play_circle_o;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void preferUnicode_changed(object sender, EventArgs e)
|
private void preferUnicode_changed(object sender, EventArgs e)
|
||||||
@ -337,12 +339,16 @@ namespace osu.Game.Overlays
|
|||||||
Task.Run(() =>
|
Task.Run(() =>
|
||||||
{
|
{
|
||||||
if (beatmap?.Beatmap == null)
|
if (beatmap?.Beatmap == null)
|
||||||
//todo: we may need to display some default text here (currently in the constructor).
|
{
|
||||||
return;
|
title.Text = @"Nothing to play";
|
||||||
|
artist.Text = @"Nothing to play";
|
||||||
BeatmapMetadata metadata = beatmap.Beatmap.BeatmapInfo.Metadata;
|
}
|
||||||
title.Text = unicodeString(metadata.Title, metadata.TitleUnicode);
|
else
|
||||||
artist.Text = unicodeString(metadata.Artist, metadata.ArtistUnicode);
|
{
|
||||||
|
BeatmapMetadata metadata = beatmap.Beatmap.BeatmapInfo.Metadata;
|
||||||
|
title.Text = unicodeString(metadata.Title, metadata.TitleUnicode);
|
||||||
|
artist.Text = unicodeString(metadata.Artist, metadata.ArtistUnicode);
|
||||||
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
MusicControllerBackground newBackground;
|
MusicControllerBackground newBackground;
|
||||||
|
@ -70,14 +70,14 @@ namespace osu.Game.Screens.Play
|
|||||||
{
|
{
|
||||||
if (mouseDisabled.Value)
|
if (mouseDisabled.Value)
|
||||||
{
|
{
|
||||||
mouse.ButtonStates.Find(s => s.Button == MouseButton.Left).State = false;
|
mouse.PressedButtons.Remove(MouseButton.Left);
|
||||||
mouse.ButtonStates.Find(s => s.Button == MouseButton.Right).State = false;
|
mouse.PressedButtons.Remove(MouseButton.Right);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (leftViaKeyboard)
|
if (leftViaKeyboard)
|
||||||
mouse.ButtonStates.Find(s => s.Button == MouseButton.Left).State = true;
|
mouse.PressedButtons.Add(MouseButton.Left);
|
||||||
if (rightViaKeyboard)
|
if (rightViaKeyboard)
|
||||||
mouse.ButtonStates.Find(s => s.Button == MouseButton.Right).State = true;
|
mouse.PressedButtons.Add(MouseButton.Right);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -16,7 +16,6 @@ using osu.Game.Database;
|
|||||||
using osu.Framework.Graphics.Colour;
|
using osu.Framework.Graphics.Colour;
|
||||||
using osu.Game.Beatmaps.Drawables;
|
using osu.Game.Beatmaps.Drawables;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using osu.Framework.Extensions.IEnumerableExtensions;
|
|
||||||
using osu.Framework.MathUtils;
|
using osu.Framework.MathUtils;
|
||||||
using osu.Game.Graphics;
|
using osu.Game.Graphics;
|
||||||
using osu.Game.Graphics.Sprites;
|
using osu.Game.Graphics.Sprites;
|
||||||
@ -56,8 +55,15 @@ namespace osu.Game.Screens.Select
|
|||||||
public void UpdateBeatmap(WorkingBeatmap beatmap)
|
public void UpdateBeatmap(WorkingBeatmap beatmap)
|
||||||
{
|
{
|
||||||
if (beatmap?.BeatmapInfo == null)
|
if (beatmap?.BeatmapInfo == null)
|
||||||
|
{
|
||||||
|
FadeOut(250);
|
||||||
|
beatmapInfoContainer?.FadeOut(250);
|
||||||
|
beatmapInfoContainer?.Expire();
|
||||||
|
beatmapInfoContainer = null;
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
FadeIn(250);
|
||||||
var lastContainer = beatmapInfoContainer;
|
var lastContainer = beatmapInfoContainer;
|
||||||
|
|
||||||
float newDepth = lastContainer?.Depth + 1 ?? 0;
|
float newDepth = lastContainer?.Depth + 1 ?? 0;
|
||||||
@ -84,7 +90,7 @@ namespace osu.Game.Screens.Select
|
|||||||
}));
|
}));
|
||||||
|
|
||||||
//get statistics fromt he current ruleset.
|
//get statistics fromt he current ruleset.
|
||||||
Ruleset.GetRuleset(beatmap.BeatmapInfo.Mode).GetBeatmapStatistics(beatmap).ForEach(s => labels.Add(new InfoLabel(s)));
|
labels.AddRange(Ruleset.GetRuleset(beatmap.BeatmapInfo.Mode).GetBeatmapStatistics(beatmap).Select(s => new InfoLabel(s)));
|
||||||
}
|
}
|
||||||
|
|
||||||
(beatmapInfoContainer = new BufferedContainer
|
(beatmapInfoContainer = new BufferedContainer
|
||||||
|
@ -57,6 +57,7 @@ namespace osu.Game.Screens.Select
|
|||||||
public void RemoveGroup(BeatmapGroup group)
|
public void RemoveGroup(BeatmapGroup group)
|
||||||
{
|
{
|
||||||
groups.Remove(group);
|
groups.Remove(group);
|
||||||
|
panels.Remove(group.Header);
|
||||||
foreach (var p in group.BeatmapPanels)
|
foreach (var p in group.BeatmapPanels)
|
||||||
panels.Remove(p);
|
panels.Remove(p);
|
||||||
|
|
||||||
|
@ -326,8 +326,7 @@ namespace osu.Game.Screens.Select
|
|||||||
backgroundModeBeatmap.FadeTo(1, 250);
|
backgroundModeBeatmap.FadeTo(1, 250);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (beatmap != null)
|
beatmapInfoWedge.UpdateBeatmap(beatmap);
|
||||||
beatmapInfoWedge.UpdateBeatmap(beatmap);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@ -337,11 +336,11 @@ namespace osu.Game.Screens.Select
|
|||||||
{
|
{
|
||||||
base.OnBeatmapChanged(beatmap);
|
base.OnBeatmapChanged(beatmap);
|
||||||
|
|
||||||
beatmap.Mods.BindTo(modSelect.SelectedMods);
|
beatmap?.Mods.BindTo(modSelect.SelectedMods);
|
||||||
|
|
||||||
//todo: change background in selectionChanged instead; support per-difficulty backgrounds.
|
//todo: change background in selectionChanged instead; support per-difficulty backgrounds.
|
||||||
changeBackground(beatmap);
|
changeBackground(beatmap);
|
||||||
carousel.SelectBeatmap(beatmap.BeatmapInfo);
|
carousel.SelectBeatmap(beatmap?.BeatmapInfo);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
@ -1,16 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
|
||||||
|
|
||||||
<!--
|
|
||||||
Copyright (c) 2007-2017 ppy Pty Ltd <contact@ppy.sh>.
|
|
||||||
Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
|
|
||||||
-->
|
|
||||||
<configuration>
|
|
||||||
<runtime>
|
|
||||||
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
|
|
||||||
<dependentAssembly>
|
|
||||||
<assemblyIdentity name="Newtonsoft.Json" publicKeyToken="30ad4fe6b2a6aeed" culture="neutral" />
|
|
||||||
<bindingRedirect oldVersion="0.0.0.0-9.0.0.0" newVersion="9.0.0.0" />
|
|
||||||
</dependentAssembly>
|
|
||||||
</assemblyBinding>
|
|
||||||
</runtime>
|
|
||||||
</configuration>
|
|
@ -240,7 +240,7 @@
|
|||||||
<Compile Include="Users\User.cs" />
|
<Compile Include="Users\User.cs" />
|
||||||
<Compile Include="Graphics\UserInterface\Volume\VolumeControl.cs" />
|
<Compile Include="Graphics\UserInterface\Volume\VolumeControl.cs" />
|
||||||
<Compile Include="Database\BeatmapDatabase.cs" />
|
<Compile Include="Database\BeatmapDatabase.cs" />
|
||||||
<Compile Include="Beatmaps\IO\BeatmapArchiveReader.cs" />
|
<Compile Include="Beatmaps\IO\ArchiveReader.cs" />
|
||||||
<Compile Include="Beatmaps\Formats\BeatmapDecoder.cs" />
|
<Compile Include="Beatmaps\Formats\BeatmapDecoder.cs" />
|
||||||
<Compile Include="Beatmaps\Formats\OsuLegacyDecoder.cs" />
|
<Compile Include="Beatmaps\Formats\OsuLegacyDecoder.cs" />
|
||||||
<Compile Include="Beatmaps\IO\OszArchiveReader.cs" />
|
<Compile Include="Beatmaps\IO\OszArchiveReader.cs" />
|
||||||
@ -328,7 +328,6 @@
|
|||||||
<Compile Include="Screens\Select\Options\BeatmapOptionsEditButton.cs" />
|
<Compile Include="Screens\Select\Options\BeatmapOptionsEditButton.cs" />
|
||||||
<Compile Include="Screens\Select\Options\BeatmapOptionsOverlay.cs" />
|
<Compile Include="Screens\Select\Options\BeatmapOptionsOverlay.cs" />
|
||||||
<Compile Include="Screens\Select\Options\BeatmapOptionsRemoveFromUnplayedButton.cs" />
|
<Compile Include="Screens\Select\Options\BeatmapOptionsRemoveFromUnplayedButton.cs" />
|
||||||
<Compile Include="IO\ArchiveReader.cs" />
|
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<ProjectReference Include="$(SolutionDir)\osu-framework\osu.Framework\osu.Framework.csproj">
|
<ProjectReference Include="$(SolutionDir)\osu-framework\osu.Framework\osu.Framework.csproj">
|
||||||
@ -344,7 +343,6 @@
|
|||||||
<None Include="..\osu.licenseheader">
|
<None Include="..\osu.licenseheader">
|
||||||
<Link>osu.licenseheader</Link>
|
<Link>osu.licenseheader</Link>
|
||||||
</None>
|
</None>
|
||||||
<None Include="app.config" />
|
|
||||||
<None Include="packages.config" />
|
<None Include="packages.config" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup />
|
<ItemGroup />
|
||||||
|
Loading…
Reference in New Issue
Block a user