1
0
mirror of https://github.com/ppy/osu.git synced 2024-09-22 09:27:34 +08:00

Merge branch 'master' into followpoints

This commit is contained in:
Dean Herbert 2017-02-13 22:23:57 +09:00 committed by GitHub
commit 343e48c195
63 changed files with 569 additions and 225 deletions

View File

@ -1,6 +1,4 @@
The MIT License
Copyright (c) 2007-2016 ppy Pty Ltd <contact@ppy.sh>.
Copyright (c) 2007-2017 ppy Pty Ltd <contact@ppy.sh>.
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
@ -18,4 +16,4 @@ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
THE SOFTWARE.

@ -1 +1 @@
Subproject commit 7df72f8d0cb887437a2816d3f413bf37ca2d6641
Subproject commit 4d7f9b8a3afd32183a31d62143d522d43d8c01ca

View File

@ -20,6 +20,7 @@
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<TreatWarningsAsErrors>false</TreatWarningsAsErrors>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DebugType>pdbonly</DebugType>
@ -28,6 +29,7 @@
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<TreatWarningsAsErrors>false</TreatWarningsAsErrors>
</PropertyGroup>
<ItemGroup>
<Reference Include="mscorlib" />

View File

@ -71,7 +71,7 @@ namespace osu.Desktop.VisualTests.Tests
Add(flow = new FlowContainer
{
RelativeSizeAxes = Axes.Both,
Direction = FlowDirection.VerticalOnly
Direction = FlowDirections.Vertical
});
SpriteText loading;

View File

@ -88,13 +88,13 @@ namespace osu.Desktop.VisualTests.Tests
if (n.Progress < 1)
n.Progress += (float)(Time.Elapsed / 2000) * RNG.NextSingle();
else
n.Complete();
n.State = ProgressNotificationState.Completed;
}
}
private void sendProgress2()
{
var n = new ProgressNotification(@"Downloading Haitai...");
var n = new ProgressNotification { Text = @"Downloading Haitai..." };
manager.Post(n);
progressingNotifications.Add(n);
}
@ -103,19 +103,19 @@ namespace osu.Desktop.VisualTests.Tests
private void sendProgress1()
{
var n = new ProgressNotification(@"Uploading to BSS...");
var n = new ProgressNotification { Text = @"Uploading to BSS..." };
manager.Post(n);
progressingNotifications.Add(n);
}
private void sendNotification2()
{
manager.Post(new SimpleNotification(@"You are amazing"));
manager.Post(new SimpleNotification { Text = @"You are amazing" });
}
private void sendNotification1()
{
manager.Post(new SimpleNotification(@"Welcome to osu!. Enjoy your stay!"));
manager.Post(new SimpleNotification { Text = @"Welcome to osu!. Enjoy your stay!" });
}
}
}

View File

@ -59,6 +59,7 @@
<CodeAnalysisRuleSet>AllRules.ruleset</CodeAnalysisRuleSet>
<RunCodeAnalysis>false</RunCodeAnalysis>
<Prefer32Bit>false</Prefer32Bit>
<TreatWarningsAsErrors>false</TreatWarningsAsErrors>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DebugType>none</DebugType>
@ -73,6 +74,7 @@
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
<CodeAnalysisRuleSet>AllRules.ruleset</CodeAnalysisRuleSet>
<Prefer32Bit>false</Prefer32Bit>
<TreatWarningsAsErrors>false</TreatWarningsAsErrors>
</PropertyGroup>
<PropertyGroup>
<Win32Resource>

View File

