1
0
mirror of https://github.com/ppy/osu.git synced 2025-01-13 13:32:54 +08:00

Fix merge conflict in osu.Game/osu.Game.csproj

This commit is contained in:
TocoToucan 2016-10-13 18:23:50 +03:00
commit 7d27406131
61 changed files with 2548 additions and 1447 deletions

@ -1 +1 @@
Subproject commit 7439250a63dd451f34dbc08ecf68a196cf8e479f
Subproject commit 30ff0e1a99a10e735611bb3ffa35352061f52d8a

@ -1 +1 @@
Subproject commit 6d9bbe6c838e4b89b69d5ad49b37b434aa62281e
Subproject commit 0505cf0d3b317667dbc95346f57b67fdbcdb4dee

View File

@ -23,7 +23,7 @@ namespace osu.Desktop.Tests
public override string Description => @"Showing hitobjects and what not.";
FramedOffsetClock localClock;
FramedClock localClock;
protected override IFrameBasedClock Clock => localClock;
@ -32,9 +32,7 @@ namespace osu.Desktop.Tests
base.Reset();
//ensure we are at offset 0
if (localClock == null)
localClock = new FramedOffsetClock(base.Clock);
localClock.Offset = -base.Clock.CurrentTime;
localClock = new FramedClock();
List<HitObject> objects = new List<HitObject>();

View File

@ -1,159 +0,0 @@
//Copyright (c) 2007-2016 ppy Pty Ltd <contact@ppy.sh>.
//Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
using System;
using OpenTK.Input;
using osu.Framework.GameModes.Testing;
using osu.Framework.Graphics;
using osu.Game.Graphics.UserInterface;
using osu.Framework.Graphics.UserInterface;
using osu.Framework.Graphics.Transformations;
using OpenTK;
using OpenTK.Graphics;
using osu.Framework.MathUtils;
using osu.Framework.Graphics.Sprites;
namespace osu.Desktop.Tests
{
class TestCaseScoreCounter : TestCase
{
public override string Name => @"ScoreCounter";
public override string Description => @"Tests multiple counters";
public override void Reset()
{
base.Reset();
ScoreCounter uc = new ScoreCounter
{
Origin = Anchor.TopRight,
Anchor = Anchor.TopRight,
TextSize = 40,
RollingDuration = 1000,
RollingEasing = EasingTypes.Out,
Count = 0,
Position = new Vector2(20, 20),
LeadingZeroes = 7,
};
Add(uc);
StandardComboCounter sc = new StandardComboCounter
{
Origin = Anchor.BottomLeft,
Anchor = Anchor.BottomLeft,
Position = new Vector2(20, 20),
IsRollingProportional = true,
RollingDuration = 20,
PopOutDuration = 250,
Count = 0,
TextSize = 40,
};
Add(sc);
CatchComboCounter cc = new CatchComboCounter
{
Origin = Anchor.Centre,
Anchor = Anchor.Centre,
IsRollingProportional = true,
RollingDuration = 20,
PopOutDuration = 250,
Count = 0,
TextSize = 40,
};
Add(cc);
AlternativeComboCounter ac = new AlternativeComboCounter
{
Origin = Anchor.BottomLeft,
Anchor = Anchor.BottomLeft,
Position = new Vector2(20, 80),
IsRollingProportional = true,
RollingDuration = 20,
ScaleFactor = 2,
Count = 0,
TextSize = 40,
};
Add(ac);
AccuracyCounter pc = new AccuracyCounter
{
Origin = Anchor.TopRight,
Anchor = Anchor.TopRight,
RollingDuration = 1000,
RollingEasing = EasingTypes.Out,
Count = 100.0f,
Position = new Vector2(20, 60),
};
Add(pc);
SpriteText text = new SpriteText
{
Origin = Anchor.BottomLeft,
Anchor = Anchor.BottomLeft,
Position = new Vector2(20, 190),
Text = @"- unset -",
};
Add(text);
StarCounter tc = new StarCounter
{
Origin = Anchor.BottomLeft,
Anchor = Anchor.BottomLeft,
Position = new Vector2(20, 160),
};
Add(tc);
AddButton(@"Reset all", delegate
{
uc.Count = 0;
sc.Count = 0;
ac.Count = 0;
cc.Count = 0;
pc.SetCount(0, 0);
tc.Count = 0;
text.Text = tc.Count.ToString("0.00");
});
AddButton(@"Hit! :D", delegate
{
uc.Count += 300 + (ulong)(300.0 * (sc.Count > 0 ? sc.Count - 1 : 0) / 25.0);
sc.Count++;
ac.Count++;
cc.CatchFruit(new Color4(
Math.Max(0.5f, RNG.NextSingle()),
Math.Max(0.5f, RNG.NextSingle()),
Math.Max(0.5f, RNG.NextSingle()),
1)
);
pc.Numerator++;
pc.Denominator++;
});
AddButton(@"miss...", delegate
{
sc.Count = 0;
ac.Count = 0;
cc.Count = 0;
pc.Denominator++;
});
AddButton(@"Alter stars", delegate
{
tc.Count = RNG.NextSingle() * (tc.MaxStars + 1);
text.Text = tc.Count.ToString("0.00");
});
AddButton(@"Stop counters", delegate
{
uc.StopRolling();
sc.StopRolling();
cc.StopRolling();
ac.StopRolling();
pc.StopRolling();
tc.StopRolling();
});
}
}
}

View File

@ -140,7 +140,6 @@
<Compile Include="Program.cs" />
<Compile Include="Tests\TestCaseChatDisplay.cs" />
<Compile Include="Tests\TestCaseGamefield.cs" />
<Compile Include="Tests\TestCaseScoreCounter.cs" />
<Compile Include="Tests\TestCaseKeyCounter.cs" />
<Compile Include="Tests\TestCaseMenuButtonSystem.cs" />
<Compile Include="Tests\TestCaseTextAwesome.cs" />

View File

@ -0,0 +1,57 @@
using System;
using System.IO;
using System.Collections.Generic;
using System.Linq;
using osu.Game.Beatmaps.Formats;
using osu.Game.Beatmaps.IO;
using osu.Game.Beatmaps;
namespace osu.Desktop.Beatmaps.IO
{
/// <summary>
/// Reads an extracted legacy beatmap from disk.
/// </summary>
public class LegacyFilesystemReader : ArchiveReader
{
static LegacyFilesystemReader()
{
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)
throw new FileNotFoundException(@"This directory contains no beatmaps");
using (var stream = new StreamReader(ReadFile(beatmaps[0])))
{
var decoder = BeatmapDecoder.GetDecoder(stream);
firstMap = decoder.Decode(stream);
}
}
public override string[] ReadBeatmaps()
{
return beatmaps;
}
public override Stream ReadFile(string name)
{
return File.OpenRead(Path.Combine(basePath, name));
}
public override BeatmapMetadata ReadMetadata()
{
return firstMap.Metadata;
}
public override void Dispose()
{
// no-op
} }
}

View File

@ -11,10 +11,10 @@ namespace osu.Desktop
public static class Program
{
[STAThread]
public static void Main()
public static void Main(string[] args)
{
BasicGameHost host = Host.GetSuitableHost(@"osu");
host.Add(new OsuGame());
host.Add(new OsuGame(args));
host.Run();
}
}

View File

@ -59,6 +59,7 @@
<CodeAnalysisRuleSet>AllRules.ruleset</CodeAnalysisRuleSet>
<RunCodeAnalysis>false</RunCodeAnalysis>
<Prefer32Bit>false</Prefer32Bit>
<Commandlineparameters></Commandlineparameters>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DebugType>none</DebugType>
@ -135,8 +136,13 @@
</ItemGroup>
<ItemGroup>
<Compile Include="Program.cs" />
<Compile Include="Beatmaps\IO\LegacyFilesystemReader.cs" />
</ItemGroup>
<ItemGroup />
<ItemGroup>
<Folder Include="Beatmaps\" />
<Folder Include="Beatmaps\IO\" />
</ItemGroup>
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Other similar extension points exist, see Microsoft.Common.targets.

View File

@ -0,0 +1,143 @@
using System;
using System.IO;
using NUnit.Framework;
using OpenTK;
using OpenTK.Graphics;
using osu.Game.Beatmaps.Formats;
using osu.Game.Beatmaps.Objects.Osu;
using osu.Game.Beatmaps.Samples;
using osu.Game.GameModes.Play;
using osu.Game.Tests.Resources;
namespace osu.Game.Tests.Beatmaps.Formats
{
[TestFixture]
public class OsuLegacyDecoderTest
{
[TestFixtureSetUp]
public void SetUp()
{
OsuLegacyDecoder.Register();
}
[Test]
public void TestDecodeMetadata()
{
var decoder = new OsuLegacyDecoder();
using (var stream = Resource.OpenResource("Soleily - Renatus (Gamu) [Insane].osu"))
{
var beatmap = decoder.Decode(new StreamReader(stream));
var meta = beatmap.Metadata;
Assert.AreEqual(241526, meta.BeatmapSetID);
Assert.AreEqual("Soleily", meta.Artist);
Assert.AreEqual("Soleily", meta.ArtistUnicode);
Assert.AreEqual("03. Renatus - Soleily 192kbps.mp3", meta.AudioFile);
Assert.AreEqual("Gamu", meta.Author);
Assert.AreEqual("machinetop_background.jpg", meta.BackgroundFile);
Assert.AreEqual(164471, meta.PreviewTime);
Assert.AreEqual(string.Empty, meta.Source);
Assert.AreEqual("MBC7 Unisphere 地球ヤバイEP Chikyu Yabai", meta.Tags);
Assert.AreEqual("Renatus", meta.Title);
Assert.AreEqual("Renatus", meta.TitleUnicode);
}
}
[Test]
public void TestDecodeGeneral()
{
var decoder = new OsuLegacyDecoder();
using (var stream = Resource.OpenResource("Soleily - Renatus (Gamu) [Insane].osu"))
{
var beatmap = decoder.Decode(new StreamReader(stream));
Assert.AreEqual(0, beatmap.AudioLeadIn);
Assert.AreEqual(false, beatmap.Countdown);
Assert.AreEqual(SampleSet.Soft, beatmap.SampleSet);
Assert.AreEqual(0.7f, beatmap.StackLeniency);
Assert.AreEqual(false, beatmap.SpecialStyle);
Assert.AreEqual(PlayMode.Osu, beatmap.Mode);
Assert.AreEqual(false, beatmap.LetterboxInBreaks);
Assert.AreEqual(false, beatmap.WidescreenStoryboard);
}
}
[Test]
public void TestDecodeEditor()
{
var decoder = new OsuLegacyDecoder();
using (var stream = Resource.OpenResource("Soleily - Renatus (Gamu) [Insane].osu"))
{
var beatmap = decoder.Decode(new StreamReader(stream));
int[] expectedBookmarks =
{
11505, 22054, 32604, 43153, 53703, 64252, 74802, 85351,
95901, 106450, 116999, 119637, 130186, 140735, 151285,
161834, 164471, 175020, 185570, 196119, 206669, 209306
};
Assert.AreEqual(expectedBookmarks.Length, beatmap.Bookmarks.Length);
for (int i = 0; i < expectedBookmarks.Length; i++)
Assert.AreEqual(expectedBookmarks[i], beatmap.Bookmarks[i]);
Assert.AreEqual(1.8, beatmap.DistanceSpacing);
Assert.AreEqual(4, beatmap.BeatDivisor);
Assert.AreEqual(4, beatmap.GridSize);
Assert.AreEqual(2, beatmap.TimelineZoom);
}
}
[Test]
public void TestDecodeDifficulty()
{
var decoder = new OsuLegacyDecoder();
using (var stream = Resource.OpenResource("Soleily - Renatus (Gamu) [Insane].osu"))
{
var beatmap = decoder.Decode(new StreamReader(stream));
var difficulty = beatmap.BaseDifficulty;
Assert.AreEqual(6.5f, difficulty.DrainRate);
Assert.AreEqual(4, difficulty.CircleSize);
Assert.AreEqual(8, difficulty.OverallDifficulty);
Assert.AreEqual(9, difficulty.ApproachRate);
Assert.AreEqual(1.8f, difficulty.SliderMultiplier);
Assert.AreEqual(2, difficulty.SliderTickRate);
}
}
[Test]
public void TestDecodeColors()
{
var decoder = new OsuLegacyDecoder();
using (var stream = Resource.OpenResource("Soleily - Renatus (Gamu) [Insane].osu"))
{
var beatmap = decoder.Decode(new StreamReader(stream));
Color4[] expected =
{
new Color4(142, 199, 255, 255),
new Color4(255, 128, 128, 255),
new Color4(128, 255, 255, 255),
new Color4(128, 255, 128, 255),
new Color4(255, 187, 255, 255),
new Color4(255, 177, 140, 255),
};
Assert.AreEqual(expected.Length, beatmap.ComboColors.Count);
for (int i = 0; i < expected.Length; i++)
Assert.AreEqual(expected[i], beatmap.ComboColors[i]);
}
}
[Test] public void TestDecodeHitObjects()
{
var decoder = new OsuLegacyDecoder();
using (var stream = Resource.OpenResource("Soleily - Renatus (Gamu) [Insane].osu"))
{
var beatmap = decoder.Decode(new StreamReader(stream));
var slider = beatmap.HitObjects[0] as Slider;
Assert.IsNotNull(slider);
Assert.AreEqual(new Vector2(192, 168), slider.Position);
Assert.AreEqual(956, slider.StartTime);
Assert.AreEqual(SampleType.None, slider.Sample.Type);
var circle = beatmap.HitObjects[1] as Circle;
Assert.IsNotNull(circle);
Assert.AreEqual(new Vector2(304, 56), circle.Position);
Assert.AreEqual(1285, circle.StartTime);
Assert.AreEqual(SampleType.Clap, circle.Sample.Type);
}
}
}
}

