diff --git a/.gitignore b/.gitignore index aa8061f0c9..7097de6024 100644 --- a/.gitignore +++ b/.gitignore @@ -255,4 +255,5 @@ paket-files/ # Python Tools for Visual Studio (PTVS) __pycache__/ -*.pyc \ No newline at end of file +*.pyc +Staging/ diff --git a/osu-framework b/osu-framework index 1cd7a165ec..a766d283f4 160000 --- a/osu-framework +++ b/osu-framework @@ -1 +1 @@ -Subproject commit 1cd7a165ec42cd1eeb4eee06b5a4a6cdd8c280da +Subproject commit a766d283f4d628736db784001cc1f11d065cab9d diff --git a/osu.Desktop.Deploy/App.config b/osu.Desktop.Deploy/App.config new file mode 100644 index 0000000000..6272e396fb --- /dev/null +++ b/osu.Desktop.Deploy/App.config @@ -0,0 +1,28 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/osu.Desktop.Deploy/GitHubObject.cs b/osu.Desktop.Deploy/GitHubObject.cs new file mode 100644 index 0000000000..f87de5cbdd --- /dev/null +++ b/osu.Desktop.Deploy/GitHubObject.cs @@ -0,0 +1,13 @@ +using Newtonsoft.Json; + +namespace osu.Desktop.Deploy +{ + internal class GitHubObject + { + [JsonProperty(@"id")] + public int Id; + + [JsonProperty(@"name")] + public string Name; + } +} \ No newline at end of file diff --git a/osu.Desktop.Deploy/GitHubRelease.cs b/osu.Desktop.Deploy/GitHubRelease.cs new file mode 100644 index 0000000000..7e7b04fe58 --- /dev/null +++ b/osu.Desktop.Deploy/GitHubRelease.cs @@ -0,0 +1,25 @@ +using Newtonsoft.Json; + +namespace osu.Desktop.Deploy +{ + internal class GitHubRelease + { + [JsonProperty(@"id")] + public int Id; + + [JsonProperty(@"tag_name")] + public string TagName => $"v{Name}"; + + [JsonProperty(@"name")] + public string Name; + + [JsonProperty(@"draft")] + public bool Draft; + + [JsonProperty(@"prerelease")] + public bool PreRelease; + + [JsonProperty(@"upload_url")] + public string UploadUrl; + } +} \ No newline at end of file diff --git a/osu.Desktop.Deploy/Program.cs b/osu.Desktop.Deploy/Program.cs new file mode 100644 index 0000000000..3cd9c80365 --- /dev/null +++ b/osu.Desktop.Deploy/Program.cs @@ -0,0 +1,420 @@ +// Copyright (c) 2007-2017 ppy Pty Ltd . +// Licensed under the MIT Licence - https://raw.GitHubusercontent.com/ppy/osu-framework/master/LICENCE + +using System; +using System.Collections.Generic; +using System.Configuration; +using System.Diagnostics; +using System.IO; +using System.Linq; +using System.Net; +using Newtonsoft.Json; +using osu.Framework.IO.Network; +using FileWebRequest = osu.Framework.IO.Network.FileWebRequest; +using WebRequest = osu.Framework.IO.Network.WebRequest; + +namespace osu.Desktop.Deploy +{ + internal static class Program + { + private const string nuget_path = @"packages\NuGet.CommandLine.3.5.0\tools\NuGet.exe"; + private const string squirrel_path = @"packages\squirrel.windows.1.5.2\tools\Squirrel.exe"; + private const string msbuild_path = @"C:\Program Files (x86)\MSBuild\14.0\Bin\MSBuild.exe"; + + public static string StagingFolder = ConfigurationManager.AppSettings["StagingFolder"]; + public static string ReleasesFolder = ConfigurationManager.AppSettings["ReleasesFolder"]; + public static string GitHubAccessToken = ConfigurationManager.AppSettings["GitHubAccessToken"]; + public static string GitHubUsername = ConfigurationManager.AppSettings["GitHubUsername"]; + public static string GitHubRepoName = ConfigurationManager.AppSettings["GitHubRepoName"]; + public static string SolutionName = ConfigurationManager.AppSettings["SolutionName"]; + public static string ProjectName = ConfigurationManager.AppSettings["ProjectName"]; + public static string NuSpecName = ConfigurationManager.AppSettings["NuSpecName"]; + public static string TargetName = ConfigurationManager.AppSettings["TargetName"]; + public static string PackageName = ConfigurationManager.AppSettings["PackageName"]; + public static string IconName = ConfigurationManager.AppSettings["IconName"]; + public static string CodeSigningCertificate = ConfigurationManager.AppSettings["CodeSigningCertificate"]; + + public static string GitHubApiEndpoint => $"https://api.github.com/repos/{GitHubUsername}/{GitHubRepoName}/releases"; + public static string GitHubReleasePage => $"https://github.com/{GitHubUsername}/{GitHubRepoName}/releases"; + + /// + /// How many previous build deltas we want to keep when publishing. + /// + 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\""; + + private static string homeDir => Environment.GetFolderPath(Environment.SpecialFolder.UserProfile); + private static string codeSigningCertPath => Path.Combine(homeDir, CodeSigningCertificate); + private static string solutionPath => Environment.CurrentDirectory; + private static string stagingPath => Path.Combine(solutionPath, StagingFolder); + private static string iconPath => Path.Combine(solutionPath, ProjectName, IconName); + + private static string nupkgFilename(string ver) => $"{PackageName}.{ver}.nupkg"; + private static string nupkgDistroFilename(string ver) => $"{PackageName}-{ver}-full.nupkg"; + + private static Stopwatch sw = new Stopwatch(); + + private static string codeSigningPassword; + + public static void Main(string[] args) + { + displayHeader(); + + findSolutionPath(); + + if (!Directory.Exists(ReleasesFolder)) + { + write("WARNING: No release directory found. Make sure you want this!", ConsoleColor.Yellow); + Directory.CreateDirectory(ReleasesFolder); + } + + checkGitHubReleases(); + + refreshDirectory(StagingFolder); + + //increment build number until we have a unique one. + string verBase = DateTime.Now.ToString("yyyy.Md."); + int increment = 0; + while (Directory.GetFiles(ReleasesFolder, $"*{verBase}{increment}*").Any()) + increment++; + + string version = $"{verBase}{increment}"; + + Console.ForegroundColor = ConsoleColor.White; + Console.Write($"Ready to deploy {version}: "); + Console.ReadLine(); + + sw.Start(); + + if (!string.IsNullOrEmpty(CodeSigningCertificate)) + { + Console.Write("Enter code signing password: "); + codeSigningPassword = readLineMasked(); + } + + write("Restoring NuGet packages..."); + runCommand(nuget_path, "restore " + solutionPath); + + write("Updating AssemblyInfo..."); + updateAssemblyInfo(version); + + write("Running build process..."); + runCommand(msbuild_path, $"/v:quiet /m /t:{TargetName.Replace('.', '_')} /p:OutputPath={stagingPath};Configuration=Release {SolutionName}.sln"); + + write("Creating NuGet deployment package..."); + runCommand(nuget_path, $"pack {NuSpecName} -Version {version} -Properties Configuration=Deploy -OutputDirectory {stagingPath} -BasePath {stagingPath}"); + + //prune once before checking for files so we can avoid erroring on files which aren't even needed for this build. + pruneReleases(); + + checkReleaseFiles(); + + write("Running squirrel build..."); + runCommand(squirrel_path, $"--releasify {stagingPath}\\{nupkgFilename(version)} --setupIcon {iconPath} --icon {iconPath} {codeSigningCmd} --no-msi"); + + //prune again to clean up before upload. + pruneReleases(); + + //rename setup to install. + File.Copy(Path.Combine(ReleasesFolder, "Setup.exe"), Path.Combine(ReleasesFolder, "install.exe"), true); + File.Delete(Path.Combine(ReleasesFolder, "Setup.exe")); + + uploadBuild(version); + + //reset assemblyinfo. + updateAssemblyInfo("0.0.0"); + + write("Done!", ConsoleColor.White); + Console.ReadLine(); + } + + private static void displayHeader() + { + Console.ForegroundColor = ConsoleColor.Red; + Console.WriteLine(); + Console.WriteLine(" Please note that OSU! and PPY are registered trademarks and as such covered by trademark law."); + Console.WriteLine(" Do not distribute builds of this project publicly that make use of these."); + Console.ResetColor(); + Console.WriteLine(); + } + + /// + /// Ensure we have all the files in the release directory which are expected to be there. + /// This should have been accounted for in earlier steps, and just serves as a verification step. + /// + private static void checkReleaseFiles() + { + var releaseLines = getReleaseLines(); + + //ensure we have all files necessary + foreach (var l in releaseLines) + if (!File.Exists(Path.Combine(ReleasesFolder, l.Filename))) + error($"Local file missing {l.Filename}"); + } + + private static IEnumerable getReleaseLines() => File.ReadAllLines(Path.Combine(ReleasesFolder, "RELEASES")).Select(l => new ReleaseLine(l)); + + private static void pruneReleases() + { + write("Pruning RELEASES..."); + + var releaseLines = getReleaseLines().ToList(); + + var fulls = releaseLines.Where(l => l.Filename.Contains("-full")).Reverse().Skip(1); + + //remove any FULL releases (except most recent) + foreach (var l in fulls) + { + write($"- Removing old release {l.Filename}", ConsoleColor.Yellow); + File.Delete(Path.Combine(ReleasesFolder, l.Filename)); + releaseLines.Remove(l); + } + + //remove excess deltas + var deltas = releaseLines.Where(l => l.Filename.Contains("-delta")); + if (deltas.Count() > keep_delta_count) + { + foreach (var l in deltas.Take(deltas.Count() - keep_delta_count)) + { + write($"- Removing old delta {l.Filename}", ConsoleColor.Yellow); + File.Delete(Path.Combine(ReleasesFolder, l.Filename)); + releaseLines.Remove(l); + } + } + + var lines = new List(); + releaseLines.ForEach(l => lines.Add(l.ToString())); + File.WriteAllLines(Path.Combine(ReleasesFolder, "RELEASES"), lines); + } + + private static void uploadBuild(string version) + { + if (string.IsNullOrEmpty(GitHubAccessToken) || string.IsNullOrEmpty(codeSigningCertPath)) + return; + + write("Publishing to GitHub..."); + + write($"- Creating release {version}...", ConsoleColor.Yellow); + var req = new JsonWebRequest($"{GitHubApiEndpoint}") + { + Method = HttpMethod.POST + }; + req.AddRaw(JsonConvert.SerializeObject(new GitHubRelease + { + Name = version, + Draft = true, + PreRelease = true + })); + req.AuthenticatedBlockingPerform(); + + var assetUploadUrl = req.ResponseObject.UploadUrl.Replace("{?name,label}", "?name={0}"); + foreach (var a in Directory.GetFiles(ReleasesFolder).Reverse()) //reverse to upload RELEASES first. + { + write($"- Adding asset {a}...", ConsoleColor.Yellow); + var upload = new WebRequest(assetUploadUrl, Path.GetFileName(a)) + { + Method = HttpMethod.POST, + ContentType = "application/octet-stream", + }; + + upload.AddRaw(File.ReadAllBytes(a)); + upload.AuthenticatedBlockingPerform(); + } + + openGitHubReleasePage(); + } + + private static void openGitHubReleasePage() => Process.Start(GitHubReleasePage); + + private static void checkGitHubReleases() + { + write("Checking GitHub releases..."); + var req = new JsonWebRequest>($"{GitHubApiEndpoint}"); + req.AuthenticatedBlockingPerform(); + + var lastRelease = req.ResponseObject.FirstOrDefault(); + + if (lastRelease == null) + return; + + if (lastRelease.Draft) + { + openGitHubReleasePage(); + error("There's a pending draft release! You probably don't want to push a build with this present."); + } + + //there's a previous release for this project. + var assetReq = new JsonWebRequest>($"{GitHubApiEndpoint}/{lastRelease.Id}/assets"); + assetReq.AuthenticatedBlockingPerform(); + var assets = assetReq.ResponseObject; + + //make sure our RELEASES file is the same as the last build on the server. + var releaseAsset = assets.FirstOrDefault(a => a.Name == "RELEASES"); + + //if we don't have a RELEASES asset then the previous release likely wasn't a Squirrel one. + if (releaseAsset == null) return; + + write($"Last GitHub release was {lastRelease.Name}."); + + bool requireDownload = false; + + if (!File.Exists(Path.Combine(ReleasesFolder, nupkgDistroFilename(lastRelease.Name)))) + { + write("Last verion's package not found locally.", ConsoleColor.Red); + requireDownload = true; + } + else + { + var lastReleases = new RawFileWebRequest($"{GitHubApiEndpoint}/assets/{releaseAsset.Id}"); + lastReleases.AuthenticatedBlockingPerform(); + if (File.ReadAllText(Path.Combine(ReleasesFolder, "RELEASES")) != lastReleases.ResponseString) + { + write("Server's RELEASES differed from ours.", ConsoleColor.Red); + requireDownload = true; + } + } + + if (!requireDownload) return; + + write("Refreshing local releases directory..."); + refreshDirectory(ReleasesFolder); + + foreach (var a in assets) + { + write($"- Downloading {a.Name}...", ConsoleColor.Yellow); + new FileWebRequest(Path.Combine(ReleasesFolder, a.Name), $"{GitHubApiEndpoint}/assets/{a.Id}").AuthenticatedBlockingPerform(); + } + } + + private static void refreshDirectory(string directory) + { + if (Directory.Exists(directory)) + Directory.Delete(directory, true); + Directory.CreateDirectory(directory); + } + + private static void updateAssemblyInfo(string version) + { + string file = Path.Combine(ProjectName, "Properties", "AssemblyInfo.cs"); + + var l1 = File.ReadAllLines(file); + List l2 = new List(); + foreach (var l in l1) + { + if (l.StartsWith("[assembly: AssemblyVersion(")) + l2.Add($"[assembly: AssemblyVersion(\"{version}\")]"); + else if (l.StartsWith("[assembly: AssemblyFileVersion(")) + l2.Add($"[assembly: AssemblyFileVersion(\"{version}\")]"); + else + l2.Add(l); + } + + File.WriteAllLines(file, l2); + } + + /// + /// Find the base path of the active solution (git checkout location) + /// + private static void findSolutionPath() + { + string path = Path.GetDirectoryName(Environment.CommandLine.Replace("\"", "").Trim()); + + if (string.IsNullOrEmpty(path)) + path = Environment.CurrentDirectory; + + while (!File.Exists(Path.Combine(path, $"{SolutionName}.sln"))) + path = path.Remove(path.LastIndexOf('\\')); + path += "\\"; + + Environment.CurrentDirectory = path; + } + + private static bool runCommand(string command, string args) + { + var psi = new ProcessStartInfo(command, args) + { + WorkingDirectory = solutionPath, + CreateNoWindow = true, + RedirectStandardOutput = true, + UseShellExecute = false, + WindowStyle = ProcessWindowStyle.Hidden + }; + + Process p = Process.Start(psi); + string output = p.StandardOutput.ReadToEnd(); + if (p.ExitCode == 0) return true; + + write(output); + error($"Command {command} {args} failed!"); + return false; + } + + private static string readLineMasked() + { + var fg = Console.ForegroundColor; + Console.ForegroundColor = Console.BackgroundColor; + var ret = Console.ReadLine(); + Console.ForegroundColor = fg; + + return ret; + } + + private static void error(string message) + { + Console.ForegroundColor = ConsoleColor.Red; + Console.WriteLine($"FATAL ERROR: {message}"); + + Console.ReadLine(); + Environment.Exit(-1); + } + + private static void write(string message, ConsoleColor col = ConsoleColor.Gray) + { + if (sw.ElapsedMilliseconds > 0) + { + Console.ForegroundColor = ConsoleColor.Green; + Console.Write(sw.ElapsedMilliseconds.ToString().PadRight(8)); + } + Console.ForegroundColor = col; + Console.WriteLine(message); + } + + public static void AuthenticatedBlockingPerform(this WebRequest r) + { + r.AddHeader("Authorization", $"token {GitHubAccessToken}"); + r.BlockingPerform(); + } + } + + internal class RawFileWebRequest : WebRequest + { + public RawFileWebRequest(string url) : base(url) + { + } + + protected override HttpWebRequest CreateWebRequest(string requestString = null) + { + var req = base.CreateWebRequest(requestString); + req.Accept = "application/octet-stream"; + return req; + } + } + + internal class ReleaseLine + { + public string Hash; + public string Filename; + public int Filesize; + + public ReleaseLine(string line) + { + var split = line.Split(' '); + Hash = split[0]; + Filename = split[1]; + Filesize = int.Parse(split[2]); + } + + public override string ToString() => $"{Hash} {Filename} {Filesize}"; + } +} diff --git a/osu.Desktop.Deploy/Properties/AssemblyInfo.cs b/osu.Desktop.Deploy/Properties/AssemblyInfo.cs new file mode 100644 index 0000000000..c71d82df00 --- /dev/null +++ b/osu.Desktop.Deploy/Properties/AssemblyInfo.cs @@ -0,0 +1,36 @@ +using System.Reflection; +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; + +// General Information about an assembly is controlled through the following +// set of attributes. Change these attribute values to modify the information +// associated with an assembly. +[assembly: AssemblyTitle("osu.Desktop.Deploy")] +[assembly: AssemblyDescription("")] +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("")] +[assembly: AssemblyProduct("osu.Desktop.Deploy")] +[assembly: AssemblyCopyright("Copyright © 2017")] +[assembly: AssemblyTrademark("")] +[assembly: AssemblyCulture("")] + +// Setting ComVisible to false makes the types in this assembly not visible +// to COM components. If you need to access a type in this assembly from +// COM, set the ComVisible attribute to true on that type. +[assembly: ComVisible(false)] + +// The following GUID is for the ID of the typelib if this project is exposed to COM +[assembly: Guid("baea2f74-0315-4667-84e0-acac0b4bf785")] + +// Version information for an assembly consists of the following four values: +// +// Major Version +// Minor Version +// Build Number +// Revision +// +// You can specify all the values or you can default the Build and Revision Numbers +// by using the '*' as shown below: +// [assembly: AssemblyVersion("1.0.*")] +[assembly: AssemblyVersion("1.0.0.0")] +[assembly: AssemblyFileVersion("1.0.0.0")] diff --git a/osu.Desktop.Deploy/osu.Desktop.Deploy.csproj b/osu.Desktop.Deploy/osu.Desktop.Deploy.csproj new file mode 100644 index 0000000000..122c2ec0d6 --- /dev/null +++ b/osu.Desktop.Deploy/osu.Desktop.Deploy.csproj @@ -0,0 +1,125 @@ + + + + + Debug + AnyCPU + {BAEA2F74-0315-4667-84E0-ACAC0B4BF785} + Exe + Properties + osu.Desktop.Deploy + osu.Desktop.Deploy + v4.5.2 + 512 + true + + + AnyCPU + true + full + false + bin\Debug\ + DEBUG;TRACE + prompt + 4 + + + AnyCPU + pdbonly + true + bin\Release\ + TRACE + prompt + 4 + + + osu.Desktop.Deploy.Program + + + + ..\packages\DeltaCompressionDotNet.1.0.0\lib\net45\DeltaCompressionDotNet.dll + True + + + ..\packages\DeltaCompressionDotNet.1.0.0\lib\net45\DeltaCompressionDotNet.MsDelta.dll + True + + + ..\packages\DeltaCompressionDotNet.1.0.0\lib\net45\DeltaCompressionDotNet.PatchApi.dll + True + + + ..\packages\squirrel.windows.1.5.2\lib\Net45\ICSharpCode.SharpZipLib.dll + True + + + ..\packages\Mono.Cecil.0.9.6.1\lib\net45\Mono.Cecil.dll + True + + + ..\packages\Mono.Cecil.0.9.6.1\lib\net45\Mono.Cecil.Mdb.dll + True + + + ..\packages\Mono.Cecil.0.9.6.1\lib\net45\Mono.Cecil.Pdb.dll + True + + + ..\packages\Mono.Cecil.0.9.6.1\lib\net45\Mono.Cecil.Rocks.dll + True + + + ..\packages\Newtonsoft.Json.9.0.1\lib\net45\Newtonsoft.Json.dll + True + + + ..\packages\squirrel.windows.1.5.2\lib\Net45\NuGet.Squirrel.dll + True + + + ..\packages\Splat.1.6.2\lib\Net45\Splat.dll + True + + + ..\packages\squirrel.windows.1.5.2\lib\Net45\Squirrel.dll + True + + + + + + + + + + + + + + + + + + + + + + + + {65dc628f-a640-4111-ab35-3a5652bc1e17} + osu.Framework.Desktop + + + {C76BF5B3-985E-4D39-95FE-97C9C879B83A} + osu.Framework + + + + + \ No newline at end of file diff --git a/osu.Desktop.Deploy/packages.config b/osu.Desktop.Deploy/packages.config new file mode 100644 index 0000000000..b7c4b9c3bb --- /dev/null +++ b/osu.Desktop.Deploy/packages.config @@ -0,0 +1,9 @@ + + + + + + + + + \ No newline at end of file diff --git a/osu.Desktop.Tests/app.config b/osu.Desktop.Tests/app.config index 44ccc4b77a..b9af3fdc80 100644 --- a/osu.Desktop.Tests/app.config +++ b/osu.Desktop.Tests/app.config @@ -1,4 +1,8 @@  + diff --git a/osu.Desktop.Tests/osu.Desktop.Tests.csproj b/osu.Desktop.Tests/osu.Desktop.Tests.csproj index 2c88548c3e..7a5bd59074 100644 --- a/osu.Desktop.Tests/osu.Desktop.Tests.csproj +++ b/osu.Desktop.Tests/osu.Desktop.Tests.csproj @@ -100,6 +100,9 @@ + + osu.licenseheader + diff --git a/osu.Desktop.Tests/packages.config b/osu.Desktop.Tests/packages.config index 05b53c019c..76b22db9d4 100644 --- a/osu.Desktop.Tests/packages.config +++ b/osu.Desktop.Tests/packages.config @@ -1,4 +1,8 @@  + diff --git a/osu.Desktop.VisualTests/OpenTK.dll.config b/osu.Desktop.VisualTests/OpenTK.dll.config index 1dd145f0c4..627e9f6009 100644 --- a/osu.Desktop.VisualTests/OpenTK.dll.config +++ b/osu.Desktop.VisualTests/OpenTK.dll.config @@ -1,8 +1,7 @@ - diff --git a/osu.Desktop.VisualTests/Tests/TestCaseHitObjects.cs b/osu.Desktop.VisualTests/Tests/TestCaseHitObjects.cs index 7ca51f8af3..1e3d8df6c6 100644 --- a/osu.Desktop.VisualTests/Tests/TestCaseHitObjects.cs +++ b/osu.Desktop.VisualTests/Tests/TestCaseHitObjects.cs @@ -1,18 +1,23 @@ // 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.Framework; using osu.Framework.GameModes.Testing; using osu.Framework.Graphics; using osu.Framework.Timing; using OpenTK; using osu.Framework.Allocation; +using osu.Framework.Configuration; using osu.Game.Modes.Objects; using osu.Game.Modes.Objects.Drawables; using osu.Game.Modes.Osu.Objects; using osu.Game.Modes.Osu.Objects.Drawables; using osu.Framework.Graphics.Containers; +using osu.Framework.Graphics.Sprites; +using osu.Framework.Graphics.UserInterface; using osu.Game.Modes; +using OpenTK.Graphics; namespace osu.Desktop.VisualTests.Tests { @@ -20,44 +25,124 @@ namespace osu.Desktop.VisualTests.Tests { public override string Name => @"Hit Objects"; + private StopwatchClock rateAdjustClock; + private FramedClock framedClock; + + bool auto = false; + public TestCaseHitObjects() { - var swClock = new StopwatchClock(true) { Rate = 0.2f }; - Clock = new FramedClock(swClock); + rateAdjustClock = new StopwatchClock(true); + framedClock = new FramedClock(rateAdjustClock); + playbackSpeed.ValueChanged += delegate { rateAdjustClock.Rate = playbackSpeed.Value; }; + } + + HitObjectType mode = HitObjectType.Spinner; + + BindableNumber playbackSpeed = new BindableDouble(0.5) { MinValue = 0, MaxValue = 1 }; + private Container playfieldContainer; + private Container approachContainer; + + private void load(HitObjectType mode) + { + this.mode = mode; + + switch (mode) + { + case HitObjectType.Circle: + const int count = 10; + + for (int i = 0; i < count; i++) + { + var h = new HitCircle + { + StartTime = framedClock.CurrentTime + 600 + i * 80, + Position = new Vector2((i - count / 2) * 14), + }; + + add(new DrawableHitCircle(h)); + } + break; + case HitObjectType.Slider: + add(new DrawableSlider(new Slider + { + StartTime = framedClock.CurrentTime + 600, + ControlPoints = new List() + { + new Vector2(-200, 0), + new Vector2(400, 0), + }, + Length = 400, + Position = new Vector2(-200, 0), + Velocity = 1, + })); + break; + case HitObjectType.Spinner: + add(new DrawableSpinner(new Spinner + { + StartTime = framedClock.CurrentTime + 600, + Length = 1000, + Position = new Vector2(0, 0), + })); + break; + } } public override void Reset() { base.Reset(); - Clock.ProcessFrame(); + playbackSpeed.TriggerChange(); - Container approachContainer = new Container { Depth = float.MinValue, }; + AddButton(@"circles", () => load(HitObjectType.Circle)); + AddButton(@"slider", () => load(HitObjectType.Slider)); + AddButton(@"spinner", () => load(HitObjectType.Spinner)); - Add(approachContainer); + AddToggle(@"auto", () => { auto = !auto; load(mode); }); - const int count = 10; - - for (int i = 0; i < count; i++) + ButtonsContainer.Add(new SpriteText { Text = "Playback Speed" }); + ButtonsContainer.Add(new BasicSliderBar { - var h = new HitCircle + Width = 150, + Height = 10, + SelectionColor = Color4.Orange, + Bindable = playbackSpeed + }); + + framedClock.ProcessFrame(); + + var clockAdjustContainer = new Container + { + RelativeSizeAxes = Axes.Both, + Clock = framedClock, + Children = new[] { - StartTime = Clock.CurrentTime + 600 + i * 80, - Position = new Vector2((i - count / 2) * 14), - }; + playfieldContainer = new Container { RelativeSizeAxes = Axes.Both }, + approachContainer = new Container { RelativeSizeAxes = Axes.Both } + } + }; - DrawableHitCircle d = new DrawableHitCircle(h) - { - Anchor = Anchor.Centre, - Depth = i, - State = ArmedState.Hit, - Judgement = new OsuJudgementInfo { Result = HitResult.Hit } - }; + Add(clockAdjustContainer); + load(mode); + } - approachContainer.Add(d.ApproachCircle.CreateProxy()); - Add(d); + int depth; + void add(DrawableHitObject h) + { + h.Anchor = Anchor.Centre; + h.Depth = depth++; + + if (auto) + { + h.State = ArmedState.Hit; + h.Judgement = new OsuJudgementInfo { Result = HitResult.Hit }; } + + playfieldContainer.Add(h); + var proxyable = h as IDrawableHitObjectWithProxiedApproach; + if (proxyable != null) + approachContainer.Add(proxyable.ProxiedLayer.CreateProxy()); } } } diff --git a/osu.Desktop.VisualTests/Tests/TestCaseNotificationManager.cs b/osu.Desktop.VisualTests/Tests/TestCaseNotificationManager.cs index 77b313f4ad..0b84eeaa30 100644 --- a/osu.Desktop.VisualTests/Tests/TestCaseNotificationManager.cs +++ b/osu.Desktop.VisualTests/Tests/TestCaseNotificationManager.cs @@ -26,8 +26,6 @@ namespace osu.Desktop.VisualTests.Tests progressingNotifications.Clear(); - AddInternal(new BackgroundModeDefault() { Depth = 10 }); - Content.Add(manager = new NotificationManager { Anchor = Anchor.TopRight, diff --git a/osu.Desktop.VisualTests/VisualTestGame.cs b/osu.Desktop.VisualTests/VisualTestGame.cs index 952de4ab26..51fcffce57 100644 --- a/osu.Desktop.VisualTests/VisualTestGame.cs +++ b/osu.Desktop.VisualTests/VisualTestGame.cs @@ -11,6 +11,7 @@ using System.Reflection; using System.IO; using System.Collections.Generic; using osu.Framework.Allocation; +using osu.Game.Screens.Backgrounds; namespace osu.Desktop.VisualTests { @@ -20,6 +21,8 @@ namespace osu.Desktop.VisualTests { base.LoadComplete(); + (new BackgroundModeDefault() { Depth = 10 }).Preload(this, AddInternal); + // Have to construct this here, rather than in the constructor, because // we depend on some dependencies to be loaded within OsuGameBase.load(). Add(new TestBrowser()); diff --git a/osu.Desktop.VisualTests/app.config b/osu.Desktop.VisualTests/app.config index 9bad888bf3..b9af3fdc80 100644 --- a/osu.Desktop.VisualTests/app.config +++ b/osu.Desktop.VisualTests/app.config @@ -1,9 +1,8 @@  - diff --git a/osu.Desktop.VisualTests/packages.config b/osu.Desktop.VisualTests/packages.config index 75affafd35..82404c059e 100644 --- a/osu.Desktop.VisualTests/packages.config +++ b/osu.Desktop.VisualTests/packages.config @@ -1,6 +1,6 @@  diff --git a/osu.Desktop/Overlays/VersionManager.cs b/osu.Desktop/Overlays/VersionManager.cs index f941401f43..6c34838130 100644 --- a/osu.Desktop/Overlays/VersionManager.cs +++ b/osu.Desktop/Overlays/VersionManager.cs @@ -1,4 +1,8 @@ -using osu.Framework.Allocation; +// Copyright (c) 2007-2017 ppy Pty Ltd . +// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE + +using System.Diagnostics; +using osu.Framework.Allocation; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Game.Graphics.Sprites; @@ -6,6 +10,11 @@ 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; namespace osu.Desktop.Overlays { @@ -14,20 +23,77 @@ namespace osu.Desktop.Overlays private UpdateManager updateManager; private NotificationManager notification; + protected override bool HideOnEscape => false; + + public override bool HandleInput => false; + [BackgroundDependencyLoader] - private void load(NotificationManager notification) + private void load(NotificationManager notification, OsuColour colours, TextureStore textures) { this.notification = notification; AutoSizeAxes = Axes.Both; Anchor = Anchor.BottomCentre; Origin = Anchor.BottomCentre; + Alpha = 0; + + bool isDebug = false; + Debug.Assert(isDebug = true); var asm = Assembly.GetEntryAssembly().GetName(); - Add(new OsuSpriteText + string version; + if (asm.Version.Major == 0) { - Text = $@"osu!lazer v{asm.Version}" - }); + version = @"local " + (isDebug ? @"debug" : @"release"); + } + else + version = $@"{asm.Version.Major}.{asm.Version.Minor}.{asm.Version.Build}"; + + Children = new Drawable[] + { + new FlowContainer + { + AutoSizeAxes = Axes.Both, + Direction = FlowDirections.Vertical, + Children = new Drawable[] + { + new FlowContainer + { + AutoSizeAxes = Axes.Both, + Direction = FlowDirections.Horizontal, + Anchor = Anchor.TopCentre, + Origin = Anchor.TopCentre, + Spacing = new Vector2(5), + Children = new Drawable[] + { + new OsuSpriteText + { + Font = @"Exo2.0-Bold", + Text = $@"osu!lazer" + }, + new OsuSpriteText + { + Colour = isDebug ? colours.Red : Color4.White, + Text = version + }, + } + }, + new OsuSpriteText + { + Anchor = Anchor.TopCentre, + Origin = Anchor.TopCentre, + TextSize = 12, + Colour = colours.Yellow, + Font = @"Venera", + Text = $@"Development Build" + }, + new Sprite + { + Texture = textures.Get(@"Menu/dev-build-footer"), + }, + } + } + }; updateChecker(); } @@ -75,6 +141,7 @@ namespace osu.Desktop.Overlays protected override void PopIn() { + FadeIn(1000); } protected override void PopOut() diff --git a/osu.Desktop/Properties/AssemblyInfo.cs b/osu.Desktop/Properties/AssemblyInfo.cs index 1f234d2993..17329d8ac0 100644 --- a/osu.Desktop/Properties/AssemblyInfo.cs +++ b/osu.Desktop/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.CompilerServices; using System.Runtime.InteropServices; @@ -22,5 +25,5 @@ using System.Runtime.InteropServices; // The following GUID is for the ID of the typelib if this project is exposed to COM [assembly: Guid("55e28cb2-7b6c-4595-8dcc-9871d8aad7e9")] -[assembly: AssemblyVersion("0.0.5")] -[assembly: AssemblyFileVersion("0.0.5")] +[assembly: AssemblyVersion("0.0.0")] +[assembly: AssemblyFileVersion("0.0.0")] diff --git a/osu.Desktop/app.config b/osu.Desktop/app.config index 44ccc4b77a..b9af3fdc80 100644 --- a/osu.Desktop/app.config +++ b/osu.Desktop/app.config @@ -1,4 +1,8 @@  + diff --git a/osu.Desktop/osu.nuspec b/osu.Desktop/osu.nuspec new file mode 100644 index 0000000000..2888f7c040 --- /dev/null +++ b/osu.Desktop/osu.nuspec @@ -0,0 +1,25 @@ + + + + osulazer + 0.0.0 + osulazer + ppy Pty Ltd + Dean Herbert + https://osu.ppy.sh/ + https://puu.sh/tYyXZ/9a01a5d1b0.ico + false + click the circles. to the beat. + click the circles. + testing + Copyright ppy Pty Ltd 2007-2017 + en-AU + + + + + + + + + diff --git a/osu.Desktop/packages.config b/osu.Desktop/packages.config index 8d1361bd0a..5fc8e82bfd 100644 --- a/osu.Desktop/packages.config +++ b/osu.Desktop/packages.config @@ -1,4 +1,8 @@  + diff --git a/osu.Game.Modes.Catch/CatchRuleset.cs b/osu.Game.Modes.Catch/CatchRuleset.cs index 5b681badd7..5db11737f4 100644 --- a/osu.Game.Modes.Catch/CatchRuleset.cs +++ b/osu.Game.Modes.Catch/CatchRuleset.cs @@ -24,6 +24,6 @@ namespace osu.Game.Modes.Catch public override ScoreProcessor CreateScoreProcessor(int hitObjectCount) => null; - public override HitObjectParser CreateHitObjectParser() => new OsuHitObjectParser(); + public override HitObjectParser CreateHitObjectParser() => new NullHitObjectParser(); } } diff --git a/osu.Game.Modes.Catch/OpenTK.dll.config b/osu.Game.Modes.Catch/OpenTK.dll.config index 1dd145f0c4..627e9f6009 100644 --- a/osu.Game.Modes.Catch/OpenTK.dll.config +++ b/osu.Game.Modes.Catch/OpenTK.dll.config @@ -1,8 +1,7 @@ - diff --git a/osu.Game.Modes.Catch/packages.config b/osu.Game.Modes.Catch/packages.config index 3c9e7e3fdc..d53e65896a 100644 --- a/osu.Game.Modes.Catch/packages.config +++ b/osu.Game.Modes.Catch/packages.config @@ -1,9 +1,8 @@  - \ No newline at end of file diff --git a/osu.Game.Modes.Mania/ManiaRuleset.cs b/osu.Game.Modes.Mania/ManiaRuleset.cs index 75f7d93228..654a4ddaa6 100644 --- a/osu.Game.Modes.Mania/ManiaRuleset.cs +++ b/osu.Game.Modes.Mania/ManiaRuleset.cs @@ -25,6 +25,6 @@ namespace osu.Game.Modes.Mania public override ScoreProcessor CreateScoreProcessor(int hitObjectCount) => null; - public override HitObjectParser CreateHitObjectParser() => new OsuHitObjectParser(); + public override HitObjectParser CreateHitObjectParser() => new NullHitObjectParser(); } } diff --git a/osu.Game.Modes.Mania/OpenTK.dll.config b/osu.Game.Modes.Mania/OpenTK.dll.config index 1dd145f0c4..627e9f6009 100644 --- a/osu.Game.Modes.Mania/OpenTK.dll.config +++ b/osu.Game.Modes.Mania/OpenTK.dll.config @@ -1,8 +1,7 @@ - diff --git a/osu.Game.Modes.Mania/app.config b/osu.Game.Modes.Mania/app.config index 9bad888bf3..b9af3fdc80 100644 --- a/osu.Game.Modes.Mania/app.config +++ b/osu.Game.Modes.Mania/app.config @@ -1,9 +1,8 @@  - diff --git a/osu.Game.Modes.Mania/packages.config b/osu.Game.Modes.Mania/packages.config index 3c9e7e3fdc..d53e65896a 100644 --- a/osu.Game.Modes.Mania/packages.config +++ b/osu.Game.Modes.Mania/packages.config @@ -1,9 +1,8 @@  - \ No newline at end of file diff --git a/osu.Game.Modes.Osu/Objects/Drawables/DrawableHitCircle.cs b/osu.Game.Modes.Osu/Objects/Drawables/DrawableHitCircle.cs index 8f59f05001..5c4401455c 100644 --- a/osu.Game.Modes.Osu/Objects/Drawables/DrawableHitCircle.cs +++ b/osu.Game.Modes.Osu/Objects/Drawables/DrawableHitCircle.cs @@ -2,7 +2,6 @@ // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE using System; -using System.ComponentModel; using osu.Framework.Graphics; using osu.Framework.Graphics.Transformations; using osu.Game.Modes.Objects.Drawables; @@ -11,9 +10,9 @@ using OpenTK; namespace osu.Game.Modes.Osu.Objects.Drawables { - public class DrawableHitCircle : DrawableOsuHitObject + public class DrawableHitCircle : DrawableOsuHitObject, IDrawableHitObjectWithProxiedApproach { - private HitCircle osuObject; + private OsuHitObject osuObject; public ApproachCircle ApproachCircle; private CirclePiece circle; @@ -23,11 +22,12 @@ namespace osu.Game.Modes.Osu.Objects.Drawables private NumberPiece number; private GlowPiece glow; - public DrawableHitCircle(HitCircle h) : base(h) + public DrawableHitCircle(OsuHitObject h) : base(h) { + Origin = Anchor.Centre; + osuObject = h; - Origin = Anchor.Centre; Position = osuObject.StackedPosition; Scale = new Vector2(osuObject.Scale); @@ -156,5 +156,7 @@ namespace osu.Game.Modes.Osu.Objects.Drawables break; } } + + public Drawable ProxiedLayer => ApproachCircle; } } diff --git a/osu.Game.Modes.Osu/Objects/Drawables/DrawableOsuHitObject.cs b/osu.Game.Modes.Osu/Objects/Drawables/DrawableOsuHitObject.cs index 0c7ca11672..ef153848d4 100644 --- a/osu.Game.Modes.Osu/Objects/Drawables/DrawableOsuHitObject.cs +++ b/osu.Game.Modes.Osu/Objects/Drawables/DrawableOsuHitObject.cs @@ -4,6 +4,7 @@ using System.ComponentModel; using osu.Game.Modes.Objects; using osu.Game.Modes.Objects.Drawables; +using osu.Framework.Graphics; namespace osu.Game.Modes.Osu.Objects.Drawables { diff --git a/osu.Game.Modes.Osu/Objects/Drawables/DrawableSlider.cs b/osu.Game.Modes.Osu/Objects/Drawables/DrawableSlider.cs index 981da050a3..bd3ac3da14 100644 --- a/osu.Game.Modes.Osu/Objects/Drawables/DrawableSlider.cs +++ b/osu.Game.Modes.Osu/Objects/Drawables/DrawableSlider.cs @@ -3,7 +3,6 @@ using OpenTK; using osu.Framework.Graphics; -using osu.Framework.Graphics.Containers; using osu.Game.Modes.Objects.Drawables; using osu.Game.Modes.Osu.Objects.Drawables.Pieces; using System.Collections.Generic; @@ -11,7 +10,7 @@ using System.Linq; namespace osu.Game.Modes.Osu.Objects.Drawables { - class DrawableSlider : DrawableOsuHitObject + public class DrawableSlider : DrawableOsuHitObject, IDrawableHitObjectWithProxiedApproach { private Slider slider; @@ -157,6 +156,8 @@ namespace osu.Game.Modes.Osu.Objects.Drawables FadeOut(800); } + + public Drawable ProxiedLayer => initialCircle.ApproachCircle; } internal interface ISliderProgress diff --git a/osu.Game.Modes.Osu/Objects/Drawables/DrawableSpinner.cs b/osu.Game.Modes.Osu/Objects/Drawables/DrawableSpinner.cs new file mode 100644 index 0000000000..94bcade2dc --- /dev/null +++ b/osu.Game.Modes.Osu/Objects/Drawables/DrawableSpinner.cs @@ -0,0 +1,140 @@ +// Copyright (c) 2007-2017 ppy Pty Ltd . +// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE + +using System; +using osu.Framework.Graphics; +using osu.Framework.Graphics.Transformations; +using osu.Framework.MathUtils; +using osu.Game.Modes.Objects.Drawables; +using osu.Game.Modes.Osu.Objects.Drawables.Pieces; +using OpenTK; +using OpenTK.Graphics; + +namespace osu.Game.Modes.Osu.Objects.Drawables +{ + public class DrawableSpinner : DrawableOsuHitObject + { + private Spinner spinner; + + private SpinnerDisc disc; + private SpinnerBackground background; + private DrawableHitCircle circle; + private NumberPiece number; + + public DrawableSpinner(Spinner s) : base(s) + { + Origin = Anchor.Centre; + Position = s.Position; + + //take up full playfield. + Size = new Vector2(512); + + spinner = s; + + Children = new Drawable[] + { + background = new SpinnerBackground + { + Alpha = 0, + Anchor = Anchor.Centre, + Origin = Anchor.Centre, + DiscColour = Color4.Black + }, + disc = new SpinnerDisc + { + Alpha = 0, + Anchor = Anchor.Centre, + Origin = Anchor.Centre, + DiscColour = s.Colour + }, + circle = new DrawableHitCircle(s) + { + Interactive = false, + Position = Vector2.Zero, + Anchor = Anchor.Centre, + } + }; + + circle.ApproachCircle.Colour = Color4.Transparent; + + background.Scale = scaleToCircle; + disc.Scale = scaleToCircle; + } + + public override bool Contains(Vector2 screenSpacePos) => true; + + protected override void CheckJudgement(bool userTriggered) + { + if (Time.Current < HitObject.StartTime) return; + + var j = Judgement as OsuJudgementInfo; + + disc.ScaleTo(Interpolation.ValueAt(Math.Sqrt(Progress), scaleToCircle, Vector2.One, 0, 1), 100); + + if (!userTriggered && Time.Current >= HitObject.EndTime) + { + if (Progress >= 1) + { + j.Score = OsuScoreResult.Hit300; + j.Result = HitResult.Hit; + } + else if (Progress > .9) + { + j.Score = OsuScoreResult.Hit100; + j.Result = HitResult.Hit; + } + else if (Progress > .75) + { + j.Score = OsuScoreResult.Hit50; + j.Result = HitResult.Hit; + } + else + { + j.Score = OsuScoreResult.Miss; + j.Result = HitResult.Miss; + } + } + } + + private Vector2 scaleToCircle => new Vector2(circle.Scale * circle.DrawWidth / DrawWidth) * 0.95f; + + private float spinsPerMinuteNeeded = 100 + (5 * 15); //TODO: read per-map OD and place it on the 5 + + private float rotationsNeeded => (float)(spinsPerMinuteNeeded * (spinner.EndTime - spinner.StartTime) / 60000f); + + public float Progress => MathHelper.Clamp(disc.RotationAbsolute / 360 / rotationsNeeded, 0, 1); + + protected override void UpdatePreemptState() + { + base.UpdatePreemptState(); + + FadeIn(200); + + background.Delay(TIME_PREEMPT - 100); + background.FadeIn(200); + background.ScaleTo(1, 200, EasingTypes.OutQuint); + + disc.Delay(TIME_PREEMPT - 50); + disc.FadeIn(200); + } + + protected override void UpdateState(ArmedState state) + { + base.UpdateState(state); + + Delay(HitObject.Duration, true); + + FadeOut(160); + + switch (state) + { + case ArmedState.Hit: + ScaleTo(Scale * 1.2f, 320, EasingTypes.Out); + break; + case ArmedState.Miss: + ScaleTo(Scale * 0.8f, 320, EasingTypes.In); + break; + } + } + } +} diff --git a/osu.Game.Modes.Osu/Objects/Drawables/Pieces/SpinnerBackground.cs b/osu.Game.Modes.Osu/Objects/Drawables/Pieces/SpinnerBackground.cs new file mode 100644 index 0000000000..50dab933b0 --- /dev/null +++ b/osu.Game.Modes.Osu/Objects/Drawables/Pieces/SpinnerBackground.cs @@ -0,0 +1,10 @@ +// Copyright (c) 2007-2017 ppy Pty Ltd . +// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE + +namespace osu.Game.Modes.Osu.Objects.Drawables.Pieces +{ + public class SpinnerBackground : SpinnerDisc + { + public override bool HandleInput => false; + } +} diff --git a/osu.Game.Modes.Osu/Objects/Drawables/Pieces/SpinnerDisc.cs b/osu.Game.Modes.Osu/Objects/Drawables/Pieces/SpinnerDisc.cs new file mode 100644 index 0000000000..76fd360818 --- /dev/null +++ b/osu.Game.Modes.Osu/Objects/Drawables/Pieces/SpinnerDisc.cs @@ -0,0 +1,168 @@ +// Copyright (c) 2007-2017 ppy Pty Ltd . +// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE + +using System; +using System.Linq; +using osu.Framework.Graphics; +using osu.Framework.Graphics.Colour; +using osu.Framework.Graphics.Containers; +using osu.Framework.Graphics.Sprites; +using osu.Framework.Graphics.Transformations; +using osu.Framework.Input; +using osu.Framework.Logging; +using OpenTK; +using OpenTK.Graphics; + +namespace osu.Game.Modes.Osu.Objects.Drawables.Pieces +{ + public class SpinnerDisc : CircularContainer + { + public override bool Contains(Vector2 screenSpacePos) => true; + + protected Sprite Disc; + + public SRGBColour DiscColour + { + get { return Disc.Colour; } + set { Disc.Colour = value; } + } + + class SpinnerBorder : Container + { + public SpinnerBorder() + { + Origin = Anchor.Centre; + Anchor = Anchor.Centre; + RelativeSizeAxes = Axes.Both; + + layout(); + } + + private int lastLayoutDotCount; + private void layout() + { + int count = (int)(MathHelper.Pi * ScreenSpaceDrawQuad.Width / 9); + + if (count == lastLayoutDotCount) return; + + lastLayoutDotCount = count; + + while (Children.Count() < count) + { + Add(new CircularContainer + { + Colour = Color4.White, + RelativePositionAxes = Axes.Both, + Origin = Anchor.Centre, + Size = new Vector2(1 / ScreenSpaceDrawQuad.Width * 2000), + Children = new[] + { + new Box + { + Origin = Anchor.Centre, + Anchor = Anchor.Centre, + RelativeSizeAxes = Axes.Both, + } + } + }); + } + + var size = new Vector2(1 / ScreenSpaceDrawQuad.Width * 2000); + + int i = 0; + foreach (var d in Children) + { + d.Size = size; + d.Position = new Vector2( + 0.5f + (float)Math.Sin((float)i / count * 2 * MathHelper.Pi) / 2, + 0.5f + (float)Math.Cos((float)i / count * 2 * MathHelper.Pi) / 2 + ); + + i++; + } + } + + protected override void Update() + { + base.Update(); + layout(); + } + } + + public SpinnerDisc() + { + RelativeSizeAxes = Axes.Both; + + Children = new Drawable[] + { + Disc = new Box + { + Origin = Anchor.Centre, + Anchor = Anchor.Centre, + RelativeSizeAxes = Axes.Both, + Alpha = 0.2f, + }, + new SpinnerBorder() + }; + } + + bool tracking; + public bool Tracking + { + get { return tracking; } + set + { + if (value == tracking) return; + + tracking = value; + + Disc.FadeTo(tracking ? 0.5f : 0.2f, 100); + } + } + + protected override bool OnMouseDown(InputState state, MouseDownEventArgs args) + { + Tracking = true; + return base.OnMouseDown(state, args); + } + + protected override bool OnMouseUp(InputState state, MouseUpEventArgs args) + { + Tracking = false; + return base.OnMouseUp(state, args); + } + + protected override bool OnMouseMove(InputState state) + { + Tracking |= state.Mouse.HasMainButtonPressed; + mousePosition = state.Mouse.Position; + return base.OnMouseMove(state); + } + + private Vector2 mousePosition; + + private float lastAngle; + private float currentRotation; + public float RotationAbsolute; + + protected override void Update() + { + base.Update(); + + var thisAngle = -(float)MathHelper.RadiansToDegrees(Math.Atan2(mousePosition.X - DrawSize.X / 2, mousePosition.Y - DrawSize.Y / 2)); + if (tracking) + { + if (thisAngle - lastAngle > 180) + lastAngle += 360; + else if (lastAngle - thisAngle > 180) + lastAngle -= 360; + + currentRotation += thisAngle - lastAngle; + RotationAbsolute += Math.Abs(thisAngle - lastAngle); + } + lastAngle = thisAngle; + + RotateTo(currentRotation, 100, EasingTypes.OutExpo); + } + } +} diff --git a/osu.Game.Modes.Osu/Objects/OsuHitObject.cs b/osu.Game.Modes.Osu/Objects/OsuHitObject.cs index 5c3121e76c..c23c9a0b64 100644 --- a/osu.Game.Modes.Osu/Objects/OsuHitObject.cs +++ b/osu.Game.Modes.Osu/Objects/OsuHitObject.cs @@ -31,19 +31,19 @@ namespace osu.Game.Modes.Osu.Objects Scale = (1.0f - 0.7f * (beatmap.BeatmapInfo.BaseDifficulty.CircleSize - 5) / 5) / 2; } + } - [Flags] - internal enum HitObjectType - { - Circle = 1, - Slider = 2, - NewCombo = 4, - CircleNewCombo = 5, - SliderNewCombo = 6, - Spinner = 8, - ColourHax = 122, - Hold = 128, - ManiaLong = 128, - } + [Flags] + public enum HitObjectType + { + Circle = 1, + Slider = 2, + NewCombo = 4, + CircleNewCombo = 5, + SliderNewCombo = 6, + Spinner = 8, + ColourHax = 122, + Hold = 128, + ManiaLong = 128, } } diff --git a/osu.Game.Modes.Osu/Objects/OsuHitObjectParser.cs b/osu.Game.Modes.Osu/Objects/OsuHitObjectParser.cs index 0f65ae598a..b4dc494ad4 100644 --- a/osu.Game.Modes.Osu/Objects/OsuHitObjectParser.cs +++ b/osu.Game.Modes.Osu/Objects/OsuHitObjectParser.cs @@ -18,21 +18,22 @@ namespace osu.Game.Modes.Osu.Objects public override HitObject Parse(string text) { string[] split = text.Split(','); - var type = (OsuHitObject.HitObjectType)int.Parse(split[3]); - bool combo = type.HasFlag(OsuHitObject.HitObjectType.NewCombo); - type &= (OsuHitObject.HitObjectType)0xF; - type &= ~OsuHitObject.HitObjectType.NewCombo; + var type = (HitObjectType)int.Parse(split[3]); + bool combo = type.HasFlag(HitObjectType.NewCombo); + type &= (HitObjectType)0xF; + type &= ~HitObjectType.NewCombo; OsuHitObject result; switch (type) { - case OsuHitObject.HitObjectType.Circle: - result = new HitCircle(); + case HitObjectType.Circle: + result = new HitCircle + { + Position = new Vector2(int.Parse(split[0]), int.Parse(split[1])) + }; break; - case OsuHitObject.HitObjectType.Slider: - Slider s = new Slider(); - + case HitObjectType.Slider: CurveTypes curveType = CurveTypes.Catmull; - int repeatCount = 0; + int repeatCount; double length = 0; List points = new List(); @@ -79,29 +80,28 @@ namespace osu.Game.Modes.Osu.Objects if (split.Length > 7) length = Convert.ToDouble(split[7], CultureInfo.InvariantCulture); - s.RepeatCount = repeatCount; - - s.Curve = new SliderCurve + result = new Slider { ControlPoints = points, Length = length, - CurveType = curveType + CurveType = curveType, + RepeatCount = repeatCount, + Position = new Vector2(int.Parse(split[0]), int.Parse(split[1])) }; - - s.Curve.Calculate(); - - result = s; break; - case OsuHitObject.HitObjectType.Spinner: - result = new Spinner(); + case HitObjectType.Spinner: + result = new Spinner + { + Length = Convert.ToDouble(split[5], CultureInfo.InvariantCulture) - Convert.ToDouble(split[2], CultureInfo.InvariantCulture), + Position = new Vector2(512, 384) / 2, + }; break; default: - //throw new InvalidOperationException($@"Unknown hit object type {type}"); - return null; + 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 { + result.StartTime = Convert.ToDouble(split[2], CultureInfo.InvariantCulture); + result.Sample = new HitSampleInfo + { Type = (SampleType)int.Parse(split[4]), Set = SampleSet.Soft, }; diff --git a/osu.Game.Modes.Osu/Objects/Slider.cs b/osu.Game.Modes.Osu/Objects/Slider.cs index 6f97ccf654..30ad1c0180 100644 --- a/osu.Game.Modes.Osu/Objects/Slider.cs +++ b/osu.Game.Modes.Osu/Objects/Slider.cs @@ -1,11 +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.Beatmaps; using OpenTK; -using System.Collections.Generic; -using System; +using osu.Game.Beatmaps; using osu.Game.Beatmaps.Samples; +using System; +using System.Collections.Generic; namespace osu.Game.Modes.Osu.Objects { @@ -22,11 +22,28 @@ namespace osu.Game.Modes.Osu.Objects set { stackHeight = value; - if (Curve != null) - Curve.Offset = StackOffset; + Curve.Offset = StackOffset; } } + public List ControlPoints + { + get { return Curve.ControlPoints; } + set { Curve.ControlPoints = value; } + } + + public double Length + { + get { return Curve.Length; } + set { Curve.Length = value; } + } + + public CurveTypes CurveType + { + get { return Curve.CurveType; } + set { Curve.CurveType = value; } + } + public double Velocity; public double TickDistance; @@ -43,9 +60,9 @@ namespace osu.Game.Modes.Osu.Objects TickDistance = (100 * baseDifficulty.SliderMultiplier) / baseDifficulty.SliderTickRate / (multipliedStartBeatLength / startBeatLength); } - public int RepeatCount; + public int RepeatCount = 1; - public SliderCurve Curve; + internal readonly SliderCurve Curve = new SliderCurve(); public IEnumerable Ticks { diff --git a/osu.Game.Modes.Osu/Objects/SliderCurve.cs b/osu.Game.Modes.Osu/Objects/SliderCurve.cs index 62931a7356..e60e58da9a 100644 --- a/osu.Game.Modes.Osu/Objects/SliderCurve.cs +++ b/osu.Game.Modes.Osu/Objects/SliderCurve.cs @@ -15,7 +15,7 @@ namespace osu.Game.Modes.Osu.Objects public List ControlPoints; - public CurveTypes CurveType; + public CurveTypes CurveType = CurveTypes.PerfectCurve; public Vector2 Offset; @@ -172,6 +172,9 @@ namespace osu.Game.Modes.Osu.Objects /// End progress. Ranges from 0 (beginning of the slider) to 1 (end of the slider). public void GetPathToProgress(List path, double p0, double p1) { + if (calculatedPath.Count == 0 && ControlPoints.Count > 0) + Calculate(); + double d0 = progressToDistance(p0); double d1 = progressToDistance(p1); @@ -196,6 +199,9 @@ namespace osu.Game.Modes.Osu.Objects /// public Vector2 PositionAt(double progress) { + if (calculatedPath.Count == 0 && ControlPoints.Count > 0) + Calculate(); + double d = progressToDistance(progress); return interpolateVertices(indexOfDistance(d), d) + Offset; } diff --git a/osu.Game.Modes.Osu/Objects/Spinner.cs b/osu.Game.Modes.Osu/Objects/Spinner.cs index ea6f1b53f2..fa1bddf760 100644 --- a/osu.Game.Modes.Osu/Objects/Spinner.cs +++ b/osu.Game.Modes.Osu/Objects/Spinner.cs @@ -1,9 +1,14 @@ // Copyright (c) 2007-2017 ppy Pty Ltd . // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE +using osu.Game.Beatmaps; + namespace osu.Game.Modes.Osu.Objects { public class Spinner : OsuHitObject { + public double Length; + + public override double EndTime => StartTime + Length; } } diff --git a/osu.Game.Modes.Osu/OpenTK.dll.config b/osu.Game.Modes.Osu/OpenTK.dll.config index 1dd145f0c4..627e9f6009 100644 --- a/osu.Game.Modes.Osu/OpenTK.dll.config +++ b/osu.Game.Modes.Osu/OpenTK.dll.config @@ -1,8 +1,7 @@ - diff --git a/osu.Game.Modes.Osu/UI/OsuHitRenderer.cs b/osu.Game.Modes.Osu/UI/OsuHitRenderer.cs index fdaab87d55..fa222aafd7 100644 --- a/osu.Game.Modes.Osu/UI/OsuHitRenderer.cs +++ b/osu.Game.Modes.Osu/UI/OsuHitRenderer.cs @@ -21,7 +21,8 @@ namespace osu.Game.Modes.Osu.UI return new DrawableHitCircle(h as HitCircle); if (h is Slider) return new DrawableSlider(h as Slider); - + if (h is Spinner) + return new DrawableSpinner(h as Spinner); return null; } } diff --git a/osu.Game.Modes.Osu/UI/OsuPlayfield.cs b/osu.Game.Modes.Osu/UI/OsuPlayfield.cs index b6daffbb8b..20164060fe 100644 --- a/osu.Game.Modes.Osu/UI/OsuPlayfield.cs +++ b/osu.Game.Modes.Osu/UI/OsuPlayfield.cs @@ -60,10 +60,10 @@ namespace osu.Game.Modes.Osu.UI public override void Add(DrawableHitObject h) { h.Depth = (float)h.HitObject.StartTime; - DrawableHitCircle c = h as DrawableHitCircle; + IDrawableHitObjectWithProxiedApproach c = h as IDrawableHitObjectWithProxiedApproach; if (c != null) { - approachCircles.Add(c.ApproachCircle.CreateProxy()); + approachCircles.Add(c.ProxiedLayer.CreateProxy()); } h.OnJudgement += judgement; diff --git a/osu.Game.Modes.Osu/app.config b/osu.Game.Modes.Osu/app.config index c42343ec69..d9da887349 100644 --- a/osu.Game.Modes.Osu/app.config +++ b/osu.Game.Modes.Osu/app.config @@ -1,9 +1,8 @@ - diff --git a/osu.Game.Modes.Osu/osu.Game.Modes.Osu.csproj b/osu.Game.Modes.Osu/osu.Game.Modes.Osu.csproj index 19f0df55b8..d236497ff4 100644 --- a/osu.Game.Modes.Osu/osu.Game.Modes.Osu.csproj +++ b/osu.Game.Modes.Osu/osu.Game.Modes.Osu.csproj @@ -50,9 +50,11 @@ + + @@ -61,6 +63,7 @@ + diff --git a/osu.Game.Modes.Osu/packages.config b/osu.Game.Modes.Osu/packages.config index 591ae8cd7f..d06cd15869 100644 --- a/osu.Game.Modes.Osu/packages.config +++ b/osu.Game.Modes.Osu/packages.config @@ -1,10 +1,8 @@  - - \ No newline at end of file diff --git a/osu.Game.Modes.Taiko/OpenTK.dll.config b/osu.Game.Modes.Taiko/OpenTK.dll.config index 1dd145f0c4..627e9f6009 100644 --- a/osu.Game.Modes.Taiko/OpenTK.dll.config +++ b/osu.Game.Modes.Taiko/OpenTK.dll.config @@ -1,8 +1,7 @@ - diff --git a/osu.Game.Modes.Taiko/TaikoRuleset.cs b/osu.Game.Modes.Taiko/TaikoRuleset.cs index c5d5ff5805..bd20608d57 100644 --- a/osu.Game.Modes.Taiko/TaikoRuleset.cs +++ b/osu.Game.Modes.Taiko/TaikoRuleset.cs @@ -25,6 +25,6 @@ namespace osu.Game.Modes.Taiko public override ScoreProcessor CreateScoreProcessor(int hitObjectCount) => null; - public override HitObjectParser CreateHitObjectParser() => new OsuHitObjectParser(); + public override HitObjectParser CreateHitObjectParser() => new NullHitObjectParser(); } } diff --git a/osu.Game.Modes.Taiko/packages.config b/osu.Game.Modes.Taiko/packages.config index 3c9e7e3fdc..d53e65896a 100644 --- a/osu.Game.Modes.Taiko/packages.config +++ b/osu.Game.Modes.Taiko/packages.config @@ -1,9 +1,8 @@  - \ No newline at end of file diff --git a/osu.Game.Tests/Beatmaps/Formats/OsuLegacyDecoderTest.cs b/osu.Game.Tests/Beatmaps/Formats/OsuLegacyDecoderTest.cs index 9a988d6eff..6613b5c370 100644 --- a/osu.Game.Tests/Beatmaps/Formats/OsuLegacyDecoderTest.cs +++ b/osu.Game.Tests/Beatmaps/Formats/OsuLegacyDecoderTest.cs @@ -1,4 +1,7 @@ -using System; +// Copyright (c) 2007-2017 ppy Pty Ltd . +// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE + +using System; using System.IO; using NUnit.Framework; using OpenTK; diff --git a/osu.Game.Tests/Beatmaps/IO/ImportBeatmapTest.cs b/osu.Game.Tests/Beatmaps/IO/ImportBeatmapTest.cs index 165181a332..6a162a4ab9 100644 --- a/osu.Game.Tests/Beatmaps/IO/ImportBeatmapTest.cs +++ b/osu.Game.Tests/Beatmaps/IO/ImportBeatmapTest.cs @@ -1,4 +1,7 @@ -using System; +// Copyright (c) 2007-2017 ppy Pty Ltd . +// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE + +using System; using System.Collections.Generic; using System.IO; using System.Linq; diff --git a/osu.Game.Tests/Beatmaps/IO/OszArchiveReaderTest.cs b/osu.Game.Tests/Beatmaps/IO/OszArchiveReaderTest.cs index 037c0185b8..3d706a8026 100644 --- a/osu.Game.Tests/Beatmaps/IO/OszArchiveReaderTest.cs +++ b/osu.Game.Tests/Beatmaps/IO/OszArchiveReaderTest.cs @@ -1,4 +1,7 @@ -using System; +// Copyright (c) 2007-2017 ppy Pty Ltd . +// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE + +using System; using System.IO; using NUnit.Framework; using osu.Game.Beatmaps.IO; diff --git a/osu.Game.Tests/OpenTK.dll.config b/osu.Game.Tests/OpenTK.dll.config index 5620e3d9e2..627e9f6009 100644 --- a/osu.Game.Tests/OpenTK.dll.config +++ b/osu.Game.Tests/OpenTK.dll.config @@ -1,3 +1,7 @@ + diff --git a/osu.Game.Tests/Resources/Resource.cs b/osu.Game.Tests/Resources/Resource.cs index 21945ac504..6c66b6818b 100644 --- a/osu.Game.Tests/Resources/Resource.cs +++ b/osu.Game.Tests/Resources/Resource.cs @@ -1,4 +1,7 @@ -using System; +// Copyright (c) 2007-2017 ppy Pty Ltd . +// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE + +using System; using System.IO; using System.Reflection; diff --git a/osu.Game.Tests/app.config b/osu.Game.Tests/app.config index 44ccc4b77a..b9af3fdc80 100644 --- a/osu.Game.Tests/app.config +++ b/osu.Game.Tests/app.config @@ -1,4 +1,8 @@  + diff --git a/osu.Game.Tests/osu.Game.Tests.csproj b/osu.Game.Tests/osu.Game.Tests.csproj index c6f0c6fa55..f555615f09 100644 --- a/osu.Game.Tests/osu.Game.Tests.csproj +++ b/osu.Game.Tests/osu.Game.Tests.csproj @@ -55,6 +55,9 @@ + + osu.licenseheader + diff --git a/osu.Game.Tests/packages.config b/osu.Game.Tests/packages.config index f9151f1eaa..b9f1a2c8cd 100644 --- a/osu.Game.Tests/packages.config +++ b/osu.Game.Tests/packages.config @@ -1,4 +1,8 @@  + diff --git a/osu.Game/Configuration/OsuConfigManager.cs b/osu.Game/Configuration/OsuConfigManager.cs index 8e71a54a34..381bca2a71 100644 --- a/osu.Game/Configuration/OsuConfigManager.cs +++ b/osu.Game/Configuration/OsuConfigManager.cs @@ -14,144 +14,148 @@ namespace osu.Game.Configuration { #pragma warning disable CS0612 // Type or member is obsolete - Set(OsuConfig.MouseSpeed, 1.0); - Set(OsuConfig.Username, string.Empty); Set(OsuConfig.Token, string.Empty); Set(OsuConfig.PlayMode, PlayMode.Osu); - - Set(OsuConfig.BeatmapDirectory, @"Songs"); // TODO: use this - Set(OsuConfig.AllowPublicInvites, true); - Set(OsuConfig.AutoChatHide, true); - Set(OsuConfig.AutomaticDownload, true); - Set(OsuConfig.AutomaticDownloadNoVideo, false); - Set(OsuConfig.BlockNonFriendPM, false); - Set(OsuConfig.BloomSoftening, false); - Set(OsuConfig.BossKeyFirstActivation, true); - Set(OsuConfig.ChatAudibleHighlight, true); - Set(OsuConfig.ChatChannels, string.Empty); - Set(OsuConfig.ChatFilter, false); - Set(OsuConfig.ChatHighlightName, true); - Set(OsuConfig.ChatMessageNotification, true); - Set(OsuConfig.ChatLastChannel, string.Empty); - Set(OsuConfig.ChatRemoveForeign, false); - //Set(OsuConfig.ChatSortMode, UserSortMode.Rank); - Set(OsuConfig.ComboBurst, true); - Set(OsuConfig.ComboFire, false); - Set(OsuConfig.ComboFireHeight, 3); - Set(OsuConfig.ConfirmExit, false); - Set(OsuConfig.AutoSendNowPlaying, true); - Set(OsuConfig.CursorSize, 1.0, 0.5f, 2); - Set(OsuConfig.AutomaticCursorSizing, false); - Set(OsuConfig.DimLevel, 30, 0, 100); - Set(OsuConfig.Display, 1); - Set(OsuConfig.DisplayCityLocation, false); - Set(OsuConfig.DistanceSpacingEnabled, true); - Set(OsuConfig.EditorTip, 0); - Set(OsuConfig.VideoEditor, true); - Set(OsuConfig.EditorDefaultSkin, false); - Set(OsuConfig.EditorSnakingSliders, true); - Set(OsuConfig.EditorHitAnimations, false); - Set(OsuConfig.EditorFollowPoints, true); - Set(OsuConfig.EditorStacking, true); - Set(OsuConfig.ForceSliderRendering, false); - Set(OsuConfig.FpsCounter, false); - Set(OsuConfig.FrameTimeDisplay, false); - Set(OsuConfig.GuideTips, @""); - Set(OsuConfig.CursorRipple, false); - Set(OsuConfig.HighlightWords, string.Empty); - Set(OsuConfig.HighResolution, false); - Set(OsuConfig.HitLighting, true); - Set(OsuConfig.IgnoreBarline, false); - Set(OsuConfig.IgnoreBeatmapSamples, false); - Set(OsuConfig.IgnoreBeatmapSkins, false); - Set(OsuConfig.IgnoreList, string.Empty); - Set(OsuConfig.KeyOverlay, false); - Set(OsuConfig.Language, @"unknown"); - Set(OsuConfig.AllowNowPlayingHighlights, false); - Set(OsuConfig.LastVersion, string.Empty); - Set(OsuConfig.LastVersionPermissionsFailed, string.Empty); - Set(OsuConfig.LoadSubmittedThread, true); - Set(OsuConfig.LobbyPlayMode, -1); - Set(OsuConfig.ShowInterface, true); - Set(OsuConfig.ShowInterfaceDuringRelax, false); - Set(OsuConfig.LobbyShowExistingOnly, false); - Set(OsuConfig.LobbyShowFriendsOnly, false); - Set(OsuConfig.LobbyShowFull, false); - Set(OsuConfig.LobbyShowInProgress, true); - Set(OsuConfig.LobbyShowPassworded, true); - Set(OsuConfig.LogPrivateMessages, false); - Set(OsuConfig.LowResolution, false); - //Set(OsuConfig.ManiaSpeed, SpeedMania.SPEED_DEFAULT, SpeedMania.SPEED_MIN, SpeedMania.SPEED_MAX); - Set(OsuConfig.UsePerBeatmapManiaSpeed, true); - Set(OsuConfig.ManiaSpeedBPMScale, true); - Set(OsuConfig.MenuTip, 0); - Set(OsuConfig.MouseDisableButtons, false); - Set(OsuConfig.MouseDisableWheel, false); - Set(OsuConfig.MouseSpeed, 1, 0.4, 6); - Set(OsuConfig.Offset, 0, -300, 300); - Set(OsuConfig.ScoreMeterScale, 1, 0.5, 2); - //Set(OsuConfig.ScoreMeterScale, 1, 0.5, OsuGame.Tournament ? 10 : 2); - Set(OsuConfig.DistanceSpacing, 0.8, 0.1, 6); - Set(OsuConfig.EditorBeatDivisor, 1, 1, 16); - Set(OsuConfig.EditorGridSize, 32, 4, 32); - Set(OsuConfig.EditorGridSizeDesign, 32, 4, 32); - Set(OsuConfig.CustomFrameLimit, 240, 240, 999); - Set(OsuConfig.MsnIntegration, false); - Set(OsuConfig.MyPcSucks, false); - Set(OsuConfig.NotifyFriends, true); - Set(OsuConfig.NotifySubmittedThread, true); - Set(OsuConfig.PopupDuringGameplay, true); - Set(OsuConfig.ProgressBarType, ProgressBarType.Pie); - Set(OsuConfig.RankType, RankingType.Top); - Set(OsuConfig.RefreshRate, 60); - Set(OsuConfig.OverrideRefreshRate, Get(OsuConfig.RefreshRate) != 60); - //Set(OsuConfig.ScaleMode, ScaleMode.WidescreenConservative); - Set(OsuConfig.ScoreboardVisible, true); - Set(OsuConfig.ScoreMeter, ScoreMeterType.Error); - //Set(OsuConfig.ScoreMeter, OsuGame.Tournament ? ScoreMeterType.Colour : ScoreMeterType.Error); - Set(OsuConfig.ScreenshotId, 0); - Set(OsuConfig.MenuSnow, false); - Set(OsuConfig.MenuTriangles, true); - Set(OsuConfig.SongSelectThumbnails, true); - Set(OsuConfig.ScreenshotFormat, ScreenshotFormat.Jpg); - Set(OsuConfig.ShowReplayComments, true); - Set(OsuConfig.ShowSpectators, true); - Set(OsuConfig.ShowStoryboard, true); - //Set(OsuConfig.Skin, SkinManager.DEFAULT_SKIN); - Set(OsuConfig.SkinSamples, true); - Set(OsuConfig.SkipTablet, false); - Set(OsuConfig.SnakingInSliders, true); - Set(OsuConfig.SnakingOutSliders, false); - Set(OsuConfig.Tablet, false); - Set(OsuConfig.UpdatePending, false); - Set(OsuConfig.UseSkinCursor, false); - Set(OsuConfig.UseTaikoSkin, false); - Set(OsuConfig.Video, true); - Set(OsuConfig.Wiimote, false); - Set(OsuConfig.YahooIntegration, false); - Set(OsuConfig.ForceFrameFlush, false); - Set(OsuConfig.DetectPerformanceIssues, true); - Set(OsuConfig.MenuMusic, true); - Set(OsuConfig.MenuVoice, true); - Set(OsuConfig.MenuParallax, true); - Set(OsuConfig.RawInput, false); - Set(OsuConfig.AbsoluteToOsuWindow, Get(OsuConfig.RawInput)); - Set(OsuConfig.ShowMenuTips, true); - Set(OsuConfig.HiddenShowFirstApproach, true); - Set(OsuConfig.ComboColourSliderBall, true); - Set(OsuConfig.AlternativeChatFont, false); - Set(OsuConfig.DisplayStarsMaximum, 10.0, 0.0, 10.0); - Set(OsuConfig.DisplayStarsMinimum, 0.0, 0.0, 10.0); Set(OsuConfig.AudioDevice, string.Empty); - Set(OsuConfig.ReleaseStream, ReleaseStream.Lazer); - Set(OsuConfig.UpdateFailCount, 0); Set(OsuConfig.SavePassword, false); Set(OsuConfig.SaveUsername, true); - //Set(OsuConfig.TreeSortMode, TreeGroupMode.Show_All); - //Set(OsuConfig.TreeSortMode2, TreeSortMode.Title); + + Set(OsuConfig.CursorSize, 1.0, 0.5f, 2); + Set(OsuConfig.DimLevel, 30, 0, 100); + + Set(OsuConfig.MouseDisableButtons, false); + + Set(OsuConfig.SnakingInSliders, true); + Set(OsuConfig.SnakingOutSliders, false); + + //todo: implement all settings below this line (remove the Disabled set when doing so). + + Set(OsuConfig.MouseSpeed, 1.0).Disabled = true; + Set(OsuConfig.BeatmapDirectory, @"Songs").Disabled = true; // TODO: use thi.Disabled = trues + Set(OsuConfig.AllowPublicInvites, true).Disabled = true; + Set(OsuConfig.AutoChatHide, true).Disabled = true; + Set(OsuConfig.AutomaticDownload, true).Disabled = true; + Set(OsuConfig.AutomaticDownloadNoVideo, false).Disabled = true; + Set(OsuConfig.BlockNonFriendPM, false).Disabled = true; + Set(OsuConfig.BloomSoftening, false).Disabled = true; + Set(OsuConfig.BossKeyFirstActivation, true).Disabled = true; + Set(OsuConfig.ChatAudibleHighlight, true).Disabled = true; + Set(OsuConfig.ChatChannels, string.Empty).Disabled = true; + Set(OsuConfig.ChatFilter, false).Disabled = true; + Set(OsuConfig.ChatHighlightName, true).Disabled = true; + Set(OsuConfig.ChatMessageNotification, true).Disabled = true; + Set(OsuConfig.ChatLastChannel, string.Empty).Disabled = true; + Set(OsuConfig.ChatRemoveForeign, false).Disabled = true; + //Set(OsuConfig.ChatSortMode, UserSortMode.Rank).Disabled = true; + Set(OsuConfig.ComboBurst, true).Disabled = true; + Set(OsuConfig.ComboFire, false).Disabled = true; + Set(OsuConfig.ComboFireHeight, 3).Disabled = true; + Set(OsuConfig.ConfirmExit, false).Disabled = true; + Set(OsuConfig.AutoSendNowPlaying, true).Disabled = true; + Set(OsuConfig.AutomaticCursorSizing, false).Disabled = true; + Set(OsuConfig.Display, 1).Disabled = true; + Set(OsuConfig.DisplayCityLocation, false).Disabled = true; + Set(OsuConfig.DistanceSpacingEnabled, true).Disabled = true; + Set(OsuConfig.EditorTip, 0).Disabled = true; + Set(OsuConfig.VideoEditor, true).Disabled = true; + Set(OsuConfig.EditorDefaultSkin, false).Disabled = true; + Set(OsuConfig.EditorSnakingSliders, true).Disabled = true; + Set(OsuConfig.EditorHitAnimations, false).Disabled = true; + Set(OsuConfig.EditorFollowPoints, true).Disabled = true; + Set(OsuConfig.EditorStacking, true).Disabled = true; + Set(OsuConfig.ForceSliderRendering, false).Disabled = true; + Set(OsuConfig.FpsCounter, false).Disabled = true; + Set(OsuConfig.FrameTimeDisplay, false).Disabled = true; + Set(OsuConfig.GuideTips, @"").Disabled = true; + Set(OsuConfig.CursorRipple, false).Disabled = true; + Set(OsuConfig.HighlightWords, string.Empty).Disabled = true; + Set(OsuConfig.HighResolution, false).Disabled = true; + Set(OsuConfig.HitLighting, true).Disabled = true; + Set(OsuConfig.IgnoreBarline, false).Disabled = true; + Set(OsuConfig.IgnoreBeatmapSamples, false).Disabled = true; + Set(OsuConfig.IgnoreBeatmapSkins, false).Disabled = true; + Set(OsuConfig.IgnoreList, string.Empty).Disabled = true; + Set(OsuConfig.KeyOverlay, false).Disabled = true; + Set(OsuConfig.Language, @"unknown").Disabled = true; + Set(OsuConfig.AllowNowPlayingHighlights, false).Disabled = true; + Set(OsuConfig.LastVersion, string.Empty).Disabled = true; + Set(OsuConfig.LastVersionPermissionsFailed, string.Empty).Disabled = true; + Set(OsuConfig.LoadSubmittedThread, true).Disabled = true; + Set(OsuConfig.LobbyPlayMode, -1).Disabled = true; + Set(OsuConfig.ShowInterface, true).Disabled = true; + Set(OsuConfig.ShowInterfaceDuringRelax, false).Disabled = true; + Set(OsuConfig.LobbyShowExistingOnly, false).Disabled = true; + Set(OsuConfig.LobbyShowFriendsOnly, false).Disabled = true; + Set(OsuConfig.LobbyShowFull, false).Disabled = true; + Set(OsuConfig.LobbyShowInProgress, true).Disabled = true; + Set(OsuConfig.LobbyShowPassworded, true).Disabled = true; + Set(OsuConfig.LogPrivateMessages, false).Disabled = true; + Set(OsuConfig.LowResolution, false).Disabled = true; + //Set(OsuConfig.ManiaSpeed, SpeedMania.SPEED_DEFAULT, SpeedMania.SPEED_MIN, SpeedMania.SPEED_MAX).Disabled = true; + Set(OsuConfig.UsePerBeatmapManiaSpeed, true).Disabled = true; + Set(OsuConfig.ManiaSpeedBPMScale, true).Disabled = true; + Set(OsuConfig.MenuTip, 0).Disabled = true; + Set(OsuConfig.MouseDisableWheel, false).Disabled = true; + Set(OsuConfig.MouseSpeed, 1, 0.4, 6).Disabled = true; + Set(OsuConfig.Offset, 0, -300, 300).Disabled = true; + Set(OsuConfig.ScoreMeterScale, 1, 0.5, 2).Disabled = true; + //Set(OsuConfig.ScoreMeterScale, 1, 0.5, OsuGame.Tournament ? 10 : 2).Disabled = true; + Set(OsuConfig.DistanceSpacing, 0.8, 0.1, 6).Disabled = true; + Set(OsuConfig.EditorBeatDivisor, 1, 1, 16).Disabled = true; + Set(OsuConfig.EditorGridSize, 32, 4, 32).Disabled = true; + Set(OsuConfig.EditorGridSizeDesign, 32, 4, 32).Disabled = true; + Set(OsuConfig.CustomFrameLimit, 240, 240, 999).Disabled = true; + Set(OsuConfig.MsnIntegration, false).Disabled = true; + Set(OsuConfig.MyPcSucks, false).Disabled = true; + Set(OsuConfig.NotifyFriends, true).Disabled = true; + Set(OsuConfig.NotifySubmittedThread, true).Disabled = true; + Set(OsuConfig.PopupDuringGameplay, true).Disabled = true; + Set(OsuConfig.ProgressBarType, ProgressBarType.Pie).Disabled = true; + Set(OsuConfig.RankType, RankingType.Top).Disabled = true; + Set(OsuConfig.RefreshRate, 60).Disabled = true; + Set(OsuConfig.OverrideRefreshRate, Get(OsuConfig.RefreshRate) != 60).Disabled = true; + //Set(OsuConfig.ScaleMode, ScaleMode.WidescreenConservative).Disabled = true; + Set(OsuConfig.ScoreboardVisible, true).Disabled = true; + Set(OsuConfig.ScoreMeter, ScoreMeterType.Error).Disabled = true; + //Set(OsuConfig.ScoreMeter, OsuGame.Tournament ? ScoreMeterType.Colour : ScoreMeterType.Error).Disabled = true; + Set(OsuConfig.ScreenshotId, 0).Disabled = true; + Set(OsuConfig.MenuSnow, false).Disabled = true; + Set(OsuConfig.MenuTriangles, true).Disabled = true; + Set(OsuConfig.SongSelectThumbnails, true).Disabled = true; + Set(OsuConfig.ScreenshotFormat, ScreenshotFormat.Jpg).Disabled = true; + Set(OsuConfig.ShowReplayComments, true).Disabled = true; + Set(OsuConfig.ShowSpectators, true).Disabled = true; + Set(OsuConfig.ShowStoryboard, true).Disabled = true; + //Set(OsuConfig.Skin, SkinManager.DEFAULT_SKIN).Disabled = true; + Set(OsuConfig.SkinSamples, true).Disabled = true; + Set(OsuConfig.SkipTablet, false).Disabled = true; + Set(OsuConfig.Tablet, false).Disabled = true; + Set(OsuConfig.UpdatePending, false).Disabled = true; + Set(OsuConfig.UseSkinCursor, false).Disabled = true; + Set(OsuConfig.UseTaikoSkin, false).Disabled = true; + Set(OsuConfig.Video, true).Disabled = true; + Set(OsuConfig.Wiimote, false).Disabled = true; + Set(OsuConfig.YahooIntegration, false).Disabled = true; + Set(OsuConfig.ForceFrameFlush, false).Disabled = true; + Set(OsuConfig.DetectPerformanceIssues, true).Disabled = true; + Set(OsuConfig.MenuMusic, true).Disabled = true; + Set(OsuConfig.MenuVoice, true).Disabled = true; + Set(OsuConfig.MenuParallax, true).Disabled = true; + Set(OsuConfig.RawInput, false).Disabled = true; + Set(OsuConfig.AbsoluteToOsuWindow, Get(OsuConfig.RawInput)).Disabled = true; + Set(OsuConfig.ShowMenuTips, true).Disabled = true; + Set(OsuConfig.HiddenShowFirstApproach, true).Disabled = true; + Set(OsuConfig.ComboColourSliderBall, true).Disabled = true; + Set(OsuConfig.AlternativeChatFont, false).Disabled = true; + Set(OsuConfig.DisplayStarsMaximum, 10.0, 0.0, 10.0).Disabled = true; + Set(OsuConfig.DisplayStarsMinimum, 0.0, 0.0, 10.0).Disabled = true; + Set(OsuConfig.ReleaseStream, ReleaseStream.Lazer).Disabled = true; + Set(OsuConfig.UpdateFailCount, 0).Disabled = true; + //Set(OsuConfig.TreeSortMode, TreeGroupMode.Show_All).Disabled = true; + //Set(OsuConfig.TreeSortMode2, TreeSortMode.Title).Disabled = true; bool unicodeDefault = false; switch (Get(OsuConfig.Language)) { @@ -162,12 +166,12 @@ namespace osu.Game.Configuration break; } Set(OsuConfig.ShowUnicode, unicodeDefault); - Set(OsuConfig.PermanentSongInfo, false); - Set(OsuConfig.Ticker, false); - Set(OsuConfig.CompatibilityContext, false); - Set(OsuConfig.CanForceOptimusCompatibility, true); + Set(OsuConfig.PermanentSongInfo, false).Disabled = true; + Set(OsuConfig.Ticker, false).Disabled = true; + Set(OsuConfig.CompatibilityContext, false).Disabled = true; + Set(OsuConfig.CanForceOptimusCompatibility, true).Disabled = true; Set(OsuConfig.ConfineMouse, Get(OsuConfig.ConfineMouseToFullscreen) ? - ConfineMouseMode.Fullscreen : ConfineMouseMode.Never); + ConfineMouseMode.Fullscreen : ConfineMouseMode.Never).Disabled = true; GetBindable(OsuConfig.SavePassword).ValueChanged += delegate diff --git a/osu.Game/Graphics/Backgrounds/Background.cs b/osu.Game/Graphics/Backgrounds/Background.cs index 55c37cb71d..5ff63ead2a 100644 --- a/osu.Game/Graphics/Backgrounds/Background.cs +++ b/osu.Game/Graphics/Backgrounds/Background.cs @@ -20,6 +20,8 @@ namespace osu.Game.Graphics.Backgrounds public Background(string textureName = @"") { + CacheDrawnFrameBuffer = true; + this.textureName = textureName; RelativeSizeAxes = Axes.Both; Depth = float.MaxValue; diff --git a/osu.Game/Graphics/UserInterface/OsuButton.cs b/osu.Game/Graphics/UserInterface/OsuButton.cs index 7d88451a6f..31f66407ce 100644 --- a/osu.Game/Graphics/UserInterface/OsuButton.cs +++ b/osu.Game/Graphics/UserInterface/OsuButton.cs @@ -32,10 +32,15 @@ namespace osu.Game.Graphics.UserInterface Font = @"Exo2.0-Bold", }; + public override bool HandleInput => Action != null; + [BackgroundDependencyLoader] private void load(OsuColour colours) { - Colour = colours.BlueDark; + if (Action == null) + Colour = OsuColour.Gray(0.5f); + + BackgroundColour = colours.BlueDark; Content.Masking = true; Content.CornerRadius = 5; diff --git a/osu.Game/Graphics/UserInterface/OsuCheckbox.cs b/osu.Game/Graphics/UserInterface/OsuCheckbox.cs index bd580bb76b..206b0dc09d 100644 --- a/osu.Game/Graphics/UserInterface/OsuCheckbox.cs +++ b/osu.Game/Graphics/UserInterface/OsuCheckbox.cs @@ -39,6 +39,9 @@ namespace osu.Game.Graphics.UserInterface State = bindable.Value ? CheckBoxState.Checked : CheckBoxState.Unchecked; bindable.ValueChanged += bindableValueChanged; } + + if (bindable?.Disabled ?? true) + Alpha = 0.3f; } } @@ -123,20 +126,20 @@ namespace osu.Game.Graphics.UserInterface protected override void OnChecked() { - if (bindable != null) - bindable.Value = true; - sampleChecked?.Play(); nub.State = CheckBoxState.Checked; + + if (bindable != null) + bindable.Value = true; } protected override void OnUnchecked() { - if (bindable != null) - bindable.Value = false; - sampleUnchecked?.Play(); nub.State = CheckBoxState.Unchecked; + + if (bindable != null) + bindable.Value = false; } } } diff --git a/osu.Game/Graphics/UserInterface/OsuPasswordTextBox.cs b/osu.Game/Graphics/UserInterface/OsuPasswordTextBox.cs index 13fbbb16e0..bc8be25035 100644 --- a/osu.Game/Graphics/UserInterface/OsuPasswordTextBox.cs +++ b/osu.Game/Graphics/UserInterface/OsuPasswordTextBox.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 osu.Framework.Graphics; using osu.Framework.Graphics.Containers; diff --git a/osu.Game/Modes/Objects/Drawables/DrawableHitObject.cs b/osu.Game/Modes/Objects/Drawables/DrawableHitObject.cs index d4beabe2ba..4df49ca01f 100644 --- a/osu.Game/Modes/Objects/Drawables/DrawableHitObject.cs +++ b/osu.Game/Modes/Objects/Drawables/DrawableHitObject.cs @@ -19,6 +19,10 @@ namespace osu.Game.Modes.Objects.Drawables { public event Action OnJudgement; + public override bool HandleInput => Interactive; + + public bool Interactive = true; + public Container ChildObjects; public JudgementInfo Judgement; diff --git a/osu.Game/Modes/Objects/Drawables/IDrawableHitObjectWithProxiedApproach.cs b/osu.Game/Modes/Objects/Drawables/IDrawableHitObjectWithProxiedApproach.cs new file mode 100644 index 0000000000..9abd2f8592 --- /dev/null +++ b/osu.Game/Modes/Objects/Drawables/IDrawableHitObjectWithProxiedApproach.cs @@ -0,0 +1,17 @@ +// Copyright (c) 2007-2017 ppy Pty Ltd . +// 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.Graphics; + +namespace osu.Game.Modes.Objects.Drawables +{ + public interface IDrawableHitObjectWithProxiedApproach + { + Drawable ProxiedLayer { get; } + } +} diff --git a/osu.Game/Modes/Objects/NullHitObjectParser.cs b/osu.Game/Modes/Objects/NullHitObjectParser.cs new file mode 100644 index 0000000000..4f06d5ab26 --- /dev/null +++ b/osu.Game/Modes/Objects/NullHitObjectParser.cs @@ -0,0 +1,14 @@ +// Copyright (c) 2007-2017 ppy Pty Ltd . +// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE + + +namespace osu.Game.Modes.Objects +{ + /// + /// Returns null HitObjects but at least allows us to run. + /// + public class NullHitObjectParser : HitObjectParser + { + public override HitObject Parse(string text) => null; + } +} diff --git a/osu.Game/OsuGame.cs b/osu.Game/OsuGame.cs index 9188fab355..2cce0aa0ce 100644 --- a/osu.Game/OsuGame.cs +++ b/osu.Game/OsuGame.cs @@ -25,6 +25,7 @@ using OpenTK; using System.Linq; using osu.Framework.Graphics.Primitives; using System.Collections.Generic; +using osu.Game.Overlays.Notifications; namespace osu.Game { @@ -130,6 +131,16 @@ namespace osu.Game Origin = Anchor.TopRight, }).Preload(this, overlayContent.Add); + Logger.NewEntry += entry => + { + if (entry.Level < LogLevel.Important) return; + + notificationManager.Post(new SimpleNotification + { + Text = $@"{entry.Level}: {entry.Message}" + }); + }; + Dependencies.Cache(options); Dependencies.Cache(musicController); Dependencies.Cache(notificationManager); diff --git a/osu.Game/Overlays/Options/OptionDropDown.cs b/osu.Game/Overlays/Options/OptionDropDown.cs index ff1e6ae103..2f88ab34ae 100644 --- a/osu.Game/Overlays/Options/OptionDropDown.cs +++ b/osu.Game/Overlays/Options/OptionDropDown.cs @@ -34,29 +34,32 @@ namespace osu.Game.Overlays.Options set { if (bindable != null) - bindable.ValueChanged -= Bindable_ValueChanged; + bindable.ValueChanged -= bindable_ValueChanged; bindable = value; - bindable.ValueChanged += Bindable_ValueChanged; - Bindable_ValueChanged(null, null); + bindable.ValueChanged += bindable_ValueChanged; + bindable_ValueChanged(null, null); + + if (bindable?.Disabled ?? true) + Alpha = 0.3f; } } private Bindable bindable; - void Bindable_ValueChanged(object sender, EventArgs e) + void bindable_ValueChanged(object sender, EventArgs e) { dropdown.SelectedValue = bindable.Value; } - void Dropdown_ValueChanged(object sender, EventArgs e) + void dropdown_ValueChanged(object sender, EventArgs e) { bindable.Value = dropdown.SelectedValue; } protected override void Dispose(bool isDisposing) { - bindable.ValueChanged -= Bindable_ValueChanged; - dropdown.ValueChanged -= Dropdown_ValueChanged; + bindable.ValueChanged -= bindable_ValueChanged; + dropdown.ValueChanged -= dropdown_ValueChanged; base.Dispose(isDisposing); } @@ -101,7 +104,7 @@ namespace osu.Game.Overlays.Options Items = this.Items, } }; - dropdown.ValueChanged += Dropdown_ValueChanged; + dropdown.ValueChanged += dropdown_ValueChanged; } } } diff --git a/osu.Game/Overlays/Options/OptionEnumDropDown.cs b/osu.Game/Overlays/Options/OptionEnumDropDown.cs index 81438fd59e..044e704d3a 100644 --- a/osu.Game/Overlays/Options/OptionEnumDropDown.cs +++ b/osu.Game/Overlays/Options/OptionEnumDropDown.cs @@ -1,4 +1,7 @@ -using System; +// Copyright (c) 2007-2017 ppy Pty Ltd . +// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE + +using System; using osu.Framework.Configuration; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; diff --git a/osu.Game/Overlays/Options/OptionSlider.cs b/osu.Game/Overlays/Options/OptionSlider.cs index 6a41cb9612..32ce420e7e 100644 --- a/osu.Game/Overlays/Options/OptionSlider.cs +++ b/osu.Game/Overlays/Options/OptionSlider.cs @@ -1,6 +1,7 @@ // Copyright (c) 2007-2017 ppy Pty Ltd . // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE +using OpenTK.Graphics; using osu.Framework.Configuration; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; @@ -16,7 +17,7 @@ namespace osu.Game.Overlays.Options { private SliderBar slider; private SpriteText text; - + public string LabelText { get { return text.Text; } @@ -26,11 +27,16 @@ namespace osu.Game.Overlays.Options text.Alpha = string.IsNullOrEmpty(value) ? 0 : 1; } } - + public BindableNumber Bindable { get { return slider.Bindable; } - set { slider.Bindable = value; } + set + { + slider.Bindable = value; + if (value?.Disabled ?? true) + Alpha = 0.3f; + } } public OptionSlider() diff --git a/osu.Game/Overlays/Options/OptionTextBox.cs b/osu.Game/Overlays/Options/OptionTextBox.cs index 18fcfa6fca..813d372db6 100644 --- a/osu.Game/Overlays/Options/OptionTextBox.cs +++ b/osu.Game/Overlays/Options/OptionTextBox.cs @@ -24,6 +24,9 @@ namespace osu.Game.Overlays.Options base.Text = bindable.Value; bindable.ValueChanged += bindableValueChanged; } + + if (bindable?.Disabled ?? true) + Alpha = 0.3f; } } diff --git a/osu.Game/Overlays/Toolbar/ToolbarModeSelector.cs b/osu.Game/Overlays/Toolbar/ToolbarModeSelector.cs index af543ae559..d8ad235cec 100644 --- a/osu.Game/Overlays/Toolbar/ToolbarModeSelector.cs +++ b/osu.Game/Overlays/Toolbar/ToolbarModeSelector.cs @@ -41,12 +41,11 @@ namespace osu.Game.Overlays.Toolbar Direction = FlowDirections.Horizontal, Anchor = Anchor.TopCentre, Origin = Anchor.TopCentre, - Padding = new MarginPadding { Left = 10, Right = 10 }, + Padding = new MarginPadding { Left = padding, Right = padding }, }, modeButtonLine = new Container { - RelativeSizeAxes = Axes.X, - Size = new Vector2(0.3f, 3), + Size = new Vector2(padding * 2 + ToolbarButton.WIDTH, 3), Anchor = Anchor.BottomLeft, Origin = Anchor.TopLeft, Masking = true, diff --git a/osu.Game/Screens/Backgrounds/BackgroundModeBeatmap.cs b/osu.Game/Screens/Backgrounds/BackgroundModeBeatmap.cs index 65b50542ce..e7b0ba1566 100644 --- a/osu.Game/Screens/Backgrounds/BackgroundModeBeatmap.cs +++ b/osu.Game/Screens/Backgrounds/BackgroundModeBeatmap.cs @@ -78,7 +78,6 @@ namespace osu.Game.Screens.Backgrounds public BeatmapBackground(WorkingBeatmap beatmap) { this.beatmap = beatmap; - CacheDrawnFrameBuffer = true; } [BackgroundDependencyLoader] diff --git a/osu.Game/Screens/GameModeWhiteBox.cs b/osu.Game/Screens/GameModeWhiteBox.cs index b72a352ef9..dce33eefb0 100644 --- a/osu.Game/Screens/GameModeWhiteBox.cs +++ b/osu.Game/Screens/GameModeWhiteBox.cs @@ -145,7 +145,7 @@ namespace osu.Game.Screens Size = new Vector2(1, 40), Anchor = Anchor.BottomRight, Origin = Anchor.BottomRight, - Colour = getColourFor(t), + BackgroundColour = getColourFor(t), Action = delegate { Push(Activator.CreateInstance(t) as GameMode); diff --git a/osu.Game/Screens/Play/Player.cs b/osu.Game/Screens/Play/Player.cs index 7f2fa415d2..650568f60b 100644 --- a/osu.Game/Screens/Play/Player.cs +++ b/osu.Game/Screens/Play/Player.cs @@ -23,6 +23,7 @@ using System.Linq; using osu.Game.Beatmaps; using OpenTK.Graphics; using osu.Framework.Graphics.Containers; +using osu.Framework.Logging; namespace osu.Game.Screens.Play { @@ -75,9 +76,14 @@ namespace osu.Game.Screens.Play { if (Beatmap == null) Beatmap = beatmaps.GetWorkingBeatmap(BeatmapInfo, withStoryboard: true); + + if ((Beatmap?.Beatmap?.HitObjects.Count ?? 0) == 0) + throw new Exception("No valid objects were found!"); } - catch + catch (Exception e) { + Logger.Log($"Could not load this beatmap sucessfully ({e})!", LoggingTarget.Runtime, LogLevel.Error); + //couldn't load, hard abort! Exit(); return; @@ -117,7 +123,8 @@ namespace osu.Game.Screens.Play pauseOverlay = new PauseOverlay { Depth = -1, - OnResume = delegate { + OnResume = delegate + { Delay(400); Schedule(Resume); }, @@ -277,9 +284,9 @@ namespace osu.Game.Screens.Play protected override void OnEntering(GameMode last) { base.OnEntering(last); - + (Background as BackgroundModeBeatmap)?.BlurTo(Vector2.Zero, 1000); - Background?.FadeTo((100f- dimLevel)/100, 1000); + Background?.FadeTo((100f - dimLevel) / 100, 1000); Content.Alpha = 0; dimLevel.ValueChanged += dimChanged; @@ -287,6 +294,8 @@ namespace osu.Game.Screens.Play protected override bool OnExiting(GameMode next) { + if (pauseOverlay == null) return false; + if (pauseOverlay.State != Visibility.Visible && !canPause) return true; if (!IsPaused && sourceClock.IsRunning) // For if the user presses escape quickly when entering the map diff --git a/osu.Game/Screens/Select/BeatmapInfoWedge.cs b/osu.Game/Screens/Select/BeatmapInfoWedge.cs index 390d175bd4..eb93b4ac1a 100644 --- a/osu.Game/Screens/Select/BeatmapInfoWedge.cs +++ b/osu.Game/Screens/Select/BeatmapInfoWedge.cs @@ -74,7 +74,7 @@ namespace osu.Game.Screens.Select { Name = "Length", Icon = FontAwesome.fa_clock_o, - Content = TimeSpan.FromMilliseconds(beatmap.Beatmap.HitObjects.Last().EndTime - beatmap.Beatmap.HitObjects.First().StartTime).ToString(@"m\:ss"), + Content = beatmap.Beatmap.HitObjects.Count == 0 ? "-" : TimeSpan.FromMilliseconds(beatmap.Beatmap.HitObjects.Last().EndTime - beatmap.Beatmap.HitObjects.First().StartTime).ToString(@"m\:ss"), })); labels.Add(new InfoLabel(new BeatmapStatistic diff --git a/osu.Game/osu.Game.csproj b/osu.Game/osu.Game.csproj index 4cbc229596..ed49590dbd 100644 --- a/osu.Game/osu.Game.csproj +++ b/osu.Game/osu.Game.csproj @@ -75,7 +75,9 @@ + + diff --git a/osu.Game/packages.config b/osu.Game/packages.config index 98448d402f..0249d173ac 100644 --- a/osu.Game/packages.config +++ b/osu.Game/packages.config @@ -1,9 +1,8 @@  - diff --git a/osu.licenseheader b/osu.licenseheader index 94a06a7e14..30ea2f9ad9 100644 --- a/osu.licenseheader +++ b/osu.licenseheader @@ -4,6 +4,6 @@ extensions: .xml .config .xsd +--> \ No newline at end of file diff --git a/osu.sln b/osu.sln index 588cabf6b6..bda60c6318 100644 --- a/osu.sln +++ b/osu.sln @@ -31,6 +31,10 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "osu.Game.Modes.Mania", "osu EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "osu.Desktop.Tests", "osu.Desktop.Tests\osu.Desktop.Tests.csproj", "{230AC4F3-7783-49FB-9AEC-B83CDA3B9F3D}" EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "osu.Desktop.Deploy", "osu.Desktop.Deploy\osu.Desktop.Deploy.csproj", "{BAEA2F74-0315-4667-84E0-ACAC0B4BF785}" +EndProject +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Tools", "Tools", "{6EAD7610-89D8-48A2-8BE0-E348297E4D8B}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU @@ -85,6 +89,8 @@ Global {230AC4F3-7783-49FB-9AEC-B83CDA3B9F3D}.Debug|Any CPU.Build.0 = Debug|Any CPU {230AC4F3-7783-49FB-9AEC-B83CDA3B9F3D}.Release|Any CPU.ActiveCfg = Release|Any CPU {230AC4F3-7783-49FB-9AEC-B83CDA3B9F3D}.Release|Any CPU.Build.0 = Release|Any CPU + {BAEA2F74-0315-4667-84E0-ACAC0B4BF785}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {BAEA2F74-0315-4667-84E0-ACAC0B4BF785}.Release|Any CPU.ActiveCfg = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE @@ -102,6 +108,7 @@ Global {F167E17A-7DE6-4AF5-B920-A5112296C695} = {0D37A2AD-80A4-464F-A1DE-1560B70F1CE3} {48F4582B-7687-4621-9CBE-5C24197CB536} = {0D37A2AD-80A4-464F-A1DE-1560B70F1CE3} {230AC4F3-7783-49FB-9AEC-B83CDA3B9F3D} = {0D37A2AD-80A4-464F-A1DE-1560B70F1CE3} + {BAEA2F74-0315-4667-84E0-ACAC0B4BF785} = {6EAD7610-89D8-48A2-8BE0-E348297E4D8B} EndGlobalSection GlobalSection(MonoDevelopProperties) = preSolution Policies = $0 diff --git a/osu.sln.DotSettings b/osu.sln.DotSettings index e9b225da4e..d3054a4561 100644 --- a/osu.sln.DotSettings +++ b/osu.sln.DotSettings @@ -21,8 +21,10 @@ DO_NOT_SHOW DO_NOT_SHOW HINT + HINT SUGGESTION HINT + HINT <?xml version="1.0" encoding="utf-16"?><Profile name="Code Cleanup (peppy)"><CSArrangeThisQualifier>True</CSArrangeThisQualifier><CSUseVar><BehavourStyle>CAN_CHANGE_TO_EXPLICIT</BehavourStyle><LocalVariableStyle>ALWAYS_EXPLICIT</LocalVariableStyle><ForeachVariableStyle>ALWAYS_EXPLICIT</ForeachVariableStyle></CSUseVar><CSOptimizeUsings><OptimizeUsings>True</OptimizeUsings><EmbraceInRegion>False</EmbraceInRegion><RegionName></RegionName></CSOptimizeUsings><CSShortenReferences>True</CSShortenReferences><CSReformatCode>True</CSReformatCode><CSUpdateFileHeader>True</CSUpdateFileHeader><CSCodeStyleAttributes ArrangeTypeAccessModifier="False" ArrangeTypeMemberAccessModifier="False" SortModifiers="True" RemoveRedundantParentheses="True" AddMissingParentheses="False" ArrangeBraces="False" ArrangeAttributes="False" ArrangeArgumentsStyle="False" /><XAMLCollapseEmptyTags>False</XAMLCollapseEmptyTags><CSFixBuiltinTypeReferences>True</CSFixBuiltinTypeReferences><CSArrangeQualifiers>True</CSArrangeQualifiers></Profile> Code Cleanup (peppy) True