@ -20,27 +20,22 @@ namespace osu.Desktop.Beatmaps.IO
public static void Register() => AddReader<LegacyFilesystemReader>((storage, path) => Directory.Exists(path));
private string basePath { get; set; }
private string[] beatmaps { get; set; }
private Beatmap firstMap { get; set; }
public LegacyFilesystemReader(string path)
{
basePath = path;
beatmaps = Directory.GetFiles(basePath, @"*.osu").Select(f => Path.GetFileName(f)).ToArray();
if (beatmaps.Length == 0)
BeatmapFilenames = Directory.GetFiles(basePath, @"*.osu").Select(f => Path.GetFileName(f)).ToArray();
if (BeatmapFilenames.Length == 0)
throw new FileNotFoundException(@"This directory contains no beatmaps");
using (var stream = new StreamReader(GetStream(beatmaps[0])))
StoryboardFilename = Directory.GetFiles(basePath, @"*.osb").Select(f => Path.GetFileName(f)).FirstOrDefault();
using (var stream = new StreamReader(GetStream(BeatmapFilenames[0])))
{
var decoder = BeatmapDecoder.GetDecoder(stream);
firstMap = decoder.Decode(stream);
}
}
public override string[] ReadBeatmaps()
{
return beatmaps;
}
public override Stream GetStream(string name)
{
return File.OpenRead(Path.Combine(basePath, name));

View File

@ -11,6 +11,9 @@ using System.Windows.Forms;
using osu.Framework.Platform;
using osu.Framework.Desktop.Platform;
using osu.Game.Database;
using osu.Desktop.Overlays;
using System.Reflection;
using System.Drawing;
namespace osu.Desktop
{
@ -22,12 +25,22 @@ namespace osu.Desktop
}
protected override void LoadComplete()
{
base.LoadComplete();
(new VersionManager()).Preload(this, Add);
}
public override void SetHost(BasicGameHost host)
{
base.SetHost(host);
var desktopWindow = host.Window as DesktopGameWindow;
if (desktopWindow != null)
{
desktopWindow.Icon = Icon.ExtractAssociatedIcon(Assembly.GetExecutingAssembly().Location);
desktopWindow.Title = @"osu!lazer";
desktopWindow.DragEnter += dragEnter;
desktopWindow.DragDrop += dragDrop;
}

View File

@ -0,0 +1,97 @@
using osu.Framework.Allocation;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
using osu.Game.Graphics.Sprites;
using osu.Game.Overlays;
using osu.Game.Overlays.Notifications;
using Squirrel;
using System.Reflection;
namespace osu.Desktop.Overlays
{
public class VersionManager : OverlayContainer
{
private UpdateManager updateManager;
private NotificationManager notification;
[BackgroundDependencyLoader]
private void load(NotificationManager notification)
{
this.notification = notification;
AutoSizeAxes = Axes.Both;
Anchor = Anchor.BottomCentre;
Origin = Anchor.BottomCentre;
var asm = Assembly.GetEntryAssembly().GetName();
Add(new OsuSpriteText
{
Text = $@"osu!lazer v{asm.Version}"
});
updateChecker();
}
protected override void LoadComplete()
{
base.LoadComplete();
State = Visibility.Visible;
}
protected override void Dispose(bool isDisposing)
{
base.Dispose(isDisposing);
updateManager?.Dispose();
}
private async void updateChecker()
{
updateManager = await UpdateManager.GitHubUpdateManager(@"https://github.com/ppy/osu", @"osulazer", null, null, true);
if (!updateManager.IsInstalledApp)
return;
var info = await updateManager.CheckForUpdate();
if (info.ReleasesToApply.Count > 0)
{
ProgressNotification n = new UpdateProgressNotification
{
Text = @"Downloading update..."
};
Schedule(() => notification.Post(n));
Schedule(() => n.State = ProgressNotificationState.Active);
await updateManager.DownloadReleases(info.ReleasesToApply, (int p) => Schedule(() => n.Progress = p / 100f));
Schedule(() => n.Text = @"Installing update...");
await updateManager.ApplyReleases(info, (int p) => Schedule(() => n.Progress = p / 100f));
Schedule(() => n.State = ProgressNotificationState.Completed);
}
else
{
//check again every 30 minutes.
Scheduler.AddDelayed(updateChecker, 60000 * 30);
}
}
protected override void PopIn()
{
}
protected override void PopOut()
{
}
class UpdateProgressNotification : ProgressNotification
{
protected override Notification CreateCompletionNotification() => new ProgressCompletionNotification(this)
{
Text = @"Update ready to install. Click to restart!",
Activated = () =>
{
UpdateManager.RestartApp();
return true;
}
};
}
}
}

View File

@ -0,0 +1,26 @@
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("osu!lazer")]
[assembly: AssemblyDescription("click the circles. to the beat.")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("ppy Pty Ltd")]
[assembly: AssemblyProduct("osu!lazer")]
[assembly: AssemblyCopyright("ppy Pty Ltd 2007-2017")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]
// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("55e28cb2-7b6c-4595-8dcc-9871d8aad7e9")]
[assembly: AssemblyVersion("0.0.5")]
[assembly: AssemblyFileVersion("0.0.5")]

11
osu.Desktop/app.config Normal file
View File

@ -0,0 +1,11 @@
<?xml version="1.0" encoding="utf-8"?>
<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>

View File

@ -59,6 +59,7 @@
<CodeAnalysisRuleSet>AllRules.ruleset</CodeAnalysisRuleSet>
<RunCodeAnalysis>false</RunCodeAnalysis>
<Prefer32Bit>false</Prefer32Bit>
<TreatWarningsAsErrors>false</TreatWarningsAsErrors>
<Commandlineparameters>
</Commandlineparameters>
</PropertyGroup>
@ -75,21 +76,76 @@
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
<CodeAnalysisRuleSet>AllRules.ruleset</CodeAnalysisRuleSet>
<Prefer32Bit>false</Prefer32Bit>
<TreatWarningsAsErrors>false</TreatWarningsAsErrors>
</PropertyGroup>
<PropertyGroup>
<Win32Resource>osu!.res</Win32Resource>
<Win32Resource>
</Win32Resource>
</PropertyGroup>
<PropertyGroup>
<ApplicationIcon>lazer.ico</ApplicationIcon>
</PropertyGroup>
<PropertyGroup>
<ApplicationManifest>Properties\app.manifest</ApplicationManifest>
</PropertyGroup>
<ItemGroup>
<Reference Include="DeltaCompressionDotNet, Version=1.0.0.0, Culture=neutral, PublicKeyToken=1d14d6e5194e7f4a, processorArchitecture=MSIL">
<HintPath>..\packages\DeltaCompressionDotNet.1.0.0\lib\net45\DeltaCompressionDotNet.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="DeltaCompressionDotNet.MsDelta, Version=1.0.0.0, Culture=neutral, PublicKeyToken=46b2138a390abf55, processorArchitecture=MSIL">
<HintPath>..\packages\DeltaCompressionDotNet.1.0.0\lib\net45\DeltaCompressionDotNet.MsDelta.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="DeltaCompressionDotNet.PatchApi, Version=1.0.0.0, Culture=neutral, PublicKeyToken=3e8888ee913ed789, processorArchitecture=MSIL">
<HintPath>..\packages\DeltaCompressionDotNet.1.0.0\lib\net45\DeltaCompressionDotNet.PatchApi.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="ICSharpCode.SharpZipLib, Version=0.86.0.518, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\squirrel.windows.1.5.2\lib\Net45\ICSharpCode.SharpZipLib.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="Mono.Cecil, Version=0.9.6.0, Culture=neutral, PublicKeyToken=0738eb9f132ed756, processorArchitecture=MSIL">
<HintPath>..\packages\Mono.Cecil.0.9.6.1\lib\net45\Mono.Cecil.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="Mono.Cecil.Mdb, Version=0.9.6.0, Culture=neutral, PublicKeyToken=0738eb9f132ed756, processorArchitecture=MSIL">
<HintPath>..\packages\Mono.Cecil.0.9.6.1\lib\net45\Mono.Cecil.Mdb.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="Mono.Cecil.Pdb, Version=0.9.6.0, Culture=neutral, PublicKeyToken=0738eb9f132ed756, processorArchitecture=MSIL">
<HintPath>..\packages\Mono.Cecil.0.9.6.1\lib\net45\Mono.Cecil.Pdb.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="Mono.Cecil.Rocks, Version=0.9.6.0, Culture=neutral, PublicKeyToken=0738eb9f132ed756, processorArchitecture=MSIL">
<HintPath>..\packages\Mono.Cecil.0.9.6.1\lib\net45\Mono.Cecil.Rocks.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="mscorlib" />
<Reference Include="NuGet.Squirrel, Version=3.0.0.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\squirrel.windows.1.5.2\lib\Net45\NuGet.Squirrel.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="OpenTK, Version=2.0.0.0, Culture=neutral, PublicKeyToken=bad199fe84eb3df4" />
<Reference Include="Splat, Version=1.6.2.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\Splat.1.6.2\lib\Net45\Splat.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="Squirrel, Version=1.5.2.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\squirrel.windows.1.5.2\lib\Net45\Squirrel.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="System" />
<Reference Include="System.Drawing" />
<Reference Include="System.Windows.Forms" />
</ItemGroup>
<ItemGroup>
<None Include="..\osu.licenseheader">
<Link>osu.licenseheader</Link>
</None>
<None Include="app.config" />
<None Include="osu!.res" />
<None Include="packages.config" />
<None Include="Properties\app.manifest" />
</ItemGroup>
<ItemGroup>
@ -155,10 +211,14 @@
</ItemGroup>
<ItemGroup>
<Compile Include="OsuGameDesktop.cs" />
<Compile Include="Overlays\VersionManager.cs" />
<Compile Include="Program.cs" />
<Compile Include="Beatmaps\IO\LegacyFilesystemReader.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
</ItemGroup>
<ItemGroup>
<Content Include="lazer.ico" />
</ItemGroup>
<ItemGroup />
<ItemGroup />
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.

View File

@ -0,0 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="DeltaCompressionDotNet" version="1.0.0" targetFramework="net45" />
<package id="Mono.Cecil" version="0.9.6.1" targetFramework="net45" />
<package id="Splat" version="1.6.2" targetFramework="net45" />
<package id="squirrel.windows" version="1.5.2" targetFramework="net45" />
</packages>

View File

@ -20,6 +20,7 @@
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<TreatWarningsAsErrors>false</TreatWarningsAsErrors>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DebugType>pdbonly</DebugType>
@ -28,6 +29,7 @@
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<TreatWarningsAsErrors>false</TreatWarningsAsErrors>
</PropertyGroup>
<ItemGroup>
<Reference Include="OpenTK, Version=2.0.0.0, Culture=neutral, PublicKeyToken=bad199fe84eb3df4, processorArchitecture=MSIL">

View File

@ -20,6 +20,7 @@
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<TreatWarningsAsErrors>false</TreatWarningsAsErrors>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DebugType>pdbonly</DebugType>
@ -28,6 +29,7 @@
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<TreatWarningsAsErrors>false</TreatWarningsAsErrors>
</PropertyGroup>
<ItemGroup>
<Reference Include="OpenTK, Version=2.0.0.0, Culture=neutral, PublicKeyToken=bad199fe84eb3df4, processorArchitecture=MSIL">

View File

@ -24,7 +24,7 @@ namespace osu.Game.Modes.Osu.Objects.Drawables
AutoSizeAxes = Axes.Both;
Origin = Anchor.Centre;
Direction = FlowDirection.VerticalOnly;
Direction = FlowDirections.Vertical;
Spacing = new Vector2(0, 2);
Position = (h?.StackedEndPosition ?? Vector2.Zero) + judgement.PositionOffset;

View File

@ -21,6 +21,7 @@
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<TreatWarningsAsErrors>false</TreatWarningsAsErrors>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DebugType>pdbonly</DebugType>
@ -29,6 +30,7 @@
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<TreatWarningsAsErrors>false</TreatWarningsAsErrors>
</PropertyGroup>
<ItemGroup>
<Reference Include="OpenTK, Version=2.0.0.0, Culture=neutral, PublicKeyToken=bad199fe84eb3df4, processorArchitecture=MSIL">

View File

@ -20,6 +20,7 @@
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<TreatWarningsAsErrors>false</TreatWarningsAsErrors>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DebugType>pdbonly</DebugType>
@ -28,6 +29,7 @@
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<TreatWarningsAsErrors>false</TreatWarningsAsErrors>
</PropertyGroup>
<ItemGroup>
<Reference Include="OpenTK, Version=2.0.0.0, Culture=neutral, PublicKeyToken=bad199fe84eb3df4, processorArchitecture=MSIL">

View File

@ -39,7 +39,7 @@ namespace osu.Game.Tests.Beatmaps.IO
"Soleily - Renatus (MMzz) [Muzukashii].osu",
"Soleily - Renatus (MMzz) [Oni].osu"
};
var maps = reader.ReadBeatmaps();
var maps = reader.BeatmapFilenames;
foreach (var map in expected)
Assert.Contains(map, maps);
}