View File

@ -0,0 +1,81 @@
using System;
using System.IO;
using NUnit.Framework;
using osu.Game.Beatmaps.IO;
using osu.Game.GameModes.Play;
using osu.Game.Tests.Resources;
namespace osu.Game.Tests.Beatmaps.IO
{
[TestFixture]
public class OszArchiveReaderTest
{
[TestFixtureSetUp]
public void SetUp()
{
OszArchiveReader.Register();
}
[Test]
public void TestReadBeatmaps()
{
using (var osz = Resource.OpenResource("Beatmaps.241526 Soleily - Renatus.osz"))
{
var reader = new OszArchiveReader(osz);
string[] expected =
{
"Soleily - Renatus (Deif) [Platter].osu",
"Soleily - Renatus (Deif) [Rain].osu",
"Soleily - Renatus (Deif) [Salad].osu",
"Soleily - Renatus (ExPew) [Another].osu",
"Soleily - Renatus (ExPew) [Hyper].osu",
"Soleily - Renatus (ExPew) [Normal].osu",
"Soleily - Renatus (Gamu) [Hard].osu",
"Soleily - Renatus (Gamu) [Insane].osu",
"Soleily - Renatus (Gamu) [Normal].osu",
"Soleily - Renatus (MMzz) [Futsuu].osu",
"Soleily - Renatus (MMzz) [Muzukashii].osu",
"Soleily - Renatus (MMzz) [Oni].osu"
};
var maps = reader.ReadBeatmaps();
foreach (var map in expected)
Assert.Contains(map, maps);
}
}
[Test]
public void TestReadMetadata()
{
using (var osz = Resource.OpenResource("Beatmaps.241526 Soleily - Renatus.osz"))
{
var reader = new OszArchiveReader(osz);
var meta = reader.ReadMetadata();
Assert.AreEqual(241526, meta.BeatmapSetID);
Assert.AreEqual("Soleily", meta.Artist);
Assert.AreEqual("Soleily", meta.ArtistUnicode);
Assert.AreEqual("03. Renatus - Soleily 192kbps.mp3", meta.AudioFile);
Assert.AreEqual("Deif", meta.Author);
Assert.AreEqual("machinetop_background.jpg", meta.BackgroundFile);
Assert.AreEqual(164471, meta.PreviewTime);
Assert.AreEqual(string.Empty, meta.Source);
Assert.AreEqual("MBC7 Unisphere 地球ヤバイEP Chikyu Yabai", meta.Tags);
Assert.AreEqual("Renatus", meta.Title);
Assert.AreEqual("Renatus", meta.TitleUnicode);
}
}
[Test]
public void TestReadFile()
{
using (var osz = Resource.OpenResource("Beatmaps.241526 Soleily - Renatus.osz"))
{
var reader = new OszArchiveReader(osz);
using (var stream = new StreamReader(
reader.ReadFile("Soleily - Renatus (Deif) [Platter].osu")))
{
Assert.AreEqual("osu file format v13", stream.ReadLine().Trim());
}
}
}
}
}

View File

@ -0,0 +1,25 @@
<configuration>
<dllmap os="linux" dll="opengl32.dll" target="libGL.so.1"/>
<dllmap os="linux" dll="glu32.dll" target="libGLU.so.1"/>
<dllmap os="linux" dll="openal32.dll" target="libopenal.so.1"/>
<dllmap os="linux" dll="alut.dll" target="libalut.so.0"/>
<dllmap os="linux" dll="opencl.dll" target="libOpenCL.so"/>
<dllmap os="linux" dll="libX11" target="libX11.so.6"/>
<dllmap os="linux" dll="libXi" target="libXi.so.6"/>
<dllmap os="linux" dll="SDL2.dll" target="libSDL2-2.0.so.0"/>
<dllmap os="osx" dll="opengl32.dll" target="/System/Library/Frameworks/OpenGL.framework/OpenGL"/>
<dllmap os="osx" dll="openal32.dll" target="/System/Library/Frameworks/OpenAL.framework/OpenAL" />
<dllmap os="osx" dll="alut.dll" target="/System/Library/Frameworks/OpenAL.framework/OpenAL" />
<dllmap os="osx" dll="libGLES.dll" target="/System/Library/Frameworks/OpenGLES.framework/OpenGLES" />
<dllmap os="osx" dll="libGLESv1_CM.dll" target="/System/Library/Frameworks/OpenGLES.framework/OpenGLES" />
<dllmap os="osx" dll="libGLESv2.dll" target="/System/Library/Frameworks/OpenGLES.framework/OpenGLES" />
<dllmap os="osx" dll="opencl.dll" target="/System/Library/Frameworks/OpenCL.framework/OpenCL"/>
<dllmap os="osx" dll="SDL2.dll" target="libSDL2.dylib"/>
<!-- XQuartz compatibility (X11 on Mac) -->
<dllmap os="osx" dll="libGL.so.1" target="/usr/X11/lib/libGL.dylib"/>
<dllmap os="osx" dll="libX11" target="/usr/X11/lib/libX11.dylib"/>
<dllmap os="osx" dll="libXcursor.so.1" target="/usr/X11/lib/libXcursor.dylib"/>
<dllmap os="osx" dll="libXi" target="/usr/X11/lib/libXi.dylib"/>
<dllmap os="osx" dll="libXinerama" target="/usr/X11/lib/libXinerama.dylib"/>
<dllmap os="osx" dll="libXrandr.so.2" target="/usr/X11/lib/libXrandr.dylib"/>
</configuration>

View File

@ -0,0 +1,17 @@
using System;
using System.IO;
using System.Reflection;
namespace osu.Game.Tests.Resources
{
public static class Resource
{
public static Stream OpenResource(string name)
{
return Assembly.GetExecutingAssembly().GetManifestResourceStream(
$@"osu.Game.Tests.Resources.{name}") ??
Assembly.LoadFrom("osu.Game.Resources.dll").GetManifestResourceStream(
$@"osu.Game.Resources.{name}");
}
}
}

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,69 @@
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProjectGuid>{54377672-20B1-40AF-8087-5CF73BF3953A}</ProjectGuid>
<OutputType>Library</OutputType>
<RootNamespace>osu.Game.Tests</RootNamespace>
<AssemblyName>osu.Game.Tests</AssemblyName>
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\Debug</OutputPath>
<DefineConstants>DEBUG;</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<ConsolePause>false</ConsolePause>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<Optimize>true</Optimize>
<OutputPath>bin\Release</OutputPath>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<ConsolePause>false</ConsolePause>
</PropertyGroup>
<ItemGroup>
<Reference Include="System" />
<Reference Include="nunit.framework">
<HintPath>$(SolutionDir)\packages\NUnit.2.6.4\lib\nunit.framework.dll</HintPath>
</Reference>
<Reference Include="OpenTK">
<HintPath>$(SolutionDir)\packages\ppy.OpenTK.1.1.2225.3\lib\net20\OpenTK.dll</HintPath>
</Reference>
<Reference Include="System.Drawing" />
<Reference Include="System.Xml" />
</ItemGroup>
<ItemGroup>
<None Include="packages.config" />
<None Include="OpenTK.dll.config" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\osu.Game\osu.Game.csproj">
<Project>{0D3FBF8A-7464-4CF7-8C90-3E7886DF2D4D}</Project>
<Name>osu.Game</Name>
</ProjectReference>
<ProjectReference Include="..\osu-resources\osu.Game.Resources\osu.Game.Resources.csproj">
<Project>{D9A367C9-4C1A-489F-9B05-A0CEA2B53B58}</Project>
<Name>osu.Game.Resources</Name>
</ProjectReference>
</ItemGroup>
<ItemGroup>
<Folder Include="Resources\" />
<Folder Include="Beatmaps\" />
<Folder Include="Beatmaps\IO\" />
<Folder Include="Beatmaps\Formats\" />
</ItemGroup>
<ItemGroup>
<Compile Include="Beatmaps\IO\OszArchiveReaderTest.cs" />
<Compile Include="Resources\Resource.cs" />
<Compile Include="Beatmaps\Formats\OsuLegacyDecoderTest.cs" />
</ItemGroup>
<ItemGroup>
<EmbeddedResource Include="Resources\Soleily - Renatus %28Gamu%29 [Insane].osu" />
</ItemGroup>
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
</Project>

View File

@ -0,0 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="NUnit" version="2.6.4" targetFramework="net45" />
<package id="ppy.OpenTK" version="1.1.2225.3" targetFramework="net45" />
</packages>

View File

@ -0,0 +1,18 @@
using System;
using SQLite;
namespace osu.Game.Beatmaps
{
public class BaseDifficulty
{
[PrimaryKey, AutoIncrement]
public int ID { get; set; }
public float DrainRate { get; set; }
public float CircleSize { get; set; }
public float OverallDifficulty { get; set; }
public float ApproachRate { get; set; }
public float SliderMultiplier { get; set; }
public float SliderTickRate { get; set; }
}
}

View File

@ -2,19 +2,68 @@
//Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
using System.Collections.Generic;
using System.Linq;
using OpenTK.Graphics;
using osu.Game.Beatmaps.Objects;
using osu.Game.Beatmaps.Samples;
using osu.Game.Beatmaps.Timing;
using osu.Game.GameModes.Play;
using osu.Game.Users;
using SQLite;
namespace osu.Game.Beatmaps
{
public class Beatmap
{
public List<HitObject> HitObjects;
public List<ControlPoint> ControlPoints;
public string Difficulty;
public User Creator;
[PrimaryKey]
public int BeatmapID { get; set; }
[NotNull, Indexed]
public int BeatmapSetID { get; set; }
[Indexed]
public int BeatmapMetadataID { get; set; }
public int BaseDifficultyID { get; set; }
[Ignore]
public List<HitObject> HitObjects { get; set; }
[Ignore]
public List<ControlPoint> ControlPoints { get; set; }
[Ignore]
public BeatmapMetadata Metadata { get; set; }
[Ignore]
public BaseDifficulty BaseDifficulty { get; set; }
[Ignore]
public List<Color4> ComboColors { get; set; }
// General
public int AudioLeadIn { get; set; }
public bool Countdown { get; set; }
public SampleSet SampleSet { get; set; }
public float StackLeniency { get; set; }
public bool SpecialStyle { get; set; }
public PlayMode Mode { get; set; }
public bool LetterboxInBreaks { get; set; }
public bool WidescreenStoryboard { get; set; }
// Editor
// This bookmarks stuff is necessary because DB doesn't know how to store int[]
public string StoredBookmarks { get; internal set; }
[Ignore]
public int[] Bookmarks
{
get
{
return StoredBookmarks.Split(',').Select(b => int.Parse(b)).ToArray();
}
set
{
StoredBookmarks = string.Join(",", value);
}
}
public double DistanceSpacing { get; set; }
public int BeatDivisor { get; set; }
public int GridSize { get; set; }
public double TimelineZoom { get; set; }
// Metadata
public string Version { get; set; }
}
}

View File

@ -0,0 +1,26 @@
//Copyright (c) 2007-2016 ppy Pty Ltd <contact@ppy.sh>.
//Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
using osu.Game.GameModes.Play;
using SQLite;
namespace osu.Game.Beatmaps
{
public class BeatmapMetadata
{
[PrimaryKey]
public int ID { get; set; }
public int BeatmapSetID { get; set; }
public string Title { get; set; }
public string TitleUnicode { get; set; }
public string Artist { get; set; }
public string ArtistUnicode { get; set; }
public string Author { get; set; }
public string Source { get; set; }
public string Tags { get; set; }
public int PreviewTime { get; set; }
public string AudioFile { get; set; }
public string BackgroundFile { get; set; }
}
}

View File

@ -3,6 +3,7 @@
using System.Collections.Generic;
using osu.Game.Users;
using SQLite;
namespace osu.Game.Beatmaps
{
@ -11,10 +12,15 @@ namespace osu.Game.Beatmaps
/// </summary>
public class BeatmapSet
{
[PrimaryKey]
public int BeatmapSetID { get; set; }
[NotNull, Indexed]
public int BeatmapMetadataID { get; set; }
[Ignore]
public List<Beatmap> Beatmaps { get; protected set; }
public Metadata Metadata;
public User Creator;
[Ignore]
public BeatmapMetadata Metadata { get; set; }
[Ignore]
public User Creator { get; set; }
}
}

