diff --git a/appveyor.yml b/appveyor.yml new file mode 100644 index 0000000000..0d5878aa77 --- /dev/null +++ b/appveyor.yml @@ -0,0 +1,23 @@ +clone_depth: 1 +version: '{branch}-{build}' +configuration: Debug +cache: + - C:\ProgramData\chocolatey\bin -> appveyor.yml + - C:\ProgramData\chocolatey\lib -> appveyor.yml + - inspectcode -> appveyor.yml + - packages -> **\packages.config +install: + - cmd: git submodule update --init --recursive + - cmd: choco install resharper-clt -y + - cmd: choco install nvika -y + - cmd: appveyor DownloadFile https://github.com/peppy/CodeFileSanity/releases/download/v0.1/CodeFileSanity.exe +before_build: + - cmd: CodeFileSanity.exe + - cmd: nuget restore +build: + project: osu.sln + parallel: true + verbosity: minimal +after_build: + - cmd: inspectcode /o="inspectcodereport.xml" /caches-home="inspectcode" osu.sln + - cmd: NVika parsereport "inspectcodereport.xml" \ No newline at end of file diff --git a/osu-framework b/osu-framework index 5dbb4a5134..405537bd35 160000 --- a/osu-framework +++ b/osu-framework @@ -1 +1 @@ -Subproject commit 5dbb4a5134dacb2e98ab8f2af219039a72bd32e6 +Subproject commit 405537bd351954878ddc1d2ba53e5d0563528446 diff --git a/osu-resources b/osu-resources index 51f2b9b37f..f85c594c18 160000 --- a/osu-resources +++ b/osu-resources @@ -1 +1 @@ -Subproject commit 51f2b9b37f38cd349a3dd728a78f8fffcb3a54f5 +Subproject commit f85c594c182db2b01233e29ca52639b7baa00402 diff --git a/osu.Desktop.Deploy/App.config b/osu.Desktop.Deploy/App.config index 33ae53313b..d1da144f50 100644 --- a/osu.Desktop.Deploy/App.config +++ b/osu.Desktop.Deploy/App.config @@ -1,4 +1,8 @@  + @@ -17,16 +21,4 @@ - - - - - - - - - - - - \ No newline at end of file diff --git a/osu.Desktop.Deploy/GitHubObject.cs b/osu.Desktop.Deploy/GitHubObject.cs index f87de5cbdd..a91e7273a4 100644 --- a/osu.Desktop.Deploy/GitHubObject.cs +++ b/osu.Desktop.Deploy/GitHubObject.cs @@ -1,8 +1,11 @@ -using Newtonsoft.Json; +// Copyright (c) 2007-2017 ppy Pty Ltd . +// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE + +using Newtonsoft.Json; namespace osu.Desktop.Deploy { - internal class GitHubObject + public class GitHubObject { [JsonProperty(@"id")] public int Id; diff --git a/osu.Desktop.Deploy/GitHubRelease.cs b/osu.Desktop.Deploy/GitHubRelease.cs index 7e7b04fe58..fe372a7825 100644 --- a/osu.Desktop.Deploy/GitHubRelease.cs +++ b/osu.Desktop.Deploy/GitHubRelease.cs @@ -1,8 +1,11 @@ -using Newtonsoft.Json; +// Copyright (c) 2007-2017 ppy Pty Ltd . +// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE + +using Newtonsoft.Json; namespace osu.Desktop.Deploy { - internal class GitHubRelease + public class GitHubRelease { [JsonProperty(@"id")] public int Id; diff --git a/osu.Desktop.Deploy/Program.cs b/osu.Desktop.Deploy/Program.cs index 7c6efa7f70..00ec215e8a 100644 --- a/osu.Desktop.Deploy/Program.cs +++ b/osu.Desktop.Deploy/Program.cs @@ -1,5 +1,5 @@ // Copyright (c) 2007-2017 ppy Pty Ltd . -// Licensed under the MIT Licence - https://raw.GitHubusercontent.com/ppy/osu-framework/master/LICENCE +// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE using System; using System.Collections.Generic; @@ -40,7 +40,7 @@ namespace osu.Desktop.Deploy /// /// How many previous build deltas we want to keep when publishing. /// - const int keep_delta_count = 3; + private const int keep_delta_count = 3; private static string codeSigningCmd => string.IsNullOrEmpty(codeSigningPassword) ? "" : $"-n \"/a /f {codeSigningCertPath} /p {codeSigningPassword} /t http://timestamp.comodoca.com/authenticode\""; @@ -172,10 +172,10 @@ namespace osu.Desktop.Deploy } //remove excess deltas - var deltas = releaseLines.Where(l => l.Filename.Contains("-delta")); - if (deltas.Count() > keep_delta_count) + var deltas = releaseLines.Where(l => l.Filename.Contains("-delta")).ToArray(); + if (deltas.Length > keep_delta_count) { - foreach (var l in deltas.Take(deltas.Count() - keep_delta_count)) + foreach (var l in deltas.Take(deltas.Length - keep_delta_count)) { write($"- Removing old delta {l.Filename}", ConsoleColor.Yellow); File.Delete(Path.Combine(ReleasesFolder, l.Filename)); @@ -198,7 +198,7 @@ namespace osu.Desktop.Deploy write($"- Creating release {version}...", ConsoleColor.Yellow); var req = new JsonWebRequest($"{GitHubApiEndpoint}") { - Method = HttpMethod.POST + Method = HttpMethod.POST, }; req.AddRaw(JsonConvert.SerializeObject(new GitHubRelease { @@ -215,6 +215,7 @@ namespace osu.Desktop.Deploy var upload = new WebRequest(assetUploadUrl, Path.GetFileName(a)) { Method = HttpMethod.POST, + Timeout = 240000, ContentType = "application/octet-stream", }; @@ -261,7 +262,7 @@ namespace osu.Desktop.Deploy if (!File.Exists(Path.Combine(ReleasesFolder, nupkgDistroFilename(lastRelease.Name)))) { - write("Last verion's package not found locally.", ConsoleColor.Red); + write("Last version's package not found locally.", ConsoleColor.Red); requireDownload = true; } else @@ -282,6 +283,8 @@ namespace osu.Desktop.Deploy foreach (var a in assets) { + if (a.Name.EndsWith(".exe")) continue; + write($"- Downloading {a.Name}...", ConsoleColor.Yellow); new FileWebRequest(Path.Combine(ReleasesFolder, a.Name), $"{GitHubApiEndpoint}/assets/{a.Id}").AuthenticatedBlockingPerform(); } @@ -337,12 +340,17 @@ namespace osu.Desktop.Deploy WorkingDirectory = solutionPath, CreateNoWindow = true, RedirectStandardOutput = true, + RedirectStandardError = true, UseShellExecute = false, WindowStyle = ProcessWindowStyle.Hidden }; Process p = Process.Start(psi); + if (p == null) return false; + string output = p.StandardOutput.ReadToEnd(); + output += p.StandardError.ReadToEnd(); + if (p.ExitCode == 0) return true; write(output); diff --git a/osu.Desktop.Deploy/Properties/AssemblyInfo.cs b/osu.Desktop.Deploy/Properties/AssemblyInfo.cs index e0c1ad1a43..8df81400c1 100644 --- a/osu.Desktop.Deploy/Properties/AssemblyInfo.cs +++ b/osu.Desktop.Deploy/Properties/AssemblyInfo.cs @@ -1,4 +1,7 @@ -using System.Reflection; +// Copyright (c) 2007-2017 ppy Pty Ltd . +// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE + +using System.Reflection; using System.Runtime.InteropServices; // General Information about an assembly is controlled through the following diff --git a/osu.Desktop.Deploy/osu.Desktop.Deploy.csproj b/osu.Desktop.Deploy/osu.Desktop.Deploy.csproj index 898a991292..7a3719a25b 100644 --- a/osu.Desktop.Deploy/osu.Desktop.Deploy.csproj +++ b/osu.Desktop.Deploy/osu.Desktop.Deploy.csproj @@ -101,7 +101,12 @@ - + + osu.licenseheader + + + PreserveNewest + diff --git a/osu.Desktop.Deploy/packages.config b/osu.Desktop.Deploy/packages.config index 4bbb763e27..59e9e42f45 100644 --- a/osu.Desktop.Deploy/packages.config +++ b/osu.Desktop.Deploy/packages.config @@ -1,4 +1,8 @@  + diff --git a/osu.Desktop.Tests/app.config b/osu.Desktop.Tests/app.config deleted file mode 100644 index b9af3fdc80..0000000000 --- a/osu.Desktop.Tests/app.config +++ /dev/null @@ -1,15 +0,0 @@ - - - - - - - - - - - - \ No newline at end of file diff --git a/osu.Desktop.Tests/osu.Desktop.Tests.csproj b/osu.Desktop.Tests/osu.Desktop.Tests.csproj index 07495311e0..ad69994592 100644 --- a/osu.Desktop.Tests/osu.Desktop.Tests.csproj +++ b/osu.Desktop.Tests/osu.Desktop.Tests.csproj @@ -100,12 +100,14 @@ osu.licenseheader - + + + - - - - - - - - - - \ No newline at end of file diff --git a/osu.Desktop.VisualTests/osu.Desktop.VisualTests.csproj b/osu.Desktop.VisualTests/osu.Desktop.VisualTests.csproj index a340bd843e..01daadc3f7 100644 --- a/osu.Desktop.VisualTests/osu.Desktop.VisualTests.csproj +++ b/osu.Desktop.VisualTests/osu.Desktop.VisualTests.csproj @@ -23,6 +23,7 @@ false LocalIntranet v4.5 + true publish\ true Disk @@ -86,6 +87,10 @@ $(SolutionDir)\packages\ppy.OpenTK.2.0.50727.1340\lib\net45\OpenTK.dll True + + ..\packages\SharpCompress.0.15.1\lib\net45\SharpCompress.dll + True + False $(SolutionDir)\packages\SQLite.Net.Core-PCL.3.1.1\lib\portable-win8+net45+wp8+wpa81+MonoAndroid1+MonoTouch1\SQLite.Net.dll @@ -110,7 +115,6 @@ osu.licenseheader - @@ -179,6 +183,7 @@ + @@ -186,7 +191,9 @@ + + @@ -195,7 +202,10 @@ + + + diff --git a/osu.Desktop.VisualTests/packages.config b/osu.Desktop.VisualTests/packages.config index 3da209ee61..5a30c50600 100644 --- a/osu.Desktop.VisualTests/packages.config +++ b/osu.Desktop.VisualTests/packages.config @@ -6,6 +6,7 @@ Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/maste + diff --git a/osu.Desktop/Beatmaps/IO/LegacyFilesystemReader.cs b/osu.Desktop/Beatmaps/IO/LegacyFilesystemReader.cs index b8bfb63a08..0ef448cafe 100644 --- a/osu.Desktop/Beatmaps/IO/LegacyFilesystemReader.cs +++ b/osu.Desktop/Beatmaps/IO/LegacyFilesystemReader.cs @@ -17,16 +17,16 @@ namespace osu.Desktop.Beatmaps.IO { public static void Register() => AddReader((storage, path) => Directory.Exists(path)); - private string basePath { get; set; } - private Beatmap firstMap { get; set; } + private string basePath { get; } + private Beatmap firstMap { get; } public LegacyFilesystemReader(string path) { basePath = path; - BeatmapFilenames = Directory.GetFiles(basePath, @"*.osu").Select(f => Path.GetFileName(f)).ToArray(); + BeatmapFilenames = Directory.GetFiles(basePath, @"*.osu").Select(Path.GetFileName).ToArray(); if (BeatmapFilenames.Length == 0) throw new FileNotFoundException(@"This directory contains no beatmaps"); - StoryboardFilename = Directory.GetFiles(basePath, @"*.osb").Select(f => Path.GetFileName(f)).FirstOrDefault(); + StoryboardFilename = Directory.GetFiles(basePath, @"*.osb").Select(Path.GetFileName).FirstOrDefault(); using (var stream = new StreamReader(GetStream(BeatmapFilenames[0]))) { var decoder = BeatmapDecoder.GetDecoder(stream); diff --git a/osu.Desktop/OsuGameDesktop.cs b/osu.Desktop/OsuGameDesktop.cs index d9b9c31617..da3e7b704a 100644 --- a/osu.Desktop/OsuGameDesktop.cs +++ b/osu.Desktop/OsuGameDesktop.cs @@ -9,16 +9,16 @@ using osu.Framework.Desktop.Platform; using osu.Desktop.Overlays; using System.Reflection; using System.Drawing; +using System.IO; +using System.Threading.Tasks; using osu.Game.Screens.Menu; namespace osu.Desktop { - class OsuGameDesktop : OsuGame + internal class OsuGameDesktop : OsuGame { private VersionManager versionManager; - public override bool IsDeployedBuild => versionManager.IsDeployedBuild; - public OsuGameDesktop(string[] args = null) : base(args) { @@ -30,9 +30,9 @@ namespace osu.Desktop base.LoadComplete(); versionManager.LoadAsync(this); - ModeChanged += m => + ScreenChanged += s => { - if (!versionManager.IsAlive && m is Intro) + if (!versionManager.IsAlive && s is Intro) Add(versionManager); }; } @@ -43,8 +43,10 @@ namespace osu.Desktop var desktopWindow = host.Window as DesktopGameWindow; if (desktopWindow != null) { + desktopWindow.CursorState = CursorState.Hidden; + desktopWindow.Icon = Icon.ExtractAssociatedIcon(Assembly.GetExecutingAssembly().Location); - desktopWindow.Title = @"osu!lazer"; + desktopWindow.Title = Name; desktopWindow.DragEnter += dragEnter; desktopWindow.DragDrop += dragDrop; @@ -54,22 +56,29 @@ namespace osu.Desktop private void dragDrop(DragEventArgs e) { // this method will only be executed if e.Effect in dragEnter gets set to something other that None. - var dropData = e.Data.GetData(DataFormats.FileDrop) as object[]; + var dropData = (object[])e.Data.GetData(DataFormats.FileDrop); var filePaths = dropData.Select(f => f.ToString()).ToArray(); - ImportBeatmapsAsync(filePaths); + + if (filePaths.All(f => Path.GetExtension(f) == @".osz")) + Task.Run(() => BeatmapDatabase.Import(filePaths)); + else if (filePaths.All(f => Path.GetExtension(f) == @".osr")) + Task.Run(() => + { + var score = ScoreDatabase.ReadReplayFile(filePaths.First()); + Schedule(() => LoadScore(score)); + }); } + private static readonly string[] allowed_extensions = { @".osz", @".osr" }; + private void dragEnter(DragEventArgs e) { // dragDrop will only be executed if e.Effect gets set to something other that None in this method. bool isFile = e.Data.GetDataPresent(DataFormats.FileDrop); if (isFile) { - var paths = (e.Data.GetData(DataFormats.FileDrop) as object[]).Select(f => f.ToString()).ToArray(); - if (paths.Any(p => !p.EndsWith(".osz"))) - e.Effect = DragDropEffects.None; - else - e.Effect = DragDropEffects.Copy; + var paths = ((object[])e.Data.GetData(DataFormats.FileDrop)).Select(f => f.ToString()).ToArray(); + e.Effect = allowed_extensions.Any(ext => paths.All(p => p.EndsWith(ext))) ? DragDropEffects.Copy : DragDropEffects.None; } } } diff --git a/osu.Desktop/Overlays/VersionManager.cs b/osu.Desktop/Overlays/VersionManager.cs index aff8bb0d7b..70925f6cf4 100644 --- a/osu.Desktop/Overlays/VersionManager.cs +++ b/osu.Desktop/Overlays/VersionManager.cs @@ -2,7 +2,6 @@ // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE using System; -using System.Diagnostics; using osu.Framework.Allocation; using osu.Framework.Graphics; using osu.Framework.Graphics.Colour; @@ -11,13 +10,14 @@ using osu.Game.Graphics.Sprites; using osu.Game.Overlays; using osu.Game.Overlays.Notifications; using Squirrel; -using System.Reflection; using osu.Framework.Graphics.Sprites; using osu.Framework.Graphics.Textures; using osu.Game.Graphics; using OpenTK; using OpenTK.Graphics; using System.Net.Http; +using osu.Framework.Logging; +using osu.Game; namespace osu.Desktop.Overlays { @@ -26,16 +26,12 @@ namespace osu.Desktop.Overlays private UpdateManager updateManager; private NotificationManager notificationManager; - AssemblyName assembly = Assembly.GetEntryAssembly().GetName(); - - public bool IsDeployedBuild => assembly.Version.Major > 0; - protected override bool HideOnEscape => false; public override bool HandleInput => false; [BackgroundDependencyLoader] - private void load(NotificationManager notification, OsuColour colours, TextureStore textures) + private void load(NotificationManager notification, OsuColour colours, TextureStore textures, OsuGameBase game) { notificationManager = notification; @@ -44,29 +40,18 @@ namespace osu.Desktop.Overlays Origin = Anchor.BottomCentre; Alpha = 0; - bool isDebug = false; - Debug.Assert(isDebug = true); - - string version; - if (!IsDeployedBuild) - { - version = @"local " + (isDebug ? @"debug" : @"release"); - } - else - version = $@"{assembly.Version.Major}.{assembly.Version.Minor}.{assembly.Version.Build}"; - Children = new Drawable[] { new FillFlowContainer { AutoSizeAxes = Axes.Both, - Direction = FillDirection.Down, + Direction = FillDirection.Vertical, Children = new Drawable[] { new FillFlowContainer { AutoSizeAxes = Axes.Both, - Direction = FillDirection.Right, + Direction = FillDirection.Horizontal, Spacing = new Vector2(5), Anchor = Anchor.TopCentre, Origin = Anchor.TopCentre, @@ -75,12 +60,12 @@ namespace osu.Desktop.Overlays new OsuSpriteText { Font = @"Exo2.0-Bold", - Text = $@"osu!lazer" + Text = game.Name }, new OsuSpriteText { - Colour = isDebug ? colours.Red : Color4.White, - Text = version + Colour = game.IsDebug ? colours.Red : Color4.White, + Text = game.Version }, } }, @@ -91,7 +76,7 @@ namespace osu.Desktop.Overlays TextSize = 12, Colour = colours.Yellow, Font = @"Venera", - Text = $@"Development Build" + Text = @"Development Build" }, new Sprite { @@ -103,7 +88,7 @@ namespace osu.Desktop.Overlays } }; - if (IsDeployedBuild) + if (game.IsDeployedBuild) checkForUpdateAsync(); } @@ -159,15 +144,21 @@ namespace osu.Desktop.Overlays Schedule(() => notification.State = ProgressNotificationState.Completed); } - catch (Exception) + catch (Exception e) { if (useDeltaPatching) { + Logger.Error(e, @"delta patching failed!"); + //could fail if deltas are unavailable for full update path (https://github.com/Squirrel/Squirrel.Windows/issues/959) //try again without deltas. checkForUpdateAsync(false, notification); scheduleRetry = false; } + else + { + Logger.Error(e, @"update failed!"); + } } } catch (HttpRequestException) @@ -196,9 +187,9 @@ namespace osu.Desktop.Overlays { } - class UpdateProgressNotification : ProgressNotification + private class UpdateProgressNotification : ProgressNotification { - protected override Notification CreateCompletionNotification() => new ProgressCompletionNotification(this) + protected override Notification CreateCompletionNotification() => new ProgressCompletionNotification() { Text = @"Update ready to install. Click to restart!", Activated = () => @@ -221,8 +212,10 @@ namespace osu.Desktop.Overlays new TextAwesome { Anchor = Anchor.Centre, + Origin = Anchor.Centre, Icon = FontAwesome.fa_upload, Colour = Color4.White, + TextSize = 20 } }); } diff --git a/osu.Desktop/Program.cs b/osu.Desktop/Program.cs index 3171e474dc..ddf58ac363 100644 --- a/osu.Desktop/Program.cs +++ b/osu.Desktop/Program.cs @@ -29,7 +29,7 @@ namespace osu.Desktop { if (!host.IsPrimaryInstance) { - var importer = new BeatmapImporter(host); + var importer = new BeatmapIPCChannel(host); // Restore the cwd so relative paths given at the command line work correctly Directory.SetCurrentDirectory(cwd); foreach (var file in args) diff --git a/osu.Desktop/app.config b/osu.Desktop/app.config deleted file mode 100644 index b3c333c783..0000000000 --- a/osu.Desktop/app.config +++ /dev/null @@ -1,19 +0,0 @@ - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/osu.Desktop/osu.Desktop.csproj b/osu.Desktop/osu.Desktop.csproj index 527a027ca2..934004dfde 100644 --- a/osu.Desktop/osu.Desktop.csproj +++ b/osu.Desktop/osu.Desktop.csproj @@ -23,6 +23,7 @@ false LocalIntranet v4.5 + true publish\ true Disk @@ -101,10 +102,6 @@ $(SolutionDir)\packages\DeltaCompressionDotNet.1.1.0\lib\net20\DeltaCompressionDotNet.PatchApi.dll True - - $(SolutionDir)\packages\squirrel.windows.1.5.2\lib\Net45\ICSharpCode.SharpZipLib.dll - True - $(SolutionDir)\packages\Mono.Cecil.0.9.6.4\lib\net45\Mono.Cecil.dll True @@ -153,7 +150,6 @@ osu.licenseheader - diff --git a/osu.Desktop/osu.nuspec b/osu.Desktop/osu.nuspec index 2888f7c040..4c529f57e5 100644 --- a/osu.Desktop/osu.nuspec +++ b/osu.Desktop/osu.nuspec @@ -17,7 +17,8 @@ - + + diff --git a/osu.Game.Modes.Catch/Beatmaps/CatchBeatmapConverter.cs b/osu.Game.Modes.Catch/Beatmaps/CatchBeatmapConverter.cs new file mode 100644 index 0000000000..9791554f02 --- /dev/null +++ b/osu.Game.Modes.Catch/Beatmaps/CatchBeatmapConverter.cs @@ -0,0 +1,20 @@ +// Copyright (c) 2007-2017 ppy Pty Ltd . +// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE + +using osu.Game.Beatmaps; +using osu.Game.Modes.Catch.Objects; +using System.Collections.Generic; + +namespace osu.Game.Modes.Catch.Beatmaps +{ + internal class CatchBeatmapConverter : IBeatmapConverter + { + public Beatmap Convert(Beatmap original) + { + return new Beatmap(original) + { + HitObjects = new List() // Todo: Convert HitObjects + }; + } + } +} diff --git a/osu.Game.Modes.Catch/Beatmaps/CatchBeatmapProcessor.cs b/osu.Game.Modes.Catch/Beatmaps/CatchBeatmapProcessor.cs new file mode 100644 index 0000000000..ef585e2675 --- /dev/null +++ b/osu.Game.Modes.Catch/Beatmaps/CatchBeatmapProcessor.cs @@ -0,0 +1,19 @@ +// Copyright (c) 2007-2017 ppy Pty Ltd . +// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE + +using osu.Game.Beatmaps; +using osu.Game.Modes.Catch.Objects; + +namespace osu.Game.Modes.Catch.Beatmaps +{ + internal class CatchBeatmapProcessor : IBeatmapProcessor + { + public void SetDefaults(CatchBaseHit hitObject, Beatmap beatmap) + { + } + + public void PostProcess(Beatmap beatmap) + { + } + } +} diff --git a/osu.Game.Modes.Catch/CatchDifficultyCalculator.cs b/osu.Game.Modes.Catch/CatchDifficultyCalculator.cs index ccc4097d59..53c6f5c2ce 100644 --- a/osu.Game.Modes.Catch/CatchDifficultyCalculator.cs +++ b/osu.Game.Modes.Catch/CatchDifficultyCalculator.cs @@ -2,26 +2,23 @@ // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE using osu.Game.Beatmaps; +using osu.Game.Modes.Catch.Beatmaps; using osu.Game.Modes.Catch.Objects; -using osu.Game.Modes.Objects; -using System; using System.Collections.Generic; namespace osu.Game.Modes.Catch { public class CatchDifficultyCalculator : DifficultyCalculator { - protected override PlayMode PlayMode => PlayMode.Catch; - public CatchDifficultyCalculator(Beatmap beatmap) : base(beatmap) { } - protected override HitObjectConverter Converter => new CatchConverter(); - - protected override double CalculateInternal(Dictionary categoryDifficulty) + protected override double CalculateInternal(Dictionary categoryDifficulty) { return 0; } + + protected override IBeatmapConverter CreateBeatmapConverter() => new CatchBeatmapConverter(); } } \ No newline at end of file diff --git a/osu.Game.Modes.Catch/CatchRuleset.cs b/osu.Game.Modes.Catch/CatchRuleset.cs index fd778d1ce6..50224e3fdb 100644 --- a/osu.Game.Modes.Catch/CatchRuleset.cs +++ b/osu.Game.Modes.Catch/CatchRuleset.cs @@ -1,29 +1,94 @@ // Copyright (c) 2007-2017 ppy Pty Ltd . // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE -using osu.Game.Graphics; -using osu.Game.Modes.Catch.UI; -using osu.Game.Modes.Objects; -using osu.Game.Modes.Osu.UI; -using osu.Game.Modes.UI; +using OpenTK.Input; using osu.Game.Beatmaps; +using osu.Game.Graphics; +using osu.Game.Modes.Catch.Mods; +using osu.Game.Modes.Catch.UI; +using osu.Game.Modes.Mods; +using osu.Game.Modes.UI; +using osu.Game.Screens.Play; +using System.Collections.Generic; namespace osu.Game.Modes.Catch { public class CatchRuleset : Ruleset { - public override ScoreOverlay CreateScoreOverlay() => new OsuScoreOverlay(); + public override HitRenderer CreateHitRendererWith(WorkingBeatmap beatmap) => new CatchHitRenderer(beatmap); - public override HitRenderer CreateHitRendererWith(Beatmap beatmap) => new CatchHitRenderer { Beatmap = beatmap }; + public override IEnumerable GetModsFor(ModType type) + { + switch (type) + { + case ModType.DifficultyReduction: + return new Mod[] + { + new CatchModEasy(), + new CatchModNoFail(), + new CatchModHalfTime(), + }; + + case ModType.DifficultyIncrease: + return new Mod[] + { + new CatchModHardRock(), + new MultiMod + { + Mods = new Mod[] + { + new CatchModSuddenDeath(), + new CatchModPerfect(), + }, + }, + new MultiMod + { + Mods = new Mod[] + { + new CatchModDoubleTime(), + new CatchModNightcore(), + }, + }, + new CatchModHidden(), + new CatchModFlashlight(), + }; + + case ModType.Special: + return new Mod[] + { + new CatchModRelax(), + null, + null, + new MultiMod + { + Mods = new Mod[] + { + new ModAutoplay(), + new ModCinema(), + }, + }, + }; + + default: + return new Mod[] { }; + } + } protected override PlayMode PlayMode => PlayMode.Catch; + public override string Description => "osu!catch"; + public override FontAwesome Icon => FontAwesome.fa_osu_fruits_o; - public override ScoreProcessor CreateScoreProcessor(int hitObjectCount) => null; - - public override HitObjectParser CreateHitObjectParser() => new NullHitObjectParser(); + public override IEnumerable CreateGameplayKeys() => new KeyCounter[] + { + new KeyCounterKeyboard(Key.ShiftLeft), + new KeyCounterMouse(MouseButton.Left), + new KeyCounterMouse(MouseButton.Right) + }; public override DifficultyCalculator CreateDifficultyCalculator(Beatmap beatmap) => new CatchDifficultyCalculator(beatmap); + + public override ScoreProcessor CreateScoreProcessor() => new CatchScoreProcessor(); } } diff --git a/osu.Game.Modes.Catch/CatchScoreProcessor.cs b/osu.Game.Modes.Catch/CatchScoreProcessor.cs new file mode 100644 index 0000000000..be4ae8b799 --- /dev/null +++ b/osu.Game.Modes.Catch/CatchScoreProcessor.cs @@ -0,0 +1,25 @@ +// Copyright (c) 2007-2017 ppy Pty Ltd . +// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE + +using osu.Game.Modes.Catch.Judgements; +using osu.Game.Modes.Catch.Objects; +using osu.Game.Modes.UI; + +namespace osu.Game.Modes.Catch +{ + internal class CatchScoreProcessor : ScoreProcessor + { + public CatchScoreProcessor() + { + } + + public CatchScoreProcessor(HitRenderer hitRenderer) + : base(hitRenderer) + { + } + + protected override void UpdateCalculations(CatchJudgementInfo newJudgement) + { + } + } +} diff --git a/osu.Game.Modes.Catch/Judgements/CatchJudgementInfo.cs b/osu.Game.Modes.Catch/Judgements/CatchJudgementInfo.cs new file mode 100644 index 0000000000..33e84d2f97 --- /dev/null +++ b/osu.Game.Modes.Catch/Judgements/CatchJudgementInfo.cs @@ -0,0 +1,11 @@ +// Copyright (c) 2007-2017 ppy Pty Ltd . +// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE + +using osu.Game.Modes.Judgements; + +namespace osu.Game.Modes.Catch.Judgements +{ + public class CatchJudgementInfo : JudgementInfo + { + } +} diff --git a/osu.Game.Modes.Catch/Mods/CatchMod.cs b/osu.Game.Modes.Catch/Mods/CatchMod.cs new file mode 100644 index 0000000000..97e4e58a5d --- /dev/null +++ b/osu.Game.Modes.Catch/Mods/CatchMod.cs @@ -0,0 +1,64 @@ +// Copyright (c) 2007-2017 ppy Pty Ltd . +// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE + +using osu.Game.Modes.Mods; + +namespace osu.Game.Modes.Catch.Mods +{ + public class CatchModNoFail : ModNoFail + { + + } + + public class CatchModEasy : ModEasy + { + + } + + public class CatchModHidden : ModHidden + { + public override string Description => @"Play with no approach circles and fading notes for a slight score advantage."; + public override double ScoreMultiplier => 1.06; + } + + public class CatchModHardRock : ModHardRock + { + public override double ScoreMultiplier => 1.12; + public override bool Ranked => true; + } + + public class CatchModSuddenDeath : ModSuddenDeath + { + + } + + public class CatchModDoubleTime : ModDoubleTime + { + public override double ScoreMultiplier => 1.06; + } + + public class CatchModRelax : ModRelax + { + public override string Description => @"Use the mouse to control the catcher."; + } + + public class CatchModHalfTime : ModHalfTime + { + public override double ScoreMultiplier => 0.5; + } + + public class CatchModNightcore : ModNightcore + { + public override double ScoreMultiplier => 1.06; + } + + public class CatchModFlashlight : ModFlashlight + { + public override double ScoreMultiplier => 1.12; + } + + public class CatchModPerfect : ModPerfect + { + + } +} diff --git a/osu.Game.Modes.Catch/Objects/CatchBaseHit.cs b/osu.Game.Modes.Catch/Objects/CatchBaseHit.cs index 79769710a7..ee66894d31 100644 --- a/osu.Game.Modes.Catch/Objects/CatchBaseHit.cs +++ b/osu.Game.Modes.Catch/Objects/CatchBaseHit.cs @@ -7,6 +7,6 @@ namespace osu.Game.Modes.Catch.Objects { public abstract class CatchBaseHit : HitObject { - public float Position; + public float Position { get; set; } } } diff --git a/osu.Game.Modes.Catch/Objects/CatchConverter.cs b/osu.Game.Modes.Catch/Objects/CatchConverter.cs deleted file mode 100644 index d8c2df320f..0000000000 --- a/osu.Game.Modes.Catch/Objects/CatchConverter.cs +++ /dev/null @@ -1,40 +0,0 @@ -// Copyright (c) 2007-2017 ppy Pty Ltd . -// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE - -using System.Collections.Generic; -using osu.Game.Modes.Objects; -using osu.Game.Modes.Osu.Objects; -using osu.Game.Beatmaps; - -namespace osu.Game.Modes.Catch.Objects -{ - class CatchConverter : HitObjectConverter - { - public override List Convert(Beatmap beatmap) - { - List output = new List(); - - foreach (HitObject i in beatmap.HitObjects) - { - CatchBaseHit h = i as CatchBaseHit; - - if (h == null) - { - OsuHitObject o = i as OsuHitObject; - - if (o == null) throw new HitObjectConvertException(@"Catch", i); - - h = new Fruit - { - StartTime = o.StartTime, - Position = o.Position.X, - }; - } - - output.Add(h); - } - - return output; - } - } -} diff --git a/osu.Game.Modes.Catch/Objects/Drawable/DrawableFruit.cs b/osu.Game.Modes.Catch/Objects/Drawable/DrawableFruit.cs index dea8bdfae2..5d19d902b1 100644 --- a/osu.Game.Modes.Catch/Objects/Drawable/DrawableFruit.cs +++ b/osu.Game.Modes.Catch/Objects/Drawable/DrawableFruit.cs @@ -10,7 +10,7 @@ using OpenTK; namespace osu.Game.Modes.Catch.Objects.Drawable { - class DrawableFruit : Sprite + internal class DrawableFruit : Sprite { private CatchBaseHit h; @@ -29,8 +29,10 @@ namespace osu.Game.Modes.Catch.Objects.Drawable { Texture = textures.Get(@"Menu/logo"); + double duration = 0; + Transforms.Add(new TransformPosition { 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 { StartTime = h.StartTime + h.Duration + 200, EndTime = h.StartTime + h.Duration + 400, StartValue = 1, EndValue = 0 }); + Transforms.Add(new TransformAlpha { StartTime = h.StartTime + duration + 200, EndTime = h.StartTime + duration + 400, StartValue = 1, EndValue = 0 }); Expire(true); } } diff --git a/osu.Game.Modes.Catch/UI/CatchComboCounter.cs b/osu.Game.Modes.Catch/UI/CatchComboCounter.cs deleted file mode 100644 index e0a07dc295..0000000000 --- a/osu.Game.Modes.Catch/UI/CatchComboCounter.cs +++ /dev/null @@ -1,65 +0,0 @@ -// Copyright (c) 2007-2017 ppy Pty Ltd . -// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE - -using osu.Game.Modes.Osu.UI; -using OpenTK.Graphics; - -namespace osu.Game.Modes.Catch.UI -{ - /// - /// Similar to Standard, but without the 'x' and has tinted pop-ups. Used in osu!catch. - /// - public class CatchComboCounter : OsuComboCounter - { - protected override bool CanPopOutWhileRolling => true; - - protected virtual double FadeOutDelay => 1000; - protected override double FadeOutDuration => 300; - - protected override string FormatCount(ulong count) - { - return $@"{count:#,0}"; - } - - private void animateFade() - { - Show(); - Delay(FadeOutDelay); - FadeOut(FadeOutDuration); - DelayReset(); - } - - protected override void OnCountChange(ulong currentValue, ulong newValue) - { - if (newValue != 0) - animateFade(); - base.OnCountChange(currentValue, newValue); - } - - protected override void OnCountRolling(ulong currentValue, ulong newValue) - { - if (!IsRolling) - { - PopOutCount.Colour = DisplayedCountSpriteText.Colour; - FadeOut(FadeOutDuration); - } - base.OnCountRolling(currentValue, newValue); - } - - protected override void OnCountIncrement(ulong currentValue, ulong newValue) - { - animateFade(); - base.OnCountIncrement(currentValue, newValue); - } - - /// - /// Increaces counter and tints pop-out before animation. - /// - /// Last grabbed fruit colour. - public void CatchFruit(Color4 colour) - { - PopOutCount.Colour = colour; - Count++; - } - } -} diff --git a/osu.Game.Modes.Catch/UI/CatchHitRenderer.cs b/osu.Game.Modes.Catch/UI/CatchHitRenderer.cs index 0d06ce29a7..c02b6b6c49 100644 --- a/osu.Game.Modes.Catch/UI/CatchHitRenderer.cs +++ b/osu.Game.Modes.Catch/UI/CatchHitRenderer.cs @@ -1,19 +1,30 @@ // Copyright (c) 2007-2017 ppy Pty Ltd . // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE +using osu.Game.Beatmaps; +using osu.Game.Modes.Catch.Beatmaps; +using osu.Game.Modes.Catch.Judgements; using osu.Game.Modes.Catch.Objects; -using osu.Game.Modes.Objects; using osu.Game.Modes.Objects.Drawables; using osu.Game.Modes.UI; namespace osu.Game.Modes.Catch.UI { - public class CatchHitRenderer : HitRenderer + public class CatchHitRenderer : HitRenderer { - protected override HitObjectConverter Converter => new CatchConverter(); + public CatchHitRenderer(WorkingBeatmap beatmap) + : base(beatmap) + { + } - protected override Playfield CreatePlayfield() => new CatchPlayfield(); + public override ScoreProcessor CreateScoreProcessor() => new CatchScoreProcessor(this); - protected override DrawableHitObject GetVisualRepresentation(CatchBaseHit h) => null;// new DrawableFruit(h); + protected override IBeatmapConverter CreateBeatmapConverter() => new CatchBeatmapConverter(); + + protected override IBeatmapProcessor CreateBeatmapProcessor() => new CatchBeatmapProcessor(); + + protected override Playfield CreatePlayfield() => new CatchPlayfield(); + + protected override DrawableHitObject GetVisualRepresentation(CatchBaseHit h) => null; } } diff --git a/osu.Game.Modes.Catch/UI/CatchPlayfield.cs b/osu.Game.Modes.Catch/UI/CatchPlayfield.cs index cf69ab4fe2..eba8734eaf 100644 --- a/osu.Game.Modes.Catch/UI/CatchPlayfield.cs +++ b/osu.Game.Modes.Catch/UI/CatchPlayfield.cs @@ -3,12 +3,14 @@ using osu.Framework.Graphics; using osu.Framework.Graphics.Sprites; +using osu.Game.Modes.Catch.Objects; using osu.Game.Modes.UI; using OpenTK; +using osu.Game.Modes.Catch.Judgements; namespace osu.Game.Modes.Catch.UI { - public class CatchPlayfield : Playfield + public class CatchPlayfield : Playfield { public CatchPlayfield() { diff --git a/osu.Game.Modes.Catch/osu.Game.Modes.Catch.csproj b/osu.Game.Modes.Catch/osu.Game.Modes.Catch.csproj index 6b37963da1..a32416173d 100644 --- a/osu.Game.Modes.Catch/osu.Game.Modes.Catch.csproj +++ b/osu.Game.Modes.Catch/osu.Game.Modes.Catch.csproj @@ -47,17 +47,20 @@ + + + + - - + diff --git a/osu.Game.Modes.Catch/packages.config b/osu.Game.Modes.Catch/packages.config index 4031dd62a8..08fca09c35 100644 --- a/osu.Game.Modes.Catch/packages.config +++ b/osu.Game.Modes.Catch/packages.config @@ -1,4 +1,5 @@  + - - - - - - - - - - \ No newline at end of file diff --git a/osu.Game.Modes.Mania/osu.Game.Modes.Mania.csproj b/osu.Game.Modes.Mania/osu.Game.Modes.Mania.csproj index b9b7e35ae7..8b78929510 100644 --- a/osu.Game.Modes.Mania/osu.Game.Modes.Mania.csproj +++ b/osu.Game.Modes.Mania/osu.Game.Modes.Mania.csproj @@ -47,17 +47,20 @@ + + + + - - + @@ -81,10 +84,10 @@ osu.licenseheader - + - - - - - - - - - - diff --git a/osu.Game.Modes.Osu/osu.Game.Modes.Osu.csproj b/osu.Game.Modes.Osu/osu.Game.Modes.Osu.csproj index 1d3ee7a6a4..12135a38fb 100644 --- a/osu.Game.Modes.Osu/osu.Game.Modes.Osu.csproj +++ b/osu.Game.Modes.Osu/osu.Game.Modes.Osu.csproj @@ -43,11 +43,12 @@ - - + + + @@ -67,24 +68,22 @@ - - + + - - - + @@ -100,7 +99,6 @@ osu.licenseheader - diff --git a/osu.Game.Modes.Osu/packages.config b/osu.Game.Modes.Osu/packages.config index 4031dd62a8..08fca09c35 100644 --- a/osu.Game.Modes.Osu/packages.config +++ b/osu.Game.Modes.Osu/packages.config @@ -1,4 +1,5 @@  + - - - - - - - - - - \ No newline at end of file diff --git a/osu.Game.Tests/osu.Game.Tests.csproj b/osu.Game.Tests/osu.Game.Tests.csproj index 009cafe59e..d01aa77e02 100644 --- a/osu.Game.Tests/osu.Game.Tests.csproj +++ b/osu.Game.Tests/osu.Game.Tests.csproj @@ -38,10 +38,6 @@ True - - $(SolutionDir)\packages\NUnit.3.5.0\lib\nunit.framework.dll - - $(SolutionDir)\packages\SQLite.Net.Core-PCL.3.1.1\lib\portable-win8+net45+wp8+wpa81+MonoAndroid1+MonoTouch1\SQLite.Net.dll @@ -56,7 +52,6 @@ osu.licenseheader - diff --git a/osu.Game.Tests/packages.config b/osu.Game.Tests/packages.config index c3be99dfd1..ca53ef08b0 100644 --- a/osu.Game.Tests/packages.config +++ b/osu.Game.Tests/packages.config @@ -1,4 +1,5 @@  +