View File

@ -18,6 +18,7 @@
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<ConsolePause>false</ConsolePause>
<TreatWarningsAsErrors>false</TreatWarningsAsErrors>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<Optimize>true</Optimize>
@ -25,6 +26,7 @@
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<ConsolePause>false</ConsolePause>
<TreatWarningsAsErrors>false</TreatWarningsAsErrors>
</PropertyGroup>
<ItemGroup>
<Reference Include="nunit.framework, Version=3.5.0.0, Culture=neutral, PublicKeyToken=2638cd05610744eb, processorArchitecture=MSIL">

View File

@ -77,7 +77,7 @@ namespace osu.Game.Beatmaps.Drawables
new FlowContainer
{
Padding = new MarginPadding(5),
Direction = FlowDirection.HorizontalOnly,
Direction = FlowDirections.Horizontal,
AutoSizeAxes = Axes.Both,
Anchor = Anchor.CentreLeft,
Origin = Anchor.CentreLeft,
@ -93,13 +93,13 @@ namespace osu.Game.Beatmaps.Drawables
{
Padding = new MarginPadding { Left = 5 },
Spacing = new Vector2(0, 5),
Direction = FlowDirection.VerticalOnly,
Direction = FlowDirections.Vertical,
AutoSizeAxes = Axes.Both,
Children = new Drawable[]
{
new FlowContainer
{
Direction = FlowDirection.HorizontalOnly,
Direction = FlowDirections.Horizontal,
AutoSizeAxes = Axes.Both,
Spacing = new Vector2(4, 0),
Children = new[]

View File

@ -39,7 +39,7 @@ namespace osu.Game.Beatmaps.Drawables
},
new FlowContainer
{
Direction = FlowDirection.VerticalOnly,
Direction = FlowDirections.Vertical,
Padding = new MarginPadding { Top = 5, Left = 18, Right = 10, Bottom = 10 },
AutoSizeAxes = Axes.Both,
Children = new[]
@ -113,7 +113,7 @@ namespace osu.Game.Beatmaps.Drawables
new FlowContainer
{
Depth = -1,
Direction = FlowDirection.HorizontalOnly,
Direction = FlowDirections.Horizontal,
RelativeSizeAxes = Axes.Both,
// This makes the gradient not be perfectly horizontal, but diagonal at a ~40° angle
Shear = new Vector2(0.8f, 0),

View File

@ -7,6 +7,8 @@ using System.IO;
using osu.Game.Modes.Objects;
using OpenTK.Graphics;
using osu.Game.Graphics;
using osu.Game.Beatmaps.Timing;
using osu.Game.Database;
namespace osu.Game.Beatmaps.Formats
{
@ -34,6 +36,11 @@ namespace osu.Game.Beatmaps.Formats
return b;
}
public virtual void Decode(TextReader stream, Beatmap beatmap)
{
ParseFile(stream, beatmap);
}
public virtual Beatmap Process(Beatmap beatmap)
{
ApplyColours(beatmap);
@ -41,7 +48,23 @@ namespace osu.Game.Beatmaps.Formats
return beatmap;
}
protected abstract Beatmap ParseFile(TextReader stream);
protected virtual Beatmap ParseFile(TextReader stream)
{
var beatmap = new Beatmap
{
HitObjects = new List<HitObject>(),
ControlPoints = new List<ControlPoint>(),
ComboColors = new List<Color4>(),
BeatmapInfo = new BeatmapInfo
{
Metadata = new BeatmapMetadata(),
BaseDifficulty = new BaseDifficulty(),
},
};
ParseFile(stream, beatmap);
return beatmap;
}
protected abstract void ParseFile(TextReader stream, Beatmap beatmap);
public virtual void ApplyColours(Beatmap b)
{

View File

@ -12,7 +12,7 @@ namespace osu.Game.Beatmaps.Formats
{
public class ConstructableBeatmapDecoder : BeatmapDecoder
{
protected override Beatmap ParseFile(TextReader stream)
protected override void ParseFile(TextReader stream, Beatmap beatmap)
{
throw new NotImplementedException();
}

View File

@ -233,20 +233,8 @@ namespace osu.Game.Beatmaps.Formats
});
}
protected override Beatmap ParseFile(TextReader stream)
protected override void ParseFile(TextReader stream, Beatmap beatmap)
{
var beatmap = new Beatmap
{
HitObjects = new List<HitObject>(),
ControlPoints = new List<ControlPoint>(),
ComboColors = new List<Color4>(),
BeatmapInfo = new BeatmapInfo
{
Metadata = new BeatmapMetadata(),
BaseDifficulty = new BaseDifficulty(),
},
};
HitObjectParser parser = null;
var section = Section.None;
@ -309,8 +297,6 @@ namespace osu.Game.Beatmaps.Formats
break;
}
}
return beatmap;
}
}
}

View File

@ -19,7 +19,7 @@ namespace osu.Game.Beatmaps.IO
}
private static List<Reader> readers { get; } = new List<Reader>();
public static ArchiveReader GetReader(BasicStorage storage, string path)
{
foreach (var reader in readers)
@ -29,20 +29,27 @@ namespace osu.Game.Beatmaps.IO
}
throw new IOException(@"Unknown file format");
}
protected static void AddReader<T>(Func<BasicStorage, string, bool> test) where T : ArchiveReader
{
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 abstract string[] ReadBeatmaps();
public string[] BeatmapFilenames { get; protected set; }
/// <summary>
/// The storyboard filename. Null if no storyboard is present.
/// </summary>
public string StoryboardFilename { get; protected set; }
/// <summary>
/// Opens a stream for reading a specific file from this archive.
/// </summary>

View File

@ -25,29 +25,25 @@ namespace osu.Game.Beatmaps.IO
private Stream archiveStream;
private ZipFile archive;
private string[] beatmaps;
private Beatmap firstMap;
public OszArchiveReader(Stream archiveStream)
{
this.archiveStream = archiveStream;
archive = ZipFile.Read(archiveStream);
beatmaps = archive.Entries.Where(e => e.FileName.EndsWith(@".osu"))
BeatmapFilenames = archive.Entries.Where(e => e.FileName.EndsWith(@".osu"))
.Select(e => e.FileName).ToArray();
if (beatmaps.Length == 0)
if (BeatmapFilenames.Length == 0)
throw new FileNotFoundException(@"This directory contains no beatmaps");
using (var stream = new StreamReader(GetStream(beatmaps[0])))
StoryboardFilename = archive.Entries.Where(e => e.FileName.EndsWith(@".osb"))
.Select(e => e.FileName).FirstOrDefault();
using (var stream = new StreamReader(GetStream(BeatmapFilenames[0])))
{
var decoder = BeatmapDecoder.GetDecoder(stream);
firstMap = decoder.Decode(stream);
}
}
public override string[] ReadBeatmaps()
{
return beatmaps;
}
public override Stream GetStream(string name)
{
ZipEntry entry = archive.Entries.SingleOrDefault(e => e.FileName == name);

View File

@ -18,6 +18,8 @@ namespace osu.Game.Beatmaps
public readonly BeatmapSetInfo BeatmapSetInfo;
private readonly BeatmapDatabase database;
public readonly bool WithStoryboard;
private ArchiveReader getReader() => database?.GetReader(BeatmapSetInfo);
private Texture background;
@ -30,7 +32,7 @@ namespace osu.Game.Beatmaps
{
if (background != null) return background;
if (BeatmapInfo.Metadata?.BackgroundFile == null) return null;
if (BeatmapInfo?.Metadata?.BackgroundFile == null) return null;
try
{
@ -58,8 +60,19 @@ namespace osu.Game.Beatmaps
try
{
using (var reader = getReader())
using (var stream = new StreamReader(reader.GetStream(BeatmapInfo.Path)))
beatmap = BeatmapDecoder.GetDecoder(stream)?.Decode(stream);
{
BeatmapDecoder decoder;
using (var stream = new StreamReader(reader.GetStream(BeatmapInfo.Path)))
{
decoder = BeatmapDecoder.GetDecoder(stream);
beatmap = decoder?.Decode(stream);
}
if (WithStoryboard && beatmap != null && BeatmapSetInfo.StoryboardFile != null)
using (var stream = new StreamReader(reader.GetStream(BeatmapSetInfo.StoryboardFile)))
decoder?.Decode(stream, beatmap);
}
}
catch { }
@ -103,11 +116,12 @@ namespace osu.Game.Beatmaps
this.beatmap = beatmap;
}
public WorkingBeatmap(BeatmapInfo beatmapInfo, BeatmapSetInfo beatmapSetInfo, BeatmapDatabase database)
public WorkingBeatmap(BeatmapInfo beatmapInfo, BeatmapSetInfo beatmapSetInfo, BeatmapDatabase database, bool withStoryboard = false)
{
BeatmapInfo = beatmapInfo;
BeatmapSetInfo = beatmapSetInfo;
this.database = database;
this.WithStoryboard = withStoryboard;
}
private bool isDisposed;

View File

@ -83,64 +83,67 @@ namespace osu.Game.Database
connection.DeleteAll<BeatmapInfo>();
}
public void Import(params string[] paths)
public void Import(IEnumerable<string> paths)
{
foreach (string p in paths)
Import(p);
}
public void Import(string path)
{
string hash = null;
BeatmapMetadata metadata;
using (var reader = ArchiveReader.GetReader(storage, path))
metadata = reader.ReadMetadata();
if (metadata.OnlineBeatmapSetID.HasValue &&
connection.Table<BeatmapSetInfo>().Count(b => b.OnlineBeatmapSetID == metadata.OnlineBeatmapSetID) != 0)
return; // TODO: Update this beatmap instead
if (File.Exists(path)) // Not always the case, i.e. for LegacyFilesystemReader
{
var path = p;
string hash = null;
BeatmapMetadata metadata;
using (var reader = ArchiveReader.GetReader(storage, path))
metadata = reader.ReadMetadata();
if (metadata.OnlineBeatmapSetID.HasValue &&
connection.Table<BeatmapSetInfo>().Count(b => b.OnlineBeatmapSetID == metadata.OnlineBeatmapSetID) != 0)
return; // TODO: Update this beatmap instead
if (File.Exists(path)) // Not always the case, i.e. for LegacyFilesystemReader
using (var md5 = MD5.Create())
using (var input = storage.GetStream(path))
{
using (var md5 = MD5.Create())
using (var input = storage.GetStream(path))
{
hash = BitConverter.ToString(md5.ComputeHash(input)).Replace("-", "").ToLowerInvariant();
input.Seek(0, SeekOrigin.Begin);
path = Path.Combine(@"beatmaps", hash.Remove(1), hash.Remove(2), hash);
using (var output = storage.GetStream(path, FileAccess.Write))
input.CopyTo(output);
}
hash = BitConverter.ToString(md5.ComputeHash(input)).Replace("-", "").ToLowerInvariant();
input.Seek(0, SeekOrigin.Begin);
path = Path.Combine(@"beatmaps", hash.Remove(1), hash.Remove(2), hash);
using (var output = storage.GetStream(path, FileAccess.Write))
input.CopyTo(output);
}
var beatmapSet = new BeatmapSetInfo
{
OnlineBeatmapSetID = metadata.OnlineBeatmapSetID,
Beatmaps = new List<BeatmapInfo>(),
Path = path,
Hash = hash,
Metadata = metadata
};
using (var reader = ArchiveReader.GetReader(storage, path))
{
string[] mapNames = reader.ReadBeatmaps();
foreach (var name in mapNames)
{
using (var stream = new StreamReader(reader.GetStream(name)))
{
var decoder = BeatmapDecoder.GetDecoder(stream);
Beatmap beatmap = decoder.Decode(stream);
beatmap.BeatmapInfo.Path = name;
// TODO: Diff beatmap metadata with set metadata and leave it here if necessary
beatmap.BeatmapInfo.Metadata = null;
beatmapSet.Beatmaps.Add(beatmap.BeatmapInfo);
}
}
}
Import(new[] { beatmapSet });
}
var beatmapSet = new BeatmapSetInfo
{
OnlineBeatmapSetID = metadata.OnlineBeatmapSetID,
Beatmaps = new List<BeatmapInfo>(),
Path = path,
Hash = hash,
Metadata = metadata
};
using (var reader = ArchiveReader.GetReader(storage, path))
{
string[] mapNames = reader.BeatmapFilenames;
foreach (var name in mapNames)
{
using (var stream = new StreamReader(reader.GetStream(name)))
{
var decoder = BeatmapDecoder.GetDecoder(stream);
Beatmap beatmap = decoder.Decode(stream);
beatmap.BeatmapInfo.Path = name;
// TODO: Diff beatmap metadata with set metadata and leave it here if necessary
beatmap.BeatmapInfo.Metadata = null;
beatmapSet.Beatmaps.Add(beatmap.BeatmapInfo);
}
beatmapSet.StoryboardFile = reader.StoryboardFilename;
}
}
Import(new[] { beatmapSet });
}
public void Import(IEnumerable<BeatmapSetInfo> beatmapSets)
@ -169,7 +172,7 @@ namespace osu.Game.Database
return Query<BeatmapSetInfo>().FirstOrDefault(s => s.OnlineBeatmapSetID == id);
}
public WorkingBeatmap GetWorkingBeatmap(BeatmapInfo beatmapInfo, WorkingBeatmap previous = null)
public WorkingBeatmap GetWorkingBeatmap(BeatmapInfo beatmapInfo, WorkingBeatmap previous = null, bool withStoryboard = false)
{
var beatmapSetInfo = Query<BeatmapSetInfo>().FirstOrDefault(s => s.ID == beatmapInfo.BeatmapSetInfoID);
@ -182,7 +185,7 @@ namespace osu.Game.Database
if (beatmapInfo.Metadata == null)
beatmapInfo.Metadata = beatmapSetInfo.Metadata;
var working = new WorkingBeatmap(beatmapInfo, beatmapSetInfo, this);
var working = new WorkingBeatmap(beatmapInfo, beatmapSetInfo, this, withStoryboard);
previous?.TransferTo(working);

View File

@ -27,6 +27,8 @@ namespace osu.Game.Database
public string Hash { get; set; }
public string Path { get; set; }
public string StoryboardFile { get; set; }
}
}