View File

@ -0,0 +1,14 @@
using System;
namespace osu.Game.Beatmaps.Events
{
public enum EventType
{
Background = 0,
Video = 1,
Break = 2,
Colour = 3,
Sprite = 4,
Sample = 5,
Animation = 6
}
}

View File

@ -0,0 +1,25 @@
using System;
using System.Collections.Generic;
using System.IO;
namespace osu.Game.Beatmaps.Formats
{
public abstract class BeatmapDecoder
{
private static Dictionary<string, Type> decoders { get; } = new Dictionary<string, Type>();
public static BeatmapDecoder GetDecoder(TextReader stream)
{
var line = stream.ReadLine().Trim();
if (!decoders.ContainsKey(line))
throw new IOException(@"Unknown file format");
return (BeatmapDecoder)Activator.CreateInstance(decoders[line]);
}
protected static void AddDecoder<T>(string magic) where T : BeatmapDecoder
{
decoders[magic] = typeof(T);
}
public abstract Beatmap Decode(TextReader stream);
}
}

View File

@ -0,0 +1,272 @@
using System;
using System.Collections.Generic;
using System.Globalization;
using System.IO;
using OpenTK.Graphics;
using osu.Game.Beatmaps.Events;
using osu.Game.Beatmaps.Objects;
using osu.Game.Beatmaps.Samples;
using osu.Game.Beatmaps.Timing;
using osu.Game.GameModes.Play;
namespace osu.Game.Beatmaps.Formats
{
public class OsuLegacyDecoder : BeatmapDecoder
{
public static void Register()
{
AddDecoder<OsuLegacyDecoder>(@"osu file format v14");
AddDecoder<OsuLegacyDecoder>(@"osu file format v13");
AddDecoder<OsuLegacyDecoder>(@"osu file format v12");
AddDecoder<OsuLegacyDecoder>(@"osu file format v11");
AddDecoder<OsuLegacyDecoder>(@"osu file format v10");
// TODO: Not sure how far back to go, or differences between versions
}
private enum Section
{
None,
General,
Editor,
Metadata,
Difficulty,
Events,
TimingPoints,
Colours,
HitObjects,
}
private void handleGeneral(Beatmap beatmap, string key, string val)
{
switch (key)
{
case @"AudioFilename":
beatmap.Metadata.AudioFile = val;
break;
case @"AudioLeadIn":
beatmap.AudioLeadIn = int.Parse(val);
break;
case @"PreviewTime":
beatmap.Metadata.PreviewTime = int.Parse(val);
break;
case @"Countdown":
beatmap.Countdown = int.Parse(val) == 1;
break;
case @"SampleSet":
beatmap.SampleSet = (SampleSet)Enum.Parse(typeof(SampleSet), val);
break;
case @"StackLeniency":
beatmap.StackLeniency = float.Parse(val, NumberFormatInfo.InvariantInfo);
break;
case @"Mode":
beatmap.Mode = (PlayMode)int.Parse(val);
break;
case @"LetterboxInBreaks":
beatmap.LetterboxInBreaks = int.Parse(val) == 1;
break;
case @"SpecialStyle":
beatmap.SpecialStyle = int.Parse(val) == 1;
break;
case @"WidescreenStoryboard":
beatmap.WidescreenStoryboard = int.Parse(val) == 1;
break;
}
}
private void handleEditor(Beatmap beatmap, string key, string val)
{
switch (key)
{
case @"Bookmarks":
beatmap.StoredBookmarks = val;
break;
case @"DistanceSpacing":
beatmap.DistanceSpacing = double.Parse(val, NumberFormatInfo.InvariantInfo);
break;
case @"BeatDivisor":
beatmap.BeatDivisor = int.Parse(val);
break;
case @"GridSize":
beatmap.GridSize = int.Parse(val);
break;
case @"TimelineZoom":
beatmap.TimelineZoom = double.Parse(val, NumberFormatInfo.InvariantInfo);
break;
}
}
private void handleMetadata(Beatmap beatmap, string key, string val)
{
switch (key)
{
case @"Title":
beatmap.Metadata.Title = val;
break;
case @"TitleUnicode":
beatmap.Metadata.TitleUnicode = val;
break;
case @"Artist":
beatmap.Metadata.Artist = val;
break;
case @"ArtistUnicode":
beatmap.Metadata.ArtistUnicode = val;
break;
case @"Creator":
beatmap.Metadata.Author = val;
break;
case @"Version":
beatmap.Version = val;
break;
case @"Source":
beatmap.Metadata.Source = val;
break;
case @"Tags":
beatmap.Metadata.Tags = val;
break;
case @"BeatmapID":
beatmap.BeatmapID = int.Parse(val);
break;
case @"BeatmapSetID":
beatmap.BeatmapSetID = int.Parse(val);
beatmap.Metadata.BeatmapSetID = int.Parse(val);
break;
}
}
private void handleDifficulty(Beatmap beatmap, string key, string val)
{
switch (key)
{
case @"HPDrainRate":
beatmap.BaseDifficulty.DrainRate = float.Parse(val, NumberFormatInfo.InvariantInfo);
break;
case @"CircleSize":
beatmap.BaseDifficulty.CircleSize = float.Parse(val, NumberFormatInfo.InvariantInfo);
break;
case @"OverallDifficulty":
beatmap.BaseDifficulty.OverallDifficulty = float.Parse(val, NumberFormatInfo.InvariantInfo);
break;
case @"ApproachRate":
beatmap.BaseDifficulty.ApproachRate = float.Parse(val, NumberFormatInfo.InvariantInfo);
break;
case @"SliderMultiplier":
beatmap.BaseDifficulty.SliderMultiplier = float.Parse(val, NumberFormatInfo.InvariantInfo);
break;
case @"SliderTickRate":
beatmap.BaseDifficulty.SliderTickRate = float.Parse(val, NumberFormatInfo.InvariantInfo);
break;
}
}
private void handleEvents(Beatmap beatmap, string val)
{
if (val.StartsWith(@"//"))
return;
if (val.StartsWith(@" "))
return; // TODO
string[] split = val.Split(',');
EventType type;
int _type;
if (!int.TryParse(split[0], out _type))
{
if (!Enum.TryParse(split[0], out type))
throw new InvalidDataException($@"Unknown event type {split[0]}");
}
else
type = (EventType)_type;
// TODO: Parse and store the rest of the event
if (type == EventType.Background)
beatmap.Metadata.BackgroundFile = split[2].Trim('"');
}
private void handleTimingPoints(Beatmap beatmap, string val)
{
// TODO
}
private void handleColours(Beatmap beatmap, string key, string val)
{
string[] split = val.Split(',');
if (split.Length != 3)
throw new InvalidOperationException($@"Color specified in incorrect format (should be R,G,B): {val}");
byte r, g, b;
if (!byte.TryParse(split[0], out r) || !byte.TryParse(split[1], out g) || !byte.TryParse(split[2], out b))
throw new InvalidOperationException($@"Color must be specified with 8-bit integer components");
// Note: the combo index specified in the beatmap is discarded
beatmap.ComboColors.Add(new Color4
{
R = r / 255f,
G = g / 255f,
B = b / 255f,
A = 1f,
});
}
public override Beatmap Decode(TextReader stream)
{
var beatmap = new Beatmap
{
Metadata = new BeatmapMetadata(),
BaseDifficulty = new BaseDifficulty(),
HitObjects = new List<HitObject>(),
ControlPoints = new List<ControlPoint>(),
ComboColors = new List<Color4>(),
};
var section = Section.None;
string line;
while (true)
{
line = stream.ReadLine();
if (line == null)
break;
line = line.Trim();
if (string.IsNullOrEmpty(line))
continue;
if (line.StartsWith(@"osu file format v"))
continue;
if (line.StartsWith(@"[") && line.EndsWith(@"]"))
{
if (!Enum.TryParse(line.Substring(1, line.Length - 2), out section))
throw new InvalidDataException($@"Unknown osu section {line}");
continue;
}
string val = line, key = null;
if (section != Section.Events && section != Section.TimingPoints && section != Section.HitObjects)
{
key = val.Remove(val.IndexOf(':')).Trim();
val = val.Substring(val.IndexOf(':') + 1).Trim();
}
switch (section)
{
case Section.General:
handleGeneral(beatmap, key, val);
break;
case Section.Editor:
handleEditor(beatmap, key, val);
break;
case Section.Metadata:
handleMetadata(beatmap, key, val);
break;
case Section.Difficulty:
handleDifficulty(beatmap, key, val);
break;
case Section.Events:
handleEvents(beatmap, val);
break;
case Section.TimingPoints:
handleTimingPoints(beatmap, val);
break;
case Section.Colours:
handleColours(beatmap, key, val);
break;
case Section.HitObjects:
beatmap.HitObjects.Add(HitObject.Parse(beatmap.Mode, val));
break;
}
}
return beatmap;
}
}
}

View File

@ -0,0 +1,48 @@
using System;
using System.Collections.Generic;
using System.IO;
using osu.Framework.Platform;
namespace osu.Game.Beatmaps.IO
{
public abstract class ArchiveReader : IDisposable
{
private class Reader
{
public Func<BasicStorage, string, bool> Test { get; set; }
public Type Type { get; set; }
}
private static List<Reader> readers { get; } = new List<Reader>();
public static ArchiveReader GetReader(BasicStorage storage, string path)
{
foreach (var reader in readers)
{
if (reader.Test(storage, path))
return (ArchiveReader)Activator.CreateInstance(reader.Type, storage.GetStream(path));
}
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();
/// <summary>
/// Opens a stream for reading a specific file from this archive.
/// </summary>
public abstract Stream ReadFile(string name);
public abstract void Dispose();
}
}

View File

@ -0,0 +1,61 @@
using System;
using System.IO;
using System.Linq;
using Ionic.Zip;
using osu.Game.Beatmaps.Formats;
namespace osu.Game.Beatmaps.IO
{
public sealed class OszArchiveReader : ArchiveReader
{
public static void Register()
{
AddReader<OszArchiveReader>((storage, path) =>
{
using (var stream = storage.GetStream(path))
return ZipFile.IsZipFile(stream, false);
});
OsuLegacyDecoder.Register();
}
private ZipFile archive { get; set; }
private string[] beatmaps { get; set; }
private Beatmap firstMap { get; set; }
public OszArchiveReader(Stream archiveStream)
{
archive = ZipFile.Read(archiveStream);
beatmaps = archive.Entries.Where(e => e.FileName.EndsWith(@".osu"))
.Select(e => e.FileName).ToArray();
if (beatmaps.Length == 0)
throw new FileNotFoundException(@"This directory contains no beatmaps");
using (var stream = new StreamReader(ReadFile(beatmaps[0])))
{
var decoder = BeatmapDecoder.GetDecoder(stream);
firstMap = decoder.Decode(stream);
}
}
public override string[] ReadBeatmaps()
{
return beatmaps;
}
public override Stream ReadFile(string name)
{
ZipEntry entry = archive.Entries.SingleOrDefault(e => e.FileName == name);
if (entry == null)
throw new FileNotFoundException();
return entry.OpenReader();
}
public override BeatmapMetadata ReadMetadata()
{
return firstMap.Metadata;
}
public override void Dispose()
{
archive.Dispose();
}
}
}

View File

@ -1,11 +0,0 @@
//Copyright (c) 2007-2016 ppy Pty Ltd <contact@ppy.sh>.
//Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
namespace osu.Game.Beatmaps
{
public class Metadata
{
public string Artist;
public string Title;
}
}

View File

@ -0,0 +1,43 @@
//Copyright (c) 2007-2016 ppy Pty Ltd <contact@ppy.sh>.
//Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using osu.Game.Beatmaps.Objects.Catch;
using osu.Game.Beatmaps.Objects.Osu;
namespace osu.Game.Beatmaps.Objects.Catch
{
class CatchConverter : HitObjectConverter<CatchBaseHit>
{
public override List<CatchBaseHit> Convert(List<HitObject> input)
{
List<CatchBaseHit> output = new List<CatchBaseHit>();
foreach (HitObject i in input)
{
CatchBaseHit h = i as CatchBaseHit;
if (h == null)
{
OsuBaseHit o = i as OsuBaseHit;
if (o == null) throw new Exception(@"Can't convert!");
h = new Fruit
{
StartTime = o.StartTime,
Position = o.Position.X,
};
}
output.Add(h);
}
return output;
}
}
}

View File

@ -0,0 +1,42 @@
//Copyright (c) 2007-2016 ppy Pty Ltd <contact@ppy.sh>.
//Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using osu.Framework;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Sprites;
using osu.Framework.Graphics.Transformations;
using OpenTK;
namespace osu.Game.Beatmaps.Objects.Catch.Drawable
{
class DrawableFruit : Sprite
{
private CatchBaseHit h;
public DrawableFruit(CatchBaseHit h)
{
this.h = h;
Origin = Anchor.Centre;
Scale = new Vector2(0.1f);
RelativePositionAxes = Axes.Y;
Position = new Vector2(h.Position, -0.1f);
}
public override void Load(BaseGame game)
{
base.Load(game);
Texture = game.Textures.Get(@"Menu/logo");
Transforms.Add(new TransformPosition(Clock) { StartTime = h.StartTime - 200, EndTime = h.StartTime, StartValue = new Vector2(h.Position, -0.1f), EndValue = new Vector2(h.Position, 0.9f) });
Transforms.Add(new TransformAlpha(Clock) { StartTime = h.StartTime + h.Duration + 200, EndTime = h.StartTime + h.Duration + 400, StartValue = 1, EndValue = 0 });
Expire(true);
}
}
}

View File

@ -1,7 +1,9 @@
//Copyright (c) 2007-2016 ppy Pty Ltd <contact@ppy.sh>.
//Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
using osu.Game.Beatmaps.Objects.Osu;
using osu.Game.Beatmaps.Samples;
using osu.Game.GameModes.Play;
namespace osu.Game.Beatmaps.Objects
{
@ -16,5 +18,17 @@ namespace osu.Game.Beatmaps.Objects
public double Duration => (EndTime ?? StartTime) - StartTime;
public HitSampleInfo Sample;
public static HitObject Parse(PlayMode mode, string val)
{
//TODO: move to modular HitObjectParser system rather than static parsing. (https://github.com/ppy/osu/pull/60/files#r83135780)
switch (mode)
{
case PlayMode.Osu:
return OsuBaseHit.Parse(val);
default:
return null;
}
}
}
}

View File

@ -0,0 +1,13 @@
//Copyright (c) 2007-2016 ppy Pty Ltd <contact@ppy.sh>.
//Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
using System.Collections.Generic;
namespace osu.Game.Beatmaps.Objects
{
public abstract class HitObjectConverter<T>
where T : HitObject
{
public abstract List<T> Convert(List<HitObject> input);
}
}

View File

@ -0,0 +1,33 @@
//Copyright (c) 2007-2016 ppy Pty Ltd <contact@ppy.sh>.
//Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
using osu.Framework;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Sprites;
using osu.Framework.Graphics.Transformations;
using OpenTK;
namespace osu.Game.Beatmaps.Objects.Mania.Drawable
{
public class DrawableNote : Sprite
{
private readonly ManiaBaseHit note;
public DrawableNote(ManiaBaseHit note)
{
this.note = note;
Origin = Anchor.Centre;
Scale = new Vector2(0.1f);
}
public override void Load(BaseGame game)
{
base.Load(game);
Texture = game.Textures.Get(@"Menu/logo");
Transforms.Add(new TransformPositionY(Clock) { StartTime = note.StartTime - 200, EndTime = note.StartTime, StartValue = -0.1f, EndValue = 0.9f });
Transforms.Add(new TransformAlpha(Clock) { StartTime = note.StartTime + note.Duration + 200, EndTime = note.StartTime + note.Duration + 400, StartValue = 1, EndValue = 0 });
Expire(true);
}
}
}

View File

@ -0,0 +1,46 @@
//Copyright (c) 2007-2016 ppy Pty Ltd <contact@ppy.sh>.
//Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
using System;
using System.Collections.Generic;
using osu.Game.Beatmaps.Objects.Osu;
namespace osu.Game.Beatmaps.Objects.Mania
{
class ManiaConverter : HitObjectConverter<ManiaBaseHit>
{
private readonly int columns;
public ManiaConverter(int columns)
{
this.columns = columns;
}
public override List<ManiaBaseHit> Convert(List<HitObject> input)
{
List<ManiaBaseHit> output = new List<ManiaBaseHit>();
foreach (HitObject i in input)
{
ManiaBaseHit h = i as ManiaBaseHit;
if (h == null)
{
OsuBaseHit o = i as OsuBaseHit;
if (o == null) throw new Exception(@"Can't convert!");
h = new Note
{
StartTime = o.StartTime,
Column = (int)Math.Round(o.Position.X / 512 * columns)
};
}
output.Add(h);
}
return output;
}
}
}

View File

@ -0,0 +1,42 @@
//Copyright (c) 2007-2016 ppy Pty Ltd <contact@ppy.sh>.
//Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using osu.Framework;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Sprites;
using osu.Framework.Graphics.Transformations;
using OpenTK;
namespace osu.Game.Beatmaps.Objects.Osu.Drawable
{
class DrawableCircle : Sprite
{
private OsuBaseHit h;
public DrawableCircle(OsuBaseHit h)
{
this.h = h;
Origin = Anchor.Centre;
Scale = new Vector2(0.1f);
Alpha = 0;
Position = h.Position;
}
public override void Load(BaseGame game)
{
base.Load(game);
Texture = game.Textures.Get(@"Menu/logo");
Transforms.Add(new TransformAlpha(Clock) { StartTime = h.StartTime - 200, EndTime = h.StartTime, StartValue = 0, EndValue = 1 });
Transforms.Add(new TransformAlpha(Clock) { StartTime = h.StartTime + h.Duration + 200, EndTime = h.StartTime + h.Duration + 400, StartValue = 1, EndValue = 0 });
Expire(true);
}
}
}

View File

@ -1,12 +1,59 @@
//Copyright (c) 2007-2016 ppy Pty Ltd <contact@ppy.sh>.
//Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
using System;
using OpenTK;
using osu.Game.Beatmaps.Samples;
namespace osu.Game.Beatmaps.Objects.Osu
{
public abstract class OsuBaseHit : HitObject
{
public Vector2 Position;
public Vector2 Position { get; set; }
public bool NewCombo { get; set; }
[Flags]
private enum HitObjectType
{
Circle = 1,
Slider = 2,
NewCombo = 4,
CircleNewCombo = 5,
SliderNewCombo = 6,
Spinner = 8,
ColourHax = 122,
Hold = 128,
ManiaLong = 128,
}
public static OsuBaseHit Parse(string val)
{
string[] split = val.Split(',');
var type = (HitObjectType)int.Parse(split[3]);
bool combo = type.HasFlag(HitObjectType.NewCombo);
type &= (HitObjectType)0xF;
type &= ~HitObjectType.NewCombo;
OsuBaseHit result;
switch (type)
{
case HitObjectType.Circle:
result = new Circle();
break;
case HitObjectType.Slider:
result = new Slider();
break;
case HitObjectType.Spinner:
result = new Spinner();
break;
default:
throw new InvalidOperationException($@"Unknown hit object type {type}");
}
result.Position = new Vector2(int.Parse(split[0]), int.Parse(split[1]));
result.StartTime = double.Parse(split[2]);
result.Sample = new HitSampleInfo { Type = (SampleType)int.Parse(split[4]) };
result.NewCombo = combo;
// TODO: "addition" field
return result;
}
}
}

View File

@ -0,0 +1,21 @@
//Copyright (c) 2007-2016 ppy Pty Ltd <contact@ppy.sh>.
//Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
using System;
using System.Collections.Generic;
namespace osu.Game.Beatmaps.Objects.Osu
{
class OsuConverter : HitObjectConverter<OsuBaseHit>
{
public override List<OsuBaseHit> Convert(List<HitObject> input)
{
List<OsuBaseHit> output = new List<OsuBaseHit>();
foreach (HitObject h in input)
output.Add(h as OsuBaseHit);
return output;
}
}
}

View File

@ -3,7 +3,7 @@
namespace osu.Game.Beatmaps.Objects.Osu
{
public class Spinner
public class Spinner : OsuBaseHit
{
}
}

View File

@ -0,0 +1,37 @@
//Copyright (c) 2007-2016 ppy Pty Ltd <contact@ppy.sh>.
//Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
using osu.Framework;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Sprites;
using osu.Framework.Graphics.Transformations;
using OpenTK;
namespace osu.Game.Beatmaps.Objects.Taiko.Drawable
{
class DrawableTaikoHit : Sprite
{
private TaikoBaseHit h;
public DrawableTaikoHit(TaikoBaseHit h)
{
this.h = h;
Origin = Anchor.Centre;
Scale = new Vector2(0.2f);
RelativePositionAxes = Axes.Both;
Position = new Vector2(1.1f, 0.5f);
}
public override void Load(BaseGame game)
{
base.Load(game);
Texture = game.Textures.Get(@"Menu/logo");
Transforms.Add(new TransformPositionX(Clock) { StartTime = h.StartTime - 200, EndTime = h.StartTime, StartValue = 1.1f, EndValue = 0.1f });
Transforms.Add(new TransformAlpha(Clock) { StartTime = h.StartTime + h.Duration + 200, EndTime = h.StartTime + h.Duration + 400, StartValue = 1, EndValue = 0 });
Expire(true);
}
}
}

View File

@ -3,7 +3,7 @@
namespace osu.Game.Beatmaps.Objects.Taiko
{
class TaikoBaseHit : HitObject
public class TaikoBaseHit : HitObject
{
public float Scale = 1;

View File

@ -0,0 +1,38 @@
//Copyright (c) 2007-2016 ppy Pty Ltd <contact@ppy.sh>.
//Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
using System;
using System.Collections.Generic;
using osu.Game.Beatmaps.Objects.Osu;
namespace osu.Game.Beatmaps.Objects.Taiko
{
class TaikoConverter : HitObjectConverter<TaikoBaseHit>
{
public override List<TaikoBaseHit> Convert(List<HitObject> input)
{
List<TaikoBaseHit> output = new List<TaikoBaseHit>();
foreach (HitObject i in input)
{
TaikoBaseHit h = i as TaikoBaseHit;
if (h == null)
{
OsuBaseHit o = i as OsuBaseHit;
if (o == null) throw new Exception(@"Can't convert!");
h = new TaikoBaseHit
{
StartTime = o.StartTime,
};
}
output.Add(h);
}
return output;
}
}
}

View File

@ -5,6 +5,6 @@ namespace osu.Game.Beatmaps.Samples
{
public class HitSampleInfo : SampleInfo
{
SampleType Type;
public SampleType Type { get; set; }
}
}

View File

@ -0,0 +1,50 @@
using System;
using System.Collections.Generic;
using System.IO;
using osu.Framework.Platform;
using osu.Game.Beatmaps;
using osu.Game.Beatmaps.Formats;
using osu.Game.Beatmaps.IO;
using SQLite;
namespace osu.Game.Database
{
public class BeatmapDatabase
{
private static SQLiteConnection connection { get; set; }
public BeatmapDatabase(BasicStorage storage)
{
if (connection == null)
{
connection = storage.GetDatabase(@"beatmaps");
connection.CreateTable<BeatmapMetadata>();
connection.CreateTable<BaseDifficulty>();
connection.CreateTable<BeatmapSet>();
connection.CreateTable<Beatmap>();
}
}
public void AddBeatmap(ArchiveReader input)
{
var metadata = input.ReadMetadata();
if (connection.Table<BeatmapSet>().Count(b => b.BeatmapSetID == metadata.BeatmapSetID) != 0)
return;
string[] mapNames = input.ReadBeatmaps();
var beatmapSet = new BeatmapSet { BeatmapSetID = metadata.BeatmapSetID };
var maps = new List<Beatmap>();
foreach (var name in mapNames)
{
using (var stream = new StreamReader(input.ReadFile(name)))
{
var decoder = BeatmapDecoder.GetDecoder(stream);
var beatmap = decoder.Decode(stream);
maps.Add(beatmap);
beatmap.BaseDifficultyID = connection.Insert(beatmap.BaseDifficulty);
}
}
beatmapSet.BeatmapMetadataID = connection.Insert(metadata);
connection.Insert(beatmapSet);
connection.InsertAll(maps);
}
}
}

View File

@ -1,82 +1,20 @@
//Copyright (c) 2007-2016 ppy Pty Ltd <contact@ppy.sh>.
//Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
using System;
using System.Collections.Generic;
using osu.Framework.Graphics.Sprites;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Transformations;
using osu.Game.Beatmaps.Objects;
using osu.Game.Beatmaps.Objects.Osu;
using osu.Game.Beatmaps.Objects.Catch;
using OpenTK;
using osu.Framework;
using osu.Game.Beatmaps.Objects.Catch.Drawable;
namespace osu.Game.GameModes.Play.Catch
{
public class CatchHitRenderer : HitRenderer
public class CatchHitRenderer : HitRenderer<CatchBaseHit>
{
List<CatchBaseHit> objects;
private CatchPlayfield playfield;
protected override Playfield CreatePlayfield() => new CatchPlayfield();
public override List<HitObject> Objects
{
set
{
//osu! mode requires all objects to be of CatchBaseHit type.
objects = value.ConvertAll(convertForCatch);
}
}
protected override List<CatchBaseHit> Convert(List<HitObject> objects) => new CatchConverter().Convert(objects);
private CatchBaseHit convertForCatch(HitObject input)
{
CatchBaseHit h = input as CatchBaseHit;
if (h == null)
{
OsuBaseHit o = input as OsuBaseHit;
if (o == null) throw new Exception(@"Can't convert!");
h = new Fruit()
{
StartTime = o.StartTime,
Position = o.Position.X
};
}
return h;
}
public override void Load(BaseGame game)
{
base.Load(game);
if (playfield == null)
Add(playfield = new CatchPlayfield());
else
playfield.Clear();
if (objects == null) return;
foreach (CatchBaseHit h in objects)
{
//render stuff!
Sprite s = new Sprite
{
Texture = game.Textures.Get(@"Menu/logo"),
Origin = Anchor.Centre,
Scale = new Vector2(0.1f),
RelativePositionAxes = Axes.Y,
Position = new Vector2(h.Position, -0.1f)
};
s.Transforms.Add(new TransformPosition(Clock) { StartTime = h.StartTime - 200, EndTime = h.StartTime, StartValue = new Vector2(h.Position, -0.1f), EndValue = new Vector2(h.Position, 0.9f) });
s.Transforms.Add(new TransformAlpha(Clock) { StartTime = h.StartTime + h.Duration + 200, EndTime = h.StartTime + h.Duration + 400, StartValue = 1, EndValue = 0 });
s.Expire(true);
playfield.Add(s);
}
}
protected override Drawable GetVisualRepresentation(CatchBaseHit h) => new DrawableFruit(h);
}
}

View File

@ -3,35 +3,53 @@
using System.Collections.Generic;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Batches;
using osu.Framework.Graphics.Containers;
using osu.Framework.Graphics.Drawables;
using osu.Game.Beatmaps.Objects;
using OpenTK;
using OpenTK.Graphics;
using osu.Framework;
namespace osu.Game.GameModes.Play
{
public abstract class HitRenderer : Container
public abstract class HitRenderer<T> : Container
{
public abstract List<HitObject> Objects { set; }
private List<T> objects;
public HitRenderer()
public List<HitObject> Objects
{
RelativeSizeAxes = Axes.Both;
set
{
objects = Convert(value);
if (IsLoaded)
loadObjects();
}
}
private Playfield playfield;
protected abstract Playfield CreatePlayfield();
protected abstract List<T> Convert(List<HitObject> objects);
public override void Load(BaseGame game)
{
base.Load(game);
Add(new Box()
RelativeSizeAxes = Axes.Both;
Children = new Drawable[]
{
RelativeSizeAxes = Axes.Both,
Alpha = 0.8f,
Colour = new Color4(5, 5, 5, 255),
});
playfield = CreatePlayfield()
};
loadObjects();
}
private void loadObjects()
{
if (objects == null) return;
foreach (T h in objects)
playfield.Add(GetVisualRepresentation(h));
}
protected abstract Drawable GetVisualRepresentation(T h);
}
}

View File

@ -1,88 +1,39 @@
//Copyright (c) 2007-2016 ppy Pty Ltd <contact@ppy.sh>.
//Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
using System;
using System.Collections.Generic;
using osu.Framework.Graphics.Sprites;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Transformations;
using osu.Game.Beatmaps.Objects;
using osu.Game.Beatmaps.Objects.Osu;
using osu.Game.Beatmaps.Objects.Mania;
using OpenTK;
using osu.Framework;
using osu.Game.Beatmaps.Objects.Mania.Drawable;
using System.Collections.Generic;
namespace osu.Game.GameModes.Play.Mania
{
public class ManiaHitRenderer : HitRenderer
public class ManiaHitRenderer : HitRenderer<ManiaBaseHit>
{
private readonly int columns;
List<ManiaBaseHit> objects;
private ManiaPlayfield playfield;
public ManiaHitRenderer(int columns = 5)
{
this.columns = columns;
}
public override List<HitObject> Objects
protected override List<ManiaBaseHit> Convert(List<HitObject> objects)
{
set
{
//osu! mode requires all objects to be of ManiaBaseHit type.
objects = value.ConvertAll(convertForMania);
}
ManiaConverter converter = new ManiaConverter(columns);
return converter.Convert(objects);
}
private ManiaBaseHit convertForMania(HitObject input)
protected override Playfield CreatePlayfield() => new ManiaPlayfield(columns);
protected override Drawable GetVisualRepresentation(ManiaBaseHit h)
{
ManiaBaseHit h = input as ManiaBaseHit;
if (h == null)
return new DrawableNote(h)
{
OsuBaseHit o = input as OsuBaseHit;
if (o == null) throw new Exception(@"Can't convert!");
h = new Note()
{
StartTime = o.StartTime,
Column = (int)Math.Round(o.Position.X / 512 * columns)
};
}
return h;
}
public override void Load(BaseGame game)
{
base.Load(game);
if (playfield == null)
Add(playfield = new ManiaPlayfield(columns));
else
playfield.Clear();
if (objects == null) return;
foreach (ManiaBaseHit h in objects)
{
//render stuff!
Sprite s = new Sprite
{
Texture = game.Textures.Get(@"Menu/logo"),
Origin = Anchor.Centre,
Scale = new Vector2(0.1f),
RelativePositionAxes = Axes.Both,
Position = new Vector2((float)(h.Column + 0.5) / columns, -0.1f)
};
s.Transforms.Add(new TransformPositionY(Clock) { StartTime = h.StartTime - 200, EndTime = h.StartTime, StartValue = -0.1f, EndValue = 0.9f });
s.Transforms.Add(new TransformAlpha(Clock) { StartTime = h.StartTime + h.Duration + 200, EndTime = h.StartTime + h.Duration + 400, StartValue = 1, EndValue = 0 });
s.Expire(true);
playfield.Add(s);
}
Position = new Vector2((float)(h.Column + 0.5) / columns, -0.1f),
RelativePositionAxes = Axes.Both
};
}
}
}

View File

@ -2,62 +2,19 @@
//Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
using System.Collections.Generic;
using osu.Framework.Graphics.Sprites;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Transformations;
using osu.Game.Beatmaps.Objects;
using osu.Game.Beatmaps.Objects.Osu;
using OpenTK;
using System.Diagnostics;
using osu.Framework;
using osu.Game.Beatmaps.Objects.Osu.Drawable;
namespace osu.Game.GameModes.Play.Osu
{
public class OsuHitRenderer : HitRenderer
public class OsuHitRenderer : HitRenderer<OsuBaseHit>
{
List<OsuBaseHit> objects;
private OsuPlayfield playfield;
protected override Playfield CreatePlayfield() => new OsuPlayfield();
public override List<HitObject> Objects
{
set
{
Debug.Assert(objects == null);
protected override List<OsuBaseHit> Convert(List<HitObject> objects) => new OsuConverter().Convert(objects);
//osu! mode requires all objects to be of OsuBaseHit type.
objects = value.ConvertAll(o => (OsuBaseHit)o);
}
}
public override void Load(BaseGame game)
{
base.Load(game);
if (playfield == null)
Add(playfield = new OsuPlayfield());
else
playfield.Clear();
if (objects == null) return;
foreach (OsuBaseHit h in objects)
{
//render stuff!
Sprite s = new Sprite
{
Texture = game.Textures.Get(@"Menu/logo"),
Origin = Anchor.Centre,
Scale = new Vector2(0.1f),
Alpha = 0,
Position = h.Position
};
s.Transforms.Add(new TransformAlpha(Clock) { StartTime = h.StartTime - 200, EndTime = h.StartTime, StartValue = 0, EndValue = 1 });
s.Transforms.Add(new TransformAlpha(Clock) { StartTime = h.StartTime + h.Duration + 200, EndTime = h.StartTime + h.Duration + 400, StartValue = 1, EndValue = 0 });
s.Expire(true);
playfield.Add(s);
}
}
protected override Drawable GetVisualRepresentation(OsuBaseHit h) => new DrawableCircle(h);
}
}

View File

@ -1,81 +1,20 @@
//Copyright (c) 2007-2016 ppy Pty Ltd <contact@ppy.sh>.
//Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
using System;
using System.Collections.Generic;
using osu.Framework.Graphics.Sprites;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Transformations;
using osu.Game.Beatmaps.Objects;
using osu.Game.Beatmaps.Objects.Osu;
using osu.Game.Beatmaps.Objects.Taiko;
using OpenTK;
using osu.Framework;
using osu.Game.Beatmaps.Objects.Taiko.Drawable;
namespace osu.Game.GameModes.Play.Taiko
{
public class TaikoHitRenderer : HitRenderer
public class TaikoHitRenderer : HitRenderer<TaikoBaseHit>
{
List<TaikoBaseHit> objects;
private TaikoPlayfield playfield;
protected override List<TaikoBaseHit> Convert(List<HitObject> objects) => new TaikoConverter().Convert(objects);
public override List<HitObject> Objects
{
set
{
//osu! mode requires all objects to be of TaikoBaseHit type.
objects = value.ConvertAll(convertForTaiko);
}
}
protected override Playfield CreatePlayfield() => new TaikoPlayfield();
private TaikoBaseHit convertForTaiko(HitObject input)
{
TaikoBaseHit h = input as TaikoBaseHit;
if (h == null)
{
OsuBaseHit o = input as OsuBaseHit;
if (o == null) throw new Exception(@"Can't convert!");
h = new TaikoBaseHit()
{
StartTime = o.StartTime
};
}
return h;
}
public override void Load(BaseGame game)
{
base.Load(game);
if (playfield == null)
Add(playfield = new TaikoPlayfield());
else
playfield.Clear();
if (objects == null) return;
foreach (TaikoBaseHit h in objects)
{
//render stuff!
Sprite s = new Sprite
{
Texture = game.Textures.Get(@"Menu/logo"),
Origin = Anchor.Centre,
Scale = new Vector2(0.2f),
RelativePositionAxes = Axes.Both,
Position = new Vector2(1.1f, 0.5f)
};
s.Transforms.Add(new TransformPositionX(Clock) { StartTime = h.StartTime - 200, EndTime = h.StartTime, StartValue = 1.1f, EndValue = 0.1f });
s.Transforms.Add(new TransformAlpha(Clock) { StartTime = h.StartTime + h.Duration + 200, EndTime = h.StartTime + h.Duration + 400, StartValue = 1, EndValue = 0 });
s.Expire(true);
playfield.Add(s);
}
}
protected override Drawable GetVisualRepresentation(TaikoBaseHit h) => new DrawableTaikoHit(h);
}
}
}

View File

@ -1,102 +0,0 @@
//Copyright (c) 2007-2016 ppy Pty Ltd <contact@ppy.sh>.
//Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
using osu.Framework.Graphics;
using osu.Framework.Graphics.Transformations;
using osu.Framework.MathUtils;
using osu.Framework.Timing;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace osu.Game.Graphics.UserInterface
{
/// <summary>
/// Used as an accuracy counter. Represented visually as a percentage, internally as a fraction.
/// </summary>
public class AccuracyCounter : NumericRollingCounter<float>
{
protected override Type transformType => typeof(TransformAccuracy);
private long numerator = 0;
public long Numerator
{
get
{
return numerator;
}
set
{
numerator = value;
updateCount();
}
}
private ulong denominator = 0;
public ulong Denominator
{
get
{
return denominator;
}
set
{
denominator = value;
updateCount();
}
}
public void SetCount(long num, ulong den)
{
numerator = num;
denominator = den;
updateCount();
}
private void updateCount()
{
Count = Denominator == 0 ? 100.0f : (Numerator * 100.0f) / Denominator;
}
public override void ResetCount()
{
numerator = 0;
denominator = 0;
updateCount();
StopRolling();
}
protected override string formatCount(float count)
{
return count.ToString("0.00") + "%";
}
protected class TransformAccuracy : Transform<float>
{
public override float CurrentValue
{
get
{
double time = Time;
if (time < StartTime) return StartValue;
if (time >= EndTime) return EndValue;
return Interpolation.ValueAt(time, StartValue, EndValue, StartTime, EndTime, Easing);
}
}
public override void Apply(Drawable d)
{
base.Apply(d);
(d as AccuracyCounter).VisibleCount = CurrentValue;
}
public TransformAccuracy(IClock clock)
: base(clock)
{
}
}
}
}

View File

@ -1,91 +0,0 @@
//Copyright (c) 2007-2016 ppy Pty Ltd <contact@ppy.sh>.
//Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
using OpenTK;
using OpenTK.Graphics;
using osu.Framework;
using osu.Framework.Graphics.Transformations;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace osu.Game.Graphics.UserInterface
{
/// <summary>
/// Allows tint and vertical scaling animation. Used in osu!taiko and osu!mania.
/// </summary>
public class AlternativeComboCounter : ULongCounter // btw, I'm terribly bad with names... OUENDAN!
{
public Color4 OriginalColour;
public Color4 TintColour = Color4.OrangeRed;
public int TintDuration = 250;
public float ScaleFactor = 2;
public EasingTypes TintEasing = EasingTypes.None;
public bool CanAnimateWhenBackwards = false;
public AlternativeComboCounter() : base()
{
IsRollingContinuous = false;
}
public override void Load(BaseGame game)
{
base.Load(game);
countSpriteText.Hide();
OriginalColour = Colour;
}
public override void ResetCount()
{
SetCountWithoutRolling(0);
}
protected override void transformCount(ulong currentValue, ulong newValue)
{
// Animate rollover only when going backwards
if (newValue > currentValue)
{
updateTransforms(typeof(TransformULongCounter));
removeTransforms(typeof(TransformULongCounter));
VisibleCount = newValue;
}
else
transformCount(new TransformULongCounter(Clock), currentValue, newValue);
}
protected override ulong getProportionalDuration(ulong currentValue, ulong newValue)
{
ulong difference = currentValue > newValue ? currentValue - newValue : currentValue - newValue;
return difference * RollingDuration;
}
protected virtual void transformAnimate()
{
countSpriteText.FadeColour(TintColour, 0);
countSpriteText.ScaleTo(new Vector2(1, ScaleFactor));
countSpriteText.FadeColour(OriginalColour, TintDuration, TintEasing);
countSpriteText.ScaleTo(new Vector2(1, 1), TintDuration, TintEasing);
}
protected override void transformVisibleCount(ulong currentValue, ulong newValue)
{
if (countSpriteText != null)
{
countSpriteText.Text = newValue.ToString("#,0");
if (newValue == 0)
{
countSpriteText.FadeOut(TintDuration);
return;
}
countSpriteText.Show();
if (newValue > currentValue || CanAnimateWhenBackwards)
{
transformAnimate();
}
}
}
}
}

View File

@ -1,60 +0,0 @@
//Copyright (c) 2007-2016 ppy Pty Ltd <contact@ppy.sh>.
//Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
using OpenTK.Graphics;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace osu.Game.Graphics.UserInterface
{
/// <summary>
/// Similar to Standard, but without the 'x' and has tinted pop-ups. Used in osu!catch.
/// </summary>
public class CatchComboCounter : StandardComboCounter
{
public CatchComboCounter() : base()
{
CanPopOutWhenBackwards = true;
}
protected override string formatCount(ulong count)
{
return count.ToString("#,0");
}
protected override void transformCount(ulong currentValue, ulong newValue)
{
// Animate rollover only when going backwards
if (newValue > currentValue)
{
updateTransforms(typeof(TransformULongCounter));
removeTransforms(typeof(TransformULongCounter));
VisibleCount = newValue;
}
else
{
// Backwards pop-up animation has no tint colour
popOutSpriteText.Colour = countSpriteText.Colour;
transformCount(new TransformULongCounter(Clock), currentValue, newValue);
}
}
/// <summary>
/// Increaces counter and tints pop-out before animation.
/// </summary>
/// <param name="colour">Last grabbed fruit colour.</param>
public void CatchFruit(Color4 colour)
{
popOutSpriteText.Colour = colour;
Count++;
}
public override void ResetCount()
{
base.ResetCount();
}
}
}

View File

@ -1,65 +0,0 @@
//Copyright (c) 2007-2016 ppy Pty Ltd <contact@ppy.sh>.
//Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
using osu.Framework;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Sprites;
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace osu.Game.Graphics.UserInterface
{
/// <summary>
/// Skeleton for a numeric counter with a simple roll-up animation.
/// </summary>
/// <typeparam name="T">Type of the actual counter.</typeparam>
public abstract class NumericRollingCounter<T> : RollingCounter<T>
{
protected SpriteText countSpriteText;
protected float textSize = 20.0f;
public float TextSize
{
get { return textSize; }
set
{
textSize = value;
updateTextSize();
}
}
public override void Load(BaseGame game)
{
base.Load(game);
Children = new Drawable[]
{
countSpriteText = new SpriteText
{
Text = formatCount(Count),
TextSize = this.TextSize,
Anchor = this.Anchor,
Origin = this.Origin,
},
};
}
protected override void transformVisibleCount(T currentValue, T newValue)
{
if (countSpriteText != null)
{
countSpriteText.Text = formatCount(newValue);
}
}
protected virtual void updateTextSize()
{
if (countSpriteText != null)
countSpriteText.TextSize = TextSize;
}
}
}

View File

@ -1,241 +0,0 @@
using osu.Framework;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
using osu.Framework.Graphics.Transformations;
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace osu.Game.Graphics.UserInterface
{
/// <summary>
/// Skeleton for a counter which value rolls-up in a lapse of time.
/// </summary>
/// <remarks>
/// This class only abstracts the basics to roll-up a value in a lapse of time by using Transforms.
/// In order to show a value, you must implement a way to display it, i.e., as a numeric counter or a bar.
/// </remarks>
/// <typeparam name="T">Type of the actual counter.</typeparam>
public abstract class RollingCounter<T> : Container
{
/// <summary>
/// Type of the Transform to use.
/// </summary>
/// <remarks>
/// Must be a subclass of Transform<T>
/// </remarks>
protected virtual Type transformType => typeof(Transform<T>);
protected ulong RollingTotalDuration = 0;
/// <summary>
/// If true, each time the Count is updated, it will roll over from the current visible value.
/// Else, it will roll up from the current count value.
/// </summary>
public bool IsRollingContinuous = true;
/// <summary>
/// If true, the roll-up duration will be proportional to the counter.
/// </summary>
public bool IsRollingProportional = false;
/// <summary>
/// If IsRollingProportional = false, duration in milliseconds for the counter roll-up animation for each
/// element; else duration in milliseconds for the counter roll-up animation in total.
/// </summary>
public ulong RollingDuration = 0;
/// <summary>
/// Easing for the counter rollover animation.
/// </summary>
public EasingTypes RollingEasing = EasingTypes.None;
protected T prevVisibleCount;
protected T visibleCount;
/// <summary>
/// Value shown at the current moment.
/// </summary>
public virtual T VisibleCount
{
get
{
return visibleCount;
}
protected set
{
prevVisibleCount = visibleCount;
if (visibleCount.Equals(value))
return;
visibleCount = value;
transformVisibleCount(prevVisibleCount, value);
}
}
protected T prevCount;
protected T count;
/// <summary>
/// Actual value of counter.
/// </summary>
public virtual T Count
{
get
{
return count;
}
set
{
prevCount = count;
count = value;
if (Clock != null)
{
RollingTotalDuration =
IsRollingProportional
? getProportionalDuration(VisibleCount, value)
: RollingDuration;
transformCount(IsRollingContinuous ? VisibleCount : prevCount, value);
}
}
}
protected RollingCounter()
{
Debug.Assert(
transformType.IsSubclassOf(typeof(Transform<T>)) || transformType == typeof(Transform<T>),
@"transformType should be a subclass of Transform<T>."
);
}
public override void Load(BaseGame game)
{
base.Load(game);
removeTransforms(transformType);
if (Count == null)
ResetCount();
VisibleCount = Count;
}
/// <summary>
/// Sets count value, bypassing rollover animation.
/// </summary>
/// <param name="count">New count value.</param>
public virtual void SetCountWithoutRolling(T count)
{
Count = count;
StopRolling();
}
/// <summary>
/// Stops rollover animation, forcing the visible count to be the actual count.
/// </summary>
public virtual void StopRolling()
{
removeTransforms(transformType);
VisibleCount = Count;
}
/// <summary>
/// Resets count to default value.
/// </summary>
public abstract void ResetCount();
/// <summary>
/// Calculates the duration of the roll-up animation by using the difference between the current visible value
/// and the new final value.
/// </summary>
/// <remarks>
/// To be used in conjunction with IsRollingProportional = true.
/// Unless a derived class needs to have a proportional rolling, it is not necessary to override this function.
/// </remarks>
/// <param name="currentValue">Current visible value.</param>
/// <param name="newValue">New final value.</param>
/// <returns>Calculated rollover duration in milliseconds.</returns>
protected virtual ulong getProportionalDuration(T currentValue, T newValue)
{
return RollingDuration;
}
/// <summary>
/// Used to format counts.
/// </summary>
/// <param name="count">Count to format.</param>
/// <returns>Count formatted as a string.</returns>
protected virtual string formatCount(T count)
{
return count.ToString();
}
protected void updateTransforms(Type type)
{
foreach (ITransform t in Transforms.AliveItems)
if (t.GetType() == type)
t.Apply(this);
}
protected void removeTransforms(Type type)
{
Transforms.RemoveAll(t => t.GetType() == type);
}
/// <summary>
/// Called when the count is updated to add a transformer that changes the value of the visible count (i.e.
/// implement the rollover animation).
/// </summary>
/// <param name="currentValue">Count value before modification.</param>
/// <param name="newValue">Expected count value after modification-</param>
/// <remarks>
/// Unless you need to set a custom animation according to the current or new value of the count, the
/// recommended approach is to call transformCount(CustomTransformer(Clock), currentValue, newValue), where
/// CustomTransformer is of type transformerType.
/// By using this approach, there is no need to check if the Clock is not null; this validation is done before
/// adding the transformer.
/// </remarks>
/// <seealso cref="transformType"/>
protected virtual void transformCount(T currentValue, T newValue)
{
object[] parameters = { Clock };
transformCount((Transform<T>)Activator.CreateInstance(transformType, parameters), currentValue, newValue);
}
/// <summary>
/// Intended to be used by transformCount().
/// </summary>
/// <see cref="transformCount"/>
protected void transformCount(Transform<T> transform, T currentValue, T newValue)
{
Type type = transform.GetType();
updateTransforms(type);
removeTransforms(type);
if (Clock == null)
return;
if (RollingDuration == 0)
{
VisibleCount = Count;
return;
}
transform.StartTime = Time;
transform.EndTime = Time + RollingTotalDuration;
transform.StartValue = currentValue;
transform.EndValue = newValue;
transform.Easing = RollingEasing;
Transforms.Add(transform);
}
/// <summary>
/// This procedure is called each time the visible count value is updated.
/// Override to create custom animations.
/// </summary>
/// <param name="currentValue">Visible count value before modification.</param>
/// <param name="newValue">Expected visible count value after modification-</param>
protected abstract void transformVisibleCount(T currentValue, T newValue);
}
}

View File

@ -1,32 +0,0 @@
//Copyright (c) 2007-2016 ppy Pty Ltd <contact@ppy.sh>.
//Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
using osu.Framework;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace osu.Game.Graphics.UserInterface
{
public class ScoreCounter : ULongCounter
{
/// <summary>
/// How many leading zeroes the counter will have.
/// </summary>
public uint LeadingZeroes = 0;
public override void Load(BaseGame game)
{
base.Load(game);
countSpriteText.FixedWidth = true;
}
protected override string formatCount(ulong count)
{
return count.ToString("D" + LeadingZeroes);
}
}
}

View File

@ -1,110 +0,0 @@
//Copyright (c) 2007-2016 ppy Pty Ltd <contact@ppy.sh>.
//Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
using osu.Framework;
using osu.Framework.Graphics.Sprites;
using osu.Framework.Graphics.Transformations;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace osu.Game.Graphics.UserInterface
{
/// <summary>
/// Uses the 'x' symbol and has a pop-out effect while rolling over. Used in osu! standard.
/// </summary>
public class StandardComboCounter : ULongCounter
{
public SpriteText popOutSpriteText;
public ulong PopOutDuration = 0;
public float PopOutBigScale = 2.0f;
public float PopOutSmallScale = 1.2f;
public EasingTypes PopOutEasing = EasingTypes.None;
public bool CanPopOutWhenBackwards = false;
public float PopOutInitialAlpha = 0.75f;
public StandardComboCounter() : base()
{
IsRollingContinuous = false;
}
public override void Load(BaseGame game)
{
base.Load(game);
countSpriteText.Alpha = 0;
Add(popOutSpriteText = new SpriteText
{
Text = formatCount(Count),
Origin = this.Origin,
Anchor = this.Anchor,
TextSize = this.TextSize,
Alpha = 0,
});
}
protected override void updateTextSize()
{
base.updateTextSize();
if (popOutSpriteText != null)
popOutSpriteText.TextSize = this.TextSize;
}
protected override void transformCount(ulong currentValue, ulong newValue)
{
// Animate rollover only when going backwards
if (newValue > currentValue)
{
updateTransforms(typeof(TransformULongCounter));
removeTransforms(typeof(TransformULongCounter));
VisibleCount = newValue;
}
else
transformCount(new TransformULongCounter(Clock), currentValue, newValue);
}
protected override ulong getProportionalDuration(ulong currentValue, ulong newValue)
{
ulong difference = currentValue > newValue ? currentValue - newValue : currentValue - newValue;
return difference * RollingDuration;
}
protected override string formatCount(ulong count)
{
return count.ToString("#,0") + "x";
}
protected virtual void transformPopOut()
{
countSpriteText.ScaleTo(PopOutSmallScale);
countSpriteText.ScaleTo(1, PopOutDuration, PopOutEasing);
popOutSpriteText.ScaleTo(PopOutBigScale);
popOutSpriteText.FadeTo(PopOutInitialAlpha);
popOutSpriteText.ScaleTo(1, PopOutDuration, PopOutEasing);
popOutSpriteText.FadeOut(PopOutDuration, PopOutEasing);
}
protected override void transformVisibleCount(ulong currentValue, ulong newValue)
{
if (countSpriteText != null && popOutSpriteText != null)
{
countSpriteText.Text = popOutSpriteText.Text = formatCount(newValue);
if (newValue == 0)
{
countSpriteText.FadeOut(PopOutDuration);
}
else
{
countSpriteText.Show();
if (newValue > currentValue || CanPopOutWhenBackwards)
transformPopOut();
}
}
}
}
}

View File

@ -1,205 +0,0 @@
//Copyright (c) 2007-2016 ppy Pty Ltd <contact@ppy.sh>.
//Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
using OpenTK;
using osu.Framework;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
using osu.Framework.Graphics.Transformations;
using osu.Framework.MathUtils;
using osu.Framework.Timing;
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace osu.Game.Graphics.UserInterface
{
/// <summary>
/// Shows a float count as stars. Used as star difficulty display.
/// </summary>
public class StarCounter : RollingCounter<float>
{
protected override Type transformType => typeof(TransformStarCounter);
protected Container starContainer;
protected List<TextAwesome> stars = new List<TextAwesome>();
public ulong StarAnimationDuration = 500;
public EasingTypes StarAnimationEasing = EasingTypes.OutElasticHalf;
public ulong FadeDuration = 100;
public float MinStarSize = 0.3f;
public float MinStarAlpha = 0.5f;
public int MaxStars = 10;
public int StarSize = 20;
public int StarSpacing = 4;
public StarCounter() : base()
{
IsRollingProportional = true;
RollingDuration = 150;
}
protected override ulong getProportionalDuration(float currentValue, float newValue)
{
return (ulong)(Math.Abs(currentValue - newValue) * RollingDuration);
}
public override void ResetCount()
{
Count = 0;
StopRolling();
}
public override void Load(BaseGame game)
{
base.Load(game);
Children = new Drawable[]
{
starContainer = new Container
{
Anchor = Anchor.CentreLeft,
Origin = Anchor.CentreLeft,
Width = MaxStars * StarSize + Math.Max(MaxStars - 1, 0) * StarSpacing,
Height = StarSize,
}
};
for (int i = 0; i < MaxStars; i++)
{
TextAwesome star = new TextAwesome
{
Icon = FontAwesome.star,
Anchor = Anchor.CentreLeft,
Origin = Anchor.Centre,
TextSize = StarSize,
Scale = new Vector2(MinStarSize),
Alpha = (i == 0) ? 1.0f : MinStarAlpha,
Position = new Vector2((StarSize + StarSpacing) * i + (StarSize + StarSpacing) / 2, 0),
};
//todo: user Container<T> once we have it.
stars.Add(star);
starContainer.Add(star);
}
ResetCount();
}
protected override void transformCount(float currentValue, float newValue)
{
transformStar((int)Math.Floor(currentValue), currentValue, currentValue < newValue);
transformCount(new TransformStarCounter(Clock), currentValue, newValue);
}
protected void updateTransformStar(int i)
{
foreach (ITransform t in stars[i].Transforms.AliveItems)
if (t.GetType() == typeof(TransformAlpha) || t.GetType() == typeof(TransformScaleVector))
t.Apply(stars[i]);
stars[i].Transforms.RemoveAll(t =>
t.GetType() == typeof(TransformScaleVector) || t.GetType() == typeof(TransformAlpha)
);
}
protected void transformStarScale(int i, TransformScaleVector transform, bool isIncrement, double startTime)
{
transform.StartTime = startTime;
transform.EndTime = transform.StartTime + StarAnimationDuration;
transform.StartValue = stars[i].Scale;
transform.EndValue = new Vector2(
Interpolation.ValueAt(
Math.Min(Math.Max(i, Count), i + 1),
MinStarSize,
1.0f,
i,
i + 1
)
);
transform.Easing = StarAnimationEasing;
stars[i].Transforms.Add(transform);
}
protected void transformStarAlpha(int i, TransformAlpha transform, bool isIncrement, double startTime)
{
transform.StartTime = startTime;
//if (!isIncrement)
//transform.StartTime += StarAnimationDuration - FadeDuration;
transform.EndTime = transform.StartTime + FadeDuration;
transform.StartValue = stars[i].Alpha;
transform.EndValue = i < Count ? 1.0f : MinStarAlpha;
stars[i].Transforms.Add(transform);
}
protected void transformStar(int i, float value, bool isIncrement)
{
if (i >= MaxStars)
return;
if (Clock == null)
return;
// Calculate time where animation should had started
double startTime = Time;
// If incrementing, animation should had started when VisibleCount crossed start of star (i)
if (isIncrement)
startTime -= i == (int)Math.Floor(prevCount) ?
getProportionalDuration(prevCount, value) : getProportionalDuration(i, value);
// If decrementing, animation should had started when VisibleCount crossed end of star (i + 1)
else
startTime -= i == (int)Math.Floor(prevCount) ?
getProportionalDuration(prevCount, value) : getProportionalDuration(i + 1, value);
updateTransformStar(i);
transformStarScale(i, new TransformScaleVector(Clock), isIncrement, startTime);
transformStarAlpha(i, new TransformAlpha(Clock), isIncrement, startTime);
}
protected override void transformVisibleCount(float currentValue, float newValue)
{
// Detect increment that passes over an integer value
if (Math.Ceiling(currentValue) <= Math.Floor(newValue))
for (int i = (int)Math.Ceiling(currentValue); i <= Math.Floor(newValue); i++)
transformStar(i, newValue, true);
// Detect decrement that passes over an integer value
if (Math.Floor(currentValue) >= Math.Ceiling(newValue))
for (int i = (int)Math.Floor(newValue); i < Math.Floor(currentValue); i++)
transformStar(i, newValue, false);
}
protected class TransformStarCounter : Transform<float>
{
public override float CurrentValue
{
get
{
double time = Time;
if (time < StartTime) return StartValue;
if (time >= EndTime) return EndValue;
return Interpolation.ValueAt(time, StartValue, EndValue, StartTime, EndTime, Easing);
}
}
public override void Apply(Drawable d)
{
base.Apply(d);
(d as StarCounter).VisibleCount = CurrentValue;
}
public TransformStarCounter(IClock clock)
: base(clock)
{
}
}
}
}

View File

@ -1,59 +0,0 @@
//Copyright (c) 2007-2016 ppy Pty Ltd <contact@ppy.sh>.
//Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
using osu.Framework.Graphics;
using osu.Framework.Graphics.Transformations;
using osu.Framework.MathUtils;
using osu.Framework.Timing;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace osu.Game.Graphics.UserInterface
{
/// <summary>
/// A simple rolling counter that accepts unsigned long values.
/// </summary>
public class ULongCounter : NumericRollingCounter<ulong>
{
protected override Type transformType => typeof(TransformULongCounter);
public override void ResetCount()
{
SetCountWithoutRolling(0);
}
protected override string formatCount(ulong count)
{
return count.ToString("#,0");
}
protected class TransformULongCounter : Transform<ulong>
{
public override ulong CurrentValue
{
get
{
double time = Time;
if (time < StartTime) return StartValue;
if (time >= EndTime) return EndValue;
return (ulong)Interpolation.ValueAt(time, StartValue, EndValue, StartTime, EndTime, Easing);
}
}
public override void Apply(Drawable d)
{
base.Apply(d);
(d as ULongCounter).VisibleCount = CurrentValue;
}
public TransformULongCounter(IClock clock)
: base(clock)
{
}
}
}
}

View File

@ -219,7 +219,10 @@ namespace osu.Game.Online.API
{
//NotificationManager.ShowMessage($@"We just went {newState}!", newState == APIState.Online ? Color4.YellowGreen : Color4.OrangeRed, 5000);
log.Add($@"We just went {newState}!");
OnStateChange?.Invoke(oldState, newState);
Scheduler.Add(delegate
{
OnStateChange?.Invoke(oldState, newState);
});
}
}
}

View File

@ -56,7 +56,7 @@ namespace osu.Game.Online.Chat.Display
}
}
},
new Container
new AutoSizeContainer
{
RelativeSizeAxes = Axes.X,
Padding = new MarginPadding { Left = padding + 10 },

View File

@ -20,17 +20,31 @@ using osu.Framework;
using osu.Framework.Input;
using osu.Game.Input;
using OpenTK.Input;
using System.IO;
using osu.Game.Beatmaps.IO;
namespace osu.Game
{
public class OsuGame : OsuGameBase
{
private class ImportBeatmap
{
public string Path;
}
public Toolbar Toolbar;
public ChatConsole Chat;
public MainMenu MainMenu => intro?.ChildGameMode as MainMenu;
private Intro intro;
private string[] args;
private IpcChannel<ImportBeatmap> BeatmapIPC;
public Bindable<PlayMode> PlayMode;
public OsuGame(string[] args)
{
this.args = args;
}
public override void SetHost(BasicGameHost host)
{
@ -41,6 +55,35 @@ namespace osu.Game
public override void Load(BaseGame game)
{
BeatmapIPC = new IpcChannel<ImportBeatmap>(Host);
if (!Host.IsPrimaryInstance)
{
if (args.Length == 1 && File.Exists(args[0]))
{
BeatmapIPC.SendMessage(new ImportBeatmap { Path = args[0] }).Wait();
Console.WriteLine(@"Sent file to running instance");
}
else
Console.WriteLine(@"osu! does not support multiple running instances.");
Environment.Exit(0);
}
BeatmapIPC.MessageReceived += message =>
{
try
{
var reader = ArchiveReader.GetReader(Host.Storage, message.Path);
Beatmaps.AddBeatmap(reader);
// TODO: Switch to beatmap list and select the new song
}
catch (Exception ex)
{
// TODO: Show the user some info?
Console.WriteLine($@"Failed to import beatmap: {ex}");
}
};
base.Load(game);
//attach our bindables to the audio subsystem.

View File

@ -5,7 +5,9 @@ using osu.Framework.Graphics.Containers;
using osu.Framework.Graphics.Cursor;
using osu.Framework.Graphics.Textures;
using osu.Framework.IO.Stores;
using osu.Game.Beatmaps.IO;
using osu.Game.Configuration;
using osu.Game.Database;
using osu.Game.Graphics.Cursor;
using osu.Game.Graphics.Processing;
using osu.Game.Online.API;
@ -16,6 +18,7 @@ namespace osu.Game
public class OsuGameBase : BaseGame
{
internal OsuConfigManager Config = new OsuConfigManager();
internal BeatmapDatabase Beatmaps { get; private set; }
protected override string MainResourceFile => @"osu.Game.Resources.dll";
@ -32,6 +35,9 @@ namespace osu.Game
{
base.Load(game);
OszArchiveReader.Register();
Beatmaps = new BeatmapDatabase(Host.Storage);
//this completely overrides the framework default. will need to change once we make a proper FontStore.
Fonts = new TextureStore() { ScaleAdjust = 0.01f };
Fonts.AddStore(new GlyphStore(Resources, @"Fonts/Exo2.0-Regular"));

View File

@ -34,32 +34,56 @@
</PropertyGroup>
<ItemGroup>
<Reference Include="Newtonsoft.Json, Version=9.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL">
<HintPath>..\packages\Newtonsoft.Json.9.0.1\lib\net45\Newtonsoft.Json.dll</HintPath>
<HintPath>$(SolutionDir)\packages\Newtonsoft.Json.9.0.1\lib\net45\Newtonsoft.Json.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="OpenTK, Version=1.2.0.0, Culture=neutral, PublicKeyToken=bad199fe84eb3df4, processorArchitecture=MSIL">
<HintPath>..\packages\ppy.OpenTK.1.1.2225.3\lib\net20\OpenTK.dll</HintPath>
<HintPath>$(SolutionDir)\packages\ppy.OpenTK.1.1.2225.3\lib\net20\OpenTK.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="System" />
<Reference Include="System.Core" />
<Reference Include="SQLitePCLRaw.core">
<HintPath>$(SolutionDir)\packages\SQLitePCLRaw.core.1.0.1\lib\net45\SQLitePCLRaw.core.dll</HintPath>
</Reference>
<Reference Include="SQLitePCLRaw.provider.e_sqlite3">
<HintPath>$(SolutionDir)\packages\SQLitePCLRaw.provider.e_sqlite3.net45.1.0.1\lib\net45\SQLitePCLRaw.provider.e_sqlite3.dll</HintPath>
</Reference>
<Reference Include="SQLitePCLRaw.batteries_green">
<HintPath>$(SolutionDir)\packages\SQLitePCLRaw.bundle_green.1.0.1\lib\net45\SQLitePCLRaw.batteries_green.dll</HintPath>
</Reference>
<Reference Include="SQLite-net">
<HintPath>$(SolutionDir)\packages\sqlite-net-pcl.1.2.0\lib\portable-net45+wp8+wpa81+win8+MonoAndroid10+MonoTouch10+Xamarin.iOS10\SQLite-net.dll</HintPath>
</Reference>
<Reference Include="DotNetZip">
<HintPath>$(SolutionDir)\packages\DotNetZip.1.10.1\lib\net20\DotNetZip.dll</HintPath>
</Reference>
</ItemGroup>
<ItemGroup>
<Compile Include="Beatmaps\Beatmap.cs" />
<Compile Include="Beatmaps\BeatmapSet.cs" />
<Compile Include="Beatmaps\Metadata.cs" />
<Compile Include="Beatmaps\BeatmapMetadata.cs" />
<Compile Include="Beatmaps\Objects\Catch\CatchConverter.cs" />
<Compile Include="Beatmaps\Objects\Catch\Drawable\DrawableFruit.cs" />
<Compile Include="Beatmaps\Objects\HitObject.cs" />
<Compile Include="Beatmaps\Objects\Catch\CatchBaseHit.cs" />
<Compile Include="Beatmaps\Objects\Catch\Droplet.cs" />
<Compile Include="Beatmaps\Objects\Catch\Fruit.cs" />
<Compile Include="Beatmaps\Objects\HitObjectConverter.cs" />
<Compile Include="Beatmaps\Objects\Mania\Drawable\DrawableNote.cs" />
<Compile Include="Beatmaps\Objects\Mania\HoldNote.cs" />
<Compile Include="Beatmaps\Objects\Mania\ManiaBaseHit.cs" />
<Compile Include="Beatmaps\Objects\Mania\ManiaConverter.cs" />
<Compile Include="Beatmaps\Objects\Mania\Note.cs" />
<Compile Include="Beatmaps\Objects\Osu\Circle.cs" />
<Compile Include="Beatmaps\Objects\Osu\Drawable\DrawableCircle.cs" />
<Compile Include="Beatmaps\Objects\Osu\OsuBaseHit.cs" />
<Compile Include="Beatmaps\Objects\Osu\OsuConverter.cs" />
<Compile Include="Beatmaps\Objects\Osu\Slider.cs" />
<Compile Include="Beatmaps\Objects\Osu\Spinner.cs" />
<Compile Include="Beatmaps\Objects\Taiko\Drawable\DrawableTaikoHit.cs" />
<Compile Include="Beatmaps\Objects\Taiko\TaikoBaseHit.cs" />
<Compile Include="Beatmaps\Objects\Taiko\TaikoConverter.cs" />
<Compile Include="Beatmaps\Samples\HitSampleInfo.cs" />
<Compile Include="Beatmaps\Samples\SampleBank.cs" />
<Compile Include="Beatmaps\Samples\SampleInfo.cs" />
@ -112,19 +136,10 @@
<Compile Include="Graphics\Cursor\OsuCursorContainer.cs" />
<Compile Include="Graphics\Processing\RatioAdjust.cs" />
<Compile Include="Graphics\TextAwesome.cs" />
<Compile Include="Graphics\UserInterface\AlternativeComboCounter.cs" />
<Compile Include="Graphics\UserInterface\RollingCounter.cs" />
<Compile Include="Graphics\UserInterface\KeyCounter.cs" />
<Compile Include="Graphics\UserInterface\KeyCounterKeyboard.cs" />
<Compile Include="Graphics\UserInterface\KeyCounterCollection.cs" />
<Compile Include="Graphics\UserInterface\KeyCounterMouse.cs" />
<Compile Include="Graphics\UserInterface\AccuracyCounter.cs" />
<Compile Include="Graphics\UserInterface\NumericRollingCounter.cs" />
<Compile Include="Graphics\UserInterface\ScoreCounter.cs" />
<Compile Include="Graphics\UserInterface\CatchComboCounter.cs" />
<Compile Include="Graphics\UserInterface\StandardComboCounter.cs" />
<Compile Include="Graphics\UserInterface\StarCounter.cs" />
<Compile Include="Graphics\UserInterface\ULongCounter.cs" />
<Compile Include="Online\API\APIAccess.cs" />
<Compile Include="Online\API\APIRequest.cs" />
<Compile Include="Online\API\OAuth.cs" />
@ -148,14 +163,21 @@
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="Users\User.cs" />
<Compile Include="VolumeControl.cs" />
<Compile Include="Database\BeatmapDatabase.cs" />
<Compile Include="Beatmaps\IO\ArchiveReader.cs" />
<Compile Include="Beatmaps\Formats\BeatmapDecoder.cs" />
<Compile Include="Beatmaps\Formats\OsuLegacyDecoder.cs" />
<Compile Include="Beatmaps\IO\OszArchiveReader.cs" />
<Compile Include="Beatmaps\BaseDifficulty.cs" />
<Compile Include="Beatmaps\Events\EventType.cs" />
<Compile Include="VolumeMeter.cs" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\osu-framework\osu.Framework\osu.Framework.csproj">
<ProjectReference Include="$(SolutionDir)\osu-framework\osu.Framework\osu.Framework.csproj">
<Project>{c76bf5b3-985e-4d39-95fe-97c9c879b83a}</Project>
<Name>osu.Framework</Name>
</ProjectReference>
<ProjectReference Include="..\osu-resources\osu.Game.Resources\osu.Game.Resources.csproj">
<ProjectReference Include="$(SolutionDir)\osu-resources\osu.Game.Resources\osu.Game.Resources.csproj">
<Project>{d9a367c9-4c1a-489f-9b05-a0cea2b53b58}</Project>
<Name>osu.Game.Resources</Name>
</ProjectReference>
@ -167,6 +189,7 @@
<None Include="packages.config" />
</ItemGroup>
<ItemGroup />
<ItemGroup />
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Other similar extension points exist, see Microsoft.Common.targets.
@ -175,4 +198,7 @@
<Target Name="AfterBuild">
</Target>
-->
<Import Project="$(SolutionDir)\packages\SQLitePCLRaw.lib.e_sqlite3.v110_xp.1.0.1\build\SQLitePCLRaw.lib.e_sqlite3.v110_xp.targets" Condition="Exists('..\packages\SQLitePCLRaw.lib.e_sqlite3.v110_xp.1.0.1\build\SQLitePCLRaw.lib.e_sqlite3.v110_xp.targets')" />
<Import Project="$(SolutionDir)\packages\SQLitePCLRaw.lib.e_sqlite3.osx.1.0.1\build\SQLitePCLRaw.lib.e_sqlite3.osx.targets" Condition="Exists('..\packages\SQLitePCLRaw.lib.e_sqlite3.osx.1.0.1\build\SQLitePCLRaw.lib.e_sqlite3.osx.targets')" />
<Import Project="$(SolutionDir)\packages\SQLitePCLRaw.lib.e_sqlite3.linux.1.0.1\build\SQLitePCLRaw.lib.e_sqlite3.linux.targets" Condition="Exists('..\packages\SQLitePCLRaw.lib.e_sqlite3.linux.1.0.1\build\SQLitePCLRaw.lib.e_sqlite3.linux.targets')" />
</Project>

View File

@ -1,9 +1,17 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
Copyright (c) 2007-2016 ppy Pty Ltd <contact@ppy.sh>.
Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
-->
<packages>
<package id="Newtonsoft.Json" version="9.0.1" targetFramework="net45" />
<package id="ppy.OpenTK" version="1.1.2225.3" targetFramework="net45" />
</packages>
<?xml version="1.0" encoding="utf-8"?>
<!--
Copyright (c) 2007-2016 ppy Pty Ltd <contact@ppy.sh>.
Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
-->
<packages>
<package id="DotNetZip" version="1.10.1" targetFramework="net45" />
<package id="Newtonsoft.Json" version="9.0.1" targetFramework="net45" />
<package id="ppy.OpenTK" version="1.1.2225.3" targetFramework="net45" />
<package id="sqlite-net-pcl" version="1.2.0" targetFramework="net45" />
<package id="SQLitePCLRaw.bundle_green" version="1.0.1" targetFramework="net45" />
<package id="SQLitePCLRaw.core" version="1.0.1" targetFramework="net45" />
<package id="SQLitePCLRaw.lib.e_sqlite3.linux" version="1.0.1" targetFramework="net45" />
<package id="SQLitePCLRaw.lib.e_sqlite3.osx" version="1.0.1" targetFramework="net45" />
<package id="SQLitePCLRaw.lib.e_sqlite3.v110_xp" version="1.0.1" targetFramework="net45" />
<package id="SQLitePCLRaw.provider.e_sqlite3.net45" version="1.0.1" targetFramework="net45" />
</packages>

14
osu.sln
View File

@ -19,43 +19,42 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "osu.Framework.Desktop", "os
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "osu.Desktop.VisualTests", "osu.Desktop.VisualTests\osu.Desktop.VisualTests.csproj", "{69051C69-12AE-4E7D-A3E6-460D2E282312}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "osu.Game.Tests", "osu.Game.Tests\osu.Game.Tests.csproj", "{54377672-20B1-40AF-8087-5CF73BF3953A}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Deploy|Any CPU = Deploy|Any CPU
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{2A66DD92-ADB1-4994-89E2-C94E04ACDA0D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{2A66DD92-ADB1-4994-89E2-C94E04ACDA0D}.Debug|Any CPU.Build.0 = Debug|Any CPU
{2A66DD92-ADB1-4994-89E2-C94E04ACDA0D}.Deploy|Any CPU.ActiveCfg = Debug|Any CPU
{2A66DD92-ADB1-4994-89E2-C94E04ACDA0D}.Release|Any CPU.ActiveCfg = Release|Any CPU
{2A66DD92-ADB1-4994-89E2-C94E04ACDA0D}.Release|Any CPU.Build.0 = Release|Any CPU
{C76BF5B3-985E-4D39-95FE-97C9C879B83A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{C76BF5B3-985E-4D39-95FE-97C9C879B83A}.Debug|Any CPU.Build.0 = Debug|Any CPU
{C76BF5B3-985E-4D39-95FE-97C9C879B83A}.Deploy|Any CPU.ActiveCfg = Debug|Any CPU
{C76BF5B3-985E-4D39-95FE-97C9C879B83A}.Release|Any CPU.ActiveCfg = Release|Any CPU
{C76BF5B3-985E-4D39-95FE-97C9C879B83A}.Release|Any CPU.Build.0 = Release|Any CPU
{0D3FBF8A-7464-4CF7-8C90-3E7886DF2D4D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{0D3FBF8A-7464-4CF7-8C90-3E7886DF2D4D}.Debug|Any CPU.Build.0 = Debug|Any CPU
{0D3FBF8A-7464-4CF7-8C90-3E7886DF2D4D}.Deploy|Any CPU.ActiveCfg = Debug|Any CPU
{0D3FBF8A-7464-4CF7-8C90-3E7886DF2D4D}.Release|Any CPU.ActiveCfg = Release|Any CPU
{0D3FBF8A-7464-4CF7-8C90-3E7886DF2D4D}.Release|Any CPU.Build.0 = Release|Any CPU
{D9A367C9-4C1A-489F-9B05-A0CEA2B53B58}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{D9A367C9-4C1A-489F-9B05-A0CEA2B53B58}.Debug|Any CPU.Build.0 = Debug|Any CPU
{D9A367C9-4C1A-489F-9B05-A0CEA2B53B58}.Deploy|Any CPU.ActiveCfg = Debug|Any CPU
{D9A367C9-4C1A-489F-9B05-A0CEA2B53B58}.Release|Any CPU.ActiveCfg = Release|Any CPU
{D9A367C9-4C1A-489F-9B05-A0CEA2B53B58}.Release|Any CPU.Build.0 = Release|Any CPU
{65DC628F-A640-4111-AB35-3A5652BC1E17}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{65DC628F-A640-4111-AB35-3A5652BC1E17}.Debug|Any CPU.Build.0 = Debug|Any CPU
{65DC628F-A640-4111-AB35-3A5652BC1E17}.Deploy|Any CPU.ActiveCfg = Debug|Any CPU
{65DC628F-A640-4111-AB35-3A5652BC1E17}.Release|Any CPU.ActiveCfg = Release|Any CPU
{65DC628F-A640-4111-AB35-3A5652BC1E17}.Release|Any CPU.Build.0 = Release|Any CPU
{69051C69-12AE-4E7D-A3E6-460D2E282312}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{69051C69-12AE-4E7D-A3E6-460D2E282312}.Debug|Any CPU.Build.0 = Debug|Any CPU
{69051C69-12AE-4E7D-A3E6-460D2E282312}.Deploy|Any CPU.ActiveCfg = Debug|Any CPU
{69051C69-12AE-4E7D-A3E6-460D2E282312}.Release|Any CPU.ActiveCfg = Release|Any CPU
{69051C69-12AE-4E7D-A3E6-460D2E282312}.Release|Any CPU.Build.0 = Release|Any CPU
{54377672-20B1-40AF-8087-5CF73BF3953A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{54377672-20B1-40AF-8087-5CF73BF3953A}.Debug|Any CPU.Build.0 = Debug|Any CPU
{54377672-20B1-40AF-8087-5CF73BF3953A}.Release|Any CPU.ActiveCfg = Release|Any CPU
{54377672-20B1-40AF-8087-5CF73BF3953A}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
@ -67,6 +66,7 @@ Global
{D9A367C9-4C1A-489F-9B05-A0CEA2B53B58} = {0D37A2AD-80A4-464F-A1DE-1560B70F1CE3}
{65DC628F-A640-4111-AB35-3A5652BC1E17} = {7A75DFA2-DE65-4458-98AF-26AF96FFD6DC}
{69051C69-12AE-4E7D-A3E6-460D2E282312} = {0D37A2AD-80A4-464F-A1DE-1560B70F1CE3}
{54377672-20B1-40AF-8087-5CF73BF3953A} = {0D37A2AD-80A4-464F-A1DE-1560B70F1CE3}
EndGlobalSection
GlobalSection(MonoDevelopProperties) = preSolution
Policies = $0