View File

@ -22,7 +22,7 @@ namespace osu.Game.Graphics.UserInterface
{
new FlowContainer
{
Direction = FlowDirection.HorizontalOnly,
Direction = FlowDirections.Horizontal,
RelativeSizeAxes = Axes.X,
AutoSizeAxes = Axes.Y,
Children = new Drawable[]

View File

@ -42,7 +42,7 @@ namespace osu.Game.Online.Chat.Drawables
{
flow = new FlowContainer
{
Direction = FlowDirection.VerticalOnly,
Direction = FlowDirections.Vertical,
RelativeSizeAxes = Axes.X,
AutoSizeAxes = Axes.Y,
Spacing = new Vector2(1, 1)

View File

@ -24,6 +24,7 @@ using osu.Game.Screens.Menu;
using OpenTK;
using System.Linq;
using osu.Framework.Graphics.Primitives;
using System.Collections.Generic;
namespace osu.Game
{
@ -67,14 +68,17 @@ namespace osu.Game
}
if (args?.Length > 0)
ImportBeatmaps(args);
{
var paths = args.Where(a => !a.StartsWith(@"-"));
ImportBeatmaps(paths);
}
Dependencies.Cache(this);
PlayMode = LocalConfig.GetBindable<PlayMode>(OsuConfig.PlayMode);
}
public void ImportBeatmaps(params string[] paths)
public void ImportBeatmaps(IEnumerable<string> paths)
{
Schedule(delegate { Dependencies.Get<BeatmapDatabase>().Import(paths); });
}

View File

@ -240,7 +240,6 @@ namespace osu.Game.Overlays
if (current?.TrackLoaded ?? false)
{
progress.UpdatePosition((float)(current.Track.CurrentTime / current.Track.Length));
playButton.Icon = current.Track.IsRunning ? FontAwesome.fa_pause_circle_o : FontAwesome.fa_play_circle_o;

View File

@ -45,7 +45,7 @@ namespace osu.Game.Overlays
{
sections = new FlowContainer<NotificationSection>
{
Direction = FlowDirection.VerticalOnly,
Direction = FlowDirections.Vertical,
AutoSizeAxes = Axes.Y,
RelativeSizeAxes = Axes.X,
Children = new []
@ -73,6 +73,8 @@ namespace osu.Game.Overlays
public void Post(Notification notification)
{
State = Visibility.Visible;
++runningDepth;
notification.Depth = notification.DisplayOnTop ? runningDepth : -runningDepth;

View File

@ -53,8 +53,7 @@ namespace osu.Game.Overlays.Notifications
}
}
[BackgroundDependencyLoader]
private void load(OsuColour colours)
public Notification()
{
RelativeSizeAxes = Axes.X;
AutoSizeAxes = Axes.Y;

View File

@ -60,7 +60,7 @@ namespace osu.Game.Overlays.Notifications
{
RelativeSizeAxes = Axes.X;
AutoSizeAxes = Axes.Y;
Direction = FlowDirection.VerticalOnly;
Direction = FlowDirections.Vertical;
Padding = new MarginPadding
{

View File

@ -1,6 +1,8 @@
// Copyright (c) 2007-2017 ppy Pty Ltd <contact@ppy.sh>.
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
using osu.Game.Graphics;
namespace osu.Game.Overlays.Notifications
{
public class ProgressCompletionNotification : SimpleNotification
@ -8,9 +10,9 @@ namespace osu.Game.Overlays.Notifications
private ProgressNotification progressNotification;
public ProgressCompletionNotification(ProgressNotification progressNotification)
: base(@"Task has completed!")
{
this.progressNotification = progressNotification;
Icon = FontAwesome.fa_check;
}
}
}

View File

@ -16,50 +16,91 @@ namespace osu.Game.Overlays.Notifications
{
public class ProgressNotification : Notification, IHasCompletionTarget
{
private string text;
private float progress;
public float Progress
public string Text
{
get { return progress; }
get { return textDrawable.Text; }
set
{
Debug.Assert(state == ProgressNotificationState.Active);
progress = value;
progressBar.Progress = progress;
textDrawable.Text = value;
}
}
public ProgressNotificationState State
public float Progress
{
get { return progressBar.Progress; }
set
{
progressBar.Progress = value;
}
}
protected override void LoadComplete()
{
base.LoadComplete();
//we may have received changes before we were displayed.
State = state;
}
public virtual ProgressNotificationState State
{
get { return state; }
set
{
bool stateChanged = state != value;
state = value;
switch (state)
if (IsLoaded)
{
case ProgressNotificationState.Queued:
Light.Colour = colourQueued;
Light.Pulsate = false;
progressBar.Active = false;
break;
case ProgressNotificationState.Active:
Light.Colour = colourActive;
Light.Pulsate = true;
progressBar.Active = true;
break;
case ProgressNotificationState.Cancelled:
Light.Colour = colourCancelled;
Light.Pulsate = false;
progressBar.Active = false;
break;
switch (state)
{
case ProgressNotificationState.Queued:
Light.Colour = colourQueued;
Light.Pulsate = false;
progressBar.Active = false;
break;
case ProgressNotificationState.Active:
Light.Colour = colourActive;
Light.Pulsate = true;
progressBar.Active = true;
break;
case ProgressNotificationState.Cancelled:
Light.Colour = colourCancelled;
Light.Pulsate = false;
progressBar.Active = false;
break;
}
}
if (stateChanged)
{
switch (state)
{
case ProgressNotificationState.Completed:
NotificationContent.MoveToY(-DrawSize.Y / 2, 200, EasingTypes.OutQuint);
FadeTo(0.01f, 200); //don't completely fade out or our scheduled task won't run.
Delay(100);
Schedule(Completed);
break;
}
}
}
}
private ProgressNotificationState state;
public Action Completed;
protected virtual Notification CreateCompletionNotification() => new ProgressCompletionNotification(this)
{
Activated = CompletionClickAction,
Text = $"Task \"{Text}\" has completed!"
};
protected virtual void Completed()
{
Expire();
CompletionTarget?.Invoke(CreateCompletionNotification());
}
public override bool DisplayOnTop => false;
@ -68,30 +109,21 @@ namespace osu.Game.Overlays.Notifications
private Color4 colourActive;
private Color4 colourCancelled;
public ProgressNotification(string text)
{
this.text = text;
}
private SpriteText textDrawable;
[BackgroundDependencyLoader]
private void load(OsuColour colours)
public ProgressNotification()
{
colourQueued = colours.YellowDark;
colourActive = colours.Blue;
colourCancelled = colours.Red;
IconContent.Add(new Box
{
RelativeSizeAxes = Axes.Both,
});
Content.Add(new SpriteText
Content.Add(textDrawable = new SpriteText
{
TextSize = 16,
Colour = OsuColour.Gray(128),
AutoSizeAxes = Axes.Y,
RelativeSizeAxes = Axes.X,
Text = text
});
NotificationContent.Add(progressBar = new ProgressBar
@ -104,21 +136,12 @@ namespace osu.Game.Overlays.Notifications
State = ProgressNotificationState.Queued;
}
public void Complete()
[BackgroundDependencyLoader]
private void load(OsuColour colours)
{
Debug.Assert(state != ProgressNotificationState.Completed);
state = ProgressNotificationState.Completed;
NotificationContent.MoveToY(-DrawSize.Y / 2, 200, EasingTypes.OutQuint);
FadeTo(0.01f, 200); //don't completely fade out or our scheduled task won't run.
Delay(100);
Schedule(() =>
{
CompletionTarget?.Invoke(new ProgressCompletionNotification(this));
base.Close();
});
colourQueued = colours.YellowDark;
colourActive = colours.Blue;
colourCancelled = colours.Red;
}
public override void Close()
@ -135,8 +158,16 @@ namespace osu.Game.Overlays.Notifications
}
}
/// <summary>
/// The function to post completion notifications back to.
/// </summary>
public Action<Notification> CompletionTarget { get; set; }
/// <summary>
/// An action to complete when the completion notification is clicked.
/// </summary>
public Func<bool> CompletionClickAction;
class ProgressBar : Container
{
private Box box;
@ -175,7 +206,7 @@ namespace osu.Game.Overlays.Notifications
{
colourActive = colours.Blue;
Colour = colourInactive = OsuColour.Gray(0.5f);
Height = 5;
Children = new[]

View File

@ -12,14 +12,31 @@ namespace osu.Game.Overlays.Notifications
public class SimpleNotification : Notification
{
private string text;
public SimpleNotification(string text)
public string Text
{
this.text = text;
get { return text; }
set
{
text = value;
textDrawable.Text = text;
}
}
[BackgroundDependencyLoader]
private void load(OsuColour colours)
private FontAwesome icon = FontAwesome.fa_info_circle;
public FontAwesome Icon
{
get { return icon; }
set
{
icon = value;
iconDrawable.Icon = icon;
}
}
private SpriteText textDrawable;
private TextAwesome iconDrawable;
public SimpleNotification()
{
IconContent.Add(new Drawable[]
{
@ -28,14 +45,14 @@ namespace osu.Game.Overlays.Notifications
RelativeSizeAxes = Axes.Both,
ColourInfo = ColourInfo.GradientVertical(OsuColour.Gray(0.2f), OsuColour.Gray(0.5f))
},
new TextAwesome
iconDrawable = new TextAwesome
{
Anchor = Anchor.Centre,
Icon = FontAwesome.fa_info_circle,
Icon = icon ,
}
});
Content.Add(new SpriteText
Content.Add(textDrawable = new SpriteText
{
TextSize = 16,
Colour = OsuColour.Gray(128),
@ -43,7 +60,11 @@ namespace osu.Game.Overlays.Notifications
RelativeSizeAxes = Axes.X,
Text = text
});
}
[BackgroundDependencyLoader]
private void load(OsuColour colours)
{
Light.Colour = colours.Green;
}

View File

@ -71,7 +71,14 @@ namespace osu.Game.Overlays.Options
{
items = value;
if(dropdown != null)
{
dropdown.Items = value;
// We need to refresh the dropdown because our items changed,
// thus its selected value may be outdated.
if (bindable != null)
dropdown.SelectedValue = bindable.Value;
}
}
}
@ -79,7 +86,7 @@ namespace osu.Game.Overlays.Options
{
Items = new KeyValuePair<string, T>[0];
Direction = FlowDirection.VerticalOnly;
Direction = FlowDirections.Vertical;
RelativeSizeAxes = Axes.X;
AutoSizeAxes = Axes.Y;
Children = new Drawable[]

View File

@ -35,7 +35,7 @@ namespace osu.Game.Overlays.Options
public OptionSlider()
{
Direction = FlowDirection.VerticalOnly;
Direction = FlowDirections.Vertical;
RelativeSizeAxes = Axes.X;
AutoSizeAxes = Axes.Y;
Padding = new MarginPadding { Right = 5 };

View File

@ -61,7 +61,7 @@ namespace osu.Game.Overlays.Options
FlowContent = new FlowContainer
{
Margin = new MarginPadding { Top = header_size + header_margin },
Direction = FlowDirection.VerticalOnly,
Direction = FlowDirections.Vertical,
Spacing = new Vector2(0, 30),
AutoSizeAxes = Axes.Y,
RelativeSizeAxes = Axes.X,

View File

@ -21,7 +21,7 @@ namespace osu.Game.Overlays.Options
{
RelativeSizeAxes = Axes.X;
AutoSizeAxes = Axes.Y;
Direction = FlowDirection.VerticalOnly;
Direction = FlowDirections.Vertical;
AddInternal(new Drawable[]
{
new OsuSpriteText
@ -32,7 +32,7 @@ namespace osu.Game.Overlays.Options
},
content = new FlowContainer
{
Direction = FlowDirection.VerticalOnly,
Direction = FlowDirections.Vertical,
RelativeSizeAxes = Axes.X,
AutoSizeAxes = Axes.Y,
Spacing = new Vector2(0, 5),

View File

@ -14,6 +14,7 @@ namespace osu.Game.Overlays.Options.Sections.Audio
protected override string Header => "Devices";
private AudioManager audio;
private OptionDropDown<string> dropdown;
[BackgroundDependencyLoader]
private void load(AudioManager audio)
@ -21,21 +22,45 @@ namespace osu.Game.Overlays.Options.Sections.Audio
this.audio = audio;
}
protected override void Dispose(bool isDisposing)
{
base.Dispose(isDisposing);
audio.OnNewDevice -= onDeviceChanged;
audio.OnLostDevice -= onDeviceChanged;
}
private void updateItems()
{
var deviceItems = new List<KeyValuePair<string, string>>();
deviceItems.Add(new KeyValuePair<string, string>("Default", string.Empty));
deviceItems.AddRange(audio.AudioDeviceNames.Select(d => new KeyValuePair<string, string>(d, d)));
var preferredDeviceName = audio.AudioDevice.Value;
if (!deviceItems.Any(kv => kv.Value == preferredDeviceName))
deviceItems.Add(new KeyValuePair<string, string>(preferredDeviceName, preferredDeviceName));
dropdown.Items = deviceItems;
}
private void onDeviceChanged(string name) => updateItems();
protected override void LoadComplete()
{
base.LoadComplete();
var deviceItems = new List<KeyValuePair<string, string>>();
deviceItems.Add(new KeyValuePair<string, string>("Default", string.Empty));
deviceItems.AddRange(audio.GetDeviceNames().Select(d => new KeyValuePair<string, string>(d, d)));
Children = new Drawable[]
{
new OptionDropDown<string>()
dropdown = new OptionDropDown<string>()
{
Items = deviceItems,
Bindable = audio.AudioDevice
},
};
updateItems();
audio.OnNewDevice += onDeviceChanged;
audio.OnLostDevice += onDeviceChanged;
}
}
}

View File

@ -101,7 +101,7 @@ namespace osu.Game.Overlays.Options.Sections.General
private void load(APIAccess api, OsuConfigManager config)
{
this.api = api;
Direction = FlowDirection.VerticalOnly;
Direction = FlowDirections.Vertical;
AutoSizeAxes = Axes.Y;
RelativeSizeAxes = Axes.X;
Spacing = new Vector2(0, 5);

View File

@ -42,7 +42,7 @@ namespace osu.Game.Overlays.Options
Anchor = Anchor.CentreLeft,
AutoSizeAxes = Axes.Y,
RelativeSizeAxes = Axes.X,
Direction = FlowDirection.VerticalOnly
Direction = FlowDirections.Vertical
}
}
},

View File

@ -82,7 +82,7 @@ namespace osu.Game.Overlays
{
AutoSizeAxes = Axes.Y,
RelativeSizeAxes = Axes.X,
Direction = FlowDirection.VerticalOnly,
Direction = FlowDirections.Vertical,
Children = new Drawable[]
{
@ -103,7 +103,7 @@ namespace osu.Game.Overlays
{
AutoSizeAxes = Axes.Y,
RelativeSizeAxes = Axes.X,
Direction = FlowDirection.VerticalOnly,
Direction = FlowDirections.Vertical,
Children = sections,
}
}
@ -141,7 +141,7 @@ namespace osu.Game.Overlays
foreach (OptionsSection section in sections)
{
float distance = Math.Abs(scrollContainer.GetChildYInContent(section) - currentScroll);
float distance = Math.Abs(scrollContainer.GetChildPosInContent(section) - currentScroll);
if (distance < bestDistance)
{
bestDistance = distance;

View File

@ -104,7 +104,7 @@ namespace osu.Game.Overlays.Pause
{
RelativeSizeAxes = Axes.X,
AutoSizeAxes = Axes.Y,
Direction = FlowDirection.VerticalOnly,
Direction = FlowDirections.Vertical,
Spacing = new Vector2(0f, 50f),
Origin = Anchor.Centre,
Anchor = Anchor.Centre,
@ -113,7 +113,7 @@ namespace osu.Game.Overlays.Pause
new FlowContainer
{
AutoSizeAxes = Axes.Both,
Direction = FlowDirection.VerticalOnly,
Direction = FlowDirections.Vertical,
Spacing = new Vector2(0f, 20f),
Origin = Anchor.TopCentre,
Anchor = Anchor.TopCentre,

View File

@ -43,7 +43,7 @@ namespace osu.Game.Overlays.Toolbar
new ToolbarBackground(),
new FlowContainer
{
Direction = FlowDirection.HorizontalOnly,
Direction = FlowDirections.Horizontal,
RelativeSizeAxes = Axes.Y,
AutoSizeAxes = Axes.X,
Children = new Drawable[]
@ -63,7 +63,7 @@ namespace osu.Game.Overlays.Toolbar
{
Anchor = Anchor.TopRight,
Origin = Anchor.TopRight,
Direction = FlowDirection.HorizontalOnly,
Direction = FlowDirections.Horizontal,
RelativeSizeAxes = Axes.Y,
AutoSizeAxes = Axes.X,
Children = new Drawable[]

View File

@ -84,7 +84,7 @@ namespace osu.Game.Overlays.Toolbar
},
Flow = new FlowContainer
{
Direction = FlowDirection.HorizontalOnly,
Direction = FlowDirections.Horizontal,
Anchor = Anchor.TopCentre,
Origin = Anchor.TopCentre,
Padding = new MarginPadding { Left = Toolbar.HEIGHT / 2, Right = Toolbar.HEIGHT / 2 },
@ -107,7 +107,7 @@ namespace osu.Game.Overlays.Toolbar
},
tooltipContainer = new FlowContainer
{
Direction = FlowDirection.VerticalOnly,
Direction = FlowDirections.Vertical,
RelativeSizeAxes = Axes.Both, //stops us being considered in parent's autosize
Anchor = (TooltipAnchor & Anchor.x0) > 0 ? Anchor.BottomLeft : Anchor.BottomRight,
Origin = TooltipAnchor,

View File

@ -38,7 +38,7 @@ namespace osu.Game.Overlays.Toolbar
{
RelativeSizeAxes = Axes.Y,
AutoSizeAxes = Axes.X,
Direction = FlowDirection.HorizontalOnly,
Direction = FlowDirections.Horizontal,
Anchor = Anchor.TopCentre,
Origin = Anchor.TopCentre,
Padding = new MarginPadding { Left = 10, Right = 10 },

View File

@ -84,7 +84,7 @@ namespace osu.Game.Screens.Backgrounds
[BackgroundDependencyLoader]
private void load()
{
Sprite.Texture = beatmap.Background;
Sprite.Texture = beatmap?.Background;
}
}
}

View File

@ -126,7 +126,7 @@ namespace osu.Game.Screens
},
childModeButtons = new FlowContainer
{
Direction = FlowDirection.VerticalOnly,
Direction = FlowDirections.Vertical,
Anchor = Anchor.TopRight,
Origin = Anchor.TopRight,
RelativeSizeAxes = Axes.Both,

View File

@ -114,7 +114,7 @@ namespace osu.Game.Screens.Menu
new OsuSpriteText
{
Shadow = true,
Direction = FlowDirection.HorizontalOnly,
Direction = FlowDirections.Horizontal,
Anchor = Anchor.Centre,
Origin = Anchor.Centre,
TextSize = 16,

View File

@ -81,7 +81,7 @@ namespace osu.Game.Screens.Menu
},
buttonFlow = new FlowContainerWithOrigin
{
Direction = FlowDirection.HorizontalOnly,
Direction = FlowDirections.Horizontal,
Anchor = Anchor.Centre,
AutoSizeAxes = Axes.Both,
Spacing = new Vector2(-WEDGE_WIDTH, 0),

View File

@ -12,7 +12,7 @@ namespace osu.Game.Screens.Play
{
public KeyCounterCollection()
{
Direction = FlowDirection.HorizontalOnly;
Direction = FlowDirections.Horizontal;
AutoSizeAxes = Axes.Both;
}

View File

@ -74,7 +74,7 @@ namespace osu.Game.Screens.Play
try
{
if (Beatmap == null)
Beatmap = beatmaps.GetWorkingBeatmap(BeatmapInfo);
Beatmap = beatmaps.GetWorkingBeatmap(BeatmapInfo, withStoryboard: true);
}
catch
{

View File

@ -69,7 +69,7 @@ namespace osu.Game.Screens.Ranking
new FlowContainer
{
AutoSizeAxes = Axes.Both,
Direction = FlowDirection.VerticalOnly,
Direction = FlowDirections.Vertical,
Children = new Drawable[]
{
new OsuSpriteText

View File

@ -127,7 +127,7 @@ namespace osu.Game.Screens.Select
{
Anchor = Anchor.BottomLeft,
Origin = Anchor.BottomLeft,
Direction = FlowDirection.VerticalOnly,
Direction = FlowDirections.Vertical,
Margin = new MarginPadding { Top = 10, Left = 25, Right = 10, Bottom = 20 },
AutoSizeAxes = Axes.Both,
Children = new Drawable[]
@ -149,7 +149,7 @@ namespace osu.Game.Screens.Select
new FlowContainer
{
Margin = new MarginPadding { Top = 10 },
Direction = FlowDirection.HorizontalOnly,
Direction = FlowDirections.Horizontal,
AutoSizeAxes = Axes.Both,
Children = new []
{

View File

@ -43,7 +43,7 @@ namespace osu.Game.Screens.Select
Anchor = Anchor.TopRight,
Origin = Anchor.TopRight,
Width = 0.4f, // TODO: InnerWidth property or something
Direction = FlowDirection.VerticalOnly,
Direction = FlowDirections.Vertical,
Children = new Drawable[]
{
searchTextBox = new SearchTextBox { RelativeSizeAxes = Axes.X },
@ -175,7 +175,7 @@ namespace osu.Game.Screens.Select
new FlowContainer
{
AutoSizeAxes = Axes.Both,
Direction = FlowDirection.HorizontalOnly,
Direction = FlowDirections.Horizontal,
Spacing = new Vector2(10, 0),
Children = new Drawable[]
{
@ -207,7 +207,7 @@ namespace osu.Game.Screens.Select
new FlowContainer
{
AutoSizeAxes = Axes.Both,
Direction = FlowDirection.HorizontalOnly,
Direction = FlowDirections.Horizontal,
Spacing = new Vector2(10, 0),
Origin = Anchor.TopRight,
Anchor = Anchor.TopRight,

View File

@ -94,14 +94,14 @@ namespace osu.Game.Screens.Select
Position = new Vector2(BackButton.SIZE_EXTENDED.X + padding, 0),
RelativeSizeAxes = Axes.Y,
AutoSizeAxes = Axes.X,
Direction = FlowDirection.HorizontalOnly,
Direction = FlowDirections.Horizontal,
Spacing = new Vector2(padding, 0),
Children = new Drawable[]
{
buttons = new FlowContainer
{
Direction = FlowDirection.HorizontalOnly,
Direction = FlowDirections.Horizontal,
Spacing = new Vector2(0.2f, 0),
AutoSizeAxes = Axes.Both,
}

View File

@ -23,6 +23,7 @@
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<TreatWarningsAsErrors>false</TreatWarningsAsErrors>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DebugType>pdbonly</DebugType>
@ -31,6 +32,7 @@
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<TreatWarningsAsErrors>false</TreatWarningsAsErrors>
</PropertyGroup>
<ItemGroup>
<Reference Include="Newtonsoft.Json, Version=9.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL">