From 72959691e9e2aa5958521717dd940a2601d46ee6 Mon Sep 17 00:00:00 2001 From: Roman Kapustin Date: Sun, 22 Jul 2018 17:16:17 +0300 Subject: [PATCH 001/417] Introduce KeyCounterMemento --- osu.Game/Screens/Play/HUDOverlay.cs | 2 +- osu.Game/Screens/Play/KeyCounter.cs | 7 +++++++ osu.Game/Screens/Play/KeyCounterCollection.cs | 10 +++++++--- osu.Game/Screens/Play/KeyCounterMemento.cs | 17 +++++++++++++++++ 4 files changed, 32 insertions(+), 4 deletions(-) create mode 100644 osu.Game/Screens/Play/KeyCounterMemento.cs diff --git a/osu.Game/Screens/Play/HUDOverlay.cs b/osu.Game/Screens/Play/HUDOverlay.cs index 4f3fe15211..c6a411c0bb 100644 --- a/osu.Game/Screens/Play/HUDOverlay.cs +++ b/osu.Game/Screens/Play/HUDOverlay.cs @@ -79,7 +79,7 @@ namespace osu.Game.Screens.Play BindRulesetContainer(rulesetContainer); Progress.Objects = rulesetContainer.Objects; - Progress.AudioClock = offsetClock; + Progress.AudioClock = KeyCounter.AudioClock = offsetClock; Progress.AllowSeeking = rulesetContainer.HasReplayLoaded; Progress.OnSeek = pos => adjustableClock.Seek(pos); diff --git a/osu.Game/Screens/Play/KeyCounter.cs b/osu.Game/Screens/Play/KeyCounter.cs index 2c31e61114..01f1d6dafd 100644 --- a/osu.Game/Screens/Play/KeyCounter.cs +++ b/osu.Game/Screens/Play/KeyCounter.cs @@ -6,6 +6,7 @@ using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Sprites; using osu.Framework.Graphics.Textures; +using osu.Framework.Timing; using osu.Game.Graphics.Sprites; using OpenTK; using OpenTK.Graphics; @@ -55,6 +56,8 @@ namespace osu.Game.Screens.Play public Color4 KeyUpTextColor { get; set; } = Color4.White; public int FadeTime { get; set; } + public IClock AudioClock { get; set; } + protected KeyCounter(string name) { Name = name; @@ -129,5 +132,9 @@ namespace osu.Game.Screens.Play } public void ResetCount() => CountPresses = 0; + + public KeyCounterMemento SaveState() => new KeyCounterMemento(AudioClock.CurrentTime, CountPresses); + + public void RestoreState(KeyCounterMemento memento) => CountPresses = memento.CountPresses; } } diff --git a/osu.Game/Screens/Play/KeyCounterCollection.cs b/osu.Game/Screens/Play/KeyCounterCollection.cs index 721d925d63..5f1e502cf7 100644 --- a/osu.Game/Screens/Play/KeyCounterCollection.cs +++ b/osu.Game/Screens/Play/KeyCounterCollection.cs @@ -3,14 +3,15 @@ using System; using System.Linq; +using osu.Framework.Allocation; +using osu.Framework.Configuration; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; -using OpenTK.Graphics; using osu.Framework.Input; -using osu.Framework.Configuration; -using osu.Framework.Allocation; +using osu.Framework.Timing; using osu.Game.Configuration; using OpenTK; +using OpenTK.Graphics; namespace osu.Game.Screens.Play { @@ -36,6 +37,7 @@ namespace osu.Game.Screens.Play key.FadeTime = FadeTime; key.KeyDownTextColor = KeyDownTextColor; key.KeyUpTextColor = KeyUpTextColor; + key.AudioClock = AudioClock; } public void ResetCount() @@ -117,6 +119,8 @@ namespace osu.Game.Screens.Play public override bool HandleKeyboardInput => receptor == null; public override bool HandleMouseInput => receptor == null; + public IClock AudioClock { get; set; } + private Receptor receptor; public Receptor GetReceptor() diff --git a/osu.Game/Screens/Play/KeyCounterMemento.cs b/osu.Game/Screens/Play/KeyCounterMemento.cs new file mode 100644 index 0000000000..daf217cb62 --- /dev/null +++ b/osu.Game/Screens/Play/KeyCounterMemento.cs @@ -0,0 +1,17 @@ +// Copyright (c) 2007-2018 ppy Pty Ltd . +// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE + +namespace osu.Game.Screens.Play +{ + public class KeyCounterMemento + { + public KeyCounterMemento(double currentTime, int countPresses) + { + CurrentTime = currentTime; + CountPresses = countPresses; + } + + public double CurrentTime { get; } + public int CountPresses { get; } + } +} From 0632c59e604449e197fb5b13acf88bd4ee88c3d9 Mon Sep 17 00:00:00 2001 From: Roman Kapustin Date: Sun, 22 Jul 2018 17:35:42 +0300 Subject: [PATCH 002/417] Save KeyCounter state when keypress happens --- osu.Game/Screens/Play/KeyCounter.cs | 6 ++++++ osu.Game/Screens/Play/KeyCounterCollection.cs | 6 ++++++ 2 files changed, 12 insertions(+) diff --git a/osu.Game/Screens/Play/KeyCounter.cs b/osu.Game/Screens/Play/KeyCounter.cs index 01f1d6dafd..99685c238f 100644 --- a/osu.Game/Screens/Play/KeyCounter.cs +++ b/osu.Game/Screens/Play/KeyCounter.cs @@ -1,6 +1,7 @@ // Copyright (c) 2007-2018 ppy Pty Ltd . // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE +using System; using osu.Framework.Allocation; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; @@ -15,6 +16,8 @@ namespace osu.Game.Screens.Play { public abstract class KeyCounter : Container { + public event Action KeyPressed; + private Sprite buttonSprite; private Sprite glowSprite; private Container textLayer; @@ -46,7 +49,10 @@ namespace osu.Game.Screens.Play isLit = value; updateGlowSprite(value); if (value && IsCounting) + { CountPresses++; + KeyPressed?.Invoke(); + } } } } diff --git a/osu.Game/Screens/Play/KeyCounterCollection.cs b/osu.Game/Screens/Play/KeyCounterCollection.cs index 5f1e502cf7..e472e8d9c9 100644 --- a/osu.Game/Screens/Play/KeyCounterCollection.cs +++ b/osu.Game/Screens/Play/KeyCounterCollection.cs @@ -2,6 +2,7 @@ // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE using System; +using System.Collections.Generic; using System.Linq; using osu.Framework.Allocation; using osu.Framework.Configuration; @@ -22,6 +23,8 @@ namespace osu.Game.Screens.Play public readonly Bindable Visible = new Bindable(true); private readonly Bindable configVisibility = new Bindable(); + private readonly Dictionary> keyCountersState = new Dictionary>(); + public KeyCounterCollection() { Direction = FillDirection.Horizontal; @@ -38,6 +41,9 @@ namespace osu.Game.Screens.Play key.KeyDownTextColor = KeyDownTextColor; key.KeyUpTextColor = KeyUpTextColor; key.AudioClock = AudioClock; + + keyCountersState.Add(key.Name, new List()); + key.KeyPressed += () => keyCountersState[key.Name].Add(key.SaveState()); } public void ResetCount() From 1d9bf420821bb33d39873d51ab3ad60a8a8ab856 Mon Sep 17 00:00:00 2001 From: Roman Kapustin Date: Sun, 22 Jul 2018 18:38:10 +0300 Subject: [PATCH 003/417] Fix clock assigning during KeyCounterCollection creation --- osu.Game/Screens/Play/HUDOverlay.cs | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/osu.Game/Screens/Play/HUDOverlay.cs b/osu.Game/Screens/Play/HUDOverlay.cs index c6a411c0bb..b813fb7cba 100644 --- a/osu.Game/Screens/Play/HUDOverlay.cs +++ b/osu.Game/Screens/Play/HUDOverlay.cs @@ -68,7 +68,7 @@ namespace osu.Game.Screens.Play Direction = FillDirection.Vertical, Children = new Drawable[] { - KeyCounter = CreateKeyCounter(), + KeyCounter = CreateKeyCounter(offsetClock), HoldToQuit = CreateQuitButton(), } } @@ -79,7 +79,7 @@ namespace osu.Game.Screens.Play BindRulesetContainer(rulesetContainer); Progress.Objects = rulesetContainer.Objects; - Progress.AudioClock = KeyCounter.AudioClock = offsetClock; + Progress.AudioClock = offsetClock; Progress.AllowSeeking = rulesetContainer.HasReplayLoaded; Progress.OnSeek = pos => adjustableClock.Seek(pos); @@ -193,12 +193,13 @@ namespace osu.Game.Screens.Play Margin = new MarginPadding { Top = 20 } }; - protected virtual KeyCounterCollection CreateKeyCounter() => new KeyCounterCollection + protected virtual KeyCounterCollection CreateKeyCounter(IClock offsetClock) => new KeyCounterCollection { FadeTime = 50, Anchor = Anchor.BottomRight, Origin = Anchor.BottomRight, Margin = new MarginPadding(10), + AudioClock = offsetClock }; protected virtual ScoreCounter CreateScoreCounter() => new ScoreCounter(6) From 7f3ad37edec8eb9df2fc4e8338fac0612b2c1ad8 Mon Sep 17 00:00:00 2001 From: Roman Kapustin Date: Sun, 22 Jul 2018 19:42:18 +0300 Subject: [PATCH 004/417] Restore keycounter state on replay seek --- osu.Game/Screens/Play/HUDOverlay.cs | 8 ++++++-- osu.Game/Screens/Play/KeyCounterCollection.cs | 9 +++++++++ 2 files changed, 15 insertions(+), 2 deletions(-) diff --git a/osu.Game/Screens/Play/HUDOverlay.cs b/osu.Game/Screens/Play/HUDOverlay.cs index b813fb7cba..7fc4d637e0 100644 --- a/osu.Game/Screens/Play/HUDOverlay.cs +++ b/osu.Game/Screens/Play/HUDOverlay.cs @@ -68,7 +68,7 @@ namespace osu.Game.Screens.Play Direction = FillDirection.Vertical, Children = new Drawable[] { - KeyCounter = CreateKeyCounter(offsetClock), + KeyCounter = CreateKeyCounter(adjustableClock), HoldToQuit = CreateQuitButton(), } } @@ -81,7 +81,11 @@ namespace osu.Game.Screens.Play Progress.Objects = rulesetContainer.Objects; Progress.AudioClock = offsetClock; Progress.AllowSeeking = rulesetContainer.HasReplayLoaded; - Progress.OnSeek = pos => adjustableClock.Seek(pos); + Progress.OnSeek = pos => + { + adjustableClock.Seek(pos); + KeyCounter.RestoreKeyCounterState(pos); + }; ModDisplay.Current.BindTo(working.Mods); diff --git a/osu.Game/Screens/Play/KeyCounterCollection.cs b/osu.Game/Screens/Play/KeyCounterCollection.cs index e472e8d9c9..8ee3e97e54 100644 --- a/osu.Game/Screens/Play/KeyCounterCollection.cs +++ b/osu.Game/Screens/Play/KeyCounterCollection.cs @@ -46,6 +46,15 @@ namespace osu.Game.Screens.Play key.KeyPressed += () => keyCountersState[key.Name].Add(key.SaveState()); } + public void RestoreKeyCounterState(double time) + { + foreach (var counter in Children) + { + var targetState = keyCountersState[counter.Name].LastOrDefault(state => state.CurrentTime <= time); + counter.RestoreState(targetState); + } + } + public void ResetCount() { foreach (var counter in Children) From ecd51d70f991bd204728c3a392ab4217c79af094 Mon Sep 17 00:00:00 2001 From: Roman Kapustin Date: Sun, 22 Jul 2018 23:13:06 +0300 Subject: [PATCH 005/417] Rename Memento class --- osu.Game/Screens/Play/KeyCounter.cs | 4 ++-- osu.Game/Screens/Play/KeyCounterCollection.cs | 6 +++--- osu.Game/Screens/Play/KeyCounterMemento.cs | 17 ----------------- osu.Game/Screens/Play/KeyCounterState.cs | 17 +++++++++++++++++ 4 files changed, 22 insertions(+), 22 deletions(-) delete mode 100644 osu.Game/Screens/Play/KeyCounterMemento.cs create mode 100644 osu.Game/Screens/Play/KeyCounterState.cs diff --git a/osu.Game/Screens/Play/KeyCounter.cs b/osu.Game/Screens/Play/KeyCounter.cs index 99685c238f..7e9c04110c 100644 --- a/osu.Game/Screens/Play/KeyCounter.cs +++ b/osu.Game/Screens/Play/KeyCounter.cs @@ -139,8 +139,8 @@ namespace osu.Game.Screens.Play public void ResetCount() => CountPresses = 0; - public KeyCounterMemento SaveState() => new KeyCounterMemento(AudioClock.CurrentTime, CountPresses); + public KeyCounterState SaveState() => new KeyCounterState(AudioClock.CurrentTime, CountPresses); - public void RestoreState(KeyCounterMemento memento) => CountPresses = memento.CountPresses; + public void RestoreState(KeyCounterState state) => CountPresses = state.Count; } } diff --git a/osu.Game/Screens/Play/KeyCounterCollection.cs b/osu.Game/Screens/Play/KeyCounterCollection.cs index 8978181ce4..cdb42ec514 100644 --- a/osu.Game/Screens/Play/KeyCounterCollection.cs +++ b/osu.Game/Screens/Play/KeyCounterCollection.cs @@ -24,7 +24,7 @@ namespace osu.Game.Screens.Play public readonly Bindable Visible = new Bindable(true); private readonly Bindable configVisibility = new Bindable(); - private readonly Dictionary> keyCountersState = new Dictionary>(); + private readonly Dictionary> keyCountersState = new Dictionary>(); public KeyCounterCollection() { @@ -43,7 +43,7 @@ namespace osu.Game.Screens.Play key.KeyUpTextColor = KeyUpTextColor; key.AudioClock = AudioClock; - keyCountersState.Add(key.Name, new List()); + keyCountersState.Add(key.Name, new List()); key.KeyPressed += () => keyCountersState[key.Name].Add(key.SaveState()); } @@ -51,7 +51,7 @@ namespace osu.Game.Screens.Play { foreach (var counter in Children) { - var targetState = keyCountersState[counter.Name].LastOrDefault(state => state.CurrentTime <= time); + var targetState = keyCountersState[counter.Name].LastOrDefault(state => state.Time <= time); counter.RestoreState(targetState); } } diff --git a/osu.Game/Screens/Play/KeyCounterMemento.cs b/osu.Game/Screens/Play/KeyCounterMemento.cs deleted file mode 100644 index daf217cb62..0000000000 --- a/osu.Game/Screens/Play/KeyCounterMemento.cs +++ /dev/null @@ -1,17 +0,0 @@ -// Copyright (c) 2007-2018 ppy Pty Ltd . -// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE - -namespace osu.Game.Screens.Play -{ - public class KeyCounterMemento - { - public KeyCounterMemento(double currentTime, int countPresses) - { - CurrentTime = currentTime; - CountPresses = countPresses; - } - - public double CurrentTime { get; } - public int CountPresses { get; } - } -} diff --git a/osu.Game/Screens/Play/KeyCounterState.cs b/osu.Game/Screens/Play/KeyCounterState.cs new file mode 100644 index 0000000000..e5c0703319 --- /dev/null +++ b/osu.Game/Screens/Play/KeyCounterState.cs @@ -0,0 +1,17 @@ +// Copyright (c) 2007-2018 ppy Pty Ltd . +// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE + +namespace osu.Game.Screens.Play +{ + public class KeyCounterState + { + public KeyCounterState(double time, int count) + { + Time = time; + Count = count; + } + + public readonly double Time; + public readonly int Count; + } +} From 332ad5bb67df65bce9dac3fe2aed748e11b8e112 Mon Sep 17 00:00:00 2001 From: Roman Kapustin Date: Sun, 22 Jul 2018 23:58:21 +0300 Subject: [PATCH 006/417] Move states to KeyCounter --- osu.Game/Screens/Play/KeyCounter.cs | 24 ++++++++++++++----- osu.Game/Screens/Play/KeyCounterCollection.cs | 15 +++--------- 2 files changed, 21 insertions(+), 18 deletions(-) diff --git a/osu.Game/Screens/Play/KeyCounter.cs b/osu.Game/Screens/Play/KeyCounter.cs index 7e9c04110c..f5d218b4cf 100644 --- a/osu.Game/Screens/Play/KeyCounter.cs +++ b/osu.Game/Screens/Play/KeyCounter.cs @@ -1,7 +1,8 @@ // Copyright (c) 2007-2018 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 osu.Framework.Allocation; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; @@ -16,13 +17,13 @@ namespace osu.Game.Screens.Play { public abstract class KeyCounter : Container { - public event Action KeyPressed; - private Sprite buttonSprite; private Sprite glowSprite; private Container textLayer; private SpriteText countSpriteText; + private readonly List states = new List(); + public bool IsCounting { get; set; } = true; private int countPresses; public int CountPresses @@ -51,7 +52,7 @@ namespace osu.Game.Screens.Play if (value && IsCounting) { CountPresses++; - KeyPressed?.Invoke(); + SaveState(); } } } @@ -139,8 +140,19 @@ namespace osu.Game.Screens.Play public void ResetCount() => CountPresses = 0; - public KeyCounterState SaveState() => new KeyCounterState(AudioClock.CurrentTime, CountPresses); + public void SaveState() + { + var lastState = states.LastOrDefault(); - public void RestoreState(KeyCounterState state) => CountPresses = state.Count; + if (lastState == null || lastState.Time < AudioClock.CurrentTime) + states.Add(new KeyCounterState(AudioClock.CurrentTime, CountPresses)); + } + + public void RestoreState(double time) + { + var targetState = states.LastOrDefault(state => state.Time <= time) ?? states.LastOrDefault(); + var targetCount = targetState?.Count ?? 0; + CountPresses = targetCount; + } } } diff --git a/osu.Game/Screens/Play/KeyCounterCollection.cs b/osu.Game/Screens/Play/KeyCounterCollection.cs index cdb42ec514..c4974dbaa8 100644 --- a/osu.Game/Screens/Play/KeyCounterCollection.cs +++ b/osu.Game/Screens/Play/KeyCounterCollection.cs @@ -2,18 +2,17 @@ // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE using System; -using System.Collections.Generic; using System.Linq; using osu.Framework.Allocation; using osu.Framework.Configuration; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; -using osu.Framework.Timing; -using OpenTK.Graphics; using osu.Framework.Input.EventArgs; using osu.Framework.Input.States; +using osu.Framework.Timing; using osu.Game.Configuration; using OpenTK; +using OpenTK.Graphics; namespace osu.Game.Screens.Play { @@ -24,8 +23,6 @@ namespace osu.Game.Screens.Play public readonly Bindable Visible = new Bindable(true); private readonly Bindable configVisibility = new Bindable(); - private readonly Dictionary> keyCountersState = new Dictionary>(); - public KeyCounterCollection() { Direction = FillDirection.Horizontal; @@ -42,18 +39,12 @@ namespace osu.Game.Screens.Play key.KeyDownTextColor = KeyDownTextColor; key.KeyUpTextColor = KeyUpTextColor; key.AudioClock = AudioClock; - - keyCountersState.Add(key.Name, new List()); - key.KeyPressed += () => keyCountersState[key.Name].Add(key.SaveState()); } public void RestoreKeyCounterState(double time) { foreach (var counter in Children) - { - var targetState = keyCountersState[counter.Name].LastOrDefault(state => state.Time <= time); - counter.RestoreState(targetState); - } + counter.RestoreState(time); } public void ResetCount() From 4a5a453c7f442cfddf5a166c260051bf0f0bec39 Mon Sep 17 00:00:00 2001 From: miterosan Date: Mon, 23 Jul 2018 21:28:56 +0200 Subject: [PATCH 007/417] Create an inital cake buildscript --- .gitignore | 4 + build.cake | 47 +++++++++ build.ps1 | 236 ++++++++++++++++++++++++++++++++++++++++++ build.sh | 117 +++++++++++++++++++++ cake.config | 2 + tools/packages.config | 4 + 6 files changed, 410 insertions(+) create mode 100644 build.cake create mode 100644 build.ps1 create mode 100644 build.sh create mode 100644 cake.config create mode 100644 tools/packages.config diff --git a/.gitignore b/.gitignore index 5138e940ed..be43e1a79c 100644 --- a/.gitignore +++ b/.gitignore @@ -10,6 +10,10 @@ # User-specific files (MonoDevelop/Xamarin Studio) *.userprefs +### Cake ### +tools/* +!tools/packages.config + # Build results bin/[Dd]ebug/ [Dd]ebugPublic/ diff --git a/build.cake b/build.cake new file mode 100644 index 0000000000..ca005279ad --- /dev/null +++ b/build.cake @@ -0,0 +1,47 @@ +#tool Microsoft.TestPlatform.Portable + +/////////////////////////////////////////////////////////////////////////////// +// ARGUMENTS +/////////////////////////////////////////////////////////////////////////////// + +var target = Argument("target", "Test"); +var framework = Argument("framework", "net471"); +var configuration = Argument("configuration", "Debug"); + +var osuDesktop = new FilePath("./osu.Desktop/osu.Desktop.csproj"); + +var testProjects = new [] { + new FilePath("./osu.Game.Tests/osu.Game.Tests.csproj"), + new FilePath("./osu.Game.Rulesets.Osu.Tests/osu.Game.Rulesets.Osu.Tests.csproj"), + new FilePath("./osu.Game.Rulesets.Catch.Tests/osu.Game.Rulesets.Catch.Tests.csproj"), + new FilePath("./osu.Game.Rulesets.Mania.Tests/osu.Game.Rulesets.Mania.Tests.csproj"), + new FilePath("./osu.Game.Rulesets.Taiko.Tests/osu.Game.Rulesets.Taiko.Tests.csproj"), +}; + +/////////////////////////////////////////////////////////////////////////////// +// TASKS +/////////////////////////////////////////////////////////////////////////////// + +Task("Compile") +.Does(() => { + DotNetCoreBuild(osuDesktop.FullPath, new DotNetCoreBuildSettings { + Framework = framework, + Configuration = "Debug" + }); +}); + +Task("CompileTests") +.DoesForEach(testProjects, testProject => { + DotNetCoreBuild(testProject.FullPath, new DotNetCoreBuildSettings { + Framework = framework + }); +}); + + +Task("Test") +.IsDependentOn("CompileTests") +.Does(() => { + VSTest($"./*.Tests/bin/{configuration}/{framework}/**/*Tests.exe"); +}); + +RunTarget(target); \ No newline at end of file diff --git a/build.ps1 b/build.ps1 new file mode 100644 index 0000000000..dc42c4595a --- /dev/null +++ b/build.ps1 @@ -0,0 +1,236 @@ +########################################################################## +# This is the Cake bootstrapper script for PowerShell. +# This file was downloaded from https://github.com/cake-build/resources +# Feel free to change this file to fit your needs. +########################################################################## + +<# + +.SYNOPSIS +This is a Powershell script to bootstrap a Cake build. + +.DESCRIPTION +This Powershell script will download NuGet if missing, restore NuGet tools (including Cake) +and execute your Cake build script with the parameters you provide. + +.PARAMETER Script +The build script to execute. +.PARAMETER Target +The build script target to run. +.PARAMETER Configuration +The build configuration to use. +.PARAMETER Verbosity +Specifies the amount of information to be displayed. +.PARAMETER ShowDescription +Shows description about tasks. +.PARAMETER DryRun +Performs a dry run. +.PARAMETER Experimental +Uses the nightly builds of the Roslyn script engine. +.PARAMETER Mono +Uses the Mono Compiler rather than the Roslyn script engine. +.PARAMETER SkipToolPackageRestore +Skips restoring of packages. +.PARAMETER ScriptArgs +Remaining arguments are added here. + +.LINK +https://cakebuild.net + +#> + +[CmdletBinding()] +Param( + [string]$Script = "build.cake", + [string]$Target, + [string]$Configuration, + [ValidateSet("Quiet", "Minimal", "Normal", "Verbose", "Diagnostic")] + [string]$Verbosity, + [switch]$ShowDescription, + [Alias("WhatIf", "Noop")] + [switch]$DryRun, + [switch]$Experimental, + [switch]$Mono, + [switch]$SkipToolPackageRestore, + [Parameter(Position=0,Mandatory=$false,ValueFromRemainingArguments=$true)] + [string[]]$ScriptArgs +) + +[Reflection.Assembly]::LoadWithPartialName("System.Security") | Out-Null +function MD5HashFile([string] $filePath) +{ + if ([string]::IsNullOrEmpty($filePath) -or !(Test-Path $filePath -PathType Leaf)) + { + return $null + } + + [System.IO.Stream] $file = $null; + [System.Security.Cryptography.MD5] $md5 = $null; + try + { + $md5 = [System.Security.Cryptography.MD5]::Create() + $file = [System.IO.File]::OpenRead($filePath) + return [System.BitConverter]::ToString($md5.ComputeHash($file)) + } + finally + { + if ($file -ne $null) + { + $file.Dispose() + } + } +} + +function GetProxyEnabledWebClient +{ + $wc = New-Object System.Net.WebClient + $proxy = [System.Net.WebRequest]::GetSystemWebProxy() + $proxy.Credentials = [System.Net.CredentialCache]::DefaultCredentials + $wc.Proxy = $proxy + return $wc +} + +Write-Host "Preparing to run build script..." + +if(!$PSScriptRoot){ + $PSScriptRoot = Split-Path $MyInvocation.MyCommand.Path -Parent +} + +$TOOLS_DIR = Join-Path $PSScriptRoot "tools" +$ADDINS_DIR = Join-Path $TOOLS_DIR "Addins" +$MODULES_DIR = Join-Path $TOOLS_DIR "Modules" +$NUGET_EXE = Join-Path $TOOLS_DIR "nuget.exe" +$CAKE_EXE = Join-Path $TOOLS_DIR "Cake/Cake.exe" +$NUGET_URL = "https://dist.nuget.org/win-x86-commandline/latest/nuget.exe" +$PACKAGES_CONFIG = Join-Path $TOOLS_DIR "packages.config" +$PACKAGES_CONFIG_MD5 = Join-Path $TOOLS_DIR "packages.config.md5sum" +$ADDINS_PACKAGES_CONFIG = Join-Path $ADDINS_DIR "packages.config" +$MODULES_PACKAGES_CONFIG = Join-Path $MODULES_DIR "packages.config" + +# Make sure tools folder exists +if ((Test-Path $PSScriptRoot) -and !(Test-Path $TOOLS_DIR)) { + Write-Verbose -Message "Creating tools directory..." + New-Item -Path $TOOLS_DIR -Type directory | out-null +} + +# Make sure that packages.config exist. +if (!(Test-Path $PACKAGES_CONFIG)) { + Write-Verbose -Message "Downloading packages.config..." + try { + $wc = GetProxyEnabledWebClient + $wc.DownloadFile("https://cakebuild.net/download/bootstrapper/packages", $PACKAGES_CONFIG) + } catch { + Throw "Could not download packages.config." + } +} + +# Try find NuGet.exe in path if not exists +if (!(Test-Path $NUGET_EXE)) { + Write-Verbose -Message "Trying to find nuget.exe in PATH..." + $existingPaths = $Env:Path -Split ';' | Where-Object { (![string]::IsNullOrEmpty($_)) -and (Test-Path $_ -PathType Container) } + $NUGET_EXE_IN_PATH = Get-ChildItem -Path $existingPaths -Filter "nuget.exe" | Select -First 1 + if ($NUGET_EXE_IN_PATH -ne $null -and (Test-Path $NUGET_EXE_IN_PATH.FullName)) { + Write-Verbose -Message "Found in PATH at $($NUGET_EXE_IN_PATH.FullName)." + $NUGET_EXE = $NUGET_EXE_IN_PATH.FullName + } +} + +# Try download NuGet.exe if not exists +if (!(Test-Path $NUGET_EXE)) { + Write-Verbose -Message "Downloading NuGet.exe..." + try { + $wc = GetProxyEnabledWebClient + $wc.DownloadFile($NUGET_URL, $NUGET_EXE) + } catch { + Throw "Could not download NuGet.exe." + } +} + +# Save nuget.exe path to environment to be available to child processed +$ENV:NUGET_EXE = $NUGET_EXE + +# Restore tools from NuGet? +if(-Not $SkipToolPackageRestore.IsPresent) { + Push-Location + Set-Location $TOOLS_DIR + + # Check for changes in packages.config and remove installed tools if true. + [string] $md5Hash = MD5HashFile($PACKAGES_CONFIG) + if((!(Test-Path $PACKAGES_CONFIG_MD5)) -Or + ($md5Hash -ne (Get-Content $PACKAGES_CONFIG_MD5 ))) { + Write-Verbose -Message "Missing or changed package.config hash..." + Get-ChildItem -Exclude packages.config,nuget.exe,Cake.Bakery | + Remove-Item -Recurse + } + + Write-Verbose -Message "Restoring tools from NuGet..." + $NuGetOutput = Invoke-Expression "&`"$NUGET_EXE`" install -ExcludeVersion -OutputDirectory `"$TOOLS_DIR`"" + + if ($LASTEXITCODE -ne 0) { + Throw "An error occurred while restoring NuGet tools." + } + else + { + $md5Hash | Out-File $PACKAGES_CONFIG_MD5 -Encoding "ASCII" + } + Write-Verbose -Message ($NuGetOutput | out-string) + + Pop-Location +} + +# Restore addins from NuGet +if (Test-Path $ADDINS_PACKAGES_CONFIG) { + Push-Location + Set-Location $ADDINS_DIR + + Write-Verbose -Message "Restoring addins from NuGet..." + $NuGetOutput = Invoke-Expression "&`"$NUGET_EXE`" install -ExcludeVersion -OutputDirectory `"$ADDINS_DIR`"" + + if ($LASTEXITCODE -ne 0) { + Throw "An error occurred while restoring NuGet addins." + } + + Write-Verbose -Message ($NuGetOutput | out-string) + + Pop-Location +} + +# Restore modules from NuGet +if (Test-Path $MODULES_PACKAGES_CONFIG) { + Push-Location + Set-Location $MODULES_DIR + + Write-Verbose -Message "Restoring modules from NuGet..." + $NuGetOutput = Invoke-Expression "&`"$NUGET_EXE`" install -ExcludeVersion -OutputDirectory `"$MODULES_DIR`"" + + if ($LASTEXITCODE -ne 0) { + Throw "An error occurred while restoring NuGet modules." + } + + Write-Verbose -Message ($NuGetOutput | out-string) + + Pop-Location +} + +# Make sure that Cake has been installed. +if (!(Test-Path $CAKE_EXE)) { + Throw "Could not find Cake.exe at $CAKE_EXE" +} + + + +# Build Cake arguments +$cakeArguments = @("$Script"); +if ($Target) { $cakeArguments += "-target=$Target" } +if ($Configuration) { $cakeArguments += "-configuration=$Configuration" } +if ($Verbosity) { $cakeArguments += "-verbosity=$Verbosity" } +if ($ShowDescription) { $cakeArguments += "-showdescription" } +if ($DryRun) { $cakeArguments += "-dryrun" } +if ($Experimental) { $cakeArguments += "-experimental" } +if ($Mono) { $cakeArguments += "-mono" } +$cakeArguments += $ScriptArgs + +# Start Cake +Write-Host "Running build script..." +&$CAKE_EXE $cakeArguments +exit $LASTEXITCODE diff --git a/build.sh b/build.sh new file mode 100644 index 0000000000..b9e12527f1 --- /dev/null +++ b/build.sh @@ -0,0 +1,117 @@ +#!/usr/bin/env bash + +########################################################################## +# This is the Cake bootstrapper script for Linux and OS X. +# This file was downloaded from https://github.com/cake-build/resources +# Feel free to change this file to fit your needs. +########################################################################## + +# Define directories. +SCRIPT_DIR=$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd ) +TOOLS_DIR=$SCRIPT_DIR/tools +ADDINS_DIR=$TOOLS_DIR/Addins +MODULES_DIR=$TOOLS_DIR/Modules +NUGET_EXE=$TOOLS_DIR/nuget.exe +CAKE_EXE=$TOOLS_DIR/Cake/Cake.exe +PACKAGES_CONFIG=$TOOLS_DIR/packages.config +PACKAGES_CONFIG_MD5=$TOOLS_DIR/packages.config.md5sum +ADDINS_PACKAGES_CONFIG=$ADDINS_DIR/packages.config +MODULES_PACKAGES_CONFIG=$MODULES_DIR/packages.config + +# Define md5sum or md5 depending on Linux/OSX +MD5_EXE= +if [[ "$(uname -s)" == "Darwin" ]]; then + MD5_EXE="md5 -r" +else + MD5_EXE="md5sum" +fi + +# Define default arguments. +SCRIPT="build.cake" +CAKE_ARGUMENTS=() + +# Parse arguments. +for i in "$@"; do + case $1 in + -s|--script) SCRIPT="$2"; shift ;; + --) shift; CAKE_ARGUMENTS+=("$@"); break ;; + *) CAKE_ARGUMENTS+=("$1") ;; + esac + shift +done + +# Make sure the tools folder exist. +if [ ! -d "$TOOLS_DIR" ]; then + mkdir "$TOOLS_DIR" +fi + +# Make sure that packages.config exist. +if [ ! -f "$TOOLS_DIR/packages.config" ]; then + echo "Downloading packages.config..." + curl -Lsfo "$TOOLS_DIR/packages.config" https://cakebuild.net/download/bootstrapper/packages + if [ $? -ne 0 ]; then + echo "An error occurred while downloading packages.config." + exit 1 + fi +fi + +# Download NuGet if it does not exist. +if [ ! -f "$NUGET_EXE" ]; then + echo "Downloading NuGet..." + curl -Lsfo "$NUGET_EXE" https://dist.nuget.org/win-x86-commandline/latest/nuget.exe + if [ $? -ne 0 ]; then + echo "An error occurred while downloading nuget.exe." + exit 1 + fi +fi + +# Restore tools from NuGet. +pushd "$TOOLS_DIR" >/dev/null +if [ ! -f "$PACKAGES_CONFIG_MD5" ] || [ "$( cat "$PACKAGES_CONFIG_MD5" | sed 's/\r$//' )" != "$( $MD5_EXE "$PACKAGES_CONFIG" | awk '{ print $1 }' )" ]; then + find . -type d ! -name . ! -name 'Cake.Bakery' | xargs rm -rf +fi + +mono "$NUGET_EXE" install -ExcludeVersion +if [ $? -ne 0 ]; then + echo "Could not restore NuGet tools." + exit 1 +fi + +$MD5_EXE "$PACKAGES_CONFIG" | awk '{ print $1 }' >| "$PACKAGES_CONFIG_MD5" + +popd >/dev/null + +# Restore addins from NuGet. +if [ -f "$ADDINS_PACKAGES_CONFIG" ]; then + pushd "$ADDINS_DIR" >/dev/null + + mono "$NUGET_EXE" install -ExcludeVersion + if [ $? -ne 0 ]; then + echo "Could not restore NuGet addins." + exit 1 + fi + + popd >/dev/null +fi + +# Restore modules from NuGet. +if [ -f "$MODULES_PACKAGES_CONFIG" ]; then + pushd "$MODULES_DIR" >/dev/null + + mono "$NUGET_EXE" install -ExcludeVersion + if [ $? -ne 0 ]; then + echo "Could not restore NuGet modules." + exit 1 + fi + + popd >/dev/null +fi + +# Make sure that Cake has been installed. +if [ ! -f "$CAKE_EXE" ]; then + echo "Could not find Cake.exe at '$CAKE_EXE'." + exit 1 +fi + +# Start Cake +exec mono "$CAKE_EXE" $SCRIPT "${CAKE_ARGUMENTS[@]}" diff --git a/cake.config b/cake.config new file mode 100644 index 0000000000..9dbafb5e95 --- /dev/null +++ b/cake.config @@ -0,0 +1,2 @@ +[Nuget] +UseInProcessClient=false \ No newline at end of file diff --git a/tools/packages.config b/tools/packages.config new file mode 100644 index 0000000000..227ecd9e52 --- /dev/null +++ b/tools/packages.config @@ -0,0 +1,4 @@ + + + + From 91ca245c584921864a44f15b9c8934147c53d469 Mon Sep 17 00:00:00 2001 From: miterosan Date: Thu, 26 Jul 2018 03:40:28 +0200 Subject: [PATCH 008/417] Allow testing --- build.cake | 39 ++++++++++++++++----------------------- 1 file changed, 16 insertions(+), 23 deletions(-) diff --git a/build.cake b/build.cake index ca005279ad..07d2e7df03 100644 --- a/build.cake +++ b/build.cake @@ -1,22 +1,14 @@ -#tool Microsoft.TestPlatform.Portable - /////////////////////////////////////////////////////////////////////////////// // ARGUMENTS /////////////////////////////////////////////////////////////////////////////// -var target = Argument("target", "Test"); +var target = Argument("target", "Build"); var framework = Argument("framework", "net471"); -var configuration = Argument("configuration", "Debug"); +var configuration = Argument("configuration", "Release"); var osuDesktop = new FilePath("./osu.Desktop/osu.Desktop.csproj"); -var testProjects = new [] { - new FilePath("./osu.Game.Tests/osu.Game.Tests.csproj"), - new FilePath("./osu.Game.Rulesets.Osu.Tests/osu.Game.Rulesets.Osu.Tests.csproj"), - new FilePath("./osu.Game.Rulesets.Catch.Tests/osu.Game.Rulesets.Catch.Tests.csproj"), - new FilePath("./osu.Game.Rulesets.Mania.Tests/osu.Game.Rulesets.Mania.Tests.csproj"), - new FilePath("./osu.Game.Rulesets.Taiko.Tests/osu.Game.Rulesets.Taiko.Tests.csproj"), -}; +var testProjects = GetFiles("**/*.Tests.csproj"); /////////////////////////////////////////////////////////////////////////////// // TASKS @@ -26,22 +18,23 @@ Task("Compile") .Does(() => { DotNetCoreBuild(osuDesktop.FullPath, new DotNetCoreBuildSettings { Framework = framework, - Configuration = "Debug" + Configuration = configuration }); }); -Task("CompileTests") -.DoesForEach(testProjects, testProject => { - DotNetCoreBuild(testProject.FullPath, new DotNetCoreBuildSettings { - Framework = framework - }); -}); - - Task("Test") -.IsDependentOn("CompileTests") -.Does(() => { - VSTest($"./*.Tests/bin/{configuration}/{framework}/**/*Tests.exe"); +.ContinueOnError() +.DoesForEach(testProjects, testProject => { + DotNetCoreTest(testProject.FullPath, new DotNetCoreTestSettings {3 + Framework = framework, + Configuration = configuration, + Logger = $"trx;LogFileName={testProject.GetFilename()}.trx", + ResultsDirectory = "./TestResults/" + }); }); +Task("Build") +.IsDependentOn("Compile") +.IsDependentOn("Test"); + RunTarget(target); \ No newline at end of file From 1e6220e3c0a066457d54f1ad52e0c94b2be92b3d Mon Sep 17 00:00:00 2001 From: Roman Kapustin Date: Sat, 28 Jul 2018 13:22:52 +0300 Subject: [PATCH 009/417] Call KeyCounter.RestoreState itself --- osu.Game/Screens/Play/HUDOverlay.cs | 6 +----- osu.Game/Screens/Play/KeyCounter.cs | 16 ++++++++++------ osu.Game/Screens/Play/KeyCounterCollection.cs | 8 +------- 3 files changed, 12 insertions(+), 18 deletions(-) diff --git a/osu.Game/Screens/Play/HUDOverlay.cs b/osu.Game/Screens/Play/HUDOverlay.cs index 6fce7c9a70..0187a21d01 100644 --- a/osu.Game/Screens/Play/HUDOverlay.cs +++ b/osu.Game/Screens/Play/HUDOverlay.cs @@ -82,11 +82,7 @@ namespace osu.Game.Screens.Play Progress.Objects = rulesetContainer.Objects; Progress.AudioClock = offsetClock; Progress.AllowSeeking = rulesetContainer.HasReplayLoaded; - Progress.OnSeek = pos => - { - adjustableClock.Seek(pos); - KeyCounter.RestoreKeyCounterState(pos); - }; + Progress.OnSeek = pos => adjustableClock.Seek(pos); ModDisplay.Current.BindTo(working.Mods); diff --git a/osu.Game/Screens/Play/KeyCounter.cs b/osu.Game/Screens/Play/KeyCounter.cs index f5d218b4cf..031fe11f88 100644 --- a/osu.Game/Screens/Play/KeyCounter.cs +++ b/osu.Game/Screens/Play/KeyCounter.cs @@ -8,7 +8,6 @@ using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Sprites; using osu.Framework.Graphics.Textures; -using osu.Framework.Timing; using osu.Game.Graphics.Sprites; using OpenTK; using OpenTK.Graphics; @@ -23,6 +22,7 @@ namespace osu.Game.Screens.Play private SpriteText countSpriteText; private readonly List states = new List(); + private KeyCounterState lastState; public bool IsCounting { get; set; } = true; private int countPresses; @@ -63,8 +63,6 @@ namespace osu.Game.Screens.Play public Color4 KeyUpTextColor { get; set; } = Color4.White; public int FadeTime { get; set; } - public IClock AudioClock { get; set; } - protected KeyCounter(string name) { Name = name; @@ -142,10 +140,16 @@ namespace osu.Game.Screens.Play public void SaveState() { - var lastState = states.LastOrDefault(); + if (lastState == null || lastState.Time < Clock.CurrentTime) + states.Add(lastState = new KeyCounterState(Clock.CurrentTime, CountPresses)); + } - if (lastState == null || lastState.Time < AudioClock.CurrentTime) - states.Add(new KeyCounterState(AudioClock.CurrentTime, CountPresses)); + protected override void Update() + { + base.Update(); + + if (lastState?.Time > Clock.CurrentTime) + RestoreState(Clock.CurrentTime); } public void RestoreState(double time) diff --git a/osu.Game/Screens/Play/KeyCounterCollection.cs b/osu.Game/Screens/Play/KeyCounterCollection.cs index c4974dbaa8..2a5ecd474d 100644 --- a/osu.Game/Screens/Play/KeyCounterCollection.cs +++ b/osu.Game/Screens/Play/KeyCounterCollection.cs @@ -38,13 +38,7 @@ namespace osu.Game.Screens.Play key.FadeTime = FadeTime; key.KeyDownTextColor = KeyDownTextColor; key.KeyUpTextColor = KeyUpTextColor; - key.AudioClock = AudioClock; - } - - public void RestoreKeyCounterState(double time) - { - foreach (var counter in Children) - counter.RestoreState(time); + key.Clock = (IFrameBasedClock)AudioClock; } public void ResetCount() From 8bb83a8fd982cf3a4c4708ae8e4a98c2c413f7b2 Mon Sep 17 00:00:00 2001 From: Roman Kapustin Date: Sat, 28 Jul 2018 22:16:14 +0300 Subject: [PATCH 010/417] Fix nullref in KeyCounterCollection --- osu.Game/Screens/Play/KeyCounterCollection.cs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/osu.Game/Screens/Play/KeyCounterCollection.cs b/osu.Game/Screens/Play/KeyCounterCollection.cs index 2a5ecd474d..f701c468e9 100644 --- a/osu.Game/Screens/Play/KeyCounterCollection.cs +++ b/osu.Game/Screens/Play/KeyCounterCollection.cs @@ -38,7 +38,8 @@ namespace osu.Game.Screens.Play key.FadeTime = FadeTime; key.KeyDownTextColor = KeyDownTextColor; key.KeyUpTextColor = KeyUpTextColor; - key.Clock = (IFrameBasedClock)AudioClock; + if (AudioClock != null && AudioClock is IFrameBasedClock basedClock) + key.Clock = basedClock; } public void ResetCount() From 3134e14b37b3d177f254accd935c26c0122730ec Mon Sep 17 00:00:00 2001 From: Roman Kapustin Date: Sat, 28 Jul 2018 23:24:03 +0300 Subject: [PATCH 011/417] Test KeyCounter.RestoreState --- osu.Game.Tests/Visual/TestCaseKeyCounter.cs | 29 ++++++++++++++++++++- osu.Game/Screens/Play/KeyCounter.cs | 7 +---- 2 files changed, 29 insertions(+), 7 deletions(-) diff --git a/osu.Game.Tests/Visual/TestCaseKeyCounter.cs b/osu.Game.Tests/Visual/TestCaseKeyCounter.cs index b98875cd6a..931c62a64a 100644 --- a/osu.Game.Tests/Visual/TestCaseKeyCounter.cs +++ b/osu.Game.Tests/Visual/TestCaseKeyCounter.cs @@ -3,7 +3,9 @@ using NUnit.Framework; using osu.Framework.Graphics; +using osu.Framework.Input.EventArgs; using osu.Framework.MathUtils; +using osu.Framework.Timing; using osu.Game.Screens.Play; using OpenTK.Input; @@ -12,15 +14,18 @@ namespace osu.Game.Tests.Visual [TestFixture] public class TestCaseKeyCounter : OsuTestCase { + private const Key rewind_test_key = Key.Z; + public TestCaseKeyCounter() { + KeyCounterKeyboard rewindTestKeyCounterKeyboard; KeyCounterCollection kc = new KeyCounterCollection { Origin = Anchor.Centre, Anchor = Anchor.Centre, Children = new KeyCounter[] { - new KeyCounterKeyboard(Key.Z), + rewindTestKeyCounterKeyboard = new KeyCounterKeyboard(rewind_test_key), new KeyCounterKeyboard(Key.X), new KeyCounterMouse(MouseButton.Left), new KeyCounterMouse(MouseButton.Right), @@ -34,6 +39,28 @@ namespace osu.Game.Tests.Visual }); AddSliderStep("Fade time", 0, 200, 50, v => kc.FadeTime = v); + var expectedCountPresses = rewindTestKeyCounterKeyboard.CountPresses + 1; + AddStep($"Press {rewind_test_key} key", () => + { + rewindTestKeyCounterKeyboard.TriggerOnKeyDown(null, new KeyDownEventArgs { Key = rewind_test_key, Repeat = false }); + rewindTestKeyCounterKeyboard.TriggerOnKeyUp(null, new KeyUpEventArgs { Key = rewind_test_key }); + }); + + AddAssert($"Check {rewind_test_key} counter after keypress", () => rewindTestKeyCounterKeyboard.CountPresses == expectedCountPresses); + + IFrameBasedClock counterClock = null; + AddStep($"Rewind {rewind_test_key} counter", () => + { + counterClock = rewindTestKeyCounterKeyboard.Clock; + rewindTestKeyCounterKeyboard.Clock = new DecoupleableInterpolatingFramedClock(); + }); + + AddAssert($"Check {rewind_test_key} counter after rewind", () => + { + rewindTestKeyCounterKeyboard.Clock = counterClock; + return rewindTestKeyCounterKeyboard.CountPresses == 0; + }); + Add(kc); } } diff --git a/osu.Game/Screens/Play/KeyCounter.cs b/osu.Game/Screens/Play/KeyCounter.cs index 031fe11f88..cb9ff28aff 100644 --- a/osu.Game/Screens/Play/KeyCounter.cs +++ b/osu.Game/Screens/Play/KeyCounter.cs @@ -152,11 +152,6 @@ namespace osu.Game.Screens.Play RestoreState(Clock.CurrentTime); } - public void RestoreState(double time) - { - var targetState = states.LastOrDefault(state => state.Time <= time) ?? states.LastOrDefault(); - var targetCount = targetState?.Count ?? 0; - CountPresses = targetCount; - } + public void RestoreState(double time) => CountPresses = states.LastOrDefault(state => state.Time <= time)?.Count ?? 0; } } From 6a661d1766e473e0a013cafe5b227a7723f59a59 Mon Sep 17 00:00:00 2001 From: miterosan Date: Sun, 29 Jul 2018 20:49:26 +0200 Subject: [PATCH 012/417] Prepare inspect code --- build.cake | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/build.cake b/build.cake index 07d2e7df03..98ad292d7b 100644 --- a/build.cake +++ b/build.cake @@ -1,3 +1,5 @@ +#tool "nuget:?package=JetBrains.ReSharper.CommandLineTools" + /////////////////////////////////////////////////////////////////////////////// // ARGUMENTS /////////////////////////////////////////////////////////////////////////////// @@ -25,7 +27,7 @@ Task("Compile") Task("Test") .ContinueOnError() .DoesForEach(testProjects, testProject => { - DotNetCoreTest(testProject.FullPath, new DotNetCoreTestSettings {3 + DotNetCoreTest(testProject.FullPath, new DotNetCoreTestSettings { Framework = framework, Configuration = configuration, Logger = $"trx;LogFileName={testProject.GetFilename()}.trx", @@ -33,6 +35,11 @@ Task("Test") }); }); +Task("InspectCode") +.Does(() => { + +}); + Task("Build") .IsDependentOn("Compile") .IsDependentOn("Test"); From aef824b13dda77cad2c27946106a8b87e24a3df3 Mon Sep 17 00:00:00 2001 From: miterosan Date: Mon, 30 Jul 2018 02:12:39 +0200 Subject: [PATCH 013/417] Also analyze the code for spaces and warnings. --- .gitignore | 1 + appveyor.yml | 22 +++------------------- build.cake | 22 ++++++++++++++++++++-- cake.config | 2 -- inspectcodereport.xml | 18 ++++++++++++++++++ 5 files changed, 42 insertions(+), 23 deletions(-) delete mode 100644 cake.config create mode 100644 inspectcodereport.xml diff --git a/.gitignore b/.gitignore index be43e1a79c..26a8752b66 100644 --- a/.gitignore +++ b/.gitignore @@ -102,6 +102,7 @@ $tf/ _ReSharper*/ *.[Rr]e[Ss]harper *.DotSettings.user +inspectcode # JustCode is a .NET coding add-in .JustCode diff --git a/appveyor.yml b/appveyor.yml index 7c08eb9e9c..68c6725d0c 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -1,24 +1,8 @@ clone_depth: 1 version: '{branch}-{build}' image: Visual Studio 2017 -configuration: Debug -cache: - - C:\ProgramData\chocolatey\bin -> appveyor.yml - - C:\ProgramData\chocolatey\lib -> appveyor.yml +test: off install: - cmd: git submodule update --init --recursive --depth=5 - - cmd: choco install resharper-clt -y - - cmd: choco install nvika -y - - cmd: appveyor DownloadFile https://github.com/peppy/CodeFileSanity/releases/download/v0.2.5/CodeFileSanity.exe -before_build: - - cmd: CodeFileSanity.exe - - cmd: nuget restore -verbosity quiet -environment: - TargetFramework: net471 -build: - project: osu.sln - parallel: true - verbosity: minimal -after_build: - - cmd: inspectcode --o="inspectcodereport.xml" --projects:osu.Game* --caches-home="inspectcode" osu.sln > NUL - - cmd: NVika parsereport "inspectcodereport.xml" --treatwarningsaserrors +build_script: +- cmd: PowerShell -Version 2.0 .\build.ps1 diff --git a/build.cake b/build.cake index 98ad292d7b..6d11aade77 100644 --- a/build.cake +++ b/build.cake @@ -1,4 +1,7 @@ #tool "nuget:?package=JetBrains.ReSharper.CommandLineTools" +#tool "nuget:?package=NVika.MSBuild" +var NVikaToolPath = GetFiles("./tools/NVika.MSBuild.*/tools/NVika.exe").First(); +var CodeFileSanityToolPath = DownloadFile("https://github.com/peppy/CodeFileSanity/releases/download/v0.2.5/CodeFileSanity.exe"); /////////////////////////////////////////////////////////////////////////////// // ARGUMENTS @@ -9,7 +12,7 @@ var framework = Argument("framework", "net471"); var configuration = Argument("configuration", "Release"); var osuDesktop = new FilePath("./osu.Desktop/osu.Desktop.csproj"); - +var osuSolution = new FilePath("./osu.sln"); var testProjects = GetFiles("**/*.Tests.csproj"); /////////////////////////////////////////////////////////////////////////////// @@ -37,11 +40,26 @@ Task("Test") Task("InspectCode") .Does(() => { - + InspectCode(osuSolution, new InspectCodeSettings { + CachesHome = "inspectcode", + OutputFile = "inspectcodereport.xml", + }); + + StartProcess(NVikaToolPath, @"parsereport ""inspectcodereport.xml"" --treatwarningsaserrors"); +}); + +Task("CodeFileSanity") +.Does(() => { + var result = StartProcess(CodeFileSanityToolPath); + + if (result != 0) + throw new Exception("Code sanity failed."); }); Task("Build") +.IsDependentOn("CodeFileSanity") .IsDependentOn("Compile") +.IsDependentOn("InspectCode") .IsDependentOn("Test"); RunTarget(target); \ No newline at end of file diff --git a/cake.config b/cake.config deleted file mode 100644 index 9dbafb5e95..0000000000 --- a/cake.config +++ /dev/null @@ -1,2 +0,0 @@ -[Nuget] -UseInProcessClient=false \ No newline at end of file diff --git a/inspectcodereport.xml b/inspectcodereport.xml new file mode 100644 index 0000000000..f4b531f547 --- /dev/null +++ b/inspectcodereport.xml @@ -0,0 +1,18 @@ + + + + + osu.sln + + Solution + + + + + + + + + + + \ No newline at end of file From 8652c48c1801421fbe65369322d1845551198ce3 Mon Sep 17 00:00:00 2001 From: miterosan Date: Mon, 30 Jul 2018 02:23:31 +0200 Subject: [PATCH 014/417] Restore nuget before analyzing the binaries. --- build.cake | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/build.cake b/build.cake index 6d11aade77..304037f486 100644 --- a/build.cake +++ b/build.cake @@ -38,7 +38,11 @@ Task("Test") }); }); +Task("Restore Nuget") +.Does(() => NuGetRestore(osuSolution)); + Task("InspectCode") +.IsDependentOn("Restore Nuget") .Does(() => { InspectCode(osuSolution, new InspectCodeSettings { CachesHome = "inspectcode", From 23a37d06cf7ef515d8af336d12812c4fa089567a Mon Sep 17 00:00:00 2001 From: miterosan Date: Mon, 30 Jul 2018 11:34:20 +0200 Subject: [PATCH 015/417] Implement the arrange mod. --- osu.Game.Rulesets.Osu/Mods/OsuModArrange.cs | 56 +++++++++++++++++++++ osu.Game.Rulesets.Osu/OsuRuleset.cs | 1 + 2 files changed, 57 insertions(+) create mode 100644 osu.Game.Rulesets.Osu/Mods/OsuModArrange.cs diff --git a/osu.Game.Rulesets.Osu/Mods/OsuModArrange.cs b/osu.Game.Rulesets.Osu/Mods/OsuModArrange.cs new file mode 100644 index 0000000000..78f956416a --- /dev/null +++ b/osu.Game.Rulesets.Osu/Mods/OsuModArrange.cs @@ -0,0 +1,56 @@ +using System; +using System.Collections.Generic; +using osu.Framework.Extensions.IEnumerableExtensions; +using osu.Framework.Graphics; +using osu.Game.Graphics; +using osu.Game.Rulesets.Mods; +using osu.Game.Rulesets.Objects.Drawables; +using osu.Game.Rulesets.Osu.Objects; +using OpenTK; + +namespace osu.Game.Rulesets.Osu.Mods +{ + internal class OsuModArrange : Mod, IApplicableToDrawableHitObjects + { + public override string Name => "Arrange"; + public override string ShortenedName => "Arrange"; + public override FontAwesome Icon => FontAwesome.fa_arrows; + public override ModType Type => ModType.DifficultyIncrease; + public override string Description => "Everything rotates. EVERYTHING"; + public override bool Ranked => true; + public override double ScoreMultiplier => 1.05; + + public void ApplyToDrawableHitObjects(IEnumerable drawables) + { + drawables.ForEach(drawable => drawable.ApplyCustomUpdateState += drawableOnApplyCustomUpdateState); + } + + private float theta = 0; + + private void drawableOnApplyCustomUpdateState(DrawableHitObject drawable, ArmedState state) + { + var hitObject = (OsuHitObject) drawable.HitObject; + + Vector2 origPos; + + if (hitObject is RepeatPoint rp) + { + return; + } + else + { + origPos = drawable.Position; + } + + using (drawable.BeginAbsoluteSequence(hitObject.StartTime - hitObject.TimeFadeIn - 1000, true)) + { + drawable + .MoveToOffset(new Vector2((float)Math.Cos(theta), (float)Math.Sin(theta)) * 250) + .MoveTo(origPos, hitObject.TimeFadeIn + 1000, Easing.InOutSine); + } + + if (hitObject is HitCircle || hitObject is Slider) + theta += 0.4f; + } + } +} diff --git a/osu.Game.Rulesets.Osu/OsuRuleset.cs b/osu.Game.Rulesets.Osu/OsuRuleset.cs index b8ba1e2945..0d4d75d8d5 100644 --- a/osu.Game.Rulesets.Osu/OsuRuleset.cs +++ b/osu.Game.Rulesets.Osu/OsuRuleset.cs @@ -103,6 +103,7 @@ namespace osu.Game.Rulesets.Osu new MultiMod(new OsuModDoubleTime(), new OsuModNightcore()), new OsuModHidden(), new OsuModFlashlight(), + new OsuModArrange(), }; case ModType.Special: return new Mod[] From 4d306ef837884ea75337a5ea80e68e50e8e1a6be Mon Sep 17 00:00:00 2001 From: miterosan Date: Mon, 30 Jul 2018 11:39:21 +0200 Subject: [PATCH 016/417] Add comments and clean up code. --- osu.Game.Rulesets.Osu/Mods/OsuModArrange.cs | 21 ++++++++++----------- 1 file changed, 10 insertions(+), 11 deletions(-) diff --git a/osu.Game.Rulesets.Osu/Mods/OsuModArrange.cs b/osu.Game.Rulesets.Osu/Mods/OsuModArrange.cs index 78f956416a..b322169e76 100644 --- a/osu.Game.Rulesets.Osu/Mods/OsuModArrange.cs +++ b/osu.Game.Rulesets.Osu/Mods/OsuModArrange.cs @@ -31,24 +31,23 @@ namespace osu.Game.Rulesets.Osu.Mods { var hitObject = (OsuHitObject) drawable.HitObject; - Vector2 origPos; - - if (hitObject is RepeatPoint rp) - { + // repeat points get their position data from the slider. + if (hitObject is RepeatPoint) return; - } - else - { - origPos = drawable.Position; - } - using (drawable.BeginAbsoluteSequence(hitObject.StartTime - hitObject.TimeFadeIn - 1000, true)) + Vector2 originalPosition = drawable.Position; + + // avoiding that the player can see the abroupt move. + const int pre_time_offset = 1000; + + using (drawable.BeginAbsoluteSequence(hitObject.StartTime - hitObject.TimeFadeIn - pre_time_offset, true)) { drawable .MoveToOffset(new Vector2((float)Math.Cos(theta), (float)Math.Sin(theta)) * 250) - .MoveTo(origPos, hitObject.TimeFadeIn + 1000, Easing.InOutSine); + .MoveTo(originalPosition, hitObject.TimeFadeIn + pre_time_offset, Easing.InOutSine); } + // That way slider ticks come all from the same direction. if (hitObject is HitCircle || hitObject is Slider) theta += 0.4f; } From 9e477140c1ca3e8c012ea2ca4d805886fcbc0948 Mon Sep 17 00:00:00 2001 From: miterosan Date: Mon, 30 Jul 2018 21:45:15 +0200 Subject: [PATCH 017/417] Build against netcoreapp2.1 instead of net471 --- build.cake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build.cake b/build.cake index 304037f486..6f512b8628 100644 --- a/build.cake +++ b/build.cake @@ -8,7 +8,7 @@ var CodeFileSanityToolPath = DownloadFile("https://github.com/peppy/CodeFileSani /////////////////////////////////////////////////////////////////////////////// var target = Argument("target", "Build"); -var framework = Argument("framework", "net471"); +var framework = Argument("framework", "netcoreapp2.1"); var configuration = Argument("configuration", "Release"); var osuDesktop = new FilePath("./osu.Desktop/osu.Desktop.csproj"); From 1b779dae779a469f80d42cbe91c903e0a2bd562c Mon Sep 17 00:00:00 2001 From: miterosan Date: Sat, 4 Aug 2018 00:01:17 +0200 Subject: [PATCH 018/417] Use CodeFileSanity as a cake addin. --- build.cake | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/build.cake b/build.cake index 6f512b8628..160db5148e 100644 --- a/build.cake +++ b/build.cake @@ -1,7 +1,7 @@ #tool "nuget:?package=JetBrains.ReSharper.CommandLineTools" #tool "nuget:?package=NVika.MSBuild" +#addin "nuget:?package=CodeFileSanity" var NVikaToolPath = GetFiles("./tools/NVika.MSBuild.*/tools/NVika.exe").First(); -var CodeFileSanityToolPath = DownloadFile("https://github.com/peppy/CodeFileSanity/releases/download/v0.2.5/CodeFileSanity.exe"); /////////////////////////////////////////////////////////////////////////////// // ARGUMENTS @@ -54,10 +54,10 @@ Task("InspectCode") Task("CodeFileSanity") .Does(() => { - var result = StartProcess(CodeFileSanityToolPath); - - if (result != 0) - throw new Exception("Code sanity failed."); + ValidateCodeSanity(new ValidateCodeSanitySettings { + RootDirectory = ".", + IsAppveyorBuild = AppVeyor.IsRunningOnAppVeyor + }); }); Task("Build") From 309e74afac74dfb7420e69995e5173ba832389f4 Mon Sep 17 00:00:00 2001 From: miterosan Date: Sat, 4 Aug 2018 00:02:31 +0200 Subject: [PATCH 019/417] Move compile to the correct task. The dotnetcore... commands all contain compiling. --- build.cake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build.cake b/build.cake index 160db5148e..e945115570 100644 --- a/build.cake +++ b/build.cake @@ -43,6 +43,7 @@ Task("Restore Nuget") Task("InspectCode") .IsDependentOn("Restore Nuget") +.IsDependentOn("Compile") .Does(() => { InspectCode(osuSolution, new InspectCodeSettings { CachesHome = "inspectcode", @@ -62,7 +63,6 @@ Task("CodeFileSanity") Task("Build") .IsDependentOn("CodeFileSanity") -.IsDependentOn("Compile") .IsDependentOn("InspectCode") .IsDependentOn("Test"); From 2ce64104a40a4cdd0554697e74d5201de19c560c Mon Sep 17 00:00:00 2001 From: miterosan Date: Sat, 4 Aug 2018 00:03:03 +0200 Subject: [PATCH 020/417] :V JetBrains.ReSharper.CommandLineTools is an addin and not a tool --- build.cake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build.cake b/build.cake index e945115570..20b2685351 100644 --- a/build.cake +++ b/build.cake @@ -1,4 +1,4 @@ -#tool "nuget:?package=JetBrains.ReSharper.CommandLineTools" +#addin "nuget:?package=JetBrains.ReSharper.CommandLineTools" #tool "nuget:?package=NVika.MSBuild" #addin "nuget:?package=CodeFileSanity" var NVikaToolPath = GetFiles("./tools/NVika.MSBuild.*/tools/NVika.exe").First(); From 5bb12b574b2ff0e8344ff5dfd878b37c95876ec2 Mon Sep 17 00:00:00 2001 From: miterosan Date: Sat, 4 Aug 2018 00:26:06 +0200 Subject: [PATCH 021/417] The arrange mod is not ranked I think. --- osu.Game.Rulesets.Osu/Mods/OsuModArrange.cs | 1 - 1 file changed, 1 deletion(-) diff --git a/osu.Game.Rulesets.Osu/Mods/OsuModArrange.cs b/osu.Game.Rulesets.Osu/Mods/OsuModArrange.cs index b322169e76..634f2ed653 100644 --- a/osu.Game.Rulesets.Osu/Mods/OsuModArrange.cs +++ b/osu.Game.Rulesets.Osu/Mods/OsuModArrange.cs @@ -17,7 +17,6 @@ namespace osu.Game.Rulesets.Osu.Mods public override FontAwesome Icon => FontAwesome.fa_arrows; public override ModType Type => ModType.DifficultyIncrease; public override string Description => "Everything rotates. EVERYTHING"; - public override bool Ranked => true; public override double ScoreMultiplier => 1.05; public void ApplyToDrawableHitObjects(IEnumerable drawables) From 67c64ac4599bb9e75d955be105a69c8bbb29b5da Mon Sep 17 00:00:00 2001 From: miterosan Date: Sat, 4 Aug 2018 00:26:26 +0200 Subject: [PATCH 022/417] Put the arrange mod into the fun section. --- osu.Game.Rulesets.Osu/Mods/OsuModArrange.cs | 2 +- osu.Game.Rulesets.Osu/OsuRuleset.cs | 5 ++++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/osu.Game.Rulesets.Osu/Mods/OsuModArrange.cs b/osu.Game.Rulesets.Osu/Mods/OsuModArrange.cs index 634f2ed653..df5495cf00 100644 --- a/osu.Game.Rulesets.Osu/Mods/OsuModArrange.cs +++ b/osu.Game.Rulesets.Osu/Mods/OsuModArrange.cs @@ -15,7 +15,7 @@ namespace osu.Game.Rulesets.Osu.Mods public override string Name => "Arrange"; public override string ShortenedName => "Arrange"; public override FontAwesome Icon => FontAwesome.fa_arrows; - public override ModType Type => ModType.DifficultyIncrease; + public override ModType Type => ModType.Fun; public override string Description => "Everything rotates. EVERYTHING"; public override double ScoreMultiplier => 1.05; diff --git a/osu.Game.Rulesets.Osu/OsuRuleset.cs b/osu.Game.Rulesets.Osu/OsuRuleset.cs index cac9b2db52..6d44d4993c 100644 --- a/osu.Game.Rulesets.Osu/OsuRuleset.cs +++ b/osu.Game.Rulesets.Osu/OsuRuleset.cs @@ -104,7 +104,6 @@ namespace osu.Game.Rulesets.Osu new MultiMod(new OsuModDoubleTime(), new OsuModNightcore()), new OsuModHidden(), new OsuModFlashlight(), - new OsuModArrange(), }; case ModType.Conversion: return new Mod[] @@ -118,6 +117,10 @@ namespace osu.Game.Rulesets.Osu new OsuModRelax(), new OsuModAutopilot(), }; + case ModType.Fun: + return new Mod[] { + new OsuModArrange(), + }; default: return new Mod[] { }; } From 159ce8e93e970478724c2de4a82dff613f1add5c Mon Sep 17 00:00:00 2001 From: miterosan Date: Sat, 4 Aug 2018 00:29:32 +0200 Subject: [PATCH 023/417] Add license header --- osu.Game.Rulesets.Osu/Mods/OsuModArrange.cs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/osu.Game.Rulesets.Osu/Mods/OsuModArrange.cs b/osu.Game.Rulesets.Osu/Mods/OsuModArrange.cs index df5495cf00..f7756831ac 100644 --- a/osu.Game.Rulesets.Osu/Mods/OsuModArrange.cs +++ b/osu.Game.Rulesets.Osu/Mods/OsuModArrange.cs @@ -1,4 +1,7 @@ -using System; +// Copyright (c) 2007-2018 ppy Pty Ltd . +// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE + +using System; using System.Collections.Generic; using osu.Framework.Extensions.IEnumerableExtensions; using osu.Framework.Graphics; From 25791b631784c386387d44b0a0f1d48ebff44ec3 Mon Sep 17 00:00:00 2001 From: miterosan Date: Sat, 4 Aug 2018 00:30:46 +0200 Subject: [PATCH 024/417] remove space. --- osu.Game.Rulesets.Osu/OsuRuleset.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu.Game.Rulesets.Osu/OsuRuleset.cs b/osu.Game.Rulesets.Osu/OsuRuleset.cs index 6d44d4993c..c80ecbf6df 100644 --- a/osu.Game.Rulesets.Osu/OsuRuleset.cs +++ b/osu.Game.Rulesets.Osu/OsuRuleset.cs @@ -117,7 +117,7 @@ namespace osu.Game.Rulesets.Osu new OsuModRelax(), new OsuModAutopilot(), }; - case ModType.Fun: + case ModType.Fun: return new Mod[] { new OsuModArrange(), }; From 546bdf061850b4a0ab38b915e4b1d9788223593a Mon Sep 17 00:00:00 2001 From: miterosan Date: Sat, 4 Aug 2018 00:36:59 +0200 Subject: [PATCH 025/417] remove default value init .-. --- osu.Game.Rulesets.Osu/Mods/OsuModArrange.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu.Game.Rulesets.Osu/Mods/OsuModArrange.cs b/osu.Game.Rulesets.Osu/Mods/OsuModArrange.cs index f7756831ac..d319433b5c 100644 --- a/osu.Game.Rulesets.Osu/Mods/OsuModArrange.cs +++ b/osu.Game.Rulesets.Osu/Mods/OsuModArrange.cs @@ -27,7 +27,7 @@ namespace osu.Game.Rulesets.Osu.Mods drawables.ForEach(drawable => drawable.ApplyCustomUpdateState += drawableOnApplyCustomUpdateState); } - private float theta = 0; + private float theta; private void drawableOnApplyCustomUpdateState(DrawableHitObject drawable, ArmedState state) { From f02d1f9013720196f4613d0307a729c5e7aabfb0 Mon Sep 17 00:00:00 2001 From: miterosan Date: Sun, 5 Aug 2018 15:10:42 +0200 Subject: [PATCH 026/417] move the 250 appear disance to a const var. --- osu.Game.Rulesets.Osu/Mods/OsuModArrange.cs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/osu.Game.Rulesets.Osu/Mods/OsuModArrange.cs b/osu.Game.Rulesets.Osu/Mods/OsuModArrange.cs index d319433b5c..4a93067128 100644 --- a/osu.Game.Rulesets.Osu/Mods/OsuModArrange.cs +++ b/osu.Game.Rulesets.Osu/Mods/OsuModArrange.cs @@ -41,12 +41,13 @@ namespace osu.Game.Rulesets.Osu.Mods // avoiding that the player can see the abroupt move. const int pre_time_offset = 1000; + const float appearDistance = 250; using (drawable.BeginAbsoluteSequence(hitObject.StartTime - hitObject.TimeFadeIn - pre_time_offset, true)) { drawable - .MoveToOffset(new Vector2((float)Math.Cos(theta), (float)Math.Sin(theta)) * 250) .MoveTo(originalPosition, hitObject.TimeFadeIn + pre_time_offset, Easing.InOutSine); + .MoveToOffset(new Vector2((float)Math.Cos(theta), (float)Math.Sin(theta)) * appearDistance) } // That way slider ticks come all from the same direction. From 876d410fa1bece8a373c99b95d7fc148223c9a30 Mon Sep 17 00:00:00 2001 From: miterosan Date: Sun, 5 Aug 2018 15:13:04 +0200 Subject: [PATCH 027/417] Add missing ; --- osu.Game.Rulesets.Osu/Mods/OsuModArrange.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu.Game.Rulesets.Osu/Mods/OsuModArrange.cs b/osu.Game.Rulesets.Osu/Mods/OsuModArrange.cs index 4a93067128..dec7d386d3 100644 --- a/osu.Game.Rulesets.Osu/Mods/OsuModArrange.cs +++ b/osu.Game.Rulesets.Osu/Mods/OsuModArrange.cs @@ -47,7 +47,7 @@ namespace osu.Game.Rulesets.Osu.Mods { drawable .MoveTo(originalPosition, hitObject.TimeFadeIn + pre_time_offset, Easing.InOutSine); - .MoveToOffset(new Vector2((float)Math.Cos(theta), (float)Math.Sin(theta)) * appearDistance) + .MoveToOffset(new Vector2((float)Math.Cos(theta), (float)Math.Sin(theta)) * appearDistance); } // That way slider ticks come all from the same direction. From d32ffc1ebcd3fb2304ae1b1128fbcf7ba00a90fb Mon Sep 17 00:00:00 2001 From: miterosan Date: Sun, 5 Aug 2018 15:14:52 +0200 Subject: [PATCH 028/417] Swtich order of the moveto and the movetooffset. --- osu.Game.Rulesets.Osu/Mods/OsuModArrange.cs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/osu.Game.Rulesets.Osu/Mods/OsuModArrange.cs b/osu.Game.Rulesets.Osu/Mods/OsuModArrange.cs index dec7d386d3..464486884b 100644 --- a/osu.Game.Rulesets.Osu/Mods/OsuModArrange.cs +++ b/osu.Game.Rulesets.Osu/Mods/OsuModArrange.cs @@ -46,8 +46,9 @@ namespace osu.Game.Rulesets.Osu.Mods using (drawable.BeginAbsoluteSequence(hitObject.StartTime - hitObject.TimeFadeIn - pre_time_offset, true)) { drawable + .MoveToOffset(new Vector2((float)Math.Cos(theta), (float)Math.Sin(theta)) * appearDistance) .MoveTo(originalPosition, hitObject.TimeFadeIn + pre_time_offset, Easing.InOutSine); - .MoveToOffset(new Vector2((float)Math.Cos(theta), (float)Math.Sin(theta)) * appearDistance); + } // That way slider ticks come all from the same direction. From 7653ce80cd3b7c17d85dcc261ecf563b1791706a Mon Sep 17 00:00:00 2001 From: miterosan Date: Sun, 5 Aug 2018 15:16:10 +0200 Subject: [PATCH 029/417] add a period after EVERYTHING --- osu.Game.Rulesets.Osu/Mods/OsuModArrange.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu.Game.Rulesets.Osu/Mods/OsuModArrange.cs b/osu.Game.Rulesets.Osu/Mods/OsuModArrange.cs index 464486884b..7fae89f3dc 100644 --- a/osu.Game.Rulesets.Osu/Mods/OsuModArrange.cs +++ b/osu.Game.Rulesets.Osu/Mods/OsuModArrange.cs @@ -19,8 +19,8 @@ namespace osu.Game.Rulesets.Osu.Mods public override string ShortenedName => "Arrange"; public override FontAwesome Icon => FontAwesome.fa_arrows; public override ModType Type => ModType.Fun; - public override string Description => "Everything rotates. EVERYTHING"; public override double ScoreMultiplier => 1.05; + public override string Description => "Everything rotates. EVERYTHING."; public void ApplyToDrawableHitObjects(IEnumerable drawables) { From 8ad8c2b6d0fc800648ccd95210263aa60541559c Mon Sep 17 00:00:00 2001 From: miterosan Date: Sun, 5 Aug 2018 15:16:25 +0200 Subject: [PATCH 030/417] Reset the ScoreMultiplier to 1 --- osu.Game.Rulesets.Osu/Mods/OsuModArrange.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu.Game.Rulesets.Osu/Mods/OsuModArrange.cs b/osu.Game.Rulesets.Osu/Mods/OsuModArrange.cs index 7fae89f3dc..440da5df4f 100644 --- a/osu.Game.Rulesets.Osu/Mods/OsuModArrange.cs +++ b/osu.Game.Rulesets.Osu/Mods/OsuModArrange.cs @@ -19,8 +19,8 @@ namespace osu.Game.Rulesets.Osu.Mods public override string ShortenedName => "Arrange"; public override FontAwesome Icon => FontAwesome.fa_arrows; public override ModType Type => ModType.Fun; - public override double ScoreMultiplier => 1.05; public override string Description => "Everything rotates. EVERYTHING."; + public override double ScoreMultiplier => 1; public void ApplyToDrawableHitObjects(IEnumerable drawables) { From d1ffb7c2d78b2fbce64954d7f8ac8f61c5aafb0d Mon Sep 17 00:00:00 2001 From: miterosan Date: Sun, 5 Aug 2018 15:38:27 +0200 Subject: [PATCH 031/417] Use timepreempt and put appeartime and move duration into their own vars. --- osu.Game.Rulesets.Osu/Mods/OsuModArrange.cs | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/osu.Game.Rulesets.Osu/Mods/OsuModArrange.cs b/osu.Game.Rulesets.Osu/Mods/OsuModArrange.cs index 440da5df4f..dd4bb727a2 100644 --- a/osu.Game.Rulesets.Osu/Mods/OsuModArrange.cs +++ b/osu.Game.Rulesets.Osu/Mods/OsuModArrange.cs @@ -39,15 +39,15 @@ namespace osu.Game.Rulesets.Osu.Mods Vector2 originalPosition = drawable.Position; - // avoiding that the player can see the abroupt move. - const int pre_time_offset = 1000; - const float appearDistance = 250; + const float appear_distance = 250; + double appearTime = hitObject.StartTime - hitObject.TimePreempt - 1; + double moveDuration = hitObject.TimePreempt + 1; - using (drawable.BeginAbsoluteSequence(hitObject.StartTime - hitObject.TimeFadeIn - pre_time_offset, true)) + using (drawable.BeginAbsoluteSequence(appearTime, true)) { drawable - .MoveToOffset(new Vector2((float)Math.Cos(theta), (float)Math.Sin(theta)) * appearDistance) - .MoveTo(originalPosition, hitObject.TimeFadeIn + pre_time_offset, Easing.InOutSine); + .MoveToOffset(new Vector2((float)Math.Cos(theta), (float)Math.Sin(theta)) * appear_distance) + .MoveTo(originalPosition, moveDuration, Easing.InOutSine); } From 89a18e4aac47644e61373862ed3492530a80a948 Mon Sep 17 00:00:00 2001 From: miterosan Date: Sun, 5 Aug 2018 15:39:12 +0200 Subject: [PATCH 032/417] remove nl and add comment for -1 and +1 --- osu.Game.Rulesets.Osu/Mods/OsuModArrange.cs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/osu.Game.Rulesets.Osu/Mods/OsuModArrange.cs b/osu.Game.Rulesets.Osu/Mods/OsuModArrange.cs index dd4bb727a2..5dabf6bfe1 100644 --- a/osu.Game.Rulesets.Osu/Mods/OsuModArrange.cs +++ b/osu.Game.Rulesets.Osu/Mods/OsuModArrange.cs @@ -40,6 +40,8 @@ namespace osu.Game.Rulesets.Osu.Mods Vector2 originalPosition = drawable.Position; const float appear_distance = 250; + + //the - 1 and + 1 prevents the hit explosion to appear in the wrong position. double appearTime = hitObject.StartTime - hitObject.TimePreempt - 1; double moveDuration = hitObject.TimePreempt + 1; @@ -48,7 +50,6 @@ namespace osu.Game.Rulesets.Osu.Mods drawable .MoveToOffset(new Vector2((float)Math.Cos(theta), (float)Math.Sin(theta)) * appear_distance) .MoveTo(originalPosition, moveDuration, Easing.InOutSine); - } // That way slider ticks come all from the same direction. From e69e225ad3332808a0a5b325b7206772f78e2bee Mon Sep 17 00:00:00 2001 From: miterosan Date: Sun, 5 Aug 2018 21:08:11 +0200 Subject: [PATCH 033/417] Use coreclr instead of .framework. --- tools/packages.config | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/packages.config b/tools/packages.config index 227ecd9e52..e37e9304d5 100644 --- a/tools/packages.config +++ b/tools/packages.config @@ -1,4 +1,4 @@ - + From abe10741e6892344b7691ef7fceaa1f3b2648728 Mon Sep 17 00:00:00 2001 From: miterosan Date: Sun, 5 Aug 2018 21:45:14 +0200 Subject: [PATCH 034/417] Use netcore cake --- build.ps1 | 168 ++---------------------------------------------------- 1 file changed, 5 insertions(+), 163 deletions(-) diff --git a/build.ps1 b/build.ps1 index dc42c4595a..e923331793 100644 --- a/build.ps1 +++ b/build.ps1 @@ -25,12 +25,6 @@ Specifies the amount of information to be displayed. Shows description about tasks. .PARAMETER DryRun Performs a dry run. -.PARAMETER Experimental -Uses the nightly builds of the Roslyn script engine. -.PARAMETER Mono -Uses the Mono Compiler rather than the Roslyn script engine. -.PARAMETER SkipToolPackageRestore -Skips restoring of packages. .PARAMETER ScriptArgs Remaining arguments are added here. @@ -49,47 +43,10 @@ Param( [switch]$ShowDescription, [Alias("WhatIf", "Noop")] [switch]$DryRun, - [switch]$Experimental, - [switch]$Mono, - [switch]$SkipToolPackageRestore, [Parameter(Position=0,Mandatory=$false,ValueFromRemainingArguments=$true)] [string[]]$ScriptArgs ) -[Reflection.Assembly]::LoadWithPartialName("System.Security") | Out-Null -function MD5HashFile([string] $filePath) -{ - if ([string]::IsNullOrEmpty($filePath) -or !(Test-Path $filePath -PathType Leaf)) - { - return $null - } - - [System.IO.Stream] $file = $null; - [System.Security.Cryptography.MD5] $md5 = $null; - try - { - $md5 = [System.Security.Cryptography.MD5]::Create() - $file = [System.IO.File]::OpenRead($filePath) - return [System.BitConverter]::ToString($md5.ComputeHash($file)) - } - finally - { - if ($file -ne $null) - { - $file.Dispose() - } - } -} - -function GetProxyEnabledWebClient -{ - $wc = New-Object System.Net.WebClient - $proxy = [System.Net.WebRequest]::GetSystemWebProxy() - $proxy.Credentials = [System.Net.CredentialCache]::DefaultCredentials - $wc.Proxy = $proxy - return $wc -} - Write-Host "Preparing to run build script..." if(!$PSScriptRoot){ @@ -97,127 +54,12 @@ if(!$PSScriptRoot){ } $TOOLS_DIR = Join-Path $PSScriptRoot "tools" -$ADDINS_DIR = Join-Path $TOOLS_DIR "Addins" -$MODULES_DIR = Join-Path $TOOLS_DIR "Modules" -$NUGET_EXE = Join-Path $TOOLS_DIR "nuget.exe" -$CAKE_EXE = Join-Path $TOOLS_DIR "Cake/Cake.exe" -$NUGET_URL = "https://dist.nuget.org/win-x86-commandline/latest/nuget.exe" -$PACKAGES_CONFIG = Join-Path $TOOLS_DIR "packages.config" -$PACKAGES_CONFIG_MD5 = Join-Path $TOOLS_DIR "packages.config.md5sum" -$ADDINS_PACKAGES_CONFIG = Join-Path $ADDINS_DIR "packages.config" -$MODULES_PACKAGES_CONFIG = Join-Path $MODULES_DIR "packages.config" - -# Make sure tools folder exists -if ((Test-Path $PSScriptRoot) -and !(Test-Path $TOOLS_DIR)) { - Write-Verbose -Message "Creating tools directory..." - New-Item -Path $TOOLS_DIR -Type directory | out-null -} - -# Make sure that packages.config exist. -if (!(Test-Path $PACKAGES_CONFIG)) { - Write-Verbose -Message "Downloading packages.config..." - try { - $wc = GetProxyEnabledWebClient - $wc.DownloadFile("https://cakebuild.net/download/bootstrapper/packages", $PACKAGES_CONFIG) - } catch { - Throw "Could not download packages.config." - } -} - -# Try find NuGet.exe in path if not exists -if (!(Test-Path $NUGET_EXE)) { - Write-Verbose -Message "Trying to find nuget.exe in PATH..." - $existingPaths = $Env:Path -Split ';' | Where-Object { (![string]::IsNullOrEmpty($_)) -and (Test-Path $_ -PathType Container) } - $NUGET_EXE_IN_PATH = Get-ChildItem -Path $existingPaths -Filter "nuget.exe" | Select -First 1 - if ($NUGET_EXE_IN_PATH -ne $null -and (Test-Path $NUGET_EXE_IN_PATH.FullName)) { - Write-Verbose -Message "Found in PATH at $($NUGET_EXE_IN_PATH.FullName)." - $NUGET_EXE = $NUGET_EXE_IN_PATH.FullName - } -} - -# Try download NuGet.exe if not exists -if (!(Test-Path $NUGET_EXE)) { - Write-Verbose -Message "Downloading NuGet.exe..." - try { - $wc = GetProxyEnabledWebClient - $wc.DownloadFile($NUGET_URL, $NUGET_EXE) - } catch { - Throw "Could not download NuGet.exe." - } -} - -# Save nuget.exe path to environment to be available to child processed -$ENV:NUGET_EXE = $NUGET_EXE - -# Restore tools from NuGet? -if(-Not $SkipToolPackageRestore.IsPresent) { - Push-Location - Set-Location $TOOLS_DIR - - # Check for changes in packages.config and remove installed tools if true. - [string] $md5Hash = MD5HashFile($PACKAGES_CONFIG) - if((!(Test-Path $PACKAGES_CONFIG_MD5)) -Or - ($md5Hash -ne (Get-Content $PACKAGES_CONFIG_MD5 ))) { - Write-Verbose -Message "Missing or changed package.config hash..." - Get-ChildItem -Exclude packages.config,nuget.exe,Cake.Bakery | - Remove-Item -Recurse - } - - Write-Verbose -Message "Restoring tools from NuGet..." - $NuGetOutput = Invoke-Expression "&`"$NUGET_EXE`" install -ExcludeVersion -OutputDirectory `"$TOOLS_DIR`"" - - if ($LASTEXITCODE -ne 0) { - Throw "An error occurred while restoring NuGet tools." - } - else - { - $md5Hash | Out-File $PACKAGES_CONFIG_MD5 -Encoding "ASCII" - } - Write-Verbose -Message ($NuGetOutput | out-string) - - Pop-Location -} - -# Restore addins from NuGet -if (Test-Path $ADDINS_PACKAGES_CONFIG) { - Push-Location - Set-Location $ADDINS_DIR - - Write-Verbose -Message "Restoring addins from NuGet..." - $NuGetOutput = Invoke-Expression "&`"$NUGET_EXE`" install -ExcludeVersion -OutputDirectory `"$ADDINS_DIR`"" - - if ($LASTEXITCODE -ne 0) { - Throw "An error occurred while restoring NuGet addins." - } - - Write-Verbose -Message ($NuGetOutput | out-string) - - Pop-Location -} - -# Restore modules from NuGet -if (Test-Path $MODULES_PACKAGES_CONFIG) { - Push-Location - Set-Location $MODULES_DIR - - Write-Verbose -Message "Restoring modules from NuGet..." - $NuGetOutput = Invoke-Expression "&`"$NUGET_EXE`" install -ExcludeVersion -OutputDirectory `"$MODULES_DIR`"" - - if ($LASTEXITCODE -ne 0) { - Throw "An error occurred while restoring NuGet modules." - } - - Write-Verbose -Message ($NuGetOutput | out-string) - - Pop-Location -} - -# Make sure that Cake has been installed. -if (!(Test-Path $CAKE_EXE)) { - Throw "Could not find Cake.exe at $CAKE_EXE" -} +$CAKE_CSPROJ = Join-Path $TOOLS_DIR "cake.csproj" +Invoke-Expression "dotnet restore `"$CAKE_CSPROJ`" --packages `"$TOOLS_DIR`"" +# Find the Cake executable +$CAKE_EXECUTABLE = (Get-ChildItem -Path ./tools/cake.coreclr/ -Filter Cake.dll -Recurse).FullName # Build Cake arguments $cakeArguments = @("$Script"); @@ -232,5 +74,5 @@ $cakeArguments += $ScriptArgs # Start Cake Write-Host "Running build script..." -&$CAKE_EXE $cakeArguments +Invoke-Expression "dotnet `"$CAKE_EXECUTABLE`" $cakeArguments" exit $LASTEXITCODE From cefabf14d9418a381c9d4956654c02038c528229 Mon Sep 17 00:00:00 2001 From: miterosan Date: Sun, 5 Aug 2018 21:46:28 +0200 Subject: [PATCH 035/417] Linux users can use powershell on, linux --- build.sh | 117 ------------------------------------------------------- 1 file changed, 117 deletions(-) delete mode 100644 build.sh diff --git a/build.sh b/build.sh deleted file mode 100644 index b9e12527f1..0000000000 --- a/build.sh +++ /dev/null @@ -1,117 +0,0 @@ -#!/usr/bin/env bash - -########################################################################## -# This is the Cake bootstrapper script for Linux and OS X. -# This file was downloaded from https://github.com/cake-build/resources -# Feel free to change this file to fit your needs. -########################################################################## - -# Define directories. -SCRIPT_DIR=$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd ) -TOOLS_DIR=$SCRIPT_DIR/tools -ADDINS_DIR=$TOOLS_DIR/Addins -MODULES_DIR=$TOOLS_DIR/Modules -NUGET_EXE=$TOOLS_DIR/nuget.exe -CAKE_EXE=$TOOLS_DIR/Cake/Cake.exe -PACKAGES_CONFIG=$TOOLS_DIR/packages.config -PACKAGES_CONFIG_MD5=$TOOLS_DIR/packages.config.md5sum -ADDINS_PACKAGES_CONFIG=$ADDINS_DIR/packages.config -MODULES_PACKAGES_CONFIG=$MODULES_DIR/packages.config - -# Define md5sum or md5 depending on Linux/OSX -MD5_EXE= -if [[ "$(uname -s)" == "Darwin" ]]; then - MD5_EXE="md5 -r" -else - MD5_EXE="md5sum" -fi - -# Define default arguments. -SCRIPT="build.cake" -CAKE_ARGUMENTS=() - -# Parse arguments. -for i in "$@"; do - case $1 in - -s|--script) SCRIPT="$2"; shift ;; - --) shift; CAKE_ARGUMENTS+=("$@"); break ;; - *) CAKE_ARGUMENTS+=("$1") ;; - esac - shift -done - -# Make sure the tools folder exist. -if [ ! -d "$TOOLS_DIR" ]; then - mkdir "$TOOLS_DIR" -fi - -# Make sure that packages.config exist. -if [ ! -f "$TOOLS_DIR/packages.config" ]; then - echo "Downloading packages.config..." - curl -Lsfo "$TOOLS_DIR/packages.config" https://cakebuild.net/download/bootstrapper/packages - if [ $? -ne 0 ]; then - echo "An error occurred while downloading packages.config." - exit 1 - fi -fi - -# Download NuGet if it does not exist. -if [ ! -f "$NUGET_EXE" ]; then - echo "Downloading NuGet..." - curl -Lsfo "$NUGET_EXE" https://dist.nuget.org/win-x86-commandline/latest/nuget.exe - if [ $? -ne 0 ]; then - echo "An error occurred while downloading nuget.exe." - exit 1 - fi -fi - -# Restore tools from NuGet. -pushd "$TOOLS_DIR" >/dev/null -if [ ! -f "$PACKAGES_CONFIG_MD5" ] || [ "$( cat "$PACKAGES_CONFIG_MD5" | sed 's/\r$//' )" != "$( $MD5_EXE "$PACKAGES_CONFIG" | awk '{ print $1 }' )" ]; then - find . -type d ! -name . ! -name 'Cake.Bakery' | xargs rm -rf -fi - -mono "$NUGET_EXE" install -ExcludeVersion -if [ $? -ne 0 ]; then - echo "Could not restore NuGet tools." - exit 1 -fi - -$MD5_EXE "$PACKAGES_CONFIG" | awk '{ print $1 }' >| "$PACKAGES_CONFIG_MD5" - -popd >/dev/null - -# Restore addins from NuGet. -if [ -f "$ADDINS_PACKAGES_CONFIG" ]; then - pushd "$ADDINS_DIR" >/dev/null - - mono "$NUGET_EXE" install -ExcludeVersion - if [ $? -ne 0 ]; then - echo "Could not restore NuGet addins." - exit 1 - fi - - popd >/dev/null -fi - -# Restore modules from NuGet. -if [ -f "$MODULES_PACKAGES_CONFIG" ]; then - pushd "$MODULES_DIR" >/dev/null - - mono "$NUGET_EXE" install -ExcludeVersion - if [ $? -ne 0 ]; then - echo "Could not restore NuGet modules." - exit 1 - fi - - popd >/dev/null -fi - -# Make sure that Cake has been installed. -if [ ! -f "$CAKE_EXE" ]; then - echo "Could not find Cake.exe at '$CAKE_EXE'." - exit 1 -fi - -# Start Cake -exec mono "$CAKE_EXE" $SCRIPT "${CAKE_ARGUMENTS[@]}" From fce2be9dc7118db2caa6a32729f9fb709d4f68bd Mon Sep 17 00:00:00 2001 From: miterosan Date: Sun, 5 Aug 2018 22:24:52 +0200 Subject: [PATCH 036/417] Allow running inspect core with cakeclr. Sadly window only because nvika and resharper cmd tools require net45. --- build.cake | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/build.cake b/build.cake index 20b2685351..a341e93a0b 100644 --- a/build.cake +++ b/build.cake @@ -1,7 +1,7 @@ +#addin "nuget:?package=CodeFileSanity" #addin "nuget:?package=JetBrains.ReSharper.CommandLineTools" #tool "nuget:?package=NVika.MSBuild" -#addin "nuget:?package=CodeFileSanity" -var NVikaToolPath = GetFiles("./tools/NVika.MSBuild.*/tools/NVika.exe").First(); +#tool "nuget:?package=NuGet.CommandLine" /////////////////////////////////////////////////////////////////////////////// // ARGUMENTS @@ -38,13 +38,17 @@ Task("Test") }); }); -Task("Restore Nuget") -.Does(() => NuGetRestore(osuSolution)); - +// windows only because both inspectcore and nvike depend on net45 +// will be ignored on linux Task("InspectCode") -.IsDependentOn("Restore Nuget") +.WithCriteria(IsRunningOnWindows()) .IsDependentOn("Compile") .Does(() => { + var NVikaToolPath = GetFiles("./tools/NVika.MSBuild.*/tools/NVika.exe").First(); + var NugetToolPath = GetFiles("./tools/NuGet.CommandLine.*/tools/NuGet.exe").First(); + + StartProcess(NugetToolPath, $"restore {osuSolution}"); + InspectCode(osuSolution, new InspectCodeSettings { CachesHome = "inspectcode", OutputFile = "inspectcodereport.xml", From 90c08a447e4741efaa1f0db6a4285c02bab38655 Mon Sep 17 00:00:00 2001 From: miterosan Date: Sun, 5 Aug 2018 22:26:32 +0200 Subject: [PATCH 037/417] Add inspectcodereport to the gitignore --- .gitignore | 2 ++ inspectcodereport.xml | 18 ------------------ 2 files changed, 2 insertions(+), 18 deletions(-) delete mode 100644 inspectcodereport.xml diff --git a/.gitignore b/.gitignore index 26a8752b66..78986dee1d 100644 --- a/.gitignore +++ b/.gitignore @@ -262,3 +262,5 @@ paket-files/ __pycache__/ *.pyc Staging/ + +inspectcodereport.xml diff --git a/inspectcodereport.xml b/inspectcodereport.xml deleted file mode 100644 index f4b531f547..0000000000 --- a/inspectcodereport.xml +++ /dev/null @@ -1,18 +0,0 @@ - - - - - osu.sln - - Solution - - - - - - - - - - - \ No newline at end of file From b430cf34e73760e136cebc4f87045826b76557be Mon Sep 17 00:00:00 2001 From: miterosan Date: Sun, 5 Aug 2018 22:27:51 +0200 Subject: [PATCH 038/417] remove unfnished comment. --- build.cake | 1 - 1 file changed, 1 deletion(-) diff --git a/build.cake b/build.cake index a341e93a0b..60219d4fb0 100644 --- a/build.cake +++ b/build.cake @@ -39,7 +39,6 @@ Task("Test") }); // windows only because both inspectcore and nvike depend on net45 -// will be ignored on linux Task("InspectCode") .WithCriteria(IsRunningOnWindows()) .IsDependentOn("Compile") From 580d478dc80bafbbe39eede20ff1e9f6dc234dc6 Mon Sep 17 00:00:00 2001 From: miterosan Date: Mon, 6 Aug 2018 22:50:23 +0200 Subject: [PATCH 039/417] Allow running on mono if possible. (non windows) --- build.cake | 38 +++++++++++++++++++++++++++++++------- 1 file changed, 31 insertions(+), 7 deletions(-) diff --git a/build.cake b/build.cake index 60219d4fb0..28c314a41b 100644 --- a/build.cake +++ b/build.cake @@ -1,4 +1,4 @@ -#addin "nuget:?package=CodeFileSanity" +#addin "nuget:http://localhost:8081/repository/hm?package=CodeFileSanity&version=1.0.10" #addin "nuget:?package=JetBrains.ReSharper.CommandLineTools" #tool "nuget:?package=NVika.MSBuild" #tool "nuget:?package=NuGet.CommandLine" @@ -38,24 +38,48 @@ Task("Test") }); }); -// windows only because both inspectcore and nvike depend on net45 Task("InspectCode") -.WithCriteria(IsRunningOnWindows()) .IsDependentOn("Compile") .Does(() => { - var NVikaToolPath = GetFiles("./tools/NVika.MSBuild.*/tools/NVika.exe").First(); - var NugetToolPath = GetFiles("./tools/NuGet.CommandLine.*/tools/NuGet.exe").First(); + var nVikaToolPath = GetFiles("./tools/NVika.MSBuild.*/tools/NVika.exe").First(); + var nugetToolPath = GetFiles("./tools/NuGet.CommandLine.*/tools/NuGet.exe").First(); - StartProcess(NugetToolPath, $"restore {osuSolution}"); + if (!IsRunningOnWindows()) { + RunInpectCodeInMono(nVikaToolPath, nugetToolPath); + return; + } + + StartProcess(nugetToolPath, $"restore {osuSolution}"); InspectCode(osuSolution, new InspectCodeSettings { CachesHome = "inspectcode", OutputFile = "inspectcodereport.xml", }); - StartProcess(NVikaToolPath, @"parsereport ""inspectcodereport.xml"" --treatwarningsaserrors"); + StartProcess(nVikaToolPath, @"parsereport ""inspectcodereport.xml"" --treatwarningsaserrors"); }); +void RunInpectCodeInMono(FilePath nugetToolPath, FilePath nVikaToolPath) { + var inspectcodeToolPath = GetFiles("./tools/NuGet.CommandLine.*/tools/NuGet.exe").First(); + + if (!FileExists("mono")) { + Information("Running on an os other than windows and mono is not installed. Skipping InpectCode."); + return; + } + + StartProcess("mono", $"{nugetToolPath} restore {osuSolution}"); + + StartProcess("mono", @"--o=""inspectcodereport.xml"" --caches-home=""inspectcode"" "); + + InspectCode(osuSolution, new InspectCodeSettings { + CachesHome = "inspectcode", + OutputFile = "inspectcodereport.xml", + + }); + + StartProcess("mono", $@"{nVikaToolPath} parsereport ""inspectcodereport.xml"" --treatwarningsaserrors"); +} + Task("CodeFileSanity") .Does(() => { ValidateCodeSanity(new ValidateCodeSanitySettings { From 058a6d9e13b9d91275326fa0508fc776a128df28 Mon Sep 17 00:00:00 2001 From: miterosan Date: Mon, 6 Aug 2018 23:14:51 +0200 Subject: [PATCH 040/417] Add cake.csproj --- .gitignore | 1 + tools/cake.csproj | 9 +++++++++ 2 files changed, 10 insertions(+) create mode 100644 tools/cake.csproj diff --git a/.gitignore b/.gitignore index 78986dee1d..c75c19f9f5 100644 --- a/.gitignore +++ b/.gitignore @@ -13,6 +13,7 @@ ### Cake ### tools/* !tools/packages.config +!tools/cake.csproj # Build results bin/[Dd]ebug/ diff --git a/tools/cake.csproj b/tools/cake.csproj new file mode 100644 index 0000000000..06692627d2 --- /dev/null +++ b/tools/cake.csproj @@ -0,0 +1,9 @@ + + + Exe + netcoreapp2.0 + + + + + \ No newline at end of file From 2b293add9ecfa22d65dbed2d2b22db68a4c04558 Mon Sep 17 00:00:00 2001 From: miterosan Date: Mon, 6 Aug 2018 23:36:24 +0200 Subject: [PATCH 041/417] Use the correct tool executable. Better mono detection --- build.cake | 12 +++--------- 1 file changed, 3 insertions(+), 9 deletions(-) diff --git a/build.cake b/build.cake index 28c314a41b..98add57062 100644 --- a/build.cake +++ b/build.cake @@ -45,7 +45,7 @@ Task("InspectCode") var nugetToolPath = GetFiles("./tools/NuGet.CommandLine.*/tools/NuGet.exe").First(); if (!IsRunningOnWindows()) { - RunInpectCodeInMono(nVikaToolPath, nugetToolPath); + RunInpectCodeInMono(nugetToolPath, nVikaToolPath); return; } @@ -62,20 +62,14 @@ Task("InspectCode") void RunInpectCodeInMono(FilePath nugetToolPath, FilePath nVikaToolPath) { var inspectcodeToolPath = GetFiles("./tools/NuGet.CommandLine.*/tools/NuGet.exe").First(); - if (!FileExists("mono")) { + if (!StartProcess("mono", "--version") != 0) { Information("Running on an os other than windows and mono is not installed. Skipping InpectCode."); return; } StartProcess("mono", $"{nugetToolPath} restore {osuSolution}"); - StartProcess("mono", @"--o=""inspectcodereport.xml"" --caches-home=""inspectcode"" "); - - InspectCode(osuSolution, new InspectCodeSettings { - CachesHome = "inspectcode", - OutputFile = "inspectcodereport.xml", - - }); + StartProcess("mono", $@"{inspectcodeToolPath} --o=""inspectcodereport.xml"" --caches-home=""inspectcode"" "); StartProcess("mono", $@"{nVikaToolPath} parsereport ""inspectcodereport.xml"" --treatwarningsaserrors"); } From de6c25c052a24beb621a2089a5b1aada6b1d561f Mon Sep 17 00:00:00 2001 From: miterosan Date: Mon, 6 Aug 2018 23:37:47 +0200 Subject: [PATCH 042/417] rm bad sign --- build.cake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build.cake b/build.cake index 98add57062..8fdf04d827 100644 --- a/build.cake +++ b/build.cake @@ -62,7 +62,7 @@ Task("InspectCode") void RunInpectCodeInMono(FilePath nugetToolPath, FilePath nVikaToolPath) { var inspectcodeToolPath = GetFiles("./tools/NuGet.CommandLine.*/tools/NuGet.exe").First(); - if (!StartProcess("mono", "--version") != 0) { + if (StartProcess("mono", "--version") != 0) { Information("Running on an os other than windows and mono is not installed. Skipping InpectCode."); return; } From 8ed8efd06dea56957f2aabfe690654bcac0a5a1a Mon Sep 17 00:00:00 2001 From: miterosan Date: Mon, 6 Aug 2018 23:46:08 +0200 Subject: [PATCH 043/417] silent the test for mono --- build.cake | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/build.cake b/build.cake index 8fdf04d827..c52523908f 100644 --- a/build.cake +++ b/build.cake @@ -62,7 +62,12 @@ Task("InspectCode") void RunInpectCodeInMono(FilePath nugetToolPath, FilePath nVikaToolPath) { var inspectcodeToolPath = GetFiles("./tools/NuGet.CommandLine.*/tools/NuGet.exe").First(); - if (StartProcess("mono", "--version") != 0) { + var testMonoArguments = new ProcessArgumentBuilder(); + testMonoArguments.AppendSwitch("version", ""); + + if (StartProcess("mono", new ProcessSettings { + Silent = true, Arguments = testMonoArguments } + ) != 0) { Information("Running on an os other than windows and mono is not installed. Skipping InpectCode."); return; } From b98611dd8ffee7db45e4221437661c3637887fd9 Mon Sep 17 00:00:00 2001 From: miterosan Date: Mon, 6 Aug 2018 23:47:48 +0200 Subject: [PATCH 044/417] minus minus --- build.cake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build.cake b/build.cake index c52523908f..4c5eb92948 100644 --- a/build.cake +++ b/build.cake @@ -63,7 +63,7 @@ void RunInpectCodeInMono(FilePath nugetToolPath, FilePath nVikaToolPath) { var inspectcodeToolPath = GetFiles("./tools/NuGet.CommandLine.*/tools/NuGet.exe").First(); var testMonoArguments = new ProcessArgumentBuilder(); - testMonoArguments.AppendSwitch("version", ""); + testMonoArguments.AppendSwitch("--version", ""); if (StartProcess("mono", new ProcessSettings { Silent = true, Arguments = testMonoArguments } From 7c6ae73be1e82c3a4d5de5fce613ffd1a2273953 Mon Sep 17 00:00:00 2001 From: miterosan Date: Mon, 6 Aug 2018 23:53:09 +0200 Subject: [PATCH 045/417] adjust the path to the commandline tools --- build.cake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build.cake b/build.cake index 4c5eb92948..ceebbf3d83 100644 --- a/build.cake +++ b/build.cake @@ -60,7 +60,7 @@ Task("InspectCode") }); void RunInpectCodeInMono(FilePath nugetToolPath, FilePath nVikaToolPath) { - var inspectcodeToolPath = GetFiles("./tools/NuGet.CommandLine.*/tools/NuGet.exe").First(); + var inspectcodeToolPath = GetFiles("./tools/Addins/JetBrains.Resharper.CommandLineTools.*/**/inspectcode.exe").First(); var testMonoArguments = new ProcessArgumentBuilder(); testMonoArguments.AppendSwitch("--version", ""); From 1a03ef13f4dd29556c629907902425206d4df135 Mon Sep 17 00:00:00 2001 From: miterosan Date: Tue, 7 Aug 2018 22:36:52 +0200 Subject: [PATCH 046/417] Revert "Allow running on mono if possible. (non windows)" https://youtrack.jetbrains.com/issue/RSRP-410004 This reverts commit 580d478dc80bafbbe39eede20ff1e9f6dc234dc6. --- build.cake | 29 +++-------------------------- 1 file changed, 3 insertions(+), 26 deletions(-) diff --git a/build.cake b/build.cake index ceebbf3d83..6a06f843db 100644 --- a/build.cake +++ b/build.cake @@ -1,4 +1,4 @@ -#addin "nuget:http://localhost:8081/repository/hm?package=CodeFileSanity&version=1.0.10" +#addin "nuget:?package=CodeFileSanity" #addin "nuget:?package=JetBrains.ReSharper.CommandLineTools" #tool "nuget:?package=NVika.MSBuild" #tool "nuget:?package=NuGet.CommandLine" @@ -38,17 +38,14 @@ Task("Test") }); }); +// windows only because both inspectcore and nvika depend on net45 Task("InspectCode") +.WithCriteria(IsRunningOnWindows()) .IsDependentOn("Compile") .Does(() => { var nVikaToolPath = GetFiles("./tools/NVika.MSBuild.*/tools/NVika.exe").First(); var nugetToolPath = GetFiles("./tools/NuGet.CommandLine.*/tools/NuGet.exe").First(); - if (!IsRunningOnWindows()) { - RunInpectCodeInMono(nugetToolPath, nVikaToolPath); - return; - } - StartProcess(nugetToolPath, $"restore {osuSolution}"); InspectCode(osuSolution, new InspectCodeSettings { @@ -59,26 +56,6 @@ Task("InspectCode") StartProcess(nVikaToolPath, @"parsereport ""inspectcodereport.xml"" --treatwarningsaserrors"); }); -void RunInpectCodeInMono(FilePath nugetToolPath, FilePath nVikaToolPath) { - var inspectcodeToolPath = GetFiles("./tools/Addins/JetBrains.Resharper.CommandLineTools.*/**/inspectcode.exe").First(); - - var testMonoArguments = new ProcessArgumentBuilder(); - testMonoArguments.AppendSwitch("--version", ""); - - if (StartProcess("mono", new ProcessSettings { - Silent = true, Arguments = testMonoArguments } - ) != 0) { - Information("Running on an os other than windows and mono is not installed. Skipping InpectCode."); - return; - } - - StartProcess("mono", $"{nugetToolPath} restore {osuSolution}"); - - StartProcess("mono", $@"{inspectcodeToolPath} --o=""inspectcodereport.xml"" --caches-home=""inspectcode"" "); - - StartProcess("mono", $@"{nVikaToolPath} parsereport ""inspectcodereport.xml"" --treatwarningsaserrors"); -} - Task("CodeFileSanity") .Does(() => { ValidateCodeSanity(new ValidateCodeSanitySettings { From 2763f0be6bbc8fbbbc37878f40b9e1ee55422ff7 Mon Sep 17 00:00:00 2001 From: miterosan Date: Thu, 9 Aug 2018 20:45:34 +0200 Subject: [PATCH 047/417] Remove the usage of windows nuget restore and replace it with dotnet restore --- build.cake | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/build.cake b/build.cake index 6a06f843db..6508150a3b 100644 --- a/build.cake +++ b/build.cake @@ -1,7 +1,6 @@ #addin "nuget:?package=CodeFileSanity" #addin "nuget:?package=JetBrains.ReSharper.CommandLineTools" #tool "nuget:?package=NVika.MSBuild" -#tool "nuget:?package=NuGet.CommandLine" /////////////////////////////////////////////////////////////////////////////// // ARGUMENTS @@ -44,9 +43,8 @@ Task("InspectCode") .IsDependentOn("Compile") .Does(() => { var nVikaToolPath = GetFiles("./tools/NVika.MSBuild.*/tools/NVika.exe").First(); - var nugetToolPath = GetFiles("./tools/NuGet.CommandLine.*/tools/NuGet.exe").First(); - - StartProcess(nugetToolPath, $"restore {osuSolution}"); + + DotNetCoreRestore(osuSolution.FullPath); InspectCode(osuSolution, new InspectCodeSettings { CachesHome = "inspectcode", From 8a9b3f6459324a0af0e1f2ec2c09e51392ef4144 Mon Sep 17 00:00:00 2001 From: Roman Kapustin Date: Wed, 15 Aug 2018 22:18:48 +0300 Subject: [PATCH 048/417] Remove rewinded keycounter states --- osu.Game/Screens/Play/KeyCounter.cs | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/osu.Game/Screens/Play/KeyCounter.cs b/osu.Game/Screens/Play/KeyCounter.cs index cb9ff28aff..301c25f1fd 100644 --- a/osu.Game/Screens/Play/KeyCounter.cs +++ b/osu.Game/Screens/Play/KeyCounter.cs @@ -152,6 +152,15 @@ namespace osu.Game.Screens.Play RestoreState(Clock.CurrentTime); } - public void RestoreState(double time) => CountPresses = states.LastOrDefault(state => state.Time <= time)?.Count ?? 0; + public void RestoreState(double time) + { + var targetState = states.LastOrDefault(state => state.Time <= time); + var targetIndex = states.IndexOf(targetState); + + states.RemoveRange(targetIndex + 1, states.Count - (targetIndex + 1)); + + lastState = targetState; + CountPresses = targetState?.Count ?? 0; + } } } From d070a3e2d8feca209c46bf33cd791b350076544c Mon Sep 17 00:00:00 2001 From: miterosan Date: Wed, 22 Aug 2018 20:46:03 +0200 Subject: [PATCH 049/417] Only affect hitcicles, slider and spinner --- osu.Game.Rulesets.Osu/Mods/OsuModArrange.cs | 21 +++++++++++---------- 1 file changed, 11 insertions(+), 10 deletions(-) diff --git a/osu.Game.Rulesets.Osu/Mods/OsuModArrange.cs b/osu.Game.Rulesets.Osu/Mods/OsuModArrange.cs index 5dabf6bfe1..49e98ea861 100644 --- a/osu.Game.Rulesets.Osu/Mods/OsuModArrange.cs +++ b/osu.Game.Rulesets.Osu/Mods/OsuModArrange.cs @@ -24,7 +24,13 @@ namespace osu.Game.Rulesets.Osu.Mods public void ApplyToDrawableHitObjects(IEnumerable drawables) { - drawables.ForEach(drawable => drawable.ApplyCustomUpdateState += drawableOnApplyCustomUpdateState); + drawables.Where(drawable => ( + drawable is DrawableHitCircle || + drawable is DrawableSlider || + drawable is DrawableSpinner + )).ForEach(drawable => + drawable.ApplyCustomUpdateState += drawableOnApplyCustomUpdateState + ); } private float theta; @@ -33,13 +39,10 @@ namespace osu.Game.Rulesets.Osu.Mods { var hitObject = (OsuHitObject) drawable.HitObject; - // repeat points get their position data from the slider. - if (hitObject is RepeatPoint) - return; + float appear_distance = (float)hitObject.TimePreempt * 0.5f; Vector2 originalPosition = drawable.Position; - - const float appear_distance = 250; + Vector2 appearOffset = new Vector2((float)Math.Cos(theta), (float)Math.Sin(theta)) * appear_distance; //the - 1 and + 1 prevents the hit explosion to appear in the wrong position. double appearTime = hitObject.StartTime - hitObject.TimePreempt - 1; @@ -48,13 +51,11 @@ namespace osu.Game.Rulesets.Osu.Mods using (drawable.BeginAbsoluteSequence(appearTime, true)) { drawable - .MoveToOffset(new Vector2((float)Math.Cos(theta), (float)Math.Sin(theta)) * appear_distance) + .MoveToOffset(appearOffset) .MoveTo(originalPosition, moveDuration, Easing.InOutSine); } - // That way slider ticks come all from the same direction. - if (hitObject is HitCircle || hitObject is Slider) - theta += 0.4f; + theta += 0.4f; } } } From c374755cc88d296e00092e2a36096b2334ce47c4 Mon Sep 17 00:00:00 2001 From: miterosan Date: Wed, 22 Aug 2018 21:16:45 +0200 Subject: [PATCH 050/417] only affect spinner, hitcircle and slider and nothing else. --- osu.Game.Rulesets.Osu/Mods/OsuModArrange.cs | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/osu.Game.Rulesets.Osu/Mods/OsuModArrange.cs b/osu.Game.Rulesets.Osu/Mods/OsuModArrange.cs index 49e98ea861..83f6e7843e 100644 --- a/osu.Game.Rulesets.Osu/Mods/OsuModArrange.cs +++ b/osu.Game.Rulesets.Osu/Mods/OsuModArrange.cs @@ -22,13 +22,15 @@ namespace osu.Game.Rulesets.Osu.Mods public override string Description => "Everything rotates. EVERYTHING."; public override double ScoreMultiplier => 1; + private readonly IReadOnlyList TargetHitObjectTypes = new List() { + typeof(HitCircle), + typeof(Slider), + typeof(Spinner), + }; + public void ApplyToDrawableHitObjects(IEnumerable drawables) { - drawables.Where(drawable => ( - drawable is DrawableHitCircle || - drawable is DrawableSlider || - drawable is DrawableSpinner - )).ForEach(drawable => + drawables.ForEach(drawable => drawable.ApplyCustomUpdateState += drawableOnApplyCustomUpdateState ); } @@ -39,6 +41,9 @@ namespace osu.Game.Rulesets.Osu.Mods { var hitObject = (OsuHitObject) drawable.HitObject; + if (!TargetHitObjectTypes.Contains(hitObject.GetType())) + return; + float appear_distance = (float)hitObject.TimePreempt * 0.5f; Vector2 originalPosition = drawable.Position; From 173d12c1ec191cfcedc6398b127084720f3d1e5c Mon Sep 17 00:00:00 2001 From: miterosan Date: Wed, 22 Aug 2018 21:17:18 +0200 Subject: [PATCH 051/417] rename arrange to transform --- osu.Game.Rulesets.Osu/Mods/OsuModArrange.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/osu.Game.Rulesets.Osu/Mods/OsuModArrange.cs b/osu.Game.Rulesets.Osu/Mods/OsuModArrange.cs index 83f6e7843e..fd227b0285 100644 --- a/osu.Game.Rulesets.Osu/Mods/OsuModArrange.cs +++ b/osu.Game.Rulesets.Osu/Mods/OsuModArrange.cs @@ -15,8 +15,8 @@ namespace osu.Game.Rulesets.Osu.Mods { internal class OsuModArrange : Mod, IApplicableToDrawableHitObjects { - public override string Name => "Arrange"; - public override string ShortenedName => "Arrange"; + public override string Name => "Transform"; + public override string ShortenedName => "TR"; public override FontAwesome Icon => FontAwesome.fa_arrows; public override ModType Type => ModType.Fun; public override string Description => "Everything rotates. EVERYTHING."; From 5c5191b9c3773e4bedbbc7d3db622bd1db29a811 Mon Sep 17 00:00:00 2001 From: miterosan Date: Wed, 22 Aug 2018 21:19:28 +0200 Subject: [PATCH 052/417] Rename the mod class to transform. --- .../Mods/{OsuModArrange.cs => OsuModTransform.cs} | 6 +++++- osu.Game.Rulesets.Osu/OsuRuleset.cs | 2 +- 2 files changed, 6 insertions(+), 2 deletions(-) rename osu.Game.Rulesets.Osu/Mods/{OsuModArrange.cs => OsuModTransform.cs} (92%) diff --git a/osu.Game.Rulesets.Osu/Mods/OsuModArrange.cs b/osu.Game.Rulesets.Osu/Mods/OsuModTransform.cs similarity index 92% rename from osu.Game.Rulesets.Osu/Mods/OsuModArrange.cs rename to osu.Game.Rulesets.Osu/Mods/OsuModTransform.cs index fd227b0285..4b48e1af2c 100644 --- a/osu.Game.Rulesets.Osu/Mods/OsuModArrange.cs +++ b/osu.Game.Rulesets.Osu/Mods/OsuModTransform.cs @@ -2,6 +2,7 @@ // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE using System; +using System.Linq; using System.Collections.Generic; using osu.Framework.Extensions.IEnumerableExtensions; using osu.Framework.Graphics; @@ -10,10 +11,13 @@ using osu.Game.Rulesets.Mods; using osu.Game.Rulesets.Objects.Drawables; using osu.Game.Rulesets.Osu.Objects; using OpenTK; +using osu.Game.Rulesets.Osu.UI; +using osu.Game.Rulesets.UI; +using osu.Game.Rulesets.Osu.Objects.Drawables; namespace osu.Game.Rulesets.Osu.Mods { - internal class OsuModArrange : Mod, IApplicableToDrawableHitObjects + internal class OsuModTransform : Mod, IApplicableToDrawableHitObjects { public override string Name => "Transform"; public override string ShortenedName => "TR"; diff --git a/osu.Game.Rulesets.Osu/OsuRuleset.cs b/osu.Game.Rulesets.Osu/OsuRuleset.cs index c80ecbf6df..9e3214530f 100644 --- a/osu.Game.Rulesets.Osu/OsuRuleset.cs +++ b/osu.Game.Rulesets.Osu/OsuRuleset.cs @@ -119,7 +119,7 @@ namespace osu.Game.Rulesets.Osu }; case ModType.Fun: return new Mod[] { - new OsuModArrange(), + new OsuModTransform(), }; default: return new Mod[] { }; From 6600f7b30e145d7cac2222655943d9d5961b1e04 Mon Sep 17 00:00:00 2001 From: miterosan Date: Wed, 22 Aug 2018 21:27:20 +0200 Subject: [PATCH 053/417] correct the namings and styling --- osu.Game.Rulesets.Osu/Mods/OsuModTransform.cs | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/osu.Game.Rulesets.Osu/Mods/OsuModTransform.cs b/osu.Game.Rulesets.Osu/Mods/OsuModTransform.cs index 4b48e1af2c..6fa4ed434e 100644 --- a/osu.Game.Rulesets.Osu/Mods/OsuModTransform.cs +++ b/osu.Game.Rulesets.Osu/Mods/OsuModTransform.cs @@ -11,9 +11,6 @@ using osu.Game.Rulesets.Mods; using osu.Game.Rulesets.Objects.Drawables; using osu.Game.Rulesets.Osu.Objects; using OpenTK; -using osu.Game.Rulesets.Osu.UI; -using osu.Game.Rulesets.UI; -using osu.Game.Rulesets.Osu.Objects.Drawables; namespace osu.Game.Rulesets.Osu.Mods { @@ -26,7 +23,7 @@ namespace osu.Game.Rulesets.Osu.Mods public override string Description => "Everything rotates. EVERYTHING."; public override double ScoreMultiplier => 1; - private readonly IReadOnlyList TargetHitObjectTypes = new List() { + private readonly IReadOnlyList targetHitObjectTypes = new List() { typeof(HitCircle), typeof(Slider), typeof(Spinner), @@ -34,7 +31,7 @@ namespace osu.Game.Rulesets.Osu.Mods public void ApplyToDrawableHitObjects(IEnumerable drawables) { - drawables.ForEach(drawable => + drawables.ForEach(drawable => drawable.ApplyCustomUpdateState += drawableOnApplyCustomUpdateState ); } @@ -45,13 +42,13 @@ namespace osu.Game.Rulesets.Osu.Mods { var hitObject = (OsuHitObject) drawable.HitObject; - if (!TargetHitObjectTypes.Contains(hitObject.GetType())) + if (!targetHitObjectTypes.Contains(hitObject.GetType())) return; - float appear_distance = (float)hitObject.TimePreempt * 0.5f; + float appearDistance = (float)hitObject.TimePreempt * 0.5f; Vector2 originalPosition = drawable.Position; - Vector2 appearOffset = new Vector2((float)Math.Cos(theta), (float)Math.Sin(theta)) * appear_distance; + Vector2 appearOffset = new Vector2((float)Math.Cos(theta), (float)Math.Sin(theta)) * appearDistance; //the - 1 and + 1 prevents the hit explosion to appear in the wrong position. double appearTime = hitObject.StartTime - hitObject.TimePreempt - 1; From 0a48f8eadd76d7e06ecf97a575aa5a49d0b382fd Mon Sep 17 00:00:00 2001 From: miterosan Date: Wed, 22 Aug 2018 21:39:59 +0200 Subject: [PATCH 054/417] remove empty object ctar args --- osu.Game.Rulesets.Osu/Mods/OsuModTransform.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu.Game.Rulesets.Osu/Mods/OsuModTransform.cs b/osu.Game.Rulesets.Osu/Mods/OsuModTransform.cs index 6fa4ed434e..e31c7b12f9 100644 --- a/osu.Game.Rulesets.Osu/Mods/OsuModTransform.cs +++ b/osu.Game.Rulesets.Osu/Mods/OsuModTransform.cs @@ -23,7 +23,7 @@ namespace osu.Game.Rulesets.Osu.Mods public override string Description => "Everything rotates. EVERYTHING."; public override double ScoreMultiplier => 1; - private readonly IReadOnlyList targetHitObjectTypes = new List() { + private readonly IReadOnlyList targetHitObjectTypes = new List { typeof(HitCircle), typeof(Slider), typeof(Spinner), From 8112a51d5fc1b2e9c4d51c7224562377d7e71f04 Mon Sep 17 00:00:00 2001 From: miterosan Date: Fri, 24 Aug 2018 22:23:27 +0200 Subject: [PATCH 055/417] Only apply the transformation once and make the distance and theta dynamic. --- osu.Game.Rulesets.Osu/Mods/OsuModTransform.cs | 59 ++++++++----------- 1 file changed, 24 insertions(+), 35 deletions(-) diff --git a/osu.Game.Rulesets.Osu/Mods/OsuModTransform.cs b/osu.Game.Rulesets.Osu/Mods/OsuModTransform.cs index e31c7b12f9..e76da68bee 100644 --- a/osu.Game.Rulesets.Osu/Mods/OsuModTransform.cs +++ b/osu.Game.Rulesets.Osu/Mods/OsuModTransform.cs @@ -22,46 +22,35 @@ namespace osu.Game.Rulesets.Osu.Mods public override ModType Type => ModType.Fun; public override string Description => "Everything rotates. EVERYTHING."; public override double ScoreMultiplier => 1; - - private readonly IReadOnlyList targetHitObjectTypes = new List { - typeof(HitCircle), - typeof(Slider), - typeof(Spinner), - }; + private float theta; public void ApplyToDrawableHitObjects(IEnumerable drawables) { - drawables.ForEach(drawable => - drawable.ApplyCustomUpdateState += drawableOnApplyCustomUpdateState - ); - } - - private float theta; - - private void drawableOnApplyCustomUpdateState(DrawableHitObject drawable, ArmedState state) - { - var hitObject = (OsuHitObject) drawable.HitObject; - - if (!targetHitObjectTypes.Contains(hitObject.GetType())) - return; - - float appearDistance = (float)hitObject.TimePreempt * 0.5f; - - Vector2 originalPosition = drawable.Position; - Vector2 appearOffset = new Vector2((float)Math.Cos(theta), (float)Math.Sin(theta)) * appearDistance; - - //the - 1 and + 1 prevents the hit explosion to appear in the wrong position. - double appearTime = hitObject.StartTime - hitObject.TimePreempt - 1; - double moveDuration = hitObject.TimePreempt + 1; - - using (drawable.BeginAbsoluteSequence(appearTime, true)) + foreach (var drawable in drawables) { - drawable - .MoveToOffset(appearOffset) - .MoveTo(originalPosition, moveDuration, Easing.InOutSine); - } + var hitObject = (OsuHitObject) drawable.HitObject; - theta += 0.4f; + float appearDistance = (float)(hitObject.TimePreempt - hitObject.TimeFadeIn) / 2; + + Vector2 originalPosition = drawable.Position; + Vector2 appearOffset = new Vector2((float)Math.Cos(theta), (float)Math.Sin(theta)) * appearDistance; + + //the - 1 and + 1 prevents the hit explosion to appear in the wrong position. + double appearTime = hitObject.StartTime - hitObject.TimePreempt - 1; + double moveDuration = hitObject.TimePreempt + 1; + + using (drawable.BeginAbsoluteSequence(appearTime, true)) + { + drawable + .MoveToOffset(appearOffset) + .MoveTo(originalPosition, moveDuration, Easing.InOutSine); + } + + theta += (float) hitObject.TimeFadeIn / 1000; + } } + + + } } From 8b016f05e6cb18e110de0d1bba636ae5dd360304 Mon Sep 17 00:00:00 2001 From: miterosan Date: Fri, 24 Aug 2018 22:24:57 +0200 Subject: [PATCH 056/417] Remove unessesary nl --- osu.Game.Rulesets.Osu/Mods/OsuModTransform.cs | 3 --- 1 file changed, 3 deletions(-) diff --git a/osu.Game.Rulesets.Osu/Mods/OsuModTransform.cs b/osu.Game.Rulesets.Osu/Mods/OsuModTransform.cs index e76da68bee..4892ba8dc1 100644 --- a/osu.Game.Rulesets.Osu/Mods/OsuModTransform.cs +++ b/osu.Game.Rulesets.Osu/Mods/OsuModTransform.cs @@ -49,8 +49,5 @@ namespace osu.Game.Rulesets.Osu.Mods theta += (float) hitObject.TimeFadeIn / 1000; } } - - - } } From 726a51018915a55a399e67a573e70aa105b33219 Mon Sep 17 00:00:00 2001 From: miterosan Date: Fri, 24 Aug 2018 22:33:14 +0200 Subject: [PATCH 057/417] remove not needed usings --- osu.Game.Rulesets.Osu/Mods/OsuModTransform.cs | 2 -- 1 file changed, 2 deletions(-) diff --git a/osu.Game.Rulesets.Osu/Mods/OsuModTransform.cs b/osu.Game.Rulesets.Osu/Mods/OsuModTransform.cs index 4892ba8dc1..5839d51500 100644 --- a/osu.Game.Rulesets.Osu/Mods/OsuModTransform.cs +++ b/osu.Game.Rulesets.Osu/Mods/OsuModTransform.cs @@ -2,9 +2,7 @@ // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE using System; -using System.Linq; using System.Collections.Generic; -using osu.Framework.Extensions.IEnumerableExtensions; using osu.Framework.Graphics; using osu.Game.Graphics; using osu.Game.Rulesets.Mods; From e1f01d6f73e24f2a0fb54c4f0885261e650b1282 Mon Sep 17 00:00:00 2001 From: clayton Date: Sat, 25 Aug 2018 20:31:33 -0700 Subject: [PATCH 058/417] Update LastVisit JSON property name --- osu.Game/Users/User.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu.Game/Users/User.cs b/osu.Game/Users/User.cs index f42df4023f..10b75082ad 100644 --- a/osu.Game/Users/User.cs +++ b/osu.Game/Users/User.cs @@ -83,7 +83,7 @@ namespace osu.Game.Users [JsonProperty(@"location")] public string Location; - [JsonProperty(@"lastvisit")] + [JsonProperty(@"last_visit")] public DateTimeOffset LastVisit; [JsonProperty(@"twitter")] From 4c42d4031440623a7ac1d62a7b2201691df0c6bb Mon Sep 17 00:00:00 2001 From: miterosan Date: Wed, 5 Sep 2018 21:09:09 +0200 Subject: [PATCH 059/417] Correct the comment from explosion to object --- osu.Game.Rulesets.Osu/Mods/OsuModTransform.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu.Game.Rulesets.Osu/Mods/OsuModTransform.cs b/osu.Game.Rulesets.Osu/Mods/OsuModTransform.cs index 5839d51500..30837d7db9 100644 --- a/osu.Game.Rulesets.Osu/Mods/OsuModTransform.cs +++ b/osu.Game.Rulesets.Osu/Mods/OsuModTransform.cs @@ -33,7 +33,7 @@ namespace osu.Game.Rulesets.Osu.Mods Vector2 originalPosition = drawable.Position; Vector2 appearOffset = new Vector2((float)Math.Cos(theta), (float)Math.Sin(theta)) * appearDistance; - //the - 1 and + 1 prevents the hit explosion to appear in the wrong position. + //the - 1 and + 1 prevents the hit objects to appear in the wrong position. double appearTime = hitObject.StartTime - hitObject.TimePreempt - 1; double moveDuration = hitObject.TimePreempt + 1; From 7a1fdd9dc8a146ffdb951c6588c001ede4d0c11e Mon Sep 17 00:00:00 2001 From: Roman Kapustin Date: Thu, 6 Sep 2018 01:01:36 +0300 Subject: [PATCH 060/417] Reset KeyCounter if targetState was not found --- osu.Game/Screens/Play/KeyCounter.cs | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/osu.Game/Screens/Play/KeyCounter.cs b/osu.Game/Screens/Play/KeyCounter.cs index 301c25f1fd..0771cc614c 100644 --- a/osu.Game/Screens/Play/KeyCounter.cs +++ b/osu.Game/Screens/Play/KeyCounter.cs @@ -136,7 +136,11 @@ namespace osu.Game.Screens.Play } } - public void ResetCount() => CountPresses = 0; + public void ResetCount() + { + CountPresses = 0; + states.Clear(); + } public void SaveState() { @@ -155,6 +159,12 @@ namespace osu.Game.Screens.Play public void RestoreState(double time) { var targetState = states.LastOrDefault(state => state.Time <= time); + if (targetState == null) + { + ResetCount(); + return; + } + var targetIndex = states.IndexOf(targetState); states.RemoveRange(targetIndex + 1, states.Count - (targetIndex + 1)); From dae54d252df331bd7a0dd026235e0b4035bdff54 Mon Sep 17 00:00:00 2001 From: Roman Kapustin Date: Fri, 7 Sep 2018 21:35:32 +0300 Subject: [PATCH 061/417] Remove redundant checks in RestoreState --- osu.Game/Screens/Play/KeyCounter.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu.Game/Screens/Play/KeyCounter.cs b/osu.Game/Screens/Play/KeyCounter.cs index 0771cc614c..0f621e6bb3 100644 --- a/osu.Game/Screens/Play/KeyCounter.cs +++ b/osu.Game/Screens/Play/KeyCounter.cs @@ -170,7 +170,7 @@ namespace osu.Game.Screens.Play states.RemoveRange(targetIndex + 1, states.Count - (targetIndex + 1)); lastState = targetState; - CountPresses = targetState?.Count ?? 0; + CountPresses = targetState.Count; } } } From 125b569ccbf06ee2d488879812b761e999d58c87 Mon Sep 17 00:00:00 2001 From: Roman Kapustin Date: Fri, 7 Sep 2018 21:39:41 +0300 Subject: [PATCH 062/417] Change AudioClock type to IFrameBasedClock and comment its usage --- osu.Game/Screens/Play/HUDOverlay.cs | 4 ++-- osu.Game/Screens/Play/KeyCounterCollection.cs | 7 ++++--- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/osu.Game/Screens/Play/HUDOverlay.cs b/osu.Game/Screens/Play/HUDOverlay.cs index 0187a21d01..eb137f5447 100644 --- a/osu.Game/Screens/Play/HUDOverlay.cs +++ b/osu.Game/Screens/Play/HUDOverlay.cs @@ -69,7 +69,7 @@ namespace osu.Game.Screens.Play Direction = FillDirection.Vertical, Children = new Drawable[] { - KeyCounter = CreateKeyCounter(adjustableClock), + KeyCounter = CreateKeyCounter(adjustableClock as IFrameBasedClock), HoldToQuit = CreateQuitButton(), } } @@ -194,7 +194,7 @@ namespace osu.Game.Screens.Play Margin = new MarginPadding { Top = 20 } }; - protected virtual KeyCounterCollection CreateKeyCounter(IClock offsetClock) => new KeyCounterCollection + protected virtual KeyCounterCollection CreateKeyCounter(IFrameBasedClock offsetClock) => new KeyCounterCollection { FadeTime = 50, Anchor = Anchor.BottomRight, diff --git a/osu.Game/Screens/Play/KeyCounterCollection.cs b/osu.Game/Screens/Play/KeyCounterCollection.cs index f701c468e9..2a737d974b 100644 --- a/osu.Game/Screens/Play/KeyCounterCollection.cs +++ b/osu.Game/Screens/Play/KeyCounterCollection.cs @@ -38,8 +38,9 @@ namespace osu.Game.Screens.Play key.FadeTime = FadeTime; key.KeyDownTextColor = KeyDownTextColor; key.KeyUpTextColor = KeyUpTextColor; - if (AudioClock != null && AudioClock is IFrameBasedClock basedClock) - key.Clock = basedClock; + // Use the same clock object as SongProgress for saving KeyCounter state + if (AudioClock != null) + key.Clock = AudioClock; } public void ResetCount() @@ -121,7 +122,7 @@ namespace osu.Game.Screens.Play public override bool HandleKeyboardInput => receptor == null; public override bool HandleMouseInput => receptor == null; - public IClock AudioClock { get; set; } + public IFrameBasedClock AudioClock { get; set; } private Receptor receptor; From 0f9aa834e55db032a784175c35390bd4c7900a12 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Sat, 8 Sep 2018 16:31:00 +0900 Subject: [PATCH 063/417] Fix osu! logo being present throughout the whole game --- osu.Game/Screens/Menu/OsuLogo.cs | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/osu.Game/Screens/Menu/OsuLogo.cs b/osu.Game/Screens/Menu/OsuLogo.cs index f0f765a4c9..5ad6427fd8 100644 --- a/osu.Game/Screens/Menu/OsuLogo.cs +++ b/osu.Game/Screens/Menu/OsuLogo.cs @@ -84,11 +84,10 @@ namespace osu.Game.Screens.Menu private const double early_activation = 60; + public override bool IsPresent => base.IsPresent || Scheduler.HasPendingTasks; + public OsuLogo() { - // Required to make Schedule calls run in OsuScreen even when we are not visible. - AlwaysPresent = true; - EarlyActivationMilliseconds = early_activation; Size = new Vector2(default_size); From 27ac7685e164dafd1c555a3f8b8667bf0d9cf7b8 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Sun, 9 Sep 2018 22:12:37 +0900 Subject: [PATCH 064/417] Bring music controller in front of notification overlay --- osu.Game/OsuGame.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu.Game/OsuGame.cs b/osu.Game/OsuGame.cs index 6fcb948298..8610a8d74d 100644 --- a/osu.Game/OsuGame.cs +++ b/osu.Game/OsuGame.cs @@ -355,7 +355,7 @@ namespace osu.Game loadComponentSingleFile(beatmapSetOverlay = new BeatmapSetOverlay { Depth = -3 }, mainContent.Add); loadComponentSingleFile(musicController = new MusicController { - Depth = -4, + Depth = -5, Position = new Vector2(0, Toolbar.HEIGHT), Anchor = Anchor.TopRight, Origin = Anchor.TopRight, From 399d456edb7e06ccd892fbb66aa03439be208c13 Mon Sep 17 00:00:00 2001 From: miterosan Date: Tue, 11 Sep 2018 21:49:10 +0200 Subject: [PATCH 065/417] Pin the addin and tool versions down. --- build.cake | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/build.cake b/build.cake index 6508150a3b..4f6883cab0 100644 --- a/build.cake +++ b/build.cake @@ -1,6 +1,6 @@ -#addin "nuget:?package=CodeFileSanity" -#addin "nuget:?package=JetBrains.ReSharper.CommandLineTools" -#tool "nuget:?package=NVika.MSBuild" +#addin "nuget:?package=CodeFileSanity&version=0.0.21" +#addin "nuget:?package=JetBrains.ReSharper.CommandLineTools&version=2018.2.2" +#tool "nuget:?package=NVika.MSBuild&version=1.0.1" /////////////////////////////////////////////////////////////////////////////// // ARGUMENTS From 2e91b86e00a47249df5a56f757ed0be0466d78c7 Mon Sep 17 00:00:00 2001 From: miterosan Date: Tue, 11 Sep 2018 22:07:14 +0200 Subject: [PATCH 066/417] Remove Redundant parentheses --- osu.Game/Storyboards/CommandTimeline.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/osu.Game/Storyboards/CommandTimeline.cs b/osu.Game/Storyboards/CommandTimeline.cs index 7de0756dbd..8a032064d3 100644 --- a/osu.Game/Storyboards/CommandTimeline.cs +++ b/osu.Game/Storyboards/CommandTimeline.cs @@ -16,10 +16,10 @@ namespace osu.Game.Storyboards public bool HasCommands => commands.Count > 0; private Cached startTimeBacking; - public double StartTime => startTimeBacking.IsValid ? startTimeBacking : (startTimeBacking.Value = HasCommands ? commands.Min(c => c.StartTime) : double.MinValue); + public double StartTime => startTimeBacking.IsValid ? startTimeBacking : startTimeBacking.Value = HasCommands ? commands.Min(c => c.StartTime) : double.MinValue; private Cached endTimeBacking; - public double EndTime => endTimeBacking.IsValid ? endTimeBacking : (endTimeBacking.Value = HasCommands ? commands.Max(c => c.EndTime) : double.MaxValue); + public double EndTime => endTimeBacking.IsValid ? endTimeBacking : endTimeBacking.Value = HasCommands ? commands.Max(c => c.EndTime) : double.MaxValue; public T StartValue => HasCommands ? commands.OrderBy(c => c.StartTime).First().StartValue : default(T); public T EndValue => HasCommands ? commands.OrderByDescending(c => c.EndTime).First().EndValue : default(T); From e20b0849002120c9981312853a68ef8ae9c39821 Mon Sep 17 00:00:00 2001 From: miterosan Date: Tue, 11 Sep 2018 22:11:25 +0200 Subject: [PATCH 067/417] Report the test results to appveyor --- build.cake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build.cake b/build.cake index 4f6883cab0..7e1f1bdda7 100644 --- a/build.cake +++ b/build.cake @@ -32,7 +32,7 @@ Task("Test") DotNetCoreTest(testProject.FullPath, new DotNetCoreTestSettings { Framework = framework, Configuration = configuration, - Logger = $"trx;LogFileName={testProject.GetFilename()}.trx", + Logger = AppVeyor.IsRunningOnAppVeyor ? "Appveyor" : $"trx;LogFileName={testProject.GetFilename()}.trx", ResultsDirectory = "./TestResults/" }); }); From 0be3ba946fdb4f2d02d4b60adf5c2a7231d83de5 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Thu, 13 Sep 2018 13:40:46 +0900 Subject: [PATCH 068/417] Fix system user attempting to show in profile overlay --- osu.Game/Online/Chat/InfoMessage.cs | 6 +----- osu.Game/Overlays/UserProfileOverlay.cs | 4 +++- osu.Game/Users/User.cs | 9 +++++++++ 3 files changed, 13 insertions(+), 6 deletions(-) diff --git a/osu.Game/Online/Chat/InfoMessage.cs b/osu.Game/Online/Chat/InfoMessage.cs index 2ff901deb1..4e14b097f7 100644 --- a/osu.Game/Online/Chat/InfoMessage.cs +++ b/osu.Game/Online/Chat/InfoMessage.cs @@ -15,11 +15,7 @@ namespace osu.Game.Online.Chat Timestamp = DateTimeOffset.Now; Content = message; - Sender = new User - { - Username = @"system", - Colour = @"0000ff", - }; + Sender = User.SystemUser; } } } diff --git a/osu.Game/Overlays/UserProfileOverlay.cs b/osu.Game/Overlays/UserProfileOverlay.cs index ea077ff645..f428e8cfc6 100644 --- a/osu.Game/Overlays/UserProfileOverlay.cs +++ b/osu.Game/Overlays/UserProfileOverlay.cs @@ -77,9 +77,11 @@ namespace osu.Game.Overlays public void ShowUser(User user, bool fetchOnline = true) { + if (user == User.SystemUser) return; + Show(); - if (user.Id == Header?.User.Id) + if (user.Id == Header?.User?.Id) return; userReq?.Cancel(); diff --git a/osu.Game/Users/User.cs b/osu.Game/Users/User.cs index f42df4023f..3a90605da7 100644 --- a/osu.Game/Users/User.cs +++ b/osu.Game/Users/User.cs @@ -144,5 +144,14 @@ namespace osu.Game.Users public Badge[] Badges; public override string ToString() => Username; + + /// + /// A user instance for displaying locally created system messages. + /// + public static User SystemUser { get; } = new User + { + Username = "system", + Id = 0 + }; } } From 4341d258af3d9ab94cf95cf20e02c921aa426894 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Thu, 13 Sep 2018 14:03:21 +0900 Subject: [PATCH 069/417] Make readonly instead --- osu.Game/Online/Chat/InfoMessage.cs | 2 +- osu.Game/Overlays/UserProfileOverlay.cs | 2 +- osu.Game/Users/User.cs | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/osu.Game/Online/Chat/InfoMessage.cs b/osu.Game/Online/Chat/InfoMessage.cs index 4e14b097f7..103a999591 100644 --- a/osu.Game/Online/Chat/InfoMessage.cs +++ b/osu.Game/Online/Chat/InfoMessage.cs @@ -15,7 +15,7 @@ namespace osu.Game.Online.Chat Timestamp = DateTimeOffset.Now; Content = message; - Sender = User.SystemUser; + Sender = User.SYSTEM_USER; } } } diff --git a/osu.Game/Overlays/UserProfileOverlay.cs b/osu.Game/Overlays/UserProfileOverlay.cs index f428e8cfc6..c106446fe0 100644 --- a/osu.Game/Overlays/UserProfileOverlay.cs +++ b/osu.Game/Overlays/UserProfileOverlay.cs @@ -77,7 +77,7 @@ namespace osu.Game.Overlays public void ShowUser(User user, bool fetchOnline = true) { - if (user == User.SystemUser) return; + if (user == User.SYSTEM_USER) return; Show(); diff --git a/osu.Game/Users/User.cs b/osu.Game/Users/User.cs index 3a90605da7..6c3d2bfa63 100644 --- a/osu.Game/Users/User.cs +++ b/osu.Game/Users/User.cs @@ -148,7 +148,7 @@ namespace osu.Game.Users /// /// A user instance for displaying locally created system messages. /// - public static User SystemUser { get; } = new User + public static readonly User SYSTEM_USER = new User { Username = "system", Id = 0 From 221a99d886cfe9aaacf6515dcd65c0c0673b90e1 Mon Sep 17 00:00:00 2001 From: Unknown Date: Thu, 13 Sep 2018 08:54:58 +0200 Subject: [PATCH 070/417] fix StatusPill not setting text when initially set with NONE --- osu.Game/Beatmaps/Drawables/BeatmapSetOnlineStatusPill.cs | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/osu.Game/Beatmaps/Drawables/BeatmapSetOnlineStatusPill.cs b/osu.Game/Beatmaps/Drawables/BeatmapSetOnlineStatusPill.cs index c7e97cef55..511ce9aa58 100644 --- a/osu.Game/Beatmaps/Drawables/BeatmapSetOnlineStatusPill.cs +++ b/osu.Game/Beatmaps/Drawables/BeatmapSetOnlineStatusPill.cs @@ -14,10 +14,10 @@ namespace osu.Game.Beatmaps.Drawables { private readonly OsuSpriteText statusText; - private BeatmapSetOnlineStatus status = BeatmapSetOnlineStatus.None; + private BeatmapSetOnlineStatus status; public BeatmapSetOnlineStatus Status { - get { return status; } + get => status; set { if (value == status) return; @@ -49,6 +49,8 @@ namespace osu.Game.Beatmaps.Drawables Padding = textPadding, }, }; + + Status = BeatmapSetOnlineStatus.None; } } } From 13b988053a116306855e48316bc00bbf62fa413c Mon Sep 17 00:00:00 2001 From: Unknown Date: Thu, 13 Sep 2018 10:10:58 +0200 Subject: [PATCH 071/417] add status column to BeatmapInfo + BeatmapSetInfo --- osu.Game/Beatmaps/BeatmapInfo.cs | 11 +- osu.Game/Beatmaps/BeatmapSetInfo.cs | 6 +- .../20180913080842_AddRankStatus.Designer.cs | 380 ++++++++++++++++++ .../20180913080842_AddRankStatus.cs | 33 ++ .../Migrations/OsuDbContextModelSnapshot.cs | 9 +- 5 files changed, 430 insertions(+), 9 deletions(-) create mode 100644 osu.Game/Migrations/20180913080842_AddRankStatus.Designer.cs create mode 100644 osu.Game/Migrations/20180913080842_AddRankStatus.cs diff --git a/osu.Game/Beatmaps/BeatmapInfo.cs b/osu.Game/Beatmaps/BeatmapInfo.cs index 303a19aab3..5a5229e29f 100644 --- a/osu.Game/Beatmaps/BeatmapInfo.cs +++ b/osu.Game/Beatmaps/BeatmapInfo.cs @@ -27,13 +27,15 @@ namespace osu.Game.Beatmaps [JsonProperty("id")] public int? OnlineBeatmapID { - get { return onlineBeatmapID; } - set { onlineBeatmapID = value > 0 ? value : null; } + get => onlineBeatmapID; + set => onlineBeatmapID = value > 0 ? value : null; } [JsonIgnore] public int BeatmapSetInfoID { get; set; } + public BeatmapSetOnlineStatus Status { get; set; } = BeatmapSetOnlineStatus.None; + [Required] public BeatmapSetInfo BeatmapSet { get; set; } @@ -82,7 +84,7 @@ namespace osu.Game.Beatmaps [JsonIgnore] public string StoredBookmarks { - get { return string.Join(",", Bookmarks); } + get => string.Join(",", Bookmarks); set { if (string.IsNullOrEmpty(value)) @@ -93,8 +95,7 @@ namespace osu.Game.Beatmaps Bookmarks = value.Split(',').Select(v => { - int val; - bool result = int.TryParse(v, out val); + bool result = int.TryParse(v, out int val); return new { result, val }; }).Where(p => p.result).Select(p => p.val).ToArray(); } diff --git a/osu.Game/Beatmaps/BeatmapSetInfo.cs b/osu.Game/Beatmaps/BeatmapSetInfo.cs index ebebe42097..e131be0b70 100644 --- a/osu.Game/Beatmaps/BeatmapSetInfo.cs +++ b/osu.Game/Beatmaps/BeatmapSetInfo.cs @@ -17,9 +17,11 @@ namespace osu.Game.Beatmaps public int? OnlineBeatmapSetID { - get { return onlineBeatmapSetID; } - set { onlineBeatmapSetID = value > 0 ? value : null; } + get => onlineBeatmapSetID; + set => onlineBeatmapSetID = value > 0 ? value : null; } + + public BeatmapSetOnlineStatus Status { get; set; } = BeatmapSetOnlineStatus.None; public BeatmapMetadata Metadata { get; set; } diff --git a/osu.Game/Migrations/20180913080842_AddRankStatus.Designer.cs b/osu.Game/Migrations/20180913080842_AddRankStatus.Designer.cs new file mode 100644 index 0000000000..5ab43da046 --- /dev/null +++ b/osu.Game/Migrations/20180913080842_AddRankStatus.Designer.cs @@ -0,0 +1,380 @@ +// +using System; +using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore.Infrastructure; +using Microsoft.EntityFrameworkCore.Migrations; +using Microsoft.EntityFrameworkCore.Storage.ValueConversion; +using osu.Game.Database; + +namespace osu.Game.Migrations +{ + [DbContext(typeof(OsuDbContext))] + [Migration("20180913080842_AddRankStatus")] + partial class AddRankStatus + { + protected override void BuildTargetModel(ModelBuilder modelBuilder) + { +#pragma warning disable 612, 618 + modelBuilder + .HasAnnotation("ProductVersion", "2.1.2-rtm-30932"); + + modelBuilder.Entity("osu.Game.Beatmaps.BeatmapDifficulty", b => + { + b.Property("ID") + .ValueGeneratedOnAdd(); + + b.Property("ApproachRate"); + + b.Property("CircleSize"); + + b.Property("DrainRate"); + + b.Property("OverallDifficulty"); + + b.Property("SliderMultiplier"); + + b.Property("SliderTickRate"); + + b.HasKey("ID"); + + b.ToTable("BeatmapDifficulty"); + }); + + modelBuilder.Entity("osu.Game.Beatmaps.BeatmapInfo", b => + { + b.Property("ID") + .ValueGeneratedOnAdd(); + + b.Property("AudioLeadIn"); + + b.Property("BaseDifficultyID"); + + b.Property("BeatDivisor"); + + b.Property("BeatmapSetInfoID"); + + b.Property("Countdown"); + + b.Property("DistanceSpacing"); + + b.Property("GridSize"); + + b.Property("Hash"); + + b.Property("Hidden"); + + b.Property("LetterboxInBreaks"); + + b.Property("MD5Hash"); + + b.Property("MetadataID"); + + b.Property("OnlineBeatmapID"); + + b.Property("Path"); + + b.Property("RulesetID"); + + b.Property("SpecialStyle"); + + b.Property("StackLeniency"); + + b.Property("StarDifficulty"); + + b.Property("Status"); + + b.Property("StoredBookmarks"); + + b.Property("TimelineZoom"); + + b.Property("Version"); + + b.Property("WidescreenStoryboard"); + + b.HasKey("ID"); + + b.HasIndex("BaseDifficultyID"); + + b.HasIndex("BeatmapSetInfoID"); + + b.HasIndex("Hash"); + + b.HasIndex("MD5Hash"); + + b.HasIndex("MetadataID"); + + b.HasIndex("OnlineBeatmapID") + .IsUnique(); + + b.HasIndex("RulesetID"); + + b.ToTable("BeatmapInfo"); + }); + + modelBuilder.Entity("osu.Game.Beatmaps.BeatmapMetadata", b => + { + b.Property("ID") + .ValueGeneratedOnAdd(); + + b.Property("Artist"); + + b.Property("ArtistUnicode"); + + b.Property("AudioFile"); + + b.Property("AuthorString") + .HasColumnName("Author"); + + b.Property("BackgroundFile"); + + b.Property("PreviewTime"); + + b.Property("Source"); + + b.Property("Tags"); + + b.Property("Title"); + + b.Property("TitleUnicode"); + + b.HasKey("ID"); + + b.ToTable("BeatmapMetadata"); + }); + + modelBuilder.Entity("osu.Game.Beatmaps.BeatmapSetFileInfo", b => + { + b.Property("ID") + .ValueGeneratedOnAdd(); + + b.Property("BeatmapSetInfoID"); + + b.Property("FileInfoID"); + + b.Property("Filename") + .IsRequired(); + + b.HasKey("ID"); + + b.HasIndex("BeatmapSetInfoID"); + + b.HasIndex("FileInfoID"); + + b.ToTable("BeatmapSetFileInfo"); + }); + + modelBuilder.Entity("osu.Game.Beatmaps.BeatmapSetInfo", b => + { + b.Property("ID") + .ValueGeneratedOnAdd(); + + b.Property("DeletePending"); + + b.Property("Hash"); + + b.Property("MetadataID"); + + b.Property("OnlineBeatmapSetID"); + + b.Property("Protected"); + + b.Property("Status"); + + b.HasKey("ID"); + + b.HasIndex("DeletePending"); + + b.HasIndex("Hash") + .IsUnique(); + + b.HasIndex("MetadataID"); + + b.HasIndex("OnlineBeatmapSetID") + .IsUnique(); + + b.ToTable("BeatmapSetInfo"); + }); + + modelBuilder.Entity("osu.Game.Configuration.DatabasedSetting", b => + { + b.Property("ID") + .ValueGeneratedOnAdd(); + + b.Property("IntKey") + .HasColumnName("Key"); + + b.Property("RulesetID"); + + b.Property("StringValue") + .HasColumnName("Value"); + + b.Property("Variant"); + + b.HasKey("ID"); + + b.HasIndex("RulesetID", "Variant"); + + b.ToTable("Settings"); + }); + + modelBuilder.Entity("osu.Game.Input.Bindings.DatabasedKeyBinding", b => + { + b.Property("ID") + .ValueGeneratedOnAdd(); + + b.Property("IntAction") + .HasColumnName("Action"); + + b.Property("KeysString") + .HasColumnName("Keys"); + + b.Property("RulesetID"); + + b.Property("Variant"); + + b.HasKey("ID"); + + b.HasIndex("IntAction"); + + b.HasIndex("RulesetID", "Variant"); + + b.ToTable("KeyBinding"); + }); + + modelBuilder.Entity("osu.Game.IO.FileInfo", b => + { + b.Property("ID") + .ValueGeneratedOnAdd(); + + b.Property("Hash"); + + b.Property("ReferenceCount"); + + b.HasKey("ID"); + + b.HasIndex("Hash") + .IsUnique(); + + b.HasIndex("ReferenceCount"); + + b.ToTable("FileInfo"); + }); + + modelBuilder.Entity("osu.Game.Rulesets.RulesetInfo", b => + { + b.Property("ID") + .ValueGeneratedOnAdd(); + + b.Property("Available"); + + b.Property("InstantiationInfo"); + + b.Property("Name"); + + b.Property("ShortName"); + + b.HasKey("ID"); + + b.HasIndex("Available"); + + b.HasIndex("ShortName") + .IsUnique(); + + b.ToTable("RulesetInfo"); + }); + + modelBuilder.Entity("osu.Game.Skinning.SkinFileInfo", b => + { + b.Property("ID") + .ValueGeneratedOnAdd(); + + b.Property("FileInfoID"); + + b.Property("Filename") + .IsRequired(); + + b.Property("SkinInfoID"); + + b.HasKey("ID"); + + b.HasIndex("FileInfoID"); + + b.HasIndex("SkinInfoID"); + + b.ToTable("SkinFileInfo"); + }); + + modelBuilder.Entity("osu.Game.Skinning.SkinInfo", b => + { + b.Property("ID") + .ValueGeneratedOnAdd(); + + b.Property("Creator"); + + b.Property("DeletePending"); + + b.Property("Name"); + + b.HasKey("ID"); + + b.ToTable("SkinInfo"); + }); + + modelBuilder.Entity("osu.Game.Beatmaps.BeatmapInfo", b => + { + b.HasOne("osu.Game.Beatmaps.BeatmapDifficulty", "BaseDifficulty") + .WithMany() + .HasForeignKey("BaseDifficultyID") + .OnDelete(DeleteBehavior.Cascade); + + b.HasOne("osu.Game.Beatmaps.BeatmapSetInfo", "BeatmapSet") + .WithMany("Beatmaps") + .HasForeignKey("BeatmapSetInfoID") + .OnDelete(DeleteBehavior.Cascade); + + b.HasOne("osu.Game.Beatmaps.BeatmapMetadata", "Metadata") + .WithMany("Beatmaps") + .HasForeignKey("MetadataID"); + + b.HasOne("osu.Game.Rulesets.RulesetInfo", "Ruleset") + .WithMany() + .HasForeignKey("RulesetID") + .OnDelete(DeleteBehavior.Cascade); + }); + + modelBuilder.Entity("osu.Game.Beatmaps.BeatmapSetFileInfo", b => + { + b.HasOne("osu.Game.Beatmaps.BeatmapSetInfo") + .WithMany("Files") + .HasForeignKey("BeatmapSetInfoID") + .OnDelete(DeleteBehavior.Cascade); + + b.HasOne("osu.Game.IO.FileInfo", "FileInfo") + .WithMany() + .HasForeignKey("FileInfoID") + .OnDelete(DeleteBehavior.Cascade); + }); + + modelBuilder.Entity("osu.Game.Beatmaps.BeatmapSetInfo", b => + { + b.HasOne("osu.Game.Beatmaps.BeatmapMetadata", "Metadata") + .WithMany("BeatmapSets") + .HasForeignKey("MetadataID"); + }); + + modelBuilder.Entity("osu.Game.Skinning.SkinFileInfo", b => + { + b.HasOne("osu.Game.IO.FileInfo", "FileInfo") + .WithMany() + .HasForeignKey("FileInfoID") + .OnDelete(DeleteBehavior.Cascade); + + b.HasOne("osu.Game.Skinning.SkinInfo") + .WithMany("Files") + .HasForeignKey("SkinInfoID") + .OnDelete(DeleteBehavior.Cascade); + }); +#pragma warning restore 612, 618 + } + } +} diff --git a/osu.Game/Migrations/20180913080842_AddRankStatus.cs b/osu.Game/Migrations/20180913080842_AddRankStatus.cs new file mode 100644 index 0000000000..bba4944bb7 --- /dev/null +++ b/osu.Game/Migrations/20180913080842_AddRankStatus.cs @@ -0,0 +1,33 @@ +using Microsoft.EntityFrameworkCore.Migrations; + +namespace osu.Game.Migrations +{ + public partial class AddRankStatus : Migration + { + protected override void Up(MigrationBuilder migrationBuilder) + { + migrationBuilder.AddColumn( + name: "Status", + table: "BeatmapSetInfo", + nullable: false, + defaultValue: -3); // NONE + + migrationBuilder.AddColumn( + name: "Status", + table: "BeatmapInfo", + nullable: false, + defaultValue: -3); // NONE + } + + protected override void Down(MigrationBuilder migrationBuilder) + { + migrationBuilder.DropColumn( + name: "Status", + table: "BeatmapSetInfo"); + + migrationBuilder.DropColumn( + name: "Status", + table: "BeatmapInfo"); + } + } +} diff --git a/osu.Game/Migrations/OsuDbContextModelSnapshot.cs b/osu.Game/Migrations/OsuDbContextModelSnapshot.cs index 6dbeaed62f..fde5c9fd82 100644 --- a/osu.Game/Migrations/OsuDbContextModelSnapshot.cs +++ b/osu.Game/Migrations/OsuDbContextModelSnapshot.cs @@ -1,7 +1,8 @@ // - +using System; using Microsoft.EntityFrameworkCore; using Microsoft.EntityFrameworkCore.Infrastructure; +using Microsoft.EntityFrameworkCore.Storage.ValueConversion; using osu.Game.Database; namespace osu.Game.Migrations @@ -13,7 +14,7 @@ namespace osu.Game.Migrations { #pragma warning disable 612, 618 modelBuilder - .HasAnnotation("ProductVersion", "2.1.1-rtm-30846"); + .HasAnnotation("ProductVersion", "2.1.2-rtm-30932"); modelBuilder.Entity("osu.Game.Beatmaps.BeatmapDifficulty", b => { @@ -78,6 +79,8 @@ namespace osu.Game.Migrations b.Property("StarDifficulty"); + b.Property("Status"); + b.Property("StoredBookmarks"); b.Property("TimelineZoom"); @@ -173,6 +176,8 @@ namespace osu.Game.Migrations b.Property("Protected"); + b.Property("Status"); + b.HasKey("ID"); b.HasIndex("DeletePending"); From 5414ce9932887b082b37f5e663d4b7e3653a8de7 Mon Sep 17 00:00:00 2001 From: Unknown Date: Thu, 13 Sep 2018 10:18:20 +0200 Subject: [PATCH 072/417] add StatusPill to BeatmapInfoWedge and DrawabelCarouselBeatmapSet --- osu.Game/Screens/Select/BeatmapInfoWedge.cs | 19 ++++++++++++++++- .../Carousel/DrawableCarouselBeatmapSet.cs | 21 ++++++++++++++++--- 2 files changed, 36 insertions(+), 4 deletions(-) diff --git a/osu.Game/Screens/Select/BeatmapInfoWedge.cs b/osu.Game/Screens/Select/BeatmapInfoWedge.cs index d26702fcf9..febd136e25 100644 --- a/osu.Game/Screens/Select/BeatmapInfoWedge.cs +++ b/osu.Game/Screens/Select/BeatmapInfoWedge.cs @@ -127,6 +127,7 @@ namespace osu.Game.Screens.Select public OsuSpriteText VersionLabel { get; private set; } public OsuSpriteText TitleLabel { get; private set; } public OsuSpriteText ArtistLabel { get; private set; } + public BeatmapSetOnlineStatusPill StatusPill { get; private set; } public FillFlowContainer MapperContainer { get; private set; } public FillFlowContainer InfoLabelContainer { get; private set; } @@ -190,7 +191,7 @@ namespace osu.Game.Screens.Select }, new FillFlowContainer { - Name = "Top-aligned metadata", + Name = "Topleft-aligned metadata", Anchor = Anchor.TopLeft, Origin = Anchor.TopLeft, Direction = FillDirection.Vertical, @@ -207,6 +208,22 @@ namespace osu.Game.Screens.Select } }, new FillFlowContainer + { + Name = "Topright-aligned metadata", + Anchor = Anchor.TopRight, + Origin = Anchor.TopRight, + Direction = FillDirection.Vertical, + Margin = new MarginPadding { Top = 14, Left = 10, Right = 18, Bottom = 20 }, + AutoSizeAxes = Axes.Both, + Children = new Drawable[] + { + StatusPill = new BeatmapSetOnlineStatusPill(11, new MarginPadding { Horizontal = 8, Vertical = 2 }) + { + Status = beatmapInfo.Status, + } + } + }, + new FillFlowContainer { Name = "Centre-aligned metadata", Anchor = Anchor.CentreLeft, diff --git a/osu.Game/Screens/Select/Carousel/DrawableCarouselBeatmapSet.cs b/osu.Game/Screens/Select/Carousel/DrawableCarouselBeatmapSet.cs index 23f338b530..52d34a935f 100644 --- a/osu.Game/Screens/Select/Carousel/DrawableCarouselBeatmapSet.cs +++ b/osu.Game/Screens/Select/Carousel/DrawableCarouselBeatmapSet.cs @@ -78,11 +78,26 @@ namespace osu.Game.Screens.Select.Carousel TextSize = 17, Shadow = true, }, - new FillFlowContainer + new FillFlowContainer { - Margin = new MarginPadding { Top = 5 }, + Direction = FillDirection.Horizontal, AutoSizeAxes = Axes.Both, - Children = ((CarouselBeatmapSet)Item).Beatmaps.Select(b => new FilterableDifficultyIcon(b)).ToList() + Margin = new MarginPadding { Top = 5 }, + Children = new Drawable[] + { + new BeatmapSetOnlineStatusPill(11, new MarginPadding { Horizontal = 8, Vertical = 2 }) + { + Origin = Anchor.CentreLeft, + Anchor = Anchor.CentreLeft, + Margin = new MarginPadding{ Right = 5 }, + Status = beatmapSet.Status + }, + new FillFlowContainer + { + AutoSizeAxes = Axes.Both, + Children = ((CarouselBeatmapSet)Item).Beatmaps.Select(b => new FilterableDifficultyIcon(b)).ToList() + }, + } } } } From 638a2e5ba84490663b576d9ed31980495fcbf692 Mon Sep 17 00:00:00 2001 From: Unknown Date: Thu, 13 Sep 2018 11:57:33 +0200 Subject: [PATCH 073/417] populate Status for Beatmap + BeatmapSet also added Status to APIBeatmap + APIBeatmapSet --- osu.Game/Beatmaps/BeatmapInfo.cs | 2 +- osu.Game/Beatmaps/BeatmapManager.cs | 17 +++++++++++------ osu.Game/Beatmaps/BeatmapSetInfo.cs | 2 +- .../Online/API/Requests/Responses/APIBeatmap.cs | 10 +++++++++- .../API/Requests/Responses/APIBeatmapSet.cs | 15 ++++++++------- 5 files changed, 30 insertions(+), 16 deletions(-) diff --git a/osu.Game/Beatmaps/BeatmapInfo.cs b/osu.Game/Beatmaps/BeatmapInfo.cs index 5a5229e29f..1aa4818393 100644 --- a/osu.Game/Beatmaps/BeatmapInfo.cs +++ b/osu.Game/Beatmaps/BeatmapInfo.cs @@ -35,7 +35,7 @@ namespace osu.Game.Beatmaps public int BeatmapSetInfoID { get; set; } public BeatmapSetOnlineStatus Status { get; set; } = BeatmapSetOnlineStatus.None; - + [Required] public BeatmapSetInfo BeatmapSet { get; set; } diff --git a/osu.Game/Beatmaps/BeatmapManager.cs b/osu.Game/Beatmaps/BeatmapManager.cs index 21df9a6c68..aa653d88f9 100644 --- a/osu.Game/Beatmaps/BeatmapManager.cs +++ b/osu.Game/Beatmaps/BeatmapManager.cs @@ -1,4 +1,4 @@ -// Copyright (c) 2007-2018 ppy Pty Ltd . +// Copyright (c) 2007-2018 ppy Pty Ltd . // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE using System; @@ -104,7 +104,7 @@ namespace osu.Game.Beatmaps validateOnlineIds(beatmapSet.Beatmaps); foreach (BeatmapInfo b in beatmapSet.Beatmaps) - fetchAndPopulateOnlineIDs(b, beatmapSet.Beatmaps); + fetchAndPopulateOnlineValues(b, beatmapSet.Beatmaps); // check if a set already exists with the same online id, delete if it does. if (beatmapSet.OnlineBeatmapSetID != null) @@ -388,21 +388,22 @@ namespace osu.Game.Beatmaps } /// - /// Query the API to populate mising OnlineBeatmapID / OnlineBeatmapSetID properties. + /// Query the API to populate missing values like OnlineBeatmapID / OnlineBeatmapSetID or (Rank-)Status. /// /// The beatmap to populate. /// The other beatmaps contained within this set. /// Whether to re-query if the provided beatmap already has populated values. /// True if population was successful. - private bool fetchAndPopulateOnlineIDs(BeatmapInfo beatmap, IEnumerable otherBeatmaps, bool force = false) + private bool fetchAndPopulateOnlineValues(BeatmapInfo beatmap, IEnumerable otherBeatmaps, bool force = false) { if (api?.State != APIState.Online) return false; - if (!force && beatmap.OnlineBeatmapID != null && beatmap.BeatmapSet.OnlineBeatmapSetID != null) + if (!force && beatmap.OnlineBeatmapID != null && beatmap.BeatmapSet.OnlineBeatmapSetID != null + && beatmap.Status != BeatmapSetOnlineStatus.None && beatmap.BeatmapSet.Status != BeatmapSetOnlineStatus.None) return true; - Logger.Log("Attempting online lookup for IDs...", LoggingTarget.Database); + Logger.Log("Attempting online lookup for the missing values...", LoggingTarget.Database); try { @@ -414,6 +415,9 @@ namespace osu.Game.Beatmaps Logger.Log($"Successfully mapped to {res.OnlineBeatmapSetID} / {res.OnlineBeatmapID}.", LoggingTarget.Database); + beatmap.Status = res.Status; + beatmap.BeatmapSet.Status = res.BeatmapSet.Status; + if (otherBeatmaps.Any(b => b.OnlineBeatmapID == res.OnlineBeatmapID)) { Logger.Log("Another beatmap in the same set already mapped to this ID. We'll skip adding it this time.", LoggingTarget.Database); @@ -422,6 +426,7 @@ namespace osu.Game.Beatmaps beatmap.BeatmapSet.OnlineBeatmapSetID = res.OnlineBeatmapSetID; beatmap.OnlineBeatmapID = res.OnlineBeatmapID; + return true; } catch (Exception e) diff --git a/osu.Game/Beatmaps/BeatmapSetInfo.cs b/osu.Game/Beatmaps/BeatmapSetInfo.cs index e131be0b70..7a7d010a31 100644 --- a/osu.Game/Beatmaps/BeatmapSetInfo.cs +++ b/osu.Game/Beatmaps/BeatmapSetInfo.cs @@ -20,7 +20,7 @@ namespace osu.Game.Beatmaps get => onlineBeatmapSetID; set => onlineBeatmapSetID = value > 0 ? value : null; } - + public BeatmapSetOnlineStatus Status { get; set; } = BeatmapSetOnlineStatus.None; public BeatmapMetadata Metadata { get; set; } diff --git a/osu.Game/Online/API/Requests/Responses/APIBeatmap.cs b/osu.Game/Online/API/Requests/Responses/APIBeatmap.cs index 99e4392374..193ccf1f6b 100644 --- a/osu.Game/Online/API/Requests/Responses/APIBeatmap.cs +++ b/osu.Game/Online/API/Requests/Responses/APIBeatmap.cs @@ -15,6 +15,12 @@ namespace osu.Game.Online.API.Requests.Responses [JsonProperty(@"beatmapset_id")] public int OnlineBeatmapSetID { get; set; } + [JsonProperty(@"status")] + public BeatmapSetOnlineStatus Status { get; set; } + + [JsonProperty(@"beatmapset")] + public APIBeatmapSet BeatmapSet { get; set; } + [JsonProperty(@"playcount")] private int playCount { get; set; } @@ -59,11 +65,13 @@ namespace osu.Game.Online.API.Requests.Responses Ruleset = rulesets.GetRuleset(ruleset), StarDifficulty = starDifficulty, OnlineBeatmapID = OnlineBeatmapID, + Version = version, + Status = Status, BeatmapSet = new BeatmapSetInfo { OnlineBeatmapSetID = OnlineBeatmapSetID, + Status = BeatmapSet?.Status ?? BeatmapSetOnlineStatus.None }, - Version = version, BaseDifficulty = new BeatmapDifficulty { DrainRate = drainRate, diff --git a/osu.Game/Online/API/Requests/Responses/APIBeatmapSet.cs b/osu.Game/Online/API/Requests/Responses/APIBeatmapSet.cs index bbaaa0c756..8446285070 100644 --- a/osu.Game/Online/API/Requests/Responses/APIBeatmapSet.cs +++ b/osu.Game/Online/API/Requests/Responses/APIBeatmapSet.cs @@ -20,10 +20,13 @@ namespace osu.Game.Online.API.Requests.Responses [JsonProperty(@"id")] public int? OnlineBeatmapSetID { - get { return onlineBeatmapSetID; } - set { onlineBeatmapSetID = value > 0 ? value : null; } + get => onlineBeatmapSetID; + set => onlineBeatmapSetID = value > 0 ? value : null; } + [JsonProperty(@"status")] + public BeatmapSetOnlineStatus Status { get; set; } + [JsonProperty(@"preview_url")] private string preview { get; set; } @@ -42,9 +45,6 @@ namespace osu.Game.Online.API.Requests.Responses [JsonProperty(@"storyboard")] private bool hasStoryboard { get; set; } - [JsonProperty(@"status")] - private BeatmapSetOnlineStatus status { get; set; } - [JsonProperty(@"submitted_date")] private DateTimeOffset submitted { get; set; } @@ -57,7 +57,7 @@ namespace osu.Game.Online.API.Requests.Responses [JsonProperty(@"user_id")] private long creatorId { - set { Author.Id = value; } + set => Author.Id = value; } [JsonProperty(@"beatmaps")] @@ -69,6 +69,7 @@ namespace osu.Game.Online.API.Requests.Responses { OnlineBeatmapSetID = OnlineBeatmapSetID, Metadata = this, + Status = Status, OnlineInfo = new BeatmapSetOnlineInfo { Covers = covers, @@ -76,7 +77,7 @@ namespace osu.Game.Online.API.Requests.Responses PlayCount = playCount, FavouriteCount = favouriteCount, BPM = bpm, - Status = status, + Status = Status, HasVideo = hasVideo, HasStoryboard = hasStoryboard, Submitted = submitted, From 04853b8c8366a20f605477cbd5cd60f1f8b46ac8 Mon Sep 17 00:00:00 2001 From: Unknown Date: Thu, 13 Sep 2018 13:49:57 +0200 Subject: [PATCH 074/417] don't show StatusPill without a difficulty --- osu.Game/Screens/Select/BeatmapInfoWedge.cs | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/osu.Game/Screens/Select/BeatmapInfoWedge.cs b/osu.Game/Screens/Select/BeatmapInfoWedge.cs index febd136e25..ae5134c0da 100644 --- a/osu.Game/Screens/Select/BeatmapInfoWedge.cs +++ b/osu.Game/Screens/Select/BeatmapInfoWedge.cs @@ -261,8 +261,11 @@ namespace osu.Game.Screens.Select } } }; - artistBinding.ValueChanged += value => setMetadata(metadata.Source); - artistBinding.TriggerChange(); + artistBinding.BindValueChanged(value => setMetadata(metadata.Source), true); + + // no difficulty means it can't have a status to show + if (beatmapInfo.Version == null) + StatusPill.Hide(); } private void setMetadata(string source) From f280e910bbbe0fe7a16c090a78a6940d0f48798e Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Fri, 14 Sep 2018 04:20:11 +0900 Subject: [PATCH 075/417] Bump squirrel version --- osu.Desktop/osu.Desktop.csproj | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu.Desktop/osu.Desktop.csproj b/osu.Desktop/osu.Desktop.csproj index e2fc4d14f6..067a78132a 100644 --- a/osu.Desktop/osu.Desktop.csproj +++ b/osu.Desktop/osu.Desktop.csproj @@ -27,7 +27,7 @@ - + From 1c2cc3837a59d6023fa086db90ea1ccd50e9fdd6 Mon Sep 17 00:00:00 2001 From: Hanamuke Date: Thu, 13 Sep 2018 21:52:15 +0200 Subject: [PATCH 076/417] Compute combo for nested Objects. Display fruit depending on Combo for osu!catch --- osu.Game.Rulesets.Catch/Objects/CatchHitObject.cs | 2 +- osu.Game/Beatmaps/BeatmapProcessor.cs | 9 +++++++++ 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/osu.Game.Rulesets.Catch/Objects/CatchHitObject.cs b/osu.Game.Rulesets.Catch/Objects/CatchHitObject.cs index 621fc100c2..2346a55bbe 100644 --- a/osu.Game.Rulesets.Catch/Objects/CatchHitObject.cs +++ b/osu.Game.Rulesets.Catch/Objects/CatchHitObject.cs @@ -16,7 +16,7 @@ namespace osu.Game.Rulesets.Catch.Objects public int IndexInBeatmap { get; set; } - public virtual FruitVisualRepresentation VisualRepresentation => (FruitVisualRepresentation)(IndexInBeatmap % 4); + public virtual FruitVisualRepresentation VisualRepresentation => (FruitVisualRepresentation)(ComboIndex % 4); public virtual bool NewCombo { get; set; } diff --git a/osu.Game/Beatmaps/BeatmapProcessor.cs b/osu.Game/Beatmaps/BeatmapProcessor.cs index 9d7cd673dc..84bf6ada18 100644 --- a/osu.Game/Beatmaps/BeatmapProcessor.cs +++ b/osu.Game/Beatmaps/BeatmapProcessor.cs @@ -44,6 +44,15 @@ namespace osu.Game.Beatmaps public virtual void PostProcess() { + foreach (var hitObject in Beatmap.HitObjects) + { + var objectComboInfo = (IHasComboInformation)hitObject; + foreach (var obj in hitObject.NestedHitObjects.OfType()) + { + obj.IndexInCurrentCombo = objectComboInfo.IndexInCurrentCombo; + obj.ComboIndex = objectComboInfo.ComboIndex; + } + } } } } From b1f6828a1a29e7ccd7004fe15c039c8153cc29a3 Mon Sep 17 00:00:00 2001 From: MaxOhn Date: Wed, 5 Sep 2018 20:30:03 +0200 Subject: [PATCH 077/417] Added OsuModWiggle class and adjusted OsuRuleset.cs --- osu.Game.Rulesets.Osu/Mods/OsuModWiggle.cs | 82 ++++++++++++++++++++++ osu.Game.Rulesets.Osu/OsuRuleset.cs | 5 ++ 2 files changed, 87 insertions(+) create mode 100644 osu.Game.Rulesets.Osu/Mods/OsuModWiggle.cs diff --git a/osu.Game.Rulesets.Osu/Mods/OsuModWiggle.cs b/osu.Game.Rulesets.Osu/Mods/OsuModWiggle.cs new file mode 100644 index 0000000000..5e6cb22ec3 --- /dev/null +++ b/osu.Game.Rulesets.Osu/Mods/OsuModWiggle.cs @@ -0,0 +1,82 @@ +// Copyright (c) 2007-2018 ppy Pty Ltd . +// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE + +using System; +using System.Collections.Generic; +using osu.Framework.Graphics; +using osu.Game.Graphics; +using osu.Game.Rulesets.Mods; +using osu.Game.Rulesets.Objects.Drawables; +using osu.Game.Rulesets.Osu.Objects; +using OpenTK; + +namespace osu.Game.Rulesets.Osu.Mods +{ + internal class OsuModWiggle : Mod, IApplicableToDrawableHitObjects + { + public override string Name => "Wiggle"; + public override string ShortenedName => "WG"; + public override FontAwesome Icon => FontAwesome.fa_arrows_alt; + public override ModType Type => ModType.Fun; + public override string Description => "They just won't stay still..."; + public override double ScoreMultiplier => 1; + + private readonly int wiggle_delay = 90; // (ms) Higher = fewer wiggles + private readonly int wiggle_strength = 10; // Higher = stronger wiggles + + public void ApplyToDrawableHitObjects(IEnumerable drawables) + { + foreach(var drawable in drawables) + drawable.ApplyCustomUpdateState += drawableOnApplyCustomUpdateState; + } + + private void drawableOnApplyCustomUpdateState(DrawableHitObject drawable, ArmedState state) + { + var hitObject = (OsuHitObject)drawable.HitObject; + Vector2 origPos = drawable.Position; + + Random distRand = new Random(hitObject.ComboOffset); + Random angleRand = new Random(hitObject.IndexInCurrentCombo); + + // Wiggle all objects during TimePreempt + int amountWiggles = (int)hitObject.TimePreempt / wiggle_delay; + + for (int i = 0; i < amountWiggles; i++) + { + using (drawable.BeginAbsoluteSequence(hitObject.StartTime - hitObject.TimePreempt + i * wiggle_delay, true)) + { + float nextAngle = (float)(angleRand.NextDouble() * 2 * Math.PI); + float nextDist = (float)(distRand.NextDouble() * wiggle_strength); + Vector2 wiggledPos = new Vector2((float)(nextDist * Math.Cos(nextAngle) + origPos.X), (float)(nextDist * Math.Sin(nextAngle) + origPos.Y)); + drawable.MoveTo(wiggledPos, wiggle_delay); + } + } + + // Keep wiggling sliders and spinners for their duration + double objDuration; + if (hitObject is Slider slider) + { + objDuration = slider.Duration; + } + else if (hitObject is Spinner spinner) + { + objDuration = spinner.Duration; + } + else + return; + + amountWiggles = (int)(objDuration / wiggle_delay); + + for (int i = 0; i < amountWiggles; i++) + { + using (drawable.BeginAbsoluteSequence(hitObject.StartTime + i * wiggle_delay, true)) + { + float nextAngle = (float)(angleRand.NextDouble() * 2 * Math.PI); + float nextDist = (float)(distRand.NextDouble() * wiggle_strength); + Vector2 wiggledPos = new Vector2((float)(nextDist * Math.Cos(nextAngle) + origPos.X), (float)(nextDist * Math.Sin(nextAngle) + origPos.Y)); + drawable.MoveTo(wiggledPos, wiggle_delay); + } + } + } + } +} diff --git a/osu.Game.Rulesets.Osu/OsuRuleset.cs b/osu.Game.Rulesets.Osu/OsuRuleset.cs index fa6e9a018a..a16f6494e7 100644 --- a/osu.Game.Rulesets.Osu/OsuRuleset.cs +++ b/osu.Game.Rulesets.Osu/OsuRuleset.cs @@ -117,6 +117,11 @@ namespace osu.Game.Rulesets.Osu new OsuModRelax(), new OsuModAutopilot(), }; + case ModType.Fun: + return new Mod[] + { + new OsuModWiggle(), + }; default: return new Mod[] { }; } From 9d94aa4e6260cac120abb67f15c43ba6be3367ff Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Fri, 14 Sep 2018 17:38:47 +0900 Subject: [PATCH 078/417] Fix formatting and constants --- osu.Game.Rulesets.Osu/Mods/OsuModWiggle.cs | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/osu.Game.Rulesets.Osu/Mods/OsuModWiggle.cs b/osu.Game.Rulesets.Osu/Mods/OsuModWiggle.cs index 5e6cb22ec3..d03908fef1 100644 --- a/osu.Game.Rulesets.Osu/Mods/OsuModWiggle.cs +++ b/osu.Game.Rulesets.Osu/Mods/OsuModWiggle.cs @@ -21,12 +21,12 @@ namespace osu.Game.Rulesets.Osu.Mods public override string Description => "They just won't stay still..."; public override double ScoreMultiplier => 1; - private readonly int wiggle_delay = 90; // (ms) Higher = fewer wiggles - private readonly int wiggle_strength = 10; // Higher = stronger wiggles - + private const int wiggle_delay = 90; // (ms) Higher = fewer wiggles + private const int wiggle_strength = 10; // Higher = stronger wiggles + public void ApplyToDrawableHitObjects(IEnumerable drawables) { - foreach(var drawable in drawables) + foreach (var drawable in drawables) drawable.ApplyCustomUpdateState += drawableOnApplyCustomUpdateState; } @@ -34,7 +34,7 @@ namespace osu.Game.Rulesets.Osu.Mods { var hitObject = (OsuHitObject)drawable.HitObject; Vector2 origPos = drawable.Position; - + Random distRand = new Random(hitObject.ComboOffset); Random angleRand = new Random(hitObject.IndexInCurrentCombo); From 00daaef27a8885284372fcbd738df89b78454d76 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Fri, 14 Sep 2018 17:57:27 +0900 Subject: [PATCH 079/417] Use a slightly more suiting icon --- osu.Game.Rulesets.Osu/Mods/OsuModWiggle.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu.Game.Rulesets.Osu/Mods/OsuModWiggle.cs b/osu.Game.Rulesets.Osu/Mods/OsuModWiggle.cs index d03908fef1..46ccfc5a35 100644 --- a/osu.Game.Rulesets.Osu/Mods/OsuModWiggle.cs +++ b/osu.Game.Rulesets.Osu/Mods/OsuModWiggle.cs @@ -16,7 +16,7 @@ namespace osu.Game.Rulesets.Osu.Mods { public override string Name => "Wiggle"; public override string ShortenedName => "WG"; - public override FontAwesome Icon => FontAwesome.fa_arrows_alt; + public override FontAwesome Icon => FontAwesome.fa_certificate; public override ModType Type => ModType.Fun; public override string Description => "They just won't stay still..."; public override double ScoreMultiplier => 1; From ef31698f5653a82219a5ad3f9d29e86da362caaf Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Fri, 14 Sep 2018 18:18:40 +0900 Subject: [PATCH 080/417] Further code tidying --- osu.Game.Rulesets.Osu/Mods/OsuModWiggle.cs | 55 ++++++++-------------- 1 file changed, 20 insertions(+), 35 deletions(-) diff --git a/osu.Game.Rulesets.Osu/Mods/OsuModWiggle.cs b/osu.Game.Rulesets.Osu/Mods/OsuModWiggle.cs index 46ccfc5a35..206d7e649f 100644 --- a/osu.Game.Rulesets.Osu/Mods/OsuModWiggle.cs +++ b/osu.Game.Rulesets.Osu/Mods/OsuModWiggle.cs @@ -7,6 +7,7 @@ using osu.Framework.Graphics; using osu.Game.Graphics; using osu.Game.Rulesets.Mods; using osu.Game.Rulesets.Objects.Drawables; +using osu.Game.Rulesets.Objects.Types; using osu.Game.Rulesets.Osu.Objects; using OpenTK; @@ -21,7 +22,7 @@ namespace osu.Game.Rulesets.Osu.Mods public override string Description => "They just won't stay still..."; public override double ScoreMultiplier => 1; - private const int wiggle_delay = 90; // (ms) Higher = fewer wiggles + private const int wiggle_duration = 90; // (ms) Higher = fewer wiggles private const int wiggle_strength = 10; // Higher = stronger wiggles public void ApplyToDrawableHitObjects(IEnumerable drawables) @@ -32,51 +33,35 @@ namespace osu.Game.Rulesets.Osu.Mods private void drawableOnApplyCustomUpdateState(DrawableHitObject drawable, ArmedState state) { - var hitObject = (OsuHitObject)drawable.HitObject; - Vector2 origPos = drawable.Position; + var osuObject = (OsuHitObject)drawable.HitObject; + Vector2 origin = drawable.Position; - Random distRand = new Random(hitObject.ComboOffset); - Random angleRand = new Random(hitObject.IndexInCurrentCombo); + Random distRand = new Random(osuObject.ComboOffset); + Random angleRand = new Random(osuObject.IndexInCurrentCombo); // Wiggle all objects during TimePreempt - int amountWiggles = (int)hitObject.TimePreempt / wiggle_delay; + int amountWiggles = (int)osuObject.TimePreempt / wiggle_duration; + + void wiggle() + { + float nextAngle = (float)(angleRand.NextDouble() * 2 * Math.PI); + float nextDist = (float)(distRand.NextDouble() * wiggle_strength); + drawable.MoveTo(new Vector2((float)(nextDist * Math.Cos(nextAngle) + origin.X), (float)(nextDist * Math.Sin(nextAngle) + origin.Y)), wiggle_duration); + } for (int i = 0; i < amountWiggles; i++) - { - using (drawable.BeginAbsoluteSequence(hitObject.StartTime - hitObject.TimePreempt + i * wiggle_delay, true)) - { - float nextAngle = (float)(angleRand.NextDouble() * 2 * Math.PI); - float nextDist = (float)(distRand.NextDouble() * wiggle_strength); - Vector2 wiggledPos = new Vector2((float)(nextDist * Math.Cos(nextAngle) + origPos.X), (float)(nextDist * Math.Sin(nextAngle) + origPos.Y)); - drawable.MoveTo(wiggledPos, wiggle_delay); - } - } + using (drawable.BeginAbsoluteSequence(osuObject.StartTime - osuObject.TimePreempt + i * wiggle_duration, true)) + wiggle(); // Keep wiggling sliders and spinners for their duration - double objDuration; - if (hitObject is Slider slider) - { - objDuration = slider.Duration; - } - else if (hitObject is Spinner spinner) - { - objDuration = spinner.Duration; - } - else + if (!(osuObject is IHasEndTime endTime)) return; - amountWiggles = (int)(objDuration / wiggle_delay); + amountWiggles = (int)(endTime.Duration / wiggle_duration); for (int i = 0; i < amountWiggles; i++) - { - using (drawable.BeginAbsoluteSequence(hitObject.StartTime + i * wiggle_delay, true)) - { - float nextAngle = (float)(angleRand.NextDouble() * 2 * Math.PI); - float nextDist = (float)(distRand.NextDouble() * wiggle_strength); - Vector2 wiggledPos = new Vector2((float)(nextDist * Math.Cos(nextAngle) + origPos.X), (float)(nextDist * Math.Sin(nextAngle) + origPos.Y)); - drawable.MoveTo(wiggledPos, wiggle_delay); - } - } + using (drawable.BeginAbsoluteSequence(osuObject.StartTime + i * wiggle_duration, true)) + wiggle(); } } } From ec6185cd3196776c2eacc120ebcb50e937b175db Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Fri, 14 Sep 2018 18:20:19 +0900 Subject: [PATCH 081/417] Reduce random allocations --- osu.Game.Rulesets.Osu/Mods/OsuModWiggle.cs | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/osu.Game.Rulesets.Osu/Mods/OsuModWiggle.cs b/osu.Game.Rulesets.Osu/Mods/OsuModWiggle.cs index 206d7e649f..5b69247451 100644 --- a/osu.Game.Rulesets.Osu/Mods/OsuModWiggle.cs +++ b/osu.Game.Rulesets.Osu/Mods/OsuModWiggle.cs @@ -36,16 +36,15 @@ namespace osu.Game.Rulesets.Osu.Mods var osuObject = (OsuHitObject)drawable.HitObject; Vector2 origin = drawable.Position; - Random distRand = new Random(osuObject.ComboOffset); - Random angleRand = new Random(osuObject.IndexInCurrentCombo); + Random objRand = new Random((int)osuObject.StartTime); // Wiggle all objects during TimePreempt int amountWiggles = (int)osuObject.TimePreempt / wiggle_duration; void wiggle() { - float nextAngle = (float)(angleRand.NextDouble() * 2 * Math.PI); - float nextDist = (float)(distRand.NextDouble() * wiggle_strength); + float nextAngle = (float)(objRand.NextDouble() * 2 * Math.PI); + float nextDist = (float)(objRand.NextDouble() * wiggle_strength); drawable.MoveTo(new Vector2((float)(nextDist * Math.Cos(nextAngle) + origin.X), (float)(nextDist * Math.Sin(nextAngle) + origin.Y)), wiggle_duration); } From 9f546bd48447d7d3b65f43088391b8ba318e37f5 Mon Sep 17 00:00:00 2001 From: LastExceed Date: Fri, 14 Sep 2018 13:50:35 +0200 Subject: [PATCH 082/417] close tab on Mclick --- osu.Game/Overlays/Chat/ChatTabControl.cs | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/osu.Game/Overlays/Chat/ChatTabControl.cs b/osu.Game/Overlays/Chat/ChatTabControl.cs index 2e3c9f9c5f..6764b5e77b 100644 --- a/osu.Game/Overlays/Chat/ChatTabControl.cs +++ b/osu.Game/Overlays/Chat/ChatTabControl.cs @@ -13,6 +13,7 @@ using osu.Game.Graphics.Sprites; using osu.Game.Graphics.UserInterface; using osu.Game.Online.Chat; using OpenTK; +using OpenTK.Input; using OpenTK.Graphics; using osu.Framework.Configuration; using System; @@ -143,6 +144,13 @@ namespace osu.Game.Overlays.Chat textBold.FadeOut(transition_length, Easing.OutQuint); } + protected override bool OnMouseUp(InputState state, MouseUpEventArgs args) + { + if (args.Button == MouseButton.Middle) + closeButton.Action(); + return base.OnMouseUp(state, args); + } + protected override bool OnHover(InputState state) { if (IsRemovable) From 347cb0a1b5bdaf64f90a4dfc699a1dd2b30d5856 Mon Sep 17 00:00:00 2001 From: Hanamuke Date: Fri, 14 Sep 2018 19:41:29 +0200 Subject: [PATCH 083/417] Check for type conversion, mais the update recursive --- osu.Game/Beatmaps/BeatmapProcessor.cs | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) diff --git a/osu.Game/Beatmaps/BeatmapProcessor.cs b/osu.Game/Beatmaps/BeatmapProcessor.cs index 84bf6ada18..1a767942eb 100644 --- a/osu.Game/Beatmaps/BeatmapProcessor.cs +++ b/osu.Game/Beatmaps/BeatmapProcessor.cs @@ -44,13 +44,24 @@ namespace osu.Game.Beatmaps public virtual void PostProcess() { + void UpdateNestedCombo(Rulesets.Objects.HitObject obj, int comboIndex, int indexInCurrentCombo) + { + if (obj is IHasComboInformation) + { + var objectComboInfo = (IHasComboInformation)obj; + objectComboInfo.ComboIndex = comboIndex; + objectComboInfo.IndexInCurrentCombo = indexInCurrentCombo; + foreach (var nestedObjet in obj.NestedHitObjects) + UpdateNestedCombo(nestedObjet, comboIndex, indexInCurrentCombo); + } + } foreach (var hitObject in Beatmap.HitObjects) { - var objectComboInfo = (IHasComboInformation)hitObject; - foreach (var obj in hitObject.NestedHitObjects.OfType()) + if (hitObject is IHasComboInformation) { - obj.IndexInCurrentCombo = objectComboInfo.IndexInCurrentCombo; - obj.ComboIndex = objectComboInfo.ComboIndex; + var objectComboInfo = (IHasComboInformation)hitObject; + foreach (var nested in hitObject.NestedHitObjects) + UpdateNestedCombo(nested, objectComboInfo.ComboIndex, objectComboInfo.IndexInCurrentCombo); } } } From c8d3776c79767b24b6772ee87014f5bd67008c8f Mon Sep 17 00:00:00 2001 From: Hanamuke Date: Fri, 14 Sep 2018 19:46:04 +0200 Subject: [PATCH 084/417] Remove uneeded brackets --- osu.Game/Beatmaps/BeatmapProcessor.cs | 2 -- 1 file changed, 2 deletions(-) diff --git a/osu.Game/Beatmaps/BeatmapProcessor.cs b/osu.Game/Beatmaps/BeatmapProcessor.cs index 1a767942eb..35420efa8e 100644 --- a/osu.Game/Beatmaps/BeatmapProcessor.cs +++ b/osu.Game/Beatmaps/BeatmapProcessor.cs @@ -56,14 +56,12 @@ namespace osu.Game.Beatmaps } } foreach (var hitObject in Beatmap.HitObjects) - { if (hitObject is IHasComboInformation) { var objectComboInfo = (IHasComboInformation)hitObject; foreach (var nested in hitObject.NestedHitObjects) UpdateNestedCombo(nested, objectComboInfo.ComboIndex, objectComboInfo.IndexInCurrentCombo); } - } } } } From 3e7006ec1fe25a650b8ef33107d91b71dd3a4f7e Mon Sep 17 00:00:00 2001 From: Hanamuke Date: Fri, 14 Sep 2018 19:52:32 +0200 Subject: [PATCH 085/417] Fix fonction name --- osu.Game/Beatmaps/BeatmapProcessor.cs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/osu.Game/Beatmaps/BeatmapProcessor.cs b/osu.Game/Beatmaps/BeatmapProcessor.cs index 35420efa8e..7007c41402 100644 --- a/osu.Game/Beatmaps/BeatmapProcessor.cs +++ b/osu.Game/Beatmaps/BeatmapProcessor.cs @@ -44,7 +44,7 @@ namespace osu.Game.Beatmaps public virtual void PostProcess() { - void UpdateNestedCombo(Rulesets.Objects.HitObject obj, int comboIndex, int indexInCurrentCombo) + void updateNestedCombo(Rulesets.Objects.HitObject obj, int comboIndex, int indexInCurrentCombo) { if (obj is IHasComboInformation) { @@ -52,7 +52,7 @@ namespace osu.Game.Beatmaps objectComboInfo.ComboIndex = comboIndex; objectComboInfo.IndexInCurrentCombo = indexInCurrentCombo; foreach (var nestedObjet in obj.NestedHitObjects) - UpdateNestedCombo(nestedObjet, comboIndex, indexInCurrentCombo); + updateNestedCombo(nestedObjet, comboIndex, indexInCurrentCombo); } } foreach (var hitObject in Beatmap.HitObjects) @@ -60,7 +60,7 @@ namespace osu.Game.Beatmaps { var objectComboInfo = (IHasComboInformation)hitObject; foreach (var nested in hitObject.NestedHitObjects) - UpdateNestedCombo(nested, objectComboInfo.ComboIndex, objectComboInfo.IndexInCurrentCombo); + updateNestedCombo(nested, objectComboInfo.ComboIndex, objectComboInfo.IndexInCurrentCombo); } } } From dd7f667fe3622e77bf3661b8210de806eb9ee2f2 Mon Sep 17 00:00:00 2001 From: Hanamuke Date: Sat, 15 Sep 2018 00:18:42 +0200 Subject: [PATCH 086/417] Disable scrolling speed control for osu!catch --- osu.Game.Rulesets.Catch/UI/CatchPlayfield.cs | 1 + 1 file changed, 1 insertion(+) diff --git a/osu.Game.Rulesets.Catch/UI/CatchPlayfield.cs b/osu.Game.Rulesets.Catch/UI/CatchPlayfield.cs index d49be69856..d16f5cbb07 100644 --- a/osu.Game.Rulesets.Catch/UI/CatchPlayfield.cs +++ b/osu.Game.Rulesets.Catch/UI/CatchPlayfield.cs @@ -22,6 +22,7 @@ namespace osu.Game.Rulesets.Catch.UI private readonly CatcherArea catcherArea; + protected override bool UserScrollSpeedAdjustment => false; public CatchPlayfield(BeatmapDifficulty difficulty, Func> getVisualRepresentation) : base(BASE_WIDTH) { From 65b2bceef237f2ea950ec312a5a7a8d51131f0dc Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Sat, 15 Sep 2018 14:51:04 +0900 Subject: [PATCH 087/417] Simplify implementation --- osu.Game/Screens/Play/KeyCounter.cs | 27 +++++++++------------------ 1 file changed, 9 insertions(+), 18 deletions(-) diff --git a/osu.Game/Screens/Play/KeyCounter.cs b/osu.Game/Screens/Play/KeyCounter.cs index 0f621e6bb3..5652c1b54f 100644 --- a/osu.Game/Screens/Play/KeyCounter.cs +++ b/osu.Game/Screens/Play/KeyCounter.cs @@ -22,7 +22,7 @@ namespace osu.Game.Screens.Play private SpriteText countSpriteText; private readonly List states = new List(); - private KeyCounterState lastState; + private KeyCounterState currentState; public bool IsCounting { get; set; } = true; private int countPresses; @@ -144,33 +144,24 @@ namespace osu.Game.Screens.Play public void SaveState() { - if (lastState == null || lastState.Time < Clock.CurrentTime) - states.Add(lastState = new KeyCounterState(Clock.CurrentTime, CountPresses)); + if (currentState == null || currentState.Time < Clock.CurrentTime) + states.Add(currentState = new KeyCounterState(Clock.CurrentTime, CountPresses)); } protected override void Update() { base.Update(); - if (lastState?.Time > Clock.CurrentTime) - RestoreState(Clock.CurrentTime); + if (currentState?.Time > Clock.CurrentTime) + restoreStateTo(Clock.CurrentTime); } - public void RestoreState(double time) + private void restoreStateTo(double time) { - var targetState = states.LastOrDefault(state => state.Time <= time); - if (targetState == null) - { - ResetCount(); - return; - } + states.RemoveAll(state => state.Time > time); - var targetIndex = states.IndexOf(targetState); - - states.RemoveRange(targetIndex + 1, states.Count - (targetIndex + 1)); - - lastState = targetState; - CountPresses = targetState.Count; + currentState = states.LastOrDefault(); + CountPresses = currentState?.Count ?? 0; } } } From e636cfe79eb537eb77f613ba34e9074be915e6f7 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Sat, 15 Sep 2018 16:24:06 +0900 Subject: [PATCH 088/417] Fix dynamic compilation not working --- osu.Game.Tests/Visual/TestCaseKeyCounter.cs | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/osu.Game.Tests/Visual/TestCaseKeyCounter.cs b/osu.Game.Tests/Visual/TestCaseKeyCounter.cs index 931c62a64a..30580a3690 100644 --- a/osu.Game.Tests/Visual/TestCaseKeyCounter.cs +++ b/osu.Game.Tests/Visual/TestCaseKeyCounter.cs @@ -1,4 +1,4 @@ -// Copyright (c) 2007-2018 ppy Pty Ltd . +// Copyright (c) 2007-2018 ppy Pty Ltd . // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE using NUnit.Framework; @@ -14,7 +14,12 @@ namespace osu.Game.Tests.Visual [TestFixture] public class TestCaseKeyCounter : OsuTestCase { - private const Key rewind_test_key = Key.Z; + public override IReadOnlyList RequiredTypes => new[] + { + typeof(KeyCounterKeyboard), + typeof(KeyCounterMouse), + typeof(KeyCounterCollection) + }; public TestCaseKeyCounter() { From 7b57439976d6af4def64b08b8753c0340dfab3b8 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Sat, 15 Sep 2018 16:25:37 +0900 Subject: [PATCH 089/417] Add proper testing --- osu.Game.Tests/Visual/TestCaseKeyCounter.cs | 60 ++++++++++++++++----- 1 file changed, 46 insertions(+), 14 deletions(-) diff --git a/osu.Game.Tests/Visual/TestCaseKeyCounter.cs b/osu.Game.Tests/Visual/TestCaseKeyCounter.cs index 30580a3690..f31a687d2d 100644 --- a/osu.Game.Tests/Visual/TestCaseKeyCounter.cs +++ b/osu.Game.Tests/Visual/TestCaseKeyCounter.cs @@ -1,6 +1,9 @@ -// Copyright (c) 2007-2018 ppy Pty Ltd . +// Copyright (c) 2007-2018 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 NUnit.Framework; using osu.Framework.Graphics; using osu.Framework.Input.EventArgs; @@ -30,13 +33,14 @@ namespace osu.Game.Tests.Visual Anchor = Anchor.Centre, Children = new KeyCounter[] { - rewindTestKeyCounterKeyboard = new KeyCounterKeyboard(rewind_test_key), + rewindTestKeyCounterKeyboard = new KeyCounterKeyboard(Key.X), new KeyCounterKeyboard(Key.X), new KeyCounterMouse(MouseButton.Left), new KeyCounterMouse(MouseButton.Right), }, }; + AddStep("Add random", () => { Key key = (Key)((int)Key.A + RNG.Next(26)); @@ -44,29 +48,57 @@ namespace osu.Game.Tests.Visual }); AddSliderStep("Fade time", 0, 200, 50, v => kc.FadeTime = v); - var expectedCountPresses = rewindTestKeyCounterKeyboard.CountPresses + 1; - AddStep($"Press {rewind_test_key} key", () => + Key testKey = ((KeyCounterKeyboard)kc.Children.First()).Key; + double time1 = 0; + + AddStep($"Press {testKey} key", () => { - rewindTestKeyCounterKeyboard.TriggerOnKeyDown(null, new KeyDownEventArgs { Key = rewind_test_key, Repeat = false }); - rewindTestKeyCounterKeyboard.TriggerOnKeyUp(null, new KeyUpEventArgs { Key = rewind_test_key }); + rewindTestKeyCounterKeyboard.TriggerOnKeyDown(null, new KeyDownEventArgs { Key = testKey, Repeat = false }); + rewindTestKeyCounterKeyboard.TriggerOnKeyUp(null, new KeyUpEventArgs { Key = testKey }); }); - AddAssert($"Check {rewind_test_key} counter after keypress", () => rewindTestKeyCounterKeyboard.CountPresses == expectedCountPresses); + AddAssert($"Check {testKey} counter after keypress", () => rewindTestKeyCounterKeyboard.CountPresses == 1); - IFrameBasedClock counterClock = null; - AddStep($"Rewind {rewind_test_key} counter", () => + AddStep($"Press {testKey} key", () => { - counterClock = rewindTestKeyCounterKeyboard.Clock; - rewindTestKeyCounterKeyboard.Clock = new DecoupleableInterpolatingFramedClock(); + rewindTestKeyCounterKeyboard.TriggerOnKeyDown(null, new KeyDownEventArgs { Key = testKey, Repeat = false }); + rewindTestKeyCounterKeyboard.TriggerOnKeyUp(null, new KeyUpEventArgs { Key = testKey }); + time1 = Clock.CurrentTime; }); - AddAssert($"Check {rewind_test_key} counter after rewind", () => + AddAssert($"Check {testKey} counter after keypress", () => rewindTestKeyCounterKeyboard.CountPresses == 2); + + IFrameBasedClock oldClock = null; + + AddStep($"Rewind {testKey} counter once", () => { - rewindTestKeyCounterKeyboard.Clock = counterClock; - return rewindTestKeyCounterKeyboard.CountPresses == 0; + oldClock = rewindTestKeyCounterKeyboard.Clock; + rewindTestKeyCounterKeyboard.Clock = new FramedOffsetClock(new FixedClock(time1 - 10)); }); + AddAssert($"Check {testKey} counter after rewind", () => rewindTestKeyCounterKeyboard.CountPresses == 1); + + AddStep($"Rewind {testKey} counter to zero", () => rewindTestKeyCounterKeyboard.Clock = new FramedOffsetClock(new FixedClock(0))); + + AddAssert($"Check {testKey} counter after rewind", () => rewindTestKeyCounterKeyboard.CountPresses == 0); + + AddStep("Restore clock", () => rewindTestKeyCounterKeyboard.Clock = oldClock); + Add(kc); } + + private class FixedClock : IClock + { + private readonly double time; + + public FixedClock(double time) + { + this.time = time; + } + + public double CurrentTime => time; + public double Rate => 1; + public bool IsRunning => false; + } } } From 79b56cb35ca11bdc81eb93ccab4eb096519ea21f Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Sat, 15 Sep 2018 16:34:08 +0900 Subject: [PATCH 090/417] Make saveState private --- osu.Game/Screens/Play/KeyCounter.cs | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/osu.Game/Screens/Play/KeyCounter.cs b/osu.Game/Screens/Play/KeyCounter.cs index 5652c1b54f..d1efe4cab7 100644 --- a/osu.Game/Screens/Play/KeyCounter.cs +++ b/osu.Game/Screens/Play/KeyCounter.cs @@ -52,7 +52,7 @@ namespace osu.Game.Screens.Play if (value && IsCounting) { CountPresses++; - SaveState(); + saveState(); } } } @@ -142,12 +142,6 @@ namespace osu.Game.Screens.Play states.Clear(); } - public void SaveState() - { - if (currentState == null || currentState.Time < Clock.CurrentTime) - states.Add(currentState = new KeyCounterState(Clock.CurrentTime, CountPresses)); - } - protected override void Update() { base.Update(); @@ -156,6 +150,12 @@ namespace osu.Game.Screens.Play restoreStateTo(Clock.CurrentTime); } + private void saveState() + { + if (currentState == null || currentState.Time < Clock.CurrentTime) + states.Add(currentState = new KeyCounterState(Clock.CurrentTime, CountPresses)); + } + private void restoreStateTo(double time) { states.RemoveAll(state => state.Time > time); From 2d74c088ce70607d55c0193539b1008e8c6bdd56 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Sat, 15 Sep 2018 17:03:51 +0900 Subject: [PATCH 091/417] Add newline --- osu.Game.Rulesets.Catch/UI/CatchPlayfield.cs | 1 + 1 file changed, 1 insertion(+) diff --git a/osu.Game.Rulesets.Catch/UI/CatchPlayfield.cs b/osu.Game.Rulesets.Catch/UI/CatchPlayfield.cs index d16f5cbb07..102ec7fb3b 100644 --- a/osu.Game.Rulesets.Catch/UI/CatchPlayfield.cs +++ b/osu.Game.Rulesets.Catch/UI/CatchPlayfield.cs @@ -23,6 +23,7 @@ namespace osu.Game.Rulesets.Catch.UI private readonly CatcherArea catcherArea; protected override bool UserScrollSpeedAdjustment => false; + public CatchPlayfield(BeatmapDifficulty difficulty, Func> getVisualRepresentation) : base(BASE_WIDTH) { From 6a1e2c6fa58bae2cf5ca1829a0434dfbaa5cccd9 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Sat, 15 Sep 2018 18:49:01 +0900 Subject: [PATCH 092/417] Update efcore packages --- osu.Desktop/osu.Desktop.csproj | 4 ++-- osu.Game/osu.Game.csproj | 2 +- osu.TestProject.props | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/osu.Desktop/osu.Desktop.csproj b/osu.Desktop/osu.Desktop.csproj index 067a78132a..803927bc6f 100644 --- a/osu.Desktop/osu.Desktop.csproj +++ b/osu.Desktop/osu.Desktop.csproj @@ -28,8 +28,8 @@ - - + + diff --git a/osu.Game/osu.Game.csproj b/osu.Game/osu.Game.csproj index 83ab5534c6..05291cf3d0 100644 --- a/osu.Game/osu.Game.csproj +++ b/osu.Game/osu.Game.csproj @@ -16,7 +16,7 @@ - + diff --git a/osu.TestProject.props b/osu.TestProject.props index 58de6ec030..506d634555 100644 --- a/osu.TestProject.props +++ b/osu.TestProject.props @@ -11,7 +11,7 @@ - + From 92c6b570ea171d5ac574d015f883c4e04f3eea2c Mon Sep 17 00:00:00 2001 From: Paul Teng Date: Sat, 15 Sep 2018 08:42:04 -0400 Subject: [PATCH 093/417] Make Transform incompatible with Wiggle --- osu.Game.Rulesets.Osu/Mods/OsuModWiggle.cs | 1 + 1 file changed, 1 insertion(+) diff --git a/osu.Game.Rulesets.Osu/Mods/OsuModWiggle.cs b/osu.Game.Rulesets.Osu/Mods/OsuModWiggle.cs index 5b69247451..f049459cb5 100644 --- a/osu.Game.Rulesets.Osu/Mods/OsuModWiggle.cs +++ b/osu.Game.Rulesets.Osu/Mods/OsuModWiggle.cs @@ -21,6 +21,7 @@ namespace osu.Game.Rulesets.Osu.Mods public override ModType Type => ModType.Fun; public override string Description => "They just won't stay still..."; public override double ScoreMultiplier => 1; + public override Type[] IncompatibleMods => new Type[] { typeof(OsuModTransform) }; private const int wiggle_duration = 90; // (ms) Higher = fewer wiggles private const int wiggle_strength = 10; // Higher = stronger wiggles From 3e02a36938084dd44b199f6d29997b5e8b9b96f6 Mon Sep 17 00:00:00 2001 From: Paul Teng Date: Sat, 15 Sep 2018 08:43:22 -0400 Subject: [PATCH 094/417] Make Wiggle incompatible with Transform --- osu.Game.Rulesets.Osu/Mods/OsuModTransform.cs | 2 ++ 1 file changed, 2 insertions(+) diff --git a/osu.Game.Rulesets.Osu/Mods/OsuModTransform.cs b/osu.Game.Rulesets.Osu/Mods/OsuModTransform.cs index 30837d7db9..5ac0cc601a 100644 --- a/osu.Game.Rulesets.Osu/Mods/OsuModTransform.cs +++ b/osu.Game.Rulesets.Osu/Mods/OsuModTransform.cs @@ -20,6 +20,8 @@ namespace osu.Game.Rulesets.Osu.Mods public override ModType Type => ModType.Fun; public override string Description => "Everything rotates. EVERYTHING."; public override double ScoreMultiplier => 1; + public override Type[] IncompatibleMods => new Type[] { typeof(OsuModWiggle) }; + private float theta; public void ApplyToDrawableHitObjects(IEnumerable drawables) From 1a8665864c9d847185b3a4350dab5584ad0af517 Mon Sep 17 00:00:00 2001 From: Paul Teng Date: Sat, 15 Sep 2018 08:55:29 -0400 Subject: [PATCH 095/417] Remove redundant explicit array type info --- osu.Game.Rulesets.Osu/Mods/OsuModTransform.cs | 2 +- osu.Game.Rulesets.Osu/Mods/OsuModWiggle.cs | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/osu.Game.Rulesets.Osu/Mods/OsuModTransform.cs b/osu.Game.Rulesets.Osu/Mods/OsuModTransform.cs index 5ac0cc601a..440b314e5f 100644 --- a/osu.Game.Rulesets.Osu/Mods/OsuModTransform.cs +++ b/osu.Game.Rulesets.Osu/Mods/OsuModTransform.cs @@ -20,7 +20,7 @@ namespace osu.Game.Rulesets.Osu.Mods public override ModType Type => ModType.Fun; public override string Description => "Everything rotates. EVERYTHING."; public override double ScoreMultiplier => 1; - public override Type[] IncompatibleMods => new Type[] { typeof(OsuModWiggle) }; + public override Type[] IncompatibleMods => new[] { typeof(OsuModWiggle) }; private float theta; diff --git a/osu.Game.Rulesets.Osu/Mods/OsuModWiggle.cs b/osu.Game.Rulesets.Osu/Mods/OsuModWiggle.cs index f049459cb5..2e601c9078 100644 --- a/osu.Game.Rulesets.Osu/Mods/OsuModWiggle.cs +++ b/osu.Game.Rulesets.Osu/Mods/OsuModWiggle.cs @@ -21,7 +21,7 @@ namespace osu.Game.Rulesets.Osu.Mods public override ModType Type => ModType.Fun; public override string Description => "They just won't stay still..."; public override double ScoreMultiplier => 1; - public override Type[] IncompatibleMods => new Type[] { typeof(OsuModTransform) }; + public override Type[] IncompatibleMods => new[] { typeof(OsuModTransform) }; private const int wiggle_duration = 90; // (ms) Higher = fewer wiggles private const int wiggle_strength = 10; // Higher = stronger wiggles From eb86f9de5e2e2db53bf756d5724f0da6ce5125f7 Mon Sep 17 00:00:00 2001 From: Paul Teng Date: Sat, 15 Sep 2018 09:28:19 -0400 Subject: [PATCH 096/417] Check for skins folder also --- osu.Desktop/OsuGameDesktop.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu.Desktop/OsuGameDesktop.cs b/osu.Desktop/OsuGameDesktop.cs index 79ac24a1da..9d75c49a6a 100644 --- a/osu.Desktop/OsuGameDesktop.cs +++ b/osu.Desktop/OsuGameDesktop.cs @@ -92,7 +92,7 @@ namespace osu.Desktop { protected override string LocateBasePath() { - bool checkExists(string p) => Directory.Exists(Path.Combine(p, "Songs")); + bool checkExists(string p) => Directory.Exists(Path.Combine(p, "Songs")) && Directory.Exists(Path.Combine(p, "Skins")); string stableInstallPath; From 75e6bbc4d895987c2837846febf242be96fa7e80 Mon Sep 17 00:00:00 2001 From: Paul Teng Date: Sat, 15 Sep 2018 09:33:31 -0400 Subject: [PATCH 097/417] Revert "Check for skins folder also" This reverts commit eb86f9de5e2e2db53bf756d5724f0da6ce5125f7. --- osu.Desktop/OsuGameDesktop.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu.Desktop/OsuGameDesktop.cs b/osu.Desktop/OsuGameDesktop.cs index 9d75c49a6a..79ac24a1da 100644 --- a/osu.Desktop/OsuGameDesktop.cs +++ b/osu.Desktop/OsuGameDesktop.cs @@ -92,7 +92,7 @@ namespace osu.Desktop { protected override string LocateBasePath() { - bool checkExists(string p) => Directory.Exists(Path.Combine(p, "Songs")) && Directory.Exists(Path.Combine(p, "Skins")); + bool checkExists(string p) => Directory.Exists(Path.Combine(p, "Songs")); string stableInstallPath; From 42b2c322226b6ed2c1a9ba5ba5744762adee9d0d Mon Sep 17 00:00:00 2001 From: Paul Teng Date: Sat, 15 Sep 2018 09:47:50 -0400 Subject: [PATCH 098/417] Catch directory not found exception --- osu.Game/Database/ArchiveModelManager.cs | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/osu.Game/Database/ArchiveModelManager.cs b/osu.Game/Database/ArchiveModelManager.cs index f4f169f27c..ce0ec5caed 100644 --- a/osu.Game/Database/ArchiveModelManager.cs +++ b/osu.Game/Database/ArchiveModelManager.cs @@ -438,7 +438,15 @@ namespace osu.Game.Database return Task.CompletedTask; } - return Task.Factory.StartNew(() => Import(stable.GetDirectories(ImportFromStablePath).Select(f => stable.GetFullPath(f)).ToArray()), TaskCreationOptions.LongRunning); + return Task.Factory.StartNew(() => { + try { + Import(stable.GetDirectories(ImportFromStablePath).Select(f => stable.GetFullPath(f)).ToArray()); + } catch (DirectoryNotFoundException) { + // This handles situations like when the user does not have a Skins folder + // which would have this exception thrown from stable.GetDirectories + Logger.Log("No " + ImportFromStablePath + " folder available in osu!stable installation", LoggingTarget.Information, LogLevel.Error); + } + }, TaskCreationOptions.LongRunning); } #endregion From d469748612a9034be91c0d8874610333b24b0b1f Mon Sep 17 00:00:00 2001 From: Paul Teng Date: Sat, 15 Sep 2018 09:53:59 -0400 Subject: [PATCH 099/417] Reformat code --- osu.Game/Database/ArchiveModelManager.cs | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/osu.Game/Database/ArchiveModelManager.cs b/osu.Game/Database/ArchiveModelManager.cs index ce0ec5caed..ee9bf70aeb 100644 --- a/osu.Game/Database/ArchiveModelManager.cs +++ b/osu.Game/Database/ArchiveModelManager.cs @@ -438,10 +438,14 @@ namespace osu.Game.Database return Task.CompletedTask; } - return Task.Factory.StartNew(() => { - try { + return Task.Factory.StartNew(() => + { + try + { Import(stable.GetDirectories(ImportFromStablePath).Select(f => stable.GetFullPath(f)).ToArray()); - } catch (DirectoryNotFoundException) { + } + catch (DirectoryNotFoundException) + { // This handles situations like when the user does not have a Skins folder // which would have this exception thrown from stable.GetDirectories Logger.Log("No " + ImportFromStablePath + " folder available in osu!stable installation", LoggingTarget.Information, LogLevel.Error); From f99eff11926d9c70e18b63e4aaa8952cd6721e5f Mon Sep 17 00:00:00 2001 From: Joehu Date: Sat, 15 Sep 2018 07:30:11 -0700 Subject: [PATCH 100/417] Use consistent terminology format --- osu.Game.Rulesets.Osu/OsuInputManager.cs | 4 ++-- osu.Game.Rulesets.Taiko/TaikoInputManager.cs | 8 ++++---- osu.Game/Input/Bindings/GlobalActionContainer.cs | 8 ++++---- .../Overlays/Settings/Sections/Audio/OffsetSettings.cs | 2 +- .../Overlays/Settings/Sections/Audio/VolumeSettings.cs | 2 +- .../Overlays/Settings/Sections/Input/KeyboardSettings.cs | 2 +- .../Overlays/Settings/Sections/Input/MouseSettings.cs | 4 ++-- osu.Game/Rulesets/Objects/Drawables/DrawableHitObject.cs | 2 +- osu.Game/Rulesets/UI/Scrolling/ScrollingDirection.cs | 8 ++++---- osu.Game/Screens/Edit/Components/PlaybackControl.cs | 2 +- .../Screens/Edit/Screens/Compose/Timeline/TimelineArea.cs | 4 ++-- osu.Game/Screens/Play/PlayerSettings/VisualSettings.cs | 2 +- osu.Game/Screens/Select/Filter/GroupMode.cs | 4 ++-- osu.Game/Screens/Select/PlaySongSelect.cs | 2 +- osu.Game/Screens/Select/SongSelect.cs | 2 +- .../Storyboards/Drawables/DrawableStoryboardSample.cs | 2 +- 16 files changed, 29 insertions(+), 29 deletions(-) diff --git a/osu.Game.Rulesets.Osu/OsuInputManager.cs b/osu.Game.Rulesets.Osu/OsuInputManager.cs index e7bbe755a0..b734f52fd1 100644 --- a/osu.Game.Rulesets.Osu/OsuInputManager.cs +++ b/osu.Game.Rulesets.Osu/OsuInputManager.cs @@ -48,10 +48,10 @@ namespace osu.Game.Rulesets.Osu public enum OsuAction { - [Description("Left Button")] + [Description("Left button")] LeftButton, - [Description("Right Button")] + [Description("Right button")] RightButton } } diff --git a/osu.Game.Rulesets.Taiko/TaikoInputManager.cs b/osu.Game.Rulesets.Taiko/TaikoInputManager.cs index dc683ae2f5..3b430e7ad1 100644 --- a/osu.Game.Rulesets.Taiko/TaikoInputManager.cs +++ b/osu.Game.Rulesets.Taiko/TaikoInputManager.cs @@ -17,13 +17,13 @@ namespace osu.Game.Rulesets.Taiko public enum TaikoAction { - [Description("Left (Rim)")] + [Description("Left (rim)")] LeftRim, - [Description("Left (Centre)")] + [Description("Left (centre)")] LeftCentre, - [Description("Right (Centre)")] + [Description("Right (centre)")] RightCentre, - [Description("Right (Rim)")] + [Description("Right (rim)")] RightRim } } diff --git a/osu.Game/Input/Bindings/GlobalActionContainer.cs b/osu.Game/Input/Bindings/GlobalActionContainer.cs index b21deff509..2f5f1aea3f 100644 --- a/osu.Game/Input/Bindings/GlobalActionContainer.cs +++ b/osu.Game/Input/Bindings/GlobalActionContainer.cs @@ -71,17 +71,17 @@ namespace osu.Game.Input.Bindings ToggleSettings, [Description("Toggle osu!direct")] ToggleDirect, - [Description("Increase Volume")] + [Description("Increase volume")] IncreaseVolume, - [Description("Decrease Volume")] + [Description("Decrease volume")] DecreaseVolume, [Description("Toggle mute")] ToggleMute, // In-Game Keybindings - [Description("Skip Cutscene")] + [Description("Skip cutscene")] SkipCutscene, - [Description("Quick Retry (Hold)")] + [Description("Quick retry (hold)")] QuickRetry, [Description("Take screenshot")] diff --git a/osu.Game/Overlays/Settings/Sections/Audio/OffsetSettings.cs b/osu.Game/Overlays/Settings/Sections/Audio/OffsetSettings.cs index 0fe41327db..da96c6ef30 100644 --- a/osu.Game/Overlays/Settings/Sections/Audio/OffsetSettings.cs +++ b/osu.Game/Overlays/Settings/Sections/Audio/OffsetSettings.cs @@ -19,7 +19,7 @@ namespace osu.Game.Overlays.Settings.Sections.Audio { new SettingsSlider { - LabelText = "Audio Offset", + LabelText = "Audio offset", Bindable = config.GetBindable(OsuSetting.AudioOffset), KeyboardStep = 1f }, diff --git a/osu.Game/Overlays/Settings/Sections/Audio/VolumeSettings.cs b/osu.Game/Overlays/Settings/Sections/Audio/VolumeSettings.cs index 369c751448..fa4a714ba3 100644 --- a/osu.Game/Overlays/Settings/Sections/Audio/VolumeSettings.cs +++ b/osu.Game/Overlays/Settings/Sections/Audio/VolumeSettings.cs @@ -18,7 +18,7 @@ namespace osu.Game.Overlays.Settings.Sections.Audio Children = new Drawable[] { new SettingsSlider { LabelText = "Master", Bindable = audio.Volume, KeyboardStep = 0.01f }, - new SettingsSlider { LabelText = "Master (Window Inactive)", Bindable = config.GetBindable(OsuSetting.VolumeInactive), KeyboardStep = 0.01f }, + new SettingsSlider { LabelText = "Master (window inactive)", Bindable = config.GetBindable(OsuSetting.VolumeInactive), KeyboardStep = 0.01f }, new SettingsSlider { LabelText = "Effect", Bindable = audio.VolumeSample, KeyboardStep = 0.01f }, new SettingsSlider { LabelText = "Music", Bindable = audio.VolumeTrack, KeyboardStep = 0.01f }, }; diff --git a/osu.Game/Overlays/Settings/Sections/Input/KeyboardSettings.cs b/osu.Game/Overlays/Settings/Sections/Input/KeyboardSettings.cs index 456d1c9a2f..51b0296ca4 100644 --- a/osu.Game/Overlays/Settings/Sections/Input/KeyboardSettings.cs +++ b/osu.Game/Overlays/Settings/Sections/Input/KeyboardSettings.cs @@ -15,7 +15,7 @@ namespace osu.Game.Overlays.Settings.Sections.Input { new SettingsButton { - Text = "Key Configuration", + Text = "Key configuration", Action = keyConfig.ToggleVisibility }, }; diff --git a/osu.Game/Overlays/Settings/Sections/Input/MouseSettings.cs b/osu.Game/Overlays/Settings/Sections/Input/MouseSettings.cs index 71ab4d3782..a3ed66d547 100644 --- a/osu.Game/Overlays/Settings/Sections/Input/MouseSettings.cs +++ b/osu.Game/Overlays/Settings/Sections/Input/MouseSettings.cs @@ -26,12 +26,12 @@ namespace osu.Game.Overlays.Settings.Sections.Input { new SettingsCheckbox { - LabelText = "Raw Input", + LabelText = "Raw input", Bindable = rawInputToggle }, sensitivity = new SensitivitySetting { - LabelText = "Cursor Sensitivity", + LabelText = "Cursor sensitivity", Bindable = config.GetBindable(FrameworkSetting.CursorSensitivity) }, new SettingsCheckbox diff --git a/osu.Game/Rulesets/Objects/Drawables/DrawableHitObject.cs b/osu.Game/Rulesets/Objects/Drawables/DrawableHitObject.cs index a274d9b12f..c7030b9db9 100644 --- a/osu.Game/Rulesets/Objects/Drawables/DrawableHitObject.cs +++ b/osu.Game/Rulesets/Objects/Drawables/DrawableHitObject.cs @@ -145,7 +145,7 @@ namespace osu.Game.Rulesets.Objects.Drawables public event Action ApplyCustomUpdateState; /// - /// Plays all the hitsounds for this . + /// Plays all the hit sounds for this . /// public void PlaySamples() => Samples?.Play(); diff --git a/osu.Game/Rulesets/UI/Scrolling/ScrollingDirection.cs b/osu.Game/Rulesets/UI/Scrolling/ScrollingDirection.cs index 4fe727cb84..d0db8f8835 100644 --- a/osu.Game/Rulesets/UI/Scrolling/ScrollingDirection.cs +++ b/osu.Game/Rulesets/UI/Scrolling/ScrollingDirection.cs @@ -6,19 +6,19 @@ namespace osu.Game.Rulesets.UI.Scrolling public enum ScrollingDirection { /// - /// Hitobjects will scroll vertically from the bottom of the hitobject container. + /// Hit objects will scroll vertically from the bottom of the hitobject container. /// Up, /// - /// Hitobjects will scroll vertically from the top of the hitobject container. + /// Hit objects will scroll vertically from the top of the hitobject container. /// Down, /// - /// Hitobjects will scroll horizontally from the right of the hitobject container. + /// Hit objects will scroll horizontally from the right of the hitobject container. /// Left, /// - /// Hitobjects will scroll horizontally from the left of the hitobject container. + /// Hit objects will scroll horizontally from the left of the hitobject container. /// Right } diff --git a/osu.Game/Screens/Edit/Components/PlaybackControl.cs b/osu.Game/Screens/Edit/Components/PlaybackControl.cs index 6cd7fd52d4..6d5bfe9ae6 100644 --- a/osu.Game/Screens/Edit/Components/PlaybackControl.cs +++ b/osu.Game/Screens/Edit/Components/PlaybackControl.cs @@ -44,7 +44,7 @@ namespace osu.Game.Screens.Edit.Components new OsuSpriteText { Origin = Anchor.BottomLeft, - Text = "Playback Speed", + Text = "Playback speed", RelativePositionAxes = Axes.Y, Y = 0.5f, Padding = new MarginPadding { Left = 45 } diff --git a/osu.Game/Screens/Edit/Screens/Compose/Timeline/TimelineArea.cs b/osu.Game/Screens/Edit/Screens/Compose/Timeline/TimelineArea.cs index 006317e57e..ecf760be8e 100644 --- a/osu.Game/Screens/Edit/Screens/Compose/Timeline/TimelineArea.cs +++ b/osu.Game/Screens/Edit/Screens/Compose/Timeline/TimelineArea.cs @@ -59,8 +59,8 @@ namespace osu.Game.Screens.Edit.Screens.Compose.Timeline Spacing = new Vector2(0, 4), Children = new[] { - hitObjectsCheckbox = new OsuCheckbox { LabelText = "Hitobjects" }, - hitSoundsCheckbox = new OsuCheckbox { LabelText = "Hitsounds" }, + hitObjectsCheckbox = new OsuCheckbox { LabelText = "Hit objects" }, + hitSoundsCheckbox = new OsuCheckbox { LabelText = "Hit sounds" }, waveformCheckbox = new OsuCheckbox { LabelText = "Waveform" } } } diff --git a/osu.Game/Screens/Play/PlayerSettings/VisualSettings.cs b/osu.Game/Screens/Play/PlayerSettings/VisualSettings.cs index 439e344020..f762597e81 100644 --- a/osu.Game/Screens/Play/PlayerSettings/VisualSettings.cs +++ b/osu.Game/Screens/Play/PlayerSettings/VisualSettings.cs @@ -38,7 +38,7 @@ namespace osu.Game.Screens.Play.PlayerSettings }, showStoryboardToggle = new PlayerCheckbox { LabelText = "Storyboards" }, beatmapSkinsToggle = new PlayerCheckbox { LabelText = "Beatmap skins" }, - beatmapHitsoundsToggle = new PlayerCheckbox { LabelText = "Beatmap hitsounds" } + beatmapHitsoundsToggle = new PlayerCheckbox { LabelText = "Beatmap hit sounds" } }; } diff --git a/osu.Game/Screens/Select/Filter/GroupMode.cs b/osu.Game/Screens/Select/Filter/GroupMode.cs index 6e57843dfc..b3bd73ee59 100644 --- a/osu.Game/Screens/Select/Filter/GroupMode.cs +++ b/osu.Game/Screens/Select/Filter/GroupMode.cs @@ -21,8 +21,8 @@ namespace osu.Game.Screens.Select.Filter DateAdded, [Description("Difficulty")] Difficulty, - [Description("Favorites")] - Favorites, + [Description("Favourites")] + Favourites, [Description("Length")] Length, [Description("My Maps")] diff --git a/osu.Game/Screens/Select/PlaySongSelect.cs b/osu.Game/Screens/Select/PlaySongSelect.cs index 2c43b333aa..917a08d172 100644 --- a/osu.Game/Screens/Select/PlaySongSelect.cs +++ b/osu.Game/Screens/Select/PlaySongSelect.cs @@ -65,7 +65,7 @@ namespace osu.Game.Screens.Select BeatmapOptions.AddButton(@"Remove", @"from unplayed", FontAwesome.fa_times_circle_o, colours.Purple, null, Key.Number1); BeatmapOptions.AddButton(@"Clear", @"local scores", FontAwesome.fa_eraser, colours.Purple, null, Key.Number2); - BeatmapOptions.AddButton(@"Edit", @"Beatmap", FontAwesome.fa_pencil, colours.Yellow, () => + BeatmapOptions.AddButton(@"Edit", @"beatmap", FontAwesome.fa_pencil, colours.Yellow, () => { ValidForResume = false; Push(new Editor()); diff --git a/osu.Game/Screens/Select/SongSelect.cs b/osu.Game/Screens/Select/SongSelect.cs index efdf55e477..2d497a22a4 100644 --- a/osu.Game/Screens/Select/SongSelect.cs +++ b/osu.Game/Screens/Select/SongSelect.cs @@ -205,7 +205,7 @@ namespace osu.Game.Screens.Select Footer.AddButton(@"random", colours.Green, triggerRandom, Key.F2); Footer.AddButton(@"options", colours.Blue, BeatmapOptions, Key.F3); - BeatmapOptions.AddButton(@"Delete", @"Beatmap", FontAwesome.fa_trash, colours.Pink, () => delete(Beatmap.Value.BeatmapSetInfo), Key.Number4, float.MaxValue); + BeatmapOptions.AddButton(@"Delete", @"beatmapset", FontAwesome.fa_trash, colours.Pink, () => delete(Beatmap.Value.BeatmapSetInfo), Key.Number4, float.MaxValue); } if (this.beatmaps == null) diff --git a/osu.Game/Storyboards/Drawables/DrawableStoryboardSample.cs b/osu.Game/Storyboards/Drawables/DrawableStoryboardSample.cs index cdec8c042f..4f469ae593 100644 --- a/osu.Game/Storyboards/Drawables/DrawableStoryboardSample.cs +++ b/osu.Game/Storyboards/Drawables/DrawableStoryboardSample.cs @@ -41,7 +41,7 @@ namespace osu.Game.Storyboards.Drawables { base.Update(); - // TODO: this logic will need to be consolidated with other game samples like hitsounds. + // TODO: this logic will need to be consolidated with other game samples like hit sounds. if (Time.Current < sample.Time) { // We've rewound before the start time of the sample From 00d0613053a5ccaaabd04a73e48a7c8fca369417 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Sun, 16 Sep 2018 00:09:17 +0900 Subject: [PATCH 101/417] Fix new resharper redundant parenthesis inspections --- osu.Game/Storyboards/CommandTimeline.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/osu.Game/Storyboards/CommandTimeline.cs b/osu.Game/Storyboards/CommandTimeline.cs index 7de0756dbd..8a032064d3 100644 --- a/osu.Game/Storyboards/CommandTimeline.cs +++ b/osu.Game/Storyboards/CommandTimeline.cs @@ -16,10 +16,10 @@ namespace osu.Game.Storyboards public bool HasCommands => commands.Count > 0; private Cached startTimeBacking; - public double StartTime => startTimeBacking.IsValid ? startTimeBacking : (startTimeBacking.Value = HasCommands ? commands.Min(c => c.StartTime) : double.MinValue); + public double StartTime => startTimeBacking.IsValid ? startTimeBacking : startTimeBacking.Value = HasCommands ? commands.Min(c => c.StartTime) : double.MinValue; private Cached endTimeBacking; - public double EndTime => endTimeBacking.IsValid ? endTimeBacking : (endTimeBacking.Value = HasCommands ? commands.Max(c => c.EndTime) : double.MaxValue); + public double EndTime => endTimeBacking.IsValid ? endTimeBacking : endTimeBacking.Value = HasCommands ? commands.Max(c => c.EndTime) : double.MaxValue; public T StartValue => HasCommands ? commands.OrderBy(c => c.StartTime).First().StartValue : default(T); public T EndValue => HasCommands ? commands.OrderByDescending(c => c.EndTime).First().EndValue : default(T); From fce9740f2810468c58fd87b588831766c0664dfa Mon Sep 17 00:00:00 2001 From: LastExceed Date: Sat, 15 Sep 2018 18:00:47 +0200 Subject: [PATCH 102/417] return true since we are handling the action --- osu.Game/Overlays/Chat/ChatTabControl.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu.Game/Overlays/Chat/ChatTabControl.cs b/osu.Game/Overlays/Chat/ChatTabControl.cs index 6764b5e77b..048659746d 100644 --- a/osu.Game/Overlays/Chat/ChatTabControl.cs +++ b/osu.Game/Overlays/Chat/ChatTabControl.cs @@ -148,7 +148,7 @@ namespace osu.Game.Overlays.Chat { if (args.Button == MouseButton.Middle) closeButton.Action(); - return base.OnMouseUp(state, args); + return true; } protected override bool OnHover(InputState state) From d855e5957a331eadd9b798f54d22d4cd27445b56 Mon Sep 17 00:00:00 2001 From: Fayne Aldan Date: Sat, 15 Sep 2018 16:16:37 -0600 Subject: [PATCH 103/417] Don't wiggle repeat points independently --- osu.Game.Rulesets.Osu/Mods/OsuModWiggle.cs | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/osu.Game.Rulesets.Osu/Mods/OsuModWiggle.cs b/osu.Game.Rulesets.Osu/Mods/OsuModWiggle.cs index 2e601c9078..e0a93453ce 100644 --- a/osu.Game.Rulesets.Osu/Mods/OsuModWiggle.cs +++ b/osu.Game.Rulesets.Osu/Mods/OsuModWiggle.cs @@ -37,6 +37,11 @@ namespace osu.Game.Rulesets.Osu.Mods var osuObject = (OsuHitObject)drawable.HitObject; Vector2 origin = drawable.Position; + // Wiggle the repeat points with the slider instead of independently. + // Also fixes an issue with repeat points being positioned incorrectly. + if (osuObject is RepeatPoint) + return; + Random objRand = new Random((int)osuObject.StartTime); // Wiggle all objects during TimePreempt From 03ff695a674787c99ee80a84c3421d2c8ed6c4c0 Mon Sep 17 00:00:00 2001 From: miterosan Date: Sun, 16 Sep 2018 16:25:19 +0200 Subject: [PATCH 104/417] Use Dotnet core VSTest This allows only running one testrun. --- build.cake | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/build.cake b/build.cake index 7e1f1bdda7..6808bb3dfc 100644 --- a/build.cake +++ b/build.cake @@ -12,7 +12,6 @@ var configuration = Argument("configuration", "Release"); var osuDesktop = new FilePath("./osu.Desktop/osu.Desktop.csproj"); var osuSolution = new FilePath("./osu.sln"); -var testProjects = GetFiles("**/*.Tests.csproj"); /////////////////////////////////////////////////////////////////////////////// // TASKS @@ -27,13 +26,13 @@ Task("Compile") }); Task("Test") -.ContinueOnError() -.DoesForEach(testProjects, testProject => { - DotNetCoreTest(testProject.FullPath, new DotNetCoreTestSettings { - Framework = framework, - Configuration = configuration, - Logger = AppVeyor.IsRunningOnAppVeyor ? "Appveyor" : $"trx;LogFileName={testProject.GetFilename()}.trx", - ResultsDirectory = "./TestResults/" +.Does(() => { + var testAssemblies = GetFiles("**/*.Tests/bin/**/*.Tests.dll"); + + DotNetCoreVSTest(testAssemblies, new DotNetCoreVSTestSettings { + Logger = AppVeyor.IsRunningOnAppVeyor ? "Appveyor" : $"trx", + Parallel = true, + ToolTimeout = TimeSpan.FromMinutes(10), }); }); From 0491fd581a4516bf55a1d474de40e893351553cb Mon Sep 17 00:00:00 2001 From: miterosan Date: Sun, 16 Sep 2018 16:25:40 +0200 Subject: [PATCH 105/417] Reduce the verbosity of the Restore. --- build.cake | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/build.cake b/build.cake index 6808bb3dfc..9fd1b33f9b 100644 --- a/build.cake +++ b/build.cake @@ -43,7 +43,9 @@ Task("InspectCode") .Does(() => { var nVikaToolPath = GetFiles("./tools/NVika.MSBuild.*/tools/NVika.exe").First(); - DotNetCoreRestore(osuSolution.FullPath); + DotNetCoreRestore(osuSolution.FullPath, new DotNetCoreRestoreSettings { + Verbosity = DotNetCoreVerbosity.Quiet + }); InspectCode(osuSolution, new InspectCodeSettings { CachesHome = "inspectcode", From ead2e388823dc8afb8272a972e21e2b1b478030c Mon Sep 17 00:00:00 2001 From: miterosan Date: Sun, 16 Sep 2018 16:40:40 +0200 Subject: [PATCH 106/417] Build the projects before testing --- build.cake | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/build.cake b/build.cake index 9fd1b33f9b..b8d84b7be6 100644 --- a/build.cake +++ b/build.cake @@ -10,7 +10,6 @@ var target = Argument("target", "Build"); var framework = Argument("framework", "netcoreapp2.1"); var configuration = Argument("configuration", "Release"); -var osuDesktop = new FilePath("./osu.Desktop/osu.Desktop.csproj"); var osuSolution = new FilePath("./osu.sln"); /////////////////////////////////////////////////////////////////////////////// @@ -19,13 +18,14 @@ var osuSolution = new FilePath("./osu.sln"); Task("Compile") .Does(() => { - DotNetCoreBuild(osuDesktop.FullPath, new DotNetCoreBuildSettings { + DotNetCoreBuild(osuSolution.FullPath, new DotNetCoreBuildSettings { Framework = framework, Configuration = configuration }); }); Task("Test") +.IsDependentOn("Compile") .Does(() => { var testAssemblies = GetFiles("**/*.Tests/bin/**/*.Tests.dll"); From 3870980f3e3f25676670ef6c9d608bac9298f289 Mon Sep 17 00:00:00 2001 From: miterosan Date: Sun, 16 Sep 2018 16:57:53 +0200 Subject: [PATCH 107/417] Seperate the compile from restoring. --- build.cake | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/build.cake b/build.cake index b8d84b7be6..fff39079b6 100644 --- a/build.cake +++ b/build.cake @@ -16,11 +16,17 @@ var osuSolution = new FilePath("./osu.sln"); // TASKS /////////////////////////////////////////////////////////////////////////////// +Task("Restore") +.Does(() => { + DotNetCoreRestore(osuSolution.FullPath); +}); + Task("Compile") +.IsDependentOn("Restore") .Does(() => { DotNetCoreBuild(osuSolution.FullPath, new DotNetCoreBuildSettings { - Framework = framework, - Configuration = configuration + Configuration = configuration, + NoRestore = true, }); }); @@ -42,10 +48,6 @@ Task("InspectCode") .IsDependentOn("Compile") .Does(() => { var nVikaToolPath = GetFiles("./tools/NVika.MSBuild.*/tools/NVika.exe").First(); - - DotNetCoreRestore(osuSolution.FullPath, new DotNetCoreRestoreSettings { - Verbosity = DotNetCoreVerbosity.Quiet - }); InspectCode(osuSolution, new InspectCodeSettings { CachesHome = "inspectcode", From 8bfd981a50526768f0c0b17f5edc444fc4ff8cbf Mon Sep 17 00:00:00 2001 From: Paul Teng Date: Mon, 17 Sep 2018 21:05:28 -0400 Subject: [PATCH 108/417] Handle directory checking before entering task --- osu.Game/Database/ArchiveModelManager.cs | 19 +++++++------------ 1 file changed, 7 insertions(+), 12 deletions(-) diff --git a/osu.Game/Database/ArchiveModelManager.cs b/osu.Game/Database/ArchiveModelManager.cs index ee9bf70aeb..06a8b490ef 100644 --- a/osu.Game/Database/ArchiveModelManager.cs +++ b/osu.Game/Database/ArchiveModelManager.cs @@ -438,19 +438,14 @@ namespace osu.Game.Database return Task.CompletedTask; } - return Task.Factory.StartNew(() => + if (!stable.ExistsDirectory(ImportFromStablePath)) { - try - { - Import(stable.GetDirectories(ImportFromStablePath).Select(f => stable.GetFullPath(f)).ToArray()); - } - catch (DirectoryNotFoundException) - { - // This handles situations like when the user does not have a Skins folder - // which would have this exception thrown from stable.GetDirectories - Logger.Log("No " + ImportFromStablePath + " folder available in osu!stable installation", LoggingTarget.Information, LogLevel.Error); - } - }, TaskCreationOptions.LongRunning); + // This handles situations like when the user does not have a Skins folder + Logger.Log("No " + ImportFromStablePath + " folder available in osu!stable installation", LoggingTarget.Information, LogLevel.Error); + return Task.CompletedTask; + } + + return Task.Factory.StartNew(() => Import(stable.GetDirectories(ImportFromStablePath).Select(f => stable.GetFullPath(f)).ToArray()), TaskCreationOptions.LongRunning); } #endregion From aba1de8b1ab1c29c85a126cbc065b9d52c884c30 Mon Sep 17 00:00:00 2001 From: smoogipoo Date: Tue, 18 Sep 2018 12:54:07 +0900 Subject: [PATCH 109/417] Cleanup --- osu.Game/Beatmaps/BeatmapProcessor.cs | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/osu.Game/Beatmaps/BeatmapProcessor.cs b/osu.Game/Beatmaps/BeatmapProcessor.cs index 7007c41402..9db2c5f08e 100644 --- a/osu.Game/Beatmaps/BeatmapProcessor.cs +++ b/osu.Game/Beatmaps/BeatmapProcessor.cs @@ -2,6 +2,7 @@ // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE using System.Linq; +using osu.Game.Rulesets.Objects; using osu.Game.Rulesets.Objects.Types; namespace osu.Game.Beatmaps @@ -44,24 +45,25 @@ namespace osu.Game.Beatmaps public virtual void PostProcess() { - void updateNestedCombo(Rulesets.Objects.HitObject obj, int comboIndex, int indexInCurrentCombo) + void updateNestedCombo(HitObject obj, int comboIndex, int indexInCurrentCombo) { - if (obj is IHasComboInformation) + if (obj is IHasComboInformation objectComboInfo) { - var objectComboInfo = (IHasComboInformation)obj; objectComboInfo.ComboIndex = comboIndex; objectComboInfo.IndexInCurrentCombo = indexInCurrentCombo; - foreach (var nestedObjet in obj.NestedHitObjects) - updateNestedCombo(nestedObjet, comboIndex, indexInCurrentCombo); + foreach (var nestedObject in obj.NestedHitObjects) + updateNestedCombo(nestedObject, comboIndex, indexInCurrentCombo); } } + foreach (var hitObject in Beatmap.HitObjects) - if (hitObject is IHasComboInformation) + { + if (hitObject is IHasComboInformation objectComboInfo) { - var objectComboInfo = (IHasComboInformation)hitObject; foreach (var nested in hitObject.NestedHitObjects) updateNestedCombo(nested, objectComboInfo.ComboIndex, objectComboInfo.IndexInCurrentCombo); } + } } } } From 27ea6102bc5d38ce773f15d4260c69e99e01a3db Mon Sep 17 00:00:00 2001 From: LastExceed Date: Tue, 18 Sep 2018 08:07:19 +0200 Subject: [PATCH 110/417] only return true on Mclick --- osu.Game/Overlays/Chat/ChatTabControl.cs | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/osu.Game/Overlays/Chat/ChatTabControl.cs b/osu.Game/Overlays/Chat/ChatTabControl.cs index 048659746d..524cae5600 100644 --- a/osu.Game/Overlays/Chat/ChatTabControl.cs +++ b/osu.Game/Overlays/Chat/ChatTabControl.cs @@ -146,9 +146,10 @@ namespace osu.Game.Overlays.Chat protected override bool OnMouseUp(InputState state, MouseUpEventArgs args) { - if (args.Button == MouseButton.Middle) + var isMclick = args.Button == MouseButton.Middle; + if (isMclick) closeButton.Action(); - return true; + return isMclick; } protected override bool OnHover(InputState state) From ad3196264307e2ee566972168dbd539b2f20c52e Mon Sep 17 00:00:00 2001 From: Dan Balasescu <1329837+smoogipoo@users.noreply.github.com> Date: Tue, 18 Sep 2018 15:27:21 +0900 Subject: [PATCH 111/417] Cleanup, use similar code to everywhere else --- osu.Game/Overlays/Chat/ChatTabControl.cs | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/osu.Game/Overlays/Chat/ChatTabControl.cs b/osu.Game/Overlays/Chat/ChatTabControl.cs index 524cae5600..d9327e73e8 100644 --- a/osu.Game/Overlays/Chat/ChatTabControl.cs +++ b/osu.Game/Overlays/Chat/ChatTabControl.cs @@ -146,10 +146,13 @@ namespace osu.Game.Overlays.Chat protected override bool OnMouseUp(InputState state, MouseUpEventArgs args) { - var isMclick = args.Button == MouseButton.Middle; - if (isMclick) + if (args.Button == MouseButton.Middle) + { closeButton.Action(); - return isMclick; + return true; + } + + return false; } protected override bool OnHover(InputState state) From e3cc25a96a32735dc00bdbb983c632dd020f8013 Mon Sep 17 00:00:00 2001 From: Hanamuke Date: Tue, 18 Sep 2018 20:21:10 +0200 Subject: [PATCH 112/417] Implement ConstantScrollingSpeedVisualiser --- osu.Game.Rulesets.Catch/UI/CatchPlayfield.cs | 2 ++ osu.Game/Configuration/SpeedChangeVisualisationMethod.cs | 4 +++- osu.Game/Rulesets/UI/Scrolling/ScrollingHitObjectContainer.cs | 3 +++ .../Scrolling/Visualisers/SequentialSpeedChangeVisualiser.cs | 2 +- 4 files changed, 9 insertions(+), 2 deletions(-) diff --git a/osu.Game.Rulesets.Catch/UI/CatchPlayfield.cs b/osu.Game.Rulesets.Catch/UI/CatchPlayfield.cs index 102ec7fb3b..85e14eaad0 100644 --- a/osu.Game.Rulesets.Catch/UI/CatchPlayfield.cs +++ b/osu.Game.Rulesets.Catch/UI/CatchPlayfield.cs @@ -55,6 +55,8 @@ namespace osu.Game.Rulesets.Catch.UI RelativeSizeAxes = Axes.Both, }, }); + + VisibleTimeRange.Value = BeatmapDifficulty.DifficultyRange(difficulty.ApproachRate, 1800, 1200, 450) / 1.2; } public bool CheckIfWeCanCatch(CatchHitObject obj) => catcherArea.AttemptCatch(obj); diff --git a/osu.Game/Configuration/SpeedChangeVisualisationMethod.cs b/osu.Game/Configuration/SpeedChangeVisualisationMethod.cs index d38b1a89c5..39c6e5649c 100644 --- a/osu.Game/Configuration/SpeedChangeVisualisationMethod.cs +++ b/osu.Game/Configuration/SpeedChangeVisualisationMethod.cs @@ -10,6 +10,8 @@ namespace osu.Game.Configuration [Description("Sequential")] Sequential, [Description("Overlapping")] - Overlapping + Overlapping, + [Description("Constant")] + Constant } } diff --git a/osu.Game/Rulesets/UI/Scrolling/ScrollingHitObjectContainer.cs b/osu.Game/Rulesets/UI/Scrolling/ScrollingHitObjectContainer.cs index c64fca6eff..3ce1ab9960 100644 --- a/osu.Game/Rulesets/UI/Scrolling/ScrollingHitObjectContainer.cs +++ b/osu.Game/Rulesets/UI/Scrolling/ScrollingHitObjectContainer.cs @@ -54,6 +54,9 @@ namespace osu.Game.Rulesets.UI.Scrolling case SpeedChangeVisualisationMethod.Overlapping: speedChangeVisualiser = new OverlappingSpeedChangeVisualiser(ControlPoints); break; + case SpeedChangeVisualisationMethod.Constant: + speedChangeVisualiser = new ConstantSpeedChangeVisualiser(); + break; } } diff --git a/osu.Game/Rulesets/UI/Scrolling/Visualisers/SequentialSpeedChangeVisualiser.cs b/osu.Game/Rulesets/UI/Scrolling/Visualisers/SequentialSpeedChangeVisualiser.cs index 25dea8dfbf..f12e274022 100644 --- a/osu.Game/Rulesets/UI/Scrolling/Visualisers/SequentialSpeedChangeVisualiser.cs +++ b/osu.Game/Rulesets/UI/Scrolling/Visualisers/SequentialSpeedChangeVisualiser.cs @@ -61,7 +61,7 @@ namespace osu.Game.Rulesets.UI.Scrolling.Visualisers foreach (var obj in hitObjects) { - var finalPosition = hitObjectPositions[obj] - timelinePosition; + var finalPosition = (hitObjectPositions[obj] - timelinePosition); switch (direction) { From 2afcdb14515813fdf55082d1bbfe3a751369f911 Mon Sep 17 00:00:00 2001 From: Hanamuke Date: Tue, 18 Sep 2018 20:23:25 +0200 Subject: [PATCH 113/417] Add the file --- .../ConstantSpeedChangeVisualiser.cs | 69 +++++++++++++++++++ .../SequentialSpeedChangeVisualiser.cs | 2 +- 2 files changed, 70 insertions(+), 1 deletion(-) create mode 100644 osu.Game/Rulesets/UI/Scrolling/Visualisers/ConstantSpeedChangeVisualiser.cs diff --git a/osu.Game/Rulesets/UI/Scrolling/Visualisers/ConstantSpeedChangeVisualiser.cs b/osu.Game/Rulesets/UI/Scrolling/Visualisers/ConstantSpeedChangeVisualiser.cs new file mode 100644 index 0000000000..422617e836 --- /dev/null +++ b/osu.Game/Rulesets/UI/Scrolling/Visualisers/ConstantSpeedChangeVisualiser.cs @@ -0,0 +1,69 @@ +// Copyright (c) 2007-2018 ppy Pty Ltd . +// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE + +using System.Collections.Generic; +using osu.Framework.Lists; +using osu.Game.Rulesets.Objects.Drawables; +using osu.Game.Rulesets.Objects.Types; +using osu.Game.Rulesets.Timing; +using OpenTK; + +namespace osu.Game.Rulesets.UI.Scrolling.Visualisers +{ + public class ConstantSpeedChangeVisualiser : ISpeedChangeVisualiser + { + public void ComputeInitialStates(IEnumerable hitObjects, ScrollingDirection direction, double timeRange, Vector2 length) + { + foreach (var obj in hitObjects) + { + obj.LifetimeStart = obj.HitObject.StartTime - timeRange; + + if (obj.HitObject is IHasEndTime endTime) + { + var hitObjectLength = (endTime.EndTime - obj.HitObject.StartTime) / timeRange; + + switch (direction) + { + case ScrollingDirection.Up: + case ScrollingDirection.Down: + obj.Height = (float)(hitObjectLength * length.Y); + break; + case ScrollingDirection.Left: + case ScrollingDirection.Right: + obj.Width = (float)(hitObjectLength * length.X); + break; + } + } + + ComputeInitialStates(obj.NestedHitObjects, direction, timeRange, length); + + // Nested hitobjects don't need to scroll, but they do need accurate positions + UpdatePositions(obj.NestedHitObjects, direction, obj.HitObject.StartTime, timeRange, length); + } + } + + public void UpdatePositions(IEnumerable hitObjects, ScrollingDirection direction, double currentTime, double timeRange, Vector2 length) + { + foreach (var obj in hitObjects) + { + var position = (obj.HitObject.StartTime - currentTime) / timeRange; + + switch (direction) + { + case ScrollingDirection.Up: + obj.Y = (float)(position * length.Y); + break; + case ScrollingDirection.Down: + obj.Y = (float)(-position * length.Y); + break; + case ScrollingDirection.Left: + obj.X = (float)(position * length.X); + break; + case ScrollingDirection.Right: + obj.X = (float)(-position * length.X); + break; + } + } + } + } +} diff --git a/osu.Game/Rulesets/UI/Scrolling/Visualisers/SequentialSpeedChangeVisualiser.cs b/osu.Game/Rulesets/UI/Scrolling/Visualisers/SequentialSpeedChangeVisualiser.cs index f12e274022..25dea8dfbf 100644 --- a/osu.Game/Rulesets/UI/Scrolling/Visualisers/SequentialSpeedChangeVisualiser.cs +++ b/osu.Game/Rulesets/UI/Scrolling/Visualisers/SequentialSpeedChangeVisualiser.cs @@ -61,7 +61,7 @@ namespace osu.Game.Rulesets.UI.Scrolling.Visualisers foreach (var obj in hitObjects) { - var finalPosition = (hitObjectPositions[obj] - timelinePosition); + var finalPosition = hitObjectPositions[obj] - timelinePosition; switch (direction) { From 6d229716e763317dd58d3471f2a580fb8e35f674 Mon Sep 17 00:00:00 2001 From: Hanamuke Date: Tue, 18 Sep 2018 20:42:55 +0200 Subject: [PATCH 114/417] Remove unused using directives --- .../UI/Scrolling/Visualisers/ConstantSpeedChangeVisualiser.cs | 2 -- 1 file changed, 2 deletions(-) diff --git a/osu.Game/Rulesets/UI/Scrolling/Visualisers/ConstantSpeedChangeVisualiser.cs b/osu.Game/Rulesets/UI/Scrolling/Visualisers/ConstantSpeedChangeVisualiser.cs index 422617e836..9e910d6b11 100644 --- a/osu.Game/Rulesets/UI/Scrolling/Visualisers/ConstantSpeedChangeVisualiser.cs +++ b/osu.Game/Rulesets/UI/Scrolling/Visualisers/ConstantSpeedChangeVisualiser.cs @@ -2,10 +2,8 @@ // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE using System.Collections.Generic; -using osu.Framework.Lists; using osu.Game.Rulesets.Objects.Drawables; using osu.Game.Rulesets.Objects.Types; -using osu.Game.Rulesets.Timing; using OpenTK; namespace osu.Game.Rulesets.UI.Scrolling.Visualisers From c8e9d9375f1742c33939684483939247fb1b8e63 Mon Sep 17 00:00:00 2001 From: ekrctb Date: Tue, 18 Sep 2018 17:05:26 +0900 Subject: [PATCH 115/417] Use new InputStateChangeEvent for RulesetInputManager --- osu.Game/Input/Handlers/ReplayInputHandler.cs | 27 ++++++++++++++- osu.Game/Rulesets/UI/RulesetInputManager.cs | 33 +++++++------------ 2 files changed, 37 insertions(+), 23 deletions(-) diff --git a/osu.Game/Input/Handlers/ReplayInputHandler.cs b/osu.Game/Input/Handlers/ReplayInputHandler.cs index 5f53868b28..0a62c6ca72 100644 --- a/osu.Game/Input/Handlers/ReplayInputHandler.cs +++ b/osu.Game/Input/Handlers/ReplayInputHandler.cs @@ -3,10 +3,13 @@ using System; using System.Collections.Generic; +using System.Linq; using osu.Framework.Input.Handlers; using osu.Framework.Input.StateChanges; +using osu.Framework.Input.StateChanges.Events; using osu.Framework.Input.States; using osu.Framework.Platform; +using osu.Game.Rulesets.UI; using OpenTK; namespace osu.Game.Input.Handlers @@ -40,7 +43,29 @@ namespace osu.Game.Input.Handlers public void Apply(InputState state, IInputStateChangeHandler handler) { - handler.HandleCustomInput(state, this); + if (!(state is RulesetInputManagerInputState inputState)) + throw new InvalidOperationException($"{nameof(ReplayState)} should only be applied to a {nameof(RulesetInputManagerInputState)}"); + + var lastPressed = inputState.LastReplayState?.PressedActions ?? new List(); + var released = lastPressed.Except(PressedActions).ToArray(); + var pressed = PressedActions.Except(lastPressed).ToArray(); + + inputState.LastReplayState = this; + + handler.HandleInputStateChange(new ReplayStateChangeEvent(state, this, released, pressed)); + } + } + + public class ReplayStateChangeEvent : InputStateChangeEvent + { + public readonly T[] ReleasedActions; + public readonly T[] PressedActions; + + public ReplayStateChangeEvent(InputState state, IInput input, T[] releasedActions, T[] pressedActions) + : base(state, input) + { + ReleasedActions = releasedActions; + PressedActions = pressedActions; } } } diff --git a/osu.Game/Rulesets/UI/RulesetInputManager.cs b/osu.Game/Rulesets/UI/RulesetInputManager.cs index b05efce146..7167621291 100644 --- a/osu.Game/Rulesets/UI/RulesetInputManager.cs +++ b/osu.Game/Rulesets/UI/RulesetInputManager.cs @@ -10,7 +10,9 @@ using osu.Framework.Graphics.Containers; using osu.Framework.Input; using osu.Framework.Input.Bindings; using osu.Framework.Input.EventArgs; +using osu.Framework.Input.Events; using osu.Framework.Input.StateChanges; +using osu.Framework.Input.StateChanges.Events; using osu.Framework.Input.States; using osu.Framework.Timing; using osu.Game.Configuration; @@ -56,33 +58,20 @@ namespace osu.Game.Rulesets.UI #region Action mapping (for replays) - private List lastPressedActions = new List(); - - public override void HandleCustomInput(InputState state, IInput input) + public override void HandleInputStateChange(InputStateChangeEvent inputStateChange) { - if (!(input is ReplayState replayState)) + if (inputStateChange is ReplayStateChangeEvent replayStateChanged) { - base.HandleCustomInput(state, input); - return; - } + foreach (var action in replayStateChanged.ReleasedActions) + KeyBindingContainer.TriggerReleased(action); - if (state is RulesetInputManagerInputState inputState) + foreach (var action in replayStateChanged.PressedActions) + KeyBindingContainer.TriggerPressed(action); + } + else { - inputState.LastReplayState = replayState; + base.HandleInputStateChange(inputStateChange); } - - // Here we handle states specifically coming from a replay source. - // These have extra action information rather than keyboard keys or mouse buttons. - - List newActions = replayState.PressedActions; - - foreach (var released in lastPressedActions.Except(newActions)) - KeyBindingContainer.TriggerReleased(released); - - foreach (var pressed in newActions.Except(lastPressedActions)) - KeyBindingContainer.TriggerPressed(pressed); - - lastPressedActions = newActions; } #endregion From a3e6973b41268f88c44a7670bf1116f9a903d3b2 Mon Sep 17 00:00:00 2001 From: ekrctb Date: Tue, 18 Sep 2018 17:48:37 +0900 Subject: [PATCH 116/417] Replace usage of now removed TriggerKeyPress and similar methods. --- osu.Game.Rulesets.Osu/Mods/OsuModRelax.cs | 3 +- .../Visual/TestCaseGameplayMenuOverlay.cs | 73 +++++++++++-------- osu.Game.Tests/Visual/TestCaseKeyCounter.cs | 11 ++- osu.Game/Rulesets/UI/RulesetInputManager.cs | 3 - osu.Game/Screens/Play/KeyCounterCollection.cs | 22 +++--- 5 files changed, 63 insertions(+), 49 deletions(-) diff --git a/osu.Game.Rulesets.Osu/Mods/OsuModRelax.cs b/osu.Game.Rulesets.Osu/Mods/OsuModRelax.cs index f3b7d60cf0..8d27502b3c 100644 --- a/osu.Game.Rulesets.Osu/Mods/OsuModRelax.cs +++ b/osu.Game.Rulesets.Osu/Mods/OsuModRelax.cs @@ -4,7 +4,6 @@ using System; using System.Collections.Generic; using System.Linq; -using osu.Framework.Input.States; using osu.Game.Rulesets.Mods; using osu.Game.Rulesets.Objects.Types; using osu.Game.Rulesets.Osu.Objects; @@ -77,7 +76,7 @@ namespace osu.Game.Rulesets.Osu.Mods wasLeft = !wasLeft; } - osuInputManager.HandleCustomInput(new InputState(), state); + state.Apply(osuInputManager.CurrentState, osuInputManager); } public void ApplyToRulesetContainer(RulesetContainer rulesetContainer) diff --git a/osu.Game.Tests/Visual/TestCaseGameplayMenuOverlay.cs b/osu.Game.Tests/Visual/TestCaseGameplayMenuOverlay.cs index 45b5ec2c11..0f78315861 100644 --- a/osu.Game.Tests/Visual/TestCaseGameplayMenuOverlay.cs +++ b/osu.Game.Tests/Visual/TestCaseGameplayMenuOverlay.cs @@ -8,14 +8,14 @@ using System.Linq; using OpenTK.Input; using osu.Framework.Allocation; using osu.Framework.Graphics.Containers; -using osu.Framework.Input.EventArgs; using osu.Framework.Logging; using osu.Game.Screens.Play; +using OpenTK; namespace osu.Game.Tests.Visual { [Description("player pause/fail screens")] - public class TestCaseGameplayMenuOverlay : OsuTestCase + public class TestCaseGameplayMenuOverlay : ManualInputManagerTestCase { public override IReadOnlyList RequiredTypes => new[] { typeof(FailOverlay), typeof(PauseContainer) }; @@ -73,12 +73,18 @@ namespace osu.Game.Tests.Visual { AddStep("Show overlay", () => failOverlay.Show()); - AddStep("Hover first button", () => failOverlay.Buttons.First().TriggerOnMouseMove(null)); + AddStep("Hover first button", () => InputManager.MoveMouseTo(failOverlay.Buttons.First())); AddStep("Hide overlay", () => failOverlay.Hide()); AddAssert("Overlay state is reset", () => !failOverlay.Buttons.Any(b => b.Selected)); } + private void press(Key key) + { + InputManager.PressKey(key); + InputManager.ReleaseKey(key); + } + /// /// Tests that pressing enter after an overlay shows doesn't trigger an event because a selection hasn't occurred. /// @@ -86,7 +92,7 @@ namespace osu.Game.Tests.Visual { AddStep("Show overlay", () => pauseOverlay.Show()); - AddStep("Press enter", () => pauseOverlay.TriggerOnKeyDown(null, new KeyDownEventArgs { Key = Key.Enter })); + AddStep("Press enter", () => press(Key.Enter)); AddAssert("Overlay still open", () => pauseOverlay.State == Visibility.Visible); AddStep("Hide overlay", () => pauseOverlay.Hide()); @@ -99,7 +105,7 @@ namespace osu.Game.Tests.Visual { AddStep("Show overlay", () => pauseOverlay.Show()); - AddStep("Up arrow", () => pauseOverlay.TriggerOnKeyDown(null, new KeyDownEventArgs { Key = Key.Up })); + AddStep("Up arrow", () => press(Key.Up)); AddAssert("Last button selected", () => pauseOverlay.Buttons.Last().Selected); AddStep("Hide overlay", () => pauseOverlay.Hide()); @@ -112,7 +118,7 @@ namespace osu.Game.Tests.Visual { AddStep("Show overlay", () => pauseOverlay.Show()); - AddStep("Down arrow", () => pauseOverlay.TriggerOnKeyDown(null, new KeyDownEventArgs { Key = Key.Down })); + AddStep("Down arrow", () => press(Key.Down)); AddAssert("First button selected", () => pauseOverlay.Buttons.First().Selected); AddStep("Hide overlay", () => pauseOverlay.Hide()); @@ -125,11 +131,11 @@ namespace osu.Game.Tests.Visual { AddStep("Show overlay", () => failOverlay.Show()); - AddStep("Up arrow", () => failOverlay.TriggerOnKeyDown(null, new KeyDownEventArgs { Key = Key.Up })); + AddStep("Up arrow", () => press(Key.Up)); AddAssert("Last button selected", () => failOverlay.Buttons.Last().Selected); - AddStep("Up arrow", () => failOverlay.TriggerOnKeyDown(null, new KeyDownEventArgs { Key = Key.Up })); + AddStep("Up arrow", () => press(Key.Up)); AddAssert("First button selected", () => failOverlay.Buttons.First().Selected); - AddStep("Up arrow", () => failOverlay.TriggerOnKeyDown(null, new KeyDownEventArgs { Key = Key.Up })); + AddStep("Up arrow", () => press(Key.Up)); AddAssert("Last button selected", () => failOverlay.Buttons.Last().Selected); AddStep("Hide overlay", () => failOverlay.Hide()); @@ -142,11 +148,11 @@ namespace osu.Game.Tests.Visual { AddStep("Show overlay", () => failOverlay.Show()); - AddStep("Down arrow", () => failOverlay.TriggerOnKeyDown(null, new KeyDownEventArgs { Key = Key.Down })); + AddStep("Down arrow", () => press(Key.Down)); AddAssert("First button selected", () => failOverlay.Buttons.First().Selected); - AddStep("Down arrow", () => failOverlay.TriggerOnKeyDown(null, new KeyDownEventArgs { Key = Key.Down })); + AddStep("Down arrow", () => press(Key.Down)); AddAssert("Last button selected", () => failOverlay.Buttons.Last().Selected); - AddStep("Down arrow", () => failOverlay.TriggerOnKeyDown(null, new KeyDownEventArgs { Key = Key.Down })); + AddStep("Down arrow", () => press(Key.Down)); AddAssert("First button selected", () => failOverlay.Buttons.First().Selected); AddStep("Hide overlay", () => failOverlay.Hide()); @@ -161,8 +167,8 @@ namespace osu.Game.Tests.Visual var secondButton = pauseOverlay.Buttons.Skip(1).First(); - AddStep("Down arrow", () => pauseOverlay.TriggerOnKeyDown(null, new KeyDownEventArgs { Key = Key.Down })); - AddStep("Hover second button", () => secondButton.TriggerOnMouseMove(null)); + AddStep("Down arrow", () => press(Key.Down)); + AddStep("Hover second button", () => InputManager.MoveMouseTo(secondButton)); AddAssert("First button not selected", () => !pauseOverlay.Buttons.First().Selected); AddAssert("Second button selected", () => secondButton.Selected); @@ -174,12 +180,16 @@ namespace osu.Game.Tests.Visual /// private void testKeySelectionAfterMouseSelection() { - AddStep("Show overlay", () => pauseOverlay.Show()); + AddStep("Show overlay", () => + { + pauseOverlay.Show(); + InputManager.MoveMouseTo(Vector2.Zero); + }); var secondButton = pauseOverlay.Buttons.Skip(1).First(); - AddStep("Hover second button", () => secondButton.TriggerOnMouseMove(null)); - AddStep("Up arrow", () => pauseOverlay.TriggerOnKeyDown(null, new KeyDownEventArgs { Key = Key.Up })); + AddStep("Hover second button", () => InputManager.MoveMouseTo(secondButton)); + AddStep("Up arrow", () => press(Key.Up)); AddAssert("Second button not selected", () => !secondButton.Selected); AddAssert("First button selected", () => pauseOverlay.Buttons.First().Selected); @@ -195,9 +205,9 @@ namespace osu.Game.Tests.Visual var secondButton = pauseOverlay.Buttons.Skip(1).First(); - AddStep("Hover second button", () => secondButton.TriggerOnMouseMove(null)); - AddStep("Unhover second button", () => secondButton.TriggerOnHoverLost(null)); - AddStep("Down arrow", () => pauseOverlay.TriggerOnKeyDown(null, new KeyDownEventArgs { Key = Key.Down })); + AddStep("Hover second button", () => InputManager.MoveMouseTo(secondButton)); + AddStep("Unhover second button", () => InputManager.MoveMouseTo(Vector2.Zero)); + AddStep("Down arrow", () => press(Key.Down)); AddAssert("First button selected", () => pauseOverlay.Buttons.First().Selected); // Initial state condition AddStep("Hide overlay", () => pauseOverlay.Hide()); @@ -235,23 +245,28 @@ namespace osu.Game.Tests.Visual AddStep("Select second button", () => { - pauseOverlay.TriggerOnKeyDown(null, new KeyDownEventArgs { Key = Key.Down }); - pauseOverlay.TriggerOnKeyDown(null, new KeyDownEventArgs { Key = Key.Down }); + press(Key.Down); + press(Key.Down); }); - var retryButton = pauseOverlay.Buttons.Skip(1).First(); - bool triggered = false; + Action lastAction = null; AddStep("Press enter", () => { - var lastAction = pauseOverlay.OnRetry; + lastAction = pauseOverlay.OnRetry; pauseOverlay.OnRetry = () => triggered = true; - - retryButton.TriggerOnKeyDown(null, new KeyDownEventArgs { Key = Key.Enter }); - pauseOverlay.OnRetry = lastAction; + press(Key.Enter); }); - AddAssert("Action was triggered", () => triggered); + AddAssert("Action was triggered", () => + { + if (lastAction != null) + { + pauseOverlay.OnRetry = lastAction; + lastAction = null; + } + return triggered; + }); AddAssert("Overlay is closed", () => pauseOverlay.State == Visibility.Hidden); } } diff --git a/osu.Game.Tests/Visual/TestCaseKeyCounter.cs b/osu.Game.Tests/Visual/TestCaseKeyCounter.cs index f31a687d2d..178b47ed33 100644 --- a/osu.Game.Tests/Visual/TestCaseKeyCounter.cs +++ b/osu.Game.Tests/Visual/TestCaseKeyCounter.cs @@ -6,7 +6,6 @@ using System.Collections.Generic; using System.Linq; using NUnit.Framework; using osu.Framework.Graphics; -using osu.Framework.Input.EventArgs; using osu.Framework.MathUtils; using osu.Framework.Timing; using osu.Game.Screens.Play; @@ -15,7 +14,7 @@ using OpenTK.Input; namespace osu.Game.Tests.Visual { [TestFixture] - public class TestCaseKeyCounter : OsuTestCase + public class TestCaseKeyCounter : ManualInputManagerTestCase { public override IReadOnlyList RequiredTypes => new[] { @@ -53,16 +52,16 @@ namespace osu.Game.Tests.Visual AddStep($"Press {testKey} key", () => { - rewindTestKeyCounterKeyboard.TriggerOnKeyDown(null, new KeyDownEventArgs { Key = testKey, Repeat = false }); - rewindTestKeyCounterKeyboard.TriggerOnKeyUp(null, new KeyUpEventArgs { Key = testKey }); + InputManager.PressKey(testKey); + InputManager.ReleaseKey(testKey); }); AddAssert($"Check {testKey} counter after keypress", () => rewindTestKeyCounterKeyboard.CountPresses == 1); AddStep($"Press {testKey} key", () => { - rewindTestKeyCounterKeyboard.TriggerOnKeyDown(null, new KeyDownEventArgs { Key = testKey, Repeat = false }); - rewindTestKeyCounterKeyboard.TriggerOnKeyUp(null, new KeyUpEventArgs { Key = testKey }); + InputManager.PressKey(testKey); + InputManager.ReleaseKey(testKey); time1 = Clock.CurrentTime; }); diff --git a/osu.Game/Rulesets/UI/RulesetInputManager.cs b/osu.Game/Rulesets/UI/RulesetInputManager.cs index 7167621291..af1dc98fec 100644 --- a/osu.Game/Rulesets/UI/RulesetInputManager.cs +++ b/osu.Game/Rulesets/UI/RulesetInputManager.cs @@ -1,7 +1,6 @@ // Copyright (c) 2007-2018 ppy Pty Ltd . // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE -using System.Collections.Generic; using System.Linq; using osu.Framework.Allocation; using osu.Framework.Configuration; @@ -10,8 +9,6 @@ using osu.Framework.Graphics.Containers; using osu.Framework.Input; using osu.Framework.Input.Bindings; using osu.Framework.Input.EventArgs; -using osu.Framework.Input.Events; -using osu.Framework.Input.StateChanges; using osu.Framework.Input.StateChanges.Events; using osu.Framework.Input.States; using osu.Framework.Timing; diff --git a/osu.Game/Screens/Play/KeyCounterCollection.cs b/osu.Game/Screens/Play/KeyCounterCollection.cs index 2a737d974b..76c102c840 100644 --- a/osu.Game/Screens/Play/KeyCounterCollection.cs +++ b/osu.Game/Screens/Play/KeyCounterCollection.cs @@ -7,8 +7,7 @@ using osu.Framework.Allocation; using osu.Framework.Configuration; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; -using osu.Framework.Input.EventArgs; -using osu.Framework.Input.States; +using osu.Framework.Input.Events; using osu.Framework.Timing; using osu.Game.Configuration; using OpenTK; @@ -152,13 +151,18 @@ namespace osu.Game.Screens.Play public override bool ReceiveMouseInputAt(Vector2 screenSpacePos) => true; - protected override bool OnKeyDown(InputState state, KeyDownEventArgs args) => Target.Children.Any(c => c.TriggerOnKeyDown(state, args)); - - protected override bool OnKeyUp(InputState state, KeyUpEventArgs args) => Target.Children.Any(c => c.TriggerOnKeyUp(state, args)); - - protected override bool OnMouseDown(InputState state, MouseDownEventArgs args) => Target.Children.Any(c => c.TriggerOnMouseDown(state, args)); - - protected override bool OnMouseUp(InputState state, MouseUpEventArgs args) => Target.Children.Any(c => c.TriggerOnMouseUp(state, args)); + protected override bool Handle(UIEvent e) + { + switch (e) + { + case KeyDownEvent _: + case KeyUpEvent _: + case MouseDownEvent _: + case MouseUpEvent _: + return Target.Children.Any(c => c.TriggerEvent(e)); + } + return base.Handle(e); + } } } } From b790e1621738ee012c580b6e071af29f41d7a2a8 Mon Sep 17 00:00:00 2001 From: ekrctb Date: Tue, 18 Sep 2018 18:05:25 +0900 Subject: [PATCH 117/417] Use Click instead of now removed TriggerOnClick --- osu.Game.Tests/Visual/TestCaseGameplayMenuOverlay.cs | 2 +- osu.Game/Overlays/BeatmapSet/Buttons/PreviewButton.cs | 2 +- osu.Game/Overlays/Dialog/PopupDialog.cs | 6 +++--- osu.Game/Overlays/MainSettings.cs | 2 +- osu.Game/Screens/Menu/ButtonSystem.cs | 8 ++++---- osu.Game/Screens/Play/GameplayMenuOverlay.cs | 2 +- osu.Game/Screens/Play/PauseContainer.cs | 2 +- osu.Game/Screens/Play/SkipOverlay.cs | 2 +- 8 files changed, 13 insertions(+), 13 deletions(-) diff --git a/osu.Game.Tests/Visual/TestCaseGameplayMenuOverlay.cs b/osu.Game.Tests/Visual/TestCaseGameplayMenuOverlay.cs index 0f78315861..417b0f94d7 100644 --- a/osu.Game.Tests/Visual/TestCaseGameplayMenuOverlay.cs +++ b/osu.Game.Tests/Visual/TestCaseGameplayMenuOverlay.cs @@ -228,7 +228,7 @@ namespace osu.Game.Tests.Visual var lastAction = pauseOverlay.OnRetry; pauseOverlay.OnRetry = () => triggered = true; - retryButton.TriggerOnClick(); + retryButton.Click(); pauseOverlay.OnRetry = lastAction; }); diff --git a/osu.Game/Overlays/BeatmapSet/Buttons/PreviewButton.cs b/osu.Game/Overlays/BeatmapSet/Buttons/PreviewButton.cs index 18391c1177..b3072a02d9 100644 --- a/osu.Game/Overlays/BeatmapSet/Buttons/PreviewButton.cs +++ b/osu.Game/Overlays/BeatmapSet/Buttons/PreviewButton.cs @@ -66,7 +66,7 @@ namespace osu.Game.Overlays.BeatmapSet.Buttons }, }; - Action = () => playButton.TriggerOnClick(); + Action = () => playButton.Click(); Playing.ValueChanged += newValue => progress.FadeTo(newValue ? 1 : 0, 100); } diff --git a/osu.Game/Overlays/Dialog/PopupDialog.cs b/osu.Game/Overlays/Dialog/PopupDialog.cs index c9c90b4555..3f79fa98e5 100644 --- a/osu.Game/Overlays/Dialog/PopupDialog.cs +++ b/osu.Game/Overlays/Dialog/PopupDialog.cs @@ -199,7 +199,7 @@ namespace osu.Game.Overlays.Dialog switch (action) { case GlobalAction.Select: - Buttons.OfType().FirstOrDefault()?.TriggerOnClick(); + Buttons.OfType().FirstOrDefault()?.Click(); return true; } @@ -252,7 +252,7 @@ namespace osu.Game.Overlays.Dialog if (!actionInvoked) // In the case a user did not choose an action before a hide was triggered, press the last button. // This is presumed to always be a sane default "cancel" action. - buttonsContainer.Last().TriggerOnClick(); + buttonsContainer.Last().Click(); base.PopOut(); content.FadeOut(EXIT_DURATION, Easing.InSine); @@ -261,7 +261,7 @@ namespace osu.Game.Overlays.Dialog private void pressButtonAtIndex(int index) { if (index < Buttons.Count()) - Buttons.Skip(index).First().TriggerOnClick(); + Buttons.Skip(index).First().Click(); } } } diff --git a/osu.Game/Overlays/MainSettings.cs b/osu.Game/Overlays/MainSettings.cs index 6e8b4494dc..b22904e724 100644 --- a/osu.Game/Overlays/MainSettings.cs +++ b/osu.Game/Overlays/MainSettings.cs @@ -155,7 +155,7 @@ namespace osu.Game.Overlays switch (action) { case GlobalAction.Back: - TriggerOnClick(); + Click(); return true; } diff --git a/osu.Game/Screens/Menu/ButtonSystem.cs b/osu.Game/Screens/Menu/ButtonSystem.cs index b9a799328e..dba0a3ac50 100644 --- a/osu.Game/Screens/Menu/ButtonSystem.cs +++ b/osu.Game/Screens/Menu/ButtonSystem.cs @@ -115,7 +115,7 @@ namespace osu.Game.Screens.Menu case GlobalAction.Back: return goBack(); case GlobalAction.Select: - logo?.TriggerOnClick(); + logo?.Click(); return true; default: return false; @@ -133,7 +133,7 @@ namespace osu.Game.Screens.Menu sampleBack?.Play(); return true; case ButtonSystemState.Play: - backButton.TriggerOnClick(); + backButton.Click(); return true; default: return false; @@ -150,10 +150,10 @@ namespace osu.Game.Screens.Menu State = ButtonSystemState.TopLevel; return true; case ButtonSystemState.TopLevel: - buttonsTopLevel.First().TriggerOnClick(); + buttonsTopLevel.First().Click(); return false; case ButtonSystemState.Play: - buttonsPlay.First().TriggerOnClick(); + buttonsPlay.First().Click(); return false; } } diff --git a/osu.Game/Screens/Play/GameplayMenuOverlay.cs b/osu.Game/Screens/Play/GameplayMenuOverlay.cs index 1ca3bc2189..f50b3e9661 100644 --- a/osu.Game/Screens/Play/GameplayMenuOverlay.cs +++ b/osu.Game/Screens/Play/GameplayMenuOverlay.cs @@ -38,7 +38,7 @@ namespace osu.Game.Screens.Play /// /// Action that is invoked when is triggered. /// - protected virtual Action BackAction => () => InternalButtons.Children.Last().TriggerOnClick(); + protected virtual Action BackAction => () => InternalButtons.Children.Last().Click(); public abstract string Header { get; } public abstract string Description { get; } diff --git a/osu.Game/Screens/Play/PauseContainer.cs b/osu.Game/Screens/Play/PauseContainer.cs index d9677e5daf..25e701294a 100644 --- a/osu.Game/Screens/Play/PauseContainer.cs +++ b/osu.Game/Screens/Play/PauseContainer.cs @@ -132,7 +132,7 @@ namespace osu.Game.Screens.Play public override string Header => "paused"; public override string Description => "you're not going to do what i think you're going to do, are ya?"; - protected override Action BackAction => () => InternalButtons.Children.First().TriggerOnClick(); + protected override Action BackAction => () => InternalButtons.Children.First().Click(); [BackgroundDependencyLoader] private void load(OsuColour colours) diff --git a/osu.Game/Screens/Play/SkipOverlay.cs b/osu.Game/Screens/Play/SkipOverlay.cs index 06837c9274..046a00d79b 100644 --- a/osu.Game/Screens/Play/SkipOverlay.cs +++ b/osu.Game/Screens/Play/SkipOverlay.cs @@ -141,7 +141,7 @@ namespace osu.Game.Screens.Play switch (action) { case GlobalAction.SkipCutscene: - button.TriggerOnClick(); + button.Click(); return true; } From 28f31540c48896830f5128ea914e64d97e08db0b Mon Sep 17 00:00:00 2001 From: smoogipoo Date: Wed, 19 Sep 2018 14:07:46 +0900 Subject: [PATCH 118/417] Apply changes in-line with framework localisation changes --- osu.Game/Overlays/Direct/DirectGridPanel.cs | 8 ++++---- osu.Game/Overlays/Direct/DirectListPanel.cs | 8 ++++---- osu.Game/Overlays/KeyBinding/KeyBindingRow.cs | 2 +- osu.Game/Overlays/Music/PlaylistItem.cs | 13 ++++++------- osu.Game/Overlays/MusicController.cs | 11 +++-------- .../Profile/Sections/BeatmapMetadataContainer.cs | 10 ++++------ osu.Game/Screens/Multi/Components/BeatmapTitle.cs | 14 ++------------ osu.Game/Screens/Play/PlayerLoader.cs | 6 +++--- osu.Game/Screens/Ranking/ResultsPageScore.cs | 8 ++++---- osu.Game/Screens/Select/BeatmapInfoWedge.cs | 10 +++++----- .../Select/Carousel/DrawableCarouselBeatmapSet.cs | 9 +++------ 11 files changed, 39 insertions(+), 60 deletions(-) diff --git a/osu.Game/Overlays/Direct/DirectGridPanel.cs b/osu.Game/Overlays/Direct/DirectGridPanel.cs index eb940bff60..fbbfbe5d01 100644 --- a/osu.Game/Overlays/Direct/DirectGridPanel.cs +++ b/osu.Game/Overlays/Direct/DirectGridPanel.cs @@ -7,11 +7,11 @@ using osu.Framework.Allocation; using osu.Framework.Extensions.Color4Extensions; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; -using osu.Framework.Localisation; using osu.Game.Graphics; using osu.Game.Graphics.Sprites; using osu.Framework.Graphics.Shapes; using osu.Framework.Input.States; +using osu.Framework.Localisation; using osu.Game.Beatmaps; using osu.Game.Beatmaps.Drawables; @@ -44,7 +44,7 @@ namespace osu.Game.Overlays.Direct } [BackgroundDependencyLoader] - private void load(OsuColour colours, LocalisationEngine localisation) + private void load(OsuColour colours) { Content.CornerRadius = 4; @@ -74,13 +74,13 @@ namespace osu.Game.Overlays.Direct { new OsuSpriteText { - Text = localisation.GetUnicodePreference(SetInfo.Metadata.TitleUnicode, SetInfo.Metadata.Title), + Text = new LocalisedString((SetInfo.Metadata.TitleUnicode, SetInfo.Metadata.Title)), TextSize = 18, Font = @"Exo2.0-BoldItalic", }, new OsuSpriteText { - Text = localisation.GetUnicodePreference(SetInfo.Metadata.ArtistUnicode, SetInfo.Metadata.Artist), + Text = new LocalisedString((SetInfo.Metadata.ArtistUnicode, SetInfo.Metadata.Artist)), Font = @"Exo2.0-BoldItalic", }, }, diff --git a/osu.Game/Overlays/Direct/DirectListPanel.cs b/osu.Game/Overlays/Direct/DirectListPanel.cs index 850ead37f6..6cb5ebad4e 100644 --- a/osu.Game/Overlays/Direct/DirectListPanel.cs +++ b/osu.Game/Overlays/Direct/DirectListPanel.cs @@ -10,8 +10,8 @@ using osu.Framework.Graphics.Colour; using osu.Game.Graphics; using osu.Game.Graphics.Sprites; using osu.Framework.Allocation; -using osu.Framework.Localisation; using osu.Framework.Graphics.Shapes; +using osu.Framework.Localisation; using osu.Game.Beatmaps; namespace osu.Game.Overlays.Direct @@ -39,7 +39,7 @@ namespace osu.Game.Overlays.Direct } [BackgroundDependencyLoader] - private void load(LocalisationEngine localisation, OsuColour colours) + private void load(OsuColour colours) { Content.CornerRadius = 5; @@ -94,13 +94,13 @@ namespace osu.Game.Overlays.Direct { new OsuSpriteText { - Current = localisation.GetUnicodePreference(SetInfo.Metadata.TitleUnicode, SetInfo.Metadata.Title), + Text = new LocalisedString((SetInfo.Metadata.TitleUnicode, SetInfo.Metadata.Title)), TextSize = 18, Font = @"Exo2.0-BoldItalic", }, new OsuSpriteText { - Current = localisation.GetUnicodePreference(SetInfo.Metadata.ArtistUnicode, SetInfo.Metadata.Artist), + Text = new LocalisedString((SetInfo.Metadata.ArtistUnicode, SetInfo.Metadata.Artist)), Font = @"Exo2.0-BoldItalic", }, } diff --git a/osu.Game/Overlays/KeyBinding/KeyBindingRow.cs b/osu.Game/Overlays/KeyBinding/KeyBindingRow.cs index 86baaf3905..d480bedc5e 100644 --- a/osu.Game/Overlays/KeyBinding/KeyBindingRow.cs +++ b/osu.Game/Overlays/KeyBinding/KeyBindingRow.cs @@ -50,7 +50,7 @@ namespace osu.Game.Overlays.KeyBinding private FillFlowContainer buttons; - public IEnumerable FilterTerms => bindings.Select(b => b.KeyCombination.ReadableString()).Prepend(text.Text); + public IEnumerable FilterTerms => bindings.Select(b => b.KeyCombination.ReadableString()).Prepend((string)text.Text); public KeyBindingRow(object action, IEnumerable bindings) { diff --git a/osu.Game/Overlays/Music/PlaylistItem.cs b/osu.Game/Overlays/Music/PlaylistItem.cs index 62c9020160..ee3f22290b 100644 --- a/osu.Game/Overlays/Music/PlaylistItem.cs +++ b/osu.Game/Overlays/Music/PlaylistItem.cs @@ -28,8 +28,8 @@ namespace osu.Game.Overlays.Music private SpriteIcon handle; private TextFlowContainer text; private IEnumerable titleSprites; - private UnicodeBindableString titleBind; - private UnicodeBindableString artistBind; + private ILocalisedBindableString titleBind; + private ILocalisedBindableString artistBind; public readonly BeatmapSetInfo BeatmapSetInfo; @@ -74,7 +74,7 @@ namespace osu.Game.Overlays.Music } [BackgroundDependencyLoader] - private void load(OsuColour colours, LocalisationEngine localisation) + private void load(OsuColour colours, LocalisationManager localisation) { hoverColour = colours.Yellow; artistColour = colours.Gray9; @@ -97,11 +97,10 @@ namespace osu.Game.Overlays.Music }, }; - titleBind = localisation.GetUnicodePreference(metadata.TitleUnicode, metadata.Title); - artistBind = localisation.GetUnicodePreference(metadata.ArtistUnicode, metadata.Artist); + titleBind = localisation.GetLocalisedString(new LocalisedString((metadata.TitleUnicode, metadata.Title))); + artistBind = localisation.GetLocalisedString(new LocalisedString((metadata.ArtistUnicode, metadata.Artist))); - artistBind.ValueChanged += newText => recreateText(); - artistBind.TriggerChange(); + artistBind.BindValueChanged(newText => recreateText(), true); } private void recreateText() diff --git a/osu.Game/Overlays/MusicController.cs b/osu.Game/Overlays/MusicController.cs index 886b5fb95b..5cccb2b0aa 100644 --- a/osu.Game/Overlays/MusicController.cs +++ b/osu.Game/Overlays/MusicController.cs @@ -47,7 +47,6 @@ namespace osu.Game.Overlays private PlaylistOverlay playlist; private BeatmapManager beatmaps; - private LocalisationEngine localisation; private List beatmapSets; private BeatmapSetInfo currentSet; @@ -67,11 +66,10 @@ namespace osu.Game.Overlays } [BackgroundDependencyLoader] - private void load(BindableBeatmap beatmap, BeatmapManager beatmaps, OsuColour colours, LocalisationEngine localisation) + private void load(BindableBeatmap beatmap, BeatmapManager beatmaps, OsuColour colours) { this.beatmap.BindTo(beatmap); this.beatmaps = beatmaps; - this.localisation = localisation; Children = new Drawable[] { @@ -351,17 +349,14 @@ namespace osu.Game.Overlays { if (beatmap?.Beatmap == null) //this is not needed if a placeholder exists { - title.Current = null; title.Text = @"Nothing to play"; - - artist.Current = null; artist.Text = @"Nothing to play"; } else { BeatmapMetadata metadata = beatmap.Metadata; - title.Current = localisation.GetUnicodePreference(metadata.TitleUnicode, metadata.Title); - artist.Current = localisation.GetUnicodePreference(metadata.ArtistUnicode, metadata.Artist); + title.Text = new LocalisedString((metadata.TitleUnicode, metadata.Title)); + artist.Text = new LocalisedString((metadata.ArtistUnicode, metadata.Artist)); } }); diff --git a/osu.Game/Overlays/Profile/Sections/BeatmapMetadataContainer.cs b/osu.Game/Overlays/Profile/Sections/BeatmapMetadataContainer.cs index 1a1f13933d..4278598bf5 100644 --- a/osu.Game/Overlays/Profile/Sections/BeatmapMetadataContainer.cs +++ b/osu.Game/Overlays/Profile/Sections/BeatmapMetadataContainer.cs @@ -29,7 +29,7 @@ namespace osu.Game.Overlays.Profile.Sections public string TooltipText { get; } [BackgroundDependencyLoader(true)] - private void load(LocalisationEngine locale, BeatmapSetOverlay beatmapSetOverlay) + private void load(BeatmapSetOverlay beatmapSetOverlay) { Action = () => { @@ -46,16 +46,14 @@ namespace osu.Game.Overlays.Profile.Sections { new OsuSpriteText { - Current = locale.GetUnicodePreference( - $"{beatmap.Metadata.TitleUnicode ?? beatmap.Metadata.Title} [{beatmap.Version}] ", - $"{beatmap.Metadata.Title ?? beatmap.Metadata.TitleUnicode} [{beatmap.Version}] " - ), + Text = new LocalisedString(($"{beatmap.Metadata.TitleUnicode ?? beatmap.Metadata.Title} [{beatmap.Version}] ", + $"{beatmap.Metadata.Title ?? beatmap.Metadata.TitleUnicode} [{beatmap.Version}] ")), TextSize = 15, Font = "Exo2.0-SemiBoldItalic", }, new OsuSpriteText { - Current = locale.GetUnicodePreference(beatmap.Metadata.ArtistUnicode, beatmap.Metadata.Artist), + Text = new LocalisedString((beatmap.Metadata.ArtistUnicode, beatmap.Metadata.Artist)), TextSize = 12, Padding = new MarginPadding { Top = 3 }, Font = "Exo2.0-RegularItalic", diff --git a/osu.Game/Screens/Multi/Components/BeatmapTitle.cs b/osu.Game/Screens/Multi/Components/BeatmapTitle.cs index 42863754c5..6dc59f5cac 100644 --- a/osu.Game/Screens/Multi/Components/BeatmapTitle.cs +++ b/osu.Game/Screens/Multi/Components/BeatmapTitle.cs @@ -1,7 +1,6 @@ // Copyright (c) 2007-2018 ppy Pty Ltd . // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE -using osu.Framework.Allocation; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Framework.Localisation; @@ -14,8 +13,6 @@ namespace osu.Game.Screens.Multi.Components { private readonly OsuSpriteText beatmapTitle, beatmapDash, beatmapArtist; - private LocalisationEngine localisation; - public float TextSize { set { beatmapTitle.TextSize = beatmapDash.TextSize = beatmapArtist.TextSize = value; } @@ -48,12 +45,6 @@ namespace osu.Game.Screens.Multi.Components }; } - [BackgroundDependencyLoader] - private void load(LocalisationEngine localisation) - { - this.localisation = localisation; - } - protected override void LoadComplete() { base.LoadComplete(); @@ -64,15 +55,14 @@ namespace osu.Game.Screens.Multi.Components { if (beatmap == null) { - beatmapTitle.Current = beatmapArtist.Current = null; beatmapTitle.Text = "Changing map"; beatmapDash.Text = beatmapArtist.Text = string.Empty; } else { - beatmapTitle.Current = localisation.GetUnicodePreference(beatmap.Metadata.TitleUnicode, beatmap.Metadata.Title); + beatmapTitle.Text = new LocalisedString((beatmap.Metadata.TitleUnicode, beatmap.Metadata.Title)); beatmapDash.Text = @" - "; - beatmapArtist.Current = localisation.GetUnicodePreference(beatmap.Metadata.ArtistUnicode, beatmap.Metadata.Artist); + beatmapArtist.Text = new LocalisedString((beatmap.Metadata.ArtistUnicode, beatmap.Metadata.Artist)); } } } diff --git a/osu.Game/Screens/Play/PlayerLoader.cs b/osu.Game/Screens/Play/PlayerLoader.cs index fd4322c268..05a43b32f0 100644 --- a/osu.Game/Screens/Play/PlayerLoader.cs +++ b/osu.Game/Screens/Play/PlayerLoader.cs @@ -290,7 +290,7 @@ namespace osu.Game.Screens.Play } [BackgroundDependencyLoader] - private void load(LocalisationEngine localisation) + private void load() { var metadata = beatmap?.BeatmapInfo?.Metadata ?? new BeatmapMetadata(); @@ -307,7 +307,7 @@ namespace osu.Game.Screens.Play { new OsuSpriteText { - Current = localisation.GetUnicodePreference(metadata.TitleUnicode, metadata.Title), + Text = new LocalisedString((metadata.TitleUnicode, metadata.Title)), TextSize = 36, Font = @"Exo2.0-MediumItalic", Origin = Anchor.TopCentre, @@ -315,7 +315,7 @@ namespace osu.Game.Screens.Play }, new OsuSpriteText { - Current = localisation.GetUnicodePreference(metadata.ArtistUnicode, metadata.Artist), + Text = new LocalisedString((metadata.ArtistUnicode, metadata.Artist)), TextSize = 26, Font = @"Exo2.0-MediumItalic", Origin = Anchor.TopCentre, diff --git a/osu.Game/Screens/Ranking/ResultsPageScore.cs b/osu.Game/Screens/Ranking/ResultsPageScore.cs index 040458e0eb..58c9cde9c7 100644 --- a/osu.Game/Screens/Ranking/ResultsPageScore.cs +++ b/osu.Game/Screens/Ranking/ResultsPageScore.cs @@ -13,7 +13,6 @@ using osu.Framework.Graphics.Colour; using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Sprites; using osu.Framework.Graphics.Textures; -using osu.Framework.Localisation; using osu.Game.Beatmaps; using osu.Game.Graphics; using osu.Game.Graphics.Sprites; @@ -24,6 +23,7 @@ using osu.Game.Screens.Select.Leaderboards; using osu.Game.Users; using osu.Framework.Graphics.Shapes; using osu.Framework.Extensions; +using osu.Framework.Localisation; namespace osu.Game.Screens.Ranking { @@ -328,7 +328,7 @@ namespace osu.Game.Screens.Ranking } [BackgroundDependencyLoader] - private void load(OsuColour colours, LocalisationEngine localisation) + private void load(OsuColour colours) { title.Colour = artist.Colour = colours.BlueDarker; versionMapper.Colour = colours.Gray8; @@ -341,8 +341,8 @@ namespace osu.Game.Screens.Ranking versionMapper.Text = $"{beatmap.Version} - " + versionMapper.Text; } - title.Current = localisation.GetUnicodePreference(beatmap.Metadata.TitleUnicode, beatmap.Metadata.Title); - artist.Current = localisation.GetUnicodePreference(beatmap.Metadata.ArtistUnicode, beatmap.Metadata.Artist); + title.Text = new LocalisedString((beatmap.Metadata.TitleUnicode, beatmap.Metadata.Title)); + artist.Text = new LocalisedString((beatmap.Metadata.ArtistUnicode, beatmap.Metadata.Artist)); } } diff --git a/osu.Game/Screens/Select/BeatmapInfoWedge.cs b/osu.Game/Screens/Select/BeatmapInfoWedge.cs index ae5134c0da..c172cbc506 100644 --- a/osu.Game/Screens/Select/BeatmapInfoWedge.cs +++ b/osu.Game/Screens/Select/BeatmapInfoWedge.cs @@ -131,8 +131,8 @@ namespace osu.Game.Screens.Select public FillFlowContainer MapperContainer { get; private set; } public FillFlowContainer InfoLabelContainer { get; private set; } - private UnicodeBindableString titleBinding; - private UnicodeBindableString artistBinding; + private ILocalisedBindableString titleBinding; + private ILocalisedBindableString artistBinding; private readonly WorkingBeatmap beatmap; private readonly RulesetInfo ruleset; @@ -144,7 +144,7 @@ namespace osu.Game.Screens.Select } [BackgroundDependencyLoader] - private void load(LocalisationEngine localisation) + private void load(LocalisationManager localisation) { var beatmapInfo = beatmap.BeatmapInfo; var metadata = beatmapInfo.Metadata ?? beatmap.BeatmapSetInfo?.Metadata ?? new BeatmapMetadata(); @@ -153,8 +153,8 @@ namespace osu.Game.Screens.Select CacheDrawnFrameBuffer = true; RelativeSizeAxes = Axes.Both; - titleBinding = localisation.GetUnicodePreference(metadata.TitleUnicode, metadata.Title); - artistBinding = localisation.GetUnicodePreference(metadata.ArtistUnicode, metadata.Artist); + titleBinding = localisation.GetLocalisedString(new LocalisedString((metadata.TitleUnicode, metadata.Title))); + artistBinding = localisation.GetLocalisedString(new LocalisedString((metadata.ArtistUnicode, metadata.Artist))); Children = new Drawable[] { diff --git a/osu.Game/Screens/Select/Carousel/DrawableCarouselBeatmapSet.cs b/osu.Game/Screens/Select/Carousel/DrawableCarouselBeatmapSet.cs index 52d34a935f..2f943300fe 100644 --- a/osu.Game/Screens/Select/Carousel/DrawableCarouselBeatmapSet.cs +++ b/osu.Game/Screens/Select/Carousel/DrawableCarouselBeatmapSet.cs @@ -38,11 +38,8 @@ namespace osu.Game.Screens.Select.Carousel } [BackgroundDependencyLoader(true)] - private void load(LocalisationEngine localisation, BeatmapManager manager, BeatmapSetOverlay beatmapOverlay, DialogOverlay overlay) + private void load(BeatmapManager manager, BeatmapSetOverlay beatmapOverlay, DialogOverlay overlay) { - if (localisation == null) - throw new ArgumentNullException(nameof(localisation)); - restoreHiddenRequested = s => s.Beatmaps.ForEach(manager.Restore); dialogOverlay = overlay; if (beatmapOverlay != null) @@ -67,14 +64,14 @@ namespace osu.Game.Screens.Select.Carousel new OsuSpriteText { Font = @"Exo2.0-BoldItalic", - Current = localisation.GetUnicodePreference(beatmapSet.Metadata.TitleUnicode, beatmapSet.Metadata.Title), + Text = new LocalisedString((beatmapSet.Metadata.TitleUnicode, beatmapSet.Metadata.Title)), TextSize = 22, Shadow = true, }, new OsuSpriteText { Font = @"Exo2.0-SemiBoldItalic", - Current = localisation.GetUnicodePreference(beatmapSet.Metadata.ArtistUnicode, beatmapSet.Metadata.Artist), + Text = new LocalisedString((beatmapSet.Metadata.ArtistUnicode, beatmapSet.Metadata.Artist)), TextSize = 17, Shadow = true, }, From 38a3c2a82076dbe2ecb0b05b4bb24033ee3e5e29 Mon Sep 17 00:00:00 2001 From: smoogipoo Date: Wed, 19 Sep 2018 14:57:32 +0900 Subject: [PATCH 119/417] Fix song select wedge sometimes not updating when localisation changes --- osu.Game/Screens/Select/BeatmapInfoWedge.cs | 2 ++ 1 file changed, 2 insertions(+) diff --git a/osu.Game/Screens/Select/BeatmapInfoWedge.cs b/osu.Game/Screens/Select/BeatmapInfoWedge.cs index ae5134c0da..44622fa845 100644 --- a/osu.Game/Screens/Select/BeatmapInfoWedge.cs +++ b/osu.Game/Screens/Select/BeatmapInfoWedge.cs @@ -261,6 +261,8 @@ namespace osu.Game.Screens.Select } } }; + + titleBinding.BindValueChanged(value => setMetadata(metadata.Source)); artistBinding.BindValueChanged(value => setMetadata(metadata.Source), true); // no difficulty means it can't have a status to show From 73fb3fa3a4070bc407361d2fedd1503e762b9b4b Mon Sep 17 00:00:00 2001 From: smoogipoo Date: Wed, 19 Sep 2018 17:52:35 +0900 Subject: [PATCH 120/417] Fix macOS crashing in fullscreen mode --- .../Sections/Graphics/LayoutSettings.cs | 45 ++++++++++++------- 1 file changed, 29 insertions(+), 16 deletions(-) diff --git a/osu.Game/Overlays/Settings/Sections/Graphics/LayoutSettings.cs b/osu.Game/Overlays/Settings/Sections/Graphics/LayoutSettings.cs index 4a8164c6df..013204561b 100644 --- a/osu.Game/Overlays/Settings/Sections/Graphics/LayoutSettings.cs +++ b/osu.Game/Overlays/Settings/Sections/Graphics/LayoutSettings.cs @@ -35,6 +35,8 @@ namespace osu.Game.Overlays.Settings.Sections.Graphics letterboxing = config.GetBindable(FrameworkSetting.Letterboxing); sizeFullscreen = config.GetBindable(FrameworkSetting.SizeFullscreen); + Container resolutionSettingsContainer; + Children = new Drawable[] { windowModeDropdown = new SettingsEnumDropdown @@ -42,13 +44,12 @@ namespace osu.Game.Overlays.Settings.Sections.Graphics LabelText = "Screen mode", Bindable = config.GetBindable(FrameworkSetting.WindowMode), }, - resolutionDropdown = new SettingsDropdown + resolutionSettingsContainer = new Container { - LabelText = "Resolution", - ShowsDefaultIndicator = false, - Items = getResolutions(), - Bindable = sizeFullscreen + RelativeSizeAxes = Axes.X, + AutoSizeAxes = Axes.Y }, + new SettingsCheckbox { LabelText = "Letterboxing", @@ -81,16 +82,28 @@ namespace osu.Game.Overlays.Settings.Sections.Graphics }, }; - windowModeDropdown.Bindable.BindValueChanged(windowMode => + var resolutions = getResolutions(); + if (resolutions.Count > 1) { - if (windowMode == WindowMode.Fullscreen) + resolutionSettingsContainer.Child = resolutionDropdown = new SettingsDropdown { - resolutionDropdown.Show(); - sizeFullscreen.TriggerChange(); - } - else - resolutionDropdown.Hide(); - }, true); + LabelText = "Resolution", + ShowsDefaultIndicator = false, + Items = getResolutions(), + Bindable = sizeFullscreen + }; + + windowModeDropdown.Bindable.BindValueChanged(windowMode => + { + if (windowMode == WindowMode.Fullscreen) + { + resolutionDropdown.Show(); + sizeFullscreen.TriggerChange(); + } + else + resolutionDropdown.Hide(); + }); + } letterboxing.BindValueChanged(isVisible => { @@ -102,7 +115,7 @@ namespace osu.Game.Overlays.Settings.Sections.Graphics }, true); } - private IEnumerable> getResolutions() + private IReadOnlyList> getResolutions() { var resolutions = new KeyValuePair("Default", new Size(9999, 9999)).Yield(); @@ -112,8 +125,8 @@ namespace osu.Game.Overlays.Settings.Sections.Graphics .OrderByDescending(r => r.Width) .ThenByDescending(r => r.Height) .Select(res => new KeyValuePair($"{res.Width}x{res.Height}", new Size(res.Width, res.Height))) - .Distinct()).ToList(); - return resolutions; + .Distinct()); + return resolutions.ToList(); } } } From e7d78b94ae1d9700bd80a9844516c3db5c73a6dc Mon Sep 17 00:00:00 2001 From: Hanamuke Date: Wed, 19 Sep 2018 18:30:25 +0200 Subject: [PATCH 121/417] Remove ScrollingVisualisation from settings --- osu.Game.Rulesets.Catch/UI/CatchPlayfield.cs | 3 ++ osu.Game.Rulesets.Taiko/UI/TaikoPlayfield.cs | 29 ++++++++++--------- osu.Game/Configuration/OsuConfigManager.cs | 3 -- .../Sections/Gameplay/ScrollingSettings.cs | 26 ----------------- .../Settings/Sections/GameplaySection.cs | 3 +- .../Scrolling/ScrollingHitObjectContainer.cs | 12 +++----- .../UI/Scrolling/ScrollingPlayfield.cs | 5 +++- 7 files changed, 28 insertions(+), 53 deletions(-) delete mode 100644 osu.Game/Overlays/Settings/Sections/Gameplay/ScrollingSettings.cs diff --git a/osu.Game.Rulesets.Catch/UI/CatchPlayfield.cs b/osu.Game.Rulesets.Catch/UI/CatchPlayfield.cs index 85e14eaad0..dd5cb3c15a 100644 --- a/osu.Game.Rulesets.Catch/UI/CatchPlayfield.cs +++ b/osu.Game.Rulesets.Catch/UI/CatchPlayfield.cs @@ -5,6 +5,7 @@ using System; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Game.Beatmaps; +using osu.Game.Configuration; using osu.Game.Rulesets.Catch.Objects; using osu.Game.Rulesets.Catch.Objects.Drawable; using osu.Game.Rulesets.Judgements; @@ -24,6 +25,8 @@ namespace osu.Game.Rulesets.Catch.UI protected override bool UserScrollSpeedAdjustment => false; + protected override SpeedChangeVisualisationMethod visualisationMethod => SpeedChangeVisualisationMethod.Constant; + public CatchPlayfield(BeatmapDifficulty difficulty, Func> getVisualRepresentation) : base(BASE_WIDTH) { diff --git a/osu.Game.Rulesets.Taiko/UI/TaikoPlayfield.cs b/osu.Game.Rulesets.Taiko/UI/TaikoPlayfield.cs index 325beb38a5..f5b3049302 100644 --- a/osu.Game.Rulesets.Taiko/UI/TaikoPlayfield.cs +++ b/osu.Game.Rulesets.Taiko/UI/TaikoPlayfield.cs @@ -1,23 +1,24 @@ // Copyright (c) 2007-2018 ppy Pty Ltd . // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE -using osu.Framework.Allocation; -using osu.Framework.Graphics; -using osu.Framework.Graphics.Shapes; -using osu.Game.Rulesets.Taiko.Objects; -using OpenTK; -using OpenTK.Graphics; -using osu.Game.Rulesets.Taiko.Judgements; -using osu.Game.Rulesets.Objects.Drawables; -using osu.Game.Graphics; -using osu.Framework.Graphics.Containers; -using osu.Framework.Extensions.Color4Extensions; using System.Linq; -using osu.Game.Rulesets.Judgements; -using osu.Game.Rulesets.Taiko.Objects.Drawables; +using osu.Framework.Allocation; +using osu.Framework.Extensions.Color4Extensions; +using osu.Framework.Graphics; +using osu.Framework.Graphics.Containers; +using osu.Framework.Graphics.Shapes; using osu.Game.Beatmaps.ControlPoints; +using osu.Game.Configuration; +using osu.Game.Graphics; +using osu.Game.Rulesets.Objects.Drawables; +using osu.Game.Rulesets.Judgements; using osu.Game.Rulesets.UI; using osu.Game.Rulesets.UI.Scrolling; +using osu.Game.Rulesets.Taiko.Objects; +using osu.Game.Rulesets.Taiko.Objects.Drawables; +using osu.Game.Rulesets.Taiko.Judgements; +using OpenTK; +using OpenTK.Graphics; namespace osu.Game.Rulesets.Taiko.UI { @@ -40,6 +41,8 @@ namespace osu.Game.Rulesets.Taiko.UI protected override bool UserScrollSpeedAdjustment => false; + protected override SpeedChangeVisualisationMethod visualisationMethod => SpeedChangeVisualisationMethod.Overlapping; + private readonly Container hitExplosionContainer; private readonly Container kiaiExplosionContainer; private readonly JudgementContainer judgementContainer; diff --git a/osu.Game/Configuration/OsuConfigManager.cs b/osu.Game/Configuration/OsuConfigManager.cs index f7fe424aa9..9ac2cabe9f 100644 --- a/osu.Game/Configuration/OsuConfigManager.cs +++ b/osu.Game/Configuration/OsuConfigManager.cs @@ -83,8 +83,6 @@ namespace osu.Game.Configuration Set(OsuSetting.ScoreDisplayMode, ScoringMode.Standardised); - Set(OsuSetting.SpeedChangeVisualisation, SpeedChangeVisualisationMethod.Sequential); - Set(OsuSetting.IncreaseFirstObjectVisibility, true); // Update @@ -143,7 +141,6 @@ namespace osu.Game.Configuration ChatDisplayHeight, Version, ShowConvertedBeatmaps, - SpeedChangeVisualisation, Skin, ScreenshotFormat, ScreenshotCaptureMenuCursor, diff --git a/osu.Game/Overlays/Settings/Sections/Gameplay/ScrollingSettings.cs b/osu.Game/Overlays/Settings/Sections/Gameplay/ScrollingSettings.cs deleted file mode 100644 index 0e661aeba6..0000000000 --- a/osu.Game/Overlays/Settings/Sections/Gameplay/ScrollingSettings.cs +++ /dev/null @@ -1,26 +0,0 @@ -// Copyright (c) 2007-2018 ppy Pty Ltd . -// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE - -using osu.Framework.Allocation; -using osu.Game.Configuration; - -namespace osu.Game.Overlays.Settings.Sections.Gameplay -{ - public class ScrollingSettings : SettingsSubsection - { - protected override string Header => "Scrolling"; - - [BackgroundDependencyLoader] - private void load(OsuConfigManager config) - { - Children = new[] - { - new SettingsEnumDropdown - { - LabelText = "Visualise speed changes as", - Bindable = config.GetBindable(OsuSetting.SpeedChangeVisualisation), - } - }; - } - } -} diff --git a/osu.Game/Overlays/Settings/Sections/GameplaySection.cs b/osu.Game/Overlays/Settings/Sections/GameplaySection.cs index 8add0b01ec..f565ff8556 100644 --- a/osu.Game/Overlays/Settings/Sections/GameplaySection.cs +++ b/osu.Game/Overlays/Settings/Sections/GameplaySection.cs @@ -21,7 +21,6 @@ namespace osu.Game.Overlays.Settings.Sections { new GeneralSettings(), new SongSelectSettings(), - new ScrollingSettings(), new ModsSettings(), }; } @@ -29,7 +28,7 @@ namespace osu.Game.Overlays.Settings.Sections [BackgroundDependencyLoader] private void load(RulesetStore rulesets) { - foreach(Ruleset ruleset in rulesets.AvailableRulesets.Select(info => info.CreateInstance())) + foreach (Ruleset ruleset in rulesets.AvailableRulesets.Select(info => info.CreateInstance())) { SettingsSubsection section = ruleset.CreateSettings(); if (section != null) diff --git a/osu.Game/Rulesets/UI/Scrolling/ScrollingHitObjectContainer.cs b/osu.Game/Rulesets/UI/Scrolling/ScrollingHitObjectContainer.cs index 3ce1ab9960..9762739ab0 100644 --- a/osu.Game/Rulesets/UI/Scrolling/ScrollingHitObjectContainer.cs +++ b/osu.Game/Rulesets/UI/Scrolling/ScrollingHitObjectContainer.cs @@ -33,20 +33,14 @@ namespace osu.Game.Rulesets.UI.Scrolling private Cached initialStateCache = new Cached(); - public ScrollingHitObjectContainer() + public ScrollingHitObjectContainer(SpeedChangeVisualisationMethod visualisationMethod) { RelativeSizeAxes = Axes.Both; TimeRange.ValueChanged += _ => initialStateCache.Invalidate(); Direction.ValueChanged += _ => initialStateCache.Invalidate(); - } - private ISpeedChangeVisualiser speedChangeVisualiser; - - [BackgroundDependencyLoader] - private void load(OsuConfigManager config) - { - switch (config.Get(OsuSetting.SpeedChangeVisualisation)) + switch (visualisationMethod) { case SpeedChangeVisualisationMethod.Sequential: speedChangeVisualiser = new SequentialSpeedChangeVisualiser(ControlPoints); @@ -60,6 +54,8 @@ namespace osu.Game.Rulesets.UI.Scrolling } } + private ISpeedChangeVisualiser speedChangeVisualiser; + public override void Add(DrawableHitObject hitObject) { initialStateCache.Invalidate(); diff --git a/osu.Game/Rulesets/UI/Scrolling/ScrollingPlayfield.cs b/osu.Game/Rulesets/UI/Scrolling/ScrollingPlayfield.cs index ec73c0fb14..e446c90f75 100644 --- a/osu.Game/Rulesets/UI/Scrolling/ScrollingPlayfield.cs +++ b/osu.Game/Rulesets/UI/Scrolling/ScrollingPlayfield.cs @@ -5,6 +5,7 @@ using osu.Framework.Allocation; using osu.Framework.Configuration; using osu.Framework.Graphics; using osu.Framework.Input.Bindings; +using osu.Game.Configuration; using osu.Game.Input.Bindings; using osu.Game.Rulesets.Objects.Drawables; @@ -62,6 +63,8 @@ namespace osu.Game.Rulesets.UI.Scrolling /// protected readonly Bindable Direction = new Bindable(); + protected virtual SpeedChangeVisualisationMethod visualisationMethod => SpeedChangeVisualisationMethod.Sequential; + /// /// Creates a new . /// @@ -104,7 +107,7 @@ namespace osu.Game.Rulesets.UI.Scrolling protected sealed override HitObjectContainer CreateHitObjectContainer() { - var container = new ScrollingHitObjectContainer(); + var container = new ScrollingHitObjectContainer(visualisationMethod); container.Direction.BindTo(Direction); return container; } From 309d8c8cb4c55fafd76e046bd21d38d07be9ab8b Mon Sep 17 00:00:00 2001 From: Hanamuke Date: Wed, 19 Sep 2018 18:43:39 +0200 Subject: [PATCH 122/417] CI --- osu.Game.Rulesets.Catch/UI/CatchPlayfield.cs | 2 +- osu.Game.Rulesets.Taiko/UI/TaikoPlayfield.cs | 2 +- osu.Game/Rulesets/UI/Scrolling/ScrollingHitObjectContainer.cs | 3 +-- osu.Game/Rulesets/UI/Scrolling/ScrollingPlayfield.cs | 4 ++-- 4 files changed, 5 insertions(+), 6 deletions(-) diff --git a/osu.Game.Rulesets.Catch/UI/CatchPlayfield.cs b/osu.Game.Rulesets.Catch/UI/CatchPlayfield.cs index dd5cb3c15a..a65079c590 100644 --- a/osu.Game.Rulesets.Catch/UI/CatchPlayfield.cs +++ b/osu.Game.Rulesets.Catch/UI/CatchPlayfield.cs @@ -25,7 +25,7 @@ namespace osu.Game.Rulesets.Catch.UI protected override bool UserScrollSpeedAdjustment => false; - protected override SpeedChangeVisualisationMethod visualisationMethod => SpeedChangeVisualisationMethod.Constant; + protected override SpeedChangeVisualisationMethod VisualisationMethod => SpeedChangeVisualisationMethod.Constant; public CatchPlayfield(BeatmapDifficulty difficulty, Func> getVisualRepresentation) : base(BASE_WIDTH) diff --git a/osu.Game.Rulesets.Taiko/UI/TaikoPlayfield.cs b/osu.Game.Rulesets.Taiko/UI/TaikoPlayfield.cs index f5b3049302..1219ccc0e8 100644 --- a/osu.Game.Rulesets.Taiko/UI/TaikoPlayfield.cs +++ b/osu.Game.Rulesets.Taiko/UI/TaikoPlayfield.cs @@ -41,7 +41,7 @@ namespace osu.Game.Rulesets.Taiko.UI protected override bool UserScrollSpeedAdjustment => false; - protected override SpeedChangeVisualisationMethod visualisationMethod => SpeedChangeVisualisationMethod.Overlapping; + protected override SpeedChangeVisualisationMethod VisualisationMethod => SpeedChangeVisualisationMethod.Overlapping; private readonly Container hitExplosionContainer; private readonly Container kiaiExplosionContainer; diff --git a/osu.Game/Rulesets/UI/Scrolling/ScrollingHitObjectContainer.cs b/osu.Game/Rulesets/UI/Scrolling/ScrollingHitObjectContainer.cs index 9762739ab0..33c34d7202 100644 --- a/osu.Game/Rulesets/UI/Scrolling/ScrollingHitObjectContainer.cs +++ b/osu.Game/Rulesets/UI/Scrolling/ScrollingHitObjectContainer.cs @@ -1,7 +1,6 @@ // Copyright (c) 2007-2018 ppy Pty Ltd . // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE -using osu.Framework.Allocation; using osu.Framework.Caching; using osu.Framework.Configuration; using osu.Framework.Graphics; @@ -54,7 +53,7 @@ namespace osu.Game.Rulesets.UI.Scrolling } } - private ISpeedChangeVisualiser speedChangeVisualiser; + private readonly ISpeedChangeVisualiser speedChangeVisualiser; public override void Add(DrawableHitObject hitObject) { diff --git a/osu.Game/Rulesets/UI/Scrolling/ScrollingPlayfield.cs b/osu.Game/Rulesets/UI/Scrolling/ScrollingPlayfield.cs index e446c90f75..b85531909c 100644 --- a/osu.Game/Rulesets/UI/Scrolling/ScrollingPlayfield.cs +++ b/osu.Game/Rulesets/UI/Scrolling/ScrollingPlayfield.cs @@ -63,7 +63,7 @@ namespace osu.Game.Rulesets.UI.Scrolling /// protected readonly Bindable Direction = new Bindable(); - protected virtual SpeedChangeVisualisationMethod visualisationMethod => SpeedChangeVisualisationMethod.Sequential; + protected virtual SpeedChangeVisualisationMethod VisualisationMethod => SpeedChangeVisualisationMethod.Sequential; /// /// Creates a new . @@ -107,7 +107,7 @@ namespace osu.Game.Rulesets.UI.Scrolling protected sealed override HitObjectContainer CreateHitObjectContainer() { - var container = new ScrollingHitObjectContainer(visualisationMethod); + var container = new ScrollingHitObjectContainer(VisualisationMethod); container.Direction.BindTo(Direction); return container; } From 7b8094d73129595bbb891d7b0e59e6f46eb8a72d Mon Sep 17 00:00:00 2001 From: smoogipoo Date: Thu, 20 Sep 2018 12:35:07 +0900 Subject: [PATCH 123/417] Move text size/padding out of constructor --- .../Drawables/BeatmapSetOnlineStatusPill.cs | 20 +++++++++++++++---- osu.Game/Overlays/BeatmapSet/Header.cs | 4 +++- osu.Game/Overlays/Direct/DirectGridPanel.cs | 4 +++- osu.Game/Screens/Select/BeatmapInfoWedge.cs | 4 +++- .../Carousel/DrawableCarouselBeatmapSet.cs | 4 +++- 5 files changed, 28 insertions(+), 8 deletions(-) diff --git a/osu.Game/Beatmaps/Drawables/BeatmapSetOnlineStatusPill.cs b/osu.Game/Beatmaps/Drawables/BeatmapSetOnlineStatusPill.cs index 511ce9aa58..ab28ad0a2c 100644 --- a/osu.Game/Beatmaps/Drawables/BeatmapSetOnlineStatusPill.cs +++ b/osu.Game/Beatmaps/Drawables/BeatmapSetOnlineStatusPill.cs @@ -15,19 +15,33 @@ namespace osu.Game.Beatmaps.Drawables private readonly OsuSpriteText statusText; private BeatmapSetOnlineStatus status; + public BeatmapSetOnlineStatus Status { get => status; set { - if (value == status) return; + if (status == value) + return; status = value; statusText.Text = Enum.GetName(typeof(BeatmapSetOnlineStatus), Status)?.ToUpperInvariant(); } } - public BeatmapSetOnlineStatusPill(float textSize, MarginPadding textPadding) + public float TextSize + { + get => statusText.TextSize; + set => statusText.TextSize = value; + } + + public MarginPadding TextPadding + { + get => statusText.Padding; + set => statusText.Padding = value; + } + + public BeatmapSetOnlineStatusPill() { AutoSizeAxes = Axes.Both; Masking = true; @@ -45,8 +59,6 @@ namespace osu.Game.Beatmaps.Drawables Anchor = Anchor.Centre, Origin = Anchor.Centre, Font = @"Exo2.0-Bold", - TextSize = textSize, - Padding = textPadding, }, }; diff --git a/osu.Game/Overlays/BeatmapSet/Header.cs b/osu.Game/Overlays/BeatmapSet/Header.cs index afba99f928..6f01fae92d 100644 --- a/osu.Game/Overlays/BeatmapSet/Header.cs +++ b/osu.Game/Overlays/BeatmapSet/Header.cs @@ -230,10 +230,12 @@ namespace osu.Game.Overlays.BeatmapSet Spacing = new Vector2(10), Children = new Drawable[] { - onlineStatusPill = new BeatmapSetOnlineStatusPill(14, new MarginPadding { Horizontal = 25, Vertical = 8 }) + onlineStatusPill = new BeatmapSetOnlineStatusPill { Anchor = Anchor.TopRight, Origin = Anchor.TopRight, + TextSize = 14, + TextPadding = new MarginPadding { Horizontal = 25, Vertical = 8 } }, Details = new Details(), }, diff --git a/osu.Game/Overlays/Direct/DirectGridPanel.cs b/osu.Game/Overlays/Direct/DirectGridPanel.cs index eb940bff60..d8830cd092 100644 --- a/osu.Game/Overlays/Direct/DirectGridPanel.cs +++ b/osu.Game/Overlays/Direct/DirectGridPanel.cs @@ -217,8 +217,10 @@ namespace osu.Game.Overlays.Direct statusContainer.Add(new IconPill(FontAwesome.fa_image)); } - statusContainer.Add(new BeatmapSetOnlineStatusPill(12, new MarginPadding { Horizontal = 10, Vertical = 5 }) + statusContainer.Add(new BeatmapSetOnlineStatusPill { + TextSize = 12, + TextPadding = new MarginPadding { Horizontal = 10, Vertical = 5 }, Status = SetInfo.OnlineInfo?.Status ?? BeatmapSetOnlineStatus.None, }); diff --git a/osu.Game/Screens/Select/BeatmapInfoWedge.cs b/osu.Game/Screens/Select/BeatmapInfoWedge.cs index 44622fa845..02081cb17c 100644 --- a/osu.Game/Screens/Select/BeatmapInfoWedge.cs +++ b/osu.Game/Screens/Select/BeatmapInfoWedge.cs @@ -217,8 +217,10 @@ namespace osu.Game.Screens.Select AutoSizeAxes = Axes.Both, Children = new Drawable[] { - StatusPill = new BeatmapSetOnlineStatusPill(11, new MarginPadding { Horizontal = 8, Vertical = 2 }) + StatusPill = new BeatmapSetOnlineStatusPill { + TextSize = 11, + TextPadding = new MarginPadding { Horizontal = 8, Vertical = 2 }, Status = beatmapInfo.Status, } } diff --git a/osu.Game/Screens/Select/Carousel/DrawableCarouselBeatmapSet.cs b/osu.Game/Screens/Select/Carousel/DrawableCarouselBeatmapSet.cs index 52d34a935f..658ece740e 100644 --- a/osu.Game/Screens/Select/Carousel/DrawableCarouselBeatmapSet.cs +++ b/osu.Game/Screens/Select/Carousel/DrawableCarouselBeatmapSet.cs @@ -85,11 +85,13 @@ namespace osu.Game.Screens.Select.Carousel Margin = new MarginPadding { Top = 5 }, Children = new Drawable[] { - new BeatmapSetOnlineStatusPill(11, new MarginPadding { Horizontal = 8, Vertical = 2 }) + new BeatmapSetOnlineStatusPill { Origin = Anchor.CentreLeft, Anchor = Anchor.CentreLeft, Margin = new MarginPadding{ Right = 5 }, + TextSize = 11, + TextPadding = new MarginPadding { Horizontal = 8, Vertical = 2 }, Status = beatmapSet.Status }, new FillFlowContainer From 04cd68f97029ccac9ede8b8a5c0d3dd99b5e62de Mon Sep 17 00:00:00 2001 From: smoogipoo Date: Thu, 20 Sep 2018 12:53:21 +0900 Subject: [PATCH 124/417] Hide status pill when status is none --- osu.Game/Beatmaps/Drawables/BeatmapSetOnlineStatusPill.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/osu.Game/Beatmaps/Drawables/BeatmapSetOnlineStatusPill.cs b/osu.Game/Beatmaps/Drawables/BeatmapSetOnlineStatusPill.cs index ab28ad0a2c..da281b4db3 100644 --- a/osu.Game/Beatmaps/Drawables/BeatmapSetOnlineStatusPill.cs +++ b/osu.Game/Beatmaps/Drawables/BeatmapSetOnlineStatusPill.cs @@ -1,7 +1,6 @@ // Copyright (c) 2007-2018 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.Containers; using osu.Framework.Graphics.Shapes; @@ -25,7 +24,8 @@ namespace osu.Game.Beatmaps.Drawables return; status = value; - statusText.Text = Enum.GetName(typeof(BeatmapSetOnlineStatus), Status)?.ToUpperInvariant(); + Alpha = value == BeatmapSetOnlineStatus.None ? 0 : 1; + statusText.Text = value.ToString().ToUpperInvariant(); } } From 62135c39aa435ea140e9e15a12548431d9069d9b Mon Sep 17 00:00:00 2001 From: smoogipoo Date: Thu, 20 Sep 2018 12:56:39 +0900 Subject: [PATCH 125/417] Cleanup --- osu.Game/Screens/Select/Carousel/DrawableCarouselBeatmapSet.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu.Game/Screens/Select/Carousel/DrawableCarouselBeatmapSet.cs b/osu.Game/Screens/Select/Carousel/DrawableCarouselBeatmapSet.cs index 658ece740e..d7f3a4cd54 100644 --- a/osu.Game/Screens/Select/Carousel/DrawableCarouselBeatmapSet.cs +++ b/osu.Game/Screens/Select/Carousel/DrawableCarouselBeatmapSet.cs @@ -89,7 +89,7 @@ namespace osu.Game.Screens.Select.Carousel { Origin = Anchor.CentreLeft, Anchor = Anchor.CentreLeft, - Margin = new MarginPadding{ Right = 5 }, + Margin = new MarginPadding { Right = 5 }, TextSize = 11, TextPadding = new MarginPadding { Horizontal = 8, Vertical = 2 }, Status = beatmapSet.Status From 4b907336c5379ecbdcbc8cc2909da3f263629b5b Mon Sep 17 00:00:00 2001 From: Dan Balasescu <1329837+smoogipoo@users.noreply.github.com> Date: Thu, 20 Sep 2018 13:17:17 +0900 Subject: [PATCH 126/417] Move readonly field above ctor --- osu.Game/Rulesets/UI/Scrolling/ScrollingHitObjectContainer.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/osu.Game/Rulesets/UI/Scrolling/ScrollingHitObjectContainer.cs b/osu.Game/Rulesets/UI/Scrolling/ScrollingHitObjectContainer.cs index 33c34d7202..7307fc0ead 100644 --- a/osu.Game/Rulesets/UI/Scrolling/ScrollingHitObjectContainer.cs +++ b/osu.Game/Rulesets/UI/Scrolling/ScrollingHitObjectContainer.cs @@ -32,6 +32,8 @@ namespace osu.Game.Rulesets.UI.Scrolling private Cached initialStateCache = new Cached(); + private readonly ISpeedChangeVisualiser speedChangeVisualiser; + public ScrollingHitObjectContainer(SpeedChangeVisualisationMethod visualisationMethod) { RelativeSizeAxes = Axes.Both; @@ -53,8 +55,6 @@ namespace osu.Game.Rulesets.UI.Scrolling } } - private readonly ISpeedChangeVisualiser speedChangeVisualiser; - public override void Add(DrawableHitObject hitObject) { initialStateCache.Invalidate(); From 5ee41303512cc3628ea08d71afa0f30f449996c1 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Thu, 20 Sep 2018 00:30:29 +0900 Subject: [PATCH 127/417] Update framework reference --- osu.Game/osu.Game.csproj | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu.Game/osu.Game.csproj b/osu.Game/osu.Game.csproj index 05291cf3d0..5ce04b813b 100644 --- a/osu.Game/osu.Game.csproj +++ b/osu.Game/osu.Game.csproj @@ -18,7 +18,7 @@ - + From 1861547c86b44ab8faedc892bd10f175e25e4d59 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Thu, 20 Sep 2018 19:00:41 +0900 Subject: [PATCH 128/417] Apply review --- .../Overlays/Settings/Sections/Graphics/LayoutSettings.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/osu.Game/Overlays/Settings/Sections/Graphics/LayoutSettings.cs b/osu.Game/Overlays/Settings/Sections/Graphics/LayoutSettings.cs index 013204561b..df9370d0d8 100644 --- a/osu.Game/Overlays/Settings/Sections/Graphics/LayoutSettings.cs +++ b/osu.Game/Overlays/Settings/Sections/Graphics/LayoutSettings.cs @@ -49,7 +49,6 @@ namespace osu.Game.Overlays.Settings.Sections.Graphics RelativeSizeAxes = Axes.X, AutoSizeAxes = Axes.Y }, - new SettingsCheckbox { LabelText = "Letterboxing", @@ -83,13 +82,14 @@ namespace osu.Game.Overlays.Settings.Sections.Graphics }; var resolutions = getResolutions(); + if (resolutions.Count > 1) { resolutionSettingsContainer.Child = resolutionDropdown = new SettingsDropdown { LabelText = "Resolution", ShowsDefaultIndicator = false, - Items = getResolutions(), + Items = resolutions, Bindable = sizeFullscreen }; From fa33e0bd6bc5c8abb6e88938c206bad2691ba0c7 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Fri, 21 Sep 2018 02:36:39 +0900 Subject: [PATCH 129/417] Fix background brightness being adjusted globally --- osu.Game/Graphics/Backgrounds/Background.cs | 2 -- 1 file changed, 2 deletions(-) diff --git a/osu.Game/Graphics/Backgrounds/Background.cs b/osu.Game/Graphics/Backgrounds/Background.cs index 6fc8b0e070..d3d530a540 100644 --- a/osu.Game/Graphics/Backgrounds/Background.cs +++ b/osu.Game/Graphics/Backgrounds/Background.cs @@ -6,7 +6,6 @@ using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Sprites; using osu.Framework.Graphics.Textures; -using OpenTK.Graphics; namespace osu.Game.Graphics.Backgrounds { @@ -28,7 +27,6 @@ namespace osu.Game.Graphics.Backgrounds RelativeSizeAxes = Axes.Both, Anchor = Anchor.Centre, Origin = Anchor.Centre, - Colour = Color4.DarkGray, FillMode = FillMode.Fill, }); } From 07a1c39fe525dc11f06917fc3d7f3510c21e4d27 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Fri, 21 Sep 2018 02:55:24 +0900 Subject: [PATCH 130/417] Use random default background on starting the game --- osu.Game/Screens/Backgrounds/BackgroundScreenDefault.cs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/osu.Game/Screens/Backgrounds/BackgroundScreenDefault.cs b/osu.Game/Screens/Backgrounds/BackgroundScreenDefault.cs index 38df9b13ef..f52633a34a 100644 --- a/osu.Game/Screens/Backgrounds/BackgroundScreenDefault.cs +++ b/osu.Game/Screens/Backgrounds/BackgroundScreenDefault.cs @@ -1,8 +1,9 @@ -// Copyright (c) 2007-2018 ppy Pty Ltd . +// Copyright (c) 2007-2018 ppy Pty Ltd . // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE using osu.Framework.Allocation; using osu.Framework.Graphics; +using osu.Framework.MathUtils; using osu.Framework.Threading; using osu.Game.Graphics.Backgrounds; @@ -20,6 +21,7 @@ namespace osu.Game.Screens.Backgrounds [BackgroundDependencyLoader] private void load() { + currentDisplay = RNG.Next(0, background_count); display(new Background(backgroundName)); } From 78d78b5510370108a61b0b16c2f8679a67cd987c Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Fri, 21 Sep 2018 03:13:15 +0900 Subject: [PATCH 131/417] Fade menu background a bit when menu is active --- osu.Game/Screens/Menu/MainMenu.cs | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/osu.Game/Screens/Menu/MainMenu.cs b/osu.Game/Screens/Menu/MainMenu.cs index 7e97859be6..2dd6e1d7e1 100644 --- a/osu.Game/Screens/Menu/MainMenu.cs +++ b/osu.Game/Screens/Menu/MainMenu.cs @@ -10,6 +10,7 @@ using osu.Framework.Input.EventArgs; using osu.Framework.Input.States; using osu.Framework.Screens; using osu.Game.Beatmaps; +using osu.Game.Graphics; using osu.Game.Graphics.Containers; using osu.Game.Screens.Backgrounds; using osu.Game.Screens.Charts; @@ -64,6 +65,20 @@ namespace osu.Game.Screens.Menu }, sideFlashes = new MenuSideFlashes(), }; + + buttons.StateChanged += state => + { + switch (state) + { + case ButtonSystemState.Initial: + case ButtonSystemState.Exit: + background.FadeColour(Color4.White, 500, Easing.OutSine); + break; + default: + background.FadeColour(OsuColour.Gray(0.8f), 500, Easing.OutSine); + break; + } + }; } [BackgroundDependencyLoader(true)] From 83bf38f4bc03c48e3425eb93a4d433362530038f Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Fri, 21 Sep 2018 03:13:34 +0900 Subject: [PATCH 132/417] Make menu background blurrable Not actually blurring yet, needs further testing. --- .../Backgrounds/BackgroundScreenBeatmap.cs | 25 ++++++------------- .../Backgrounds/BackgroundScreenDefault.cs | 12 ++++----- osu.Game/Screens/BlurrableBackgroundScreen.cs | 20 +++++++++++++++ 3 files changed, 33 insertions(+), 24 deletions(-) create mode 100644 osu.Game/Screens/BlurrableBackgroundScreen.cs diff --git a/osu.Game/Screens/Backgrounds/BackgroundScreenBeatmap.cs b/osu.Game/Screens/Backgrounds/BackgroundScreenBeatmap.cs index 78561cecbf..62f24e8e5c 100644 --- a/osu.Game/Screens/Backgrounds/BackgroundScreenBeatmap.cs +++ b/osu.Game/Screens/Backgrounds/BackgroundScreenBeatmap.cs @@ -4,20 +4,14 @@ using osu.Framework.Allocation; using osu.Framework.Graphics; using osu.Framework.Graphics.Textures; -using osu.Framework.Graphics.Transforms; -using OpenTK; using osu.Game.Beatmaps; using osu.Game.Graphics.Backgrounds; namespace osu.Game.Screens.Backgrounds { - public class BackgroundScreenBeatmap : BackgroundScreen + public class BackgroundScreenBeatmap : BlurrableBackgroundScreen { - private Background background; - private WorkingBeatmap beatmap; - private Vector2 blurTarget; - public WorkingBeatmap Beatmap { get { return beatmap; } @@ -33,17 +27,17 @@ namespace osu.Game.Screens.Backgrounds LoadComponentAsync(new BeatmapBackground(beatmap), b => { float newDepth = 0; - if (background != null) + if (Background != null) { - newDepth = background.Depth + 1; - background.FinishTransforms(); - background.FadeOut(250); - background.Expire(); + newDepth = Background.Depth + 1; + Background.FinishTransforms(); + Background.FadeOut(250); + Background.Expire(); } b.Depth = newDepth; - Add(background = b); - background.BlurSigma = blurTarget; + Add(Background = b); + Background.BlurSigma = BlurTarget; }); }); } @@ -54,9 +48,6 @@ namespace osu.Game.Screens.Backgrounds Beatmap = beatmap; } - public TransformSequence BlurTo(Vector2 sigma, double duration, Easing easing = Easing.None) - => background?.BlurTo(blurTarget = sigma, duration, easing); - public override bool Equals(BackgroundScreen other) { var otherBeatmapBackground = other as BackgroundScreenBeatmap; diff --git a/osu.Game/Screens/Backgrounds/BackgroundScreenDefault.cs b/osu.Game/Screens/Backgrounds/BackgroundScreenDefault.cs index f52633a34a..989883c8b3 100644 --- a/osu.Game/Screens/Backgrounds/BackgroundScreenDefault.cs +++ b/osu.Game/Screens/Backgrounds/BackgroundScreenDefault.cs @@ -1,4 +1,4 @@ -// Copyright (c) 2007-2018 ppy Pty Ltd . +// Copyright (c) 2007-2018 ppy Pty Ltd . // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE using osu.Framework.Allocation; @@ -9,15 +9,13 @@ using osu.Game.Graphics.Backgrounds; namespace osu.Game.Screens.Backgrounds { - public class BackgroundScreenDefault : BackgroundScreen + public class BackgroundScreenDefault : BlurrableBackgroundScreen { private int currentDisplay; private const int background_count = 5; private string backgroundName => $@"Menu/menu-background-{currentDisplay % background_count + 1}"; - private Background current; - [BackgroundDependencyLoader] private void load() { @@ -27,10 +25,10 @@ namespace osu.Game.Screens.Backgrounds private void display(Background newBackground) { - current?.FadeOut(800, Easing.InOutSine); - current?.Expire(); + Background?.FadeOut(800, Easing.InOutSine); + Background?.Expire(); - Add(current = newBackground); + Add(Background = newBackground); currentDisplay++; } diff --git a/osu.Game/Screens/BlurrableBackgroundScreen.cs b/osu.Game/Screens/BlurrableBackgroundScreen.cs new file mode 100644 index 0000000000..92d32badc4 --- /dev/null +++ b/osu.Game/Screens/BlurrableBackgroundScreen.cs @@ -0,0 +1,20 @@ +// Copyright (c) 2007-2018 ppy Pty Ltd . +// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE + +using osu.Framework.Graphics; +using osu.Framework.Graphics.Transforms; +using osu.Game.Graphics.Backgrounds; +using OpenTK; + +namespace osu.Game.Screens +{ + public abstract class BlurrableBackgroundScreen : BackgroundScreen + { + protected Background Background; + + protected Vector2 BlurTarget; + + public TransformSequence BlurTo(Vector2 sigma, double duration, Easing easing = Easing.None) + => Background?.BlurTo(BlurTarget = sigma, duration, easing); + } +} From 52877eca8342939b4b7fe163d0ce8f28da431b91 Mon Sep 17 00:00:00 2001 From: Paul Teng Date: Thu, 20 Sep 2018 20:01:04 -0400 Subject: [PATCH 133/417] Update ArchiveModelManager.cs --- osu.Game/Database/ArchiveModelManager.cs | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/osu.Game/Database/ArchiveModelManager.cs b/osu.Game/Database/ArchiveModelManager.cs index f4f169f27c..7356ae2cc4 100644 --- a/osu.Game/Database/ArchiveModelManager.cs +++ b/osu.Game/Database/ArchiveModelManager.cs @@ -286,9 +286,10 @@ namespace osu.Game.Database using (ContextFactory.GetForWrite()) { // re-fetch the model on the import context. - var foundModel = queryModel().Include(s => s.Files).ThenInclude(f => f.FileInfo).First(s => s.ID == item.ID); + var foundModel = queryModel().Include(s => s.Files).ThenInclude(f => f.FileInfo).FirstOrDefault(s => s.ID == item.ID); - if (foundModel.DeletePending) return; + // Test for null since FirstOrDefault will return null if nothing is found + if (foundModel == null || foundModel.DeletePending) return; if (ModelStore.Delete(foundModel)) Files.Dereference(foundModel.Files.Select(f => f.FileInfo).ToArray()); From 49fbe8443a4a2003d9c97eda3eed8f996fc3a158 Mon Sep 17 00:00:00 2001 From: Paul Teng Date: Thu, 20 Sep 2018 22:00:20 -0400 Subject: [PATCH 134/417] Test if there are beatmaps when click on delete btn --- osu.Game/Screens/Select/SongSelect.cs | 2 ++ 1 file changed, 2 insertions(+) diff --git a/osu.Game/Screens/Select/SongSelect.cs b/osu.Game/Screens/Select/SongSelect.cs index efdf55e477..438d4c51b7 100644 --- a/osu.Game/Screens/Select/SongSelect.cs +++ b/osu.Game/Screens/Select/SongSelect.cs @@ -537,6 +537,8 @@ namespace osu.Game.Screens.Select private void delete(BeatmapSetInfo beatmap) { if (beatmap == null) return; + // Null check because no beatmaps actually causes beatmap.Beatmaps to be null + if (!(beatmap.Beatmaps?.Any() ?? false)) return; dialogOverlay?.Push(new BeatmapDeleteDialog(beatmap)); } From 1644719893118bf97314b31235192796030c8f17 Mon Sep 17 00:00:00 2001 From: Paul Teng Date: Thu, 20 Sep 2018 22:29:37 -0400 Subject: [PATCH 135/417] Update SongSelect.cs --- osu.Game/Screens/Select/SongSelect.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu.Game/Screens/Select/SongSelect.cs b/osu.Game/Screens/Select/SongSelect.cs index 438d4c51b7..bfac51789e 100644 --- a/osu.Game/Screens/Select/SongSelect.cs +++ b/osu.Game/Screens/Select/SongSelect.cs @@ -538,7 +538,7 @@ namespace osu.Game.Screens.Select { if (beatmap == null) return; // Null check because no beatmaps actually causes beatmap.Beatmaps to be null - if (!(beatmap.Beatmaps?.Any() ?? false)) return; + if (beatmap == null || beatmap.ID <= 0) return; dialogOverlay?.Push(new BeatmapDeleteDialog(beatmap)); } From 654345f38041b8c1f451f1d9dafba61a0b8a32fd Mon Sep 17 00:00:00 2001 From: Paul Teng Date: Thu, 20 Sep 2018 22:32:24 -0400 Subject: [PATCH 136/417] Remove duplicate condition test --- osu.Game/Screens/Select/SongSelect.cs | 2 -- 1 file changed, 2 deletions(-) diff --git a/osu.Game/Screens/Select/SongSelect.cs b/osu.Game/Screens/Select/SongSelect.cs index bfac51789e..b4dcbcce41 100644 --- a/osu.Game/Screens/Select/SongSelect.cs +++ b/osu.Game/Screens/Select/SongSelect.cs @@ -536,8 +536,6 @@ namespace osu.Game.Screens.Select private void delete(BeatmapSetInfo beatmap) { - if (beatmap == null) return; - // Null check because no beatmaps actually causes beatmap.Beatmaps to be null if (beatmap == null || beatmap.ID <= 0) return; dialogOverlay?.Push(new BeatmapDeleteDialog(beatmap)); } From 293a5dd09906ed2ef73df76166e8231fc8b0dec0 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Fri, 21 Sep 2018 11:50:36 +0900 Subject: [PATCH 137/417] Use string interpolation --- osu.Game/Database/ArchiveModelManager.cs | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/osu.Game/Database/ArchiveModelManager.cs b/osu.Game/Database/ArchiveModelManager.cs index 06a8b490ef..2a31df462e 100644 --- a/osu.Game/Database/ArchiveModelManager.cs +++ b/osu.Game/Database/ArchiveModelManager.cs @@ -96,7 +96,8 @@ namespace osu.Game.Database private void handleEvent(Action a) { if (delayingEvents) - lock (queuedEvents) queuedEvents.Add(a); + lock (queuedEvents) + queuedEvents.Add(a); else a.Invoke(); } @@ -441,7 +442,7 @@ namespace osu.Game.Database if (!stable.ExistsDirectory(ImportFromStablePath)) { // This handles situations like when the user does not have a Skins folder - Logger.Log("No " + ImportFromStablePath + " folder available in osu!stable installation", LoggingTarget.Information, LogLevel.Error); + Logger.Log($"No {ImportFromStablePath} folder available in osu!stable installation", LoggingTarget.Information, LogLevel.Error); return Task.CompletedTask; } From eaf7697b85bbcd1bff590daf7a9cf1d83e333ef8 Mon Sep 17 00:00:00 2001 From: Paul Teng Date: Thu, 20 Sep 2018 23:21:27 -0400 Subject: [PATCH 138/417] Add boolean return value --- osu.Game/Database/ArchiveModelManager.cs | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/osu.Game/Database/ArchiveModelManager.cs b/osu.Game/Database/ArchiveModelManager.cs index 7356ae2cc4..d57b94b80a 100644 --- a/osu.Game/Database/ArchiveModelManager.cs +++ b/osu.Game/Database/ArchiveModelManager.cs @@ -281,7 +281,8 @@ namespace osu.Game.Database /// Is a no-op for already deleted items. /// /// The item to delete. - public void Delete(TModel item) + /// false if no operation was performed + public bool Delete(TModel item) { using (ContextFactory.GetForWrite()) { @@ -289,10 +290,11 @@ namespace osu.Game.Database var foundModel = queryModel().Include(s => s.Files).ThenInclude(f => f.FileInfo).FirstOrDefault(s => s.ID == item.ID); // Test for null since FirstOrDefault will return null if nothing is found - if (foundModel == null || foundModel.DeletePending) return; + if (foundModel == null || foundModel.DeletePending) return false; if (ModelStore.Delete(foundModel)) Files.Dereference(foundModel.Files.Select(f => f.FileInfo).ToArray()); + return true; } } From 826dc6ceb71224f8c9261b5eea00e77a1d4a7358 Mon Sep 17 00:00:00 2001 From: smoogipoo Date: Fri, 21 Sep 2018 14:02:32 +0900 Subject: [PATCH 139/417] Make Playfield not a ScalableContainer --- osu.Game.Rulesets.Catch/UI/CatchPlayfield.cs | 46 +++++---- .../UI/ScalingContainer.cs | 29 ++++++ .../Edit/OsuHitObjectComposer.cs | 18 +++- osu.Game.Rulesets.Osu/UI/OsuPlayfield.cs | 46 ++++++--- .../UI/OsuRulesetContainer.cs | 7 -- osu.Game.Rulesets.Osu/UI/ScalingContainer.cs | 29 ++++++ osu.Game/Rulesets/Edit/HitObjectComposer.cs | 2 +- osu.Game/Rulesets/UI/Playfield.cs | 20 ++-- osu.Game/Rulesets/UI/ScalableContainer.cs | 99 ------------------- .../UI/Scrolling/ScrollingPlayfield.cs | 14 --- 10 files changed, 143 insertions(+), 167 deletions(-) create mode 100644 osu.Game.Rulesets.Catch/UI/ScalingContainer.cs create mode 100644 osu.Game.Rulesets.Osu/UI/ScalingContainer.cs delete mode 100644 osu.Game/Rulesets/UI/ScalableContainer.cs diff --git a/osu.Game.Rulesets.Catch/UI/CatchPlayfield.cs b/osu.Game.Rulesets.Catch/UI/CatchPlayfield.cs index 102ec7fb3b..ecd1142b52 100644 --- a/osu.Game.Rulesets.Catch/UI/CatchPlayfield.cs +++ b/osu.Game.Rulesets.Catch/UI/CatchPlayfield.cs @@ -25,7 +25,6 @@ namespace osu.Game.Rulesets.Catch.UI protected override bool UserScrollSpeedAdjustment => false; public CatchPlayfield(BeatmapDifficulty difficulty, Func> getVisualRepresentation) - : base(BASE_WIDTH) { Direction.Value = ScrollingDirection.Down; @@ -34,27 +33,36 @@ namespace osu.Game.Rulesets.Catch.UI Anchor = Anchor.TopCentre; Origin = Anchor.TopCentre; - base.Content.Anchor = Anchor.BottomLeft; - base.Content.Origin = Anchor.BottomLeft; - - base.Content.AddRange(new Drawable[] + InternalChild = new Container { - explodingFruitContainer = new Container + Anchor = Anchor.Centre, + Origin = Anchor.Centre, + RelativeSizeAxes = Axes.Both, + FillMode = FillMode.Fit, + FillAspectRatio = 4f / 3, + Child = new ScalingContainer(BASE_WIDTH) { RelativeSizeAxes = Axes.Both, - }, - catcherArea = new CatcherArea(difficulty) - { - GetVisualRepresentation = getVisualRepresentation, - ExplodingFruitTarget = explodingFruitContainer, - Anchor = Anchor.BottomLeft, - Origin = Anchor.TopLeft, - }, - content = new Container - { - RelativeSizeAxes = Axes.Both, - }, - }); + Children = new Drawable[] + { + explodingFruitContainer = new Container + { + RelativeSizeAxes = Axes.Both, + }, + catcherArea = new CatcherArea(difficulty) + { + GetVisualRepresentation = getVisualRepresentation, + ExplodingFruitTarget = explodingFruitContainer, + Anchor = Anchor.BottomLeft, + Origin = Anchor.TopLeft, + }, + content = new Container + { + RelativeSizeAxes = Axes.Both, + }, + } + } + }; } public bool CheckIfWeCanCatch(CatchHitObject obj) => catcherArea.AttemptCatch(obj); diff --git a/osu.Game.Rulesets.Catch/UI/ScalingContainer.cs b/osu.Game.Rulesets.Catch/UI/ScalingContainer.cs new file mode 100644 index 0000000000..a2011dcc6f --- /dev/null +++ b/osu.Game.Rulesets.Catch/UI/ScalingContainer.cs @@ -0,0 +1,29 @@ +// Copyright (c) 2007-2018 ppy Pty Ltd . +// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE + +using osu.Framework.Graphics.Containers; +using OpenTK; + +namespace osu.Game.Rulesets.Catch.UI +{ + /// + /// A which scales its content relative to a target width. + /// + public class ScalingContainer : Container + { + private readonly float targetWidth; + + public ScalingContainer(float targetWidth) + { + this.targetWidth = targetWidth; + } + + protected override void Update() + { + base.Update(); + + Scale = new Vector2(Parent.ChildSize.X / targetWidth); + Size = Vector2.Divide(Vector2.One, Scale); + } + } +} diff --git a/osu.Game.Rulesets.Osu/Edit/OsuHitObjectComposer.cs b/osu.Game.Rulesets.Osu/Edit/OsuHitObjectComposer.cs index dce1fc2851..bec7d1fe26 100644 --- a/osu.Game.Rulesets.Osu/Edit/OsuHitObjectComposer.cs +++ b/osu.Game.Rulesets.Osu/Edit/OsuHitObjectComposer.cs @@ -3,6 +3,7 @@ using System.Collections.Generic; using osu.Framework.Graphics; +using osu.Framework.Graphics.Containers; using osu.Game.Beatmaps; using osu.Game.Rulesets.Edit; using osu.Game.Rulesets.Edit.Tools; @@ -31,7 +32,7 @@ namespace osu.Game.Rulesets.Osu.Edit new HitObjectCompositionTool() }; - protected override ScalableContainer CreateLayerContainer() => new ScalableContainer(OsuPlayfield.BASE_SIZE.X) { RelativeSizeAxes = Axes.Both }; + protected override Container CreateLayerContainer() => new LayerContainer(); public override HitObjectMask CreateMaskFor(DrawableHitObject hitObject) { @@ -45,5 +46,20 @@ namespace osu.Game.Rulesets.Osu.Edit return base.CreateMaskFor(hitObject); } + + private class LayerContainer : Container + { + protected override Container Content => content; + private readonly Container content; + + public LayerContainer() + { + RelativeSizeAxes = Axes.Both; + FillMode = FillMode.Fit; + FillAspectRatio = 4f / 3; + + Child = content = new ScalingContainer(OsuPlayfield.BASE_SIZE.X) { RelativeSizeAxes = Axes.Both }; + } + } } } diff --git a/osu.Game.Rulesets.Osu/UI/OsuPlayfield.cs b/osu.Game.Rulesets.Osu/UI/OsuPlayfield.cs index 61937a535c..b6e4ae62a9 100644 --- a/osu.Game.Rulesets.Osu/UI/OsuPlayfield.cs +++ b/osu.Game.Rulesets.Osu/UI/OsuPlayfield.cs @@ -20,32 +20,46 @@ namespace osu.Game.Rulesets.Osu.UI private readonly JudgementContainer judgementLayer; private readonly ConnectionRenderer connectionLayer; + private readonly Container content; + protected override Container Content => content; + public static readonly Vector2 BASE_SIZE = new Vector2(512, 384); public OsuPlayfield() - : base(BASE_SIZE.X) { Anchor = Anchor.Centre; Origin = Anchor.Centre; - AddRange(new Drawable[] + InternalChild = new Container { - connectionLayer = new FollowPointRenderer + Anchor = Anchor.Centre, + Origin = Anchor.Centre, + RelativeSizeAxes = Axes.Both, + FillMode = FillMode.Fit, + FillAspectRatio = 4f / 3, + Child = content = new ScalingContainer(BASE_SIZE.X) { RelativeSizeAxes = Axes.Both, - Depth = 2, - }, - judgementLayer = new JudgementContainer - { - RelativeSizeAxes = Axes.Both, - Depth = 1, - }, - approachCircles = new Container - { - RelativeSizeAxes = Axes.Both, - Depth = -1, - }, - }); + Children = new Drawable[] + { + connectionLayer = new FollowPointRenderer + { + RelativeSizeAxes = Axes.Both, + Depth = 2, + }, + judgementLayer = new JudgementContainer + { + RelativeSizeAxes = Axes.Both, + Depth = 1, + }, + approachCircles = new Container + { + RelativeSizeAxes = Axes.Both, + Depth = -1, + }, + } + } + }; } public override void Add(DrawableHitObject h) diff --git a/osu.Game.Rulesets.Osu/UI/OsuRulesetContainer.cs b/osu.Game.Rulesets.Osu/UI/OsuRulesetContainer.cs index 4bc6992445..0ea8d3ede8 100644 --- a/osu.Game.Rulesets.Osu/UI/OsuRulesetContainer.cs +++ b/osu.Game.Rulesets.Osu/UI/OsuRulesetContainer.cs @@ -4,7 +4,6 @@ using System.Linq; using osu.Framework.Graphics.Cursor; using osu.Framework.Input; -using OpenTK; using osu.Game.Beatmaps; using osu.Game.Input.Handlers; using osu.Game.Rulesets.Objects.Drawables; @@ -58,12 +57,6 @@ namespace osu.Game.Rulesets.Osu.UI } } - protected override Vector2 GetAspectAdjustedSize() - { - var aspectSize = DrawSize.X * 0.75f < DrawSize.Y ? new Vector2(DrawSize.X, DrawSize.X * 0.75f) : new Vector2(DrawSize.Y * 4f / 3f, DrawSize.Y); - return new Vector2(aspectSize.X / DrawSize.X, aspectSize.Y / DrawSize.Y); - } - protected override CursorContainer CreateCursor() => new GameplayCursor(); } } diff --git a/osu.Game.Rulesets.Osu/UI/ScalingContainer.cs b/osu.Game.Rulesets.Osu/UI/ScalingContainer.cs new file mode 100644 index 0000000000..0a9bec67fb --- /dev/null +++ b/osu.Game.Rulesets.Osu/UI/ScalingContainer.cs @@ -0,0 +1,29 @@ +// Copyright (c) 2007-2018 ppy Pty Ltd . +// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE + +using osu.Framework.Graphics.Containers; +using OpenTK; + +namespace osu.Game.Rulesets.Osu.UI +{ + /// + /// A which scales its content relative to a target width. + /// + public class ScalingContainer : Container + { + private readonly float targetWidth; + + public ScalingContainer(float targetWidth) + { + this.targetWidth = targetWidth; + } + + protected override void Update() + { + base.Update(); + + Scale = new Vector2(Parent.ChildSize.X / targetWidth); + Size = Vector2.Divide(Vector2.One, Scale); + } + } +} diff --git a/osu.Game/Rulesets/Edit/HitObjectComposer.cs b/osu.Game/Rulesets/Edit/HitObjectComposer.cs index a3253250f2..8060ac742a 100644 --- a/osu.Game/Rulesets/Edit/HitObjectComposer.cs +++ b/osu.Game/Rulesets/Edit/HitObjectComposer.cs @@ -165,6 +165,6 @@ namespace osu.Game.Rulesets.Edit /// /// Creates a which provides a layer above or below the . /// - protected virtual ScalableContainer CreateLayerContainer() => new ScalableContainer { RelativeSizeAxes = Axes.Both }; + protected virtual Container CreateLayerContainer() => new Container { RelativeSizeAxes = Axes.Both }; } } diff --git a/osu.Game/Rulesets/UI/Playfield.cs b/osu.Game/Rulesets/UI/Playfield.cs index e090a18eda..a8dc096a1d 100644 --- a/osu.Game/Rulesets/UI/Playfield.cs +++ b/osu.Game/Rulesets/UI/Playfield.cs @@ -9,18 +9,25 @@ using osu.Game.Rulesets.Objects.Drawables; using osu.Framework.Allocation; using osu.Framework.Extensions.IEnumerableExtensions; using osu.Framework.Configuration; +using osu.Framework.Graphics.Containers; using osu.Game.Beatmaps; using osu.Game.Rulesets.Mods; +using OpenTK; namespace osu.Game.Rulesets.UI { - public abstract class Playfield : ScalableContainer + public abstract class Playfield : Container { /// /// The contained in this Playfield. /// public HitObjectContainer HitObjectContainer { get; private set; } + /// + /// A function that converts gamefield coordinates to screen space. + /// + public Func GamefieldToScreenSpace => HitObjectContainer.ToScreenSpace; + /// /// All the s contained in this and all . /// @@ -39,16 +46,9 @@ namespace osu.Game.Rulesets.UI public readonly BindableBool DisplayJudgements = new BindableBool(true); /// - /// A container for keeping track of DrawableHitObjects. + /// Creates a new . /// - /// The width to scale the internal coordinate space to. - /// May be null if scaling based on is desired. If is also null, no scaling will occur. - /// - /// The height to scale the internal coordinate space to. - /// May be null if scaling based on is desired. If is also null, no scaling will occur. - /// - protected Playfield(float? customWidth = null, float? customHeight = null) - : base(customWidth, customHeight) + protected Playfield() { RelativeSizeAxes = Axes.Both; } diff --git a/osu.Game/Rulesets/UI/ScalableContainer.cs b/osu.Game/Rulesets/UI/ScalableContainer.cs deleted file mode 100644 index 5ee03be7ee..0000000000 --- a/osu.Game/Rulesets/UI/ScalableContainer.cs +++ /dev/null @@ -1,99 +0,0 @@ -// Copyright (c) 2007-2018 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.Containers; -using OpenTK; - -namespace osu.Game.Rulesets.UI -{ - /// - /// A which can have its internal coordinate system scaled to a specific size. - /// - public class ScalableContainer : Container - { - /// - /// A function that converts coordinates from gamefield to screen space. - /// - public Func GamefieldToScreenSpace => scaledContent.GamefieldToScreenSpace; - - /// - /// The scaled content. - /// - private readonly ScaledContainer scaledContent; - protected override Container Content => scaledContent; - - /// - /// A which can have its internal coordinate system scaled to a specific size. - /// - /// The width to scale the internal coordinate space to. - /// May be null if scaling based on is desired. If is also null, no scaling will occur. - /// - /// The height to scale the internal coordinate space to. - /// May be null if scaling based on is desired. If is also null, no scaling will occur. - /// - public ScalableContainer(float? customWidth = null, float? customHeight = null) - { - AddInternal(scaledContent = new ScaledContainer - { - CustomWidth = customWidth, - CustomHeight = customHeight, - RelativeSizeAxes = Axes.Both, - }); - } - - private class ScaledContainer : Container - { - /// - /// A function that converts coordinates from gamefield to screen space. - /// - public Func GamefieldToScreenSpace => content.ToScreenSpace; - - /// - /// The value to scale the width of the content to match. - /// If null, is used. - /// - public float? CustomWidth; - - /// - /// The value to scale the height of the content to match. - /// if null, is used. - /// - public float? CustomHeight; - - private readonly Container content; - protected override Container Content => content; - - public ScaledContainer() - { - AddInternal(content = new Container { RelativeSizeAxes = Axes.Both }); - } - - protected override void Update() - { - base.Update(); - - content.Scale = sizeScale; - content.Size = Vector2.Divide(Vector2.One, sizeScale); - } - - /// - /// The scale that is required for the size of the content to match and . - /// - private Vector2 sizeScale - { - get - { - if (CustomWidth.HasValue && CustomHeight.HasValue) - return Vector2.Divide(DrawSize, new Vector2(CustomWidth.Value, CustomHeight.Value)); - if (CustomWidth.HasValue) - return new Vector2(DrawSize.X / CustomWidth.Value); - if (CustomHeight.HasValue) - return new Vector2(DrawSize.Y / CustomHeight.Value); - return Vector2.One; - } - } - } - } -} diff --git a/osu.Game/Rulesets/UI/Scrolling/ScrollingPlayfield.cs b/osu.Game/Rulesets/UI/Scrolling/ScrollingPlayfield.cs index ec73c0fb14..b555b6616a 100644 --- a/osu.Game/Rulesets/UI/Scrolling/ScrollingPlayfield.cs +++ b/osu.Game/Rulesets/UI/Scrolling/ScrollingPlayfield.cs @@ -62,20 +62,6 @@ namespace osu.Game.Rulesets.UI.Scrolling /// protected readonly Bindable Direction = new Bindable(); - /// - /// Creates a new . - /// - /// The width to scale the internal coordinate space to. - /// May be null if scaling based on is desired. If is also null, no scaling will occur. - /// - /// The height to scale the internal coordinate space to. - /// May be null if scaling based on is desired. If is also null, no scaling will occur. - /// - protected ScrollingPlayfield(float? customWidth = null, float? customHeight = null) - : base(customWidth, customHeight) - { - } - [BackgroundDependencyLoader] private void load() { From 368ceec47cb86e696c439aecdd4e15753d68f433 Mon Sep 17 00:00:00 2001 From: smoogipoo Date: Fri, 21 Sep 2018 14:35:50 +0900 Subject: [PATCH 140/417] Simplify creation of a playfield --- osu.Game.Rulesets.Catch/UI/CatchPlayfield.cs | 8 +------ osu.Game.Rulesets.Mania/UI/Column.cs | 7 +++--- .../UI/Components/ColumnHitObjectArea.cs | 24 ++++++++----------- .../UI/ManiaScrollingPlayfield.cs | 2 +- osu.Game.Rulesets.Mania/UI/ManiaStage.cs | 4 ++-- osu.Game.Rulesets.Osu/UI/OsuPlayfield.cs | 6 ++--- osu.Game.Rulesets.Taiko/UI/TaikoPlayfield.cs | 8 +++---- .../Visual/TestCaseScrollingHitObjects.cs | 19 ++++++++++----- osu.Game/Rulesets/UI/HitObjectContainer.cs | 5 ++++ osu.Game/Rulesets/UI/Playfield.cs | 23 +++++++++--------- 10 files changed, 52 insertions(+), 54 deletions(-) diff --git a/osu.Game.Rulesets.Catch/UI/CatchPlayfield.cs b/osu.Game.Rulesets.Catch/UI/CatchPlayfield.cs index ecd1142b52..aa3fcefd9b 100644 --- a/osu.Game.Rulesets.Catch/UI/CatchPlayfield.cs +++ b/osu.Game.Rulesets.Catch/UI/CatchPlayfield.cs @@ -17,9 +17,6 @@ namespace osu.Game.Rulesets.Catch.UI { public const float BASE_WIDTH = 512; - protected override Container Content => content; - private readonly Container content; - private readonly CatcherArea catcherArea; protected override bool UserScrollSpeedAdjustment => false; @@ -56,10 +53,7 @@ namespace osu.Game.Rulesets.Catch.UI Anchor = Anchor.BottomLeft, Origin = Anchor.TopLeft, }, - content = new Container - { - RelativeSizeAxes = Axes.Both, - }, + HitObjectContainer } } }; diff --git a/osu.Game.Rulesets.Mania/UI/Column.cs b/osu.Game.Rulesets.Mania/UI/Column.cs index d489d48fc3..09976e5994 100644 --- a/osu.Game.Rulesets.Mania/UI/Column.cs +++ b/osu.Game.Rulesets.Mania/UI/Column.cs @@ -30,8 +30,6 @@ namespace osu.Game.Rulesets.Mania.UI internal readonly Container TopLevelContainer; private readonly Container explosionContainer; - protected override Container Content => hitObjectArea; - public Column() { RelativeSizeAxes = Axes.Y; @@ -54,7 +52,10 @@ namespace osu.Game.Rulesets.Mania.UI RelativeSizeAxes = Axes.Both, Children = new Drawable[] { - hitObjectArea = new ColumnHitObjectArea { RelativeSizeAxes = Axes.Both }, + hitObjectArea = new ColumnHitObjectArea(HitObjectContainer) + { + RelativeSizeAxes = Axes.Both, + }, explosionContainer = new Container { Name = "Hit explosions", diff --git a/osu.Game.Rulesets.Mania/UI/Components/ColumnHitObjectArea.cs b/osu.Game.Rulesets.Mania/UI/Components/ColumnHitObjectArea.cs index b5dfb0949a..5a4adfd72e 100644 --- a/osu.Game.Rulesets.Mania/UI/Components/ColumnHitObjectArea.cs +++ b/osu.Game.Rulesets.Mania/UI/Components/ColumnHitObjectArea.cs @@ -8,28 +8,24 @@ using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Shapes; using osu.Game.Graphics; +using osu.Game.Rulesets.UI; using osu.Game.Rulesets.UI.Scrolling; using OpenTK.Graphics; namespace osu.Game.Rulesets.Mania.UI.Components { - public class ColumnHitObjectArea : Container, IHasAccentColour + public class ColumnHitObjectArea : CompositeDrawable, IHasAccentColour { private const float hit_target_height = 10; private const float hit_target_bar_height = 2; - private Container content; - protected override Container Content => content; - private readonly IBindable direction = new Bindable(); - private Container hitTargetLine; + private readonly Container hitTargetLine; + private readonly Drawable hitTargetBar; - [BackgroundDependencyLoader] - private void load(IScrollingInfo scrollingInfo) + public ColumnHitObjectArea(HitObjectContainer hitObjectContainer) { - Drawable hitTargetBar; - InternalChildren = new[] { hitTargetBar = new Box @@ -45,13 +41,13 @@ namespace osu.Game.Rulesets.Mania.UI.Components Masking = true, Child = new Box { RelativeSizeAxes = Axes.Both } }, - content = new Container - { - Name = "Hit objects", - RelativeSizeAxes = Axes.Both, - }, + hitObjectContainer }; + } + [BackgroundDependencyLoader] + private void load(IScrollingInfo scrollingInfo) + { direction.BindTo(scrollingInfo.Direction); direction.BindValueChanged(direction => { diff --git a/osu.Game.Rulesets.Mania/UI/ManiaScrollingPlayfield.cs b/osu.Game.Rulesets.Mania/UI/ManiaScrollingPlayfield.cs index 4d6c5a747a..8ee0fbf7fe 100644 --- a/osu.Game.Rulesets.Mania/UI/ManiaScrollingPlayfield.cs +++ b/osu.Game.Rulesets.Mania/UI/ManiaScrollingPlayfield.cs @@ -7,7 +7,7 @@ using osu.Game.Rulesets.UI.Scrolling; namespace osu.Game.Rulesets.Mania.UI { - public class ManiaScrollingPlayfield : ScrollingPlayfield + public abstract class ManiaScrollingPlayfield : ScrollingPlayfield { private readonly IBindable direction = new Bindable(); diff --git a/osu.Game.Rulesets.Mania/UI/ManiaStage.cs b/osu.Game.Rulesets.Mania/UI/ManiaStage.cs index f292d5ff16..8cf49686b9 100644 --- a/osu.Game.Rulesets.Mania/UI/ManiaStage.cs +++ b/osu.Game.Rulesets.Mania/UI/ManiaStage.cs @@ -30,8 +30,7 @@ namespace osu.Game.Rulesets.Mania.UI public IReadOnlyList Columns => columnFlow.Children; private readonly FillFlowContainer columnFlow; - protected override Container Content => barLineContainer; - private readonly Container barLineContainer; + private readonly Container barLineContainer; public Container Judgements => judgements; private readonly JudgementContainer judgements; @@ -105,6 +104,7 @@ namespace osu.Game.Rulesets.Mania.UI Anchor = Anchor.TopCentre, Origin = Anchor.TopCentre, RelativeSizeAxes = Axes.Y, + Child = HitObjectContainer } }, judgements = new JudgementContainer diff --git a/osu.Game.Rulesets.Osu/UI/OsuPlayfield.cs b/osu.Game.Rulesets.Osu/UI/OsuPlayfield.cs index b6e4ae62a9..d3a4008691 100644 --- a/osu.Game.Rulesets.Osu/UI/OsuPlayfield.cs +++ b/osu.Game.Rulesets.Osu/UI/OsuPlayfield.cs @@ -20,9 +20,6 @@ namespace osu.Game.Rulesets.Osu.UI private readonly JudgementContainer judgementLayer; private readonly ConnectionRenderer connectionLayer; - private readonly Container content; - protected override Container Content => content; - public static readonly Vector2 BASE_SIZE = new Vector2(512, 384); public OsuPlayfield() @@ -37,7 +34,7 @@ namespace osu.Game.Rulesets.Osu.UI RelativeSizeAxes = Axes.Both, FillMode = FillMode.Fit, FillAspectRatio = 4f / 3, - Child = content = new ScalingContainer(BASE_SIZE.X) + Child = new ScalingContainer(BASE_SIZE.X) { RelativeSizeAxes = Axes.Both, Children = new Drawable[] @@ -52,6 +49,7 @@ namespace osu.Game.Rulesets.Osu.UI RelativeSizeAxes = Axes.Both, Depth = 1, }, + HitObjectContainer, approachCircles = new Container { RelativeSizeAxes = Axes.Both, diff --git a/osu.Game.Rulesets.Taiko/UI/TaikoPlayfield.cs b/osu.Game.Rulesets.Taiko/UI/TaikoPlayfield.cs index 325beb38a5..6c443a2ac1 100644 --- a/osu.Game.Rulesets.Taiko/UI/TaikoPlayfield.cs +++ b/osu.Game.Rulesets.Taiko/UI/TaikoPlayfield.cs @@ -44,9 +44,6 @@ namespace osu.Game.Rulesets.Taiko.UI private readonly Container kiaiExplosionContainer; private readonly JudgementContainer judgementContainer; - protected override Container Content => content; - private readonly Container content; - private readonly Container topLevelHitContainer; private readonly Container barlineContainer; @@ -118,12 +115,13 @@ namespace osu.Game.Rulesets.Taiko.UI RelativeSizeAxes = Axes.Both, Padding = new MarginPadding { Left = HIT_TARGET_OFFSET } }, - content = new Container + new Container { Name = "Hit objects", RelativeSizeAxes = Axes.Both, Padding = new MarginPadding { Left = HIT_TARGET_OFFSET }, - Masking = true + Masking = true, + Child = HitObjectContainer }, kiaiExplosionContainer = new Container { diff --git a/osu.Game.Tests/Visual/TestCaseScrollingHitObjects.cs b/osu.Game.Tests/Visual/TestCaseScrollingHitObjects.cs index bbc9d2b860..b254325472 100644 --- a/osu.Game.Tests/Visual/TestCaseScrollingHitObjects.cs +++ b/osu.Game.Tests/Visual/TestCaseScrollingHitObjects.cs @@ -121,14 +121,21 @@ namespace osu.Game.Tests.Visual Direction = direction; Padding = new MarginPadding(2); - Content.Masking = true; - AddInternal(new Box + InternalChildren = new Drawable[] { - RelativeSizeAxes = Axes.Both, - Alpha = 0.5f, - Depth = float.MaxValue - }); + new Box + { + RelativeSizeAxes = Axes.Both, + Alpha = 0.5f, + }, + new Container + { + RelativeSizeAxes = Axes.Both, + Masking = true, + Child = HitObjectContainer + } + }; } } diff --git a/osu.Game/Rulesets/UI/HitObjectContainer.cs b/osu.Game/Rulesets/UI/HitObjectContainer.cs index af18d98561..261132c56b 100644 --- a/osu.Game/Rulesets/UI/HitObjectContainer.cs +++ b/osu.Game/Rulesets/UI/HitObjectContainer.cs @@ -14,6 +14,11 @@ namespace osu.Game.Rulesets.UI public IEnumerable Objects => InternalChildren.Cast().OrderBy(h => h.HitObject.StartTime); public IEnumerable AliveObjects => AliveInternalChildren.Cast().OrderBy(h => h.HitObject.StartTime); + public HitObjectContainer() + { + RelativeSizeAxes = Axes.Both; + } + public virtual void Add(DrawableHitObject hitObject) => AddInternal(hitObject); public virtual bool Remove(DrawableHitObject hitObject) => RemoveInternal(hitObject); diff --git a/osu.Game/Rulesets/UI/Playfield.cs b/osu.Game/Rulesets/UI/Playfield.cs index a8dc096a1d..f5db0cd3ce 100644 --- a/osu.Game/Rulesets/UI/Playfield.cs +++ b/osu.Game/Rulesets/UI/Playfield.cs @@ -16,12 +16,14 @@ using OpenTK; namespace osu.Game.Rulesets.UI { - public abstract class Playfield : Container + public abstract class Playfield : CompositeDrawable { /// /// The contained in this Playfield. /// - public HitObjectContainer HitObjectContainer { get; private set; } + public HitObjectContainer HitObjectContainer => hitObjectContainerLazy.Value; + + private readonly Lazy hitObjectContainerLazy; /// /// A function that converts gamefield coordinates to screen space. @@ -51,6 +53,8 @@ namespace osu.Game.Rulesets.UI protected Playfield() { RelativeSizeAxes = Axes.Both; + + hitObjectContainerLazy = new Lazy(CreateHitObjectContainer); } private WorkingBeatmap beatmap; @@ -59,11 +63,6 @@ namespace osu.Game.Rulesets.UI private void load(IBindableBeatmap beatmap) { this.beatmap = beatmap.Value; - - HitObjectContainer = CreateHitObjectContainer(); - HitObjectContainer.RelativeSizeAxes = Axes.Both; - - Add(HitObjectContainer); } /// @@ -94,11 +93,6 @@ namespace osu.Game.Rulesets.UI nestedPlayfields.Value.Add(otherPlayfield); } - /// - /// Creates the container that will be used to contain the s. - /// - protected virtual HitObjectContainer CreateHitObjectContainer() => new HitObjectContainer(); - protected override void Update() { base.Update(); @@ -108,5 +102,10 @@ namespace osu.Game.Rulesets.UI if (mod is IUpdatableByPlayfield updatable) updatable.Update(this); } + + /// + /// Creates the container that will be used to contain the s. + /// + protected virtual HitObjectContainer CreateHitObjectContainer() => new HitObjectContainer(); } } From a166d03ede7c3027b4d24698024f953b56906cd4 Mon Sep 17 00:00:00 2001 From: smoogipoo Date: Fri, 21 Sep 2018 14:43:17 +0900 Subject: [PATCH 141/417] Remove duplicate implementation of the Osu playfield layer --- .../Edit/OsuHitObjectComposer.cs | 17 +------ osu.Game.Rulesets.Osu/UI/OsuPlayfield.cs | 42 +++++++--------- osu.Game.Rulesets.Osu/UI/PlayfieldLayer.cs | 49 +++++++++++++++++++ osu.Game.Rulesets.Osu/UI/ScalingContainer.cs | 29 ----------- 4 files changed, 67 insertions(+), 70 deletions(-) create mode 100644 osu.Game.Rulesets.Osu/UI/PlayfieldLayer.cs delete mode 100644 osu.Game.Rulesets.Osu/UI/ScalingContainer.cs diff --git a/osu.Game.Rulesets.Osu/Edit/OsuHitObjectComposer.cs b/osu.Game.Rulesets.Osu/Edit/OsuHitObjectComposer.cs index bec7d1fe26..ad92ea15d4 100644 --- a/osu.Game.Rulesets.Osu/Edit/OsuHitObjectComposer.cs +++ b/osu.Game.Rulesets.Osu/Edit/OsuHitObjectComposer.cs @@ -32,7 +32,7 @@ namespace osu.Game.Rulesets.Osu.Edit new HitObjectCompositionTool() }; - protected override Container CreateLayerContainer() => new LayerContainer(); + protected override Container CreateLayerContainer() => new PlayfieldLayer { RelativeSizeAxes = Axes.Both }; public override HitObjectMask CreateMaskFor(DrawableHitObject hitObject) { @@ -46,20 +46,5 @@ namespace osu.Game.Rulesets.Osu.Edit return base.CreateMaskFor(hitObject); } - - private class LayerContainer : Container - { - protected override Container Content => content; - private readonly Container content; - - public LayerContainer() - { - RelativeSizeAxes = Axes.Both; - FillMode = FillMode.Fit; - FillAspectRatio = 4f / 3; - - Child = content = new ScalingContainer(OsuPlayfield.BASE_SIZE.X) { RelativeSizeAxes = Axes.Both }; - } - } } } diff --git a/osu.Game.Rulesets.Osu/UI/OsuPlayfield.cs b/osu.Game.Rulesets.Osu/UI/OsuPlayfield.cs index d3a4008691..9b3a6a7131 100644 --- a/osu.Game.Rulesets.Osu/UI/OsuPlayfield.cs +++ b/osu.Game.Rulesets.Osu/UI/OsuPlayfield.cs @@ -27,35 +27,27 @@ namespace osu.Game.Rulesets.Osu.UI Anchor = Anchor.Centre; Origin = Anchor.Centre; - InternalChild = new Container + InternalChild = new PlayfieldLayer { - Anchor = Anchor.Centre, - Origin = Anchor.Centre, RelativeSizeAxes = Axes.Both, - FillMode = FillMode.Fit, - FillAspectRatio = 4f / 3, - Child = new ScalingContainer(BASE_SIZE.X) + Children = new Drawable[] { - RelativeSizeAxes = Axes.Both, - Children = new Drawable[] + connectionLayer = new FollowPointRenderer { - connectionLayer = new FollowPointRenderer - { - RelativeSizeAxes = Axes.Both, - Depth = 2, - }, - judgementLayer = new JudgementContainer - { - RelativeSizeAxes = Axes.Both, - Depth = 1, - }, - HitObjectContainer, - approachCircles = new Container - { - RelativeSizeAxes = Axes.Both, - Depth = -1, - }, - } + RelativeSizeAxes = Axes.Both, + Depth = 2, + }, + judgementLayer = new JudgementContainer + { + RelativeSizeAxes = Axes.Both, + Depth = 1, + }, + HitObjectContainer, + approachCircles = new Container + { + RelativeSizeAxes = Axes.Both, + Depth = -1, + }, } }; } diff --git a/osu.Game.Rulesets.Osu/UI/PlayfieldLayer.cs b/osu.Game.Rulesets.Osu/UI/PlayfieldLayer.cs new file mode 100644 index 0000000000..4d1eea27c9 --- /dev/null +++ b/osu.Game.Rulesets.Osu/UI/PlayfieldLayer.cs @@ -0,0 +1,49 @@ +// Copyright (c) 2007-2018 ppy Pty Ltd . +// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE + +using osu.Framework.Graphics; +using osu.Framework.Graphics.Containers; +using OpenTK; + +namespace osu.Game.Rulesets.Osu.UI +{ + public class PlayfieldLayer : Container + { + protected override Container Content => content; + private readonly Container content; + + public PlayfieldLayer() + { + InternalChild = new Container + { + Anchor = Anchor.Centre, + Origin = Anchor.Centre, + RelativeSizeAxes = Axes.Both, + FillMode = FillMode.Fit, + FillAspectRatio = 4f / 3, + Child = content = new ScalingContainer(OsuPlayfield.BASE_SIZE.X) { RelativeSizeAxes = Axes.Both } + }; + } + + /// + /// A which scales its content relative to a target width. + /// + private class ScalingContainer : Container + { + private readonly float targetWidth; + + public ScalingContainer(float targetWidth) + { + this.targetWidth = targetWidth; + } + + protected override void Update() + { + base.Update(); + + Scale = new Vector2(Parent.ChildSize.X / targetWidth); + Size = Vector2.Divide(Vector2.One, Scale); + } + } + } +} diff --git a/osu.Game.Rulesets.Osu/UI/ScalingContainer.cs b/osu.Game.Rulesets.Osu/UI/ScalingContainer.cs deleted file mode 100644 index 0a9bec67fb..0000000000 --- a/osu.Game.Rulesets.Osu/UI/ScalingContainer.cs +++ /dev/null @@ -1,29 +0,0 @@ -// Copyright (c) 2007-2018 ppy Pty Ltd . -// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE - -using osu.Framework.Graphics.Containers; -using OpenTK; - -namespace osu.Game.Rulesets.Osu.UI -{ - /// - /// A which scales its content relative to a target width. - /// - public class ScalingContainer : Container - { - private readonly float targetWidth; - - public ScalingContainer(float targetWidth) - { - this.targetWidth = targetWidth; - } - - protected override void Update() - { - base.Update(); - - Scale = new Vector2(Parent.ChildSize.X / targetWidth); - Size = Vector2.Divide(Vector2.One, Scale); - } - } -} From 26094ea3254c3c58e09ab9698b91e8685c300ecd Mon Sep 17 00:00:00 2001 From: smoogipoo Date: Fri, 21 Sep 2018 15:01:58 +0900 Subject: [PATCH 142/417] Simplify + rename playfield layers in Osu/Catch --- osu.Game.Rulesets.Catch/UI/CatchPlayfield.cs | 2 +- .../UI/{ScalingContainer.cs => PlayfieldLayer.cs} | 14 ++------------ osu.Game.Rulesets.Osu/UI/PlayfieldLayer.cs | 11 ++--------- 3 files changed, 5 insertions(+), 22 deletions(-) rename osu.Game.Rulesets.Catch/UI/{ScalingContainer.cs => PlayfieldLayer.cs} (50%) diff --git a/osu.Game.Rulesets.Catch/UI/CatchPlayfield.cs b/osu.Game.Rulesets.Catch/UI/CatchPlayfield.cs index aa3fcefd9b..a926054b24 100644 --- a/osu.Game.Rulesets.Catch/UI/CatchPlayfield.cs +++ b/osu.Game.Rulesets.Catch/UI/CatchPlayfield.cs @@ -37,7 +37,7 @@ namespace osu.Game.Rulesets.Catch.UI RelativeSizeAxes = Axes.Both, FillMode = FillMode.Fit, FillAspectRatio = 4f / 3, - Child = new ScalingContainer(BASE_WIDTH) + Child = new PlayfieldLayer { RelativeSizeAxes = Axes.Both, Children = new Drawable[] diff --git a/osu.Game.Rulesets.Catch/UI/ScalingContainer.cs b/osu.Game.Rulesets.Catch/UI/PlayfieldLayer.cs similarity index 50% rename from osu.Game.Rulesets.Catch/UI/ScalingContainer.cs rename to osu.Game.Rulesets.Catch/UI/PlayfieldLayer.cs index a2011dcc6f..c2cce6361d 100644 --- a/osu.Game.Rulesets.Catch/UI/ScalingContainer.cs +++ b/osu.Game.Rulesets.Catch/UI/PlayfieldLayer.cs @@ -6,23 +6,13 @@ using OpenTK; namespace osu.Game.Rulesets.Catch.UI { - /// - /// A which scales its content relative to a target width. - /// - public class ScalingContainer : Container + public class PlayfieldLayer : Container { - private readonly float targetWidth; - - public ScalingContainer(float targetWidth) - { - this.targetWidth = targetWidth; - } - protected override void Update() { base.Update(); - Scale = new Vector2(Parent.ChildSize.X / targetWidth); + Scale = new Vector2(Parent.ChildSize.X / CatchPlayfield.BASE_WIDTH); Size = Vector2.Divide(Vector2.One, Scale); } } diff --git a/osu.Game.Rulesets.Osu/UI/PlayfieldLayer.cs b/osu.Game.Rulesets.Osu/UI/PlayfieldLayer.cs index 4d1eea27c9..a4c84e4905 100644 --- a/osu.Game.Rulesets.Osu/UI/PlayfieldLayer.cs +++ b/osu.Game.Rulesets.Osu/UI/PlayfieldLayer.cs @@ -21,7 +21,7 @@ namespace osu.Game.Rulesets.Osu.UI RelativeSizeAxes = Axes.Both, FillMode = FillMode.Fit, FillAspectRatio = 4f / 3, - Child = content = new ScalingContainer(OsuPlayfield.BASE_SIZE.X) { RelativeSizeAxes = Axes.Both } + Child = content = new ScalingContainer { RelativeSizeAxes = Axes.Both } }; } @@ -30,18 +30,11 @@ namespace osu.Game.Rulesets.Osu.UI /// private class ScalingContainer : Container { - private readonly float targetWidth; - - public ScalingContainer(float targetWidth) - { - this.targetWidth = targetWidth; - } - protected override void Update() { base.Update(); - Scale = new Vector2(Parent.ChildSize.X / targetWidth); + Scale = new Vector2(Parent.ChildSize.X / OsuPlayfield.BASE_SIZE.X); Size = Vector2.Divide(Vector2.One, Scale); } } From 0bc2bcaf1480d31ec1c22e7f631591ae2d0fb586 Mon Sep 17 00:00:00 2001 From: smoogipoo Date: Fri, 21 Sep 2018 15:08:43 +0900 Subject: [PATCH 143/417] Remove GetAspectAdjustedSize() and PlayfieldArea --- osu.Game.Rulesets.Catch/UI/CatchPlayfield.cs | 3 + .../UI/CatchRulesetContainer.cs | 3 - .../Edit/ManiaEditRulesetContainer.cs | 3 +- osu.Game.Rulesets.Mania/UI/ManiaPlayfield.cs | 3 + .../UI/ManiaRulesetContainer.cs | 3 - .../Edit/OsuEditRulesetContainer.cs | 5 +- osu.Game.Rulesets.Osu/UI/OsuPlayfield.cs | 2 + osu.Game.Rulesets.Taiko/UI/PlayfieldLayer.cs | 22 ++ osu.Game.Rulesets.Taiko/UI/TaikoPlayfield.cs | 252 +++++++++--------- .../UI/TaikoRulesetContainer.cs | 20 +- osu.Game/Rulesets/UI/RulesetContainer.cs | 21 -- 11 files changed, 164 insertions(+), 173 deletions(-) create mode 100644 osu.Game.Rulesets.Taiko/UI/PlayfieldLayer.cs diff --git a/osu.Game.Rulesets.Catch/UI/CatchPlayfield.cs b/osu.Game.Rulesets.Catch/UI/CatchPlayfield.cs index a926054b24..8b5ec2df9b 100644 --- a/osu.Game.Rulesets.Catch/UI/CatchPlayfield.cs +++ b/osu.Game.Rulesets.Catch/UI/CatchPlayfield.cs @@ -10,6 +10,7 @@ using osu.Game.Rulesets.Catch.Objects.Drawable; using osu.Game.Rulesets.Judgements; using osu.Game.Rulesets.Objects.Drawables; using osu.Game.Rulesets.UI.Scrolling; +using OpenTK; namespace osu.Game.Rulesets.Catch.UI { @@ -30,6 +31,8 @@ namespace osu.Game.Rulesets.Catch.UI Anchor = Anchor.TopCentre; Origin = Anchor.TopCentre; + Size = new Vector2(0.86f); // matches stable's vertical offset for catcher plate + InternalChild = new Container { Anchor = Anchor.Centre, diff --git a/osu.Game.Rulesets.Catch/UI/CatchRulesetContainer.cs b/osu.Game.Rulesets.Catch/UI/CatchRulesetContainer.cs index 1ac052de4d..bd0fec43a1 100644 --- a/osu.Game.Rulesets.Catch/UI/CatchRulesetContainer.cs +++ b/osu.Game.Rulesets.Catch/UI/CatchRulesetContainer.cs @@ -13,7 +13,6 @@ using osu.Game.Rulesets.Replays; using osu.Game.Rulesets.Scoring; using osu.Game.Rulesets.UI; using osu.Game.Rulesets.UI.Scrolling; -using OpenTK; namespace osu.Game.Rulesets.Catch.UI { @@ -32,8 +31,6 @@ namespace osu.Game.Rulesets.Catch.UI public override PassThroughInputManager CreateInputManager() => new CatchInputManager(Ruleset.RulesetInfo); - protected override Vector2 PlayfieldArea => new Vector2(0.86f); // matches stable's vertical offset for catcher plate - protected override DrawableHitObject GetVisualRepresentation(CatchHitObject h) { switch (h) diff --git a/osu.Game.Rulesets.Mania/Edit/ManiaEditRulesetContainer.cs b/osu.Game.Rulesets.Mania/Edit/ManiaEditRulesetContainer.cs index a01947a60b..138a2c0273 100644 --- a/osu.Game.Rulesets.Mania/Edit/ManiaEditRulesetContainer.cs +++ b/osu.Game.Rulesets.Mania/Edit/ManiaEditRulesetContainer.cs @@ -20,8 +20,7 @@ namespace osu.Game.Rulesets.Mania.Edit { Anchor = Anchor.Centre, Origin = Anchor.Centre, + Size = Vector2.One }; - - protected override Vector2 PlayfieldArea => Vector2.One; } } diff --git a/osu.Game.Rulesets.Mania/UI/ManiaPlayfield.cs b/osu.Game.Rulesets.Mania/UI/ManiaPlayfield.cs index 999f84ed8e..5c3a618a19 100644 --- a/osu.Game.Rulesets.Mania/UI/ManiaPlayfield.cs +++ b/osu.Game.Rulesets.Mania/UI/ManiaPlayfield.cs @@ -10,6 +10,7 @@ using osu.Game.Rulesets.Mania.Beatmaps; using osu.Game.Rulesets.Mania.Configuration; using osu.Game.Rulesets.Mania.Objects; using osu.Game.Rulesets.Objects.Drawables; +using OpenTK; namespace osu.Game.Rulesets.Mania.UI { @@ -25,6 +26,8 @@ namespace osu.Game.Rulesets.Mania.UI if (stageDefinitions.Count <= 0) throw new ArgumentException("Can't have zero or fewer stages."); + Size = new Vector2(1, 0.8f); + GridContainer playfieldGrid; AddInternal(playfieldGrid = new GridContainer { diff --git a/osu.Game.Rulesets.Mania/UI/ManiaRulesetContainer.cs b/osu.Game.Rulesets.Mania/UI/ManiaRulesetContainer.cs index 09ebde2799..49874f6dc1 100644 --- a/osu.Game.Rulesets.Mania/UI/ManiaRulesetContainer.cs +++ b/osu.Game.Rulesets.Mania/UI/ManiaRulesetContainer.cs @@ -24,7 +24,6 @@ using osu.Game.Rulesets.Replays; using osu.Game.Rulesets.Scoring; using osu.Game.Rulesets.UI; using osu.Game.Rulesets.UI.Scrolling; -using OpenTK; namespace osu.Game.Rulesets.Mania.UI { @@ -110,8 +109,6 @@ namespace osu.Game.Rulesets.Mania.UI } } - protected override Vector2 PlayfieldArea => new Vector2(1, 0.8f); - protected override ReplayInputHandler CreateReplayInputHandler(Replay replay) => new ManiaFramedReplayInputHandler(replay); } } diff --git a/osu.Game.Rulesets.Osu/Edit/OsuEditRulesetContainer.cs b/osu.Game.Rulesets.Osu/Edit/OsuEditRulesetContainer.cs index 6efa16bf56..8571de39f4 100644 --- a/osu.Game.Rulesets.Osu/Edit/OsuEditRulesetContainer.cs +++ b/osu.Game.Rulesets.Osu/Edit/OsuEditRulesetContainer.cs @@ -4,6 +4,7 @@ using osu.Framework.Graphics.Cursor; using osu.Game.Beatmaps; using osu.Game.Rulesets.Osu.UI; +using osu.Game.Rulesets.UI; using OpenTK; namespace osu.Game.Rulesets.Osu.Edit @@ -15,8 +16,8 @@ namespace osu.Game.Rulesets.Osu.Edit { } - protected override Vector2 PlayfieldArea => Vector2.One; - protected override CursorContainer CreateCursor() => null; + + protected override Playfield CreatePlayfield() => new OsuPlayfield { Size = Vector2.One }; } } diff --git a/osu.Game.Rulesets.Osu/UI/OsuPlayfield.cs b/osu.Game.Rulesets.Osu/UI/OsuPlayfield.cs index 9b3a6a7131..ae8dc7397d 100644 --- a/osu.Game.Rulesets.Osu/UI/OsuPlayfield.cs +++ b/osu.Game.Rulesets.Osu/UI/OsuPlayfield.cs @@ -27,6 +27,8 @@ namespace osu.Game.Rulesets.Osu.UI Anchor = Anchor.Centre; Origin = Anchor.Centre; + Size = new Vector2(0.75f); + InternalChild = new PlayfieldLayer { RelativeSizeAxes = Axes.Both, diff --git a/osu.Game.Rulesets.Taiko/UI/PlayfieldLayer.cs b/osu.Game.Rulesets.Taiko/UI/PlayfieldLayer.cs new file mode 100644 index 0000000000..c4e2f32c92 --- /dev/null +++ b/osu.Game.Rulesets.Taiko/UI/PlayfieldLayer.cs @@ -0,0 +1,22 @@ +// Copyright (c) 2007-2018 ppy Pty Ltd . +// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE + +using osu.Framework.Graphics.Containers; +using OpenTK; + +namespace osu.Game.Rulesets.Taiko.UI +{ + public class PlayfieldLayer : Container + { + private const float default_relative_height = TaikoPlayfield.DEFAULT_HEIGHT / 768; + private const float default_aspect = 16f / 9f; + + protected override void Update() + { + base.Update(); + + float aspectAdjust = MathHelper.Clamp(Parent.ChildSize.X / Parent.ChildSize.Y, 0.4f, 4) / default_aspect; + Size = new Vector2(1, default_relative_height * aspectAdjust); + } + } +} diff --git a/osu.Game.Rulesets.Taiko/UI/TaikoPlayfield.cs b/osu.Game.Rulesets.Taiko/UI/TaikoPlayfield.cs index 6c443a2ac1..82ab327993 100644 --- a/osu.Game.Rulesets.Taiko/UI/TaikoPlayfield.cs +++ b/osu.Game.Rulesets.Taiko/UI/TaikoPlayfield.cs @@ -58,139 +58,145 @@ namespace osu.Game.Rulesets.Taiko.UI { Direction.Value = ScrollingDirection.Left; - AddRangeInternal(new Drawable[] + InternalChild = new PlayfieldLayer { - backgroundContainer = new Container + Anchor = Anchor.CentreLeft, + Origin = Anchor.CentreLeft, + RelativeSizeAxes = Axes.Both, + Children = new Drawable[] { - Name = "Transparent playfield background", - RelativeSizeAxes = Axes.Both, - Masking = true, - EdgeEffect = new EdgeEffectParameters + backgroundContainer = new Container { - Type = EdgeEffectType.Shadow, - Colour = Color4.Black.Opacity(0.2f), - Radius = 5, - }, - Children = new Drawable[] - { - background = new Box + Name = "Transparent playfield background", + RelativeSizeAxes = Axes.Both, + Masking = true, + EdgeEffect = new EdgeEffectParameters { - RelativeSizeAxes = Axes.Both, - Alpha = 0.6f + Type = EdgeEffectType.Shadow, + Colour = Color4.Black.Opacity(0.2f), + Radius = 5, }, - } - }, - new Container - { - Name = "Right area", - RelativeSizeAxes = Axes.Both, - Padding = new MarginPadding { Left = left_area_size }, - Children = new Drawable[] - { - new Container + Children = new Drawable[] { - Name = "Masked elements before hit objects", - RelativeSizeAxes = Axes.Both, - Padding = new MarginPadding { Left = HIT_TARGET_OFFSET }, - Masking = true, - Children = new Drawable[] + background = new Box { - hitExplosionContainer = new Container - { - RelativeSizeAxes = Axes.Both, - FillMode = FillMode.Fit, - Blending = BlendingMode.Additive, - }, - new HitTarget - { - Anchor = Anchor.CentreLeft, - Origin = Anchor.Centre, - RelativeSizeAxes = Axes.Both, - FillMode = FillMode.Fit - } - } - }, - barlineContainer = new Container - { - RelativeSizeAxes = Axes.Both, - Padding = new MarginPadding { Left = HIT_TARGET_OFFSET } - }, - new Container - { - Name = "Hit objects", - RelativeSizeAxes = Axes.Both, - Padding = new MarginPadding { Left = HIT_TARGET_OFFSET }, - Masking = true, - Child = HitObjectContainer - }, - kiaiExplosionContainer = new Container - { - Name = "Kiai hit explosions", - RelativeSizeAxes = Axes.Both, - FillMode = FillMode.Fit, - Margin = new MarginPadding { Left = HIT_TARGET_OFFSET }, - Blending = BlendingMode.Additive - }, - judgementContainer = new JudgementContainer - { - Name = "Judgements", - RelativeSizeAxes = Axes.Y, - Margin = new MarginPadding { Left = HIT_TARGET_OFFSET }, - Blending = BlendingMode.Additive - }, - } - }, - overlayBackgroundContainer = new Container - { - Name = "Left overlay", - RelativeSizeAxes = Axes.Y, - Size = new Vector2(left_area_size, 1), - Children = new Drawable[] - { - overlayBackground = new Box - { - RelativeSizeAxes = Axes.Both, - }, - new InputDrum(controlPoints) - { - Anchor = Anchor.CentreRight, - Origin = Anchor.CentreRight, - Scale = new Vector2(0.9f), - Margin = new MarginPadding { Right = 20 } - }, - new Box - { - Anchor = Anchor.TopRight, - RelativeSizeAxes = Axes.Y, - Width = 10, - Colour = Framework.Graphics.Colour.ColourInfo.GradientHorizontal(Color4.Black.Opacity(0.6f), Color4.Black.Opacity(0)), - }, - } - }, - new Container - { - Name = "Border", - RelativeSizeAxes = Axes.Both, - Masking = true, - MaskingSmoothness = 0, - BorderThickness = 2, - AlwaysPresent = true, - Children = new[] - { - new Box - { - RelativeSizeAxes = Axes.Both, - Alpha = 0, - AlwaysPresent = true + RelativeSizeAxes = Axes.Both, + Alpha = 0.6f + }, } + }, + new Container + { + Name = "Right area", + RelativeSizeAxes = Axes.Both, + Padding = new MarginPadding { Left = left_area_size }, + Children = new Drawable[] + { + new Container + { + Name = "Masked elements before hit objects", + RelativeSizeAxes = Axes.Both, + Padding = new MarginPadding { Left = HIT_TARGET_OFFSET }, + Masking = true, + Children = new Drawable[] + { + hitExplosionContainer = new Container + { + RelativeSizeAxes = Axes.Both, + FillMode = FillMode.Fit, + Blending = BlendingMode.Additive, + }, + new HitTarget + { + Anchor = Anchor.CentreLeft, + Origin = Anchor.Centre, + RelativeSizeAxes = Axes.Both, + FillMode = FillMode.Fit + } + } + }, + barlineContainer = new Container + { + RelativeSizeAxes = Axes.Both, + Padding = new MarginPadding { Left = HIT_TARGET_OFFSET } + }, + new Container + { + Name = "Hit objects", + RelativeSizeAxes = Axes.Both, + Padding = new MarginPadding { Left = HIT_TARGET_OFFSET }, + Masking = true, + Child = HitObjectContainer + }, + kiaiExplosionContainer = new Container + { + Name = "Kiai hit explosions", + RelativeSizeAxes = Axes.Both, + FillMode = FillMode.Fit, + Margin = new MarginPadding { Left = HIT_TARGET_OFFSET }, + Blending = BlendingMode.Additive + }, + judgementContainer = new JudgementContainer + { + Name = "Judgements", + RelativeSizeAxes = Axes.Y, + Margin = new MarginPadding { Left = HIT_TARGET_OFFSET }, + Blending = BlendingMode.Additive + }, + } + }, + overlayBackgroundContainer = new Container + { + Name = "Left overlay", + RelativeSizeAxes = Axes.Y, + Size = new Vector2(left_area_size, 1), + Children = new Drawable[] + { + overlayBackground = new Box + { + RelativeSizeAxes = Axes.Both, + }, + new InputDrum(controlPoints) + { + Anchor = Anchor.CentreRight, + Origin = Anchor.CentreRight, + Scale = new Vector2(0.9f), + Margin = new MarginPadding { Right = 20 } + }, + new Box + { + Anchor = Anchor.TopRight, + RelativeSizeAxes = Axes.Y, + Width = 10, + Colour = Framework.Graphics.Colour.ColourInfo.GradientHorizontal(Color4.Black.Opacity(0.6f), Color4.Black.Opacity(0)), + }, + } + }, + new Container + { + Name = "Border", + RelativeSizeAxes = Axes.Both, + Masking = true, + MaskingSmoothness = 0, + BorderThickness = 2, + AlwaysPresent = true, + Children = new[] + { + new Box + { + RelativeSizeAxes = Axes.Both, + Alpha = 0, + AlwaysPresent = true + } + } + }, + topLevelHitContainer = new Container + { + Name = "Top level hit objects", + RelativeSizeAxes = Axes.Both, } - }, - topLevelHitContainer = new Container - { - Name = "Top level hit objects", - RelativeSizeAxes = Axes.Both, } - }); + }; VisibleTimeRange.Value = 6000; } diff --git a/osu.Game.Rulesets.Taiko/UI/TaikoRulesetContainer.cs b/osu.Game.Rulesets.Taiko/UI/TaikoRulesetContainer.cs index 229ab69ceb..3d08bffe0f 100644 --- a/osu.Game.Rulesets.Taiko/UI/TaikoRulesetContainer.cs +++ b/osu.Game.Rulesets.Taiko/UI/TaikoRulesetContainer.cs @@ -2,7 +2,6 @@ // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE using osu.Framework.Allocation; -using osu.Framework.Graphics; using osu.Game.Beatmaps; using osu.Game.Rulesets.Objects.Drawables; using osu.Game.Rulesets.Objects.Types; @@ -13,7 +12,6 @@ using osu.Game.Rulesets.Taiko.Objects.Drawables; using osu.Game.Rulesets.Taiko.Scoring; using osu.Game.Rulesets.UI; using osu.Game.Rulesets.Taiko.Replays; -using OpenTK; using System.Linq; using osu.Framework.Input; using osu.Game.Input.Handlers; @@ -74,27 +72,11 @@ namespace osu.Game.Rulesets.Taiko.UI } } - protected override Vector2 GetAspectAdjustedSize() - { - const float default_relative_height = TaikoPlayfield.DEFAULT_HEIGHT / 768; - const float default_aspect = 16f / 9f; - - float aspectAdjust = MathHelper.Clamp(DrawWidth / DrawHeight, 0.4f, 4) / default_aspect; - - return new Vector2(1, default_relative_height * aspectAdjust); - } - - protected override Vector2 PlayfieldArea => Vector2.One; - public override ScoreProcessor CreateScoreProcessor() => new TaikoScoreProcessor(this); public override PassThroughInputManager CreateInputManager() => new TaikoInputManager(Ruleset.RulesetInfo); - protected override Playfield CreatePlayfield() => new TaikoPlayfield(Beatmap.ControlPointInfo) - { - Anchor = Anchor.CentreLeft, - Origin = Anchor.CentreLeft - }; + protected override Playfield CreatePlayfield() => new TaikoPlayfield(Beatmap.ControlPointInfo); protected override DrawableHitObject GetVisualRepresentation(TaikoHitObject h) { diff --git a/osu.Game/Rulesets/UI/RulesetContainer.cs b/osu.Game/Rulesets/UI/RulesetContainer.cs index a830803fb1..a23a5a78f7 100644 --- a/osu.Game/Rulesets/UI/RulesetContainer.cs +++ b/osu.Game/Rulesets/UI/RulesetContainer.cs @@ -22,7 +22,6 @@ using osu.Game.Overlays; using osu.Game.Rulesets.Configuration; using osu.Game.Rulesets.Replays; using osu.Game.Rulesets.Scoring; -using OpenTK; namespace osu.Game.Rulesets.UI { @@ -309,26 +308,6 @@ namespace osu.Game.Rulesets.UI mod.ApplyToDrawableHitObjects(Playfield.HitObjectContainer.Objects); } - protected override void Update() - { - base.Update(); - - Playfield.Size = GetAspectAdjustedSize() * PlayfieldArea; - } - - /// - /// Computes the size of the in relative coordinate space after aspect adjustments. - /// - /// The aspect-adjusted size. - protected virtual Vector2 GetAspectAdjustedSize() => Vector2.One; - - /// - /// The area of this that is available for the to use. - /// Must be specified in relative coordinate space to this . - /// This affects the final size of the but does not affect the 's scale. - /// - protected virtual Vector2 PlayfieldArea => new Vector2(0.75f); // A sane default - /// /// Creates a DrawableHitObject from a HitObject. /// From c3fa7f167fbf701f961b516e3527969bc93b8149 Mon Sep 17 00:00:00 2001 From: smoogipoo Date: Fri, 21 Sep 2018 15:53:06 +0900 Subject: [PATCH 144/417] Move aspect adjustments out of CatchPlayfield --- osu.Game.Rulesets.Catch/UI/CatchPlayfield.cs | 34 ++++++++------------ osu.Game.Rulesets.Catch/UI/PlayfieldLayer.cs | 33 ++++++++++++++++--- 2 files changed, 41 insertions(+), 26 deletions(-) diff --git a/osu.Game.Rulesets.Catch/UI/CatchPlayfield.cs b/osu.Game.Rulesets.Catch/UI/CatchPlayfield.cs index 8b5ec2df9b..b90b90f45a 100644 --- a/osu.Game.Rulesets.Catch/UI/CatchPlayfield.cs +++ b/osu.Game.Rulesets.Catch/UI/CatchPlayfield.cs @@ -33,31 +33,23 @@ namespace osu.Game.Rulesets.Catch.UI Size = new Vector2(0.86f); // matches stable's vertical offset for catcher plate - InternalChild = new Container + InternalChild = new PlayfieldLayer { - Anchor = Anchor.Centre, - Origin = Anchor.Centre, RelativeSizeAxes = Axes.Both, - FillMode = FillMode.Fit, - FillAspectRatio = 4f / 3, - Child = new PlayfieldLayer + Children = new Drawable[] { - RelativeSizeAxes = Axes.Both, - Children = new Drawable[] + explodingFruitContainer = new Container { - explodingFruitContainer = new Container - { - RelativeSizeAxes = Axes.Both, - }, - catcherArea = new CatcherArea(difficulty) - { - GetVisualRepresentation = getVisualRepresentation, - ExplodingFruitTarget = explodingFruitContainer, - Anchor = Anchor.BottomLeft, - Origin = Anchor.TopLeft, - }, - HitObjectContainer - } + RelativeSizeAxes = Axes.Both, + }, + catcherArea = new CatcherArea(difficulty) + { + GetVisualRepresentation = getVisualRepresentation, + ExplodingFruitTarget = explodingFruitContainer, + Anchor = Anchor.BottomLeft, + Origin = Anchor.TopLeft, + }, + HitObjectContainer } }; } diff --git a/osu.Game.Rulesets.Catch/UI/PlayfieldLayer.cs b/osu.Game.Rulesets.Catch/UI/PlayfieldLayer.cs index c2cce6361d..d167dc59cc 100644 --- a/osu.Game.Rulesets.Catch/UI/PlayfieldLayer.cs +++ b/osu.Game.Rulesets.Catch/UI/PlayfieldLayer.cs @@ -1,6 +1,7 @@ // Copyright (c) 2007-2018 ppy Pty Ltd . // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE +using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using OpenTK; @@ -8,12 +9,34 @@ namespace osu.Game.Rulesets.Catch.UI { public class PlayfieldLayer : Container { - protected override void Update() - { - base.Update(); + protected override Container Content => content; + private readonly Container content; - Scale = new Vector2(Parent.ChildSize.X / CatchPlayfield.BASE_WIDTH); - Size = Vector2.Divide(Vector2.One, Scale); + public PlayfieldLayer() + { + InternalChild = new Container + { + Anchor = Anchor.Centre, + Origin = Anchor.Centre, + RelativeSizeAxes = Axes.Both, + FillMode = FillMode.Fit, + FillAspectRatio = 4f / 3, + Child = content = new ScalingContainer { RelativeSizeAxes = Axes.Both } + }; + } + + /// + /// A which scales its content relative to a target width. + /// + private class ScalingContainer : Container + { + protected override void Update() + { + base.Update(); + + Scale = new Vector2(Parent.ChildSize.X / CatchPlayfield.BASE_WIDTH); + Size = Vector2.Divide(Vector2.One, Scale); + } } } } From cdeb4913c420591de7761c4e851ccef3437b2efa Mon Sep 17 00:00:00 2001 From: smoogipoo Date: Fri, 21 Sep 2018 15:11:12 +0900 Subject: [PATCH 145/417] Adjust catcher size to match stable --- osu.Game.Rulesets.Catch/UI/CatcherArea.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu.Game.Rulesets.Catch/UI/CatcherArea.cs b/osu.Game.Rulesets.Catch/UI/CatcherArea.cs index be56ccf8c1..06453ac32d 100644 --- a/osu.Game.Rulesets.Catch/UI/CatcherArea.cs +++ b/osu.Game.Rulesets.Catch/UI/CatcherArea.cs @@ -25,7 +25,7 @@ namespace osu.Game.Rulesets.Catch.UI { public class CatcherArea : Container { - public const float CATCHER_SIZE = 84; + public const float CATCHER_SIZE = 100; protected readonly Catcher MovableCatcher; From 4380ef15bf32810090c693e95078a18e29eb7efd Mon Sep 17 00:00:00 2001 From: smoogipoo Date: Fri, 21 Sep 2018 16:31:09 +0900 Subject: [PATCH 146/417] Fix potential exception during async load callback --- osu.Game/Screens/Backgrounds/BackgroundScreenBeatmap.cs | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/osu.Game/Screens/Backgrounds/BackgroundScreenBeatmap.cs b/osu.Game/Screens/Backgrounds/BackgroundScreenBeatmap.cs index 62f24e8e5c..e326cdb0ca 100644 --- a/osu.Game/Screens/Backgrounds/BackgroundScreenBeatmap.cs +++ b/osu.Game/Screens/Backgrounds/BackgroundScreenBeatmap.cs @@ -12,6 +12,7 @@ namespace osu.Game.Screens.Backgrounds public class BackgroundScreenBeatmap : BlurrableBackgroundScreen { private WorkingBeatmap beatmap; + public WorkingBeatmap Beatmap { get { return beatmap; } @@ -24,7 +25,7 @@ namespace osu.Game.Screens.Backgrounds Schedule(() => { - LoadComponentAsync(new BeatmapBackground(beatmap), b => + LoadComponentAsync(new BeatmapBackground(beatmap), b => Schedule(() => { float newDepth = 0; if (Background != null) @@ -38,7 +39,7 @@ namespace osu.Game.Screens.Backgrounds b.Depth = newDepth; Add(Background = b); Background.BlurSigma = BlurTarget; - }); + })); }); } } From dafbabec31de7bc6e91b83f53b6edf41e30219df Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Fri, 21 Sep 2018 21:08:21 +0900 Subject: [PATCH 147/417] Fix import buttons having incorrect mappings when setting disabled states --- .../Sections/Maintenance/GeneralSettings.cs | 34 ++++++++++--------- 1 file changed, 18 insertions(+), 16 deletions(-) diff --git a/osu.Game/Overlays/Settings/Sections/Maintenance/GeneralSettings.cs b/osu.Game/Overlays/Settings/Sections/Maintenance/GeneralSettings.cs index 57e9a528d2..835ec808bc 100644 --- a/osu.Game/Overlays/Settings/Sections/Maintenance/GeneralSettings.cs +++ b/osu.Game/Overlays/Settings/Sections/Maintenance/GeneralSettings.cs @@ -13,57 +13,59 @@ namespace osu.Game.Overlays.Settings.Sections.Maintenance { public class GeneralSettings : SettingsSubsection { - private TriangleButton importButton; - private TriangleButton deleteButton; + protected override string Header => "General"; + + private TriangleButton importBeatmapsButton; + private TriangleButton importSkinsButton; + private TriangleButton deleteSkinsButton; + private TriangleButton deleteBeatmapsButton; private TriangleButton restoreButton; private TriangleButton undeleteButton; - protected override string Header => "General"; - [BackgroundDependencyLoader] private void load(BeatmapManager beatmaps, SkinManager skins, DialogOverlay dialogOverlay) { Children = new Drawable[] { - importButton = new SettingsButton + importBeatmapsButton = new SettingsButton { Text = "Import beatmaps from stable", Action = () => { - importButton.Enabled.Value = false; - beatmaps.ImportFromStableAsync().ContinueWith(t => Schedule(() => importButton.Enabled.Value = true)); + importBeatmapsButton.Enabled.Value = false; + beatmaps.ImportFromStableAsync().ContinueWith(t => Schedule(() => importBeatmapsButton.Enabled.Value = true)); } }, - deleteButton = new DangerousSettingsButton + deleteBeatmapsButton = new DangerousSettingsButton { Text = "Delete ALL beatmaps", Action = () => { dialogOverlay?.Push(new DeleteAllBeatmapsDialog(() => { - deleteButton.Enabled.Value = false; - Task.Run(() => beatmaps.Delete(beatmaps.GetAllUsableBeatmapSets())).ContinueWith(t => Schedule(() => deleteButton.Enabled.Value = true)); + deleteBeatmapsButton.Enabled.Value = false; + Task.Run(() => beatmaps.Delete(beatmaps.GetAllUsableBeatmapSets())).ContinueWith(t => Schedule(() => deleteBeatmapsButton.Enabled.Value = true)); })); } }, - importButton = new SettingsButton + importSkinsButton = new SettingsButton { Text = "Import skins from stable", Action = () => { - importButton.Enabled.Value = false; - skins.ImportFromStableAsync().ContinueWith(t => Schedule(() => importButton.Enabled.Value = true)); + importSkinsButton.Enabled.Value = false; + skins.ImportFromStableAsync().ContinueWith(t => Schedule(() => importSkinsButton.Enabled.Value = true)); } }, - deleteButton = new DangerousSettingsButton + deleteSkinsButton = new DangerousSettingsButton { Text = "Delete ALL skins", Action = () => { dialogOverlay?.Push(new DeleteAllBeatmapsDialog(() => { - deleteButton.Enabled.Value = false; - Task.Run(() => skins.Delete(skins.GetAllUserSkins())).ContinueWith(t => Schedule(() => deleteButton.Enabled.Value = true)); + deleteSkinsButton.Enabled.Value = false; + Task.Run(() => skins.Delete(skins.GetAllUserSkins())).ContinueWith(t => Schedule(() => deleteSkinsButton.Enabled.Value = true)); })); } }, From 6efecc4b356f612436349ccfd852af5121385123 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Sun, 23 Sep 2018 05:23:49 +0900 Subject: [PATCH 148/417] Fix files with upper-case extensions failing to import correctly --- osu.Game/IPC/ArchiveImportIPCChannel.cs | 2 +- osu.Game/OsuGameBase.cs | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/osu.Game/IPC/ArchiveImportIPCChannel.cs b/osu.Game/IPC/ArchiveImportIPCChannel.cs index 6783b9712c..e127faa70d 100644 --- a/osu.Game/IPC/ArchiveImportIPCChannel.cs +++ b/osu.Game/IPC/ArchiveImportIPCChannel.cs @@ -37,7 +37,7 @@ namespace osu.Game.IPC return; } - if (importer.HandledExtensions.Contains(Path.GetExtension(path))) + if (importer.HandledExtensions.Contains(Path.GetExtension(path)?.ToLower())) importer.Import(path); } } diff --git a/osu.Game/OsuGameBase.cs b/osu.Game/OsuGameBase.cs index 9a5dac35b9..36ca043df6 100644 --- a/osu.Game/OsuGameBase.cs +++ b/osu.Game/OsuGameBase.cs @@ -243,7 +243,7 @@ namespace osu.Game public void Import(params string[] paths) { - var extension = Path.GetExtension(paths.First()); + var extension = Path.GetExtension(paths.First())?.ToLower(); foreach (var importer in fileImporters) if (importer.HandledExtensions.Contains(extension)) importer.Import(paths); From 7a4367784928e123a2a5a080837c656c5d61693a Mon Sep 17 00:00:00 2001 From: Kyle Chang Date: Sat, 22 Sep 2018 22:54:38 -0400 Subject: [PATCH 149/417] Make judgements scale with cs --- osu.Game.Rulesets.Osu/UI/OsuPlayfield.cs | 10 ++++++++-- osu.Game.Rulesets.Osu/UI/OsuRulesetContainer.cs | 2 +- osu.Game/Rulesets/Judgements/DrawableJudgement.cs | 10 ++++++---- 3 files changed, 15 insertions(+), 7 deletions(-) diff --git a/osu.Game.Rulesets.Osu/UI/OsuPlayfield.cs b/osu.Game.Rulesets.Osu/UI/OsuPlayfield.cs index 61937a535c..f2c18d4c9c 100644 --- a/osu.Game.Rulesets.Osu/UI/OsuPlayfield.cs +++ b/osu.Game.Rulesets.Osu/UI/OsuPlayfield.cs @@ -19,12 +19,15 @@ namespace osu.Game.Rulesets.Osu.UI private readonly Container approachCircles; private readonly JudgementContainer judgementLayer; private readonly ConnectionRenderer connectionLayer; + private readonly OsuRulesetContainer rulesetContainer; public static readonly Vector2 BASE_SIZE = new Vector2(512, 384); - public OsuPlayfield() + public OsuPlayfield(OsuRulesetContainer rulesetContainer) : base(BASE_SIZE.X) { + this.rulesetContainer = rulesetContainer; + Anchor = Anchor.Centre; Origin = Anchor.Centre; @@ -69,10 +72,13 @@ namespace osu.Game.Rulesets.Osu.UI if (!judgedObject.DisplayResult || !DisplayJudgements) return; + var explosionBaseSize = rulesetContainer.Beatmap.BeatmapInfo.BaseDifficulty.CircleSize; + DrawableOsuJudgement explosion = new DrawableOsuJudgement(result, judgedObject) { Origin = Anchor.Centre, - Position = ((OsuHitObject)judgedObject.HitObject).StackedEndPosition + Position = ((OsuHitObject)judgedObject.HitObject).StackedEndPosition, + Scale = new Vector2((1.0f - 0.7f * (explosionBaseSize - 5) / 5) / 2 * 1.65f) }; judgementLayer.Add(explosion); diff --git a/osu.Game.Rulesets.Osu/UI/OsuRulesetContainer.cs b/osu.Game.Rulesets.Osu/UI/OsuRulesetContainer.cs index 4bc6992445..6cea8a0030 100644 --- a/osu.Game.Rulesets.Osu/UI/OsuRulesetContainer.cs +++ b/osu.Game.Rulesets.Osu/UI/OsuRulesetContainer.cs @@ -28,7 +28,7 @@ namespace osu.Game.Rulesets.Osu.UI public override ScoreProcessor CreateScoreProcessor() => new OsuScoreProcessor(this); - protected override Playfield CreatePlayfield() => new OsuPlayfield(); + protected override Playfield CreatePlayfield() => new OsuPlayfield(this); public override PassThroughInputManager CreateInputManager() => new OsuInputManager(Ruleset.RulesetInfo); diff --git a/osu.Game/Rulesets/Judgements/DrawableJudgement.cs b/osu.Game/Rulesets/Judgements/DrawableJudgement.cs index 65b2ef75c4..c2a52e5794 100644 --- a/osu.Game/Rulesets/Judgements/DrawableJudgement.cs +++ b/osu.Game/Rulesets/Judgements/DrawableJudgement.cs @@ -65,13 +65,15 @@ namespace osu.Game.Rulesets.Judgements this.FadeInFromZero(100, Easing.OutQuint); + var origScale = Scale; + switch (Result.Type) { case HitResult.None: break; case HitResult.Miss: - this.ScaleTo(1.6f); - this.ScaleTo(1, 100, Easing.In); + this.ScaleTo(origScale * 1.6f); + this.ScaleTo(origScale, 100, Easing.In); this.MoveToOffset(new Vector2(0, 100), 800, Easing.InQuint); this.RotateTo(40, 800, Easing.InQuint); @@ -79,8 +81,8 @@ namespace osu.Game.Rulesets.Judgements this.Delay(600).FadeOut(200); break; default: - this.ScaleTo(0.9f); - this.ScaleTo(1, 500, Easing.OutElastic); + this.ScaleTo(origScale * 0.9f); + this.ScaleTo(origScale, 500, Easing.OutElastic); this.Delay(100).FadeOut(400); break; From 62df0ec7d4c50b58a1bbcfdb2004a2bec10584de Mon Sep 17 00:00:00 2001 From: Paul Teng Date: Mon, 24 Sep 2018 07:16:19 -0400 Subject: [PATCH 150/417] Handle external files with File instead --- osu.Game/Rulesets/Scoring/ScoreStore.cs | 21 +++++++++++++++++++-- 1 file changed, 19 insertions(+), 2 deletions(-) diff --git a/osu.Game/Rulesets/Scoring/ScoreStore.cs b/osu.Game/Rulesets/Scoring/ScoreStore.cs index 69d25fcb67..997792025e 100644 --- a/osu.Game/Rulesets/Scoring/ScoreStore.cs +++ b/osu.Game/Rulesets/Scoring/ScoreStore.cs @@ -3,6 +3,7 @@ using System; using System.IO; +using osu.Framework.Logging; using osu.Framework.Platform; using osu.Game.Beatmaps; using osu.Game.Database; @@ -49,8 +50,24 @@ namespace osu.Game.Rulesets.Scoring public Score ReadReplayFile(string replayFilename) { - using (Stream s = storage.GetStream(Path.Combine(replay_folder, replayFilename))) - return new DatabasedLegacyScoreParser(rulesets, beatmaps).Parse(s); + Stream stream; + if (File.Exists(replayFilename)) + { + // Handle replay with File since it is outside of storage + stream = File.OpenRead(replayFilename); + } + else if (storage.Exists(Path.Combine(replay_folder, replayFilename))) + { + stream = storage.GetStream(Path.Combine(replay_folder, replayFilename)); + } + else + { + Logger.Log($"Replay file {replayFilename} cannot be found", LoggingTarget.Information, LogLevel.Error); + return null; + } + + using (stream) + return new DatabasedLegacyScoreParser(rulesets, beatmaps).Parse(stream); } } } From b95cc798b2b8d995422bf120118dfcb56461c44f Mon Sep 17 00:00:00 2001 From: Paul Teng Date: Mon, 24 Sep 2018 20:56:18 -0400 Subject: [PATCH 151/417] Remove unused fallback --- osu.Game/Rulesets/Scoring/ScoreStore.cs | 14 ++------------ 1 file changed, 2 insertions(+), 12 deletions(-) diff --git a/osu.Game/Rulesets/Scoring/ScoreStore.cs b/osu.Game/Rulesets/Scoring/ScoreStore.cs index 997792025e..00aec1a28c 100644 --- a/osu.Game/Rulesets/Scoring/ScoreStore.cs +++ b/osu.Game/Rulesets/Scoring/ScoreStore.cs @@ -50,23 +50,13 @@ namespace osu.Game.Rulesets.Scoring public Score ReadReplayFile(string replayFilename) { - Stream stream; - if (File.Exists(replayFilename)) - { - // Handle replay with File since it is outside of storage - stream = File.OpenRead(replayFilename); - } - else if (storage.Exists(Path.Combine(replay_folder, replayFilename))) - { - stream = storage.GetStream(Path.Combine(replay_folder, replayFilename)); - } - else + if (!File.Exists(replayFilename)) { Logger.Log($"Replay file {replayFilename} cannot be found", LoggingTarget.Information, LogLevel.Error); return null; } - using (stream) + using (var stream = File.OpenRead(replayFilename)) return new DatabasedLegacyScoreParser(rulesets, beatmaps).Parse(stream); } } From dd36b6a3815d7891418a30d07dd8f3c6329056b8 Mon Sep 17 00:00:00 2001 From: Paul Teng Date: Mon, 24 Sep 2018 21:08:58 -0400 Subject: [PATCH 152/417] Remove unused field storage --- osu.Game/OsuGameBase.cs | 2 +- osu.Game/Rulesets/Scoring/ScoreStore.cs | 5 +---- 2 files changed, 2 insertions(+), 5 deletions(-) diff --git a/osu.Game/OsuGameBase.cs b/osu.Game/OsuGameBase.cs index 9a5dac35b9..ca989bf0d5 100644 --- a/osu.Game/OsuGameBase.cs +++ b/osu.Game/OsuGameBase.cs @@ -154,7 +154,7 @@ namespace osu.Game dependencies.Cache(RulesetStore = new RulesetStore(contextFactory)); dependencies.Cache(FileStore = new FileStore(contextFactory, Host.Storage)); dependencies.Cache(BeatmapManager = new BeatmapManager(Host.Storage, contextFactory, RulesetStore, api, Audio, Host)); - dependencies.Cache(ScoreStore = new ScoreStore(Host.Storage, contextFactory, Host, BeatmapManager, RulesetStore)); + dependencies.Cache(ScoreStore = new ScoreStore(contextFactory, Host, BeatmapManager, RulesetStore)); dependencies.Cache(KeyBindingStore = new KeyBindingStore(contextFactory, RulesetStore)); dependencies.Cache(SettingsStore = new SettingsStore(contextFactory)); dependencies.Cache(RulesetConfigCache = new RulesetConfigCache(SettingsStore)); diff --git a/osu.Game/Rulesets/Scoring/ScoreStore.cs b/osu.Game/Rulesets/Scoring/ScoreStore.cs index 00aec1a28c..a847438934 100644 --- a/osu.Game/Rulesets/Scoring/ScoreStore.cs +++ b/osu.Game/Rulesets/Scoring/ScoreStore.cs @@ -14,8 +14,6 @@ namespace osu.Game.Rulesets.Scoring { public class ScoreStore : DatabaseBackedStore, ICanAcceptFiles { - private readonly Storage storage; - private readonly BeatmapManager beatmaps; private readonly RulesetStore rulesets; @@ -26,9 +24,8 @@ namespace osu.Game.Rulesets.Scoring // ReSharper disable once NotAccessedField.Local (we should keep a reference to this so it is not finalised) private ScoreIPCChannel ipc; - public ScoreStore(Storage storage, DatabaseContextFactory factory, IIpcHost importHost = null, BeatmapManager beatmaps = null, RulesetStore rulesets = null) : base(factory) + public ScoreStore(DatabaseContextFactory factory, IIpcHost importHost = null, BeatmapManager beatmaps = null, RulesetStore rulesets = null) : base(factory) { - this.storage = storage; this.beatmaps = beatmaps; this.rulesets = rulesets; From 20694674345c69fb34e3566782a8aef8845e70c1 Mon Sep 17 00:00:00 2001 From: Kyle Chang Date: Mon, 24 Sep 2018 21:18:55 -0400 Subject: [PATCH 153/417] Use HitObject scale to determine judgement size --- osu.Game.Rulesets.Osu/UI/OsuPlayfield.cs | 9 ++------- osu.Game.Rulesets.Osu/UI/OsuRulesetContainer.cs | 2 +- 2 files changed, 3 insertions(+), 8 deletions(-) diff --git a/osu.Game.Rulesets.Osu/UI/OsuPlayfield.cs b/osu.Game.Rulesets.Osu/UI/OsuPlayfield.cs index f2c18d4c9c..b0010ccbf6 100644 --- a/osu.Game.Rulesets.Osu/UI/OsuPlayfield.cs +++ b/osu.Game.Rulesets.Osu/UI/OsuPlayfield.cs @@ -19,15 +19,12 @@ namespace osu.Game.Rulesets.Osu.UI private readonly Container approachCircles; private readonly JudgementContainer judgementLayer; private readonly ConnectionRenderer connectionLayer; - private readonly OsuRulesetContainer rulesetContainer; public static readonly Vector2 BASE_SIZE = new Vector2(512, 384); - public OsuPlayfield(OsuRulesetContainer rulesetContainer) + public OsuPlayfield() : base(BASE_SIZE.X) { - this.rulesetContainer = rulesetContainer; - Anchor = Anchor.Centre; Origin = Anchor.Centre; @@ -72,13 +69,11 @@ namespace osu.Game.Rulesets.Osu.UI if (!judgedObject.DisplayResult || !DisplayJudgements) return; - var explosionBaseSize = rulesetContainer.Beatmap.BeatmapInfo.BaseDifficulty.CircleSize; - DrawableOsuJudgement explosion = new DrawableOsuJudgement(result, judgedObject) { Origin = Anchor.Centre, Position = ((OsuHitObject)judgedObject.HitObject).StackedEndPosition, - Scale = new Vector2((1.0f - 0.7f * (explosionBaseSize - 5) / 5) / 2 * 1.65f) + Scale = new Vector2(((OsuHitObject)judgedObject.HitObject).Scale * 1.65f) }; judgementLayer.Add(explosion); diff --git a/osu.Game.Rulesets.Osu/UI/OsuRulesetContainer.cs b/osu.Game.Rulesets.Osu/UI/OsuRulesetContainer.cs index 6cea8a0030..4bc6992445 100644 --- a/osu.Game.Rulesets.Osu/UI/OsuRulesetContainer.cs +++ b/osu.Game.Rulesets.Osu/UI/OsuRulesetContainer.cs @@ -28,7 +28,7 @@ namespace osu.Game.Rulesets.Osu.UI public override ScoreProcessor CreateScoreProcessor() => new OsuScoreProcessor(this); - protected override Playfield CreatePlayfield() => new OsuPlayfield(this); + protected override Playfield CreatePlayfield() => new OsuPlayfield(); public override PassThroughInputManager CreateInputManager() => new OsuInputManager(Ruleset.RulesetInfo); From 319ed1bf0f3517f3e53bfefd33bf750980fcc32e Mon Sep 17 00:00:00 2001 From: Paul Teng Date: Mon, 24 Sep 2018 21:35:13 -0400 Subject: [PATCH 154/417] Reorder if statement --- osu.Game/Rulesets/Scoring/ScoreStore.cs | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/osu.Game/Rulesets/Scoring/ScoreStore.cs b/osu.Game/Rulesets/Scoring/ScoreStore.cs index a847438934..091cb29a71 100644 --- a/osu.Game/Rulesets/Scoring/ScoreStore.cs +++ b/osu.Game/Rulesets/Scoring/ScoreStore.cs @@ -47,14 +47,14 @@ namespace osu.Game.Rulesets.Scoring public Score ReadReplayFile(string replayFilename) { - if (!File.Exists(replayFilename)) + if (File.Exists(replayFilename)) { - Logger.Log($"Replay file {replayFilename} cannot be found", LoggingTarget.Information, LogLevel.Error); - return null; + using (var stream = File.OpenRead(replayFilename)) + return new DatabasedLegacyScoreParser(rulesets, beatmaps).Parse(stream); } - using (var stream = File.OpenRead(replayFilename)) - return new DatabasedLegacyScoreParser(rulesets, beatmaps).Parse(stream); + Logger.Log($"Replay file {replayFilename} cannot be found", LoggingTarget.Information, LogLevel.Error); + return null; } } } From cb500e80e4ed0c8178fbc4cae153eb5f47f7d0d6 Mon Sep 17 00:00:00 2001 From: smoogipoo Date: Tue, 25 Sep 2018 14:39:10 +0900 Subject: [PATCH 155/417] Make BeatmapInfoWedge present until info is not null --- osu.Game/Screens/Select/BeatmapInfoWedge.cs | 2 ++ 1 file changed, 2 insertions(+) diff --git a/osu.Game/Screens/Select/BeatmapInfoWedge.cs b/osu.Game/Screens/Select/BeatmapInfoWedge.cs index 4129a9596f..6b425791e0 100644 --- a/osu.Game/Screens/Select/BeatmapInfoWedge.cs +++ b/osu.Game/Screens/Select/BeatmapInfoWedge.cs @@ -89,6 +89,8 @@ namespace osu.Game.Screens.Select } } + public override bool IsPresent => base.IsPresent || Info == null; // Visibility is updated in the LoadComponentAsync callback + private BufferedWedgeInfo loadingInfo; private void updateDisplay() From 5f61faa2d9e2069034d3ff97fd3478b5db932787 Mon Sep 17 00:00:00 2001 From: smoogipoo Date: Tue, 25 Sep 2018 18:37:25 +0900 Subject: [PATCH 156/417] Fix multiple hits in the same frame pressing multiple hitobjects --- .../Objects/Drawables/DrawableHit.cs | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/osu.Game.Rulesets.Taiko/Objects/Drawables/DrawableHit.cs b/osu.Game.Rulesets.Taiko/Objects/Drawables/DrawableHit.cs index f59dc8c1ee..86c6a56685 100644 --- a/osu.Game.Rulesets.Taiko/Objects/Drawables/DrawableHit.cs +++ b/osu.Game.Rulesets.Taiko/Objects/Drawables/DrawableHit.cs @@ -24,6 +24,8 @@ namespace osu.Game.Rulesets.Taiko.Objects.Drawables private bool validActionPressed; + private bool handleExtraPress; + protected DrawableHit(Hit hit) : base(hit) { @@ -51,6 +53,9 @@ namespace osu.Game.Rulesets.Taiko.Objects.Drawables public override bool OnPressed(TaikoAction action) { + if (handleExtraPress) + return true; + if (Judged) return false; @@ -62,6 +67,10 @@ namespace osu.Game.Rulesets.Taiko.Objects.Drawables if (IsHit) HitAction = action; + // Regardless of whether we've hit or not, any secondary key presses in the same frame should be discarded + // E.g. hitting a non-strong centre as a strong should not fall through and perform a hit on the next note + handleExtraPress = true; + return result; } @@ -76,6 +85,10 @@ namespace osu.Game.Rulesets.Taiko.Objects.Drawables { base.Update(); + // The input manager processes all input prior to us updating, so this is the perfect time + // for us to remove the extra press blocking, before input is handled in the next frame + handleExtraPress = false; + Size = BaseSize * Parent.RelativeChildSize; } From 7cd547a760d05d0394af9651bc73b42ff1dace59 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Tue, 25 Sep 2018 20:53:24 +0900 Subject: [PATCH 157/417] Update chat to work with new API version --- osu.Game/Online/API/OAuth.cs | 5 +- .../Online/API/Requests/GetMessagesRequest.cs | 23 ++------ .../Online/API/Requests/GetUpdatesRequest.cs | 32 +++++++++++ .../Online/API/Requests/GetUpdatesResponse.cs | 14 +++++ .../Online/API/Requests/JoinChannelRequest.cs | 31 +++++++++++ .../API/Requests/LeaveChannelRequest.cs | 31 +++++++++++ .../Online/API/Requests/PostMessageRequest.cs | 8 ++- osu.Game/Online/Chat/Channel.cs | 2 +- osu.Game/Online/Chat/ChannelType.cs | 11 ++++ osu.Game/Overlays/ChatOverlay.cs | 54 ++++++++++++------- osu.Game/osu.Game.csproj | 2 +- osu.sln.DotSettings | 1 + 12 files changed, 168 insertions(+), 46 deletions(-) create mode 100644 osu.Game/Online/API/Requests/GetUpdatesRequest.cs create mode 100644 osu.Game/Online/API/Requests/GetUpdatesResponse.cs create mode 100644 osu.Game/Online/API/Requests/JoinChannelRequest.cs create mode 100644 osu.Game/Online/API/Requests/LeaveChannelRequest.cs create mode 100644 osu.Game/Online/Chat/ChannelType.cs diff --git a/osu.Game/Online/API/OAuth.cs b/osu.Game/Online/API/OAuth.cs index 67b908e894..7892df9aab 100644 --- a/osu.Game/Online/API/OAuth.cs +++ b/osu.Game/Online/API/OAuth.cs @@ -2,6 +2,7 @@ // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE using System.Diagnostics; +using System.Net.Http; using osu.Framework.Configuration; using osu.Framework.IO.Network; @@ -40,7 +41,7 @@ namespace osu.Game.Online.API using (var req = new AccessTokenRequestPassword(username, password) { Url = $@"{endpoint}/oauth/token", - Method = HttpMethod.POST, + Method = HttpMethod.Post, ClientId = clientId, ClientSecret = clientSecret }) @@ -66,7 +67,7 @@ namespace osu.Game.Online.API using (var req = new AccessTokenRequestRefresh(refresh) { Url = $@"{endpoint}/oauth/token", - Method = HttpMethod.POST, + Method = HttpMethod.Post, ClientId = clientId, ClientSecret = clientSecret }) diff --git a/osu.Game/Online/API/Requests/GetMessagesRequest.cs b/osu.Game/Online/API/Requests/GetMessagesRequest.cs index 68de194bae..94f5a114ad 100644 --- a/osu.Game/Online/API/Requests/GetMessagesRequest.cs +++ b/osu.Game/Online/API/Requests/GetMessagesRequest.cs @@ -2,34 +2,19 @@ // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE using System.Collections.Generic; -using System.Linq; -using osu.Framework.IO.Network; using osu.Game.Online.Chat; namespace osu.Game.Online.API.Requests { public class GetMessagesRequest : APIRequest> { - private readonly List channels; - private readonly long? since; + private readonly Channel channel; - public GetMessagesRequest(List channels, long? sinceId) + public GetMessagesRequest(Channel channel) { - this.channels = channels; - since = sinceId; + this.channel = channel; } - protected override WebRequest CreateWebRequest() - { - string channelString = string.Join(",", channels.Select(x => x.Id)); - - var req = base.CreateWebRequest(); - req.AddParameter(@"channels", channelString); - if (since.HasValue) req.AddParameter(@"since", since.Value.ToString()); - - return req; - } - - protected override string Target => @"chat/messages"; + protected override string Target => $@"chat/channels/{channel.Id}/messages"; } } diff --git a/osu.Game/Online/API/Requests/GetUpdatesRequest.cs b/osu.Game/Online/API/Requests/GetUpdatesRequest.cs new file mode 100644 index 0000000000..950ad93396 --- /dev/null +++ b/osu.Game/Online/API/Requests/GetUpdatesRequest.cs @@ -0,0 +1,32 @@ +// Copyright (c) 2007-2018 ppy Pty Ltd . +// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE + +using JetBrains.Annotations; +using osu.Framework.IO.Network; +using osu.Game.Online.Chat; + +namespace osu.Game.Online.API.Requests +{ + public class GetUpdatesRequest : APIRequest + { + private readonly long since; + private readonly Channel channel; + + public GetUpdatesRequest(long sinceId, [CanBeNull] Channel channel = null) + { + this.channel = channel; + since = sinceId; + } + + protected override WebRequest CreateWebRequest() + { + var req = base.CreateWebRequest(); + if (channel != null) req.AddParameter(@"channel", channel.Id.ToString()); + req.AddParameter(@"since", since.ToString()); + + return req; + } + + protected override string Target => @"chat/updates"; + } +} diff --git a/osu.Game/Online/API/Requests/GetUpdatesResponse.cs b/osu.Game/Online/API/Requests/GetUpdatesResponse.cs new file mode 100644 index 0000000000..729290306a --- /dev/null +++ b/osu.Game/Online/API/Requests/GetUpdatesResponse.cs @@ -0,0 +1,14 @@ +// Copyright (c) 2007-2018 ppy Pty Ltd . +// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE + +using System.Collections.Generic; +using osu.Game.Online.Chat; + +namespace osu.Game.Online.API.Requests +{ + public class GetUpdatesResponse + { + public List Presence; + public List Messages; + } +} diff --git a/osu.Game/Online/API/Requests/JoinChannelRequest.cs b/osu.Game/Online/API/Requests/JoinChannelRequest.cs new file mode 100644 index 0000000000..55ada2ab3d --- /dev/null +++ b/osu.Game/Online/API/Requests/JoinChannelRequest.cs @@ -0,0 +1,31 @@ +// Copyright (c) 2007-2018 ppy Pty Ltd . +// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE + +using System.Net.Http; +using osu.Framework.IO.Network; +using osu.Game.Online.Chat; +using osu.Game.Users; + +namespace osu.Game.Online.API.Requests +{ + public class JoinChannelRequest : APIRequest + { + private readonly Channel channel; + private readonly User user; + + public JoinChannelRequest(Channel channel, User user) + { + this.channel = channel; + this.user = user; + } + + protected override WebRequest CreateWebRequest() + { + var req = base.CreateWebRequest(); + req.Method = HttpMethod.Put; + return req; + } + + protected override string Target => $@"chat/channels/{channel.Id}/users/{user.Id}"; + } +} diff --git a/osu.Game/Online/API/Requests/LeaveChannelRequest.cs b/osu.Game/Online/API/Requests/LeaveChannelRequest.cs new file mode 100644 index 0000000000..89bfa303c6 --- /dev/null +++ b/osu.Game/Online/API/Requests/LeaveChannelRequest.cs @@ -0,0 +1,31 @@ +// Copyright (c) 2007-2018 ppy Pty Ltd . +// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE + +using System.Net.Http; +using osu.Framework.IO.Network; +using osu.Game.Online.Chat; +using osu.Game.Users; + +namespace osu.Game.Online.API.Requests +{ + public class LeaveChannelRequest : APIRequest + { + private readonly Channel channel; + private readonly User user; + + public LeaveChannelRequest(Channel channel, User user) + { + this.channel = channel; + this.user = user; + } + + protected override WebRequest CreateWebRequest() + { + var req = base.CreateWebRequest(); + req.Method = HttpMethod.Delete; + return req; + } + + protected override string Target => $@"chat/channels/{channel.Id}/users/{user.Id}"; + } +} diff --git a/osu.Game/Online/API/Requests/PostMessageRequest.cs b/osu.Game/Online/API/Requests/PostMessageRequest.cs index e0a9fb83b2..188d6ada34 100644 --- a/osu.Game/Online/API/Requests/PostMessageRequest.cs +++ b/osu.Game/Online/API/Requests/PostMessageRequest.cs @@ -1,7 +1,7 @@ // Copyright (c) 2007-2018 ppy Pty Ltd . // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE -using osu.Framework.Extensions; +using System.Net.Http; using osu.Framework.IO.Network; using osu.Game.Online.Chat; @@ -20,15 +20,13 @@ namespace osu.Game.Online.API.Requests { var req = base.CreateWebRequest(); - req.Method = HttpMethod.POST; - req.AddParameter(@"target_type", message.TargetType.GetDescription()); - req.AddParameter(@"target_id", message.TargetId.ToString()); + req.Method = HttpMethod.Post; req.AddParameter(@"is_action", message.IsAction.ToString().ToLowerInvariant()); req.AddParameter(@"message", message.Content); return req; } - protected override string Target => @"chat/messages"; + protected override string Target => $@"chat/channels/{message.TargetId}/messages"; } } diff --git a/osu.Game/Online/Chat/Channel.cs b/osu.Game/Online/Chat/Channel.cs index e7aabad780..e68a84cd86 100644 --- a/osu.Game/Online/Chat/Channel.cs +++ b/osu.Game/Online/Chat/Channel.cs @@ -19,7 +19,7 @@ namespace osu.Game.Online.Chat public string Topic; [JsonProperty(@"type")] - public string Type; + public ChannelType Type; [JsonProperty(@"channel_id")] public int Id; diff --git a/osu.Game/Online/Chat/ChannelType.cs b/osu.Game/Online/Chat/ChannelType.cs new file mode 100644 index 0000000000..4ac0a99fc6 --- /dev/null +++ b/osu.Game/Online/Chat/ChannelType.cs @@ -0,0 +1,11 @@ +// Copyright (c) 2007-2018 ppy Pty Ltd . +// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE + +namespace osu.Game.Online.Chat +{ + public enum ChannelType + { + PM, + Public + } +} diff --git a/osu.Game/Overlays/ChatOverlay.cs b/osu.Game/Overlays/ChatOverlay.cs index 8e20d76914..e22798faa8 100644 --- a/osu.Game/Overlays/ChatOverlay.cs +++ b/osu.Game/Overlays/ChatOverlay.cs @@ -47,7 +47,7 @@ namespace osu.Game.Overlays public const float TAB_AREA_HEIGHT = 50; - private GetMessagesRequest fetchReq; + private GetUpdatesRequest fetchReq; private readonly ChatTabControl channelTabs; @@ -285,7 +285,7 @@ namespace osu.Game.Overlays chatBackground.Colour = colours.ChatBlue; } - private long? lastMessageId; + private long lastMessageId; private readonly List careChannels = new List(); @@ -304,9 +304,9 @@ namespace osu.Game.Overlays Scheduler.Add(delegate { - addChannel(channels.Find(c => c.Name == @"#lazer")); - addChannel(channels.Find(c => c.Name == @"#osu")); - addChannel(channels.Find(c => c.Name == @"#lobby")); + //addChannel(channels.Find(c => c.Name == @"#lazer")); + //addChannel(channels.Find(c => c.Name == @"#osu")); + //addChannel(channels.Find(c => c.Name == @"#lobby")); channelSelection.OnRequestJoin = addChannel; channelSelection.OnRequestLeave = removeChannel; @@ -320,7 +320,7 @@ namespace osu.Game.Overlays }; }); - messageRequest = Scheduler.AddDelayed(fetchNewMessages, 1000, true); + messageRequest = Scheduler.AddDelayed(fetchUpdates, 1000, true); }; api.Queue(req); @@ -394,6 +394,15 @@ namespace osu.Game.Overlays { careChannels.Add(channel); channelTabs.AddItem(channel); + + if (channel.Type == ChannelType.Public && !channel.Joined) + { + var req = new JoinChannelRequest(channel, api.LocalUser); + req.Success += addChannel; + req.Failure += ex => removeChannel(channel); + api.Queue(req); + return; + } } // let's fetch a small number of messages to bring us up-to-date with the backlog. @@ -415,39 +424,48 @@ namespace osu.Game.Overlays loadedChannels.Remove(loadedChannels.Find(c => c.Channel == channel)); channelTabs.RemoveItem(channel); + api.Queue(new LeaveChannelRequest(channel, api.LocalUser)); channel.Joined.Value = false; } private void fetchInitialMessages(Channel channel) { - var req = new GetMessagesRequest(new List { channel }, null); + var req = new GetMessagesRequest(channel); - req.Success += delegate (List messages) + req.Success += messages => { loading.Hide(); channel.AddNewMessages(messages.ToArray()); Debug.Write("success!"); }; - req.Failure += delegate - { - Debug.Write("failure!"); - }; + + req.Failure += exception => Debug.Write("failure!"); api.Queue(req); } - private void fetchNewMessages() + private void fetchUpdates() { if (fetchReq != null) return; - fetchReq = new GetMessagesRequest(careChannels, lastMessageId); + fetchReq = new GetUpdatesRequest(lastMessageId); - fetchReq.Success += delegate (List messages) + fetchReq.Success += updates => { - foreach (var group in messages.Where(m => m.TargetType == TargetType.Channel).GroupBy(m => m.TargetId)) - careChannels.Find(c => c.Id == group.Key)?.AddNewMessages(group.ToArray()); + // fuck the what. + if (updates?.Presence != null) + { + foreach (var channel in updates.Presence) + { + channel.Joined.Value = true; + addChannel(channel); + } - lastMessageId = messages.LastOrDefault()?.Id ?? lastMessageId; + foreach (var group in updates.Messages.Where(m => m.TargetType == TargetType.Channel).GroupBy(m => m.TargetId)) + careChannels.Find(c => c.Id == group.Key)?.AddNewMessages(group.ToArray()); + + lastMessageId = updates.Messages.LastOrDefault()?.Id ?? lastMessageId; + } Debug.Write("success!"); fetchReq = null; diff --git a/osu.Game/osu.Game.csproj b/osu.Game/osu.Game.csproj index 5ce04b813b..532654b4dc 100644 --- a/osu.Game/osu.Game.csproj +++ b/osu.Game/osu.Game.csproj @@ -18,7 +18,7 @@ - + diff --git a/osu.sln.DotSettings b/osu.sln.DotSettings index 1f1b6a79b1..404b19deda 100644 --- a/osu.sln.DotSettings +++ b/osu.sln.DotSettings @@ -218,6 +218,7 @@ GMT QAT BNG + UI HINT <?xml version="1.0" encoding="utf-16"?> <Patterns xmlns="urn:schemas-jetbrains-com:member-reordering-patterns"> From a8f156584bfa08d23cab1c0fa6f893a21ac205bd Mon Sep 17 00:00:00 2001 From: smoogipoo Date: Wed, 26 Sep 2018 14:01:15 +0900 Subject: [PATCH 158/417] Update framework with positional/non-positional changes --- osu.Desktop/Overlays/VersionManager.cs | 4 ++-- .../Edit/Layers/Selection/Overlays/HoldNoteMask.cs | 2 +- .../Edit/Layers/Selection/Overlays/SliderCircleMask.cs | 2 +- .../Edit/Layers/Selection/Overlays/SliderMask.cs | 2 +- osu.Game.Rulesets.Osu/Objects/Drawables/DrawableSlider.cs | 2 +- .../Objects/Drawables/Pieces/SliderBall.cs | 4 ++-- .../Objects/Drawables/Pieces/SliderBody.cs | 2 +- .../Objects/Drawables/Pieces/SpinnerBackground.cs | 4 ++-- .../Objects/Drawables/Pieces/SpinnerDisc.cs | 2 +- osu.Game.Rulesets.Osu/UI/Cursor/CursorTrail.cs | 2 +- osu.Game.Rulesets.Osu/UI/Cursor/GameplayCursor.cs | 2 +- osu.Game.Tests/Visual/TestCaseCursors.cs | 2 +- osu.Game/Graphics/Backgrounds/Triangles.cs | 4 ++-- osu.Game/Graphics/Containers/LinkFlowContainer.cs | 2 +- .../Graphics/Containers/OsuFocusedOverlayContainer.cs | 8 ++++---- osu.Game/Graphics/DrawableDate.cs | 2 +- osu.Game/Graphics/UserInterface/BreadcrumbControl.cs | 6 +++--- osu.Game/Graphics/UserInterface/DialogButton.cs | 2 +- osu.Game/Graphics/UserInterface/FocusedTextBox.cs | 2 +- osu.Game/Graphics/UserInterface/TwoLayerButton.cs | 2 +- osu.Game/Online/Chat/DrawableLinkCompiler.cs | 4 ++-- osu.Game/Overlays/BeatmapSetOverlay.cs | 2 +- osu.Game/Overlays/ChatOverlay.cs | 2 +- osu.Game/Overlays/Dialog/PopupDialog.cs | 2 +- osu.Game/Overlays/DialogOverlay.cs | 2 +- osu.Game/Overlays/Direct/FilterControl.cs | 4 ++-- osu.Game/Overlays/Mods/ModSelectOverlay.cs | 2 +- osu.Game/Overlays/OnScreenDisplay.cs | 4 ++-- osu.Game/Overlays/Toolbar/Toolbar.cs | 2 +- osu.Game/Overlays/Toolbar/ToolbarRulesetSelector.cs | 4 ++-- osu.Game/Overlays/VolumeOverlay.cs | 2 +- osu.Game/Overlays/WaveOverlayContainer.cs | 2 +- osu.Game/Rulesets/Edit/HitObjectMask.cs | 2 +- osu.Game/Rulesets/Objects/Drawables/DrawableHitObject.cs | 4 ++-- .../Screens/Edit/Screens/Compose/BeatDivisorControl.cs | 2 +- osu.Game/Screens/Menu/Button.cs | 6 +++--- osu.Game/Screens/Menu/ButtonSystem.cs | 4 ++-- osu.Game/Screens/Menu/LogoVisualisation.cs | 4 ++-- osu.Game/Screens/Menu/MenuSideFlashes.cs | 4 ++-- osu.Game/Screens/Menu/OsuLogo.cs | 4 ++-- osu.Game/Screens/Play/GameplayMenuOverlay.cs | 4 ++-- osu.Game/Screens/Play/HUD/PlayerSettingsOverlay.cs | 2 +- osu.Game/Screens/Play/HUD/QuitButton.cs | 2 +- osu.Game/Screens/Play/KeyCounterCollection.cs | 6 +++--- osu.Game/Screens/Play/KeyCounterMouse.cs | 2 +- osu.Game/Screens/Play/SkipOverlay.cs | 4 ++-- osu.Game/Screens/Play/SongProgress.cs | 4 ++-- osu.Game/Screens/Play/SquareGraph.cs | 4 ++-- osu.Game/Screens/Select/BeatmapCarousel.cs | 4 ++-- osu.Game/Screens/Select/BeatmapInfoWedge.cs | 4 ++-- osu.Game/Screens/Select/FilterControl.cs | 4 ++-- osu.Game/Screens/Select/FooterButton.cs | 2 +- osu.Game/Screens/Select/Leaderboards/Placeholder.cs | 2 +- osu.Game/Screens/Select/Options/BeatmapOptionsButton.cs | 2 +- osu.Game/Storyboards/Drawables/DrawableStoryboard.cs | 4 ++-- osu.Game/osu.Game.csproj | 2 +- 56 files changed, 86 insertions(+), 86 deletions(-) diff --git a/osu.Desktop/Overlays/VersionManager.cs b/osu.Desktop/Overlays/VersionManager.cs index 1129969694..8881884fb4 100644 --- a/osu.Desktop/Overlays/VersionManager.cs +++ b/osu.Desktop/Overlays/VersionManager.cs @@ -27,8 +27,8 @@ namespace osu.Desktop.Overlays private NotificationOverlay notificationOverlay; private GameHost host; - public override bool HandleKeyboardInput => false; - public override bool HandleMouseInput => false; + public override bool HandleNonPositionalInput => false; + public override bool HandlePositionalInput => false; [BackgroundDependencyLoader] private void load(NotificationOverlay notification, OsuColour colours, TextureStore textures, OsuGameBase game, OsuConfigManager config, GameHost host) diff --git a/osu.Game.Rulesets.Mania/Edit/Layers/Selection/Overlays/HoldNoteMask.cs b/osu.Game.Rulesets.Mania/Edit/Layers/Selection/Overlays/HoldNoteMask.cs index bfa6bc0a17..03d2ba19cb 100644 --- a/osu.Game.Rulesets.Mania/Edit/Layers/Selection/Overlays/HoldNoteMask.cs +++ b/osu.Game.Rulesets.Mania/Edit/Layers/Selection/Overlays/HoldNoteMask.cs @@ -78,7 +78,7 @@ namespace osu.Game.Rulesets.Mania.Edit.Layers.Selection.Overlays } // Todo: This is temporary, since the note masks don't do anything special yet. In the future they will handle input. - public override bool HandleMouseInput => false; + public override bool HandlePositionalInput => false; } } } diff --git a/osu.Game.Rulesets.Osu/Edit/Layers/Selection/Overlays/SliderCircleMask.cs b/osu.Game.Rulesets.Osu/Edit/Layers/Selection/Overlays/SliderCircleMask.cs index adb28289cf..151564a2a8 100644 --- a/osu.Game.Rulesets.Osu/Edit/Layers/Selection/Overlays/SliderCircleMask.cs +++ b/osu.Game.Rulesets.Osu/Edit/Layers/Selection/Overlays/SliderCircleMask.cs @@ -56,6 +56,6 @@ namespace osu.Game.Rulesets.Osu.Edit.Layers.Selection.Overlays } // Todo: This is temporary, since the slider circle masks don't do anything special yet. In the future they will handle input. - public override bool HandleMouseInput => false; + public override bool HandlePositionalInput => false; } } diff --git a/osu.Game.Rulesets.Osu/Edit/Layers/Selection/Overlays/SliderMask.cs b/osu.Game.Rulesets.Osu/Edit/Layers/Selection/Overlays/SliderMask.cs index 0f6143a83d..aff42dd233 100644 --- a/osu.Game.Rulesets.Osu/Edit/Layers/Selection/Overlays/SliderMask.cs +++ b/osu.Game.Rulesets.Osu/Edit/Layers/Selection/Overlays/SliderMask.cs @@ -59,7 +59,7 @@ namespace osu.Game.Rulesets.Osu.Edit.Layers.Selection.Overlays body.UpdateProgress(0); } - public override bool ReceiveMouseInputAt(Vector2 screenSpacePos) => body.ReceiveMouseInputAt(screenSpacePos); + public override bool ReceivePositionalInputAt(Vector2 screenSpacePos) => body.ReceivePositionalInputAt(screenSpacePos); public override Vector2 SelectionPoint => ToScreenSpace(OriginPosition); public override Quad SelectionQuad => body.PathDrawQuad; diff --git a/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableSlider.cs b/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableSlider.cs index 66f491532d..89f380db4e 100644 --- a/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableSlider.cs +++ b/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableSlider.cs @@ -184,6 +184,6 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables public Drawable ProxiedLayer => HeadCircle.ApproachCircle; - public override bool ReceiveMouseInputAt(Vector2 screenSpacePos) => Body.ReceiveMouseInputAt(screenSpacePos); + public override bool ReceivePositionalInputAt(Vector2 screenSpacePos) => Body.ReceivePositionalInputAt(screenSpacePos); } } diff --git a/osu.Game.Rulesets.Osu/Objects/Drawables/Pieces/SliderBall.cs b/osu.Game.Rulesets.Osu/Objects/Drawables/Pieces/SliderBall.cs index b79750a1b3..1388b23fa8 100644 --- a/osu.Game.Rulesets.Osu/Objects/Drawables/Pieces/SliderBall.cs +++ b/osu.Game.Rulesets.Osu/Objects/Drawables/Pieces/SliderBall.cs @@ -153,10 +153,10 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables.Pieces if (Time.Current < slider.EndTime) { - // Make sure to use the base version of ReceiveMouseInputAt so that we correctly check the position. + // Make sure to use the base version of ReceivePositionalInputAt so that we correctly check the position. Tracking = canCurrentlyTrack && lastState != null - && ReceiveMouseInputAt(lastState.Mouse.NativeState.Position) + && ReceivePositionalInputAt(lastState.Mouse.NativeState.Position) && (drawableSlider?.OsuActionInputManager?.PressedActions.Any(x => x == OsuAction.LeftButton || x == OsuAction.RightButton) ?? false); } } diff --git a/osu.Game.Rulesets.Osu/Objects/Drawables/Pieces/SliderBody.cs b/osu.Game.Rulesets.Osu/Objects/Drawables/Pieces/SliderBody.cs index 6f0197e711..f3924ec43b 100644 --- a/osu.Game.Rulesets.Osu/Objects/Drawables/Pieces/SliderBody.cs +++ b/osu.Game.Rulesets.Osu/Objects/Drawables/Pieces/SliderBody.cs @@ -112,7 +112,7 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables.Pieces container.Attach(RenderbufferInternalFormat.DepthComponent16); } - public override bool ReceiveMouseInputAt(Vector2 screenSpacePos) => path.ReceiveMouseInputAt(screenSpacePos); + public override bool ReceivePositionalInputAt(Vector2 screenSpacePos) => path.ReceivePositionalInputAt(screenSpacePos); public void SetRange(double p0, double p1) { diff --git a/osu.Game.Rulesets.Osu/Objects/Drawables/Pieces/SpinnerBackground.cs b/osu.Game.Rulesets.Osu/Objects/Drawables/Pieces/SpinnerBackground.cs index 1a7455838f..0401df7a91 100644 --- a/osu.Game.Rulesets.Osu/Objects/Drawables/Pieces/SpinnerBackground.cs +++ b/osu.Game.Rulesets.Osu/Objects/Drawables/Pieces/SpinnerBackground.cs @@ -11,8 +11,8 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables.Pieces { public class SpinnerBackground : CircularContainer, IHasAccentColour { - public override bool HandleKeyboardInput => false; - public override bool HandleMouseInput => false; + public override bool HandleNonPositionalInput => false; + public override bool HandlePositionalInput => false; protected Box Disc; diff --git a/osu.Game.Rulesets.Osu/Objects/Drawables/Pieces/SpinnerDisc.cs b/osu.Game.Rulesets.Osu/Objects/Drawables/Pieces/SpinnerDisc.cs index 5aba60ba03..6e5bc5258b 100644 --- a/osu.Game.Rulesets.Osu/Objects/Drawables/Pieces/SpinnerDisc.cs +++ b/osu.Game.Rulesets.Osu/Objects/Drawables/Pieces/SpinnerDisc.cs @@ -40,7 +40,7 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables.Pieces }; } - public override bool ReceiveMouseInputAt(Vector2 screenSpacePos) => true; + public override bool ReceivePositionalInputAt(Vector2 screenSpacePos) => true; private bool tracking; public bool Tracking diff --git a/osu.Game.Rulesets.Osu/UI/Cursor/CursorTrail.cs b/osu.Game.Rulesets.Osu/UI/Cursor/CursorTrail.cs index 4a6b12d41a..60c24a6fbd 100644 --- a/osu.Game.Rulesets.Osu/UI/Cursor/CursorTrail.cs +++ b/osu.Game.Rulesets.Osu/UI/Cursor/CursorTrail.cs @@ -76,7 +76,7 @@ namespace osu.Game.Rulesets.Osu.UI.Cursor } } - public override bool ReceiveMouseInputAt(Vector2 screenSpacePos) => true; + public override bool ReceivePositionalInputAt(Vector2 screenSpacePos) => true; [BackgroundDependencyLoader] private void load(ShaderManager shaders, TextureStore textures) diff --git a/osu.Game.Rulesets.Osu/UI/Cursor/GameplayCursor.cs b/osu.Game.Rulesets.Osu/UI/Cursor/GameplayCursor.cs index 4d6722b61b..4a45d4fb31 100644 --- a/osu.Game.Rulesets.Osu/UI/Cursor/GameplayCursor.cs +++ b/osu.Game.Rulesets.Osu/UI/Cursor/GameplayCursor.cs @@ -72,7 +72,7 @@ namespace osu.Game.Rulesets.Osu.UI.Cursor return false; } - public override bool HandleMouseInput => true; // OverlayContainer will set this false when we go hidden, but we always want to receive input. + public override bool HandlePositionalInput => true; // OverlayContainer will set this false when we go hidden, but we always want to receive input. protected override void PopIn() { diff --git a/osu.Game.Tests/Visual/TestCaseCursors.cs b/osu.Game.Tests/Visual/TestCaseCursors.cs index 361e255894..d4c409b144 100644 --- a/osu.Game.Tests/Visual/TestCaseCursors.cs +++ b/osu.Game.Tests/Visual/TestCaseCursors.cs @@ -193,7 +193,7 @@ namespace osu.Game.Tests.Visual public CursorContainer Cursor { get; } public bool ProvidingUserCursor { get; } - public override bool ReceiveMouseInputAt(Vector2 screenSpacePos) => base.ReceiveMouseInputAt(screenSpacePos) || SmoothTransition && !ProvidingUserCursor; + public override bool ReceivePositionalInputAt(Vector2 screenSpacePos) => base.ReceivePositionalInputAt(screenSpacePos) || SmoothTransition && !ProvidingUserCursor; private readonly Box background; diff --git a/osu.Game/Graphics/Backgrounds/Triangles.cs b/osu.Game/Graphics/Backgrounds/Triangles.cs index 0f382900ce..bff9e49dce 100644 --- a/osu.Game/Graphics/Backgrounds/Triangles.cs +++ b/osu.Game/Graphics/Backgrounds/Triangles.cs @@ -30,8 +30,8 @@ namespace osu.Game.Graphics.Backgrounds /// private const float edge_smoothness = 1; - public override bool HandleKeyboardInput => false; - public override bool HandleMouseInput => false; + public override bool HandleNonPositionalInput => false; + public override bool HandlePositionalInput => false; public Color4 ColourLight = Color4.White; diff --git a/osu.Game/Graphics/Containers/LinkFlowContainer.cs b/osu.Game/Graphics/Containers/LinkFlowContainer.cs index 9c5da71aff..7c17f95e80 100644 --- a/osu.Game/Graphics/Containers/LinkFlowContainer.cs +++ b/osu.Game/Graphics/Containers/LinkFlowContainer.cs @@ -20,7 +20,7 @@ namespace osu.Game.Graphics.Containers { } - public override bool HandleMouseInput => true; + public override bool HandlePositionalInput => true; private OsuGame game; diff --git a/osu.Game/Graphics/Containers/OsuFocusedOverlayContainer.cs b/osu.Game/Graphics/Containers/OsuFocusedOverlayContainer.cs index d2ab8441eb..a143c056ff 100644 --- a/osu.Game/Graphics/Containers/OsuFocusedOverlayContainer.cs +++ b/osu.Game/Graphics/Containers/OsuFocusedOverlayContainer.cs @@ -22,7 +22,7 @@ namespace osu.Game.Graphics.Containers protected virtual bool PlaySamplesOnStateChange => true; - protected override bool BlockPassThroughKeyboard => true; + protected override bool BlockNonPositionalInput => true; private PreviewTrackManager previewTrackManager; @@ -54,14 +54,14 @@ namespace osu.Game.Graphics.Containers /// Whether mouse input should be blocked screen-wide while this overlay is visible. /// Performing mouse actions outside of the valid extents will hide the overlay. /// - public virtual bool BlockScreenWideMouse => BlockPassThroughMouse; + public virtual bool BlockScreenWideMouse => BlockPositionalInput; // receive input outside our bounds so we can trigger a close event on ourselves. - public override bool ReceiveMouseInputAt(Vector2 screenSpacePos) => BlockScreenWideMouse || base.ReceiveMouseInputAt(screenSpacePos); + public override bool ReceivePositionalInputAt(Vector2 screenSpacePos) => BlockScreenWideMouse || base.ReceivePositionalInputAt(screenSpacePos); protected override bool OnClick(InputState state) { - if (!base.ReceiveMouseInputAt(state.Mouse.NativeState.Position)) + if (!base.ReceivePositionalInputAt(state.Mouse.NativeState.Position)) { State = Visibility.Hidden; return true; diff --git a/osu.Game/Graphics/DrawableDate.cs b/osu.Game/Graphics/DrawableDate.cs index be794d93a6..1a7ed607e6 100644 --- a/osu.Game/Graphics/DrawableDate.cs +++ b/osu.Game/Graphics/DrawableDate.cs @@ -54,7 +54,7 @@ namespace osu.Game.Graphics Scheduler.AddDelayed(updateTimeWithReschedule, timeUntilNextUpdate); } - public override bool HandleMouseInput => true; + public override bool HandlePositionalInput => true; protected virtual string Format() => Date.Humanize(); diff --git a/osu.Game/Graphics/UserInterface/BreadcrumbControl.cs b/osu.Game/Graphics/UserInterface/BreadcrumbControl.cs index f5017de639..ebb7b686e4 100644 --- a/osu.Game/Graphics/UserInterface/BreadcrumbControl.cs +++ b/osu.Game/Graphics/UserInterface/BreadcrumbControl.cs @@ -47,10 +47,10 @@ namespace osu.Game.Graphics.UserInterface public readonly SpriteIcon Chevron; //don't allow clicking between transitions and don't make the chevron clickable - public override bool ReceiveMouseInputAt(Vector2 screenSpacePos) => Alpha == 1f && Text.ReceiveMouseInputAt(screenSpacePos); + public override bool ReceivePositionalInputAt(Vector2 screenSpacePos) => Alpha == 1f && Text.ReceivePositionalInputAt(screenSpacePos); - public override bool HandleKeyboardInput => State == Visibility.Visible; - public override bool HandleMouseInput => State == Visibility.Visible; + public override bool HandleNonPositionalInput => State == Visibility.Visible; + public override bool HandlePositionalInput => State == Visibility.Visible; public override bool IsRemovable => true; private Visibility state; diff --git a/osu.Game/Graphics/UserInterface/DialogButton.cs b/osu.Game/Graphics/UserInterface/DialogButton.cs index ee2448ff02..5094062fae 100644 --- a/osu.Game/Graphics/UserInterface/DialogButton.cs +++ b/osu.Game/Graphics/UserInterface/DialogButton.cs @@ -211,7 +211,7 @@ namespace osu.Game.Graphics.UserInterface } } - public override bool ReceiveMouseInputAt(Vector2 screenSpacePos) => backgroundContainer.ReceiveMouseInputAt(screenSpacePos); + public override bool ReceivePositionalInputAt(Vector2 screenSpacePos) => backgroundContainer.ReceivePositionalInputAt(screenSpacePos); protected override bool OnClick(InputState state) { diff --git a/osu.Game/Graphics/UserInterface/FocusedTextBox.cs b/osu.Game/Graphics/UserInterface/FocusedTextBox.cs index e4fd71e17e..18ec35c76e 100644 --- a/osu.Game/Graphics/UserInterface/FocusedTextBox.cs +++ b/osu.Game/Graphics/UserInterface/FocusedTextBox.cs @@ -34,7 +34,7 @@ namespace osu.Game.Graphics.UserInterface } // We may not be focused yet, but we need to handle keyboard input to be able to request focus - public override bool HandleKeyboardInput => HoldFocus || base.HandleKeyboardInput; + public override bool HandleNonPositionalInput => HoldFocus || base.HandleNonPositionalInput; protected override void OnFocus(InputState state) { diff --git a/osu.Game/Graphics/UserInterface/TwoLayerButton.cs b/osu.Game/Graphics/UserInterface/TwoLayerButton.cs index 4e6361d1ae..027ba67f66 100644 --- a/osu.Game/Graphics/UserInterface/TwoLayerButton.cs +++ b/osu.Game/Graphics/UserInterface/TwoLayerButton.cs @@ -170,7 +170,7 @@ namespace osu.Game.Graphics.UserInterface } } - public override bool ReceiveMouseInputAt(Vector2 screenSpacePos) => IconLayer.ReceiveMouseInputAt(screenSpacePos) || TextLayer.ReceiveMouseInputAt(screenSpacePos); + public override bool ReceivePositionalInputAt(Vector2 screenSpacePos) => IconLayer.ReceivePositionalInputAt(screenSpacePos) || TextLayer.ReceivePositionalInputAt(screenSpacePos); protected override bool OnHover(InputState state) { diff --git a/osu.Game/Online/Chat/DrawableLinkCompiler.cs b/osu.Game/Online/Chat/DrawableLinkCompiler.cs index 475363bd51..0148d1d2c3 100644 --- a/osu.Game/Online/Chat/DrawableLinkCompiler.cs +++ b/osu.Game/Online/Chat/DrawableLinkCompiler.cs @@ -24,7 +24,7 @@ namespace osu.Game.Online.Chat /// public List Parts; - public override bool ReceiveMouseInputAt(Vector2 screenSpacePos) => Parts.Any(d => d.ReceiveMouseInputAt(screenSpacePos)); + public override bool ReceivePositionalInputAt(Vector2 screenSpacePos) => Parts.Any(d => d.ReceivePositionalInputAt(screenSpacePos)); protected override HoverClickSounds CreateHoverClickSounds(HoverSampleSet sampleSet) => new LinkHoverSounds(sampleSet, Parts); @@ -53,7 +53,7 @@ namespace osu.Game.Online.Chat this.parts = parts; } - public override bool ReceiveMouseInputAt(Vector2 screenSpacePos) => parts.Any(d => d.ReceiveMouseInputAt(screenSpacePos)); + public override bool ReceivePositionalInputAt(Vector2 screenSpacePos) => parts.Any(d => d.ReceivePositionalInputAt(screenSpacePos)); } } } diff --git a/osu.Game/Overlays/BeatmapSetOverlay.cs b/osu.Game/Overlays/BeatmapSetOverlay.cs index 02cc89e57e..f66e103a21 100644 --- a/osu.Game/Overlays/BeatmapSetOverlay.cs +++ b/osu.Game/Overlays/BeatmapSetOverlay.cs @@ -51,7 +51,7 @@ namespace osu.Game.Overlays } // receive input outside our bounds so we can trigger a close event on ourselves. - public override bool ReceiveMouseInputAt(Vector2 screenSpacePos) => true; + public override bool ReceivePositionalInputAt(Vector2 screenSpacePos) => true; public BeatmapSetOverlay() { diff --git a/osu.Game/Overlays/ChatOverlay.cs b/osu.Game/Overlays/ChatOverlay.cs index 8e20d76914..a2276d4904 100644 --- a/osu.Game/Overlays/ChatOverlay.cs +++ b/osu.Game/Overlays/ChatOverlay.cs @@ -62,7 +62,7 @@ namespace osu.Game.Overlays private readonly Container channelSelectionContainer; private readonly ChannelSelectionOverlay channelSelection; - public override bool Contains(Vector2 screenSpacePos) => chatContainer.ReceiveMouseInputAt(screenSpacePos) || channelSelection.State == Visibility.Visible && channelSelection.ReceiveMouseInputAt(screenSpacePos); + public override bool Contains(Vector2 screenSpacePos) => chatContainer.ReceivePositionalInputAt(screenSpacePos) || channelSelection.State == Visibility.Visible && channelSelection.ReceivePositionalInputAt(screenSpacePos); public ChatOverlay() { diff --git a/osu.Game/Overlays/Dialog/PopupDialog.cs b/osu.Game/Overlays/Dialog/PopupDialog.cs index 3f79fa98e5..ccbb7cc496 100644 --- a/osu.Game/Overlays/Dialog/PopupDialog.cs +++ b/osu.Game/Overlays/Dialog/PopupDialog.cs @@ -26,7 +26,7 @@ namespace osu.Game.Overlays.Dialog public static readonly float ENTER_DURATION = 500; public static readonly float EXIT_DURATION = 200; - protected override bool BlockPassThroughMouse => false; + protected override bool BlockPositionalInput => false; private readonly Vector2 ringSize = new Vector2(100f); private readonly Vector2 ringMinifiedSize = new Vector2(20f); diff --git a/osu.Game/Overlays/DialogOverlay.cs b/osu.Game/Overlays/DialogOverlay.cs index c40f517023..dae502dbd9 100644 --- a/osu.Game/Overlays/DialogOverlay.cs +++ b/osu.Game/Overlays/DialogOverlay.cs @@ -43,7 +43,7 @@ namespace osu.Game.Overlays protected override bool PlaySamplesOnStateChange => false; - protected override bool BlockPassThroughKeyboard => true; + protected override bool BlockNonPositionalInput => true; private void onDialogOnStateChanged(VisibilityContainer dialog, Visibility v) { diff --git a/osu.Game/Overlays/Direct/FilterControl.cs b/osu.Game/Overlays/Direct/FilterControl.cs index df98cc3c32..c4825f72fe 100644 --- a/osu.Game/Overlays/Direct/FilterControl.cs +++ b/osu.Game/Overlays/Direct/FilterControl.cs @@ -73,8 +73,8 @@ namespace osu.Game.Overlays.Direct iconContainer.FadeTo(Ruleset.ID == obj?.ID ? 1f : 0.5f, 100); } - public override bool HandleKeyboardInput => !bindable.Disabled && base.HandleKeyboardInput; - public override bool HandleMouseInput => !bindable.Disabled && base.HandleMouseInput; + public override bool HandleNonPositionalInput => !bindable.Disabled && base.HandleNonPositionalInput; + public override bool HandlePositionalInput => !bindable.Disabled && base.HandlePositionalInput; public RulesetToggleButton(Bindable bindable, RulesetInfo ruleset) { diff --git a/osu.Game/Overlays/Mods/ModSelectOverlay.cs b/osu.Game/Overlays/Mods/ModSelectOverlay.cs index e83dedaf35..55d5d797e7 100644 --- a/osu.Game/Overlays/Mods/ModSelectOverlay.cs +++ b/osu.Game/Overlays/Mods/ModSelectOverlay.cs @@ -40,7 +40,7 @@ namespace osu.Game.Overlays.Mods protected readonly OsuSpriteText MultiplierLabel, UnrankedLabel; private readonly FillFlowContainer footerContainer; - protected override bool BlockPassThroughKeyboard => false; + protected override bool BlockNonPositionalInput => false; protected readonly FillFlowContainer ModSectionsContainer; diff --git a/osu.Game/Overlays/OnScreenDisplay.cs b/osu.Game/Overlays/OnScreenDisplay.cs index 041ceab365..e40004aa01 100644 --- a/osu.Game/Overlays/OnScreenDisplay.cs +++ b/osu.Game/Overlays/OnScreenDisplay.cs @@ -25,8 +25,8 @@ namespace osu.Game.Overlays { private readonly Container box; - public override bool HandleKeyboardInput => false; - public override bool HandleMouseInput => false; + public override bool HandleNonPositionalInput => false; + public override bool HandlePositionalInput => false; private readonly SpriteText textLine1; private readonly SpriteText textLine2; diff --git a/osu.Game/Overlays/Toolbar/Toolbar.cs b/osu.Game/Overlays/Toolbar/Toolbar.cs index cdc3bc2b51..3f44cb403a 100644 --- a/osu.Game/Overlays/Toolbar/Toolbar.cs +++ b/osu.Game/Overlays/Toolbar/Toolbar.cs @@ -24,7 +24,7 @@ namespace osu.Game.Overlays.Toolbar private readonly ToolbarUserArea userArea; - protected override bool BlockPassThroughMouse => false; + protected override bool BlockPositionalInput => false; private const double transition_time = 500; diff --git a/osu.Game/Overlays/Toolbar/ToolbarRulesetSelector.cs b/osu.Game/Overlays/Toolbar/ToolbarRulesetSelector.cs index f2744ae83f..4b6fb366bb 100644 --- a/osu.Game/Overlays/Toolbar/ToolbarRulesetSelector.cs +++ b/osu.Game/Overlays/Toolbar/ToolbarRulesetSelector.cs @@ -103,8 +103,8 @@ namespace osu.Game.Overlays.Toolbar return false; } - public override bool HandleKeyboardInput => !ruleset.Disabled && base.HandleKeyboardInput; - public override bool HandleMouseInput => !ruleset.Disabled && base.HandleMouseInput; + public override bool HandleNonPositionalInput => !ruleset.Disabled && base.HandleNonPositionalInput; + public override bool HandlePositionalInput => !ruleset.Disabled && base.HandlePositionalInput; private void disabledChanged(bool isDisabled) => this.FadeColour(isDisabled ? Color4.Gray : Color4.White, 300); diff --git a/osu.Game/Overlays/VolumeOverlay.cs b/osu.Game/Overlays/VolumeOverlay.cs index 4dcdd23768..bf1c81393d 100644 --- a/osu.Game/Overlays/VolumeOverlay.cs +++ b/osu.Game/Overlays/VolumeOverlay.cs @@ -28,7 +28,7 @@ namespace osu.Game.Overlays private VolumeMeter volumeMeterMusic; private MuteButton muteButton; - protected override bool BlockPassThroughMouse => false; + protected override bool BlockPositionalInput => false; private readonly BindableDouble muteAdjustment = new BindableDouble(); diff --git a/osu.Game/Overlays/WaveOverlayContainer.cs b/osu.Game/Overlays/WaveOverlayContainer.cs index 97f52d88f7..c5a4953c5e 100644 --- a/osu.Game/Overlays/WaveOverlayContainer.cs +++ b/osu.Game/Overlays/WaveOverlayContainer.cs @@ -11,7 +11,7 @@ namespace osu.Game.Overlays { protected readonly WaveContainer Waves; - protected override bool BlockPassThroughKeyboard => true; + protected override bool BlockNonPositionalInput => true; protected override Container Content => Waves; protected WaveOverlayContainer() diff --git a/osu.Game/Rulesets/Edit/HitObjectMask.cs b/osu.Game/Rulesets/Edit/HitObjectMask.cs index ada026b32f..0ba67e1dca 100644 --- a/osu.Game/Rulesets/Edit/HitObjectMask.cs +++ b/osu.Game/Rulesets/Edit/HitObjectMask.cs @@ -45,7 +45,7 @@ namespace osu.Game.Rulesets.Edit public readonly DrawableHitObject HitObject; protected override bool ShouldBeAlive => HitObject.IsAlive && HitObject.IsPresent || State == SelectionState.Selected; - public override bool HandleMouseInput => ShouldBeAlive; + public override bool HandlePositionalInput => ShouldBeAlive; public override bool RemoveWhenNotAlive => false; public HitObjectMask(DrawableHitObject hitObject) diff --git a/osu.Game/Rulesets/Objects/Drawables/DrawableHitObject.cs b/osu.Game/Rulesets/Objects/Drawables/DrawableHitObject.cs index a274d9b12f..8489f0b19e 100644 --- a/osu.Game/Rulesets/Objects/Drawables/DrawableHitObject.cs +++ b/osu.Game/Rulesets/Objects/Drawables/DrawableHitObject.cs @@ -78,8 +78,8 @@ namespace osu.Game.Rulesets.Objects.Drawables private bool judgementOccurred; public bool Interactive = true; - public override bool HandleKeyboardInput => Interactive; - public override bool HandleMouseInput => Interactive; + public override bool HandleNonPositionalInput => Interactive; + public override bool HandlePositionalInput => Interactive; public override bool RemoveWhenNotAlive => false; public override bool RemoveCompletedTransforms => false; diff --git a/osu.Game/Screens/Edit/Screens/Compose/BeatDivisorControl.cs b/osu.Game/Screens/Edit/Screens/Compose/BeatDivisorControl.cs index 63df143ca8..833c4464c3 100644 --- a/osu.Game/Screens/Edit/Screens/Compose/BeatDivisorControl.cs +++ b/osu.Game/Screens/Edit/Screens/Compose/BeatDivisorControl.cs @@ -231,7 +231,7 @@ namespace osu.Game.Screens.Edit.Screens.Compose { } - public override bool HandleKeyboardInput => IsHovered && !CurrentNumber.Disabled; + public override bool HandleNonPositionalInput => IsHovered && !CurrentNumber.Disabled; protected override bool OnKeyDown(InputState state, KeyDownEventArgs args) { diff --git a/osu.Game/Screens/Menu/Button.cs b/osu.Game/Screens/Menu/Button.cs index e53905a102..38d74a3a4b 100644 --- a/osu.Game/Screens/Menu/Button.cs +++ b/osu.Game/Screens/Menu/Button.cs @@ -47,7 +47,7 @@ namespace osu.Game.Screens.Menu private SampleChannel sampleClick; private SampleChannel sampleHover; - public override bool ReceiveMouseInputAt(Vector2 screenSpacePos) => box.ReceiveMouseInputAt(screenSpacePos); + public override bool ReceivePositionalInputAt(Vector2 screenSpacePos) => box.ReceivePositionalInputAt(screenSpacePos); public Button(string text, string sampleName, FontAwesome symbol, Color4 colour, Action clickAction = null, float extraWidth = 0, Key triggerKey = Key.Unknown) { @@ -229,8 +229,8 @@ namespace osu.Game.Screens.Menu boxHoverLayer.FadeOut(800, Easing.OutExpo); } - public override bool HandleKeyboardInput => state == ButtonState.Expanded; - public override bool HandleMouseInput => state != ButtonState.Exploded && box.Scale.X >= 0.8f; + public override bool HandleNonPositionalInput => state == ButtonState.Expanded; + public override bool HandlePositionalInput => state != ButtonState.Exploded && box.Scale.X >= 0.8f; protected override void Update() { diff --git a/osu.Game/Screens/Menu/ButtonSystem.cs b/osu.Game/Screens/Menu/ButtonSystem.cs index dba0a3ac50..5c17317fc1 100644 --- a/osu.Game/Screens/Menu/ButtonSystem.cs +++ b/osu.Game/Screens/Menu/ButtonSystem.cs @@ -160,8 +160,8 @@ namespace osu.Game.Screens.Menu private ButtonSystemState state = ButtonSystemState.Initial; - public override bool HandleKeyboardInput => state != ButtonSystemState.Exit; - public override bool HandleMouseInput => state != ButtonSystemState.Exit; + public override bool HandleNonPositionalInput => state != ButtonSystemState.Exit; + public override bool HandlePositionalInput => state != ButtonSystemState.Exit; public ButtonSystemState State { diff --git a/osu.Game/Screens/Menu/LogoVisualisation.cs b/osu.Game/Screens/Menu/LogoVisualisation.cs index a3cb2f13d0..5d76206905 100644 --- a/osu.Game/Screens/Menu/LogoVisualisation.cs +++ b/osu.Game/Screens/Menu/LogoVisualisation.cs @@ -64,8 +64,8 @@ namespace osu.Game.Screens.Menu private readonly float[] frequencyAmplitudes = new float[256]; - public override bool HandleKeyboardInput => false; - public override bool HandleMouseInput => false; + public override bool HandleNonPositionalInput => false; + public override bool HandlePositionalInput => false; private Shader shader; private readonly Texture texture; diff --git a/osu.Game/Screens/Menu/MenuSideFlashes.cs b/osu.Game/Screens/Menu/MenuSideFlashes.cs index 7d46aad089..a9e3310fbe 100644 --- a/osu.Game/Screens/Menu/MenuSideFlashes.cs +++ b/osu.Game/Screens/Menu/MenuSideFlashes.cs @@ -19,8 +19,8 @@ namespace osu.Game.Screens.Menu { public class MenuSideFlashes : BeatSyncedContainer { - public override bool HandleKeyboardInput => false; - public override bool HandleMouseInput => false; + public override bool HandleNonPositionalInput => false; + public override bool HandlePositionalInput => false; private readonly IBindable beatmap = new Bindable(); diff --git a/osu.Game/Screens/Menu/OsuLogo.cs b/osu.Game/Screens/Menu/OsuLogo.cs index 5ad6427fd8..52354241d2 100644 --- a/osu.Game/Screens/Menu/OsuLogo.cs +++ b/osu.Game/Screens/Menu/OsuLogo.cs @@ -68,7 +68,7 @@ namespace osu.Game.Screens.Menu public bool BeatMatching = true; - public override bool ReceiveMouseInputAt(Vector2 screenSpacePos) => logoContainer.ReceiveMouseInputAt(screenSpacePos); + public override bool ReceivePositionalInputAt(Vector2 screenSpacePos) => logoContainer.ReceivePositionalInputAt(screenSpacePos); public bool Ripple { @@ -342,7 +342,7 @@ namespace osu.Game.Screens.Menu } } - public override bool HandleMouseInput => base.HandleMouseInput && Action != null && Alpha > 0.2f; + public override bool HandlePositionalInput => base.HandlePositionalInput && Action != null && Alpha > 0.2f; protected override bool OnMouseDown(InputState state, MouseDownEventArgs args) { diff --git a/osu.Game/Screens/Play/GameplayMenuOverlay.cs b/osu.Game/Screens/Play/GameplayMenuOverlay.cs index f50b3e9661..a978bd916e 100644 --- a/osu.Game/Screens/Play/GameplayMenuOverlay.cs +++ b/osu.Game/Screens/Play/GameplayMenuOverlay.cs @@ -28,9 +28,9 @@ namespace osu.Game.Screens.Play private const int button_height = 70; private const float background_alpha = 0.75f; - protected override bool BlockPassThroughKeyboard => true; + protected override bool BlockNonPositionalInput => true; - public override bool ReceiveMouseInputAt(Vector2 screenSpacePos) => true; + public override bool ReceivePositionalInputAt(Vector2 screenSpacePos) => true; public Action OnRetry; public Action OnQuit; diff --git a/osu.Game/Screens/Play/HUD/PlayerSettingsOverlay.cs b/osu.Game/Screens/Play/HUD/PlayerSettingsOverlay.cs index e5e2ed7ee0..7534c7a22e 100644 --- a/osu.Game/Screens/Play/HUD/PlayerSettingsOverlay.cs +++ b/osu.Game/Screens/Play/HUD/PlayerSettingsOverlay.cs @@ -51,7 +51,7 @@ namespace osu.Game.Screens.Play.HUD protected override void PopOut() => this.FadeOut(fade_duration); //We want to handle keyboard inputs all the time in order to trigger ToggleVisibility() when not visible - public override bool HandleKeyboardInput => true; + public override bool HandleNonPositionalInput => true; protected override bool OnKeyDown(InputState state, KeyDownEventArgs args) { diff --git a/osu.Game/Screens/Play/HUD/QuitButton.cs b/osu.Game/Screens/Play/HUD/QuitButton.cs index 2a4b1f408d..6b120421ad 100644 --- a/osu.Game/Screens/Play/HUD/QuitButton.cs +++ b/osu.Game/Screens/Play/HUD/QuitButton.cs @@ -20,7 +20,7 @@ namespace osu.Game.Screens.Play.HUD { public class QuitButton : FillFlowContainer { - public override bool ReceiveMouseInputAt(Vector2 screenSpacePos) => true; + public override bool ReceivePositionalInputAt(Vector2 screenSpacePos) => true; private readonly Button button; diff --git a/osu.Game/Screens/Play/KeyCounterCollection.cs b/osu.Game/Screens/Play/KeyCounterCollection.cs index 76c102c840..925f96f33b 100644 --- a/osu.Game/Screens/Play/KeyCounterCollection.cs +++ b/osu.Game/Screens/Play/KeyCounterCollection.cs @@ -118,8 +118,8 @@ namespace osu.Game.Screens.Play private void updateVisibility() => this.FadeTo(Visible.Value || configVisibility.Value ? 1 : 0, duration); - public override bool HandleKeyboardInput => receptor == null; - public override bool HandleMouseInput => receptor == null; + public override bool HandleNonPositionalInput => receptor == null; + public override bool HandlePositionalInput => receptor == null; public IFrameBasedClock AudioClock { get; set; } @@ -149,7 +149,7 @@ namespace osu.Game.Screens.Play Target = target; } - public override bool ReceiveMouseInputAt(Vector2 screenSpacePos) => true; + public override bool ReceivePositionalInputAt(Vector2 screenSpacePos) => true; protected override bool Handle(UIEvent e) { diff --git a/osu.Game/Screens/Play/KeyCounterMouse.cs b/osu.Game/Screens/Play/KeyCounterMouse.cs index 20cc53caee..37c2b4f072 100644 --- a/osu.Game/Screens/Play/KeyCounterMouse.cs +++ b/osu.Game/Screens/Play/KeyCounterMouse.cs @@ -17,7 +17,7 @@ namespace osu.Game.Screens.Play Button = button; } - public override bool ReceiveMouseInputAt(Vector2 screenSpacePos) => true; + public override bool ReceivePositionalInputAt(Vector2 screenSpacePos) => true; private static string getStringRepresentation(MouseButton button) { diff --git a/osu.Game/Screens/Play/SkipOverlay.cs b/osu.Game/Screens/Play/SkipOverlay.cs index 046a00d79b..d736a51a99 100644 --- a/osu.Game/Screens/Play/SkipOverlay.cs +++ b/osu.Game/Screens/Play/SkipOverlay.cs @@ -37,8 +37,8 @@ namespace osu.Game.Screens.Play private FadeContainer fadeContainer; private double displayTime; - public override bool ReceiveMouseInputAt(Vector2 screenSpacePos) => true; - protected override bool BlockPassThroughMouse => false; + public override bool ReceivePositionalInputAt(Vector2 screenSpacePos) => true; + protected override bool BlockPositionalInput => false; public SkipOverlay(double startTime) { diff --git a/osu.Game/Screens/Play/SongProgress.cs b/osu.Game/Screens/Play/SongProgress.cs index 2ca471c5c1..2e2c77c1c8 100644 --- a/osu.Game/Screens/Play/SongProgress.cs +++ b/osu.Game/Screens/Play/SongProgress.cs @@ -31,8 +31,8 @@ namespace osu.Game.Screens.Play public Action OnSeek; - public override bool HandleKeyboardInput => AllowSeeking; - public override bool HandleMouseInput => AllowSeeking; + public override bool HandleNonPositionalInput => AllowSeeking; + public override bool HandlePositionalInput => AllowSeeking; private IClock audioClock; public IClock AudioClock { set { audioClock = info.AudioClock = value; } } diff --git a/osu.Game/Screens/Play/SquareGraph.cs b/osu.Game/Screens/Play/SquareGraph.cs index 8ffd04b35c..6b4918af75 100644 --- a/osu.Game/Screens/Play/SquareGraph.cs +++ b/osu.Game/Screens/Play/SquareGraph.cs @@ -21,8 +21,8 @@ namespace osu.Game.Screens.Play public int ColumnCount => columns.Length; - public override bool HandleKeyboardInput => false; - public override bool HandleMouseInput => false; + public override bool HandleNonPositionalInput => false; + public override bool HandlePositionalInput => false; private int progress; public int Progress diff --git a/osu.Game/Screens/Select/BeatmapCarousel.cs b/osu.Game/Screens/Select/BeatmapCarousel.cs index b6cbaf45e9..5771cb1f70 100644 --- a/osu.Game/Screens/Select/BeatmapCarousel.cs +++ b/osu.Game/Screens/Select/BeatmapCarousel.cs @@ -52,8 +52,8 @@ namespace osu.Game.Screens.Select /// public Action SelectionChanged; - public override bool HandleKeyboardInput => AllowSelection; - public override bool HandleMouseInput => AllowSelection; + public override bool HandleNonPositionalInput => AllowSelection; + public override bool HandlePositionalInput => AllowSelection; /// /// Used to avoid firing null selections before the initial beatmaps have been loaded via . diff --git a/osu.Game/Screens/Select/BeatmapInfoWedge.cs b/osu.Game/Screens/Select/BeatmapInfoWedge.cs index 4129a9596f..2196f3f486 100644 --- a/osu.Game/Screens/Select/BeatmapInfoWedge.cs +++ b/osu.Game/Screens/Select/BeatmapInfoWedge.cs @@ -59,7 +59,7 @@ namespace osu.Game.Screens.Select ruleset.ValueChanged += _ => updateDisplay(); } - protected override bool BlockPassThroughMouse => false; + protected override bool BlockPositionalInput => false; protected override void PopIn() { @@ -154,7 +154,7 @@ namespace osu.Game.Screens.Select RelativeSizeAxes = Axes.Both; titleBinding = localisation.GetLocalisedString(new LocalisedString((metadata.TitleUnicode, metadata.Title))); - artistBinding = localisation.GetLocalisedString(new LocalisedString((metadata.ArtistUnicode, metadata.Artist))); + artistBinding = localisation.GetLocalisedString(new LocalisedString((metadata.ArtistUnicode, metadata.Artist))); Children = new Drawable[] { diff --git a/osu.Game/Screens/Select/FilterControl.cs b/osu.Game/Screens/Select/FilterControl.cs index 9ba8b085f3..32b6620c84 100644 --- a/osu.Game/Screens/Select/FilterControl.cs +++ b/osu.Game/Screens/Select/FilterControl.cs @@ -72,8 +72,8 @@ namespace osu.Game.Screens.Select private readonly SearchTextBox searchTextBox; - public override bool ReceiveMouseInputAt(Vector2 screenSpacePos) => - base.ReceiveMouseInputAt(screenSpacePos) || groupTabs.ReceiveMouseInputAt(screenSpacePos) || sortTabs.ReceiveMouseInputAt(screenSpacePos); + public override bool ReceivePositionalInputAt(Vector2 screenSpacePos) => + base.ReceivePositionalInputAt(screenSpacePos) || groupTabs.ReceivePositionalInputAt(screenSpacePos) || sortTabs.ReceivePositionalInputAt(screenSpacePos); public FilterControl() { diff --git a/osu.Game/Screens/Select/FooterButton.cs b/osu.Game/Screens/Select/FooterButton.cs index 1b0e3a1620..8fb95d394e 100644 --- a/osu.Game/Screens/Select/FooterButton.cs +++ b/osu.Game/Screens/Select/FooterButton.cs @@ -56,7 +56,7 @@ namespace osu.Game.Screens.Select private readonly Box box; private readonly Box light; - public override bool ReceiveMouseInputAt(Vector2 screenSpacePos) => box.ReceiveMouseInputAt(screenSpacePos); + public override bool ReceivePositionalInputAt(Vector2 screenSpacePos) => box.ReceivePositionalInputAt(screenSpacePos); public FooterButton() { diff --git a/osu.Game/Screens/Select/Leaderboards/Placeholder.cs b/osu.Game/Screens/Select/Leaderboards/Placeholder.cs index 307986a299..105f9e2064 100644 --- a/osu.Game/Screens/Select/Leaderboards/Placeholder.cs +++ b/osu.Game/Screens/Select/Leaderboards/Placeholder.cs @@ -11,7 +11,7 @@ namespace osu.Game.Screens.Select.Leaderboards { protected const float TEXT_SIZE = 22; - public override bool HandleMouseInput => true; + public override bool HandlePositionalInput => true; protected Placeholder() : base(cp => cp.TextSize = TEXT_SIZE) diff --git a/osu.Game/Screens/Select/Options/BeatmapOptionsButton.cs b/osu.Game/Screens/Select/Options/BeatmapOptionsButton.cs index d4cd882433..f9127ace19 100644 --- a/osu.Game/Screens/Select/Options/BeatmapOptionsButton.cs +++ b/osu.Game/Screens/Select/Options/BeatmapOptionsButton.cs @@ -85,7 +85,7 @@ namespace osu.Game.Screens.Select.Options return false; } - public override bool ReceiveMouseInputAt(Vector2 screenSpacePos) => box.ReceiveMouseInputAt(screenSpacePos); + public override bool ReceivePositionalInputAt(Vector2 screenSpacePos) => box.ReceivePositionalInputAt(screenSpacePos); public BeatmapOptionsButton() { diff --git a/osu.Game/Storyboards/Drawables/DrawableStoryboard.cs b/osu.Game/Storyboards/Drawables/DrawableStoryboard.cs index 37c198f370..02a4b46f1c 100644 --- a/osu.Game/Storyboards/Drawables/DrawableStoryboard.cs +++ b/osu.Game/Storyboards/Drawables/DrawableStoryboard.cs @@ -18,8 +18,8 @@ namespace osu.Game.Storyboards.Drawables protected override Container Content => content; protected override Vector2 DrawScale => new Vector2(Parent.DrawHeight / 480); - public override bool HandleKeyboardInput => false; - public override bool HandleMouseInput => false; + public override bool HandleNonPositionalInput => false; + public override bool HandlePositionalInput => false; private bool passing = true; public bool Passing diff --git a/osu.Game/osu.Game.csproj b/osu.Game/osu.Game.csproj index 5ce04b813b..992a08ce17 100644 --- a/osu.Game/osu.Game.csproj +++ b/osu.Game/osu.Game.csproj @@ -18,7 +18,7 @@ - + From e71e871d1fb68f3aafa7fb1c65e0ec52d7d9e50a Mon Sep 17 00:00:00 2001 From: Dan Balasescu <1329837+smoogipoo@users.noreply.github.com> Date: Wed, 26 Sep 2018 18:41:55 +0900 Subject: [PATCH 159/417] Remove unnecessary comment --- osu.Game/Database/ArchiveModelManager.cs | 1 - 1 file changed, 1 deletion(-) diff --git a/osu.Game/Database/ArchiveModelManager.cs b/osu.Game/Database/ArchiveModelManager.cs index 22abb4f6fa..723bb90e7e 100644 --- a/osu.Game/Database/ArchiveModelManager.cs +++ b/osu.Game/Database/ArchiveModelManager.cs @@ -290,7 +290,6 @@ namespace osu.Game.Database // re-fetch the model on the import context. var foundModel = queryModel().Include(s => s.Files).ThenInclude(f => f.FileInfo).FirstOrDefault(s => s.ID == item.ID); - // Test for null since FirstOrDefault will return null if nothing is found if (foundModel == null || foundModel.DeletePending) return false; if (ModelStore.Delete(foundModel)) From e259911875ca54e4c8b42bb6bc8e8da34d9d6053 Mon Sep 17 00:00:00 2001 From: smoogipoo Date: Wed, 26 Sep 2018 18:44:03 +0900 Subject: [PATCH 160/417] Use invariant tolower --- osu.Game/IPC/ArchiveImportIPCChannel.cs | 2 +- osu.Game/OsuGameBase.cs | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/osu.Game/IPC/ArchiveImportIPCChannel.cs b/osu.Game/IPC/ArchiveImportIPCChannel.cs index e127faa70d..fa8168c1de 100644 --- a/osu.Game/IPC/ArchiveImportIPCChannel.cs +++ b/osu.Game/IPC/ArchiveImportIPCChannel.cs @@ -37,7 +37,7 @@ namespace osu.Game.IPC return; } - if (importer.HandledExtensions.Contains(Path.GetExtension(path)?.ToLower())) + if (importer.HandledExtensions.Contains(Path.GetExtension(path)?.ToLowerInvariant())) importer.Import(path); } } diff --git a/osu.Game/OsuGameBase.cs b/osu.Game/OsuGameBase.cs index 36ca043df6..6e34302a32 100644 --- a/osu.Game/OsuGameBase.cs +++ b/osu.Game/OsuGameBase.cs @@ -243,7 +243,7 @@ namespace osu.Game public void Import(params string[] paths) { - var extension = Path.GetExtension(paths.First())?.ToLower(); + var extension = Path.GetExtension(paths.First())?.ToLowerInvariant(); foreach (var importer in fileImporters) if (importer.HandledExtensions.Contains(extension)) importer.Import(paths); From 2436ee589d25d77e159b09b63b88fcacddf06f40 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Wed, 26 Sep 2018 19:13:38 +0900 Subject: [PATCH 161/417] Remove incorrect API response --- osu.Game/Online/API/Requests/JoinChannelRequest.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu.Game/Online/API/Requests/JoinChannelRequest.cs b/osu.Game/Online/API/Requests/JoinChannelRequest.cs index 55ada2ab3d..a0a4667e98 100644 --- a/osu.Game/Online/API/Requests/JoinChannelRequest.cs +++ b/osu.Game/Online/API/Requests/JoinChannelRequest.cs @@ -8,7 +8,7 @@ using osu.Game.Users; namespace osu.Game.Online.API.Requests { - public class JoinChannelRequest : APIRequest + public class JoinChannelRequest : APIRequest { private readonly Channel channel; private readonly User user; From 1fd2782dd4bb0a138e3aa842495ca175b617c660 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Wed, 26 Sep 2018 19:15:02 +0900 Subject: [PATCH 162/417] Fix loading spinner not disappearing on empty channels --- osu.Game/Online/Chat/Channel.cs | 10 ++++++++++ osu.Game/Overlays/ChatOverlay.cs | 11 ++++------- 2 files changed, 14 insertions(+), 7 deletions(-) diff --git a/osu.Game/Online/Chat/Channel.cs b/osu.Game/Online/Chat/Channel.cs index e68a84cd86..01560dd1fd 100644 --- a/osu.Game/Online/Chat/Channel.cs +++ b/osu.Game/Online/Chat/Channel.cs @@ -24,6 +24,9 @@ namespace osu.Game.Online.Chat [JsonProperty(@"channel_id")] public int Id; + [JsonProperty(@"last_message_id")] + public long? LastMessageId; + public readonly SortedList Messages = new SortedList(Comparer.Default); private readonly List pendingMessages = new List(); @@ -51,11 +54,18 @@ namespace osu.Game.Online.Chat NewMessagesArrived?.Invoke(new[] { message }); } + public bool MessagesLoaded { get; private set; } + public void AddNewMessages(params Message[] messages) { messages = messages.Except(Messages).ToArray(); Messages.AddRange(messages); + MessagesLoaded = true; + + var maxMessageId = messages.Max(m => m.Id); + if (maxMessageId > LastMessageId) + LastMessageId = maxMessageId; purgeOldMessages(); diff --git a/osu.Game/Overlays/ChatOverlay.cs b/osu.Game/Overlays/ChatOverlay.cs index e22798faa8..774570a747 100644 --- a/osu.Game/Overlays/ChatOverlay.cs +++ b/osu.Game/Overlays/ChatOverlay.cs @@ -362,7 +362,7 @@ namespace osu.Game.Overlays loadedChannels.Add(loaded); LoadComponentAsync(loaded, l => { - if (currentChannel.Messages.Any()) + if (currentChannel.MessagesLoaded) loading.Hide(); currentChannelContainer.Clear(false); @@ -398,7 +398,7 @@ namespace osu.Game.Overlays if (channel.Type == ChannelType.Public && !channel.Joined) { var req = new JoinChannelRequest(channel, api.LocalUser); - req.Success += addChannel; + req.Success += () => addChannel(channel); req.Failure += ex => removeChannel(channel); api.Queue(req); return; @@ -431,16 +431,13 @@ namespace osu.Game.Overlays private void fetchInitialMessages(Channel channel) { var req = new GetMessagesRequest(channel); - req.Success += messages => { - loading.Hide(); channel.AddNewMessages(messages.ToArray()); - Debug.Write("success!"); + if (channel == currentChannel) + loading.Hide(); }; - req.Failure += exception => Debug.Write("failure!"); - api.Queue(req); } From 6f3c8e9f8bf1f6190777ab513dadd20b0d5c30c0 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Wed, 26 Sep 2018 19:58:58 +0900 Subject: [PATCH 163/417] Add explicit usage via attribute --- osu.Game/Online/API/Requests/GetUpdatesResponse.cs | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/osu.Game/Online/API/Requests/GetUpdatesResponse.cs b/osu.Game/Online/API/Requests/GetUpdatesResponse.cs index 729290306a..474d8e1501 100644 --- a/osu.Game/Online/API/Requests/GetUpdatesResponse.cs +++ b/osu.Game/Online/API/Requests/GetUpdatesResponse.cs @@ -2,13 +2,17 @@ // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE using System.Collections.Generic; +using Newtonsoft.Json; using osu.Game.Online.Chat; namespace osu.Game.Online.API.Requests { public class GetUpdatesResponse { + [JsonProperty] public List Presence; + + [JsonProperty] public List Messages; } } From b84994e64398dc174d020c7bb2d08d2915823311 Mon Sep 17 00:00:00 2001 From: smoogipoo Date: Thu, 27 Sep 2018 15:29:22 +0900 Subject: [PATCH 164/417] Make GetTexture return the post-scaled texture --- osu.Game/Skinning/LegacySkin.cs | 32 ++++++++++++++++++-------------- 1 file changed, 18 insertions(+), 14 deletions(-) diff --git a/osu.Game/Skinning/LegacySkin.cs b/osu.Game/Skinning/LegacySkin.cs index ce7edf8683..58b1117598 100644 --- a/osu.Game/Skinning/LegacySkin.cs +++ b/osu.Game/Skinning/LegacySkin.cs @@ -58,25 +58,29 @@ namespace osu.Game.Skinning break; } - float ratio = 0.72f; // brings sizing roughly in-line with stable - - var texture = GetTexture($"{componentName}@2x"); - if (texture == null) - { - ratio *= 2; - texture = GetTexture(componentName); - } + var texture = GetTexture(componentName); if (texture == null) return null; - return new Sprite - { - Texture = texture, - Scale = new Vector2(ratio), - }; + return new Sprite { Texture = texture }; } - public override Texture GetTexture(string componentName) => Textures.Get(componentName); + public override Texture GetTexture(string componentName) + { + float ratio = 2; + + var texture = Textures.Get($"{componentName}@2x"); + if (texture == null) + { + ratio = 1; + texture = Textures.Get(componentName); + } + + if (texture != null) + texture.ScaleAdjust = ratio / 0.72f; // brings sizing roughly in-line with stable + + return texture; + } public override SampleChannel GetSample(string sampleName) => Samples.Get(sampleName); From 0d8276c5f86a811b49d252271d6781f5ab48b708 Mon Sep 17 00:00:00 2001 From: smoogipoo Date: Thu, 27 Sep 2018 16:27:11 +0900 Subject: [PATCH 165/417] Implement skinnable sprite text --- .../Objects/Drawables/Pieces/NumberPiece.cs | 12 +++-- osu.Game/Skinning/LegacySkin.cs | 44 ++++++++++++++++++- osu.Game/Skinning/SkinnableDrawable.cs | 29 +++++++----- osu.Game/Skinning/SkinnableSpriteText.cs | 40 +++++++++++++++++ 4 files changed, 104 insertions(+), 21 deletions(-) create mode 100644 osu.Game/Skinning/SkinnableSpriteText.cs diff --git a/osu.Game.Rulesets.Osu/Objects/Drawables/Pieces/NumberPiece.cs b/osu.Game.Rulesets.Osu/Objects/Drawables/Pieces/NumberPiece.cs index 30140484de..acb3ee92ff 100644 --- a/osu.Game.Rulesets.Osu/Objects/Drawables/Pieces/NumberPiece.cs +++ b/osu.Game.Rulesets.Osu/Objects/Drawables/Pieces/NumberPiece.cs @@ -4,7 +4,6 @@ using osu.Framework.Extensions.Color4Extensions; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; -using osu.Framework.Graphics.Sprites; using osu.Game.Graphics.Sprites; using OpenTK.Graphics; using osu.Framework.Graphics.Shapes; @@ -14,7 +13,7 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables.Pieces { public class NumberPiece : Container { - private readonly SpriteText number; + private readonly SkinnableSpriteText number; public string Text { @@ -41,15 +40,14 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables.Pieces }, Child = new Box() }, s => s.GetTexture("Play/osu/hitcircle") == null), - number = new OsuSpriteText + number = new SkinnableSpriteText("Play/osu/number-text", _ => new OsuSpriteText { - Text = @"1", Font = @"Venera", UseFullGlyphHeight = false, - Anchor = Anchor.Centre, - Origin = Anchor.Centre, TextSize = 40, - Alpha = 1 + }, restrictSize: false) + { + Text = @"1" } }; } diff --git a/osu.Game/Skinning/LegacySkin.cs b/osu.Game/Skinning/LegacySkin.cs index 58b1117598..160cc412b4 100644 --- a/osu.Game/Skinning/LegacySkin.cs +++ b/osu.Game/Skinning/LegacySkin.cs @@ -12,7 +12,7 @@ using osu.Framework.Graphics.Sprites; using osu.Framework.Graphics.Textures; using osu.Framework.IO.Stores; using osu.Game.Database; -using OpenTK; +using osu.Game.Graphics.Sprites; namespace osu.Game.Skinning { @@ -56,11 +56,15 @@ namespace osu.Game.Skinning case "Play/Great": componentName = "hit300"; break; + case "Play/osu/number-text": + // Todo: Not necessarily default font + return hasFont("default") ? new LegacySpriteText(Textures, "default") : null; } var texture = GetTexture(componentName); - if (texture == null) return null; + if (texture == null) + return null; return new Sprite { Texture = texture }; } @@ -84,6 +88,8 @@ namespace osu.Game.Skinning public override SampleChannel GetSample(string sampleName) => Samples.Get(sampleName); + private bool hasFont(string fontName) => GetTexture($"{fontName}-0") != null; + protected class LegacySkinResourceStore : IResourceStore where T : INamedFileInfo { @@ -146,5 +152,39 @@ namespace osu.Game.Skinning #endregion } + + private class LegacySpriteText : OsuSpriteText + { + private readonly TextureStore textures; + private readonly string font; + + public LegacySpriteText(TextureStore textures, string font) + { + this.textures = textures; + this.font = font; + + Shadow = false; + UseFullGlyphHeight = false; + } + + protected override Texture GetTextureForCharacter(char c) + { + string textureName = $"{font}-{c}"; + + float ratio = 36; + + var texture = textures.Get($"{textureName}@2x"); + if (texture == null) + { + ratio = 18; + texture = textures.Get(textureName); + } + + if (texture != null) + texture.ScaleAdjust = ratio; + + return texture; + } + } } } diff --git a/osu.Game/Skinning/SkinnableDrawable.cs b/osu.Game/Skinning/SkinnableDrawable.cs index a40c3da82d..9ecd9e647a 100644 --- a/osu.Game/Skinning/SkinnableDrawable.cs +++ b/osu.Game/Skinning/SkinnableDrawable.cs @@ -18,6 +18,8 @@ namespace osu.Game.Skinning public class SkinnableDrawable : SkinReloadableDrawable where T : Drawable { + protected Drawable Drawable { get; private set; } + private readonly Func createDefault; private readonly string componentName; @@ -31,7 +33,8 @@ namespace osu.Game.Skinning /// A function to create the default skin implementation of this element. /// A conditional to decide whether to allow fallback to the default implementation if a skinned element is not present. /// Whether a user-skin drawable should be limited to the size of our parent. - public SkinnableDrawable(string name, Func defaultImplementation, Func allowFallback = null, bool restrictSize = true) : base(allowFallback) + public SkinnableDrawable(string name, Func defaultImplementation, Func allowFallback = null, bool restrictSize = true) + : base(allowFallback) { componentName = name; createDefault = defaultImplementation; @@ -42,26 +45,28 @@ namespace osu.Game.Skinning protected override void SkinChanged(ISkinSource skin, bool allowFallback) { - var drawable = skin.GetDrawableComponent(componentName); - if (drawable != null) + Drawable = null; + Drawable = skin.GetDrawableComponent(componentName); + + if (Drawable != null) { if (restrictSize) { - drawable.RelativeSizeAxes = Axes.Both; - drawable.Size = Vector2.One; - drawable.Scale = Vector2.One; - drawable.FillMode = FillMode.Fit; + Drawable.RelativeSizeAxes = Axes.Both; + Drawable.Size = Vector2.One; + Drawable.Scale = Vector2.One; + Drawable.FillMode = FillMode.Fit; } } else if (allowFallback) - drawable = createDefault(componentName); + Drawable = createDefault(componentName); - if (drawable != null) + if (Drawable != null) { - drawable.Origin = Anchor.Centre; - drawable.Anchor = Anchor.Centre; + Drawable.Origin = Anchor.Centre; + Drawable.Anchor = Anchor.Centre; - InternalChild = drawable; + InternalChild = Drawable; } else ClearInternal(); diff --git a/osu.Game/Skinning/SkinnableSpriteText.cs b/osu.Game/Skinning/SkinnableSpriteText.cs new file mode 100644 index 0000000000..8b09417bed --- /dev/null +++ b/osu.Game/Skinning/SkinnableSpriteText.cs @@ -0,0 +1,40 @@ +// Copyright (c) 2007-2018 ppy Pty Ltd . +// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE + +using System; +using osu.Framework.Graphics.Sprites; + +namespace osu.Game.Skinning +{ + public class SkinnableSpriteText : SkinnableDrawable, IHasText + { + public SkinnableSpriteText(string name, Func defaultImplementation, Func allowFallback = null, bool restrictSize = true) + : base(name, defaultImplementation, allowFallback, restrictSize) + { + } + + protected override void SkinChanged(ISkinSource skin, bool allowFallback) + { + base.SkinChanged(skin, allowFallback); + + if (Drawable is IHasText textDrawable) + textDrawable.Text = Text; + } + + private string text; + + public string Text + { + get => text; + set + { + if (text == value) + return; + text = value; + + if (Drawable is IHasText textDrawable) + textDrawable.Text = value; + } + } + } +} From 8191f03503b5ee06bcb1e64345c643a52de9db3a Mon Sep 17 00:00:00 2001 From: smoogipoo Date: Thu, 27 Sep 2018 17:27:24 +0900 Subject: [PATCH 166/417] Implement HitCircleFont skin configuration --- osu.Game/Skinning/LegacySkin.cs | 3 +-- osu.Game/Skinning/LegacySkinDecoder.cs | 15 +++++++++++++++ osu.Game/Skinning/SkinConfiguration.cs | 2 ++ 3 files changed, 18 insertions(+), 2 deletions(-) diff --git a/osu.Game/Skinning/LegacySkin.cs b/osu.Game/Skinning/LegacySkin.cs index 160cc412b4..bb37531c3e 100644 --- a/osu.Game/Skinning/LegacySkin.cs +++ b/osu.Game/Skinning/LegacySkin.cs @@ -57,8 +57,7 @@ namespace osu.Game.Skinning componentName = "hit300"; break; case "Play/osu/number-text": - // Todo: Not necessarily default font - return hasFont("default") ? new LegacySpriteText(Textures, "default") : null; + return hasFont(Configuration.HitCircleFont) ? new LegacySpriteText(Textures, Configuration.HitCircleFont) : null; } var texture = GetTexture(componentName); diff --git a/osu.Game/Skinning/LegacySkinDecoder.cs b/osu.Game/Skinning/LegacySkinDecoder.cs index d4f1c5c6f1..67a031fb50 100644 --- a/osu.Game/Skinning/LegacySkinDecoder.cs +++ b/osu.Game/Skinning/LegacySkinDecoder.cs @@ -19,6 +19,7 @@ namespace osu.Game.Skinning switch (section) { case Section.General: + { var pair = SplitKeyVal(line); switch (pair.Key) @@ -32,6 +33,20 @@ namespace osu.Game.Skinning } break; + } + case Section.Fonts: + { + var pair = SplitKeyVal(line); + + switch (pair.Key) + { + case "HitCirclePrefix": + skin.HitCircleFont = pair.Value; + break; + } + + break; + } } base.ParseLine(skin, section, line); diff --git a/osu.Game/Skinning/SkinConfiguration.cs b/osu.Game/Skinning/SkinConfiguration.cs index ac59fcc7db..40f5c158cc 100644 --- a/osu.Game/Skinning/SkinConfiguration.cs +++ b/osu.Game/Skinning/SkinConfiguration.cs @@ -14,5 +14,7 @@ namespace osu.Game.Skinning public List ComboColours { get; set; } = new List(); public Dictionary CustomColours { get; set; } = new Dictionary(); + + public string HitCircleFont { get; set; } = "default"; } } From 1c242556ca73c5d3044c713d3138242a2bb049ea Mon Sep 17 00:00:00 2001 From: smoogipoo Date: Thu, 27 Sep 2018 17:33:27 +0900 Subject: [PATCH 167/417] Add comments + cleanup --- osu.Game/Skinning/LegacySkin.cs | 1 + osu.Game/Skinning/SkinnableDrawable.cs | 4 +++- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/osu.Game/Skinning/LegacySkin.cs b/osu.Game/Skinning/LegacySkin.cs index bb37531c3e..67a498730a 100644 --- a/osu.Game/Skinning/LegacySkin.cs +++ b/osu.Game/Skinning/LegacySkin.cs @@ -170,6 +170,7 @@ namespace osu.Game.Skinning { string textureName = $"{font}-{c}"; + // Approximate value that brings character sizing roughly in-line with stable float ratio = 36; var texture = textures.Get($"{textureName}@2x"); diff --git a/osu.Game/Skinning/SkinnableDrawable.cs b/osu.Game/Skinning/SkinnableDrawable.cs index 9ecd9e647a..5195daee65 100644 --- a/osu.Game/Skinning/SkinnableDrawable.cs +++ b/osu.Game/Skinning/SkinnableDrawable.cs @@ -18,6 +18,9 @@ namespace osu.Game.Skinning public class SkinnableDrawable : SkinReloadableDrawable where T : Drawable { + /// + /// The displayed component. May or may not be a type- member. + /// protected Drawable Drawable { get; private set; } private readonly Func createDefault; @@ -45,7 +48,6 @@ namespace osu.Game.Skinning protected override void SkinChanged(ISkinSource skin, bool allowFallback) { - Drawable = null; Drawable = skin.GetDrawableComponent(componentName); if (Drawable != null) From f0b1aa7edf9fe75ecf220e143f09e58e2df543ec Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Thu, 27 Sep 2018 20:04:22 +0900 Subject: [PATCH 168/417] Fix unnecessary messages retrieval --- osu.Game/Overlays/ChatOverlay.cs | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/osu.Game/Overlays/ChatOverlay.cs b/osu.Game/Overlays/ChatOverlay.cs index 774570a747..98d8fb6322 100644 --- a/osu.Game/Overlays/ChatOverlay.cs +++ b/osu.Game/Overlays/ChatOverlay.cs @@ -449,13 +449,15 @@ namespace osu.Game.Overlays fetchReq.Success += updates => { - // fuck the what. if (updates?.Presence != null) { foreach (var channel in updates.Presence) { - channel.Joined.Value = true; - addChannel(channel); + if (careChannels.Find(c => c.Id == channel.Id) == null) + { + channel.Joined.Value = true; + addChannel(channel); + } } foreach (var group in updates.Messages.Where(m => m.TargetType == TargetType.Channel).GroupBy(m => m.TargetId)) @@ -464,13 +466,11 @@ namespace osu.Game.Overlays lastMessageId = updates.Messages.LastOrDefault()?.Id ?? lastMessageId; } - Debug.Write("success!"); fetchReq = null; }; fetchReq.Failure += delegate { - Debug.Write("failure!"); fetchReq = null; }; From 6a763334a188457d627edfe6dcba7aae3023869c Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Fri, 28 Sep 2018 10:00:40 +0900 Subject: [PATCH 169/417] Exit early as safety when no messages are received --- osu.Game/Online/Chat/Channel.cs | 2 ++ 1 file changed, 2 insertions(+) diff --git a/osu.Game/Online/Chat/Channel.cs b/osu.Game/Online/Chat/Channel.cs index 01560dd1fd..bbe74fcac0 100644 --- a/osu.Game/Online/Chat/Channel.cs +++ b/osu.Game/Online/Chat/Channel.cs @@ -60,6 +60,8 @@ namespace osu.Game.Online.Chat { messages = messages.Except(Messages).ToArray(); + if (messages.Length == 0) return; + Messages.AddRange(messages); MessagesLoaded = true; From d5d8a28b53890ee8a9dc7eef346d2af859214139 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Fri, 28 Sep 2018 10:01:25 +0900 Subject: [PATCH 170/417] Add explanatory comment about startup channel joins --- osu.Game/Overlays/ChatOverlay.cs | 2 ++ 1 file changed, 2 insertions(+) diff --git a/osu.Game/Overlays/ChatOverlay.cs b/osu.Game/Overlays/ChatOverlay.cs index 98d8fb6322..107ab11f34 100644 --- a/osu.Game/Overlays/ChatOverlay.cs +++ b/osu.Game/Overlays/ChatOverlay.cs @@ -304,6 +304,8 @@ namespace osu.Game.Overlays Scheduler.Add(delegate { + //todo: decide how to handle default channels for a user now that they are saved server-side. + // we likely don't want to re-join every startup like this. //addChannel(channels.Find(c => c.Name == @"#lazer")); //addChannel(channels.Find(c => c.Name == @"#osu")); //addChannel(channels.Find(c => c.Name == @"#lobby")); From 3539874262e7d512206f057b4d0a55d1af023973 Mon Sep 17 00:00:00 2001 From: smoogipoo Date: Fri, 28 Sep 2018 11:01:53 +0900 Subject: [PATCH 171/417] Add missing scale Makes about a 1px difference. --- osu.Game/Skinning/LegacySkin.cs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/osu.Game/Skinning/LegacySkin.cs b/osu.Game/Skinning/LegacySkin.cs index 67a498730a..bd7ca22fa1 100644 --- a/osu.Game/Skinning/LegacySkin.cs +++ b/osu.Game/Skinning/LegacySkin.cs @@ -13,6 +13,7 @@ using osu.Framework.Graphics.Textures; using osu.Framework.IO.Stores; using osu.Game.Database; using osu.Game.Graphics.Sprites; +using OpenTK; namespace osu.Game.Skinning { @@ -57,7 +58,7 @@ namespace osu.Game.Skinning componentName = "hit300"; break; case "Play/osu/number-text": - return hasFont(Configuration.HitCircleFont) ? new LegacySpriteText(Textures, Configuration.HitCircleFont) : null; + return !hasFont(Configuration.HitCircleFont) ? null : new LegacySpriteText(Textures, Configuration.HitCircleFont) { Scale = new Vector2(0.96f) }; } var texture = GetTexture(componentName); From 3479bfa409d8c05f7445d9fb8708df5d6e40a13a Mon Sep 17 00:00:00 2001 From: smoogipoo Date: Fri, 28 Sep 2018 17:18:34 +0900 Subject: [PATCH 172/417] Rename variable --- osu.Game.Rulesets.Taiko/Objects/Drawables/DrawableHit.cs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/osu.Game.Rulesets.Taiko/Objects/Drawables/DrawableHit.cs b/osu.Game.Rulesets.Taiko/Objects/Drawables/DrawableHit.cs index 86c6a56685..6f7264e23b 100644 --- a/osu.Game.Rulesets.Taiko/Objects/Drawables/DrawableHit.cs +++ b/osu.Game.Rulesets.Taiko/Objects/Drawables/DrawableHit.cs @@ -24,7 +24,7 @@ namespace osu.Game.Rulesets.Taiko.Objects.Drawables private bool validActionPressed; - private bool handleExtraPress; + private bool pressHandledThisFrame; protected DrawableHit(Hit hit) : base(hit) @@ -53,7 +53,7 @@ namespace osu.Game.Rulesets.Taiko.Objects.Drawables public override bool OnPressed(TaikoAction action) { - if (handleExtraPress) + if (pressHandledThisFrame) return true; if (Judged) @@ -69,7 +69,7 @@ namespace osu.Game.Rulesets.Taiko.Objects.Drawables // Regardless of whether we've hit or not, any secondary key presses in the same frame should be discarded // E.g. hitting a non-strong centre as a strong should not fall through and perform a hit on the next note - handleExtraPress = true; + pressHandledThisFrame = true; return result; } @@ -87,7 +87,7 @@ namespace osu.Game.Rulesets.Taiko.Objects.Drawables // The input manager processes all input prior to us updating, so this is the perfect time // for us to remove the extra press blocking, before input is handled in the next frame - handleExtraPress = false; + pressHandledThisFrame = false; Size = BaseSize * Parent.RelativeChildSize; } From 9baf5872460497bb0b3efac8b6be4db4c2b3d39e Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Fri, 28 Sep 2018 18:25:40 +0900 Subject: [PATCH 173/417] Bump framework again --- osu.Game/osu.Game.csproj | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu.Game/osu.Game.csproj b/osu.Game/osu.Game.csproj index 1b8dfcb9e0..8fb42c0cea 100644 --- a/osu.Game/osu.Game.csproj +++ b/osu.Game/osu.Game.csproj @@ -18,7 +18,7 @@ - + From d3eb24e70a2861cbfbe3f5d3759bf67f1cb23628 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Fri, 28 Sep 2018 18:29:49 +0900 Subject: [PATCH 174/417] Fix score retrieval no longer working --- osu.Game/Rulesets/Scoring/Score.cs | 2 ++ 1 file changed, 2 insertions(+) diff --git a/osu.Game/Rulesets/Scoring/Score.cs b/osu.Game/Rulesets/Scoring/Score.cs index dfe7ff0195..02f528791a 100644 --- a/osu.Game/Rulesets/Scoring/Score.cs +++ b/osu.Game/Rulesets/Scoring/Score.cs @@ -3,6 +3,7 @@ using System; using System.Collections.Generic; +using Newtonsoft.Json; using osu.Game.Beatmaps; using osu.Game.Rulesets.Mods; using osu.Game.Users; @@ -32,6 +33,7 @@ namespace osu.Game.Rulesets.Scoring public User User; + [JsonIgnore] public Replay Replay; public BeatmapInfo Beatmap; From 3cacc11af139184b27d5bbee0abd90b630ac1eb9 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Fri, 28 Sep 2018 19:33:19 +0900 Subject: [PATCH 175/417] Fix outdated API variable --- osu.Game/Online/API/Requests/PostMessageRequest.cs | 2 +- osu.Game/Online/Chat/Message.cs | 7 ++----- osu.Game/Overlays/ChatOverlay.cs | 5 ++--- 3 files changed, 5 insertions(+), 9 deletions(-) diff --git a/osu.Game/Online/API/Requests/PostMessageRequest.cs b/osu.Game/Online/API/Requests/PostMessageRequest.cs index 188d6ada34..8d9ba5dd5d 100644 --- a/osu.Game/Online/API/Requests/PostMessageRequest.cs +++ b/osu.Game/Online/API/Requests/PostMessageRequest.cs @@ -27,6 +27,6 @@ namespace osu.Game.Online.API.Requests return req; } - protected override string Target => $@"chat/channels/{message.TargetId}/messages"; + protected override string Target => $@"chat/channels/{message.ChannelId}/messages"; } } diff --git a/osu.Game/Online/Chat/Message.cs b/osu.Game/Online/Chat/Message.cs index 535035e4fc..65e0415cd3 100644 --- a/osu.Game/Online/Chat/Message.cs +++ b/osu.Game/Online/Chat/Message.cs @@ -18,11 +18,8 @@ namespace osu.Game.Online.Chat [JsonProperty(@"sender_id")] public int UserId; - [JsonProperty(@"target_type")] - public TargetType TargetType; - - [JsonProperty(@"target_id")] - public int TargetId; + [JsonProperty(@"channel_id")] + public int ChannelId; [JsonProperty(@"is_action")] public bool IsAction; diff --git a/osu.Game/Overlays/ChatOverlay.cs b/osu.Game/Overlays/ChatOverlay.cs index d9bb4eb12b..74eac166e2 100644 --- a/osu.Game/Overlays/ChatOverlay.cs +++ b/osu.Game/Overlays/ChatOverlay.cs @@ -462,7 +462,7 @@ namespace osu.Game.Overlays } } - foreach (var group in updates.Messages.Where(m => m.TargetType == TargetType.Channel).GroupBy(m => m.TargetId)) + foreach (var group in updates.Messages.GroupBy(m => m.ChannelId)) careChannels.Find(c => c.Id == group.Key)?.AddNewMessages(group.ToArray()); lastMessageId = updates.Messages.LastOrDefault()?.Id ?? lastMessageId; @@ -534,8 +534,7 @@ namespace osu.Game.Overlays { Sender = api.LocalUser.Value, Timestamp = DateTimeOffset.Now, - TargetType = TargetType.Channel, //TODO: read this from channel - TargetId = target.Id, + ChannelId = target.Id, IsAction = isAction, Content = postText }; From 862d3c4a6900ddd5648976c2c619200ed962fc2c Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Fri, 28 Sep 2018 19:33:35 +0900 Subject: [PATCH 176/417] Add back autojoins --- osu.Game/Overlays/ChatOverlay.cs | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/osu.Game/Overlays/ChatOverlay.cs b/osu.Game/Overlays/ChatOverlay.cs index 74eac166e2..dcf5b74d08 100644 --- a/osu.Game/Overlays/ChatOverlay.cs +++ b/osu.Game/Overlays/ChatOverlay.cs @@ -305,10 +305,8 @@ namespace osu.Game.Overlays Scheduler.Add(delegate { //todo: decide how to handle default channels for a user now that they are saved server-side. - // we likely don't want to re-join every startup like this. - //addChannel(channels.Find(c => c.Name == @"#lazer")); - //addChannel(channels.Find(c => c.Name == @"#osu")); - //addChannel(channels.Find(c => c.Name == @"#lobby")); + addChannel(channels.Find(c => c.Name == @"#lazer")); + addChannel(channels.Find(c => c.Name == @"#osu")); channelSelection.OnRequestJoin = addChannel; channelSelection.OnRequestLeave = removeChannel; From 1fe5ed5524190bb7bb542de5525691cd7a17a5e3 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Sat, 29 Sep 2018 01:59:16 +0900 Subject: [PATCH 177/417] Update signing certificate --- appveyor_deploy.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/appveyor_deploy.yml b/appveyor_deploy.yml index 6d8d95e773..22a4859885 100644 --- a/appveyor_deploy.yml +++ b/appveyor_deploy.yml @@ -10,8 +10,8 @@ before_build: - cmd: nuget restore -verbosity quiet build_script: - ps: iex ((New-Object Net.WebClient).DownloadString('https://raw.githubusercontent.com/appveyor/secure-file/master/install.ps1')) - - appveyor DownloadFile https://puu.sh/A6g5K/4d08705438.enc # signing certificate - - cmd: appveyor-tools\secure-file -decrypt 4d08705438.enc -secret %decode_secret% -out %HOMEPATH%\deanherbert.pfx + - appveyor DownloadFile https://puu.sh/BCrS8/7faccf7876.enc # signing certificate + - cmd: appveyor-tools\secure-file -decrypt 7faccf7876.enc -secret %decode_secret% -out %HOMEPATH%\deanherbert.pfx - appveyor DownloadFile https://puu.sh/A6g75/fdc6f19b04.enc # deploy configuration - cd osu-deploy - nuget restore -verbosity quiet From 88b0c234cc370f536e81e21c3d3b7566e6f1075e Mon Sep 17 00:00:00 2001 From: Kyle Chang Date: Fri, 28 Sep 2018 23:27:25 -0400 Subject: [PATCH 178/417] Move judgement text to internal container --- .../UI/DrawableManiaJudgement.cs | 7 ++-- .../UI/DrawableTaikoJudgement.cs | 4 +- .../Rulesets/Judgements/DrawableJudgement.cs | 41 +++++++++++-------- 3 files changed, 29 insertions(+), 23 deletions(-) diff --git a/osu.Game.Rulesets.Mania/UI/DrawableManiaJudgement.cs b/osu.Game.Rulesets.Mania/UI/DrawableManiaJudgement.cs index dc66249cd9..f78cfefab8 100644 --- a/osu.Game.Rulesets.Mania/UI/DrawableManiaJudgement.cs +++ b/osu.Game.Rulesets.Mania/UI/DrawableManiaJudgement.cs @@ -30,10 +30,11 @@ namespace osu.Game.Rulesets.Mania.UI if (Result.IsHit) { - this.ScaleTo(0.8f); - this.ScaleTo(1, 250, Easing.OutElastic); + JudgementBody.ScaleTo(0.8f); + JudgementBody.ScaleTo(1, 250, Easing.OutElastic); - this.Delay(50).FadeOut(200).ScaleTo(0.75f, 250); + JudgementBody.Delay(50).ScaleTo(0.75f, 250); + this.Delay(50).FadeOut(200); } Expire(); diff --git a/osu.Game.Rulesets.Taiko/UI/DrawableTaikoJudgement.cs b/osu.Game.Rulesets.Taiko/UI/DrawableTaikoJudgement.cs index 4d660918b8..c7eba91564 100644 --- a/osu.Game.Rulesets.Taiko/UI/DrawableTaikoJudgement.cs +++ b/osu.Game.Rulesets.Taiko/UI/DrawableTaikoJudgement.cs @@ -31,10 +31,10 @@ namespace osu.Game.Rulesets.Taiko.UI switch (Result.Type) { case HitResult.Good: - Colour = colours.GreenLight; + JudgementBody.Colour = colours.GreenLight; break; case HitResult.Great: - Colour = colours.BlueLight; + JudgementBody.Colour = colours.BlueLight; break; } } diff --git a/osu.Game/Rulesets/Judgements/DrawableJudgement.cs b/osu.Game/Rulesets/Judgements/DrawableJudgement.cs index c2a52e5794..fc006b4b36 100644 --- a/osu.Game/Rulesets/Judgements/DrawableJudgement.cs +++ b/osu.Game/Rulesets/Judgements/DrawableJudgement.cs @@ -19,7 +19,7 @@ namespace osu.Game.Rulesets.Judgements /// /// A drawable object which visualises the hit result of a . /// - public class DrawableJudgement : Container + public class DrawableJudgement : CompositeDrawable { private const float judgement_size = 80; @@ -29,6 +29,7 @@ namespace osu.Game.Rulesets.Judgements public readonly DrawableHitObject JudgedObject; + protected Container JudgementBody; protected SpriteText JudgementText; /// @@ -49,14 +50,20 @@ namespace osu.Game.Rulesets.Judgements { this.colours = colours; - Child = new SkinnableDrawable($"Play/{Result.Type}", _ => JudgementText = new OsuSpriteText + InternalChild = JudgementBody = new Container { - Text = Result.Type.GetDescription().ToUpperInvariant(), - Font = @"Venera", - Colour = judgementColour(Result.Type), - Scale = new Vector2(0.85f, 1), - TextSize = 12 - }, restrictSize: false); + Anchor = Anchor.Centre, + Origin = Anchor.Centre, + + Child = new SkinnableDrawable($"Play/{Result.Type}", _ => JudgementText = new OsuSpriteText + { + Text = Result.Type.GetDescription().ToUpperInvariant(), + Font = @"Venera", + Colour = judgementColour(Result.Type), + Scale = new Vector2(0.85f, 1), + TextSize = 12 + }, restrictSize: false) + }; } protected override void LoadComplete() @@ -65,24 +72,22 @@ namespace osu.Game.Rulesets.Judgements this.FadeInFromZero(100, Easing.OutQuint); - var origScale = Scale; - switch (Result.Type) { case HitResult.None: break; case HitResult.Miss: - this.ScaleTo(origScale * 1.6f); - this.ScaleTo(origScale, 100, Easing.In); + JudgementBody.ScaleTo(1.6f); + JudgementBody.ScaleTo(1, 100, Easing.In); - this.MoveToOffset(new Vector2(0, 100), 800, Easing.InQuint); - this.RotateTo(40, 800, Easing.InQuint); + JudgementBody.MoveToOffset(new Vector2(0, 100), 800, Easing.InQuint); + JudgementBody.RotateTo(40, 800, Easing.InQuint); this.Delay(600).FadeOut(200); break; default: - this.ScaleTo(origScale * 0.9f); - this.ScaleTo(origScale, 500, Easing.OutElastic); + JudgementBody.ScaleTo(0.9f); + JudgementBody.ScaleTo(1, 500, Easing.OutElastic); this.Delay(100).FadeOut(400); break; @@ -105,9 +110,9 @@ namespace osu.Game.Rulesets.Judgements return colours.Yellow; case HitResult.Miss: return colours.Red; + default: + return Color4.White; } - - return Color4.White; } } } From 08f58047c2182e49c6794d30d12bc60107dd9832 Mon Sep 17 00:00:00 2001 From: Hanamuke Date: Sun, 30 Sep 2018 16:08:17 +0200 Subject: [PATCH 179/417] Remade measurements, turns out the correction was not needed --- osu.Game.Rulesets.Catch/UI/CatchPlayfield.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu.Game.Rulesets.Catch/UI/CatchPlayfield.cs b/osu.Game.Rulesets.Catch/UI/CatchPlayfield.cs index a65079c590..970dc2d630 100644 --- a/osu.Game.Rulesets.Catch/UI/CatchPlayfield.cs +++ b/osu.Game.Rulesets.Catch/UI/CatchPlayfield.cs @@ -59,7 +59,7 @@ namespace osu.Game.Rulesets.Catch.UI }, }); - VisibleTimeRange.Value = BeatmapDifficulty.DifficultyRange(difficulty.ApproachRate, 1800, 1200, 450) / 1.2; + VisibleTimeRange.Value = BeatmapDifficulty.DifficultyRange(difficulty.ApproachRate, 1800, 1200, 450); } public bool CheckIfWeCanCatch(CatchHitObject obj) => catcherArea.AttemptCatch(obj); From b68eeae777858fbc14670386615abc9790174074 Mon Sep 17 00:00:00 2001 From: smoogipoo Date: Mon, 1 Oct 2018 18:12:26 +0900 Subject: [PATCH 180/417] Fix scrolling rulesets not accounting for slider multiplier --- .../Rulesets/Timing/MultiplierControlPoint.cs | 21 +++++++------------ .../UI/Scrolling/ScrollingRulesetContainer.cs | 20 ++---------------- 2 files changed, 9 insertions(+), 32 deletions(-) diff --git a/osu.Game/Rulesets/Timing/MultiplierControlPoint.cs b/osu.Game/Rulesets/Timing/MultiplierControlPoint.cs index a5bd6bfde7..4988bac5ce 100644 --- a/osu.Game/Rulesets/Timing/MultiplierControlPoint.cs +++ b/osu.Game/Rulesets/Timing/MultiplierControlPoint.cs @@ -18,9 +18,14 @@ namespace osu.Game.Rulesets.Timing public double StartTime; /// - /// The multiplier which this provides. + /// The aggregate multiplier which this provides. /// - public double Multiplier => 1000 / TimingPoint.BeatLength * DifficultyPoint.SpeedMultiplier; + public double Multiplier => Velocity * DifficultyPoint.SpeedMultiplier * 1000 / TimingPoint.BeatLength; + + /// + /// The velocity multiplier. + /// + public double Velocity = 1; /// /// The that provides the timing information for this . @@ -48,18 +53,6 @@ namespace osu.Game.Rulesets.Timing StartTime = startTime; } - /// - /// Creates a by copying another . - /// - /// The start time of this . - /// The to copy. - public MultiplierControlPoint(double startTime, MultiplierControlPoint other) - : this(startTime) - { - TimingPoint = other.TimingPoint; - DifficultyPoint = other.DifficultyPoint; - } - // ReSharper disable once ImpureMethodCallOnReadonlyValueField public int CompareTo(MultiplierControlPoint other) => StartTime.CompareTo(other?.StartTime); } diff --git a/osu.Game/Rulesets/UI/Scrolling/ScrollingRulesetContainer.cs b/osu.Game/Rulesets/UI/Scrolling/ScrollingRulesetContainer.cs index 3fc67e4e34..41cdd6c06f 100644 --- a/osu.Game/Rulesets/UI/Scrolling/ScrollingRulesetContainer.cs +++ b/osu.Game/Rulesets/UI/Scrolling/ScrollingRulesetContainer.cs @@ -60,6 +60,7 @@ namespace osu.Game.Rulesets.UI.Scrolling return new MultiplierControlPoint(c.Time) { + Velocity = Beatmap.BeatmapInfo.BaseDifficulty.SliderMultiplier, TimingPoint = lastTimingPoint, DifficultyPoint = lastDifficultyPoint }; @@ -78,7 +79,7 @@ namespace osu.Game.Rulesets.UI.Scrolling // If we have no control points, add a default one if (DefaultControlPoints.Count == 0) - DefaultControlPoints.Add(new MultiplierControlPoint()); + DefaultControlPoints.Add(new MultiplierControlPoint { Velocity = Beatmap.BeatmapInfo.BaseDifficulty.SliderMultiplier }); DefaultControlPoints.ForEach(c => applySpeedAdjustment(c, Playfield)); } @@ -88,22 +89,5 @@ namespace osu.Game.Rulesets.UI.Scrolling playfield.HitObjects.AddControlPoint(controlPoint); playfield.NestedPlayfields?.OfType().ForEach(p => applySpeedAdjustment(controlPoint, p)); } - - /// - /// Generates a with the default timing change/difficulty change from the beatmap at a time. - /// - /// The time to create the control point at. - /// The default at . - public MultiplierControlPoint CreateControlPointAt(double time) - { - if (DefaultControlPoints.Count == 0) - return new MultiplierControlPoint(time); - - int index = DefaultControlPoints.BinarySearch(new MultiplierControlPoint(time)); - if (index < 0) - return new MultiplierControlPoint(time); - - return new MultiplierControlPoint(time, DefaultControlPoints[index]); - } } } From 08bd36382750a65959608230cdd51dcb84731936 Mon Sep 17 00:00:00 2001 From: smoogipoo Date: Mon, 1 Oct 2018 18:15:55 +0900 Subject: [PATCH 181/417] Adjust taiko scrolling speed --- osu.Game.Rulesets.Taiko/UI/TaikoPlayfield.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu.Game.Rulesets.Taiko/UI/TaikoPlayfield.cs b/osu.Game.Rulesets.Taiko/UI/TaikoPlayfield.cs index 325beb38a5..cb927bf15a 100644 --- a/osu.Game.Rulesets.Taiko/UI/TaikoPlayfield.cs +++ b/osu.Game.Rulesets.Taiko/UI/TaikoPlayfield.cs @@ -194,7 +194,7 @@ namespace osu.Game.Rulesets.Taiko.UI } }); - VisibleTimeRange.Value = 6000; + VisibleTimeRange.Value = 7000; } [BackgroundDependencyLoader] From 4af885f6b1b4a28b91c6fa115e8f1718b2041c97 Mon Sep 17 00:00:00 2001 From: smoogipoo Date: Mon, 1 Oct 2018 18:30:52 +0900 Subject: [PATCH 182/417] Adjust default mania speed to match stable --- osu.Game.Rulesets.Mania/Configuration/ManiaConfigManager.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu.Game.Rulesets.Mania/Configuration/ManiaConfigManager.cs b/osu.Game.Rulesets.Mania/Configuration/ManiaConfigManager.cs index 3e9c9feba1..1c9e1e4c73 100644 --- a/osu.Game.Rulesets.Mania/Configuration/ManiaConfigManager.cs +++ b/osu.Game.Rulesets.Mania/Configuration/ManiaConfigManager.cs @@ -19,7 +19,7 @@ namespace osu.Game.Rulesets.Mania.Configuration { base.InitialiseDefaults(); - Set(ManiaSetting.ScrollTime, 1500.0, 50.0, 10000.0, 50.0); + Set(ManiaSetting.ScrollTime, 2250.0, 50.0, 10000.0, 50.0); Set(ManiaSetting.ScrollDirection, ManiaScrollingDirection.Down); } From 6c55efdf2030f0c9e9ea53d15f11ae7f81cbd0cb Mon Sep 17 00:00:00 2001 From: AtomCrafty Date: Mon, 1 Oct 2018 13:12:34 +0200 Subject: [PATCH 183/417] Add true to BindValueChanged call to hide resolution dropdown when starting in windowed mode --- osu.Game/Overlays/Settings/Sections/Graphics/LayoutSettings.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu.Game/Overlays/Settings/Sections/Graphics/LayoutSettings.cs b/osu.Game/Overlays/Settings/Sections/Graphics/LayoutSettings.cs index df9370d0d8..254de6c6f7 100644 --- a/osu.Game/Overlays/Settings/Sections/Graphics/LayoutSettings.cs +++ b/osu.Game/Overlays/Settings/Sections/Graphics/LayoutSettings.cs @@ -102,7 +102,7 @@ namespace osu.Game.Overlays.Settings.Sections.Graphics } else resolutionDropdown.Hide(); - }); + }, true); } letterboxing.BindValueChanged(isVisible => From 87d8945af915b851ab6add3cc4428296d92e41a0 Mon Sep 17 00:00:00 2001 From: Dan Balasescu <1329837+smoogipoo@users.noreply.github.com> Date: Tue, 2 Oct 2018 09:33:31 +0900 Subject: [PATCH 184/417] Give the body a size --- osu.Game/Rulesets/Judgements/DrawableJudgement.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu.Game/Rulesets/Judgements/DrawableJudgement.cs b/osu.Game/Rulesets/Judgements/DrawableJudgement.cs index fc006b4b36..e8e775a20d 100644 --- a/osu.Game/Rulesets/Judgements/DrawableJudgement.cs +++ b/osu.Game/Rulesets/Judgements/DrawableJudgement.cs @@ -54,7 +54,7 @@ namespace osu.Game.Rulesets.Judgements { Anchor = Anchor.Centre, Origin = Anchor.Centre, - + RelativeSizeAxes = Axes.Both, Child = new SkinnableDrawable($"Play/{Result.Type}", _ => JudgementText = new OsuSpriteText { Text = Result.Type.GetDescription().ToUpperInvariant(), From 97c585c54cde6cac63fb1a9aa205cf45479e9593 Mon Sep 17 00:00:00 2001 From: smoogipoo Date: Tue, 2 Oct 2018 10:12:07 +0900 Subject: [PATCH 185/417] Fix cursor not hiding in screenshots --- osu.Game/OsuGame.cs | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/osu.Game/OsuGame.cs b/osu.Game/OsuGame.cs index 8610a8d74d..b75a37e9df 100644 --- a/osu.Game/OsuGame.cs +++ b/osu.Game/OsuGame.cs @@ -65,7 +65,8 @@ namespace osu.Game private BeatmapSetOverlay beatmapSetOverlay; - private ScreenshotManager screenshotManager; + [Cached] + private readonly ScreenshotManager screenshotManager = new ScreenshotManager(); protected RavenLogger RavenLogger; @@ -289,9 +290,6 @@ namespace osu.Game protected override void LoadComplete() { - // this needs to be cached before base.LoadComplete as it is used by MenuCursorContainer. - dependencies.Cache(screenshotManager = new ScreenshotManager()); - base.LoadComplete(); // The next time this is updated is in UpdateAfterChildren, which occurs too late and results From 99fc04c8afac7aedc028026642b48626915db55a Mon Sep 17 00:00:00 2001 From: ekrctb Date: Tue, 2 Oct 2018 12:02:47 +0900 Subject: [PATCH 186/417] Change signature to new event handler --- .../Objects/Drawables/Pieces/SliderBall.cs | 16 +++--- .../Objects/Drawables/Pieces/SpinnerDisc.cs | 8 +-- osu.Game.Rulesets.Osu/OsuInputManager.cs | 16 +++--- .../UI/Cursor/CursorTrail.cs | 10 ++-- osu.Game.Tests/Visual/TestCaseCursors.cs | 8 +-- .../Containers/OsuFocusedOverlayContainer.cs | 6 +- .../Graphics/Containers/OsuHoverContainer.cs | 10 ++-- .../Graphics/Containers/OsuScrollContainer.cs | 22 ++++---- osu.Game/Graphics/Cursor/MenuCursor.cs | 25 ++++----- .../Graphics/UserInterface/DialogButton.cs | 14 ++--- .../UserInterface/ExternalLinkButton.cs | 12 ++-- .../Graphics/UserInterface/FocusedTextBox.cs | 13 ++--- .../UserInterface/HoverClickSounds.cs | 6 +- .../Graphics/UserInterface/HoverSounds.cs | 6 +- osu.Game/Graphics/UserInterface/IconButton.cs | 10 ++-- .../UserInterface/OsuAnimatedButton.cs | 23 ++++---- osu.Game/Graphics/UserInterface/OsuButton.cs | 19 +++---- .../Graphics/UserInterface/OsuCheckbox.cs | 10 ++-- osu.Game/Graphics/UserInterface/OsuMenu.cs | 14 ++--- .../UserInterface/OsuPasswordTextBox.cs | 17 +++--- .../Graphics/UserInterface/OsuSliderBar.cs | 19 +++---- .../Graphics/UserInterface/OsuTabControl.cs | 14 ++--- .../UserInterface/OsuTabControlCheckbox.cs | 10 ++-- osu.Game/Graphics/UserInterface/OsuTextBox.cs | 10 ++-- .../Graphics/UserInterface/PageTabControl.cs | 6 +- .../Graphics/UserInterface/SearchTextBox.cs | 13 ++--- .../Graphics/UserInterface/TwoLayerButton.cs | 13 ++--- osu.Game/Overlays/BeatmapSet/BeatmapPicker.cs | 18 +++--- .../BeatmapSet/Buttons/PreviewButton.cs | 10 ++-- .../BeatmapSet/Scores/ClickableUsername.cs | 4 +- .../BeatmapSet/Scores/DrawableScore.cs | 12 ++-- .../BeatmapSet/Scores/DrawableTopScore.cs | 10 ++-- osu.Game/Overlays/BeatmapSetOverlay.cs | 4 +- osu.Game/Overlays/Chat/ChannelListItem.cs | 8 +-- .../Overlays/Chat/ChannelSelectionOverlay.cs | 6 +- osu.Game/Overlays/Chat/ChatTabControl.cs | 27 +++++---- osu.Game/Overlays/ChatOverlay.cs | 20 +++---- osu.Game/Overlays/Dialog/PopupDialog.cs | 11 ++-- osu.Game/Overlays/Direct/DirectGridPanel.cs | 8 +-- osu.Game/Overlays/Direct/DirectPanel.cs | 12 ++-- osu.Game/Overlays/Direct/PlayButton.cs | 12 ++-- osu.Game/Overlays/KeyBinding/KeyBindingRow.cs | 56 +++++++++---------- osu.Game/Overlays/MainSettings.cs | 11 ++-- osu.Game/Overlays/MedalOverlay.cs | 9 ++- osu.Game/Overlays/Mods/ModButton.cs | 11 ++-- osu.Game/Overlays/Mods/ModSection.cs | 9 ++- osu.Game/Overlays/Music/PlaylistItem.cs | 19 +++---- osu.Game/Overlays/Music/PlaylistList.cs | 20 +++---- osu.Game/Overlays/MusicController.cs | 18 +++--- .../Overlays/Notifications/Notification.cs | 20 +++---- .../Overlays/Profile/Header/BadgeContainer.cs | 6 +- osu.Game/Overlays/Profile/Header/RankGraph.cs | 18 +++--- .../Profile/Sections/DrawableProfileRow.cs | 10 ++-- .../Profile/Sections/Kudosu/KudosuInfo.cs | 4 +- .../SearchableList/SearchableListOverlay.cs | 4 +- .../Sections/General/LoginSettings.cs | 12 ++-- .../Settings/Sections/Input/MouseSettings.cs | 10 ++-- osu.Game/Overlays/Settings/SettingsItem.cs | 13 ++--- osu.Game/Overlays/Settings/Sidebar.cs | 12 ++-- osu.Game/Overlays/Settings/SidebarButton.cs | 14 ++--- osu.Game/Overlays/SettingsOverlay.cs | 6 +- osu.Game/Overlays/Social/SocialPanel.cs | 10 ++-- osu.Game/Overlays/Toolbar/Toolbar.cs | 6 +- osu.Game/Overlays/Toolbar/ToolbarButton.cs | 15 +++-- .../Toolbar/ToolbarRulesetSelector.cs | 11 ++-- osu.Game/Overlays/Volume/MuteButton.cs | 8 +-- osu.Game/Overlays/Volume/VolumeMeter.cs | 10 ++-- osu.Game/Overlays/VolumeOverlay.cs | 12 ++-- osu.Game/Rulesets/Edit/HitObjectMask.cs | 16 +++--- osu.Game/Rulesets/UI/RulesetInputManager.cs | 12 ++-- osu.Game/Screens/BackgroundScreen.cs | 5 +- .../Edit/Components/PlaybackControl.cs | 6 +- .../Timelines/Summary/Parts/MarkerPart.cs | 13 ++--- osu.Game/Screens/Edit/Editor.cs | 6 +- osu.Game/Screens/Edit/Menus/EditorMenuBar.cs | 10 ++-- .../Screens/Compose/BeatDivisorControl.cs | 22 ++++---- .../Edit/Screens/Compose/Layers/DragLayer.cs | 12 ++-- .../Compose/Layers/HitObjectMaskLayer.cs | 5 +- .../RadioButtons/DrawableRadioButton.cs | 6 +- .../Edit/Screens/Compose/Timeline/Timeline.cs | 11 ++-- .../Timeline/ZoomableScrollContainer.cs | 10 ++-- osu.Game/Screens/Menu/Button.cs | 23 ++++---- osu.Game/Screens/Menu/MainMenu.cs | 9 ++- osu.Game/Screens/Menu/OsuLogo.cs | 17 +++--- .../Screens/Multi/Components/DrawableRoom.cs | 4 +- .../Screens/Multi/Screens/Lounge/Lounge.cs | 4 +- .../Screens/Multi/Screens/Match/Header.cs | 19 +++---- osu.Game/Screens/Play/GameplayMenuOverlay.cs | 27 +++++---- osu.Game/Screens/Play/HUD/ModDisplay.cs | 10 ++-- .../Screens/Play/HUD/PlayerSettingsOverlay.cs | 11 ++-- osu.Game/Screens/Play/HUD/QuitButton.cs | 20 +++---- osu.Game/Screens/Play/HUDOverlay.cs | 11 ++-- osu.Game/Screens/Play/KeyCounterKeyboard.cs | 15 +++-- osu.Game/Screens/Play/KeyCounterMouse.cs | 15 +++-- osu.Game/Screens/Play/Player.cs | 4 +- osu.Game/Screens/Play/PlayerLoader.cs | 10 ++-- .../PlayerSettings/PlayerSettingsGroup.cs | 11 ++-- osu.Game/Screens/Play/SkipOverlay.cs | 35 ++++++------ osu.Game/Screens/Select/BeatmapCarousel.cs | 9 ++- .../Carousel/DrawableCarouselBeatmap.cs | 6 +- .../Select/Carousel/DrawableCarouselItem.cs | 12 ++-- osu.Game/Screens/Select/FilterControl.cs | 9 ++- osu.Game/Screens/Select/Footer.cs | 7 +-- osu.Game/Screens/Select/FooterButton.cs | 25 ++++----- .../Select/Leaderboards/LeaderboardScore.cs | 10 ++-- .../RetrievalFailurePlaceholder.cs | 11 ++-- .../Select/Options/BeatmapOptionsButton.cs | 19 +++---- osu.Game/Screens/Select/SongSelect.cs | 15 +++-- osu.Game/Tests/Visual/EditorClockTestCase.cs | 6 +- osu.Game/osu.Game.csproj | 2 +- 110 files changed, 667 insertions(+), 709 deletions(-) diff --git a/osu.Game.Rulesets.Osu/Objects/Drawables/Pieces/SliderBall.cs b/osu.Game.Rulesets.Osu/Objects/Drawables/Pieces/SliderBall.cs index 1388b23fa8..c19bbc439d 100644 --- a/osu.Game.Rulesets.Osu/Objects/Drawables/Pieces/SliderBall.cs +++ b/osu.Game.Rulesets.Osu/Objects/Drawables/Pieces/SliderBall.cs @@ -5,7 +5,7 @@ using System.Linq; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Shapes; -using osu.Framework.Input.EventArgs; +using osu.Framework.Input.Events; using osu.Framework.Input.States; using osu.Game.Rulesets.Objects.Types; using OpenTK.Graphics; @@ -104,22 +104,22 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables.Pieces private InputState lastState; - protected override bool OnMouseDown(InputState state, MouseDownEventArgs args) + protected override bool OnMouseDown(MouseDownEvent e) { lastState = state; - return base.OnMouseDown(state, args); + return base.OnMouseDown(e); } - protected override bool OnMouseUp(InputState state, MouseUpEventArgs args) + protected override bool OnMouseUp(MouseUpEvent e) { lastState = state; - return base.OnMouseUp(state, args); + return base.OnMouseUp(e); } - protected override bool OnMouseMove(InputState state) + protected override bool OnMouseMove(MouseMoveEvent e) { - lastState = state; - return base.OnMouseMove(state); + lastState = e; + return base.OnMouseMove(e); } public override void ClearTransformsAfter(double time, bool propagateChildren = false, string targetMember = null) diff --git a/osu.Game.Rulesets.Osu/Objects/Drawables/Pieces/SpinnerDisc.cs b/osu.Game.Rulesets.Osu/Objects/Drawables/Pieces/SpinnerDisc.cs index 6e5bc5258b..7a577383ae 100644 --- a/osu.Game.Rulesets.Osu/Objects/Drawables/Pieces/SpinnerDisc.cs +++ b/osu.Game.Rulesets.Osu/Objects/Drawables/Pieces/SpinnerDisc.cs @@ -4,7 +4,7 @@ using System; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; -using osu.Framework.Input.States; +using osu.Framework.Input.Events; using osu.Game.Graphics; using OpenTK; using OpenTK.Graphics; @@ -68,10 +68,10 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables.Pieces } } - protected override bool OnMouseMove(InputState state) + protected override bool OnMouseMove(MouseMoveEvent e) { - mousePosition = Parent.ToLocalSpace(state.Mouse.NativeState.Position); - return base.OnMouseMove(state); + mousePosition = Parent.ToLocalSpace(e.Mouse.NativeState.Position); + return base.OnMouseMove(e); } private Vector2 mousePosition; diff --git a/osu.Game.Rulesets.Osu/OsuInputManager.cs b/osu.Game.Rulesets.Osu/OsuInputManager.cs index e7bbe755a0..70b35fbd96 100644 --- a/osu.Game.Rulesets.Osu/OsuInputManager.cs +++ b/osu.Game.Rulesets.Osu/OsuInputManager.cs @@ -4,7 +4,7 @@ using System.Collections.Generic; using System.ComponentModel; using osu.Framework.Input.Bindings; -using osu.Framework.Input.EventArgs; +using osu.Framework.Input.Events; using osu.Framework.Input.States; using osu.Game.Rulesets.UI; @@ -36,13 +36,13 @@ namespace osu.Game.Rulesets.Osu { } - protected override bool OnKeyDown(InputState state, KeyDownEventArgs args) => AllowUserPresses && base.OnKeyDown(state, args); - protected override bool OnKeyUp(InputState state, KeyUpEventArgs args) => AllowUserPresses && base.OnKeyUp(state, args); - protected override bool OnJoystickPress(InputState state, JoystickEventArgs args) => AllowUserPresses && base.OnJoystickPress(state, args); - protected override bool OnJoystickRelease(InputState state, JoystickEventArgs args) => AllowUserPresses && base.OnJoystickRelease(state, args); - protected override bool OnMouseDown(InputState state, MouseDownEventArgs args) => AllowUserPresses && base.OnMouseDown(state, args); - protected override bool OnMouseUp(InputState state, MouseUpEventArgs args) => AllowUserPresses && base.OnMouseUp(state, args); - protected override bool OnScroll(InputState state) => AllowUserPresses && base.OnScroll(state); + protected override bool OnKeyDown(KeyDownEvent e) => AllowUserPresses && base.OnKeyDown(e); + protected override bool OnKeyUp(KeyUpEvent e) => AllowUserPresses && base.OnKeyUp(e); + protected override bool OnJoystickPress(InputState state, JoystickEventArgs args) => AllowUserPresses && base.OnJoystickPress(args); + protected override bool OnJoystickRelease(InputState state, JoystickEventArgs args) => AllowUserPresses && base.OnJoystickRelease(args); + protected override bool OnMouseDown(MouseDownEvent e) => AllowUserPresses && base.OnMouseDown(e); + protected override bool OnMouseUp(MouseUpEvent e) => AllowUserPresses && base.OnMouseUp(e); + protected override bool OnScroll(ScrollEvent e) => AllowUserPresses && base.OnScroll(e); } } diff --git a/osu.Game.Rulesets.Osu/UI/Cursor/CursorTrail.cs b/osu.Game.Rulesets.Osu/UI/Cursor/CursorTrail.cs index 60c24a6fbd..8a701f1afc 100644 --- a/osu.Game.Rulesets.Osu/UI/Cursor/CursorTrail.cs +++ b/osu.Game.Rulesets.Osu/UI/Cursor/CursorTrail.cs @@ -12,7 +12,7 @@ using osu.Framework.Graphics.Primitives; using osu.Framework.Graphics.Shaders; using osu.Framework.Graphics.Textures; using osu.Framework.Input; -using osu.Framework.Input.States; +using osu.Framework.Input.Events; using osu.Framework.Timing; using OpenTK; using OpenTK.Graphics; @@ -117,15 +117,15 @@ namespace osu.Game.Rulesets.Osu.UI.Cursor timeOffset = Time.Current; } - protected override bool OnMouseMove(InputState state) + protected override bool OnMouseMove(MouseMoveEvent e) { - Vector2 pos = state.Mouse.NativeState.Position; + Vector2 pos = e.Mouse.NativeState.Position; if (lastPosition == null) { lastPosition = pos; resampler.AddPosition(lastPosition.Value); - return base.OnMouseMove(state); + return base.OnMouseMove(e); } foreach (Vector2 pos2 in resampler.AddPosition(pos)) @@ -147,7 +147,7 @@ namespace osu.Game.Rulesets.Osu.UI.Cursor } } - return base.OnMouseMove(state); + return base.OnMouseMove(e); } private void addPosition(Vector2 pos) diff --git a/osu.Game.Tests/Visual/TestCaseCursors.cs b/osu.Game.Tests/Visual/TestCaseCursors.cs index d4c409b144..cdb6b8c1f8 100644 --- a/osu.Game.Tests/Visual/TestCaseCursors.cs +++ b/osu.Game.Tests/Visual/TestCaseCursors.cs @@ -7,7 +7,7 @@ using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Cursor; using osu.Framework.Graphics.Shapes; -using osu.Framework.Input.States; +using osu.Framework.Input.Events; using osu.Framework.MathUtils; using osu.Game.Graphics.Cursor; using osu.Game.Graphics.Sprites; @@ -224,16 +224,16 @@ namespace osu.Game.Tests.Visual }; } - protected override bool OnHover(InputState state) + protected override bool OnHover(HoverEvent e) { background.FadeTo(0.4f, 250, Easing.OutQuint); return false; } - protected override void OnHoverLost(InputState state) + protected override void OnHoverLost(HoverLostEvent e) { background.FadeTo(0.1f, 250); - base.OnHoverLost(state); + base.OnHoverLost(e); } } diff --git a/osu.Game/Graphics/Containers/OsuFocusedOverlayContainer.cs b/osu.Game/Graphics/Containers/OsuFocusedOverlayContainer.cs index a143c056ff..14f18e554d 100644 --- a/osu.Game/Graphics/Containers/OsuFocusedOverlayContainer.cs +++ b/osu.Game/Graphics/Containers/OsuFocusedOverlayContainer.cs @@ -8,7 +8,7 @@ using osu.Framework.Graphics.Containers; using OpenTK; using osu.Framework.Configuration; using osu.Framework.Input.Bindings; -using osu.Framework.Input.States; +using osu.Framework.Input.Events; using osu.Game.Audio; using osu.Game.Input.Bindings; using osu.Game.Overlays; @@ -59,7 +59,7 @@ namespace osu.Game.Graphics.Containers // receive input outside our bounds so we can trigger a close event on ourselves. public override bool ReceivePositionalInputAt(Vector2 screenSpacePos) => BlockScreenWideMouse || base.ReceivePositionalInputAt(screenSpacePos); - protected override bool OnClick(InputState state) + protected override bool OnClick(ClickEvent e) { if (!base.ReceivePositionalInputAt(state.Mouse.NativeState.Position)) { @@ -67,7 +67,7 @@ namespace osu.Game.Graphics.Containers return true; } - return base.OnClick(state); + return base.OnClick(e); } public virtual bool OnPressed(GlobalAction action) diff --git a/osu.Game/Graphics/Containers/OsuHoverContainer.cs b/osu.Game/Graphics/Containers/OsuHoverContainer.cs index 12df19e7c0..577d889be3 100644 --- a/osu.Game/Graphics/Containers/OsuHoverContainer.cs +++ b/osu.Game/Graphics/Containers/OsuHoverContainer.cs @@ -6,7 +6,7 @@ using OpenTK.Graphics; using osu.Framework.Allocation; using osu.Framework.Extensions.IEnumerableExtensions; using osu.Framework.Graphics; -using osu.Framework.Input.States; +using osu.Framework.Input.Events; namespace osu.Game.Graphics.Containers { @@ -18,16 +18,16 @@ namespace osu.Game.Graphics.Containers protected virtual IEnumerable EffectTargets => new[] { Content }; - protected override bool OnHover(InputState state) + protected override bool OnHover(HoverEvent e) { EffectTargets.ForEach(d => d.FadeColour(HoverColour, 500, Easing.OutQuint)); - return base.OnHover(state); + return base.OnHover(e); } - protected override void OnHoverLost(InputState state) + protected override void OnHoverLost(HoverLostEvent e) { EffectTargets.ForEach(d => d.FadeColour(IdleColour, 500, Easing.OutQuint)); - base.OnHoverLost(state); + base.OnHoverLost(e); } [BackgroundDependencyLoader] diff --git a/osu.Game/Graphics/Containers/OsuScrollContainer.cs b/osu.Game/Graphics/Containers/OsuScrollContainer.cs index 6d42be6fca..5c5c42ba70 100644 --- a/osu.Game/Graphics/Containers/OsuScrollContainer.cs +++ b/osu.Game/Graphics/Containers/OsuScrollContainer.cs @@ -2,7 +2,7 @@ // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE using osu.Framework.Graphics.Containers; -using osu.Framework.Input.EventArgs; +using osu.Framework.Input.Events; using osu.Framework.Input.States; using OpenTK.Input; @@ -29,7 +29,7 @@ namespace osu.Game.Graphics.Containers protected override bool IsDragging => base.IsDragging || mouseScrollBarDragging; - protected override bool OnMouseDown(InputState state, MouseDownEventArgs args) + protected override bool OnMouseDown(MouseDownEvent e) { if (shouldPerformRightMouseScroll(state)) { @@ -37,32 +37,32 @@ namespace osu.Game.Graphics.Containers return true; } - return base.OnMouseDown(state, args); + return base.OnMouseDown(e); } - protected override bool OnDrag(InputState state) + protected override bool OnDrag(DragEvent e) { if (mouseScrollBarDragging) { - scrollToRelative(state.Mouse.Position[ScrollDim]); + scrollToRelative(e.Mouse.Position[ScrollDim]); return true; } - return base.OnDrag(state); + return base.OnDrag(e); } - protected override bool OnDragStart(InputState state) + protected override bool OnDragStart(DragStartEvent e) { - if (shouldPerformRightMouseScroll(state)) + if (shouldPerformRightMouseScroll(e)) { mouseScrollBarDragging = true; return true; } - return base.OnDragStart(state); + return base.OnDragStart(e); } - protected override bool OnDragEnd(InputState state) + protected override bool OnDragEnd(DragEndEvent e) { if (mouseScrollBarDragging) { @@ -70,7 +70,7 @@ namespace osu.Game.Graphics.Containers return true; } - return base.OnDragEnd(state); + return base.OnDragEnd(e); } } } diff --git a/osu.Game/Graphics/Cursor/MenuCursor.cs b/osu.Game/Graphics/Cursor/MenuCursor.cs index b55e1aa5dd..a34a7c53d0 100644 --- a/osu.Game/Graphics/Cursor/MenuCursor.cs +++ b/osu.Game/Graphics/Cursor/MenuCursor.cs @@ -12,8 +12,7 @@ using osu.Game.Configuration; using System; using JetBrains.Annotations; using osu.Framework.Graphics.Textures; -using osu.Framework.Input.EventArgs; -using osu.Framework.Input.States; +using osu.Framework.Input.Events; using OpenTK.Input; namespace osu.Game.Graphics.Cursor @@ -40,11 +39,11 @@ namespace osu.Game.Graphics.Cursor screenshotCursorVisibility.BindTo(screenshotManager.CursorVisibility); } - protected override bool OnMouseMove(InputState state) + protected override bool OnMouseMove(MouseMoveEvent e) { if (dragRotationState != DragRotationState.NotDragging) { - var position = state.Mouse.Position; + var position = e.Mouse.Position; var distance = Vector2Extensions.Distance(position, positionMouseDown); // don't start rotating until we're moved a minimum distance away from the mouse down location, // else it can have an annoying effect. @@ -53,7 +52,7 @@ namespace osu.Game.Graphics.Cursor // don't rotate when distance is zero to avoid NaN if (dragRotationState == DragRotationState.Rotating && distance > 0) { - Vector2 offset = state.Mouse.Position - positionMouseDown; + Vector2 offset = e.Mouse.Position - positionMouseDown; float degrees = (float)MathHelper.RadiansToDegrees(Math.Atan2(-offset.X, offset.Y)) + 24.3f; // Always rotate in the direction of least distance @@ -66,13 +65,13 @@ namespace osu.Game.Graphics.Cursor } } - return base.OnMouseMove(state); + return base.OnMouseMove(e); } - protected override bool OnMouseDown(InputState state, MouseDownEventArgs args) + protected override bool OnMouseDown(MouseDownEvent e) { // only trigger animation for main mouse buttons - if (args.Button <= MouseButton.Right) + if (e.Button <= MouseButton.Right) { activeCursor.Scale = new Vector2(1); activeCursor.ScaleTo(0.90f, 800, Easing.OutQuint); @@ -81,15 +80,15 @@ namespace osu.Game.Graphics.Cursor activeCursor.AdditiveLayer.FadeInFromZero(800, Easing.OutQuint); } - if (args.Button == MouseButton.Left && cursorRotate) + if (e.Button == MouseButton.Left && cursorRotate) { dragRotationState = DragRotationState.DragStarted; positionMouseDown = state.Mouse.Position; } - return base.OnMouseDown(state, args); + return base.OnMouseDown(e); } - protected override bool OnMouseUp(InputState state, MouseUpEventArgs args) + protected override bool OnMouseUp(MouseUpEvent e) { if (!state.Mouse.HasMainButtonPressed) { @@ -97,13 +96,13 @@ namespace osu.Game.Graphics.Cursor activeCursor.ScaleTo(1, 500, Easing.OutElastic); } - if (args.Button == MouseButton.Left) + if (e.Button == MouseButton.Left) { if (dragRotationState == DragRotationState.Rotating) activeCursor.RotateTo(0, 600 * (1 + Math.Abs(activeCursor.Rotation / 720)), Easing.OutElasticHalf); dragRotationState = DragRotationState.NotDragging; } - return base.OnMouseUp(state, args); + return base.OnMouseUp(e); } protected override void PopIn() diff --git a/osu.Game/Graphics/UserInterface/DialogButton.cs b/osu.Game/Graphics/UserInterface/DialogButton.cs index 5094062fae..b2220267ff 100644 --- a/osu.Game/Graphics/UserInterface/DialogButton.cs +++ b/osu.Game/Graphics/UserInterface/DialogButton.cs @@ -13,7 +13,7 @@ using osu.Game.Graphics.Sprites; using osu.Framework.Extensions.Color4Extensions; using osu.Game.Graphics.Containers; using osu.Framework.Configuration; -using osu.Framework.Input.States; +using osu.Framework.Input.Events; namespace osu.Game.Graphics.UserInterface { @@ -213,7 +213,7 @@ namespace osu.Game.Graphics.UserInterface public override bool ReceivePositionalInputAt(Vector2 screenSpacePos) => backgroundContainer.ReceivePositionalInputAt(screenSpacePos); - protected override bool OnClick(InputState state) + protected override bool OnClick(ClickEvent e) { colourContainer.ResizeTo(new Vector2(1.5f, 1f), click_duration, Easing.In); flash(); @@ -225,20 +225,20 @@ namespace osu.Game.Graphics.UserInterface glowContainer.FadeOut(); }); - return base.OnClick(state); + return base.OnClick(e); } - protected override bool OnHover(InputState state) + protected override bool OnHover(HoverEvent e) { - base.OnHover(state); + base.OnHover(e); Selected.Value = true; return true; } - protected override void OnHoverLost(InputState state) + protected override void OnHoverLost(HoverLostEvent e) { - base.OnHoverLost(state); + base.OnHoverLost(e); Selected.Value = false; } diff --git a/osu.Game/Graphics/UserInterface/ExternalLinkButton.cs b/osu.Game/Graphics/UserInterface/ExternalLinkButton.cs index fe8995f310..d82448e8a2 100644 --- a/osu.Game/Graphics/UserInterface/ExternalLinkButton.cs +++ b/osu.Game/Graphics/UserInterface/ExternalLinkButton.cs @@ -5,7 +5,7 @@ using osu.Framework.Allocation; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Cursor; -using osu.Framework.Input.States; +using osu.Framework.Input.Events; using osu.Framework.Platform; using OpenTK; using OpenTK.Graphics; @@ -37,19 +37,19 @@ namespace osu.Game.Graphics.UserInterface this.host = host; } - protected override bool OnHover(InputState state) + protected override bool OnHover(HoverEvent e) { InternalChild.FadeColour(hoverColour, 500, Easing.OutQuint); - return base.OnHover(state); + return base.OnHover(e); } - protected override void OnHoverLost(InputState state) + protected override void OnHoverLost(HoverLostEvent e) { InternalChild.FadeColour(Color4.White, 500, Easing.OutQuint); - base.OnHoverLost(state); + base.OnHoverLost(e); } - protected override bool OnClick(InputState state) + protected override bool OnClick(ClickEvent e) { if(Link != null) host.OpenUrlExternally(Link); diff --git a/osu.Game/Graphics/UserInterface/FocusedTextBox.cs b/osu.Game/Graphics/UserInterface/FocusedTextBox.cs index 18ec35c76e..122ac7b627 100644 --- a/osu.Game/Graphics/UserInterface/FocusedTextBox.cs +++ b/osu.Game/Graphics/UserInterface/FocusedTextBox.cs @@ -3,8 +3,7 @@ using OpenTK.Graphics; using System; -using osu.Framework.Input.EventArgs; -using osu.Framework.Input.States; +using osu.Framework.Input.Events; using osu.Game.Input.Bindings; using OpenTK.Input; @@ -36,20 +35,20 @@ namespace osu.Game.Graphics.UserInterface // We may not be focused yet, but we need to handle keyboard input to be able to request focus public override bool HandleNonPositionalInput => HoldFocus || base.HandleNonPositionalInput; - protected override void OnFocus(InputState state) + protected override void OnFocus(FocusEvent e) { - base.OnFocus(state); + base.OnFocus(e); BorderThickness = 0; } - protected override bool OnKeyDown(InputState state, KeyDownEventArgs args) + protected override bool OnKeyDown(KeyDownEvent e) { if (!HasFocus) return false; - if (args.Key == Key.Escape) + if (e.Key == Key.Escape) return false; // disable the framework-level handling of escape key for confority (we use GlobalAction.Back). - return base.OnKeyDown(state, args); + return base.OnKeyDown(e); } public override bool OnPressed(GlobalAction action) diff --git a/osu.Game/Graphics/UserInterface/HoverClickSounds.cs b/osu.Game/Graphics/UserInterface/HoverClickSounds.cs index 27a06ba0b7..3641e251bc 100644 --- a/osu.Game/Graphics/UserInterface/HoverClickSounds.cs +++ b/osu.Game/Graphics/UserInterface/HoverClickSounds.cs @@ -5,7 +5,7 @@ using osu.Framework.Allocation; using osu.Framework.Audio; using osu.Framework.Audio.Sample; using osu.Framework.Extensions; -using osu.Framework.Input.States; +using osu.Framework.Input.Events; namespace osu.Game.Graphics.UserInterface { @@ -21,10 +21,10 @@ namespace osu.Game.Graphics.UserInterface { } - protected override bool OnClick(InputState state) + protected override bool OnClick(ClickEvent e) { sampleClick?.Play(); - return base.OnClick(state); + return base.OnClick(e); } [BackgroundDependencyLoader] diff --git a/osu.Game/Graphics/UserInterface/HoverSounds.cs b/osu.Game/Graphics/UserInterface/HoverSounds.cs index 821305bc92..710948121e 100644 --- a/osu.Game/Graphics/UserInterface/HoverSounds.cs +++ b/osu.Game/Graphics/UserInterface/HoverSounds.cs @@ -8,7 +8,7 @@ using osu.Framework.Audio.Sample; using osu.Framework.Extensions; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; -using osu.Framework.Input.States; +using osu.Framework.Input.Events; namespace osu.Game.Graphics.UserInterface { @@ -28,10 +28,10 @@ namespace osu.Game.Graphics.UserInterface RelativeSizeAxes = Axes.Both; } - protected override bool OnHover(InputState state) + protected override bool OnHover(HoverEvent e) { sampleHover?.Play(); - return base.OnHover(state); + return base.OnHover(e); } [BackgroundDependencyLoader] diff --git a/osu.Game/Graphics/UserInterface/IconButton.cs b/osu.Game/Graphics/UserInterface/IconButton.cs index be60812ba6..f10f03873d 100644 --- a/osu.Game/Graphics/UserInterface/IconButton.cs +++ b/osu.Game/Graphics/UserInterface/IconButton.cs @@ -4,7 +4,7 @@ using OpenTK; using OpenTK.Graphics; using osu.Framework.Graphics; -using osu.Framework.Input.States; +using osu.Framework.Input.Events; namespace osu.Game.Graphics.UserInterface { @@ -84,16 +84,16 @@ namespace osu.Game.Graphics.UserInterface }); } - protected override bool OnHover(InputState state) + protected override bool OnHover(HoverEvent e) { icon.FadeColour(IconHoverColour, 500, Easing.OutQuint); - return base.OnHover(state); + return base.OnHover(e); } - protected override void OnHoverLost(InputState state) + protected override void OnHoverLost(HoverLostEvent e) { icon.FadeColour(IconColour, 500, Easing.OutQuint); - base.OnHoverLost(state); + base.OnHoverLost(e); } } } diff --git a/osu.Game/Graphics/UserInterface/OsuAnimatedButton.cs b/osu.Game/Graphics/UserInterface/OsuAnimatedButton.cs index 4428a058db..4516d7ce76 100644 --- a/osu.Game/Graphics/UserInterface/OsuAnimatedButton.cs +++ b/osu.Game/Graphics/UserInterface/OsuAnimatedButton.cs @@ -6,8 +6,7 @@ using osu.Framework.Extensions.Color4Extensions; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Shapes; -using osu.Framework.Input.EventArgs; -using osu.Framework.Input.States; +using osu.Framework.Input.Events; using osu.Game.Graphics.Containers; using OpenTK.Graphics; @@ -77,34 +76,34 @@ namespace osu.Game.Graphics.UserInterface Enabled.BindValueChanged(enabled => this.FadeColour(enabled ? Color4.White : colours.Gray9, 200, Easing.OutQuint), true); } - protected override bool OnHover(InputState state) + protected override bool OnHover(HoverEvent e) { hover.FadeIn(500, Easing.OutQuint); - return base.OnHover(state); + return base.OnHover(e); } - protected override void OnHoverLost(InputState state) + protected override void OnHoverLost(HoverLostEvent e) { hover.FadeOut(500, Easing.OutQuint); - base.OnHoverLost(state); + base.OnHoverLost(e); } - protected override bool OnClick(InputState state) + protected override bool OnClick(ClickEvent e) { hover.FlashColour(FlashColour, 800, Easing.OutQuint); - return base.OnClick(state); + return base.OnClick(e); } - protected override bool OnMouseDown(InputState state, MouseDownEventArgs args) + protected override bool OnMouseDown(MouseDownEvent e) { Content.ScaleTo(0.75f, 2000, Easing.OutQuint); - return base.OnMouseDown(state, args); + return base.OnMouseDown(e); } - protected override bool OnMouseUp(InputState state, MouseUpEventArgs args) + protected override bool OnMouseUp(MouseUpEvent e) { Content.ScaleTo(1, 1000, Easing.OutElastic); - return base.OnMouseUp(state, args); + return base.OnMouseUp(e); } } } diff --git a/osu.Game/Graphics/UserInterface/OsuButton.cs b/osu.Game/Graphics/UserInterface/OsuButton.cs index bb6a032a12..ab880cd473 100644 --- a/osu.Game/Graphics/UserInterface/OsuButton.cs +++ b/osu.Game/Graphics/UserInterface/OsuButton.cs @@ -7,8 +7,7 @@ using osu.Framework.Graphics; using osu.Framework.Graphics.Shapes; using osu.Framework.Graphics.Sprites; using osu.Framework.Graphics.UserInterface; -using osu.Framework.Input.EventArgs; -using osu.Framework.Input.States; +using osu.Framework.Input.Events; using osu.Game.Graphics.Sprites; using OpenTK.Graphics; @@ -56,28 +55,28 @@ namespace osu.Game.Graphics.UserInterface this.FadeColour(enabled ? Color4.White : Color4.Gray, 200, Easing.OutQuint); } - protected override bool OnHover(InputState state) + protected override bool OnHover(HoverEvent e) { hover.FadeIn(200); - return base.OnHover(state); + return base.OnHover(e); } - protected override void OnHoverLost(InputState state) + protected override void OnHoverLost(HoverLostEvent e) { hover.FadeOut(200); - base.OnHoverLost(state); + base.OnHoverLost(e); } - protected override bool OnMouseDown(InputState state, MouseDownEventArgs args) + protected override bool OnMouseDown(MouseDownEvent e) { Content.ScaleTo(0.9f, 4000, Easing.OutQuint); - return base.OnMouseDown(state, args); + return base.OnMouseDown(e); } - protected override bool OnMouseUp(InputState state, MouseUpEventArgs args) + protected override bool OnMouseUp(MouseUpEvent e) { Content.ScaleTo(1, 1000, Easing.OutElastic); - return base.OnMouseUp(state, args); + return base.OnMouseUp(e); } protected override SpriteText CreateText() => new OsuSpriteText diff --git a/osu.Game/Graphics/UserInterface/OsuCheckbox.cs b/osu.Game/Graphics/UserInterface/OsuCheckbox.cs index 68f59bd8cd..e267a7f848 100644 --- a/osu.Game/Graphics/UserInterface/OsuCheckbox.cs +++ b/osu.Game/Graphics/UserInterface/OsuCheckbox.cs @@ -8,7 +8,7 @@ using osu.Framework.Configuration; using osu.Framework.Graphics; using osu.Framework.Graphics.Sprites; using osu.Framework.Graphics.UserInterface; -using osu.Framework.Input.States; +using osu.Framework.Input.Events; using osu.Game.Graphics.Sprites; using OpenTK.Graphics; @@ -95,18 +95,18 @@ namespace osu.Game.Graphics.UserInterface }; } - protected override bool OnHover(InputState state) + protected override bool OnHover(HoverEvent e) { Nub.Glowing = true; Nub.Expanded = true; - return base.OnHover(state); + return base.OnHover(e); } - protected override void OnHoverLost(InputState state) + protected override void OnHoverLost(HoverLostEvent e) { Nub.Glowing = false; Nub.Expanded = false; - base.OnHoverLost(state); + base.OnHoverLost(e); } [BackgroundDependencyLoader] diff --git a/osu.Game/Graphics/UserInterface/OsuMenu.cs b/osu.Game/Graphics/UserInterface/OsuMenu.cs index abb077e94f..fe3e866a70 100644 --- a/osu.Game/Graphics/UserInterface/OsuMenu.cs +++ b/osu.Game/Graphics/UserInterface/OsuMenu.cs @@ -10,7 +10,7 @@ using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Sprites; using osu.Framework.Graphics.UserInterface; -using osu.Framework.Input.States; +using osu.Framework.Input.Events; using osu.Game.Graphics.Sprites; using OpenTK; @@ -97,25 +97,25 @@ namespace osu.Game.Graphics.UserInterface } } - protected override bool OnHover(InputState state) + protected override bool OnHover(HoverEvent e) { sampleHover.Play(); text.BoldText.FadeIn(transition_length, Easing.OutQuint); text.NormalText.FadeOut(transition_length, Easing.OutQuint); - return base.OnHover(state); + return base.OnHover(e); } - protected override void OnHoverLost(InputState state) + protected override void OnHoverLost(HoverLostEvent e) { text.BoldText.FadeOut(transition_length, Easing.OutQuint); text.NormalText.FadeIn(transition_length, Easing.OutQuint); - base.OnHoverLost(state); + base.OnHoverLost(e); } - protected override bool OnClick(InputState state) + protected override bool OnClick(ClickEvent e) { sampleClick.Play(); - return base.OnClick(state); + return base.OnClick(e); } protected sealed override Drawable CreateContent() => text = CreateTextContainer(); diff --git a/osu.Game/Graphics/UserInterface/OsuPasswordTextBox.cs b/osu.Game/Graphics/UserInterface/OsuPasswordTextBox.cs index 75655ddb36..f4ec67db23 100644 --- a/osu.Game/Graphics/UserInterface/OsuPasswordTextBox.cs +++ b/osu.Game/Graphics/UserInterface/OsuPasswordTextBox.cs @@ -9,8 +9,7 @@ using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Cursor; using osu.Framework.Graphics.Shapes; -using osu.Framework.Input.EventArgs; -using osu.Framework.Input.States; +using osu.Framework.Input.Events; using osu.Framework.Platform; namespace osu.Game.Graphics.UserInterface @@ -43,23 +42,23 @@ namespace osu.Game.Graphics.UserInterface this.host = host; } - protected override bool OnKeyDown(InputState state, KeyDownEventArgs args) + protected override bool OnKeyDown(KeyDownEvent e) { - if (args.Key == Key.CapsLock) + if (e.Key == Key.CapsLock) updateCapsWarning(host.CapsLockEnabled); - return base.OnKeyDown(state, args); + return base.OnKeyDown(e); } - protected override void OnFocus(InputState state) + protected override void OnFocus(FocusEvent e) { updateCapsWarning(host.CapsLockEnabled); - base.OnFocus(state); + base.OnFocus(e); } - protected override void OnFocusLost(InputState state) + protected override void OnFocusLost(FocusLostEvent e) { updateCapsWarning(false); - base.OnFocusLost(state); + base.OnFocusLost(e); } private void updateCapsWarning(bool visible) => warning.FadeTo(visible ? 1 : 0, 250, Easing.OutQuint); diff --git a/osu.Game/Graphics/UserInterface/OsuSliderBar.cs b/osu.Game/Graphics/UserInterface/OsuSliderBar.cs index b7b5319e06..eecc10469e 100644 --- a/osu.Game/Graphics/UserInterface/OsuSliderBar.cs +++ b/osu.Game/Graphics/UserInterface/OsuSliderBar.cs @@ -13,8 +13,7 @@ using osu.Framework.Graphics; using osu.Framework.Graphics.UserInterface; using osu.Framework.Graphics.Cursor; using osu.Framework.Graphics.Shapes; -using osu.Framework.Input.EventArgs; -using osu.Framework.Input.States; +using osu.Framework.Input.Events; namespace osu.Game.Graphics.UserInterface { @@ -125,16 +124,16 @@ namespace osu.Game.Graphics.UserInterface AccentColour = colours.Pink; } - protected override bool OnHover(InputState state) + protected override bool OnHover(HoverEvent e) { Nub.Glowing = true; - return base.OnHover(state); + return base.OnHover(e); } - protected override void OnHoverLost(InputState state) + protected override void OnHoverLost(HoverLostEvent e) { Nub.Glowing = false; - base.OnHoverLost(state); + base.OnHoverLost(e); } protected override void OnUserChange() @@ -164,16 +163,16 @@ namespace osu.Game.Graphics.UserInterface sample.Play(); } - protected override bool OnMouseDown(InputState state, MouseDownEventArgs args) + protected override bool OnMouseDown(MouseDownEvent e) { Nub.Current.Value = true; - return base.OnMouseDown(state, args); + return base.OnMouseDown(e); } - protected override bool OnMouseUp(InputState state, MouseUpEventArgs args) + protected override bool OnMouseUp(MouseUpEvent e) { Nub.Current.Value = false; - return base.OnMouseUp(state, args); + return base.OnMouseUp(e); } protected override void UpdateAfterChildren() diff --git a/osu.Game/Graphics/UserInterface/OsuTabControl.cs b/osu.Game/Graphics/UserInterface/OsuTabControl.cs index e2a0b88b2a..24183e07a0 100644 --- a/osu.Game/Graphics/UserInterface/OsuTabControl.cs +++ b/osu.Game/Graphics/UserInterface/OsuTabControl.cs @@ -14,7 +14,7 @@ using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Shapes; using osu.Framework.Graphics.Sprites; using osu.Framework.Graphics.UserInterface; -using osu.Framework.Input.States; +using osu.Framework.Input.Events; using osu.Framework.MathUtils; using osu.Game.Graphics.Sprites; @@ -126,14 +126,14 @@ namespace osu.Game.Graphics.UserInterface Text.FadeColour(AccentColour, transition_length, Easing.OutQuint); } - protected override bool OnHover(InputState state) + protected override bool OnHover(HoverEvent e) { if (!Active) fadeActive(); return true; } - protected override void OnHoverLost(InputState state) + protected override void OnHoverLost(HoverLostEvent e) { if (!Active) fadeInactive(); @@ -265,16 +265,16 @@ namespace osu.Game.Graphics.UserInterface Padding = new MarginPadding { Left = 5, Right = 5 }; } - protected override bool OnHover(InputState state) + protected override bool OnHover(HoverEvent e) { Foreground.Colour = BackgroundColour; - return base.OnHover(state); + return base.OnHover(e); } - protected override void OnHoverLost(InputState state) + protected override void OnHoverLost(HoverLostEvent e) { Foreground.Colour = BackgroundColourHover; - base.OnHoverLost(state); + base.OnHoverLost(e); } } } diff --git a/osu.Game/Graphics/UserInterface/OsuTabControlCheckbox.cs b/osu.Game/Graphics/UserInterface/OsuTabControlCheckbox.cs index 04ba111153..1355ffdb8e 100644 --- a/osu.Game/Graphics/UserInterface/OsuTabControlCheckbox.cs +++ b/osu.Game/Graphics/UserInterface/OsuTabControlCheckbox.cs @@ -10,7 +10,7 @@ using osu.Framework.Graphics.Shapes; using osu.Game.Graphics.Sprites; using osu.Framework.Graphics.Sprites; using osu.Framework.Graphics.UserInterface; -using osu.Framework.Input.States; +using osu.Framework.Input.Events; namespace osu.Game.Graphics.UserInterface { @@ -59,18 +59,18 @@ namespace osu.Game.Graphics.UserInterface text.FadeColour(AccentColour, transition_length, Easing.OutQuint); } - protected override bool OnHover(InputState state) + protected override bool OnHover(HoverEvent e) { fadeIn(); - return base.OnHover(state); + return base.OnHover(e); } - protected override void OnHoverLost(InputState state) + protected override void OnHoverLost(HoverLostEvent e) { if (!Current) fadeOut(); - base.OnHoverLost(state); + base.OnHoverLost(e); } [BackgroundDependencyLoader] diff --git a/osu.Game/Graphics/UserInterface/OsuTextBox.cs b/osu.Game/Graphics/UserInterface/OsuTextBox.cs index 7a45ffdd4b..37464faa73 100644 --- a/osu.Game/Graphics/UserInterface/OsuTextBox.cs +++ b/osu.Game/Graphics/UserInterface/OsuTextBox.cs @@ -9,7 +9,7 @@ using osu.Game.Graphics.Sprites; using OpenTK.Graphics; using osu.Framework.Extensions.Color4Extensions; using osu.Framework.Input.Bindings; -using osu.Framework.Input.States; +using osu.Framework.Input.Events; using osu.Game.Input.Bindings; namespace osu.Game.Graphics.UserInterface @@ -44,17 +44,17 @@ namespace osu.Game.Graphics.UserInterface BorderColour = colour.Yellow; } - protected override void OnFocus(InputState state) + protected override void OnFocus(FocusEvent e) { BorderThickness = 3; - base.OnFocus(state); + base.OnFocus(e); } - protected override void OnFocusLost(InputState state) + protected override void OnFocusLost(FocusLostEvent e) { BorderThickness = 0; - base.OnFocusLost(state); + base.OnFocusLost(e); } protected override Drawable GetDrawableCharacter(char c) => new OsuSpriteText { Text = c.ToString(), TextSize = CalculatedTextSize }; diff --git a/osu.Game/Graphics/UserInterface/PageTabControl.cs b/osu.Game/Graphics/UserInterface/PageTabControl.cs index d203532f9c..fb7b4c5676 100644 --- a/osu.Game/Graphics/UserInterface/PageTabControl.cs +++ b/osu.Game/Graphics/UserInterface/PageTabControl.cs @@ -10,7 +10,7 @@ using osu.Framework.Graphics; using osu.Framework.Graphics.Shapes; using osu.Framework.Graphics.Sprites; using osu.Framework.Graphics.UserInterface; -using osu.Framework.Input.States; +using osu.Framework.Input.Events; using osu.Game.Graphics.Sprites; namespace osu.Game.Graphics.UserInterface @@ -67,14 +67,14 @@ namespace osu.Game.Graphics.UserInterface box.Colour = colours.Yellow; } - protected override bool OnHover(InputState state) + protected override bool OnHover(HoverEvent e) { if (!Active) slideActive(); return true; } - protected override void OnHoverLost(InputState state) + protected override void OnHoverLost(HoverLostEvent e) { if (!Active) slideInactive(); diff --git a/osu.Game/Graphics/UserInterface/SearchTextBox.cs b/osu.Game/Graphics/UserInterface/SearchTextBox.cs index 6067481979..8aa3a3f663 100644 --- a/osu.Game/Graphics/UserInterface/SearchTextBox.cs +++ b/osu.Game/Graphics/UserInterface/SearchTextBox.cs @@ -2,8 +2,7 @@ // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE using osu.Framework.Graphics; -using osu.Framework.Input.EventArgs; -using osu.Framework.Input.States; +using osu.Framework.Input.Events; using OpenTK; using OpenTK.Input; @@ -33,11 +32,11 @@ namespace osu.Game.Graphics.UserInterface PlaceholderText = "type to search"; } - protected override bool OnKeyDown(InputState state, KeyDownEventArgs args) + protected override bool OnKeyDown(KeyDownEvent e) { if (!state.Keyboard.ControlPressed && !state.Keyboard.ShiftPressed) { - switch (args.Key) + switch (e.Key) { case Key.Left: case Key.Right: @@ -49,7 +48,7 @@ namespace osu.Game.Graphics.UserInterface if (!AllowCommit) { - switch (args.Key) + switch (e.Key) { case Key.KeypadEnter: case Key.Enter: @@ -59,14 +58,14 @@ namespace osu.Game.Graphics.UserInterface if (state.Keyboard.ShiftPressed) { - switch (args.Key) + switch (e.Key) { case Key.Delete: return false; } } - return base.OnKeyDown(state, args); + return base.OnKeyDown(e); } } } diff --git a/osu.Game/Graphics/UserInterface/TwoLayerButton.cs b/osu.Game/Graphics/UserInterface/TwoLayerButton.cs index 027ba67f66..2000eb47e4 100644 --- a/osu.Game/Graphics/UserInterface/TwoLayerButton.cs +++ b/osu.Game/Graphics/UserInterface/TwoLayerButton.cs @@ -13,8 +13,7 @@ using osu.Game.Beatmaps.ControlPoints; using osu.Framework.Audio.Track; using System; using osu.Framework.Graphics.Shapes; -using osu.Framework.Input.EventArgs; -using osu.Framework.Input.States; +using osu.Framework.Input.Events; namespace osu.Game.Graphics.UserInterface { @@ -172,7 +171,7 @@ namespace osu.Game.Graphics.UserInterface public override bool ReceivePositionalInputAt(Vector2 screenSpacePos) => IconLayer.ReceivePositionalInputAt(screenSpacePos) || TextLayer.ReceivePositionalInputAt(screenSpacePos); - protected override bool OnHover(InputState state) + protected override bool OnHover(HoverEvent e) { this.ResizeTo(SIZE_EXTENDED, transform_time, Easing.OutElastic); IconLayer.FadeColour(HoverColour, transform_time, Easing.OutElastic); @@ -182,7 +181,7 @@ namespace osu.Game.Graphics.UserInterface return true; } - protected override void OnHoverLost(InputState state) + protected override void OnHoverLost(HoverLostEvent e) { this.ResizeTo(SIZE_RETRACTED, transform_time, Easing.OutElastic); IconLayer.FadeColour(TextLayer.Colour, transform_time, Easing.OutElastic); @@ -190,12 +189,12 @@ namespace osu.Game.Graphics.UserInterface bouncingIcon.ScaleTo(1, transform_time, Easing.OutElastic); } - protected override bool OnMouseDown(InputState state, MouseDownEventArgs args) + protected override bool OnMouseDown(MouseDownEvent e) { return true; } - protected override bool OnClick(InputState state) + protected override bool OnClick(ClickEvent e) { var flash = new Box { @@ -209,7 +208,7 @@ namespace osu.Game.Graphics.UserInterface flash.FadeOut(500, Easing.OutQuint); flash.Expire(); - return base.OnClick(state); + return base.OnClick(e); } private class BouncingIcon : BeatSyncedContainer diff --git a/osu.Game/Overlays/BeatmapSet/BeatmapPicker.cs b/osu.Game/Overlays/BeatmapSet/BeatmapPicker.cs index 8186bf8685..bd9d65ccd8 100644 --- a/osu.Game/Overlays/BeatmapSet/BeatmapPicker.cs +++ b/osu.Game/Overlays/BeatmapSet/BeatmapPicker.cs @@ -10,7 +10,7 @@ using osu.Framework.Extensions.Color4Extensions; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Shapes; -using osu.Framework.Input.States; +using osu.Framework.Input.Events; using osu.Game.Beatmaps; using osu.Game.Beatmaps.Drawables; using osu.Game.Graphics; @@ -174,9 +174,9 @@ namespace osu.Game.Overlays.BeatmapSet { public Action OnLostHover; - protected override void OnHoverLost(InputState state) + protected override void OnHoverLost(HoverLostEvent e) { - base.OnHoverLost(state); + base.OnHoverLost(e); OnLostHover?.Invoke(); } } @@ -241,24 +241,24 @@ namespace osu.Game.Overlays.BeatmapSet }; } - protected override bool OnHover(InputState state) + protected override bool OnHover(HoverEvent e) { fadeIn(); OnHovered?.Invoke(Beatmap); - return base.OnHover(state); + return base.OnHover(e); } - protected override void OnHoverLost(InputState state) + protected override void OnHoverLost(HoverLostEvent e) { if (State == DifficultySelectorState.NotSelected) fadeOut(); - base.OnHoverLost(state); + base.OnHoverLost(e); } - protected override bool OnClick(InputState state) + protected override bool OnClick(ClickEvent e) { OnClicked?.Invoke(Beatmap); - return base.OnClick(state); + return base.OnClick(e); } private void fadeIn() diff --git a/osu.Game/Overlays/BeatmapSet/Buttons/PreviewButton.cs b/osu.Game/Overlays/BeatmapSet/Buttons/PreviewButton.cs index b3072a02d9..1988b7d222 100644 --- a/osu.Game/Overlays/BeatmapSet/Buttons/PreviewButton.cs +++ b/osu.Game/Overlays/BeatmapSet/Buttons/PreviewButton.cs @@ -7,7 +7,7 @@ using osu.Framework.Extensions.Color4Extensions; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Shapes; -using osu.Framework.Input.States; +using osu.Framework.Input.Events; using osu.Game.Audio; using osu.Game.Beatmaps; using osu.Game.Graphics; @@ -89,16 +89,16 @@ namespace osu.Game.Overlays.BeatmapSet.Buttons progress.Width = 0; } - protected override bool OnHover(InputState state) + protected override bool OnHover(HoverEvent e) { bg.FadeColour(Color4.Black.Opacity(0.5f), 100); - return base.OnHover(state); + return base.OnHover(e); } - protected override void OnHoverLost(InputState state) + protected override void OnHoverLost(HoverLostEvent e) { bg.FadeColour(Color4.Black.Opacity(0.25f), 100); - base.OnHoverLost(state); + base.OnHoverLost(e); } } } diff --git a/osu.Game/Overlays/BeatmapSet/Scores/ClickableUsername.cs b/osu.Game/Overlays/BeatmapSet/Scores/ClickableUsername.cs index dc350d2c4c..0be83db39e 100644 --- a/osu.Game/Overlays/BeatmapSet/Scores/ClickableUsername.cs +++ b/osu.Game/Overlays/BeatmapSet/Scores/ClickableUsername.cs @@ -3,7 +3,7 @@ using osu.Framework.Allocation; using osu.Framework.Graphics; -using osu.Framework.Input.States; +using osu.Framework.Input.Events; using osu.Game.Graphics.Containers; using osu.Game.Graphics.Sprites; using osu.Game.Users; @@ -53,7 +53,7 @@ namespace osu.Game.Overlays.BeatmapSet.Scores this.profile = profile; } - protected override bool OnClick(InputState state) + protected override bool OnClick(ClickEvent e) { profile?.ShowUser(user); return true; diff --git a/osu.Game/Overlays/BeatmapSet/Scores/DrawableScore.cs b/osu.Game/Overlays/BeatmapSet/Scores/DrawableScore.cs index d9af81c19a..309d75f60a 100644 --- a/osu.Game/Overlays/BeatmapSet/Scores/DrawableScore.cs +++ b/osu.Game/Overlays/BeatmapSet/Scores/DrawableScore.cs @@ -6,7 +6,7 @@ using osu.Framework.Allocation; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Shapes; -using osu.Framework.Input.States; +using osu.Framework.Input.Events; using osu.Game.Graphics; using osu.Game.Graphics.Sprites; using osu.Game.Online.API.Requests.Responses; @@ -125,18 +125,18 @@ namespace osu.Game.Overlays.BeatmapSet.Scores background.Colour = colours.Gray4; } - protected override bool OnHover(InputState state) + protected override bool OnHover(HoverEvent e) { background.FadeIn(fade_duration, Easing.OutQuint); - return base.OnHover(state); + return base.OnHover(e); } - protected override void OnHoverLost(InputState state) + protected override void OnHoverLost(HoverLostEvent e) { background.FadeOut(fade_duration, Easing.OutQuint); - base.OnHoverLost(state); + base.OnHoverLost(e); } - protected override bool OnClick(InputState state) => true; + protected override bool OnClick(ClickEvent e) => true; } } diff --git a/osu.Game/Overlays/BeatmapSet/Scores/DrawableTopScore.cs b/osu.Game/Overlays/BeatmapSet/Scores/DrawableTopScore.cs index a1ebab09b1..d954b48b86 100644 --- a/osu.Game/Overlays/BeatmapSet/Scores/DrawableTopScore.cs +++ b/osu.Game/Overlays/BeatmapSet/Scores/DrawableTopScore.cs @@ -8,7 +8,7 @@ using osu.Framework.Extensions.Color4Extensions; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Shapes; -using osu.Framework.Input.States; +using osu.Framework.Input.Events; using osu.Game.Graphics; using osu.Game.Graphics.Sprites; using osu.Game.Online.API.Requests.Responses; @@ -184,16 +184,16 @@ namespace osu.Game.Overlays.BeatmapSet.Scores BorderColour = rankText.Colour = colours.Yellow; } - protected override bool OnHover(InputState state) + protected override bool OnHover(HoverEvent e) { background.FadeIn(fade_duration, Easing.OutQuint); - return base.OnHover(state); + return base.OnHover(e); } - protected override void OnHoverLost(InputState state) + protected override void OnHoverLost(HoverLostEvent e) { background.FadeOut(fade_duration, Easing.OutQuint); - base.OnHoverLost(state); + base.OnHoverLost(e); } private class InfoColumn : FillFlowContainer diff --git a/osu.Game/Overlays/BeatmapSetOverlay.cs b/osu.Game/Overlays/BeatmapSetOverlay.cs index f66e103a21..23c8ec3aab 100644 --- a/osu.Game/Overlays/BeatmapSetOverlay.cs +++ b/osu.Game/Overlays/BeatmapSetOverlay.cs @@ -7,7 +7,7 @@ using osu.Framework.Extensions.Color4Extensions; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Shapes; -using osu.Framework.Input.States; +using osu.Framework.Input.Events; using osu.Game.Beatmaps; using osu.Game.Graphics; using osu.Game.Graphics.Containers; @@ -127,7 +127,7 @@ namespace osu.Game.Overlays FadeEdgeEffectTo(0, WaveContainer.DISAPPEAR_DURATION, Easing.Out).OnComplete(_ => BeatmapSet = null); } - protected override bool OnClick(InputState state) + protected override bool OnClick(ClickEvent e) { State = Visibility.Hidden; return true; diff --git a/osu.Game/Overlays/Chat/ChannelListItem.cs b/osu.Game/Overlays/Chat/ChannelListItem.cs index 7a60bf9f47..8df29c89f2 100644 --- a/osu.Game/Overlays/Chat/ChannelListItem.cs +++ b/osu.Game/Overlays/Chat/ChannelListItem.cs @@ -9,7 +9,7 @@ using osu.Framework.Allocation; using osu.Framework.Configuration; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; -using osu.Framework.Input.States; +using osu.Framework.Input.Events; using osu.Game.Graphics; using osu.Game.Graphics.Sprites; using osu.Game.Online.Chat; @@ -155,15 +155,15 @@ namespace osu.Game.Overlays.Chat FinishTransforms(true); } - protected override bool OnHover(InputState state) + protected override bool OnHover(HoverEvent e) { if (!channel.Joined.Value) name.FadeColour(hoverColour, 50, Easing.OutQuint); - return base.OnHover(state); + return base.OnHover(e); } - protected override void OnHoverLost(InputState state) + protected override void OnHoverLost(HoverLostEvent e) { if (!channel.Joined.Value) name.FadeColour(Color4.White, transition_duration); diff --git a/osu.Game/Overlays/Chat/ChannelSelectionOverlay.cs b/osu.Game/Overlays/Chat/ChannelSelectionOverlay.cs index 4e4fe4f10a..a86465b77b 100644 --- a/osu.Game/Overlays/Chat/ChannelSelectionOverlay.cs +++ b/osu.Game/Overlays/Chat/ChannelSelectionOverlay.cs @@ -10,7 +10,7 @@ using osu.Framework.Extensions.Color4Extensions; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Shapes; -using osu.Framework.Input.States; +using osu.Framework.Input.Events; using osu.Game.Graphics; using osu.Game.Graphics.Backgrounds; using osu.Game.Graphics.Sprites; @@ -150,10 +150,10 @@ namespace osu.Game.Overlays.Chat headerBg.Colour = colours.Gray2.Opacity(0.75f); } - protected override void OnFocus(InputState state) + protected override void OnFocus(FocusEvent e) { GetContainingInputManager().ChangeFocus(search); - base.OnFocus(state); + base.OnFocus(e); } protected override void PopIn() diff --git a/osu.Game/Overlays/Chat/ChatTabControl.cs b/osu.Game/Overlays/Chat/ChatTabControl.cs index d9327e73e8..ec4fd85901 100644 --- a/osu.Game/Overlays/Chat/ChatTabControl.cs +++ b/osu.Game/Overlays/Chat/ChatTabControl.cs @@ -17,8 +17,7 @@ using OpenTK.Input; using OpenTK.Graphics; using osu.Framework.Configuration; using System; -using osu.Framework.Input.EventArgs; -using osu.Framework.Input.States; +using osu.Framework.Input.Events; using osu.Game.Graphics.Containers; namespace osu.Game.Overlays.Chat @@ -144,9 +143,9 @@ namespace osu.Game.Overlays.Chat textBold.FadeOut(transition_length, Easing.OutQuint); } - protected override bool OnMouseUp(InputState state, MouseUpEventArgs args) + protected override bool OnMouseUp(MouseUpEvent e) { - if (args.Button == MouseButton.Middle) + if (e.Button == MouseButton.Middle) { closeButton.Action(); return true; @@ -155,7 +154,7 @@ namespace osu.Game.Overlays.Chat return false; } - protected override bool OnHover(InputState state) + protected override bool OnHover(HoverEvent e) { if (IsRemovable) closeButton.FadeIn(200, Easing.OutQuint); @@ -165,7 +164,7 @@ namespace osu.Game.Overlays.Chat return true; } - protected override void OnHoverLost(InputState state) + protected override void OnHoverLost(HoverLostEvent e) { closeButton.FadeOut(200, Easing.OutQuint); updateState(); @@ -291,28 +290,28 @@ namespace osu.Game.Overlays.Chat }; } - protected override bool OnMouseDown(InputState state, MouseDownEventArgs args) + protected override bool OnMouseDown(MouseDownEvent e) { icon.ScaleTo(0.5f, 1000, Easing.OutQuint); - return base.OnMouseDown(state, args); + return base.OnMouseDown(e); } - protected override bool OnMouseUp(InputState state, MouseUpEventArgs args) + protected override bool OnMouseUp(MouseUpEvent e) { icon.ScaleTo(0.75f, 1000, Easing.OutElastic); - return base.OnMouseUp(state, args); + return base.OnMouseUp(e); } - protected override bool OnHover(InputState state) + protected override bool OnHover(HoverEvent e) { icon.FadeColour(Color4.Red, 200, Easing.OutQuint); - return base.OnHover(state); + return base.OnHover(e); } - protected override void OnHoverLost(InputState state) + protected override void OnHoverLost(HoverLostEvent e) { icon.FadeColour(Color4.White, 200, Easing.OutQuint); - base.OnHoverLost(state); + base.OnHoverLost(e); } } diff --git a/osu.Game/Overlays/ChatOverlay.cs b/osu.Game/Overlays/ChatOverlay.cs index dcf5b74d08..0424481f77 100644 --- a/osu.Game/Overlays/ChatOverlay.cs +++ b/osu.Game/Overlays/ChatOverlay.cs @@ -13,7 +13,7 @@ using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Shapes; using osu.Framework.Graphics.UserInterface; -using osu.Framework.Input.States; +using osu.Framework.Input.Events; using osu.Framework.Threading; using osu.Game.Configuration; using osu.Game.Graphics; @@ -191,25 +191,25 @@ namespace osu.Game.Overlays public void OpenChannel(Channel channel) => addChannel(channel); - protected override bool OnDragStart(InputState state) + protected override bool OnDragStart(DragStartEvent e) { isDragging = tabsArea.IsHovered; if (!isDragging) - return base.OnDragStart(state); + return base.OnDragStart(e); startDragChatHeight = ChatHeight.Value; return true; } - protected override bool OnDrag(InputState state) + protected override bool OnDrag(DragEvent e) { if (isDragging) { - Trace.Assert(state.Mouse.PositionMouseDown != null); + Trace.Assert(e.Mouse.PositionMouseDown != null); // ReSharper disable once PossibleInvalidOperationException - double targetChatHeight = startDragChatHeight - (state.Mouse.Position.Y - state.Mouse.PositionMouseDown.Value.Y) / Parent.DrawSize.Y; + double targetChatHeight = startDragChatHeight - (e.Mouse.Position.Y - e.Mouse.PositionMouseDown.Value.Y) / Parent.DrawSize.Y; // If the channel selection screen is shown, mind its minimum height if (channelSelection.State == Visibility.Visible && targetChatHeight > 1f - channel_selection_min_height) @@ -221,10 +221,10 @@ namespace osu.Game.Overlays return true; } - protected override bool OnDragEnd(InputState state) + protected override bool OnDragEnd(DragEndEvent e) { isDragging = false; - return base.OnDragEnd(state); + return base.OnDragEnd(e); } public void APIStateChanged(APIAccess api, APIState state) @@ -242,11 +242,11 @@ namespace osu.Game.Overlays public override bool AcceptsFocus => true; - protected override void OnFocus(InputState state) + protected override void OnFocus(FocusEvent e) { //this is necessary as textbox is masked away and therefore can't get focus :( GetContainingInputManager().ChangeFocus(textbox); - base.OnFocus(state); + base.OnFocus(e); } protected override void PopIn() diff --git a/osu.Game/Overlays/Dialog/PopupDialog.cs b/osu.Game/Overlays/Dialog/PopupDialog.cs index ccbb7cc496..f421d2202c 100644 --- a/osu.Game/Overlays/Dialog/PopupDialog.cs +++ b/osu.Game/Overlays/Dialog/PopupDialog.cs @@ -8,8 +8,7 @@ using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Shapes; using osu.Framework.Graphics.Sprites; -using osu.Framework.Input.EventArgs; -using osu.Framework.Input.States; +using osu.Framework.Input.Events; using osu.Game.Graphics; using osu.Game.Graphics.Backgrounds; using osu.Game.Graphics.Containers; @@ -206,12 +205,12 @@ namespace osu.Game.Overlays.Dialog return base.OnPressed(action); } - protected override bool OnKeyDown(InputState state, KeyDownEventArgs args) + protected override bool OnKeyDown(KeyDownEvent e) { - if (args.Repeat) return false; + if (e.Repeat) return false; // press button at number if 1-9 on number row or keypad are pressed - var k = args.Key; + var k = e.Key; if (k >= Key.Number1 && k <= Key.Number9) { pressButtonAtIndex(k - Key.Number1); @@ -224,7 +223,7 @@ namespace osu.Game.Overlays.Dialog return true; } - return base.OnKeyDown(state, args); + return base.OnKeyDown(e); } protected override void PopIn() diff --git a/osu.Game/Overlays/Direct/DirectGridPanel.cs b/osu.Game/Overlays/Direct/DirectGridPanel.cs index 44b6a75d3c..6eef2fc500 100644 --- a/osu.Game/Overlays/Direct/DirectGridPanel.cs +++ b/osu.Game/Overlays/Direct/DirectGridPanel.cs @@ -227,15 +227,15 @@ namespace osu.Game.Overlays.Direct PreviewPlaying.ValueChanged += _ => updateStatusContainer(); } - protected override bool OnHover(InputState state) + protected override bool OnHover(HoverEvent e) { updateStatusContainer(); - return base.OnHover(state); + return base.OnHover(e); } - protected override void OnHoverLost(InputState state) + protected override void OnHoverLost(HoverLostEvent e) { - base.OnHoverLost(state); + base.OnHoverLost(e); updateStatusContainer(); } diff --git a/osu.Game/Overlays/Direct/DirectPanel.cs b/osu.Game/Overlays/Direct/DirectPanel.cs index 2ee1857ca2..5c7c34a0ed 100644 --- a/osu.Game/Overlays/Direct/DirectPanel.cs +++ b/osu.Game/Overlays/Direct/DirectPanel.cs @@ -10,7 +10,7 @@ using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Shapes; using osu.Framework.Graphics.Sprites; -using osu.Framework.Input.States; +using osu.Framework.Input.Events; using osu.Game.Audio; using osu.Game.Beatmaps; using osu.Game.Beatmaps.Drawables; @@ -121,27 +121,27 @@ namespace osu.Game.Overlays.Direct } } - protected override bool OnHover(InputState state) + protected override bool OnHover(HoverEvent e) { content.TweenEdgeEffectTo(edgeEffectHovered, hover_transition_time, Easing.OutQuint); content.MoveToY(-4, hover_transition_time, Easing.OutQuint); if (FadePlayButton) PlayButton.FadeIn(120, Easing.InOutQuint); - return base.OnHover(state); + return base.OnHover(e); } - protected override void OnHoverLost(InputState state) + protected override void OnHoverLost(HoverLostEvent e) { content.TweenEdgeEffectTo(edgeEffectNormal, hover_transition_time, Easing.OutQuint); content.MoveToY(0, hover_transition_time, Easing.OutQuint); if (FadePlayButton && !PreviewPlaying) PlayButton.FadeOut(120, Easing.InOutQuint); - base.OnHoverLost(state); + base.OnHoverLost(e); } - protected override bool OnClick(InputState state) + protected override bool OnClick(ClickEvent e) { ShowInformation(); return true; diff --git a/osu.Game/Overlays/Direct/PlayButton.cs b/osu.Game/Overlays/Direct/PlayButton.cs index 092c9ddbea..ac7a26fca3 100644 --- a/osu.Game/Overlays/Direct/PlayButton.cs +++ b/osu.Game/Overlays/Direct/PlayButton.cs @@ -5,7 +5,7 @@ using osu.Framework.Allocation; using osu.Framework.Configuration; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; -using osu.Framework.Input.States; +using osu.Framework.Input.Events; using osu.Game.Audio; using osu.Game.Beatmaps; using osu.Game.Graphics; @@ -93,23 +93,23 @@ namespace osu.Game.Overlays.Direct hoverColour = colour.Yellow; } - protected override bool OnClick(InputState state) + protected override bool OnClick(ClickEvent e) { Playing.Toggle(); return true; } - protected override bool OnHover(InputState state) + protected override bool OnHover(HoverEvent e) { icon.FadeColour(hoverColour, 120, Easing.InOutQuint); - return base.OnHover(state); + return base.OnHover(e); } - protected override void OnHoverLost(InputState state) + protected override void OnHoverLost(HoverLostEvent e) { if (!Playing.Value) icon.FadeColour(Color4.White, 120, Easing.InOutQuint); - base.OnHoverLost(state); + base.OnHoverLost(e); } private void playingStateChanged(bool playing) diff --git a/osu.Game/Overlays/KeyBinding/KeyBindingRow.cs b/osu.Game/Overlays/KeyBinding/KeyBindingRow.cs index d480bedc5e..fb17635806 100644 --- a/osu.Game/Overlays/KeyBinding/KeyBindingRow.cs +++ b/osu.Game/Overlays/KeyBinding/KeyBindingRow.cs @@ -10,7 +10,7 @@ using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Shapes; using osu.Framework.Input.Bindings; -using osu.Framework.Input.EventArgs; +using osu.Framework.Input.Events; using osu.Framework.Input.States; using osu.Game.Graphics; using osu.Game.Graphics.Containers; @@ -125,18 +125,18 @@ namespace osu.Game.Overlays.KeyBinding } } - protected override bool OnHover(InputState state) + protected override bool OnHover(HoverEvent e) { FadeEdgeEffectTo(1, transition_time, Easing.OutQuint); - return base.OnHover(state); + return base.OnHover(e); } - protected override void OnHoverLost(InputState state) + protected override void OnHoverLost(HoverLostEvent e) { FadeEdgeEffectTo(0, transition_time, Easing.OutQuint); - base.OnHoverLost(state); + base.OnHoverLost(e); } public override bool AcceptsFocus => bindTarget == null; @@ -149,16 +149,16 @@ namespace osu.Game.Overlays.KeyBinding private bool isModifier(Key k) => k < Key.F1; - protected override bool OnClick(InputState state) => true; + protected override bool OnClick(ClickEvent e) => true; - protected override bool OnMouseDown(InputState state, MouseDownEventArgs args) + protected override bool OnMouseDown(MouseDownEvent e) { if (!HasFocus || !bindTarget.IsHovered) - return base.OnMouseDown(state, args); + return base.OnMouseDown(e); if (!AllowMainMouseButtons) { - switch (args.Button) + switch (e.Button) { case MouseButton.Left: case MouseButton.Right: @@ -170,11 +170,11 @@ namespace osu.Game.Overlays.KeyBinding return true; } - protected override bool OnMouseUp(InputState state, MouseUpEventArgs args) + protected override bool OnMouseUp(MouseUpEvent e) { // don't do anything until the last button is released. if (!HasFocus || state.Mouse.Buttons.Any()) - return base.OnMouseUp(state, args); + return base.OnMouseUp(e); if (bindTarget.IsHovered) finalise(); @@ -183,27 +183,27 @@ namespace osu.Game.Overlays.KeyBinding return true; } - protected override bool OnScroll(InputState state) + protected override bool OnScroll(ScrollEvent e) { if (HasFocus) { if (bindTarget.IsHovered) { - bindTarget.UpdateKeyCombination(KeyCombination.FromInputState(state, state.Mouse.ScrollDelta)); + bindTarget.UpdateKeyCombination(KeyCombination.FromInputState(e, e.Mouse.ScrollDelta)); finalise(); return true; } } - return base.OnScroll(state); + return base.OnScroll(e); } - protected override bool OnKeyDown(InputState state, KeyDownEventArgs args) + protected override bool OnKeyDown(KeyDownEvent e) { if (!HasFocus) return false; - switch (args.Key) + switch (e.Key) { case Key.Delete: { @@ -219,14 +219,14 @@ namespace osu.Game.Overlays.KeyBinding } bindTarget.UpdateKeyCombination(KeyCombination.FromInputState(state)); - if (!isModifier(args.Key)) finalise(); + if (!isModifier(e.Key)) finalise(); return true; } - protected override bool OnKeyUp(InputState state, KeyUpEventArgs args) + protected override bool OnKeyUp(KeyUpEvent e) { - if (!HasFocus) return base.OnKeyUp(state, args); + if (!HasFocus) return base.OnKeyUp(e); finalise(); return true; @@ -246,7 +246,7 @@ namespace osu.Game.Overlays.KeyBinding protected override bool OnJoystickRelease(InputState state, JoystickEventArgs args) { if (!HasFocus) - return base.OnJoystickRelease(state, args); + return base.OnJoystickRelease(args); finalise(); return true; @@ -273,7 +273,7 @@ namespace osu.Game.Overlays.KeyBinding pressAKey.BypassAutoSizeAxes |= Axes.Y; } - protected override void OnFocus(InputState state) + protected override void OnFocus(FocusEvent e) { AutoSizeDuration = 500; AutoSizeEasing = Easing.OutQuint; @@ -282,13 +282,13 @@ namespace osu.Game.Overlays.KeyBinding pressAKey.BypassAutoSizeAxes &= ~Axes.Y; updateBindTarget(); - base.OnFocus(state); + base.OnFocus(e); } - protected override void OnFocusLost(InputState state) + protected override void OnFocusLost(FocusLostEvent e) { finalise(); - base.OnFocusLost(state); + base.OnFocusLost(e); } private void updateBindTarget() @@ -367,16 +367,16 @@ namespace osu.Game.Overlays.KeyBinding hoverColour = colours.YellowDark; } - protected override bool OnHover(InputState state) + protected override bool OnHover(HoverEvent e) { updateHoverState(); - return base.OnHover(state); + return base.OnHover(e); } - protected override void OnHoverLost(InputState state) + protected override void OnHoverLost(HoverLostEvent e) { updateHoverState(); - base.OnHoverLost(state); + base.OnHoverLost(e); } private void updateHoverState() diff --git a/osu.Game/Overlays/MainSettings.cs b/osu.Game/Overlays/MainSettings.cs index b22904e724..736843ee4d 100644 --- a/osu.Game/Overlays/MainSettings.cs +++ b/osu.Game/Overlays/MainSettings.cs @@ -6,8 +6,7 @@ using osu.Framework.Allocation; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Framework.Input.Bindings; -using osu.Framework.Input.EventArgs; -using osu.Framework.Input.States; +using osu.Framework.Input.Events; using osu.Game.Graphics; using osu.Game.Graphics.Containers; using osu.Game.Graphics.Sprites; @@ -138,16 +137,16 @@ namespace osu.Game.Overlays }; } - protected override bool OnMouseDown(InputState state, MouseDownEventArgs args) + protected override bool OnMouseDown(MouseDownEvent e) { aspect.ScaleTo(0.75f, 2000, Easing.OutQuint); - return base.OnMouseDown(state, args); + return base.OnMouseDown(e); } - protected override bool OnMouseUp(InputState state, MouseUpEventArgs args) + protected override bool OnMouseUp(MouseUpEvent e) { aspect.ScaleTo(1, 1000, Easing.OutElastic); - return base.OnMouseUp(state, args); + return base.OnMouseUp(e); } public bool OnPressed(GlobalAction action) diff --git a/osu.Game/Overlays/MedalOverlay.cs b/osu.Game/Overlays/MedalOverlay.cs index bd67a718a7..7e0954899d 100644 --- a/osu.Game/Overlays/MedalOverlay.cs +++ b/osu.Game/Overlays/MedalOverlay.cs @@ -19,8 +19,7 @@ using osu.Framework.Graphics.Textures; using OpenTK.Input; using osu.Framework.Graphics.Shapes; using System; -using System.Linq; -using osu.Framework.Input.States; +using osu.Framework.Input.Events; using osu.Framework.MathUtils; namespace osu.Game.Overlays @@ -176,15 +175,15 @@ namespace osu.Game.Overlays particleContainer.Add(new MedalParticle(RNG.Next(0, 359))); } - protected override bool OnClick(InputState state) + protected override bool OnClick(ClickEvent e) { dismiss(); return true; } - protected override void OnFocusLost(InputState state) + protected override void OnFocusLost(FocusLostEvent e) { - if (state.Keyboard.Keys.Contains(Key.Escape)) dismiss(); + if (e.Keyboard.Keys.Contains(Key.Escape)) dismiss(); } private const double initial_duration = 400; diff --git a/osu.Game/Overlays/Mods/ModButton.cs b/osu.Game/Overlays/Mods/ModButton.cs index 8024f9a732..40b9793be4 100644 --- a/osu.Game/Overlays/Mods/ModButton.cs +++ b/osu.Game/Overlays/Mods/ModButton.cs @@ -13,8 +13,7 @@ using osu.Game.Rulesets.UI; using System; using System.Linq; using osu.Framework.Graphics.Cursor; -using osu.Framework.Input.EventArgs; -using osu.Framework.Input.States; +using osu.Framework.Input.Events; using osu.Game.Graphics.UserInterface; namespace osu.Game.Overlays.Mods @@ -149,20 +148,20 @@ namespace osu.Game.Overlays.Mods public virtual Mod SelectedMod => Mods.ElementAtOrDefault(selectedIndex); - protected override bool OnMouseDown(InputState state, MouseDownEventArgs args) + protected override bool OnMouseDown(MouseDownEvent e) { scaleContainer.ScaleTo(0.9f, 800, Easing.Out); - return base.OnMouseDown(state, args); + return base.OnMouseDown(e); } - protected override bool OnMouseUp(InputState state, MouseUpEventArgs args) + protected override bool OnMouseUp(MouseUpEvent e) { scaleContainer.ScaleTo(1, 500, Easing.OutElastic); // only trigger the event if we are inside the area of the button if (Contains(ToScreenSpace(state.Mouse.Position - Position))) { - switch (args.Button) + switch (e.Button) { case MouseButton.Left: SelectNext(1); diff --git a/osu.Game/Overlays/Mods/ModSection.cs b/osu.Game/Overlays/Mods/ModSection.cs index 37bffaaf12..3ba49042e5 100644 --- a/osu.Game/Overlays/Mods/ModSection.cs +++ b/osu.Game/Overlays/Mods/ModSection.cs @@ -10,8 +10,7 @@ using osu.Game.Rulesets.Mods; using System; using System.Linq; using System.Collections.Generic; -using osu.Framework.Input.EventArgs; -using osu.Framework.Input.States; +using osu.Framework.Input.Events; namespace osu.Game.Overlays.Mods { @@ -55,16 +54,16 @@ namespace osu.Game.Overlays.Mods private ModButton[] buttons = { }; - protected override bool OnKeyDown(InputState state, KeyDownEventArgs args) + protected override bool OnKeyDown(KeyDownEvent e) { if (ToggleKeys != null) { - var index = Array.IndexOf(ToggleKeys, args.Key); + var index = Array.IndexOf(ToggleKeys, e.Key); if (index > -1 && index < buttons.Length) buttons[index].SelectNext(state.Keyboard.ShiftPressed ? -1 : 1); } - return base.OnKeyDown(state, args); + return base.OnKeyDown(e); } public void DeselectAll() => DeselectTypes(buttons.Select(b => b.SelectedMod?.GetType()).Where(t => t != null)); diff --git a/osu.Game/Overlays/Music/PlaylistItem.cs b/osu.Game/Overlays/Music/PlaylistItem.cs index ee3f22290b..c0a59df767 100644 --- a/osu.Game/Overlays/Music/PlaylistItem.cs +++ b/osu.Game/Overlays/Music/PlaylistItem.cs @@ -8,8 +8,7 @@ using osu.Framework.Allocation; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Sprites; -using osu.Framework.Input.EventArgs; -using osu.Framework.Input.States; +using osu.Framework.Input.Events; using osu.Framework.Localisation; using osu.Game.Beatmaps; using osu.Game.Graphics; @@ -37,16 +36,16 @@ namespace osu.Game.Overlays.Music public bool IsDraggable { get; private set; } - protected override bool OnMouseDown(InputState state, MouseDownEventArgs args) + protected override bool OnMouseDown(MouseDownEvent e) { IsDraggable = handle.IsHovered; - return base.OnMouseDown(state, args); + return base.OnMouseDown(e); } - protected override bool OnMouseUp(InputState state, MouseUpEventArgs args) + protected override bool OnMouseUp(MouseUpEvent e) { IsDraggable = false; - return base.OnMouseUp(state, args); + return base.OnMouseUp(e); } private bool selected; @@ -123,19 +122,19 @@ namespace osu.Game.Overlays.Music }); } - protected override bool OnHover(InputState state) + protected override bool OnHover(HoverEvent e) { handle.FadeIn(fade_duration); - return base.OnHover(state); + return base.OnHover(e); } - protected override void OnHoverLost(InputState state) + protected override void OnHoverLost(HoverLostEvent e) { handle.FadeOut(fade_duration); } - protected override bool OnClick(InputState state) + protected override bool OnClick(ClickEvent e) { OnSelect?.Invoke(BeatmapSetInfo); return true; diff --git a/osu.Game/Overlays/Music/PlaylistList.cs b/osu.Game/Overlays/Music/PlaylistList.cs index 32674f0a84..48c07846b8 100644 --- a/osu.Game/Overlays/Music/PlaylistList.cs +++ b/osu.Game/Overlays/Music/PlaylistList.cs @@ -8,7 +8,7 @@ using osu.Framework.Allocation; using osu.Framework.Configuration; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; -using osu.Framework.Input.States; +using osu.Framework.Input.Events; using osu.Game.Beatmaps; using osu.Game.Graphics.Containers; using OpenTK; @@ -115,25 +115,25 @@ namespace osu.Game.Overlays.Music private Vector2 nativeDragPosition; private PlaylistItem draggedItem; - protected override bool OnDragStart(InputState state) + protected override bool OnDragStart(DragStartEvent e) { - nativeDragPosition = state.Mouse.NativeState.Position; + nativeDragPosition = e.Mouse.NativeState.Position; draggedItem = items.FirstOrDefault(d => d.IsDraggable); - return draggedItem != null || base.OnDragStart(state); + return draggedItem != null || base.OnDragStart(e); } - protected override bool OnDrag(InputState state) + protected override bool OnDrag(DragEvent e) { - nativeDragPosition = state.Mouse.NativeState.Position; + nativeDragPosition = e.Mouse.NativeState.Position; if (draggedItem == null) - return base.OnDrag(state); + return base.OnDrag(e); return true; } - protected override bool OnDragEnd(InputState state) + protected override bool OnDragEnd(DragEndEvent e) { - nativeDragPosition = state.Mouse.NativeState.Position; - var handled = draggedItem != null || base.OnDragEnd(state); + nativeDragPosition = e.Mouse.NativeState.Position; + var handled = draggedItem != null || base.OnDragEnd(e); draggedItem = null; return handled; diff --git a/osu.Game/Overlays/MusicController.cs b/osu.Game/Overlays/MusicController.cs index 5cccb2b0aa..fc2fed890b 100644 --- a/osu.Game/Overlays/MusicController.cs +++ b/osu.Game/Overlays/MusicController.cs @@ -13,7 +13,7 @@ using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Shapes; using osu.Framework.Graphics.Sprites; using osu.Framework.Graphics.Textures; -using osu.Framework.Input.States; +using osu.Framework.Input.Events; using osu.Framework.Localisation; using osu.Framework.Threading; using osu.Game.Beatmaps; @@ -459,18 +459,18 @@ namespace osu.Game.Overlays { private Vector2 dragStart; - protected override bool OnDragStart(InputState state) + protected override bool OnDragStart(DragStartEvent e) { - base.OnDragStart(state); - dragStart = state.Mouse.Position; + base.OnDragStart(e); + dragStart = e.Mouse.Position; return true; } - protected override bool OnDrag(InputState state) + protected override bool OnDrag(DragEvent e) { - if (base.OnDrag(state)) return true; + if (base.OnDrag(e)) return true; - Vector2 change = state.Mouse.Position - dragStart; + Vector2 change = e.Mouse.Position - dragStart; // Diminish the drag distance as we go further to simulate "rubber band" feeling. change *= change.Length <= 0 ? 0 : (float)Math.Pow(change.Length, 0.7f) / change.Length; @@ -479,10 +479,10 @@ namespace osu.Game.Overlays return true; } - protected override bool OnDragEnd(InputState state) + protected override bool OnDragEnd(DragEndEvent e) { this.MoveTo(Vector2.Zero, 800, Easing.OutElastic); - return base.OnDragEnd(state); + return base.OnDragEnd(e); } } } diff --git a/osu.Game/Overlays/Notifications/Notification.cs b/osu.Game/Overlays/Notifications/Notification.cs index 6798ae2bb2..aa2b248bc4 100644 --- a/osu.Game/Overlays/Notifications/Notification.cs +++ b/osu.Game/Overlays/Notifications/Notification.cs @@ -11,7 +11,7 @@ using osu.Game.Graphics; using OpenTK; using OpenTK.Graphics; using osu.Framework.Graphics.Shapes; -using osu.Framework.Input.States; +using osu.Framework.Input.Events; using osu.Game.Graphics.Containers; namespace osu.Game.Overlays.Notifications @@ -118,19 +118,19 @@ namespace osu.Game.Overlays.Notifications }); } - protected override bool OnHover(InputState state) + protected override bool OnHover(HoverEvent e) { closeButton.FadeIn(75); - return base.OnHover(state); + return base.OnHover(e); } - protected override void OnHoverLost(InputState state) + protected override void OnHoverLost(HoverLostEvent e) { closeButton.FadeOut(75); - base.OnHoverLost(state); + base.OnHoverLost(e); } - protected override bool OnClick(InputState state) + protected override bool OnClick(ClickEvent e) { if (Activated?.Invoke() ?? true) Close(); @@ -185,16 +185,16 @@ namespace osu.Game.Overlays.Notifications hoverColour = colours.Yellow; } - protected override bool OnHover(InputState state) + protected override bool OnHover(HoverEvent e) { this.FadeColour(hoverColour, 200); - return base.OnHover(state); + return base.OnHover(e); } - protected override void OnHoverLost(InputState state) + protected override void OnHoverLost(HoverLostEvent e) { this.FadeColour(OsuColour.Gray(0.2f), 200); - base.OnHoverLost(state); + base.OnHoverLost(e); } } diff --git a/osu.Game/Overlays/Profile/Header/BadgeContainer.cs b/osu.Game/Overlays/Profile/Header/BadgeContainer.cs index 33baaf1fff..6a87db4211 100644 --- a/osu.Game/Overlays/Profile/Header/BadgeContainer.cs +++ b/osu.Game/Overlays/Profile/Header/BadgeContainer.cs @@ -9,7 +9,7 @@ using osu.Framework.Graphics.Cursor; using osu.Framework.Graphics.Shapes; using osu.Framework.Graphics.Sprites; using osu.Framework.Graphics.Textures; -using osu.Framework.Input.States; +using osu.Framework.Input.Events; using osu.Game.Graphics; using osu.Game.Graphics.Sprites; using osu.Game.Users; @@ -153,13 +153,13 @@ namespace osu.Game.Overlays.Profile.Header this.hoverLostAction = hoverLostAction; } - protected override bool OnHover(InputState state) + protected override bool OnHover(HoverEvent e) { hoverAction(); return true; } - protected override void OnHoverLost(InputState state) => hoverLostAction(); + protected override void OnHoverLost(HoverLostEvent e) => hoverLostAction(); } private class DrawableBadge : Container, IHasTooltip diff --git a/osu.Game/Overlays/Profile/Header/RankGraph.cs b/osu.Game/Overlays/Profile/Header/RankGraph.cs index a059792796..2abfaa1a6d 100644 --- a/osu.Game/Overlays/Profile/Header/RankGraph.cs +++ b/osu.Game/Overlays/Profile/Header/RankGraph.cs @@ -10,7 +10,7 @@ using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Shapes; using osu.Framework.Graphics.Sprites; -using osu.Framework.Input.States; +using osu.Framework.Input.Events; using osu.Game.Graphics; using osu.Game.Graphics.Sprites; using osu.Game.Graphics.UserInterface; @@ -137,25 +137,25 @@ namespace osu.Game.Overlays.Profile.Header relativeText.Text = dayIndex + 1 == ranks.Length ? "Now" : $"{ranked_days - ranks[dayIndex].Key} days ago"; } - protected override bool OnHover(InputState state) + protected override bool OnHover(HoverEvent e) { if (ranks?.Length > 1) { - graph.UpdateBallPosition(state.Mouse.Position.X); + graph.UpdateBallPosition(e.Mouse.Position.X); graph.ShowBall(); } - return base.OnHover(state); + return base.OnHover(e); } - protected override bool OnMouseMove(InputState state) + protected override bool OnMouseMove(MouseMoveEvent e) { if (ranks?.Length > 1) - graph.UpdateBallPosition(state.Mouse.Position.X); + graph.UpdateBallPosition(e.Mouse.Position.X); - return base.OnMouseMove(state); + return base.OnMouseMove(e); } - protected override void OnHoverLost(InputState state) + protected override void OnHoverLost(HoverLostEvent e) { if (ranks?.Length > 1) { @@ -163,7 +163,7 @@ namespace osu.Game.Overlays.Profile.Header updateRankTexts(); } - base.OnHoverLost(state); + base.OnHoverLost(e); } private class RankChartLineGraph : LineGraph diff --git a/osu.Game/Overlays/Profile/Sections/DrawableProfileRow.cs b/osu.Game/Overlays/Profile/Sections/DrawableProfileRow.cs index 3a4bfc6804..165299e8c0 100644 --- a/osu.Game/Overlays/Profile/Sections/DrawableProfileRow.cs +++ b/osu.Game/Overlays/Profile/Sections/DrawableProfileRow.cs @@ -6,7 +6,7 @@ using osu.Framework.Extensions.Color4Extensions; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Shapes; -using osu.Framework.Input.States; +using osu.Framework.Input.Events; using osu.Game.Graphics; using OpenTK; using OpenTK.Graphics; @@ -105,20 +105,20 @@ namespace osu.Game.Overlays.Profile.Sections coloredBackground.Colour = underscoreLine.Colour = colour.Gray4; } - protected override bool OnClick(InputState state) => true; + protected override bool OnClick(ClickEvent e) => true; - protected override bool OnHover(InputState state) + protected override bool OnHover(HoverEvent e) { background.FadeIn(fade_duration, Easing.OutQuint); underscoreLine.FadeOut(fade_duration, Easing.OutQuint); return true; } - protected override void OnHoverLost(InputState state) + protected override void OnHoverLost(HoverLostEvent e) { background.FadeOut(fade_duration, Easing.OutQuint); underscoreLine.FadeIn(fade_duration, Easing.OutQuint); - base.OnHoverLost(state); + base.OnHoverLost(e); } } } diff --git a/osu.Game/Overlays/Profile/Sections/Kudosu/KudosuInfo.cs b/osu.Game/Overlays/Profile/Sections/Kudosu/KudosuInfo.cs index 38bc419838..788041205b 100644 --- a/osu.Game/Overlays/Profile/Sections/Kudosu/KudosuInfo.cs +++ b/osu.Game/Overlays/Profile/Sections/Kudosu/KudosuInfo.cs @@ -8,7 +8,7 @@ using osu.Framework.Extensions.Color4Extensions; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Shapes; -using osu.Framework.Input.States; +using osu.Framework.Input.Events; using osu.Game.Graphics; using osu.Game.Graphics.Containers; using osu.Game.Graphics.Sprites; @@ -70,7 +70,7 @@ namespace osu.Game.Overlays.Profile.Sections.Kudosu }; } - protected override bool OnClick(InputState state) => true; + protected override bool OnClick(ClickEvent e) => true; private class CountSection : Container { diff --git a/osu.Game/Overlays/SearchableList/SearchableListOverlay.cs b/osu.Game/Overlays/SearchableList/SearchableListOverlay.cs index f9e4a983bb..df249b0b88 100644 --- a/osu.Game/Overlays/SearchableList/SearchableListOverlay.cs +++ b/osu.Game/Overlays/SearchableList/SearchableListOverlay.cs @@ -5,7 +5,7 @@ using OpenTK.Graphics; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Shapes; -using osu.Framework.Input.States; +using osu.Framework.Input.Events; using osu.Game.Graphics.Backgrounds; using osu.Game.Graphics.Containers; @@ -101,7 +101,7 @@ namespace osu.Game.Overlays.SearchableList scrollContainer.Padding = new MarginPadding { Top = Header.Height + Filter.Height }; } - protected override void OnFocus(InputState state) + protected override void OnFocus(FocusEvent e) { GetContainingInputManager().ChangeFocus(Filter.Search); } diff --git a/osu.Game/Overlays/Settings/Sections/General/LoginSettings.cs b/osu.Game/Overlays/Settings/Sections/General/LoginSettings.cs index c7f98f4107..11a3d36779 100644 --- a/osu.Game/Overlays/Settings/Sections/General/LoginSettings.cs +++ b/osu.Game/Overlays/Settings/Sections/General/LoginSettings.cs @@ -16,7 +16,7 @@ using System.ComponentModel; using osu.Game.Graphics; using OpenTK.Graphics; using osu.Framework.Extensions.Color4Extensions; -using osu.Framework.Input.States; +using osu.Framework.Input.Events; using RectangleF = osu.Framework.Graphics.Primitives.RectangleF; using Container = osu.Framework.Graphics.Containers.Container; @@ -175,12 +175,12 @@ namespace osu.Game.Overlays.Settings.Sections.General public override bool AcceptsFocus => true; - protected override bool OnClick(InputState state) => true; + protected override bool OnClick(ClickEvent e) => true; - protected override void OnFocus(InputState state) + protected override void OnFocus(FocusEvent e) { if (form != null) GetContainingInputManager().ChangeFocus(form); - base.OnFocus(state); + base.OnFocus(e); } private class LoginForm : FillFlowContainer @@ -244,9 +244,9 @@ namespace osu.Game.Overlays.Settings.Sections.General public override bool AcceptsFocus => true; - protected override bool OnClick(InputState state) => true; + protected override bool OnClick(ClickEvent e) => true; - protected override void OnFocus(InputState state) + protected override void OnFocus(FocusEvent e) { Schedule(() => { GetContainingInputManager().ChangeFocus(string.IsNullOrEmpty(username.Text) ? username : password); }); } diff --git a/osu.Game/Overlays/Settings/Sections/Input/MouseSettings.cs b/osu.Game/Overlays/Settings/Sections/Input/MouseSettings.cs index 71ab4d3782..2b643b6805 100644 --- a/osu.Game/Overlays/Settings/Sections/Input/MouseSettings.cs +++ b/osu.Game/Overlays/Settings/Sections/Input/MouseSettings.cs @@ -5,7 +5,7 @@ using osu.Framework.Allocation; using osu.Framework.Configuration; using osu.Framework.Graphics; using osu.Framework.Input; -using osu.Framework.Input.States; +using osu.Framework.Input.Events; using osu.Game.Configuration; using osu.Game.Graphics.UserInterface; @@ -124,18 +124,18 @@ namespace osu.Game.Overlays.Settings.Sections.Input private bool isDragging; - protected override bool OnDragStart(InputState state) + protected override bool OnDragStart(DragStartEvent e) { isDragging = true; - return base.OnDragStart(state); + return base.OnDragStart(e); } - protected override bool OnDragEnd(InputState state) + protected override bool OnDragEnd(DragEndEvent e) { isDragging = false; Current.TriggerChange(); - return base.OnDragEnd(state); + return base.OnDragEnd(e); } public override string TooltipText => Current.Disabled ? "Enable raw input to adjust sensitivity" : Current.Value.ToString(@"0.##x"); diff --git a/osu.Game/Overlays/Settings/SettingsItem.cs b/osu.Game/Overlays/Settings/SettingsItem.cs index 0f8d3aa2ac..4f947cd812 100644 --- a/osu.Game/Overlays/Settings/SettingsItem.cs +++ b/osu.Game/Overlays/Settings/SettingsItem.cs @@ -12,8 +12,7 @@ using osu.Framework.Graphics.Cursor; using osu.Framework.Graphics.Shapes; using osu.Framework.Graphics.Sprites; using osu.Framework.Graphics.UserInterface; -using osu.Framework.Input.EventArgs; -using osu.Framework.Input.States; +using osu.Framework.Input.Events; using osu.Game.Graphics; using osu.Game.Graphics.Sprites; using OpenTK; @@ -168,25 +167,25 @@ namespace osu.Game.Overlays.Settings public string TooltipText => "Revert to default"; - protected override bool OnMouseDown(InputState state, MouseDownEventArgs args) => true; + protected override bool OnMouseDown(MouseDownEvent e) => true; - protected override bool OnMouseUp(InputState state, MouseUpEventArgs args) => true; + protected override bool OnMouseUp(MouseUpEvent e) => true; - protected override bool OnClick(InputState state) + protected override bool OnClick(ClickEvent e) { if (bindable != null && !bindable.Disabled) bindable.SetDefault(); return true; } - protected override bool OnHover(InputState state) + protected override bool OnHover(HoverEvent e) { hovering = true; UpdateState(); return false; } - protected override void OnHoverLost(InputState state) + protected override void OnHoverLost(HoverLostEvent e) { hovering = false; UpdateState(); diff --git a/osu.Game/Overlays/Settings/Sidebar.cs b/osu.Game/Overlays/Settings/Sidebar.cs index fdda5b870e..862011b6e2 100644 --- a/osu.Game/Overlays/Settings/Sidebar.cs +++ b/osu.Game/Overlays/Settings/Sidebar.cs @@ -9,7 +9,7 @@ using OpenTK.Graphics; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Shapes; -using osu.Framework.Input.States; +using osu.Framework.Input.Events; using osu.Framework.Threading; using osu.Game.Overlays.Toolbar; @@ -55,25 +55,25 @@ namespace osu.Game.Overlays.Settings private ScheduledDelegate expandEvent; private ExpandedState state; - protected override bool OnHover(InputState state) + protected override bool OnHover(HoverEvent e) { queueExpandIfHovering(); return true; } - protected override void OnHoverLost(InputState state) + protected override void OnHoverLost(HoverLostEvent e) { expandEvent?.Cancel(); lastHoveredButton = null; State = ExpandedState.Contracted; - base.OnHoverLost(state); + base.OnHoverLost(e); } - protected override bool OnMouseMove(InputState state) + protected override bool OnMouseMove(MouseMoveEvent e) { queueExpandIfHovering(); - return base.OnMouseMove(state); + return base.OnMouseMove(e); } private class SidebarScrollContainer : ScrollContainer diff --git a/osu.Game/Overlays/Settings/SidebarButton.cs b/osu.Game/Overlays/Settings/SidebarButton.cs index 28e2b773ec..b6d1cf609e 100644 --- a/osu.Game/Overlays/Settings/SidebarButton.cs +++ b/osu.Game/Overlays/Settings/SidebarButton.cs @@ -10,7 +10,7 @@ using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Shapes; using osu.Framework.Graphics.Sprites; using osu.Framework.Graphics.UserInterface; -using osu.Framework.Input.States; +using osu.Framework.Input.Events; using osu.Game.Graphics; using osu.Game.Graphics.Sprites; using osu.Game.Graphics.UserInterface; @@ -109,22 +109,22 @@ namespace osu.Game.Overlays.Settings selectionIndicator.Colour = colours.Yellow; } - protected override bool OnClick(InputState state) + protected override bool OnClick(ClickEvent e) { Action?.Invoke(section); - return base.OnClick(state); + return base.OnClick(e); } - protected override bool OnHover(InputState state) + protected override bool OnHover(HoverEvent e) { Background.FadeTo(0.4f, 200); - return base.OnHover(state); + return base.OnHover(e); } - protected override void OnHoverLost(InputState state) + protected override void OnHoverLost(HoverLostEvent e) { Background.FadeTo(0, 200); - base.OnHoverLost(state); + base.OnHoverLost(e); } } } diff --git a/osu.Game/Overlays/SettingsOverlay.cs b/osu.Game/Overlays/SettingsOverlay.cs index 83e121e998..c971ab5005 100644 --- a/osu.Game/Overlays/SettingsOverlay.cs +++ b/osu.Game/Overlays/SettingsOverlay.cs @@ -11,7 +11,7 @@ using osu.Framework.Extensions.IEnumerableExtensions; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Shapes; -using osu.Framework.Input.States; +using osu.Framework.Input.Events; using osu.Game.Graphics.Containers; using osu.Game.Graphics.UserInterface; using osu.Game.Overlays.Settings; @@ -177,10 +177,10 @@ namespace osu.Game.Overlays public override bool AcceptsFocus => true; - protected override void OnFocus(InputState state) + protected override void OnFocus(FocusEvent e) { GetContainingInputManager().ChangeFocus(searchTextBox); - base.OnFocus(state); + base.OnFocus(e); } protected override void UpdateAfterChildren() diff --git a/osu.Game/Overlays/Social/SocialPanel.cs b/osu.Game/Overlays/Social/SocialPanel.cs index b0455f7edd..cfee639d53 100644 --- a/osu.Game/Overlays/Social/SocialPanel.cs +++ b/osu.Game/Overlays/Social/SocialPanel.cs @@ -6,7 +6,7 @@ using OpenTK.Graphics; using osu.Framework.Extensions.Color4Extensions; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; -using osu.Framework.Input.States; +using osu.Framework.Input.Events; using osu.Game.Users; namespace osu.Game.Overlays.Social @@ -35,20 +35,20 @@ namespace osu.Game.Overlays.Social Colour = Color4.Black.Opacity(0.3f), }; - protected override bool OnHover(InputState state) + protected override bool OnHover(HoverEvent e) { Content.TweenEdgeEffectTo(edgeEffectHovered, hover_transition_time, Easing.OutQuint); Content.MoveToY(-4, hover_transition_time, Easing.OutQuint); - return base.OnHover(state); + return base.OnHover(e); } - protected override void OnHoverLost(InputState state) + protected override void OnHoverLost(HoverLostEvent e) { Content.TweenEdgeEffectTo(edgeEffectNormal, hover_transition_time, Easing.OutQuint); Content.MoveToY(0, hover_transition_time, Easing.OutQuint); - base.OnHoverLost(state); + base.OnHoverLost(e); } protected override void LoadComplete() diff --git a/osu.Game/Overlays/Toolbar/Toolbar.cs b/osu.Game/Overlays/Toolbar/Toolbar.cs index 3f44cb403a..611b42383e 100644 --- a/osu.Game/Overlays/Toolbar/Toolbar.cs +++ b/osu.Game/Overlays/Toolbar/Toolbar.cs @@ -11,7 +11,7 @@ using OpenTK; using osu.Framework.Graphics.Shapes; using osu.Framework.Allocation; using osu.Framework.Configuration; -using osu.Framework.Input.States; +using osu.Framework.Input.Events; namespace osu.Game.Overlays.Toolbar { @@ -121,14 +121,14 @@ namespace osu.Game.Overlays.Toolbar }; } - protected override bool OnHover(InputState state) + protected override bool OnHover(HoverEvent e) { solidBackground.FadeTo(alpha_hovering, transition_time, Easing.OutQuint); gradientBackground.FadeIn(transition_time, Easing.OutQuint); return true; } - protected override void OnHoverLost(InputState state) + protected override void OnHoverLost(HoverLostEvent e) { solidBackground.FadeTo(alpha_normal, transition_time, Easing.OutQuint); gradientBackground.FadeOut(transition_time, Easing.OutQuint); diff --git a/osu.Game/Overlays/Toolbar/ToolbarButton.cs b/osu.Game/Overlays/Toolbar/ToolbarButton.cs index 74af5d7e9c..5cb26974e6 100644 --- a/osu.Game/Overlays/Toolbar/ToolbarButton.cs +++ b/osu.Game/Overlays/Toolbar/ToolbarButton.cs @@ -11,8 +11,7 @@ using osu.Game.Graphics.Sprites; using OpenTK; using OpenTK.Graphics; using osu.Framework.Graphics.Shapes; -using osu.Framework.Input.EventArgs; -using osu.Framework.Input.States; +using osu.Framework.Input.Events; using osu.Game.Graphics.Containers; using osu.Game.Graphics.UserInterface; @@ -145,22 +144,22 @@ namespace osu.Game.Overlays.Toolbar }; } - protected override bool OnMouseDown(InputState state, MouseDownEventArgs args) => true; + protected override bool OnMouseDown(MouseDownEvent e) => true; - protected override bool OnClick(InputState state) + protected override bool OnClick(ClickEvent e) { HoverBackground.FlashColour(Color4.White.Opacity(100), 500, Easing.OutQuint); - return base.OnClick(state); + return base.OnClick(e); } - protected override bool OnHover(InputState state) + protected override bool OnHover(HoverEvent e) { HoverBackground.FadeIn(200); tooltipContainer.FadeIn(100); - return base.OnHover(state); + return base.OnHover(e); } - protected override void OnHoverLost(InputState state) + protected override void OnHoverLost(HoverLostEvent e) { HoverBackground.FadeOut(200); tooltipContainer.FadeOut(100); diff --git a/osu.Game/Overlays/Toolbar/ToolbarRulesetSelector.cs b/osu.Game/Overlays/Toolbar/ToolbarRulesetSelector.cs index 4b6fb366bb..aa55f8fa41 100644 --- a/osu.Game/Overlays/Toolbar/ToolbarRulesetSelector.cs +++ b/osu.Game/Overlays/Toolbar/ToolbarRulesetSelector.cs @@ -11,8 +11,7 @@ using OpenTK.Input; using OpenTK.Graphics; using osu.Framework.Configuration; using osu.Framework.Graphics.Shapes; -using osu.Framework.Input.EventArgs; -using osu.Framework.Input.States; +using osu.Framework.Input.Events; using osu.Game.Rulesets; namespace osu.Game.Overlays.Toolbar @@ -86,13 +85,13 @@ namespace osu.Game.Overlays.Toolbar ruleset.BindTo(parentRuleset); } - protected override bool OnKeyDown(InputState state, KeyDownEventArgs args) + protected override bool OnKeyDown(KeyDownEvent e) { - base.OnKeyDown(state, args); + base.OnKeyDown(e); - if (state.Keyboard.ControlPressed && !args.Repeat && args.Key >= Key.Number1 && args.Key <= Key.Number9) + if (state.Keyboard.ControlPressed && !e.Repeat && e.Key >= Key.Number1 && e.Key <= Key.Number9) { - int requested = args.Key - Key.Number1; + int requested = e.Key - Key.Number1; RulesetInfo found = rulesets.AvailableRulesets.Skip(requested).FirstOrDefault(); if (found != null) diff --git a/osu.Game/Overlays/Volume/MuteButton.cs b/osu.Game/Overlays/Volume/MuteButton.cs index 47169d7a7b..a099a10096 100644 --- a/osu.Game/Overlays/Volume/MuteButton.cs +++ b/osu.Game/Overlays/Volume/MuteButton.cs @@ -9,7 +9,7 @@ using osu.Framework.Graphics.Colour; using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Shapes; using osu.Framework.Graphics.UserInterface; -using osu.Framework.Input.States; +using osu.Framework.Input.Events; using osu.Game.Graphics; using OpenTK; using OpenTK.Graphics; @@ -63,18 +63,18 @@ namespace osu.Game.Overlays.Volume Current.TriggerChange(); } - protected override bool OnHover(InputState state) + protected override bool OnHover(HoverEvent e) { this.TransformTo("BorderColour", hoveredColour, 500, Easing.OutQuint); return false; } - protected override void OnHoverLost(InputState state) + protected override void OnHoverLost(HoverLostEvent e) { this.TransformTo("BorderColour", unhoveredColour, 500, Easing.OutQuint); } - protected override bool OnClick(InputState state) + protected override bool OnClick(ClickEvent e) { Current.Value = !Current.Value; return true; diff --git a/osu.Game/Overlays/Volume/VolumeMeter.cs b/osu.Game/Overlays/Volume/VolumeMeter.cs index a6c98aa97e..daf45f71b4 100644 --- a/osu.Game/Overlays/Volume/VolumeMeter.cs +++ b/osu.Game/Overlays/Volume/VolumeMeter.cs @@ -11,7 +11,7 @@ using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Effects; using osu.Framework.Graphics.Shapes; using osu.Framework.Graphics.UserInterface; -using osu.Framework.Input.States; +using osu.Framework.Input.Events; using osu.Framework.MathUtils; using osu.Game.Graphics; using osu.Game.Graphics.Sprites; @@ -239,21 +239,21 @@ namespace osu.Game.Overlays.Volume adjustAccumulator = 0; } - protected override bool OnScroll(InputState state) + protected override bool OnScroll(ScrollEvent e) { - adjust(state.Mouse.ScrollDelta.Y, state.Mouse.HasPreciseScroll); + adjust(e.Mouse.ScrollDelta.Y, e.Mouse.HasPreciseScroll); return true; } private const float transition_length = 500; - protected override bool OnHover(InputState state) + protected override bool OnHover(HoverEvent e) { this.ScaleTo(1.04f, transition_length, Easing.OutExpo); return false; } - protected override void OnHoverLost(InputState state) + protected override void OnHoverLost(HoverLostEvent e) { this.ScaleTo(1f, transition_length, Easing.OutExpo); } diff --git a/osu.Game/Overlays/VolumeOverlay.cs b/osu.Game/Overlays/VolumeOverlay.cs index bf1c81393d..d45d097a09 100644 --- a/osu.Game/Overlays/VolumeOverlay.cs +++ b/osu.Game/Overlays/VolumeOverlay.cs @@ -9,7 +9,7 @@ using osu.Framework.Graphics; using osu.Framework.Graphics.Colour; using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Shapes; -using osu.Framework.Input.States; +using osu.Framework.Input.Events; using osu.Framework.Threading; using osu.Game.Graphics; using osu.Game.Input.Bindings; @@ -143,23 +143,23 @@ namespace osu.Game.Overlays this.FadeOut(100); } - protected override bool OnMouseMove(InputState state) + protected override bool OnMouseMove(MouseMoveEvent e) { // keep the scheduled event correctly timed as long as we have movement. schedulePopOut(); - return base.OnMouseMove(state); + return base.OnMouseMove(e); } - protected override bool OnHover(InputState state) + protected override bool OnHover(HoverEvent e) { schedulePopOut(); return true; } - protected override void OnHoverLost(InputState state) + protected override void OnHoverLost(HoverLostEvent e) { schedulePopOut(); - base.OnHoverLost(state); + base.OnHoverLost(e); } private void schedulePopOut() diff --git a/osu.Game/Rulesets/Edit/HitObjectMask.cs b/osu.Game/Rulesets/Edit/HitObjectMask.cs index 0ba67e1dca..a16c6d59dd 100644 --- a/osu.Game/Rulesets/Edit/HitObjectMask.cs +++ b/osu.Game/Rulesets/Edit/HitObjectMask.cs @@ -5,7 +5,7 @@ using System; using osu.Framework; using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Primitives; -using osu.Framework.Input.EventArgs; +using osu.Framework.Input.Events; using osu.Framework.Input.States; using osu.Game.Graphics.UserInterface; using osu.Game.Rulesets.Objects.Drawables; @@ -96,7 +96,7 @@ namespace osu.Game.Rulesets.Edit private bool selectionRequested; - protected override bool OnMouseDown(InputState state, MouseDownEventArgs args) + protected override bool OnMouseDown(MouseDownEvent e) { selectionRequested = false; @@ -109,23 +109,23 @@ namespace osu.Game.Rulesets.Edit return IsSelected; } - protected override bool OnClick(InputState state) + protected override bool OnClick(ClickEvent e) { if (State == SelectionState.Selected && !selectionRequested) { selectionRequested = true; - SelectionRequested?.Invoke(this, state); + SelectionRequested?.Invoke(this, e); return true; } - return base.OnClick(state); + return base.OnClick(e); } - protected override bool OnDragStart(InputState state) => true; + protected override bool OnDragStart(DragStartEvent e) => true; - protected override bool OnDrag(InputState state) + protected override bool OnDrag(DragEvent e) { - DragRequested?.Invoke(this, state); + DragRequested?.Invoke(this, e); return true; } diff --git a/osu.Game/Rulesets/UI/RulesetInputManager.cs b/osu.Game/Rulesets/UI/RulesetInputManager.cs index af1dc98fec..91bb505724 100644 --- a/osu.Game/Rulesets/UI/RulesetInputManager.cs +++ b/osu.Game/Rulesets/UI/RulesetInputManager.cs @@ -211,16 +211,16 @@ namespace osu.Game.Rulesets.UI mouseDisabled = config.GetBindable(OsuSetting.MouseDisableButtons); } - protected override bool OnMouseDown(InputState state, MouseDownEventArgs args) + protected override bool OnMouseDown(MouseDownEvent e) { - if (mouseDisabled.Value && (args.Button == MouseButton.Left || args.Button == MouseButton.Right)) return false; - return base.OnMouseDown(state, args); + if (mouseDisabled.Value && (e.Button == MouseButton.Left || e.Button == MouseButton.Right)) return false; + return base.OnMouseDown(e); } - protected override bool OnMouseUp(InputState state, MouseUpEventArgs args) + protected override bool OnMouseUp(MouseUpEvent e) { - if (!CurrentState.Mouse.IsPressed(args.Button)) return false; - return base.OnMouseUp(state, args); + if (!CurrentState.Mouse.IsPressed(e.Button)) return false; + return base.OnMouseUp(e); } #endregion diff --git a/osu.Game/Screens/BackgroundScreen.cs b/osu.Game/Screens/BackgroundScreen.cs index 46d1260410..7787b4ddc2 100644 --- a/osu.Game/Screens/BackgroundScreen.cs +++ b/osu.Game/Screens/BackgroundScreen.cs @@ -5,8 +5,7 @@ using System; using System.Threading; using osu.Framework.Screens; using osu.Framework.Graphics; -using osu.Framework.Input.EventArgs; -using osu.Framework.Input.States; +using osu.Framework.Input.Events; using OpenTK; namespace osu.Game.Screens @@ -21,7 +20,7 @@ namespace osu.Game.Screens private const float transition_length = 500; private const float x_movement_amount = 50; - protected override bool OnKeyDown(InputState state, KeyDownEventArgs args) + protected override bool OnKeyDown(KeyDownEvent e) { //we don't want to handle escape key. return false; diff --git a/osu.Game/Screens/Edit/Components/PlaybackControl.cs b/osu.Game/Screens/Edit/Components/PlaybackControl.cs index 6cd7fd52d4..c5b6251216 100644 --- a/osu.Game/Screens/Edit/Components/PlaybackControl.cs +++ b/osu.Game/Screens/Edit/Components/PlaybackControl.cs @@ -8,7 +8,7 @@ using osu.Framework.Extensions.IEnumerableExtensions; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.UserInterface; -using osu.Framework.Input.States; +using osu.Framework.Input.Events; using osu.Framework.Timing; using osu.Game.Graphics; using osu.Game.Graphics.Sprites; @@ -138,13 +138,13 @@ namespace osu.Game.Screens.Edit.Components textBold.Colour = hoveredColour = colours.Yellow; } - protected override bool OnHover(InputState state) + protected override bool OnHover(HoverEvent e) { updateState(); return true; } - protected override void OnHoverLost(InputState state) => updateState(); + protected override void OnHoverLost(HoverLostEvent e) => updateState(); protected override void OnActivated() => updateState(); protected override void OnDeactivated() => updateState(); diff --git a/osu.Game/Screens/Edit/Components/Timelines/Summary/Parts/MarkerPart.cs b/osu.Game/Screens/Edit/Components/Timelines/Summary/Parts/MarkerPart.cs index 7ff3849361..41ef2065da 100644 --- a/osu.Game/Screens/Edit/Components/Timelines/Summary/Parts/MarkerPart.cs +++ b/osu.Game/Screens/Edit/Components/Timelines/Summary/Parts/MarkerPart.cs @@ -6,8 +6,7 @@ using osu.Framework.Allocation; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Shapes; -using osu.Framework.Input.EventArgs; -using osu.Framework.Input.States; +using osu.Framework.Input.Events; using osu.Framework.Timing; using osu.Game.Beatmaps; using osu.Game.Graphics; @@ -30,15 +29,15 @@ namespace osu.Game.Screens.Edit.Components.Timelines.Summary.Parts Add(marker = new MarkerVisualisation()); } - protected override bool OnDragStart(InputState state) => true; - protected override bool OnDragEnd(InputState state) => true; - protected override bool OnDrag(InputState state) + protected override bool OnDragStart(DragStartEvent e) => true; + protected override bool OnDragEnd(DragEndEvent e) => true; + protected override bool OnDrag(DragEvent e) { - seekToPosition(state.Mouse.NativeState.Position); + seekToPosition(e.Mouse.NativeState.Position); return true; } - protected override bool OnMouseDown(InputState state, MouseDownEventArgs args) + protected override bool OnMouseDown(MouseDownEvent e) { seekToPosition(state.Mouse.NativeState.Position); return true; diff --git a/osu.Game/Screens/Edit/Editor.cs b/osu.Game/Screens/Edit/Editor.cs index 7159cd919c..2cfcf4c415 100644 --- a/osu.Game/Screens/Edit/Editor.cs +++ b/osu.Game/Screens/Edit/Editor.cs @@ -12,7 +12,7 @@ using osu.Game.Screens.Edit.Menus; using osu.Game.Screens.Edit.Components.Timelines.Summary; using osu.Framework.Allocation; using osu.Framework.Graphics.UserInterface; -using osu.Framework.Input.States; +using osu.Framework.Input.Events; using osu.Framework.Platform; using osu.Framework.Timing; using osu.Game.Graphics.UserInterface; @@ -182,9 +182,9 @@ namespace osu.Game.Screens.Edit LoadComponentAsync(currentScreen, screenContainer.Add); } - protected override bool OnScroll(InputState state) + protected override bool OnScroll(ScrollEvent e) { - if (state.Mouse.ScrollDelta.X + state.Mouse.ScrollDelta.Y > 0) + if (e.Mouse.ScrollDelta.X + e.Mouse.ScrollDelta.Y > 0) clock.SeekBackward(!clock.IsRunning); else clock.SeekForward(!clock.IsRunning); diff --git a/osu.Game/Screens/Edit/Menus/EditorMenuBar.cs b/osu.Game/Screens/Edit/Menus/EditorMenuBar.cs index c6351c8520..af0a7b6694 100644 --- a/osu.Game/Screens/Edit/Menus/EditorMenuBar.cs +++ b/osu.Game/Screens/Edit/Menus/EditorMenuBar.cs @@ -11,7 +11,7 @@ using osu.Game.Graphics.UserInterface; using OpenTK; using OpenTK.Graphics; using osu.Framework.Configuration; -using osu.Framework.Input.States; +using osu.Framework.Input.Events; using osu.Game.Screens.Edit.Screens; namespace osu.Game.Screens.Edit.Menus @@ -171,18 +171,18 @@ namespace osu.Game.Screens.Edit.Menus { } - protected override bool OnHover(InputState state) + protected override bool OnHover(HoverEvent e) { if (Item is EditorMenuItemSpacer) return true; - return base.OnHover(state); + return base.OnHover(e); } - protected override bool OnClick(InputState state) + protected override bool OnClick(ClickEvent e) { if (Item is EditorMenuItemSpacer) return true; - return base.OnClick(state); + return base.OnClick(e); } } } diff --git a/osu.Game/Screens/Edit/Screens/Compose/BeatDivisorControl.cs b/osu.Game/Screens/Edit/Screens/Compose/BeatDivisorControl.cs index 833c4464c3..2e1b2c1ac3 100644 --- a/osu.Game/Screens/Edit/Screens/Compose/BeatDivisorControl.cs +++ b/osu.Game/Screens/Edit/Screens/Compose/BeatDivisorControl.cs @@ -12,7 +12,7 @@ using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Shapes; using osu.Framework.Graphics.Sprites; using osu.Framework.Graphics.UserInterface; -using osu.Framework.Input.EventArgs; +using osu.Framework.Input.Events; using osu.Framework.Input.States; using osu.Game.Graphics; using osu.Game.Graphics.UserInterface; @@ -233,9 +233,9 @@ namespace osu.Game.Screens.Edit.Screens.Compose public override bool HandleNonPositionalInput => IsHovered && !CurrentNumber.Disabled; - protected override bool OnKeyDown(InputState state, KeyDownEventArgs args) + protected override bool OnKeyDown(KeyDownEvent e) { - switch (args.Key) + switch (e.Key) { case Key.Right: beatDivisor.Next(); @@ -250,27 +250,27 @@ namespace osu.Game.Screens.Edit.Screens.Compose } } - protected override bool OnMouseDown(InputState state, MouseDownEventArgs args) + protected override bool OnMouseDown(MouseDownEvent e) { marker.Active = true; - return base.OnMouseDown(state, args); + return base.OnMouseDown(e); } - protected override bool OnMouseUp(InputState state, MouseUpEventArgs args) + protected override bool OnMouseUp(MouseUpEvent e) { marker.Active = false; - return base.OnMouseUp(state, args); + return base.OnMouseUp(e); } - protected override bool OnClick(InputState state) + protected override bool OnClick(ClickEvent e) { - handleMouseInput(state); + handleMouseInput(e); return true; } - protected override bool OnDrag(InputState state) + protected override bool OnDrag(DragEvent e) { - handleMouseInput(state); + handleMouseInput(e); return true; } diff --git a/osu.Game/Screens/Edit/Screens/Compose/Layers/DragLayer.cs b/osu.Game/Screens/Edit/Screens/Compose/Layers/DragLayer.cs index c4392bbc60..6db272e2a4 100644 --- a/osu.Game/Screens/Edit/Screens/Compose/Layers/DragLayer.cs +++ b/osu.Game/Screens/Edit/Screens/Compose/Layers/DragLayer.cs @@ -7,7 +7,7 @@ using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Primitives; using osu.Framework.Graphics.Shapes; -using osu.Framework.Input.States; +using osu.Framework.Input.Events; using osu.Game.Rulesets.Edit; using OpenTK.Graphics; @@ -56,16 +56,16 @@ namespace osu.Game.Screens.Edit.Screens.Compose.Layers }; } - protected override bool OnDragStart(InputState state) + protected override bool OnDragStart(DragStartEvent e) { this.FadeIn(250, Easing.OutQuint); return true; } - protected override bool OnDrag(InputState state) + protected override bool OnDrag(DragEvent e) { - var dragPosition = state.Mouse.NativeState.Position; - var dragStartPosition = state.Mouse.NativeState.PositionMouseDown ?? dragPosition; + var dragPosition = e.Mouse.NativeState.Position; + var dragStartPosition = e.Mouse.NativeState.PositionMouseDown ?? dragPosition; var dragQuad = new Quad(dragStartPosition.X, dragStartPosition.Y, dragPosition.X - dragStartPosition.X, dragPosition.Y - dragStartPosition.Y); @@ -82,7 +82,7 @@ namespace osu.Game.Screens.Edit.Screens.Compose.Layers return true; } - protected override bool OnDragEnd(InputState state) + protected override bool OnDragEnd(DragEndEvent e) { this.FadeOut(250, Easing.OutQuint); DragEnd?.Invoke(); diff --git a/osu.Game/Screens/Edit/Screens/Compose/Layers/HitObjectMaskLayer.cs b/osu.Game/Screens/Edit/Screens/Compose/Layers/HitObjectMaskLayer.cs index d212bbe7dd..65f31dd56d 100644 --- a/osu.Game/Screens/Edit/Screens/Compose/Layers/HitObjectMaskLayer.cs +++ b/osu.Game/Screens/Edit/Screens/Compose/Layers/HitObjectMaskLayer.cs @@ -4,8 +4,7 @@ using osu.Framework.Allocation; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; -using osu.Framework.Input.EventArgs; -using osu.Framework.Input.States; +using osu.Framework.Input.Events; using osu.Game.Rulesets.Edit; using osu.Game.Rulesets.Objects.Drawables; @@ -52,7 +51,7 @@ namespace osu.Game.Screens.Edit.Screens.Compose.Layers addMask(obj); } - protected override bool OnMouseDown(InputState state, MouseDownEventArgs args) + protected override bool OnMouseDown(MouseDownEvent e) { maskContainer.DeselectAll(); return true; diff --git a/osu.Game/Screens/Edit/Screens/Compose/RadioButtons/DrawableRadioButton.cs b/osu.Game/Screens/Edit/Screens/Compose/RadioButtons/DrawableRadioButton.cs index 803a1275d7..2c7e2043fc 100644 --- a/osu.Game/Screens/Edit/Screens/Compose/RadioButtons/DrawableRadioButton.cs +++ b/osu.Game/Screens/Edit/Screens/Compose/RadioButtons/DrawableRadioButton.cs @@ -10,7 +10,7 @@ using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Shapes; using osu.Framework.Graphics.Sprites; -using osu.Framework.Input.States; +using osu.Framework.Input.Events; using osu.Game.Graphics; using osu.Game.Graphics.Sprites; using osu.Game.Graphics.UserInterface; @@ -99,7 +99,7 @@ namespace osu.Game.Screens.Edit.Screens.Compose.RadioButtons bubble.Colour = button.Selected ? selectedBubbleColour : defaultBubbleColour; } - protected override bool OnClick(InputState state) + protected override bool OnClick(ClickEvent e) { if (button.Selected) return true; @@ -109,7 +109,7 @@ namespace osu.Game.Screens.Edit.Screens.Compose.RadioButtons button.Selected.Value = true; - return base.OnClick(state); + return base.OnClick(e); } protected override SpriteText CreateText() => new OsuSpriteText diff --git a/osu.Game/Screens/Edit/Screens/Compose/Timeline/Timeline.cs b/osu.Game/Screens/Edit/Screens/Compose/Timeline/Timeline.cs index 30205c5aa1..da95564975 100644 --- a/osu.Game/Screens/Edit/Screens/Compose/Timeline/Timeline.cs +++ b/osu.Game/Screens/Edit/Screens/Compose/Timeline/Timeline.cs @@ -7,8 +7,7 @@ using osu.Framework.Configuration; using osu.Framework.Extensions.Color4Extensions; using osu.Framework.Graphics; using osu.Framework.Graphics.Audio; -using osu.Framework.Input.EventArgs; -using osu.Framework.Input.States; +using osu.Framework.Input.Events; using osu.Framework.Timing; using osu.Game.Beatmaps; using osu.Game.Graphics; @@ -133,9 +132,9 @@ namespace osu.Game.Screens.Edit.Screens.Compose.Timeline ScrollTo((float)(adjustableClock.CurrentTime / track.Length) * Content.DrawWidth, false); } - protected override bool OnMouseDown(InputState state, MouseDownEventArgs args) + protected override bool OnMouseDown(MouseDownEvent e) { - if (base.OnMouseDown(state, args)) + if (base.OnMouseDown(e)) { beginUserDrag(); return true; @@ -144,10 +143,10 @@ namespace osu.Game.Screens.Edit.Screens.Compose.Timeline return false; } - protected override bool OnMouseUp(InputState state, MouseUpEventArgs args) + protected override bool OnMouseUp(MouseUpEvent e) { endUserDrag(); - return base.OnMouseUp(state, args); + return base.OnMouseUp(e); } private void beginUserDrag() diff --git a/osu.Game/Screens/Edit/Screens/Compose/Timeline/ZoomableScrollContainer.cs b/osu.Game/Screens/Edit/Screens/Compose/Timeline/ZoomableScrollContainer.cs index d30aaacc6a..6390f8dd96 100644 --- a/osu.Game/Screens/Edit/Screens/Compose/Timeline/ZoomableScrollContainer.cs +++ b/osu.Game/Screens/Edit/Screens/Compose/Timeline/ZoomableScrollContainer.cs @@ -5,7 +5,7 @@ using System; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Transforms; -using osu.Framework.Input.States; +using osu.Framework.Input.Events; using osu.Framework.MathUtils; using OpenTK; @@ -97,13 +97,13 @@ namespace osu.Game.Screens.Edit.Screens.Compose.Timeline zoomedContent.Width = DrawWidth * currentZoom; } - protected override bool OnScroll(InputState state) + protected override bool OnScroll(ScrollEvent e) { - if (state.Mouse.HasPreciseScroll) + if (e.Mouse.HasPreciseScroll) // for now, we don't support zoom when using a precision scroll device. this needs gesture support. - return base.OnScroll(state); + return base.OnScroll(e); - setZoomTarget(zoomTarget + state.Mouse.ScrollDelta.Y, zoomedContent.ToLocalSpace(state.Mouse.NativeState.Position).X); + setZoomTarget(zoomTarget + e.Mouse.ScrollDelta.Y, zoomedContent.ToLocalSpace(e.Mouse.NativeState.Position).X); return true; } diff --git a/osu.Game/Screens/Menu/Button.cs b/osu.Game/Screens/Menu/Button.cs index 38d74a3a4b..bf0e0418e9 100644 --- a/osu.Game/Screens/Menu/Button.cs +++ b/osu.Game/Screens/Menu/Button.cs @@ -17,8 +17,7 @@ using OpenTK.Input; using osu.Framework.Extensions.Color4Extensions; using osu.Game.Graphics.Containers; using osu.Framework.Audio.Track; -using osu.Framework.Input.EventArgs; -using osu.Framework.Input.States; +using osu.Framework.Input.Events; using osu.Game.Beatmaps.ControlPoints; namespace osu.Game.Screens.Menu @@ -151,7 +150,7 @@ namespace osu.Game.Screens.Menu rightward = !rightward; } - protected override bool OnHover(InputState state) + protected override bool OnHover(HoverEvent e) { if (State != ButtonState.Expanded) return true; @@ -167,7 +166,7 @@ namespace osu.Game.Screens.Menu return true; } - protected override void OnHoverLost(InputState state) + protected override void OnHoverLost(HoverLostEvent e) { icon.ClearTransforms(); icon.RotateTo(0, 500, Easing.Out); @@ -186,30 +185,30 @@ namespace osu.Game.Screens.Menu sampleClick = audio.Sample.Get($@"Menu/{sampleName}"); } - protected override bool OnMouseDown(InputState state, MouseDownEventArgs args) + protected override bool OnMouseDown(MouseDownEvent e) { boxHoverLayer.FadeTo(0.1f, 1000, Easing.OutQuint); - return base.OnMouseDown(state, args); + return base.OnMouseDown(e); } - protected override bool OnMouseUp(InputState state, MouseUpEventArgs args) + protected override bool OnMouseUp(MouseUpEvent e) { boxHoverLayer.FadeTo(0, 1000, Easing.OutQuint); - return base.OnMouseUp(state, args); + return base.OnMouseUp(e); } - protected override bool OnClick(InputState state) + protected override bool OnClick(ClickEvent e) { trigger(); return true; } - protected override bool OnKeyDown(InputState state, KeyDownEventArgs args) + protected override bool OnKeyDown(KeyDownEvent e) { - if (args.Repeat || state.Keyboard.ControlPressed || state.Keyboard.ShiftPressed || state.Keyboard.AltPressed) + if (e.Repeat || state.Keyboard.ControlPressed || state.Keyboard.ShiftPressed || state.Keyboard.AltPressed) return false; - if (triggerKey == args.Key && triggerKey != Key.Unknown) + if (triggerKey == e.Key && triggerKey != Key.Unknown) { trigger(); return true; diff --git a/osu.Game/Screens/Menu/MainMenu.cs b/osu.Game/Screens/Menu/MainMenu.cs index 2dd6e1d7e1..ef86351760 100644 --- a/osu.Game/Screens/Menu/MainMenu.cs +++ b/osu.Game/Screens/Menu/MainMenu.cs @@ -6,8 +6,7 @@ using OpenTK.Graphics; using OpenTK.Input; using osu.Framework.Allocation; using osu.Framework.Graphics; -using osu.Framework.Input.EventArgs; -using osu.Framework.Input.States; +using osu.Framework.Input.Events; using osu.Framework.Screens; using osu.Game.Beatmaps; using osu.Game.Graphics; @@ -200,15 +199,15 @@ namespace osu.Game.Screens.Menu return base.OnExiting(next); } - protected override bool OnKeyDown(InputState state, KeyDownEventArgs args) + protected override bool OnKeyDown(KeyDownEvent e) { - if (!args.Repeat && state.Keyboard.ControlPressed && state.Keyboard.ShiftPressed && args.Key == Key.D) + if (!e.Repeat && state.Keyboard.ControlPressed && state.Keyboard.ShiftPressed && e.Key == Key.D) { Push(new Drawings()); return true; } - return base.OnKeyDown(state, args); + return base.OnKeyDown(e); } } } diff --git a/osu.Game/Screens/Menu/OsuLogo.cs b/osu.Game/Screens/Menu/OsuLogo.cs index 52354241d2..4e6a107f91 100644 --- a/osu.Game/Screens/Menu/OsuLogo.cs +++ b/osu.Game/Screens/Menu/OsuLogo.cs @@ -11,8 +11,7 @@ using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Shapes; using osu.Framework.Graphics.Sprites; using osu.Framework.Graphics.Textures; -using osu.Framework.Input.EventArgs; -using osu.Framework.Input.States; +using osu.Framework.Input.Events; using osu.Framework.MathUtils; using osu.Game.Beatmaps.ControlPoints; using osu.Game.Graphics; @@ -344,23 +343,23 @@ namespace osu.Game.Screens.Menu public override bool HandlePositionalInput => base.HandlePositionalInput && Action != null && Alpha > 0.2f; - protected override bool OnMouseDown(InputState state, MouseDownEventArgs args) + protected override bool OnMouseDown(MouseDownEvent e) { - if (args.Button != MouseButton.Left) return false; + if (e.Button != MouseButton.Left) return false; logoBounceContainer.ScaleTo(0.9f, 1000, Easing.Out); return true; } - protected override bool OnMouseUp(InputState state, MouseUpEventArgs args) + protected override bool OnMouseUp(MouseUpEvent e) { - if (args.Button != MouseButton.Left) return false; + if (e.Button != MouseButton.Left) return false; logoBounceContainer.ScaleTo(1f, 500, Easing.OutElastic); return true; } - protected override bool OnClick(InputState state) + protected override bool OnClick(ClickEvent e) { if (Action?.Invoke() ?? true) sampleClick.Play(); @@ -371,13 +370,13 @@ namespace osu.Game.Screens.Menu return true; } - protected override bool OnHover(InputState state) + protected override bool OnHover(HoverEvent e) { logoHoverContainer.ScaleTo(1.1f, 500, Easing.OutElastic); return true; } - protected override void OnHoverLost(InputState state) + protected override void OnHoverLost(HoverLostEvent e) { logoHoverContainer.ScaleTo(1, 500, Easing.OutElastic); } diff --git a/osu.Game/Screens/Multi/Components/DrawableRoom.cs b/osu.Game/Screens/Multi/Components/DrawableRoom.cs index 739346fabe..67db23263b 100644 --- a/osu.Game/Screens/Multi/Components/DrawableRoom.cs +++ b/osu.Game/Screens/Multi/Components/DrawableRoom.cs @@ -10,7 +10,7 @@ using osu.Framework.Extensions.Color4Extensions; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Shapes; -using osu.Framework.Input.States; +using osu.Framework.Input.Events; using osu.Game.Beatmaps; using osu.Game.Beatmaps.Drawables; using osu.Game.Graphics; @@ -246,7 +246,7 @@ namespace osu.Game.Screens.Multi.Components this.FadeInFromZero(transition_duration); } - protected override bool OnClick(InputState state) + protected override bool OnClick(ClickEvent e) { if (Enabled.Value) { diff --git a/osu.Game/Screens/Multi/Screens/Lounge/Lounge.cs b/osu.Game/Screens/Multi/Screens/Lounge/Lounge.cs index 1a47829ad7..3b3f789628 100644 --- a/osu.Game/Screens/Multi/Screens/Lounge/Lounge.cs +++ b/osu.Game/Screens/Multi/Screens/Lounge/Lounge.cs @@ -6,7 +6,7 @@ using System.Linq; using osu.Framework.Extensions.IEnumerableExtensions; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; -using osu.Framework.Input.States; +using osu.Framework.Input.Events; using osu.Framework.Screens; using osu.Game.Graphics.UserInterface; using osu.Game.Online.Multiplayer; @@ -112,7 +112,7 @@ namespace osu.Game.Screens.Multi.Screens.Lounge }; } - protected override void OnFocus(InputState state) + protected override void OnFocus(FocusEvent e) { GetContainingInputManager().ChangeFocus(Filter.Search); } diff --git a/osu.Game/Screens/Multi/Screens/Match/Header.cs b/osu.Game/Screens/Multi/Screens/Match/Header.cs index cc31f10fd2..d469815d59 100644 --- a/osu.Game/Screens/Multi/Screens/Match/Header.cs +++ b/osu.Game/Screens/Multi/Screens/Match/Header.cs @@ -8,8 +8,7 @@ using osu.Framework.Graphics; using osu.Framework.Graphics.Colour; using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Shapes; -using osu.Framework.Input.EventArgs; -using osu.Framework.Input.States; +using osu.Framework.Input.Events; using osu.Game.Beatmaps; using osu.Game.Beatmaps.Drawables; using osu.Game.Graphics; @@ -151,28 +150,28 @@ namespace osu.Game.Screens.Multi.Screens.Match border.BorderColour = colours.Yellow; } - protected override bool OnHover(InputState state) + protected override bool OnHover(HoverEvent e) { border.FadeIn(transition_duration); - return base.OnHover(state); + return base.OnHover(e); } - protected override void OnHoverLost(InputState state) + protected override void OnHoverLost(HoverLostEvent e) { - base.OnHoverLost(state); + base.OnHoverLost(e); border.FadeOut(transition_duration); } - protected override bool OnMouseDown(InputState state, MouseDownEventArgs args) + protected override bool OnMouseDown(MouseDownEvent e) { bg.FadeTo(0.75f, 1000, Easing.Out); - return base.OnMouseDown(state, args); + return base.OnMouseDown(e); } - protected override bool OnMouseUp(InputState state, MouseUpEventArgs args) + protected override bool OnMouseUp(MouseUpEvent e) { bg.FadeTo(bg_opacity, transition_duration); - return base.OnMouseUp(state, args); + return base.OnMouseUp(e); } } } diff --git a/osu.Game/Screens/Play/GameplayMenuOverlay.cs b/osu.Game/Screens/Play/GameplayMenuOverlay.cs index a978bd916e..ed79d32a39 100644 --- a/osu.Game/Screens/Play/GameplayMenuOverlay.cs +++ b/osu.Game/Screens/Play/GameplayMenuOverlay.cs @@ -16,8 +16,7 @@ using OpenTK.Input; using System.Collections.Generic; using System.Linq; using osu.Framework.Input.Bindings; -using osu.Framework.Input.EventArgs; -using osu.Framework.Input.States; +using osu.Framework.Input.Events; using osu.Game.Input.Bindings; namespace osu.Game.Screens.Play @@ -155,11 +154,11 @@ namespace osu.Game.Screens.Play protected override void PopOut() => this.FadeOut(transition_duration, Easing.In); // Don't let mouse down events through the overlay or people can click circles while paused. - protected override bool OnMouseDown(InputState state, MouseDownEventArgs args) => true; + protected override bool OnMouseDown(MouseDownEvent e) => true; - protected override bool OnMouseUp(InputState state, MouseUpEventArgs args) => true; + protected override bool OnMouseUp(MouseUpEvent e) => true; - protected override bool OnMouseMove(InputState state) => true; + protected override bool OnMouseMove(MouseMoveEvent e) => true; protected void AddButton(string text, Color4 colour, Action action) { @@ -204,11 +203,11 @@ namespace osu.Game.Screens.Play } } - protected override bool OnKeyDown(InputState state, KeyDownEventArgs args) + protected override bool OnKeyDown(KeyDownEvent e) { - if (!args.Repeat) + if (!e.Repeat) { - switch (args.Key) + switch (e.Key) { case Key.Up: if (selectionIndex == -1 || selectionIndex == 0) @@ -225,7 +224,7 @@ namespace osu.Game.Screens.Play } } - return base.OnKeyDown(state, args); + return base.OnKeyDown(e); } public bool OnPressed(GlobalAction action) @@ -283,17 +282,17 @@ namespace osu.Game.Screens.Play private class Button : DialogButton { - protected override bool OnHover(InputState state) => true; + protected override bool OnHover(HoverEvent e) => true; - protected override bool OnMouseMove(InputState state) + protected override bool OnMouseMove(MouseMoveEvent e) { Selected.Value = true; - return base.OnMouseMove(state); + return base.OnMouseMove(e); } - protected override bool OnKeyDown(InputState state, KeyDownEventArgs args) + protected override bool OnKeyDown(KeyDownEvent e) { - if (args.Repeat || args.Key != Key.Enter || !Selected) + if (e.Repeat || e.Key != Key.Enter || !Selected) return false; OnClick(state); diff --git a/osu.Game/Screens/Play/HUD/ModDisplay.cs b/osu.Game/Screens/Play/HUD/ModDisplay.cs index 1a164b473d..04f086282e 100644 --- a/osu.Game/Screens/Play/HUD/ModDisplay.cs +++ b/osu.Game/Screens/Play/HUD/ModDisplay.cs @@ -12,7 +12,7 @@ using osu.Game.Rulesets.UI; using OpenTK; using osu.Game.Graphics.Containers; using System.Linq; -using osu.Framework.Input.States; +using osu.Framework.Input.Events; namespace osu.Game.Screens.Play.HUD { @@ -93,16 +93,16 @@ namespace osu.Game.Screens.Play.HUD private void contract() => iconsContainer.TransformSpacingTo(new Vector2(-25, 0), 500, Easing.OutQuint); - protected override bool OnHover(InputState state) + protected override bool OnHover(HoverEvent e) { expand(); - return base.OnHover(state); + return base.OnHover(e); } - protected override void OnHoverLost(InputState state) + protected override void OnHoverLost(HoverLostEvent e) { contract(); - base.OnHoverLost(state); + base.OnHoverLost(e); } } } diff --git a/osu.Game/Screens/Play/HUD/PlayerSettingsOverlay.cs b/osu.Game/Screens/Play/HUD/PlayerSettingsOverlay.cs index 7534c7a22e..4b3cc57546 100644 --- a/osu.Game/Screens/Play/HUD/PlayerSettingsOverlay.cs +++ b/osu.Game/Screens/Play/HUD/PlayerSettingsOverlay.cs @@ -3,8 +3,7 @@ using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; -using osu.Framework.Input.EventArgs; -using osu.Framework.Input.States; +using osu.Framework.Input.Events; using OpenTK; using osu.Game.Screens.Play.PlayerSettings; using OpenTK.Input; @@ -53,20 +52,20 @@ namespace osu.Game.Screens.Play.HUD //We want to handle keyboard inputs all the time in order to trigger ToggleVisibility() when not visible public override bool HandleNonPositionalInput => true; - protected override bool OnKeyDown(InputState state, KeyDownEventArgs args) + protected override bool OnKeyDown(KeyDownEvent e) { - if (args.Repeat) return false; + if (e.Repeat) return false; if (state.Keyboard.ControlPressed) { - if (args.Key == Key.H && ReplayLoaded) + if (e.Key == Key.H && ReplayLoaded) { ToggleVisibility(); return true; } } - return base.OnKeyDown(state, args); + return base.OnKeyDown(e); } } } diff --git a/osu.Game/Screens/Play/HUD/QuitButton.cs b/osu.Game/Screens/Play/HUD/QuitButton.cs index 6b120421ad..569764aaf2 100644 --- a/osu.Game/Screens/Play/HUD/QuitButton.cs +++ b/osu.Game/Screens/Play/HUD/QuitButton.cs @@ -2,14 +2,12 @@ // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE using System; -using System.Linq; using osu.Framework.Allocation; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Shapes; using osu.Framework.Graphics.UserInterface; -using osu.Framework.Input.EventArgs; -using osu.Framework.Input.States; +using osu.Framework.Input.Events; using osu.Framework.MathUtils; using osu.Game.Graphics; using osu.Game.Graphics.Containers; @@ -62,10 +60,10 @@ namespace osu.Game.Screens.Play.HUD private float positionalAdjust; - protected override bool OnMouseMove(InputState state) + protected override bool OnMouseMove(MouseMoveEvent e) { - positionalAdjust = Vector2.Distance(state.Mouse.NativeState.Position, button.ScreenSpaceDrawQuad.Centre) / 200; - return base.OnMouseMove(state); + positionalAdjust = Vector2.Distance(e.Mouse.NativeState.Position, button.ScreenSpaceDrawQuad.Centre) / 200; + return base.OnMouseMove(e); } protected override void Update() @@ -170,26 +168,26 @@ namespace osu.Game.Screens.Play.HUD }); } - protected override bool OnHover(InputState state) + protected override bool OnHover(HoverEvent e) { HoverGained?.Invoke(); return true; } - protected override void OnHoverLost(InputState state) + protected override void OnHoverLost(HoverLostEvent e) { HoverLost?.Invoke(); - base.OnHoverLost(state); + base.OnHoverLost(e); } - protected override bool OnMouseDown(InputState state, MouseDownEventArgs args) + protected override bool OnMouseDown(MouseDownEvent e) { if (!pendingAnimation && state.Mouse.Buttons.Count() == 1) BeginConfirm(); return true; } - protected override bool OnMouseUp(InputState state, MouseUpEventArgs args) + protected override bool OnMouseUp(MouseUpEvent e) { if (!state.Mouse.Buttons.Any()) AbortConfirm(); diff --git a/osu.Game/Screens/Play/HUDOverlay.cs b/osu.Game/Screens/Play/HUDOverlay.cs index eb137f5447..3091cc5831 100644 --- a/osu.Game/Screens/Play/HUDOverlay.cs +++ b/osu.Game/Screens/Play/HUDOverlay.cs @@ -5,8 +5,7 @@ using osu.Framework.Allocation; using osu.Framework.Configuration; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; -using osu.Framework.Input.EventArgs; -using osu.Framework.Input.States; +using osu.Framework.Input.Events; using osu.Framework.Timing; using osu.Game.Beatmaps; using osu.Game.Configuration; @@ -152,13 +151,13 @@ namespace osu.Game.Screens.Play Progress.BindRulestContainer(rulesetContainer); } - protected override bool OnKeyDown(InputState state, KeyDownEventArgs args) + protected override bool OnKeyDown(KeyDownEvent e) { - if (args.Repeat) return false; + if (e.Repeat) return false; if (state.Keyboard.ShiftPressed) { - switch (args.Key) + switch (e.Key) { case Key.Tab: showHud.Value = !showHud.Value; @@ -166,7 +165,7 @@ namespace osu.Game.Screens.Play } } - return base.OnKeyDown(state, args); + return base.OnKeyDown(e); } protected virtual RollingCounter CreateAccuracyCounter() => new PercentageCounter diff --git a/osu.Game/Screens/Play/KeyCounterKeyboard.cs b/osu.Game/Screens/Play/KeyCounterKeyboard.cs index 1c2f2c0ac4..725eae0367 100644 --- a/osu.Game/Screens/Play/KeyCounterKeyboard.cs +++ b/osu.Game/Screens/Play/KeyCounterKeyboard.cs @@ -1,8 +1,7 @@ // Copyright (c) 2007-2018 ppy Pty Ltd . // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE -using osu.Framework.Input.EventArgs; -using osu.Framework.Input.States; +using osu.Framework.Input.Events; using OpenTK.Input; namespace osu.Game.Screens.Play @@ -15,16 +14,16 @@ namespace osu.Game.Screens.Play Key = key; } - protected override bool OnKeyDown(InputState state, KeyDownEventArgs args) + protected override bool OnKeyDown(KeyDownEvent e) { - if (args.Key == Key) IsLit = true; - return base.OnKeyDown(state, args); + if (e.Key == Key) IsLit = true; + return base.OnKeyDown(e); } - protected override bool OnKeyUp(InputState state, KeyUpEventArgs args) + protected override bool OnKeyUp(KeyUpEvent e) { - if (args.Key == Key) IsLit = false; - return base.OnKeyUp(state, args); + if (e.Key == Key) IsLit = false; + return base.OnKeyUp(e); } } } diff --git a/osu.Game/Screens/Play/KeyCounterMouse.cs b/osu.Game/Screens/Play/KeyCounterMouse.cs index 37c2b4f072..c1ed5f84f4 100644 --- a/osu.Game/Screens/Play/KeyCounterMouse.cs +++ b/osu.Game/Screens/Play/KeyCounterMouse.cs @@ -1,8 +1,7 @@ // Copyright (c) 2007-2018 ppy Pty Ltd . // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE -using osu.Framework.Input.EventArgs; -using osu.Framework.Input.States; +using osu.Framework.Input.Events; using OpenTK.Input; using OpenTK; @@ -32,16 +31,16 @@ namespace osu.Game.Screens.Play } } - protected override bool OnMouseDown(InputState state, MouseDownEventArgs args) + protected override bool OnMouseDown(MouseDownEvent e) { - if (args.Button == Button) IsLit = true; - return base.OnMouseDown(state, args); + if (e.Button == Button) IsLit = true; + return base.OnMouseDown(e); } - protected override bool OnMouseUp(InputState state, MouseUpEventArgs args) + protected override bool OnMouseUp(MouseUpEvent e) { - if (args.Button == Button) IsLit = false; - return base.OnMouseUp(state, args); + if (e.Button == Button) IsLit = false; + return base.OnMouseUp(e); } } } diff --git a/osu.Game/Screens/Play/Player.cs b/osu.Game/Screens/Play/Player.cs index 5ad0130fd7..b3cbeb3850 100644 --- a/osu.Game/Screens/Play/Player.cs +++ b/osu.Game/Screens/Play/Player.cs @@ -12,7 +12,7 @@ using osu.Framework.Configuration; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Cursor; -using osu.Framework.Input.States; +using osu.Framework.Input.Events; using osu.Framework.Logging; using osu.Framework.Screens; using osu.Framework.Threading; @@ -370,7 +370,7 @@ namespace osu.Game.Screens.Play Content.FadeOut(fadeOutDuration); } - protected override bool OnScroll(InputState state) => mouseWheelDisabled.Value && !pauseContainer.IsPaused; + protected override bool OnScroll(ScrollEvent e) => mouseWheelDisabled.Value && !pauseContainer.IsPaused; private void initializeStoryboard(bool asyncLoad) { diff --git a/osu.Game/Screens/Play/PlayerLoader.cs b/osu.Game/Screens/Play/PlayerLoader.cs index 05a43b32f0..d87fb1db86 100644 --- a/osu.Game/Screens/Play/PlayerLoader.cs +++ b/osu.Game/Screens/Play/PlayerLoader.cs @@ -7,7 +7,7 @@ using osu.Framework.Allocation; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Sprites; -using osu.Framework.Input.States; +using osu.Framework.Input.Events; using osu.Framework.Localisation; using osu.Framework.Screens; using osu.Framework.Threading; @@ -136,21 +136,21 @@ namespace osu.Game.Screens.Play private bool readyForPush => player.LoadState == LoadState.Ready && IsHovered && GetContainingInputManager()?.DraggedDrawable == null; - protected override bool OnHover(InputState state) + protected override bool OnHover(HoverEvent e) { // restore our screen defaults InitializeBackgroundElements(); - return base.OnHover(state); + return base.OnHover(e); } - protected override void OnHoverLost(InputState state) + protected override void OnHoverLost(HoverLostEvent e) { if (GetContainingInputManager().HoveredDrawables.Contains(visualSettings)) { // show user setting preview UpdateBackgroundElements(); } - base.OnHoverLost(state); + base.OnHoverLost(e); } protected override void InitializeBackgroundElements() diff --git a/osu.Game/Screens/Play/PlayerSettings/PlayerSettingsGroup.cs b/osu.Game/Screens/Play/PlayerSettings/PlayerSettingsGroup.cs index 64c49099f2..6e317ccfc9 100644 --- a/osu.Game/Screens/Play/PlayerSettings/PlayerSettingsGroup.cs +++ b/osu.Game/Screens/Play/PlayerSettings/PlayerSettingsGroup.cs @@ -5,8 +5,7 @@ using osu.Framework.Allocation; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Shapes; -using osu.Framework.Input.EventArgs; -using osu.Framework.Input.States; +using osu.Framework.Input.Events; using osu.Game.Graphics; using osu.Game.Graphics.Sprites; using osu.Game.Graphics.UserInterface; @@ -137,16 +136,16 @@ namespace osu.Game.Screens.Play.PlayerSettings this.Delay(600).FadeTo(inactive_alpha, fade_duration, Easing.OutQuint); } - protected override bool OnHover(InputState state) + protected override bool OnHover(HoverEvent e) { this.FadeIn(fade_duration, Easing.OutQuint); return true; } - protected override void OnHoverLost(InputState state) + protected override void OnHoverLost(HoverLostEvent e) { this.FadeTo(inactive_alpha, fade_duration, Easing.OutQuint); - base.OnHoverLost(state); + base.OnHoverLost(e); } [BackgroundDependencyLoader] @@ -161,6 +160,6 @@ namespace osu.Game.Screens.Play.PlayerSettings protected override Container Content => content; - protected override bool OnMouseDown(InputState state, MouseDownEventArgs args) => true; + protected override bool OnMouseDown(MouseDownEvent e) => true; } } diff --git a/osu.Game/Screens/Play/SkipOverlay.cs b/osu.Game/Screens/Play/SkipOverlay.cs index d736a51a99..a1c43c014a 100644 --- a/osu.Game/Screens/Play/SkipOverlay.cs +++ b/osu.Game/Screens/Play/SkipOverlay.cs @@ -18,8 +18,7 @@ using OpenTK.Graphics; using osu.Framework.Graphics.Shapes; using osu.Game.Graphics.Containers; using osu.Framework.Input.Bindings; -using osu.Framework.Input.EventArgs; -using osu.Framework.Input.States; +using osu.Framework.Input.Events; using osu.Game.Input.Bindings; namespace osu.Game.Screens.Play @@ -129,11 +128,11 @@ namespace osu.Game.Screens.Play remainingTimeBox.ResizeWidthTo((float)Math.Max(0, 1 - (Time.Current - displayTime) / (beginFadeTime - displayTime)), 120, Easing.OutQuint); } - protected override bool OnMouseMove(InputState state) + protected override bool OnMouseMove(MouseMoveEvent e) { - if (!state.Mouse.HasAnyButtonPressed) + if (!e.Mouse.HasAnyButtonPressed) fadeContainer.State = Visibility.Visible; - return base.OnMouseMove(state); + return base.OnMouseMove(e); } public bool OnPressed(GlobalAction action) @@ -194,16 +193,16 @@ namespace osu.Game.Screens.Play State = Visibility.Visible; } - protected override bool OnMouseDown(InputState state, MouseDownEventArgs args) + protected override bool OnMouseDown(MouseDownEvent e) { scheduledHide?.Cancel(); - return base.OnMouseDown(state, args); + return base.OnMouseDown(e); } - protected override bool OnMouseUp(InputState state, MouseUpEventArgs args) + protected override bool OnMouseUp(MouseUpEvent e) { State = Visibility.Visible; - return base.OnMouseUp(state, args); + return base.OnMouseUp(e); } } @@ -284,7 +283,7 @@ namespace osu.Game.Screens.Play }; } - protected override bool OnHover(InputState state) + protected override bool OnHover(HoverEvent e) { flow.TransformSpacingTo(new Vector2(5), 500, Easing.OutQuint); box.FadeColour(colourHover, 500, Easing.OutQuint); @@ -292,27 +291,27 @@ namespace osu.Game.Screens.Play return true; } - protected override void OnHoverLost(InputState state) + protected override void OnHoverLost(HoverLostEvent e) { flow.TransformSpacingTo(new Vector2(0), 500, Easing.OutQuint); box.FadeColour(colourNormal, 500, Easing.OutQuint); background.FadeTo(0.2f, 500, Easing.OutQuint); - base.OnHoverLost(state); + base.OnHoverLost(e); } - protected override bool OnMouseDown(InputState state, MouseDownEventArgs args) + protected override bool OnMouseDown(MouseDownEvent e) { aspect.ScaleTo(0.75f, 2000, Easing.OutQuint); - return base.OnMouseDown(state, args); + return base.OnMouseDown(e); } - protected override bool OnMouseUp(InputState state, MouseUpEventArgs args) + protected override bool OnMouseUp(MouseUpEvent e) { aspect.ScaleTo(1, 1000, Easing.OutElastic); - return base.OnMouseUp(state, args); + return base.OnMouseUp(e); } - protected override bool OnClick(InputState state) + protected override bool OnClick(ClickEvent e) { if (!Enabled) return false; @@ -322,7 +321,7 @@ namespace osu.Game.Screens.Play box.FlashColour(Color4.White, 500, Easing.OutQuint); aspect.ScaleTo(1.2f, 2000, Easing.OutQuint); - bool result = base.OnClick(state); + bool result = base.OnClick(e); // for now, let's disable the skip button after the first press. // this will likely need to be contextual in the future (bound from external components). diff --git a/osu.Game/Screens/Select/BeatmapCarousel.cs b/osu.Game/Screens/Select/BeatmapCarousel.cs index 5771cb1f70..7c9053d2f0 100644 --- a/osu.Game/Screens/Select/BeatmapCarousel.cs +++ b/osu.Game/Screens/Select/BeatmapCarousel.cs @@ -17,8 +17,7 @@ using osu.Framework.Caching; using osu.Framework.Threading; using osu.Framework.Configuration; using osu.Framework.Extensions.IEnumerableExtensions; -using osu.Framework.Input.EventArgs; -using osu.Framework.Input.States; +using osu.Framework.Input.Events; using osu.Game.Beatmaps; using osu.Game.Graphics.Containers; using osu.Game.Graphics.Cursor; @@ -381,12 +380,12 @@ namespace osu.Game.Screens.Select public void ScrollToSelected() => scrollPositionCache.Invalidate(); - protected override bool OnKeyDown(InputState state, KeyDownEventArgs args) + protected override bool OnKeyDown(KeyDownEvent e) { int direction = 0; bool skipDifficulties = false; - switch (args.Key) + switch (e.Key) { case Key.Up: direction = -1; @@ -405,7 +404,7 @@ namespace osu.Game.Screens.Select } if (direction == 0) - return base.OnKeyDown(state, args); + return base.OnKeyDown(e); SelectNext(direction, skipDifficulties); return true; diff --git a/osu.Game/Screens/Select/Carousel/DrawableCarouselBeatmap.cs b/osu.Game/Screens/Select/Carousel/DrawableCarouselBeatmap.cs index 6071e163cf..109ac25cd1 100644 --- a/osu.Game/Screens/Select/Carousel/DrawableCarouselBeatmap.cs +++ b/osu.Game/Screens/Select/Carousel/DrawableCarouselBeatmap.cs @@ -10,7 +10,7 @@ using osu.Framework.Graphics.Cursor; using osu.Framework.Graphics.Shapes; using osu.Framework.Graphics.Sprites; using osu.Framework.Graphics.UserInterface; -using osu.Framework.Input.States; +using osu.Framework.Input.Events; using osu.Game.Beatmaps; using osu.Game.Beatmaps.Drawables; using osu.Game.Graphics; @@ -155,12 +155,12 @@ namespace osu.Game.Screens.Select.Carousel triangles.Colour = OsuColour.Gray(0.5f); } - protected override bool OnClick(InputState state) + protected override bool OnClick(ClickEvent e) { if (Item.State == CarouselItemState.Selected) startRequested?.Invoke(beatmap); - return base.OnClick(state); + return base.OnClick(e); } protected override void ApplyState() diff --git a/osu.Game/Screens/Select/Carousel/DrawableCarouselItem.cs b/osu.Game/Screens/Select/Carousel/DrawableCarouselItem.cs index 8a0052559e..e11b342efe 100644 --- a/osu.Game/Screens/Select/Carousel/DrawableCarouselItem.cs +++ b/osu.Game/Screens/Select/Carousel/DrawableCarouselItem.cs @@ -8,7 +8,7 @@ using osu.Framework.Extensions.Color4Extensions; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Shapes; -using osu.Framework.Input.States; +using osu.Framework.Input.Events; using osu.Framework.MathUtils; using osu.Game.Graphics; using OpenTK; @@ -72,18 +72,18 @@ namespace osu.Game.Screens.Select.Carousel hoverLayer.Colour = colours.Blue.Opacity(0.1f); } - protected override bool OnHover(InputState state) + protected override bool OnHover(HoverEvent e) { sampleHover?.Play(); hoverLayer.FadeIn(100, Easing.OutQuint); - return base.OnHover(state); + return base.OnHover(e); } - protected override void OnHoverLost(InputState state) + protected override void OnHoverLost(HoverLostEvent e) { hoverLayer.FadeOut(1000, Easing.OutQuint); - base.OnHoverLost(state); + base.OnHoverLost(e); } public void SetMultiplicativeAlpha(float alpha) => borderContainer.Alpha = alpha; @@ -145,7 +145,7 @@ namespace osu.Game.Screens.Select.Carousel }; } - protected override bool OnClick(InputState state) + protected override bool OnClick(ClickEvent e) { Item.State.Value = CarouselItemState.Selected; return true; diff --git a/osu.Game/Screens/Select/FilterControl.cs b/osu.Game/Screens/Select/FilterControl.cs index 32b6620c84..fce7af1400 100644 --- a/osu.Game/Screens/Select/FilterControl.cs +++ b/osu.Game/Screens/Select/FilterControl.cs @@ -14,8 +14,7 @@ using osu.Game.Graphics.UserInterface; using osu.Game.Screens.Select.Filter; using Container = osu.Framework.Graphics.Containers.Container; using osu.Framework.Graphics.Shapes; -using osu.Framework.Input.EventArgs; -using osu.Framework.Input.States; +using osu.Framework.Input.Events; using osu.Game.Configuration; using osu.Game.Rulesets; @@ -187,10 +186,10 @@ namespace osu.Game.Screens.Select private void updateCriteria() => FilterChanged?.Invoke(CreateCriteria()); - protected override bool OnMouseDown(InputState state, MouseDownEventArgs args) => true; + protected override bool OnMouseDown(MouseDownEvent e) => true; - protected override bool OnMouseMove(InputState state) => true; + protected override bool OnMouseMove(MouseMoveEvent e) => true; - protected override bool OnClick(InputState state) => true; + protected override bool OnClick(ClickEvent e) => true; } } diff --git a/osu.Game/Screens/Select/Footer.cs b/osu.Game/Screens/Select/Footer.cs index bc4d216f00..5fe1aa31ac 100644 --- a/osu.Game/Screens/Select/Footer.cs +++ b/osu.Game/Screens/Select/Footer.cs @@ -11,8 +11,7 @@ using osu.Framework.Extensions.Color4Extensions; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Shapes; -using osu.Framework.Input.EventArgs; -using osu.Framework.Input.States; +using osu.Framework.Input.Events; using osu.Game.Graphics.UserInterface; namespace osu.Game.Screens.Select @@ -139,8 +138,8 @@ namespace osu.Game.Screens.Select updateModeLight(); } - protected override bool OnMouseDown(InputState state, MouseDownEventArgs args) => true; + protected override bool OnMouseDown(MouseDownEvent e) => true; - protected override bool OnClick(InputState state) => true; + protected override bool OnClick(ClickEvent e) => true; } } diff --git a/osu.Game/Screens/Select/FooterButton.cs b/osu.Game/Screens/Select/FooterButton.cs index 8fb95d394e..1521c0f413 100644 --- a/osu.Game/Screens/Select/FooterButton.cs +++ b/osu.Game/Screens/Select/FooterButton.cs @@ -8,8 +8,7 @@ using OpenTK.Input; using osu.Framework.Graphics; using osu.Framework.Graphics.Shapes; using osu.Framework.Graphics.Sprites; -using osu.Framework.Input.EventArgs; -using osu.Framework.Input.States; +using osu.Framework.Input.Events; using osu.Game.Graphics.Sprites; using osu.Game.Graphics.Containers; @@ -89,7 +88,7 @@ namespace osu.Game.Screens.Select public Action HoverLost; public Key? Hotkey; - protected override bool OnHover(InputState state) + protected override bool OnHover(HoverEvent e) { Hovered?.Invoke(); light.ScaleTo(new Vector2(1, 2), Footer.TRANSITION_LENGTH, Easing.OutQuint); @@ -97,42 +96,42 @@ namespace osu.Game.Screens.Select return true; } - protected override void OnHoverLost(InputState state) + protected override void OnHoverLost(HoverLostEvent e) { HoverLost?.Invoke(); light.ScaleTo(new Vector2(1, 1), Footer.TRANSITION_LENGTH, Easing.OutQuint); light.FadeColour(DeselectedColour, Footer.TRANSITION_LENGTH, Easing.OutQuint); } - protected override bool OnMouseDown(InputState state, MouseDownEventArgs args) + protected override bool OnMouseDown(MouseDownEvent e) { box.FadeTo(0.3f, Footer.TRANSITION_LENGTH * 2, Easing.OutQuint); - return base.OnMouseDown(state, args); + return base.OnMouseDown(e); } - protected override bool OnMouseUp(InputState state, MouseUpEventArgs args) + protected override bool OnMouseUp(MouseUpEvent e) { box.FadeOut(Footer.TRANSITION_LENGTH, Easing.OutQuint); - return base.OnMouseUp(state, args); + return base.OnMouseUp(e); } - protected override bool OnClick(InputState state) + protected override bool OnClick(ClickEvent e) { box.ClearTransforms(); box.Alpha = 1; box.FadeOut(Footer.TRANSITION_LENGTH * 3, Easing.OutQuint); - return base.OnClick(state); + return base.OnClick(e); } - protected override bool OnKeyDown(InputState state, KeyDownEventArgs args) + protected override bool OnKeyDown(KeyDownEvent e) { - if (!args.Repeat && args.Key == Hotkey) + if (!e.Repeat && e.Key == Hotkey) { OnClick(state); return true; } - return base.OnKeyDown(state, args); + return base.OnKeyDown(e); } } } diff --git a/osu.Game/Screens/Select/Leaderboards/LeaderboardScore.cs b/osu.Game/Screens/Select/Leaderboards/LeaderboardScore.cs index 95e9dde68e..241f6da3d1 100644 --- a/osu.Game/Screens/Select/Leaderboards/LeaderboardScore.cs +++ b/osu.Game/Screens/Select/Leaderboards/LeaderboardScore.cs @@ -10,7 +10,7 @@ using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Cursor; using osu.Framework.Graphics.Shapes; -using osu.Framework.Input.States; +using osu.Framework.Input.Events; using osu.Game.Graphics; using osu.Game.Graphics.Containers; using osu.Game.Graphics.Sprites; @@ -251,16 +251,16 @@ namespace osu.Game.Screens.Select.Leaderboards } } - protected override bool OnHover(InputState state) + protected override bool OnHover(HoverEvent e) { background.FadeTo(0.5f, 300, Easing.OutQuint); - return base.OnHover(state); + return base.OnHover(e); } - protected override void OnHoverLost(InputState state) + protected override void OnHoverLost(HoverLostEvent e) { background.FadeTo(background_alpha, 200, Easing.OutQuint); - base.OnHoverLost(state); + base.OnHoverLost(e); } private class GlowingSpriteText : Container diff --git a/osu.Game/Screens/Select/Leaderboards/RetrievalFailurePlaceholder.cs b/osu.Game/Screens/Select/Leaderboards/RetrievalFailurePlaceholder.cs index 19cba72f1f..6601c9df8b 100644 --- a/osu.Game/Screens/Select/Leaderboards/RetrievalFailurePlaceholder.cs +++ b/osu.Game/Screens/Select/Leaderboards/RetrievalFailurePlaceholder.cs @@ -3,8 +3,7 @@ using System; using osu.Framework.Graphics; -using osu.Framework.Input.EventArgs; -using osu.Framework.Input.States; +using osu.Framework.Input.Events; using osu.Game.Graphics; using osu.Game.Graphics.Containers; using OpenTK; @@ -49,16 +48,16 @@ namespace osu.Game.Screens.Select.Leaderboards }; } - protected override bool OnMouseDown(InputState state, MouseDownEventArgs args) + protected override bool OnMouseDown(MouseDownEvent e) { icon.ScaleTo(0.8f, 4000, Easing.OutQuint); - return base.OnMouseDown(state, args); + return base.OnMouseDown(e); } - protected override bool OnMouseUp(InputState state, MouseUpEventArgs args) + protected override bool OnMouseUp(MouseUpEvent e) { icon.ScaleTo(1, 1000, Easing.OutElastic); - return base.OnMouseUp(state, args); + return base.OnMouseUp(e); } } } diff --git a/osu.Game/Screens/Select/Options/BeatmapOptionsButton.cs b/osu.Game/Screens/Select/Options/BeatmapOptionsButton.cs index f9127ace19..a03b3f988a 100644 --- a/osu.Game/Screens/Select/Options/BeatmapOptionsButton.cs +++ b/osu.Game/Screens/Select/Options/BeatmapOptionsButton.cs @@ -5,8 +5,7 @@ using osu.Framework.Extensions.Color4Extensions; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Shapes; -using osu.Framework.Input.EventArgs; -using osu.Framework.Input.States; +using osu.Framework.Input.Events; using osu.Game.Graphics; using osu.Game.Graphics.Sprites; using OpenTK; @@ -53,30 +52,30 @@ namespace osu.Game.Screens.Select.Options public Key? HotKey; - protected override bool OnMouseDown(InputState state, MouseDownEventArgs args) + protected override bool OnMouseDown(MouseDownEvent e) { flash.FadeTo(0.1f, 1000, Easing.OutQuint); - return base.OnMouseDown(state, args); + return base.OnMouseDown(e); } - protected override bool OnMouseUp(InputState state, MouseUpEventArgs args) + protected override bool OnMouseUp(MouseUpEvent e) { flash.FadeTo(0, 1000, Easing.OutQuint); - return base.OnMouseUp(state, args); + return base.OnMouseUp(e); } - protected override bool OnClick(InputState state) + protected override bool OnClick(ClickEvent e) { flash.ClearTransforms(); flash.Alpha = 0.9f; flash.FadeOut(800, Easing.OutExpo); - return base.OnClick(state); + return base.OnClick(e); } - protected override bool OnKeyDown(InputState state, KeyDownEventArgs args) + protected override bool OnKeyDown(KeyDownEvent e) { - if (!args.Repeat && args.Key == HotKey) + if (!e.Repeat && e.Key == HotKey) { OnClick(state); return true; diff --git a/osu.Game/Screens/Select/SongSelect.cs b/osu.Game/Screens/Select/SongSelect.cs index b4dcbcce41..82f77768db 100644 --- a/osu.Game/Screens/Select/SongSelect.cs +++ b/osu.Game/Screens/Select/SongSelect.cs @@ -13,8 +13,7 @@ using osu.Framework.Configuration; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Framework.Logging; -using osu.Framework.Input.EventArgs; -using osu.Framework.Input.States; +using osu.Framework.Input.Events; using osu.Framework.Screens; using osu.Framework.Threading; using osu.Game.Beatmaps; @@ -554,11 +553,11 @@ namespace osu.Game.Screens.Select return base.OnPressed(action); } - protected override bool OnKeyDown(InputState state, KeyDownEventArgs args) + protected override bool OnKeyDown(KeyDownEvent e) { - if (args.Repeat) return false; + if (e.Repeat) return false; - switch (args.Key) + switch (e.Key) { case Key.Delete: if (state.Keyboard.ShiftPressed) @@ -571,7 +570,7 @@ namespace osu.Game.Screens.Select break; } - return base.OnKeyDown(state, args); + return base.OnKeyDown(e); } private class ResetScrollContainer : Container @@ -583,10 +582,10 @@ namespace osu.Game.Screens.Select this.onHoverAction = onHoverAction; } - protected override bool OnHover(InputState state) + protected override bool OnHover(HoverEvent e) { onHoverAction?.Invoke(); - return base.OnHover(state); + return base.OnHover(e); } } } diff --git a/osu.Game/Tests/Visual/EditorClockTestCase.cs b/osu.Game/Tests/Visual/EditorClockTestCase.cs index 0ca7ff011f..698d1a47a5 100644 --- a/osu.Game/Tests/Visual/EditorClockTestCase.cs +++ b/osu.Game/Tests/Visual/EditorClockTestCase.cs @@ -2,7 +2,7 @@ // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE using osu.Framework.Allocation; -using osu.Framework.Input.States; +using osu.Framework.Input.Events; using osu.Framework.Timing; using osu.Game.Beatmaps; using osu.Game.Beatmaps.ControlPoints; @@ -56,9 +56,9 @@ namespace osu.Game.Tests.Visual Clock.ProcessFrame(); } - protected override bool OnScroll(InputState state) + protected override bool OnScroll(ScrollEvent e) { - if (state.Mouse.ScrollDelta.Y > 0) + if (e.Mouse.ScrollDelta.Y > 0) Clock.SeekBackward(true); else Clock.SeekForward(true); diff --git a/osu.Game/osu.Game.csproj b/osu.Game/osu.Game.csproj index 8fb42c0cea..5704efd5a0 100644 --- a/osu.Game/osu.Game.csproj +++ b/osu.Game/osu.Game.csproj @@ -18,7 +18,7 @@ - + From 50091252e272564807e046b699d6619382a44891 Mon Sep 17 00:00:00 2001 From: ekrctb Date: Wed, 19 Sep 2018 20:52:57 +0900 Subject: [PATCH 187/417] Adapt signature change of event handlers --- .../Objects/Drawables/Pieces/SliderBall.cs | 14 ++++++------- .../Objects/Drawables/Pieces/SpinnerDisc.cs | 2 +- osu.Game.Rulesets.Osu/OsuInputManager.cs | 13 +++++------- .../UI/Cursor/CursorTrail.cs | 2 +- osu.Game.Tests/Visual/TestCaseCursors.cs | 2 +- .../Containers/OsuFocusedOverlayContainer.cs | 2 +- .../Graphics/Containers/OsuScrollContainer.cs | 9 ++++----- .../Graphics/Containers/ParallaxContainer.cs | 2 +- osu.Game/Graphics/Cursor/MenuCursor.cs | 8 ++++---- .../Graphics/UserInterface/SearchTextBox.cs | 5 +++-- osu.Game/Overlays/ChatOverlay.cs | 5 +---- osu.Game/Overlays/KeyBinding/KeyBindingRow.cs | 20 +++++++++---------- osu.Game/Overlays/MedalOverlay.cs | 2 +- osu.Game/Overlays/Mods/ModButton.cs | 2 +- osu.Game/Overlays/Mods/ModSection.cs | 2 +- osu.Game/Overlays/Music/PlaylistList.cs | 6 +++--- osu.Game/Overlays/MusicController.cs | 8 +------- osu.Game/Overlays/Profile/Header/RankGraph.cs | 4 ++-- .../Toolbar/ToolbarRulesetSelector.cs | 2 +- osu.Game/Overlays/Volume/VolumeMeter.cs | 2 +- osu.Game/Rulesets/Edit/HitObjectMask.cs | 8 ++++---- osu.Game/Rulesets/UI/RulesetInputManager.cs | 16 ++++++++------- .../Timelines/Summary/Parts/MarkerPart.cs | 4 ++-- osu.Game/Screens/Edit/Editor.cs | 2 +- .../Screens/Compose/BeatDivisorControl.cs | 9 ++++----- .../Edit/Screens/Compose/Layers/DragLayer.cs | 4 ++-- .../Screens/Compose/Layers/MaskContainer.cs | 5 +++-- .../Screens/Compose/Layers/MaskSelection.cs | 4 ++-- .../Timeline/ZoomableScrollContainer.cs | 4 ++-- osu.Game/Screens/Menu/Button.cs | 3 ++- osu.Game/Screens/Menu/MainMenu.cs | 3 ++- osu.Game/Screens/Play/GameplayMenuOverlay.cs | 2 +- .../Screens/Play/HUD/PlayerSettingsOverlay.cs | 2 +- osu.Game/Screens/Play/HUD/QuitButton.cs | 7 ++++--- osu.Game/Screens/Play/HUDOverlay.cs | 2 +- osu.Game/Screens/Play/SkipOverlay.cs | 2 +- osu.Game/Screens/Select/FooterButton.cs | 2 +- .../Select/Options/BeatmapOptionsButton.cs | 2 +- osu.Game/Screens/Select/SongSelect.cs | 2 +- osu.Game/Tests/Visual/EditorClockTestCase.cs | 2 +- 40 files changed, 94 insertions(+), 103 deletions(-) diff --git a/osu.Game.Rulesets.Osu/Objects/Drawables/Pieces/SliderBall.cs b/osu.Game.Rulesets.Osu/Objects/Drawables/Pieces/SliderBall.cs index c19bbc439d..3081ae49fc 100644 --- a/osu.Game.Rulesets.Osu/Objects/Drawables/Pieces/SliderBall.cs +++ b/osu.Game.Rulesets.Osu/Objects/Drawables/Pieces/SliderBall.cs @@ -6,10 +6,10 @@ using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Shapes; using osu.Framework.Input.Events; -using osu.Framework.Input.States; using osu.Game.Rulesets.Objects.Types; using OpenTK.Graphics; using osu.Game.Skinning; +using OpenTK; namespace osu.Game.Rulesets.Osu.Objects.Drawables.Pieces { @@ -102,23 +102,23 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables.Pieces }; } - private InputState lastState; + private Vector2? lastScreenSpaceMousePosition; protected override bool OnMouseDown(MouseDownEvent e) { - lastState = state; + lastScreenSpaceMousePosition = e.ScreenSpaceMousePosition; return base.OnMouseDown(e); } protected override bool OnMouseUp(MouseUpEvent e) { - lastState = state; + lastScreenSpaceMousePosition = e.ScreenSpaceMousePosition; return base.OnMouseUp(e); } protected override bool OnMouseMove(MouseMoveEvent e) { - lastState = e; + lastScreenSpaceMousePosition = e.ScreenSpaceMousePosition; return base.OnMouseMove(e); } @@ -155,8 +155,8 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables.Pieces { // Make sure to use the base version of ReceivePositionalInputAt so that we correctly check the position. Tracking = canCurrentlyTrack - && lastState != null - && ReceivePositionalInputAt(lastState.Mouse.NativeState.Position) + && lastScreenSpaceMousePosition.HasValue + && ReceivePositionalInputAt(lastScreenSpaceMousePosition.Value) && (drawableSlider?.OsuActionInputManager?.PressedActions.Any(x => x == OsuAction.LeftButton || x == OsuAction.RightButton) ?? false); } } diff --git a/osu.Game.Rulesets.Osu/Objects/Drawables/Pieces/SpinnerDisc.cs b/osu.Game.Rulesets.Osu/Objects/Drawables/Pieces/SpinnerDisc.cs index 7a577383ae..4dd1c5f218 100644 --- a/osu.Game.Rulesets.Osu/Objects/Drawables/Pieces/SpinnerDisc.cs +++ b/osu.Game.Rulesets.Osu/Objects/Drawables/Pieces/SpinnerDisc.cs @@ -70,7 +70,7 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables.Pieces protected override bool OnMouseMove(MouseMoveEvent e) { - mousePosition = Parent.ToLocalSpace(e.Mouse.NativeState.Position); + mousePosition = Parent.ToLocalSpace(e.ScreenSpaceMousePosition); return base.OnMouseMove(e); } diff --git a/osu.Game.Rulesets.Osu/OsuInputManager.cs b/osu.Game.Rulesets.Osu/OsuInputManager.cs index 70b35fbd96..0f7bc30888 100644 --- a/osu.Game.Rulesets.Osu/OsuInputManager.cs +++ b/osu.Game.Rulesets.Osu/OsuInputManager.cs @@ -5,7 +5,6 @@ using System.Collections.Generic; using System.ComponentModel; using osu.Framework.Input.Bindings; using osu.Framework.Input.Events; -using osu.Framework.Input.States; using osu.Game.Rulesets.UI; namespace osu.Game.Rulesets.Osu @@ -36,13 +35,11 @@ namespace osu.Game.Rulesets.Osu { } - protected override bool OnKeyDown(KeyDownEvent e) => AllowUserPresses && base.OnKeyDown(e); - protected override bool OnKeyUp(KeyUpEvent e) => AllowUserPresses && base.OnKeyUp(e); - protected override bool OnJoystickPress(InputState state, JoystickEventArgs args) => AllowUserPresses && base.OnJoystickPress(args); - protected override bool OnJoystickRelease(InputState state, JoystickEventArgs args) => AllowUserPresses && base.OnJoystickRelease(args); - protected override bool OnMouseDown(MouseDownEvent e) => AllowUserPresses && base.OnMouseDown(e); - protected override bool OnMouseUp(MouseUpEvent e) => AllowUserPresses && base.OnMouseUp(e); - protected override bool OnScroll(ScrollEvent e) => AllowUserPresses && base.OnScroll(e); + protected override bool Handle(UIEvent e) + { + if (!AllowUserPresses) return false; + return base.Handle(e); + } } } diff --git a/osu.Game.Rulesets.Osu/UI/Cursor/CursorTrail.cs b/osu.Game.Rulesets.Osu/UI/Cursor/CursorTrail.cs index 8a701f1afc..4b5513ff9c 100644 --- a/osu.Game.Rulesets.Osu/UI/Cursor/CursorTrail.cs +++ b/osu.Game.Rulesets.Osu/UI/Cursor/CursorTrail.cs @@ -119,7 +119,7 @@ namespace osu.Game.Rulesets.Osu.UI.Cursor protected override bool OnMouseMove(MouseMoveEvent e) { - Vector2 pos = e.Mouse.NativeState.Position; + Vector2 pos = e.ScreenSpaceMousePosition; if (lastPosition == null) { diff --git a/osu.Game.Tests/Visual/TestCaseCursors.cs b/osu.Game.Tests/Visual/TestCaseCursors.cs index cdb6b8c1f8..1f409f043e 100644 --- a/osu.Game.Tests/Visual/TestCaseCursors.cs +++ b/osu.Game.Tests/Visual/TestCaseCursors.cs @@ -184,7 +184,7 @@ namespace osu.Game.Tests.Visual /// /// The cursor to check. private bool checkAtMouse(CursorContainer cursorContainer) - => Precision.AlmostEquals(InputManager.CurrentState.Mouse.NativeState.Position, cursorContainer.ToScreenSpace(cursorContainer.ActiveCursor.DrawPosition)); + => Precision.AlmostEquals(InputManager.CurrentState.Mouse.Position, cursorContainer.ToScreenSpace(cursorContainer.ActiveCursor.DrawPosition)); private class CustomCursorBox : Container, IProvideCursor { diff --git a/osu.Game/Graphics/Containers/OsuFocusedOverlayContainer.cs b/osu.Game/Graphics/Containers/OsuFocusedOverlayContainer.cs index 14f18e554d..2aa3fede2c 100644 --- a/osu.Game/Graphics/Containers/OsuFocusedOverlayContainer.cs +++ b/osu.Game/Graphics/Containers/OsuFocusedOverlayContainer.cs @@ -61,7 +61,7 @@ namespace osu.Game.Graphics.Containers protected override bool OnClick(ClickEvent e) { - if (!base.ReceivePositionalInputAt(state.Mouse.NativeState.Position)) + if (!base.ReceivePositionalInputAt(e.ScreenSpaceMousePosition)) { State = Visibility.Hidden; return true; diff --git a/osu.Game/Graphics/Containers/OsuScrollContainer.cs b/osu.Game/Graphics/Containers/OsuScrollContainer.cs index 5c5c42ba70..4f18eb9e7b 100644 --- a/osu.Game/Graphics/Containers/OsuScrollContainer.cs +++ b/osu.Game/Graphics/Containers/OsuScrollContainer.cs @@ -3,7 +3,6 @@ using osu.Framework.Graphics.Containers; using osu.Framework.Input.Events; -using osu.Framework.Input.States; using OpenTK.Input; namespace osu.Game.Graphics.Containers @@ -21,7 +20,7 @@ namespace osu.Game.Graphics.Containers /// public double DistanceDecayOnRightMouseScrollbar = 0.02; - private bool shouldPerformRightMouseScroll(InputState state) => RightMouseScrollbar && state.Mouse.IsPressed(MouseButton.Right); + private bool shouldPerformRightMouseScroll(MouseButtonEvent e) => RightMouseScrollbar && e.Button == MouseButton.Right; private void scrollToRelative(float value) => ScrollTo(Clamp((value - Scrollbar.DrawSize[ScrollDim] / 2) / Scrollbar.Size[ScrollDim]), true, DistanceDecayOnRightMouseScrollbar); @@ -31,9 +30,9 @@ namespace osu.Game.Graphics.Containers protected override bool OnMouseDown(MouseDownEvent e) { - if (shouldPerformRightMouseScroll(state)) + if (shouldPerformRightMouseScroll(e)) { - scrollToRelative(state.Mouse.Position[ScrollDim]); + scrollToRelative(e.MousePosition[ScrollDim]); return true; } @@ -44,7 +43,7 @@ namespace osu.Game.Graphics.Containers { if (mouseScrollBarDragging) { - scrollToRelative(e.Mouse.Position[ScrollDim]); + scrollToRelative(e.MousePosition[ScrollDim]); return true; } diff --git a/osu.Game/Graphics/Containers/ParallaxContainer.cs b/osu.Game/Graphics/Containers/ParallaxContainer.cs index 8e1e5d54fa..a6b79a20dc 100644 --- a/osu.Game/Graphics/Containers/ParallaxContainer.cs +++ b/osu.Game/Graphics/Containers/ParallaxContainer.cs @@ -67,7 +67,7 @@ namespace osu.Game.Graphics.Containers if (parallaxEnabled) { - Vector2 offset = (input.CurrentState.Mouse == null ? Vector2.Zero : ToLocalSpace(input.CurrentState.Mouse.NativeState.Position) - DrawSize / 2) * ParallaxAmount; + Vector2 offset = (input.CurrentState.Mouse == null ? Vector2.Zero : ToLocalSpace(input.CurrentState.Mouse.Position) - DrawSize / 2) * ParallaxAmount; double elapsed = MathHelper.Clamp(Clock.ElapsedFrameTime, 0, 1000); diff --git a/osu.Game/Graphics/Cursor/MenuCursor.cs b/osu.Game/Graphics/Cursor/MenuCursor.cs index a34a7c53d0..6bd3b986c8 100644 --- a/osu.Game/Graphics/Cursor/MenuCursor.cs +++ b/osu.Game/Graphics/Cursor/MenuCursor.cs @@ -43,7 +43,7 @@ namespace osu.Game.Graphics.Cursor { if (dragRotationState != DragRotationState.NotDragging) { - var position = e.Mouse.Position; + var position = e.MousePosition; var distance = Vector2Extensions.Distance(position, positionMouseDown); // don't start rotating until we're moved a minimum distance away from the mouse down location, // else it can have an annoying effect. @@ -52,7 +52,7 @@ namespace osu.Game.Graphics.Cursor // don't rotate when distance is zero to avoid NaN if (dragRotationState == DragRotationState.Rotating && distance > 0) { - Vector2 offset = e.Mouse.Position - positionMouseDown; + Vector2 offset = e.MousePosition - positionMouseDown; float degrees = (float)MathHelper.RadiansToDegrees(Math.Atan2(-offset.X, offset.Y)) + 24.3f; // Always rotate in the direction of least distance @@ -83,14 +83,14 @@ namespace osu.Game.Graphics.Cursor if (e.Button == MouseButton.Left && cursorRotate) { dragRotationState = DragRotationState.DragStarted; - positionMouseDown = state.Mouse.Position; + positionMouseDown = e.MousePosition; } return base.OnMouseDown(e); } protected override bool OnMouseUp(MouseUpEvent e) { - if (!state.Mouse.HasMainButtonPressed) + if (!e.CurrentState.Mouse.HasMainButtonPressed) { activeCursor.AdditiveLayer.FadeOutFromOne(500, Easing.OutQuint); activeCursor.ScaleTo(1, 500, Easing.OutElastic); diff --git a/osu.Game/Graphics/UserInterface/SearchTextBox.cs b/osu.Game/Graphics/UserInterface/SearchTextBox.cs index 8aa3a3f663..67ee35df04 100644 --- a/osu.Game/Graphics/UserInterface/SearchTextBox.cs +++ b/osu.Game/Graphics/UserInterface/SearchTextBox.cs @@ -34,7 +34,8 @@ namespace osu.Game.Graphics.UserInterface protected override bool OnKeyDown(KeyDownEvent e) { - if (!state.Keyboard.ControlPressed && !state.Keyboard.ShiftPressed) + var keyboard = e.CurrentState.Keyboard; + if (!keyboard.ControlPressed && !keyboard.ShiftPressed) { switch (e.Key) { @@ -56,7 +57,7 @@ namespace osu.Game.Graphics.UserInterface } } - if (state.Keyboard.ShiftPressed) + if (keyboard.ShiftPressed) { switch (e.Key) { diff --git a/osu.Game/Overlays/ChatOverlay.cs b/osu.Game/Overlays/ChatOverlay.cs index 0424481f77..5312207e4e 100644 --- a/osu.Game/Overlays/ChatOverlay.cs +++ b/osu.Game/Overlays/ChatOverlay.cs @@ -206,10 +206,7 @@ namespace osu.Game.Overlays { if (isDragging) { - Trace.Assert(e.Mouse.PositionMouseDown != null); - - // ReSharper disable once PossibleInvalidOperationException - double targetChatHeight = startDragChatHeight - (e.Mouse.Position.Y - e.Mouse.PositionMouseDown.Value.Y) / Parent.DrawSize.Y; + double targetChatHeight = startDragChatHeight - (e.MousePosition.Y - e.MouseDownPosition.Y) / Parent.DrawSize.Y; // If the channel selection screen is shown, mind its minimum height if (channelSelection.State == Visibility.Visible && targetChatHeight > 1f - channel_selection_min_height) diff --git a/osu.Game/Overlays/KeyBinding/KeyBindingRow.cs b/osu.Game/Overlays/KeyBinding/KeyBindingRow.cs index fb17635806..87325c69aa 100644 --- a/osu.Game/Overlays/KeyBinding/KeyBindingRow.cs +++ b/osu.Game/Overlays/KeyBinding/KeyBindingRow.cs @@ -11,14 +11,12 @@ using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Shapes; using osu.Framework.Input.Bindings; using osu.Framework.Input.Events; -using osu.Framework.Input.States; using osu.Game.Graphics; using osu.Game.Graphics.Containers; using osu.Game.Graphics.Sprites; using osu.Game.Input; using OpenTK.Graphics; using OpenTK.Input; -using JoystickEventArgs = osu.Framework.Input.EventArgs.JoystickEventArgs; namespace osu.Game.Overlays.KeyBinding { @@ -166,14 +164,14 @@ namespace osu.Game.Overlays.KeyBinding } } - bindTarget.UpdateKeyCombination(KeyCombination.FromInputState(state)); + bindTarget.UpdateKeyCombination(KeyCombination.FromInputState(e.CurrentState)); return true; } protected override bool OnMouseUp(MouseUpEvent e) { // don't do anything until the last button is released. - if (!HasFocus || state.Mouse.Buttons.Any()) + if (!HasFocus || e.CurrentState.Mouse.HasAnyButtonPressed) return base.OnMouseUp(e); if (bindTarget.IsHovered) @@ -189,7 +187,7 @@ namespace osu.Game.Overlays.KeyBinding { if (bindTarget.IsHovered) { - bindTarget.UpdateKeyCombination(KeyCombination.FromInputState(e, e.Mouse.ScrollDelta)); + bindTarget.UpdateKeyCombination(KeyCombination.FromInputState(e.CurrentState, e.ScrollDelta)); finalise(); return true; } @@ -207,7 +205,7 @@ namespace osu.Game.Overlays.KeyBinding { case Key.Delete: { - if (state.Keyboard.ShiftPressed) + if (e.CurrentState.Keyboard.ShiftPressed) { bindTarget.UpdateKeyCombination(InputKey.None); finalise(); @@ -218,7 +216,7 @@ namespace osu.Game.Overlays.KeyBinding } } - bindTarget.UpdateKeyCombination(KeyCombination.FromInputState(state)); + bindTarget.UpdateKeyCombination(KeyCombination.FromInputState(e.CurrentState)); if (!isModifier(e.Key)) finalise(); return true; @@ -232,21 +230,21 @@ namespace osu.Game.Overlays.KeyBinding return true; } - protected override bool OnJoystickPress(InputState state, JoystickEventArgs args) + protected override bool OnJoystickPress(JoystickPressEvent e) { if (!HasFocus) return false; - bindTarget.UpdateKeyCombination(KeyCombination.FromInputState(state)); + bindTarget.UpdateKeyCombination(KeyCombination.FromInputState(e.CurrentState)); finalise(); return true; } - protected override bool OnJoystickRelease(InputState state, JoystickEventArgs args) + protected override bool OnJoystickRelease(JoystickReleaseEvent e) { if (!HasFocus) - return base.OnJoystickRelease(args); + return base.OnJoystickRelease(e); finalise(); return true; diff --git a/osu.Game/Overlays/MedalOverlay.cs b/osu.Game/Overlays/MedalOverlay.cs index 7e0954899d..13c01cb88f 100644 --- a/osu.Game/Overlays/MedalOverlay.cs +++ b/osu.Game/Overlays/MedalOverlay.cs @@ -183,7 +183,7 @@ namespace osu.Game.Overlays protected override void OnFocusLost(FocusLostEvent e) { - if (e.Keyboard.Keys.Contains(Key.Escape)) dismiss(); + if (e.CurrentState.Keyboard.IsPressed(Key.Escape)) dismiss(); } private const double initial_duration = 400; diff --git a/osu.Game/Overlays/Mods/ModButton.cs b/osu.Game/Overlays/Mods/ModButton.cs index 40b9793be4..ecb65f6df2 100644 --- a/osu.Game/Overlays/Mods/ModButton.cs +++ b/osu.Game/Overlays/Mods/ModButton.cs @@ -159,7 +159,7 @@ namespace osu.Game.Overlays.Mods scaleContainer.ScaleTo(1, 500, Easing.OutElastic); // only trigger the event if we are inside the area of the button - if (Contains(ToScreenSpace(state.Mouse.Position - Position))) + if (Contains(e.ScreenSpaceMousePosition)) { switch (e.Button) { diff --git a/osu.Game/Overlays/Mods/ModSection.cs b/osu.Game/Overlays/Mods/ModSection.cs index 3ba49042e5..4759325bc4 100644 --- a/osu.Game/Overlays/Mods/ModSection.cs +++ b/osu.Game/Overlays/Mods/ModSection.cs @@ -60,7 +60,7 @@ namespace osu.Game.Overlays.Mods { var index = Array.IndexOf(ToggleKeys, e.Key); if (index > -1 && index < buttons.Length) - buttons[index].SelectNext(state.Keyboard.ShiftPressed ? -1 : 1); + buttons[index].SelectNext(e.CurrentState.Keyboard.ShiftPressed ? -1 : 1); } return base.OnKeyDown(e); diff --git a/osu.Game/Overlays/Music/PlaylistList.cs b/osu.Game/Overlays/Music/PlaylistList.cs index 48c07846b8..17c8d2f154 100644 --- a/osu.Game/Overlays/Music/PlaylistList.cs +++ b/osu.Game/Overlays/Music/PlaylistList.cs @@ -117,14 +117,14 @@ namespace osu.Game.Overlays.Music protected override bool OnDragStart(DragStartEvent e) { - nativeDragPosition = e.Mouse.NativeState.Position; + nativeDragPosition = e.ScreenSpaceMousePosition; draggedItem = items.FirstOrDefault(d => d.IsDraggable); return draggedItem != null || base.OnDragStart(e); } protected override bool OnDrag(DragEvent e) { - nativeDragPosition = e.Mouse.NativeState.Position; + nativeDragPosition = e.ScreenSpaceMousePosition; if (draggedItem == null) return base.OnDrag(e); return true; @@ -132,7 +132,7 @@ namespace osu.Game.Overlays.Music protected override bool OnDragEnd(DragEndEvent e) { - nativeDragPosition = e.Mouse.NativeState.Position; + nativeDragPosition = e.ScreenSpaceMousePosition; var handled = draggedItem != null || base.OnDragEnd(e); draggedItem = null; diff --git a/osu.Game/Overlays/MusicController.cs b/osu.Game/Overlays/MusicController.cs index fc2fed890b..e3dc504e4d 100644 --- a/osu.Game/Overlays/MusicController.cs +++ b/osu.Game/Overlays/MusicController.cs @@ -457,20 +457,14 @@ namespace osu.Game.Overlays private class DragContainer : Container { - private Vector2 dragStart; - protected override bool OnDragStart(DragStartEvent e) { - base.OnDragStart(e); - dragStart = e.Mouse.Position; return true; } protected override bool OnDrag(DragEvent e) { - if (base.OnDrag(e)) return true; - - Vector2 change = e.Mouse.Position - dragStart; + Vector2 change = e.MousePosition - e.MouseDownPosition; // Diminish the drag distance as we go further to simulate "rubber band" feeling. change *= change.Length <= 0 ? 0 : (float)Math.Pow(change.Length, 0.7f) / change.Length; diff --git a/osu.Game/Overlays/Profile/Header/RankGraph.cs b/osu.Game/Overlays/Profile/Header/RankGraph.cs index 2abfaa1a6d..fc80370cf9 100644 --- a/osu.Game/Overlays/Profile/Header/RankGraph.cs +++ b/osu.Game/Overlays/Profile/Header/RankGraph.cs @@ -141,7 +141,7 @@ namespace osu.Game.Overlays.Profile.Header { if (ranks?.Length > 1) { - graph.UpdateBallPosition(e.Mouse.Position.X); + graph.UpdateBallPosition(e.MousePosition.X); graph.ShowBall(); } return base.OnHover(e); @@ -150,7 +150,7 @@ namespace osu.Game.Overlays.Profile.Header protected override bool OnMouseMove(MouseMoveEvent e) { if (ranks?.Length > 1) - graph.UpdateBallPosition(e.Mouse.Position.X); + graph.UpdateBallPosition(e.MousePosition.X); return base.OnMouseMove(e); } diff --git a/osu.Game/Overlays/Toolbar/ToolbarRulesetSelector.cs b/osu.Game/Overlays/Toolbar/ToolbarRulesetSelector.cs index aa55f8fa41..167d163d8b 100644 --- a/osu.Game/Overlays/Toolbar/ToolbarRulesetSelector.cs +++ b/osu.Game/Overlays/Toolbar/ToolbarRulesetSelector.cs @@ -89,7 +89,7 @@ namespace osu.Game.Overlays.Toolbar { base.OnKeyDown(e); - if (state.Keyboard.ControlPressed && !e.Repeat && e.Key >= Key.Number1 && e.Key <= Key.Number9) + if (e.CurrentState.Keyboard.ControlPressed && !e.Repeat && e.Key >= Key.Number1 && e.Key <= Key.Number9) { int requested = e.Key - Key.Number1; diff --git a/osu.Game/Overlays/Volume/VolumeMeter.cs b/osu.Game/Overlays/Volume/VolumeMeter.cs index daf45f71b4..86be652c8c 100644 --- a/osu.Game/Overlays/Volume/VolumeMeter.cs +++ b/osu.Game/Overlays/Volume/VolumeMeter.cs @@ -241,7 +241,7 @@ namespace osu.Game.Overlays.Volume protected override bool OnScroll(ScrollEvent e) { - adjust(e.Mouse.ScrollDelta.Y, e.Mouse.HasPreciseScroll); + adjust(e.ScrollDelta.Y, e.IsPrecise); return true; } diff --git a/osu.Game/Rulesets/Edit/HitObjectMask.cs b/osu.Game/Rulesets/Edit/HitObjectMask.cs index a16c6d59dd..636ea418f3 100644 --- a/osu.Game/Rulesets/Edit/HitObjectMask.cs +++ b/osu.Game/Rulesets/Edit/HitObjectMask.cs @@ -37,7 +37,7 @@ namespace osu.Game.Rulesets.Edit /// /// Invoked when this has requested drag. /// - public event Action DragRequested; + public event Action DragRequested; /// /// The which this applies to. @@ -102,7 +102,7 @@ namespace osu.Game.Rulesets.Edit if (State == SelectionState.NotSelected) { - SelectionRequested?.Invoke(this, state); + SelectionRequested?.Invoke(this, e.CurrentState); selectionRequested = true; } @@ -114,7 +114,7 @@ namespace osu.Game.Rulesets.Edit if (State == SelectionState.Selected && !selectionRequested) { selectionRequested = true; - SelectionRequested?.Invoke(this, e); + SelectionRequested?.Invoke(this, e.CurrentState); return true; } @@ -125,7 +125,7 @@ namespace osu.Game.Rulesets.Edit protected override bool OnDrag(DragEvent e) { - DragRequested?.Invoke(this, e); + DragRequested?.Invoke(this, e.Delta, e.CurrentState); return true; } diff --git a/osu.Game/Rulesets/UI/RulesetInputManager.cs b/osu.Game/Rulesets/UI/RulesetInputManager.cs index 91bb505724..fc6f82544e 100644 --- a/osu.Game/Rulesets/UI/RulesetInputManager.cs +++ b/osu.Game/Rulesets/UI/RulesetInputManager.cs @@ -18,6 +18,9 @@ using osu.Game.Input.Handlers; using osu.Game.Screens.Play; using OpenTK.Input; using static osu.Game.Input.Handlers.ReplayInputHandler; +using JoystickState = osu.Framework.Input.States.JoystickState; +using KeyboardState = osu.Framework.Input.States.KeyboardState; +using MouseState = osu.Framework.Input.States.MouseState; namespace osu.Game.Rulesets.UI { @@ -35,13 +38,7 @@ namespace osu.Game.Rulesets.UI protected override InputState CreateInitialState() { var state = base.CreateInitialState(); - return new RulesetInputManagerInputState - { - Mouse = state.Mouse, - Keyboard = state.Keyboard, - Joystick = state.Joystick, - LastReplayState = null - }; + return new RulesetInputManagerInputState(state.Mouse, state.Keyboard, state.Joystick); } protected readonly KeyBindingContainer KeyBindingContainer; @@ -275,5 +272,10 @@ namespace osu.Game.Rulesets.UI where T : struct { public ReplayState LastReplayState; + + public RulesetInputManagerInputState(MouseState mouse = null, KeyboardState keyboard = null, JoystickState joystick = null) + : base(mouse, keyboard, joystick) + { + } } } diff --git a/osu.Game/Screens/Edit/Components/Timelines/Summary/Parts/MarkerPart.cs b/osu.Game/Screens/Edit/Components/Timelines/Summary/Parts/MarkerPart.cs index 41ef2065da..4b57e1e92d 100644 --- a/osu.Game/Screens/Edit/Components/Timelines/Summary/Parts/MarkerPart.cs +++ b/osu.Game/Screens/Edit/Components/Timelines/Summary/Parts/MarkerPart.cs @@ -33,13 +33,13 @@ namespace osu.Game.Screens.Edit.Components.Timelines.Summary.Parts protected override bool OnDragEnd(DragEndEvent e) => true; protected override bool OnDrag(DragEvent e) { - seekToPosition(e.Mouse.NativeState.Position); + seekToPosition(e.ScreenSpaceMousePosition); return true; } protected override bool OnMouseDown(MouseDownEvent e) { - seekToPosition(state.Mouse.NativeState.Position); + seekToPosition(e.ScreenSpaceMousePosition); return true; } diff --git a/osu.Game/Screens/Edit/Editor.cs b/osu.Game/Screens/Edit/Editor.cs index 2cfcf4c415..62cf76ef69 100644 --- a/osu.Game/Screens/Edit/Editor.cs +++ b/osu.Game/Screens/Edit/Editor.cs @@ -184,7 +184,7 @@ namespace osu.Game.Screens.Edit protected override bool OnScroll(ScrollEvent e) { - if (e.Mouse.ScrollDelta.X + e.Mouse.ScrollDelta.Y > 0) + if (e.ScrollDelta.X + e.ScrollDelta.Y > 0) clock.SeekBackward(!clock.IsRunning); else clock.SeekForward(!clock.IsRunning); diff --git a/osu.Game/Screens/Edit/Screens/Compose/BeatDivisorControl.cs b/osu.Game/Screens/Edit/Screens/Compose/BeatDivisorControl.cs index 2e1b2c1ac3..e46be9f7c1 100644 --- a/osu.Game/Screens/Edit/Screens/Compose/BeatDivisorControl.cs +++ b/osu.Game/Screens/Edit/Screens/Compose/BeatDivisorControl.cs @@ -13,7 +13,6 @@ using osu.Framework.Graphics.Shapes; using osu.Framework.Graphics.Sprites; using osu.Framework.Graphics.UserInterface; using osu.Framework.Input.Events; -using osu.Framework.Input.States; using osu.Game.Graphics; using osu.Game.Graphics.UserInterface; using OpenTK; @@ -264,20 +263,20 @@ namespace osu.Game.Screens.Edit.Screens.Compose protected override bool OnClick(ClickEvent e) { - handleMouseInput(e); + handleMouseInput(e.ScreenSpaceMousePosition); return true; } protected override bool OnDrag(DragEvent e) { - handleMouseInput(e); + handleMouseInput(e.ScreenSpaceMousePosition); return true; } - private void handleMouseInput(InputState state) + private void handleMouseInput(Vector2 screenSpaceMousePosition) { // copied from SliderBar so we can do custom spacing logic. - var xPosition = (ToLocalSpace(state?.Mouse.NativeState.Position ?? Vector2.Zero).X - RangePadding) / UsableWidth; + var xPosition = (ToLocalSpace(screenSpaceMousePosition).X - RangePadding) / UsableWidth; CurrentNumber.Value = availableDivisors.OrderBy(d => Math.Abs(getMappedPosition(d) - xPosition)).First(); OnUserChange(); diff --git a/osu.Game/Screens/Edit/Screens/Compose/Layers/DragLayer.cs b/osu.Game/Screens/Edit/Screens/Compose/Layers/DragLayer.cs index 6db272e2a4..981ddd989c 100644 --- a/osu.Game/Screens/Edit/Screens/Compose/Layers/DragLayer.cs +++ b/osu.Game/Screens/Edit/Screens/Compose/Layers/DragLayer.cs @@ -64,8 +64,8 @@ namespace osu.Game.Screens.Edit.Screens.Compose.Layers protected override bool OnDrag(DragEvent e) { - var dragPosition = e.Mouse.NativeState.Position; - var dragStartPosition = e.Mouse.NativeState.PositionMouseDown ?? dragPosition; + var dragPosition = e.ScreenSpaceMousePosition; + var dragStartPosition = e.ScreenSpaceMouseDownPosition; var dragQuad = new Quad(dragStartPosition.X, dragStartPosition.Y, dragPosition.X - dragStartPosition.X, dragPosition.Y - dragStartPosition.Y); diff --git a/osu.Game/Screens/Edit/Screens/Compose/Layers/MaskContainer.cs b/osu.Game/Screens/Edit/Screens/Compose/Layers/MaskContainer.cs index 5ee31769a3..19258d669e 100644 --- a/osu.Game/Screens/Edit/Screens/Compose/Layers/MaskContainer.cs +++ b/osu.Game/Screens/Edit/Screens/Compose/Layers/MaskContainer.cs @@ -8,6 +8,7 @@ using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Framework.Input.States; using osu.Game.Rulesets.Edit; +using OpenTK; using RectangleF = osu.Framework.Graphics.Primitives.RectangleF; namespace osu.Game.Screens.Edit.Screens.Compose.Layers @@ -32,7 +33,7 @@ namespace osu.Game.Screens.Edit.Screens.Compose.Layers /// /// Invoked when any requests drag. /// - public event Action MaskDragRequested; + public event Action MaskDragRequested; private IEnumerable aliveMasks => AliveInternalChildren.Cast(); @@ -103,7 +104,7 @@ namespace osu.Game.Screens.Edit.Screens.Compose.Layers } private void onSelectionRequested(HitObjectMask mask, InputState state) => MaskSelectionRequested?.Invoke(mask, state); - private void onDragRequested(HitObjectMask mask, InputState state) => MaskDragRequested?.Invoke(mask, state); + private void onDragRequested(HitObjectMask mask, Vector2 delta, InputState state) => MaskDragRequested?.Invoke(mask, delta, state); protected override int Compare(Drawable x, Drawable y) { diff --git a/osu.Game/Screens/Edit/Screens/Compose/Layers/MaskSelection.cs b/osu.Game/Screens/Edit/Screens/Compose/Layers/MaskSelection.cs index 927e7a2342..635edf82da 100644 --- a/osu.Game/Screens/Edit/Screens/Compose/Layers/MaskSelection.cs +++ b/osu.Game/Screens/Edit/Screens/Compose/Layers/MaskSelection.cs @@ -54,7 +54,7 @@ namespace osu.Game.Screens.Edit.Screens.Compose.Layers #region User Input Handling - public void HandleDrag(HitObjectMask m, InputState state) + public void HandleDrag(HitObjectMask m, Vector2 delta, InputState state) { // Todo: Various forms of snapping @@ -63,7 +63,7 @@ namespace osu.Game.Screens.Edit.Screens.Compose.Layers switch (mask.HitObject.HitObject) { case IHasEditablePosition editablePosition: - editablePosition.OffsetPosition(state.Mouse.Delta); + editablePosition.OffsetPosition(delta); break; } } diff --git a/osu.Game/Screens/Edit/Screens/Compose/Timeline/ZoomableScrollContainer.cs b/osu.Game/Screens/Edit/Screens/Compose/Timeline/ZoomableScrollContainer.cs index 6390f8dd96..bbba439ca7 100644 --- a/osu.Game/Screens/Edit/Screens/Compose/Timeline/ZoomableScrollContainer.cs +++ b/osu.Game/Screens/Edit/Screens/Compose/Timeline/ZoomableScrollContainer.cs @@ -99,11 +99,11 @@ namespace osu.Game.Screens.Edit.Screens.Compose.Timeline protected override bool OnScroll(ScrollEvent e) { - if (e.Mouse.HasPreciseScroll) + if (e.IsPrecise) // for now, we don't support zoom when using a precision scroll device. this needs gesture support. return base.OnScroll(e); - setZoomTarget(zoomTarget + e.Mouse.ScrollDelta.Y, zoomedContent.ToLocalSpace(e.Mouse.NativeState.Position).X); + setZoomTarget(zoomTarget + e.ScrollDelta.Y, zoomedContent.ToLocalSpace(e.ScreenSpaceMousePosition).X); return true; } diff --git a/osu.Game/Screens/Menu/Button.cs b/osu.Game/Screens/Menu/Button.cs index bf0e0418e9..83d8ef12b8 100644 --- a/osu.Game/Screens/Menu/Button.cs +++ b/osu.Game/Screens/Menu/Button.cs @@ -205,7 +205,8 @@ namespace osu.Game.Screens.Menu protected override bool OnKeyDown(KeyDownEvent e) { - if (e.Repeat || state.Keyboard.ControlPressed || state.Keyboard.ShiftPressed || state.Keyboard.AltPressed) + var keyboard = e.CurrentState.Keyboard; + if (e.Repeat || keyboard.ControlPressed || keyboard.ShiftPressed || keyboard.AltPressed) return false; if (triggerKey == e.Key && triggerKey != Key.Unknown) diff --git a/osu.Game/Screens/Menu/MainMenu.cs b/osu.Game/Screens/Menu/MainMenu.cs index ef86351760..531ce85d4d 100644 --- a/osu.Game/Screens/Menu/MainMenu.cs +++ b/osu.Game/Screens/Menu/MainMenu.cs @@ -201,7 +201,8 @@ namespace osu.Game.Screens.Menu protected override bool OnKeyDown(KeyDownEvent e) { - if (!e.Repeat && state.Keyboard.ControlPressed && state.Keyboard.ShiftPressed && e.Key == Key.D) + var keyboard = e.CurrentState.Keyboard; + if (!e.Repeat && keyboard.ControlPressed && keyboard.ShiftPressed && e.Key == Key.D) { Push(new Drawings()); return true; diff --git a/osu.Game/Screens/Play/GameplayMenuOverlay.cs b/osu.Game/Screens/Play/GameplayMenuOverlay.cs index ed79d32a39..2c984e6135 100644 --- a/osu.Game/Screens/Play/GameplayMenuOverlay.cs +++ b/osu.Game/Screens/Play/GameplayMenuOverlay.cs @@ -295,7 +295,7 @@ namespace osu.Game.Screens.Play if (e.Repeat || e.Key != Key.Enter || !Selected) return false; - OnClick(state); + Click(); return true; } } diff --git a/osu.Game/Screens/Play/HUD/PlayerSettingsOverlay.cs b/osu.Game/Screens/Play/HUD/PlayerSettingsOverlay.cs index 4b3cc57546..1ce557f70f 100644 --- a/osu.Game/Screens/Play/HUD/PlayerSettingsOverlay.cs +++ b/osu.Game/Screens/Play/HUD/PlayerSettingsOverlay.cs @@ -56,7 +56,7 @@ namespace osu.Game.Screens.Play.HUD { if (e.Repeat) return false; - if (state.Keyboard.ControlPressed) + if (e.CurrentState.Keyboard.ControlPressed) { if (e.Key == Key.H && ReplayLoaded) { diff --git a/osu.Game/Screens/Play/HUD/QuitButton.cs b/osu.Game/Screens/Play/HUD/QuitButton.cs index 569764aaf2..347238f1d6 100644 --- a/osu.Game/Screens/Play/HUD/QuitButton.cs +++ b/osu.Game/Screens/Play/HUD/QuitButton.cs @@ -2,6 +2,7 @@ // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE using System; +using System.Linq; using osu.Framework.Allocation; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; @@ -62,7 +63,7 @@ namespace osu.Game.Screens.Play.HUD protected override bool OnMouseMove(MouseMoveEvent e) { - positionalAdjust = Vector2.Distance(e.Mouse.NativeState.Position, button.ScreenSpaceDrawQuad.Centre) / 200; + positionalAdjust = Vector2.Distance(e.ScreenSpaceMousePosition, button.ScreenSpaceDrawQuad.Centre) / 200; return base.OnMouseMove(e); } @@ -182,14 +183,14 @@ namespace osu.Game.Screens.Play.HUD protected override bool OnMouseDown(MouseDownEvent e) { - if (!pendingAnimation && state.Mouse.Buttons.Count() == 1) + if (!pendingAnimation && e.CurrentState.Mouse.Buttons.Count() == 1) BeginConfirm(); return true; } protected override bool OnMouseUp(MouseUpEvent e) { - if (!state.Mouse.Buttons.Any()) + if (!e.CurrentState.Mouse.Buttons.Any()) AbortConfirm(); return true; } diff --git a/osu.Game/Screens/Play/HUDOverlay.cs b/osu.Game/Screens/Play/HUDOverlay.cs index 3091cc5831..aa4d6c039b 100644 --- a/osu.Game/Screens/Play/HUDOverlay.cs +++ b/osu.Game/Screens/Play/HUDOverlay.cs @@ -155,7 +155,7 @@ namespace osu.Game.Screens.Play { if (e.Repeat) return false; - if (state.Keyboard.ShiftPressed) + if (e.CurrentState.Keyboard.ShiftPressed) { switch (e.Key) { diff --git a/osu.Game/Screens/Play/SkipOverlay.cs b/osu.Game/Screens/Play/SkipOverlay.cs index a1c43c014a..68bd5f7d00 100644 --- a/osu.Game/Screens/Play/SkipOverlay.cs +++ b/osu.Game/Screens/Play/SkipOverlay.cs @@ -130,7 +130,7 @@ namespace osu.Game.Screens.Play protected override bool OnMouseMove(MouseMoveEvent e) { - if (!e.Mouse.HasAnyButtonPressed) + if (!e.CurrentState.Mouse.HasAnyButtonPressed) fadeContainer.State = Visibility.Visible; return base.OnMouseMove(e); } diff --git a/osu.Game/Screens/Select/FooterButton.cs b/osu.Game/Screens/Select/FooterButton.cs index 1521c0f413..4f12082e08 100644 --- a/osu.Game/Screens/Select/FooterButton.cs +++ b/osu.Game/Screens/Select/FooterButton.cs @@ -127,7 +127,7 @@ namespace osu.Game.Screens.Select { if (!e.Repeat && e.Key == Hotkey) { - OnClick(state); + Click(); return true; } diff --git a/osu.Game/Screens/Select/Options/BeatmapOptionsButton.cs b/osu.Game/Screens/Select/Options/BeatmapOptionsButton.cs index a03b3f988a..cd775419be 100644 --- a/osu.Game/Screens/Select/Options/BeatmapOptionsButton.cs +++ b/osu.Game/Screens/Select/Options/BeatmapOptionsButton.cs @@ -77,7 +77,7 @@ namespace osu.Game.Screens.Select.Options { if (!e.Repeat && e.Key == HotKey) { - OnClick(state); + Click(); return true; } diff --git a/osu.Game/Screens/Select/SongSelect.cs b/osu.Game/Screens/Select/SongSelect.cs index 82f77768db..6195a9788c 100644 --- a/osu.Game/Screens/Select/SongSelect.cs +++ b/osu.Game/Screens/Select/SongSelect.cs @@ -560,7 +560,7 @@ namespace osu.Game.Screens.Select switch (e.Key) { case Key.Delete: - if (state.Keyboard.ShiftPressed) + if (e.CurrentState.Keyboard.ShiftPressed) { if (!Beatmap.IsDefault) delete(Beatmap.Value.BeatmapSetInfo); diff --git a/osu.Game/Tests/Visual/EditorClockTestCase.cs b/osu.Game/Tests/Visual/EditorClockTestCase.cs index 698d1a47a5..ebede74171 100644 --- a/osu.Game/Tests/Visual/EditorClockTestCase.cs +++ b/osu.Game/Tests/Visual/EditorClockTestCase.cs @@ -58,7 +58,7 @@ namespace osu.Game.Tests.Visual protected override bool OnScroll(ScrollEvent e) { - if (e.Mouse.ScrollDelta.Y > 0) + if (e.ScrollDelta.Y > 0) Clock.SeekBackward(true); else Clock.SeekForward(true); From b7a2ad1aa5980dc8e6fd49f8b990121babf98559 Mon Sep 17 00:00:00 2001 From: ekrctb Date: Tue, 2 Oct 2018 12:44:14 +0900 Subject: [PATCH 188/417] Use UIEvent level getters for modifier keys. --- osu.Game/Graphics/Cursor/MenuCursor.cs | 2 +- osu.Game/Graphics/UserInterface/SearchTextBox.cs | 5 ++--- osu.Game/Overlays/ChatOverlay.cs | 1 - osu.Game/Overlays/Direct/DirectGridPanel.cs | 2 +- osu.Game/Overlays/KeyBinding/KeyBindingRow.cs | 4 ++-- osu.Game/Overlays/MedalOverlay.cs | 2 +- osu.Game/Overlays/Mods/ModSection.cs | 2 +- osu.Game/Overlays/Toolbar/ToolbarRulesetSelector.cs | 2 +- osu.Game/Rulesets/UI/RulesetInputManager.cs | 2 +- osu.Game/Screens/Menu/Button.cs | 3 +-- osu.Game/Screens/Menu/MainMenu.cs | 3 +-- osu.Game/Screens/Play/HUD/PlayerSettingsOverlay.cs | 2 +- osu.Game/Screens/Play/HUD/QuitButton.cs | 2 +- osu.Game/Screens/Play/HUDOverlay.cs | 2 +- osu.Game/Screens/Play/SkipOverlay.cs | 2 +- osu.Game/Screens/Select/SongSelect.cs | 2 +- osu.Game/osu.Game.csproj | 2 +- 17 files changed, 18 insertions(+), 22 deletions(-) diff --git a/osu.Game/Graphics/Cursor/MenuCursor.cs b/osu.Game/Graphics/Cursor/MenuCursor.cs index 6bd3b986c8..ba858bf52d 100644 --- a/osu.Game/Graphics/Cursor/MenuCursor.cs +++ b/osu.Game/Graphics/Cursor/MenuCursor.cs @@ -90,7 +90,7 @@ namespace osu.Game.Graphics.Cursor protected override bool OnMouseUp(MouseUpEvent e) { - if (!e.CurrentState.Mouse.HasMainButtonPressed) + if (!e.IsPressed(MouseButton.Left) && !e.IsPressed(MouseButton.Right)) { activeCursor.AdditiveLayer.FadeOutFromOne(500, Easing.OutQuint); activeCursor.ScaleTo(1, 500, Easing.OutElastic); diff --git a/osu.Game/Graphics/UserInterface/SearchTextBox.cs b/osu.Game/Graphics/UserInterface/SearchTextBox.cs index 67ee35df04..08e93fad18 100644 --- a/osu.Game/Graphics/UserInterface/SearchTextBox.cs +++ b/osu.Game/Graphics/UserInterface/SearchTextBox.cs @@ -34,8 +34,7 @@ namespace osu.Game.Graphics.UserInterface protected override bool OnKeyDown(KeyDownEvent e) { - var keyboard = e.CurrentState.Keyboard; - if (!keyboard.ControlPressed && !keyboard.ShiftPressed) + if (!e.ControlPressed && !e.ShiftPressed) { switch (e.Key) { @@ -57,7 +56,7 @@ namespace osu.Game.Graphics.UserInterface } } - if (keyboard.ShiftPressed) + if (e.ShiftPressed) { switch (e.Key) { diff --git a/osu.Game/Overlays/ChatOverlay.cs b/osu.Game/Overlays/ChatOverlay.cs index 5312207e4e..4832c85e74 100644 --- a/osu.Game/Overlays/ChatOverlay.cs +++ b/osu.Game/Overlays/ChatOverlay.cs @@ -3,7 +3,6 @@ using System; using System.Collections.Generic; -using System.Diagnostics; using System.Linq; using OpenTK; using OpenTK.Graphics; diff --git a/osu.Game/Overlays/Direct/DirectGridPanel.cs b/osu.Game/Overlays/Direct/DirectGridPanel.cs index 6eef2fc500..1c462e3a73 100644 --- a/osu.Game/Overlays/Direct/DirectGridPanel.cs +++ b/osu.Game/Overlays/Direct/DirectGridPanel.cs @@ -10,7 +10,7 @@ using osu.Framework.Graphics.Containers; using osu.Game.Graphics; using osu.Game.Graphics.Sprites; using osu.Framework.Graphics.Shapes; -using osu.Framework.Input.States; +using osu.Framework.Input.Events; using osu.Framework.Localisation; using osu.Game.Beatmaps; using osu.Game.Beatmaps.Drawables; diff --git a/osu.Game/Overlays/KeyBinding/KeyBindingRow.cs b/osu.Game/Overlays/KeyBinding/KeyBindingRow.cs index 87325c69aa..63ddc25fde 100644 --- a/osu.Game/Overlays/KeyBinding/KeyBindingRow.cs +++ b/osu.Game/Overlays/KeyBinding/KeyBindingRow.cs @@ -171,7 +171,7 @@ namespace osu.Game.Overlays.KeyBinding protected override bool OnMouseUp(MouseUpEvent e) { // don't do anything until the last button is released. - if (!HasFocus || e.CurrentState.Mouse.HasAnyButtonPressed) + if (!HasFocus || e.HasAnyButtonPressed) return base.OnMouseUp(e); if (bindTarget.IsHovered) @@ -205,7 +205,7 @@ namespace osu.Game.Overlays.KeyBinding { case Key.Delete: { - if (e.CurrentState.Keyboard.ShiftPressed) + if (e.ShiftPressed) { bindTarget.UpdateKeyCombination(InputKey.None); finalise(); diff --git a/osu.Game/Overlays/MedalOverlay.cs b/osu.Game/Overlays/MedalOverlay.cs index 13c01cb88f..dcd325490a 100644 --- a/osu.Game/Overlays/MedalOverlay.cs +++ b/osu.Game/Overlays/MedalOverlay.cs @@ -183,7 +183,7 @@ namespace osu.Game.Overlays protected override void OnFocusLost(FocusLostEvent e) { - if (e.CurrentState.Keyboard.IsPressed(Key.Escape)) dismiss(); + if (e.CurrentState.Keyboard.Keys.IsPressed(Key.Escape)) dismiss(); } private const double initial_duration = 400; diff --git a/osu.Game/Overlays/Mods/ModSection.cs b/osu.Game/Overlays/Mods/ModSection.cs index 4759325bc4..c0d2d889c6 100644 --- a/osu.Game/Overlays/Mods/ModSection.cs +++ b/osu.Game/Overlays/Mods/ModSection.cs @@ -60,7 +60,7 @@ namespace osu.Game.Overlays.Mods { var index = Array.IndexOf(ToggleKeys, e.Key); if (index > -1 && index < buttons.Length) - buttons[index].SelectNext(e.CurrentState.Keyboard.ShiftPressed ? -1 : 1); + buttons[index].SelectNext(e.ShiftPressed ? -1 : 1); } return base.OnKeyDown(e); diff --git a/osu.Game/Overlays/Toolbar/ToolbarRulesetSelector.cs b/osu.Game/Overlays/Toolbar/ToolbarRulesetSelector.cs index 167d163d8b..7470dd0cd5 100644 --- a/osu.Game/Overlays/Toolbar/ToolbarRulesetSelector.cs +++ b/osu.Game/Overlays/Toolbar/ToolbarRulesetSelector.cs @@ -89,7 +89,7 @@ namespace osu.Game.Overlays.Toolbar { base.OnKeyDown(e); - if (e.CurrentState.Keyboard.ControlPressed && !e.Repeat && e.Key >= Key.Number1 && e.Key <= Key.Number9) + if (e.ControlPressed && !e.Repeat && e.Key >= Key.Number1 && e.Key <= Key.Number9) { int requested = e.Key - Key.Number1; diff --git a/osu.Game/Rulesets/UI/RulesetInputManager.cs b/osu.Game/Rulesets/UI/RulesetInputManager.cs index fc6f82544e..b0c75a4990 100644 --- a/osu.Game/Rulesets/UI/RulesetInputManager.cs +++ b/osu.Game/Rulesets/UI/RulesetInputManager.cs @@ -8,7 +8,7 @@ using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Framework.Input; using osu.Framework.Input.Bindings; -using osu.Framework.Input.EventArgs; +using osu.Framework.Input.Events; using osu.Framework.Input.StateChanges.Events; using osu.Framework.Input.States; using osu.Framework.Timing; diff --git a/osu.Game/Screens/Menu/Button.cs b/osu.Game/Screens/Menu/Button.cs index 83d8ef12b8..2b85ee6158 100644 --- a/osu.Game/Screens/Menu/Button.cs +++ b/osu.Game/Screens/Menu/Button.cs @@ -205,8 +205,7 @@ namespace osu.Game.Screens.Menu protected override bool OnKeyDown(KeyDownEvent e) { - var keyboard = e.CurrentState.Keyboard; - if (e.Repeat || keyboard.ControlPressed || keyboard.ShiftPressed || keyboard.AltPressed) + if (e.Repeat || e.ControlPressed || e.ShiftPressed || e.AltPressed) return false; if (triggerKey == e.Key && triggerKey != Key.Unknown) diff --git a/osu.Game/Screens/Menu/MainMenu.cs b/osu.Game/Screens/Menu/MainMenu.cs index 531ce85d4d..2374d6a2fe 100644 --- a/osu.Game/Screens/Menu/MainMenu.cs +++ b/osu.Game/Screens/Menu/MainMenu.cs @@ -201,8 +201,7 @@ namespace osu.Game.Screens.Menu protected override bool OnKeyDown(KeyDownEvent e) { - var keyboard = e.CurrentState.Keyboard; - if (!e.Repeat && keyboard.ControlPressed && keyboard.ShiftPressed && e.Key == Key.D) + if (!e.Repeat && e.ControlPressed && e.ShiftPressed && e.Key == Key.D) { Push(new Drawings()); return true; diff --git a/osu.Game/Screens/Play/HUD/PlayerSettingsOverlay.cs b/osu.Game/Screens/Play/HUD/PlayerSettingsOverlay.cs index 1ce557f70f..debce8c680 100644 --- a/osu.Game/Screens/Play/HUD/PlayerSettingsOverlay.cs +++ b/osu.Game/Screens/Play/HUD/PlayerSettingsOverlay.cs @@ -56,7 +56,7 @@ namespace osu.Game.Screens.Play.HUD { if (e.Repeat) return false; - if (e.CurrentState.Keyboard.ControlPressed) + if (e.ControlPressed) { if (e.Key == Key.H && ReplayLoaded) { diff --git a/osu.Game/Screens/Play/HUD/QuitButton.cs b/osu.Game/Screens/Play/HUD/QuitButton.cs index 347238f1d6..88547e0169 100644 --- a/osu.Game/Screens/Play/HUD/QuitButton.cs +++ b/osu.Game/Screens/Play/HUD/QuitButton.cs @@ -190,7 +190,7 @@ namespace osu.Game.Screens.Play.HUD protected override bool OnMouseUp(MouseUpEvent e) { - if (!e.CurrentState.Mouse.Buttons.Any()) + if (!e.HasAnyButtonPressed) AbortConfirm(); return true; } diff --git a/osu.Game/Screens/Play/HUDOverlay.cs b/osu.Game/Screens/Play/HUDOverlay.cs index aa4d6c039b..db0d7b6ccc 100644 --- a/osu.Game/Screens/Play/HUDOverlay.cs +++ b/osu.Game/Screens/Play/HUDOverlay.cs @@ -155,7 +155,7 @@ namespace osu.Game.Screens.Play { if (e.Repeat) return false; - if (e.CurrentState.Keyboard.ShiftPressed) + if (e.ShiftPressed) { switch (e.Key) { diff --git a/osu.Game/Screens/Play/SkipOverlay.cs b/osu.Game/Screens/Play/SkipOverlay.cs index 68bd5f7d00..cd34623951 100644 --- a/osu.Game/Screens/Play/SkipOverlay.cs +++ b/osu.Game/Screens/Play/SkipOverlay.cs @@ -130,7 +130,7 @@ namespace osu.Game.Screens.Play protected override bool OnMouseMove(MouseMoveEvent e) { - if (!e.CurrentState.Mouse.HasAnyButtonPressed) + if (!e.HasAnyButtonPressed) fadeContainer.State = Visibility.Visible; return base.OnMouseMove(e); } diff --git a/osu.Game/Screens/Select/SongSelect.cs b/osu.Game/Screens/Select/SongSelect.cs index 6195a9788c..7402cf4da0 100644 --- a/osu.Game/Screens/Select/SongSelect.cs +++ b/osu.Game/Screens/Select/SongSelect.cs @@ -560,7 +560,7 @@ namespace osu.Game.Screens.Select switch (e.Key) { case Key.Delete: - if (e.CurrentState.Keyboard.ShiftPressed) + if (e.ShiftPressed) { if (!Beatmap.IsDefault) delete(Beatmap.Value.BeatmapSetInfo); diff --git a/osu.Game/osu.Game.csproj b/osu.Game/osu.Game.csproj index 5704efd5a0..48400084ca 100644 --- a/osu.Game/osu.Game.csproj +++ b/osu.Game/osu.Game.csproj @@ -18,7 +18,7 @@ - + From 68980fc477f65636ccdc268750959f6581e2fb57 Mon Sep 17 00:00:00 2001 From: ekrctb Date: Tue, 2 Oct 2018 14:41:18 +0900 Subject: [PATCH 189/417] Adjust usage of Handle(Non)PositionalInput to follow framework update --- osu.Desktop/Overlays/VersionManager.cs | 3 --- .../Objects/Drawables/Pieces/CirclePiece.cs | 3 +++ .../Drawables/Pieces/SpinnerBackground.cs | 3 --- osu.Game/Graphics/Backgrounds/Triangles.cs | 4 ---- .../Graphics/Containers/LinkFlowContainer.cs | 2 -- osu.Game/Graphics/DrawableDate.cs | 2 -- .../Graphics/UserInterface/OsuDropdown.cs | 3 +++ osu.Game/Overlays/ChatOverlay.cs | 20 ++++++++++++++----- osu.Game/Overlays/OnScreenDisplay.cs | 3 --- osu.Game/Screens/Menu/LogoVisualisation.cs | 3 --- osu.Game/Screens/Menu/MenuSideFlashes.cs | 3 --- osu.Game/Screens/Play/SquareGraph.cs | 3 --- .../Select/Leaderboards/Placeholder.cs | 2 -- .../Drawables/DrawableStoryboard.cs | 2 -- osu.Game/osu.Game.csproj | 2 +- 15 files changed, 22 insertions(+), 36 deletions(-) diff --git a/osu.Desktop/Overlays/VersionManager.cs b/osu.Desktop/Overlays/VersionManager.cs index 8881884fb4..96857d6b4f 100644 --- a/osu.Desktop/Overlays/VersionManager.cs +++ b/osu.Desktop/Overlays/VersionManager.cs @@ -27,9 +27,6 @@ namespace osu.Desktop.Overlays private NotificationOverlay notificationOverlay; private GameHost host; - public override bool HandleNonPositionalInput => false; - public override bool HandlePositionalInput => false; - [BackgroundDependencyLoader] private void load(NotificationOverlay notification, OsuColour colours, TextureStore textures, OsuGameBase game, OsuConfigManager config, GameHost host) { diff --git a/osu.Game.Rulesets.Osu/Objects/Drawables/Pieces/CirclePiece.cs b/osu.Game.Rulesets.Osu/Objects/Drawables/Pieces/CirclePiece.cs index bd7a4ad3f6..6bb6991cc0 100644 --- a/osu.Game.Rulesets.Osu/Objects/Drawables/Pieces/CirclePiece.cs +++ b/osu.Game.Rulesets.Osu/Objects/Drawables/Pieces/CirclePiece.cs @@ -12,6 +12,9 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables.Pieces { public class CirclePiece : Container, IKeyBindingHandler { + // IsHovered is used + public override bool HandlePositionalInput => true; + public Func Hit; public CirclePiece() diff --git a/osu.Game.Rulesets.Osu/Objects/Drawables/Pieces/SpinnerBackground.cs b/osu.Game.Rulesets.Osu/Objects/Drawables/Pieces/SpinnerBackground.cs index 0401df7a91..584fd93a70 100644 --- a/osu.Game.Rulesets.Osu/Objects/Drawables/Pieces/SpinnerBackground.cs +++ b/osu.Game.Rulesets.Osu/Objects/Drawables/Pieces/SpinnerBackground.cs @@ -11,9 +11,6 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables.Pieces { public class SpinnerBackground : CircularContainer, IHasAccentColour { - public override bool HandleNonPositionalInput => false; - public override bool HandlePositionalInput => false; - protected Box Disc; public Color4 AccentColour diff --git a/osu.Game/Graphics/Backgrounds/Triangles.cs b/osu.Game/Graphics/Backgrounds/Triangles.cs index bff9e49dce..4a86d0e4f6 100644 --- a/osu.Game/Graphics/Backgrounds/Triangles.cs +++ b/osu.Game/Graphics/Backgrounds/Triangles.cs @@ -30,10 +30,6 @@ namespace osu.Game.Graphics.Backgrounds /// private const float edge_smoothness = 1; - public override bool HandleNonPositionalInput => false; - public override bool HandlePositionalInput => false; - - public Color4 ColourLight = Color4.White; public Color4 ColourDark = Color4.Black; diff --git a/osu.Game/Graphics/Containers/LinkFlowContainer.cs b/osu.Game/Graphics/Containers/LinkFlowContainer.cs index 7c17f95e80..e4e7828d0e 100644 --- a/osu.Game/Graphics/Containers/LinkFlowContainer.cs +++ b/osu.Game/Graphics/Containers/LinkFlowContainer.cs @@ -20,8 +20,6 @@ namespace osu.Game.Graphics.Containers { } - public override bool HandlePositionalInput => true; - private OsuGame game; private Action showNotImplementedError; diff --git a/osu.Game/Graphics/DrawableDate.cs b/osu.Game/Graphics/DrawableDate.cs index 1a7ed607e6..28f8bdf82f 100644 --- a/osu.Game/Graphics/DrawableDate.cs +++ b/osu.Game/Graphics/DrawableDate.cs @@ -54,8 +54,6 @@ namespace osu.Game.Graphics Scheduler.AddDelayed(updateTimeWithReschedule, timeUntilNextUpdate); } - public override bool HandlePositionalInput => true; - protected virtual string Format() => Date.Humanize(); private void updateTime() => Text = Format(); diff --git a/osu.Game/Graphics/UserInterface/OsuDropdown.cs b/osu.Game/Graphics/UserInterface/OsuDropdown.cs index 830bde9dac..26caf09b1b 100644 --- a/osu.Game/Graphics/UserInterface/OsuDropdown.cs +++ b/osu.Game/Graphics/UserInterface/OsuDropdown.cs @@ -97,6 +97,9 @@ namespace osu.Game.Graphics.UserInterface #region DrawableOsuDropdownMenuItem public class DrawableOsuDropdownMenuItem : DrawableDropdownMenuItem, IHasAccentColour { + // IsHovered is used + public override bool HandlePositionalInput => true; + private Color4? accentColour; public Color4 AccentColour { diff --git a/osu.Game/Overlays/ChatOverlay.cs b/osu.Game/Overlays/ChatOverlay.cs index 4832c85e74..eeadac8e8c 100644 --- a/osu.Game/Overlays/ChatOverlay.cs +++ b/osu.Game/Overlays/ChatOverlay.cs @@ -51,7 +51,7 @@ namespace osu.Game.Overlays private readonly ChatTabControl channelTabs; private readonly Container chatContainer; - private readonly Container tabsArea; + private readonly TabsArea tabsArea; private readonly Box chatBackground; private readonly Box tabBackground; @@ -145,11 +145,8 @@ namespace osu.Game.Overlays loading = new LoadingAnimation(), } }, - tabsArea = new Container + tabsArea = new TabsArea { - Name = @"tabs area", - RelativeSizeAxes = Axes.X, - Height = TAB_AREA_HEIGHT, Children = new Drawable[] { tabBackground = new Box @@ -541,5 +538,18 @@ namespace osu.Game.Overlays api.Queue(req); } + + private class TabsArea : Container + { + // IsHovered is used + public override bool HandlePositionalInput => true; + + public TabsArea() + { + Name = @"tabs area"; + RelativeSizeAxes = Axes.X; + Height = TAB_AREA_HEIGHT; + } + } } } diff --git a/osu.Game/Overlays/OnScreenDisplay.cs b/osu.Game/Overlays/OnScreenDisplay.cs index e40004aa01..97c6554908 100644 --- a/osu.Game/Overlays/OnScreenDisplay.cs +++ b/osu.Game/Overlays/OnScreenDisplay.cs @@ -25,9 +25,6 @@ namespace osu.Game.Overlays { private readonly Container box; - public override bool HandleNonPositionalInput => false; - public override bool HandlePositionalInput => false; - private readonly SpriteText textLine1; private readonly SpriteText textLine2; private readonly SpriteText textLine3; diff --git a/osu.Game/Screens/Menu/LogoVisualisation.cs b/osu.Game/Screens/Menu/LogoVisualisation.cs index 5d76206905..34fb0b196b 100644 --- a/osu.Game/Screens/Menu/LogoVisualisation.cs +++ b/osu.Game/Screens/Menu/LogoVisualisation.cs @@ -64,9 +64,6 @@ namespace osu.Game.Screens.Menu private readonly float[] frequencyAmplitudes = new float[256]; - public override bool HandleNonPositionalInput => false; - public override bool HandlePositionalInput => false; - private Shader shader; private readonly Texture texture; diff --git a/osu.Game/Screens/Menu/MenuSideFlashes.cs b/osu.Game/Screens/Menu/MenuSideFlashes.cs index a9e3310fbe..3de68fe914 100644 --- a/osu.Game/Screens/Menu/MenuSideFlashes.cs +++ b/osu.Game/Screens/Menu/MenuSideFlashes.cs @@ -19,9 +19,6 @@ namespace osu.Game.Screens.Menu { public class MenuSideFlashes : BeatSyncedContainer { - public override bool HandleNonPositionalInput => false; - public override bool HandlePositionalInput => false; - private readonly IBindable beatmap = new Bindable(); private Box leftBox; diff --git a/osu.Game/Screens/Play/SquareGraph.cs b/osu.Game/Screens/Play/SquareGraph.cs index 6b4918af75..bc4c87e191 100644 --- a/osu.Game/Screens/Play/SquareGraph.cs +++ b/osu.Game/Screens/Play/SquareGraph.cs @@ -21,9 +21,6 @@ namespace osu.Game.Screens.Play public int ColumnCount => columns.Length; - public override bool HandleNonPositionalInput => false; - public override bool HandlePositionalInput => false; - private int progress; public int Progress { diff --git a/osu.Game/Screens/Select/Leaderboards/Placeholder.cs b/osu.Game/Screens/Select/Leaderboards/Placeholder.cs index 105f9e2064..468b43e54f 100644 --- a/osu.Game/Screens/Select/Leaderboards/Placeholder.cs +++ b/osu.Game/Screens/Select/Leaderboards/Placeholder.cs @@ -11,8 +11,6 @@ namespace osu.Game.Screens.Select.Leaderboards { protected const float TEXT_SIZE = 22; - public override bool HandlePositionalInput => true; - protected Placeholder() : base(cp => cp.TextSize = TEXT_SIZE) { diff --git a/osu.Game/Storyboards/Drawables/DrawableStoryboard.cs b/osu.Game/Storyboards/Drawables/DrawableStoryboard.cs index 02a4b46f1c..ef03539998 100644 --- a/osu.Game/Storyboards/Drawables/DrawableStoryboard.cs +++ b/osu.Game/Storyboards/Drawables/DrawableStoryboard.cs @@ -18,8 +18,6 @@ namespace osu.Game.Storyboards.Drawables protected override Container Content => content; protected override Vector2 DrawScale => new Vector2(Parent.DrawHeight / 480); - public override bool HandleNonPositionalInput => false; - public override bool HandlePositionalInput => false; private bool passing = true; public bool Passing diff --git a/osu.Game/osu.Game.csproj b/osu.Game/osu.Game.csproj index 48400084ca..66bae277b3 100644 --- a/osu.Game/osu.Game.csproj +++ b/osu.Game/osu.Game.csproj @@ -18,7 +18,7 @@ - + From 4cdb6dcea5307c328be87b2635996ffc0f3b2f69 Mon Sep 17 00:00:00 2001 From: smoogipoo Date: Wed, 3 Oct 2018 13:28:00 +0900 Subject: [PATCH 190/417] Rename HitObjectMask -> SelectionMask --- ...ldNoteMask.cs => HoldNoteSelectionMask.cs} | 12 +++--- .../{NoteMask.cs => NoteSelectionMask.cs} | 4 +- .../Edit/ManiaHitObjectComposer.cs | 6 +-- ...ircleMask.cs => HitCircleSelectionMask.cs} | 4 +- ...leMask.cs => SliderCircleSelectionMask.cs} | 8 ++-- .../{SliderMask.cs => SliderSelectionMask.cs} | 8 ++-- .../Edit/OsuHitObjectComposer.cs | 6 +-- osu.Game/Beatmaps/BeatmapManager.cs | 2 +- osu.Game/Rulesets/Edit/HitObjectComposer.cs | 4 +- .../{HitObjectMask.cs => SelectionMask.cs} | 30 +++++++-------- .../Edit/Screens/Compose/Layers/DragLayer.cs | 4 +- .../Screens/Compose/Layers/MaskContainer.cs | 38 +++++++++---------- .../Screens/Compose/Layers/MaskSelection.cs | 14 +++---- 13 files changed, 70 insertions(+), 70 deletions(-) rename osu.Game.Rulesets.Mania/Edit/Layers/Selection/Overlays/{HoldNoteMask.cs => HoldNoteSelectionMask.cs} (87%) rename osu.Game.Rulesets.Mania/Edit/Layers/Selection/Overlays/{NoteMask.cs => NoteSelectionMask.cs} (90%) rename osu.Game.Rulesets.Osu/Edit/Layers/Selection/Overlays/{HitCircleMask.cs => HitCircleSelectionMask.cs} (88%) rename osu.Game.Rulesets.Osu/Edit/Layers/Selection/Overlays/{SliderCircleMask.cs => SliderCircleSelectionMask.cs} (81%) rename osu.Game.Rulesets.Osu/Edit/Layers/Selection/Overlays/{SliderMask.cs => SliderSelectionMask.cs} (87%) rename osu.Game/Rulesets/Edit/{HitObjectMask.cs => SelectionMask.cs} (80%) diff --git a/osu.Game.Rulesets.Mania/Edit/Layers/Selection/Overlays/HoldNoteMask.cs b/osu.Game.Rulesets.Mania/Edit/Layers/Selection/Overlays/HoldNoteSelectionMask.cs similarity index 87% rename from osu.Game.Rulesets.Mania/Edit/Layers/Selection/Overlays/HoldNoteMask.cs rename to osu.Game.Rulesets.Mania/Edit/Layers/Selection/Overlays/HoldNoteSelectionMask.cs index 03d2ba19cb..b4f62ea170 100644 --- a/osu.Game.Rulesets.Mania/Edit/Layers/Selection/Overlays/HoldNoteMask.cs +++ b/osu.Game.Rulesets.Mania/Edit/Layers/Selection/Overlays/HoldNoteSelectionMask.cs @@ -15,7 +15,7 @@ using OpenTK.Graphics; namespace osu.Game.Rulesets.Mania.Edit.Layers.Selection.Overlays { - public class HoldNoteMask : HitObjectMask + public class HoldNoteSelectionMask : SelectionMask { public new DrawableHoldNote HitObject => (DrawableHoldNote)base.HitObject; @@ -23,13 +23,13 @@ namespace osu.Game.Rulesets.Mania.Edit.Layers.Selection.Overlays private readonly BodyPiece body; - public HoldNoteMask(DrawableHoldNote hold) + public HoldNoteSelectionMask(DrawableHoldNote hold) : base(hold) { InternalChildren = new Drawable[] { - new HoldNoteNoteMask(hold.Head), - new HoldNoteNoteMask(hold.Tail), + new HoldNoteNoteSelectionMask(hold.Head), + new HoldNoteNoteSelectionMask(hold.Tail), body = new BodyPiece { AccentColour = Color4.Transparent @@ -59,9 +59,9 @@ namespace osu.Game.Rulesets.Mania.Edit.Layers.Selection.Overlays Y -= HitObject.Tail.DrawHeight; } - private class HoldNoteNoteMask : NoteMask + private class HoldNoteNoteSelectionMask : NoteSelectionMask { - public HoldNoteNoteMask(DrawableNote note) + public HoldNoteNoteSelectionMask(DrawableNote note) : base(note) { Select(); diff --git a/osu.Game.Rulesets.Mania/Edit/Layers/Selection/Overlays/NoteMask.cs b/osu.Game.Rulesets.Mania/Edit/Layers/Selection/Overlays/NoteSelectionMask.cs similarity index 90% rename from osu.Game.Rulesets.Mania/Edit/Layers/Selection/Overlays/NoteMask.cs rename to osu.Game.Rulesets.Mania/Edit/Layers/Selection/Overlays/NoteSelectionMask.cs index 78f876cb14..d976386d6e 100644 --- a/osu.Game.Rulesets.Mania/Edit/Layers/Selection/Overlays/NoteMask.cs +++ b/osu.Game.Rulesets.Mania/Edit/Layers/Selection/Overlays/NoteSelectionMask.cs @@ -9,9 +9,9 @@ using osu.Game.Rulesets.Mania.Objects.Drawables.Pieces; namespace osu.Game.Rulesets.Mania.Edit.Layers.Selection.Overlays { - public class NoteMask : HitObjectMask + public class NoteSelectionMask : SelectionMask { - public NoteMask(DrawableNote note) + public NoteSelectionMask(DrawableNote note) : base(note) { Scale = note.Scale; diff --git a/osu.Game.Rulesets.Mania/Edit/ManiaHitObjectComposer.cs b/osu.Game.Rulesets.Mania/Edit/ManiaHitObjectComposer.cs index f37d8134ce..7cc473c712 100644 --- a/osu.Game.Rulesets.Mania/Edit/ManiaHitObjectComposer.cs +++ b/osu.Game.Rulesets.Mania/Edit/ManiaHitObjectComposer.cs @@ -40,14 +40,14 @@ namespace osu.Game.Rulesets.Mania.Edit new HitObjectCompositionTool("Hold"), }; - public override HitObjectMask CreateMaskFor(DrawableHitObject hitObject) + public override SelectionMask CreateMaskFor(DrawableHitObject hitObject) { switch (hitObject) { case DrawableNote note: - return new NoteMask(note); + return new NoteSelectionMask(note); case DrawableHoldNote holdNote: - return new HoldNoteMask(holdNote); + return new HoldNoteSelectionMask(holdNote); } return base.CreateMaskFor(hitObject); diff --git a/osu.Game.Rulesets.Osu/Edit/Layers/Selection/Overlays/HitCircleMask.cs b/osu.Game.Rulesets.Osu/Edit/Layers/Selection/Overlays/HitCircleSelectionMask.cs similarity index 88% rename from osu.Game.Rulesets.Osu/Edit/Layers/Selection/Overlays/HitCircleMask.cs rename to osu.Game.Rulesets.Osu/Edit/Layers/Selection/Overlays/HitCircleSelectionMask.cs index a2aa639004..aa8044af15 100644 --- a/osu.Game.Rulesets.Osu/Edit/Layers/Selection/Overlays/HitCircleMask.cs +++ b/osu.Game.Rulesets.Osu/Edit/Layers/Selection/Overlays/HitCircleSelectionMask.cs @@ -10,9 +10,9 @@ using osu.Game.Rulesets.Osu.Objects.Drawables.Pieces; namespace osu.Game.Rulesets.Osu.Edit.Layers.Selection.Overlays { - public class HitCircleMask : HitObjectMask + public class HitCircleSelectionMask : SelectionMask { - public HitCircleMask(DrawableHitCircle hitCircle) + public HitCircleSelectionMask(DrawableHitCircle hitCircle) : base(hitCircle) { Origin = Anchor.Centre; diff --git a/osu.Game.Rulesets.Osu/Edit/Layers/Selection/Overlays/SliderCircleMask.cs b/osu.Game.Rulesets.Osu/Edit/Layers/Selection/Overlays/SliderCircleSelectionMask.cs similarity index 81% rename from osu.Game.Rulesets.Osu/Edit/Layers/Selection/Overlays/SliderCircleMask.cs rename to osu.Game.Rulesets.Osu/Edit/Layers/Selection/Overlays/SliderCircleSelectionMask.cs index 151564a2a8..4d6a530eda 100644 --- a/osu.Game.Rulesets.Osu/Edit/Layers/Selection/Overlays/SliderCircleMask.cs +++ b/osu.Game.Rulesets.Osu/Edit/Layers/Selection/Overlays/SliderCircleSelectionMask.cs @@ -12,21 +12,21 @@ using OpenTK; namespace osu.Game.Rulesets.Osu.Edit.Layers.Selection.Overlays { - public class SliderCircleMask : HitObjectMask + public class SliderCircleSelectionMask : SelectionMask { - public SliderCircleMask(DrawableHitCircle sliderHead, DrawableSlider slider) + public SliderCircleSelectionMask(DrawableHitCircle sliderHead, DrawableSlider slider) : this(sliderHead, Vector2.Zero, slider) { } - public SliderCircleMask(DrawableSliderTail sliderTail, DrawableSlider slider) + public SliderCircleSelectionMask(DrawableSliderTail sliderTail, DrawableSlider slider) : this(sliderTail, ((Slider)slider.HitObject).Curve.PositionAt(1), slider) { } private readonly DrawableOsuHitObject hitObject; - private SliderCircleMask(DrawableOsuHitObject hitObject, Vector2 position, DrawableSlider slider) + private SliderCircleSelectionMask(DrawableOsuHitObject hitObject, Vector2 position, DrawableSlider slider) : base(hitObject) { this.hitObject = hitObject; diff --git a/osu.Game.Rulesets.Osu/Edit/Layers/Selection/Overlays/SliderMask.cs b/osu.Game.Rulesets.Osu/Edit/Layers/Selection/Overlays/SliderSelectionMask.cs similarity index 87% rename from osu.Game.Rulesets.Osu/Edit/Layers/Selection/Overlays/SliderMask.cs rename to osu.Game.Rulesets.Osu/Edit/Layers/Selection/Overlays/SliderSelectionMask.cs index aff42dd233..40c2026937 100644 --- a/osu.Game.Rulesets.Osu/Edit/Layers/Selection/Overlays/SliderMask.cs +++ b/osu.Game.Rulesets.Osu/Edit/Layers/Selection/Overlays/SliderSelectionMask.cs @@ -14,12 +14,12 @@ using OpenTK.Graphics; namespace osu.Game.Rulesets.Osu.Edit.Layers.Selection.Overlays { - public class SliderMask : HitObjectMask + public class SliderSelectionMask : SelectionMask { private readonly SliderBody body; private readonly DrawableSlider slider; - public SliderMask(DrawableSlider slider) + public SliderSelectionMask(DrawableSlider slider) : base(slider) { this.slider = slider; @@ -35,8 +35,8 @@ namespace osu.Game.Rulesets.Osu.Edit.Layers.Selection.Overlays AccentColour = Color4.Transparent, PathWidth = sliderObject.Scale * 64 }, - new SliderCircleMask(slider.HeadCircle, slider), - new SliderCircleMask(slider.TailCircle, slider), + new SliderCircleSelectionMask(slider.HeadCircle, slider), + new SliderCircleSelectionMask(slider.TailCircle, slider), }; sliderObject.PositionChanged += _ => Position = slider.Position; diff --git a/osu.Game.Rulesets.Osu/Edit/OsuHitObjectComposer.cs b/osu.Game.Rulesets.Osu/Edit/OsuHitObjectComposer.cs index dce1fc2851..04f573596b 100644 --- a/osu.Game.Rulesets.Osu/Edit/OsuHitObjectComposer.cs +++ b/osu.Game.Rulesets.Osu/Edit/OsuHitObjectComposer.cs @@ -33,14 +33,14 @@ namespace osu.Game.Rulesets.Osu.Edit protected override ScalableContainer CreateLayerContainer() => new ScalableContainer(OsuPlayfield.BASE_SIZE.X) { RelativeSizeAxes = Axes.Both }; - public override HitObjectMask CreateMaskFor(DrawableHitObject hitObject) + public override SelectionMask CreateMaskFor(DrawableHitObject hitObject) { switch (hitObject) { case DrawableHitCircle circle: - return new HitCircleMask(circle); + return new HitCircleSelectionMask(circle); case DrawableSlider slider: - return new SliderMask(slider); + return new SliderSelectionMask(slider); } return base.CreateMaskFor(hitObject); diff --git a/osu.Game/Beatmaps/BeatmapManager.cs b/osu.Game/Beatmaps/BeatmapManager.cs index aa653d88f9..758a98e317 100644 --- a/osu.Game/Beatmaps/BeatmapManager.cs +++ b/osu.Game/Beatmaps/BeatmapManager.cs @@ -348,7 +348,7 @@ namespace osu.Game.Beatmaps OnlineBeatmapSetID = beatmap.BeatmapInfo.BeatmapSet?.OnlineBeatmapSetID, Beatmaps = new List(), Hash = computeBeatmapSetHash(reader), - Metadata = beatmap.Metadata + Metadata = beatmap.Metadata, }; } diff --git a/osu.Game/Rulesets/Edit/HitObjectComposer.cs b/osu.Game/Rulesets/Edit/HitObjectComposer.cs index a3253250f2..8e8bc7edb8 100644 --- a/osu.Game/Rulesets/Edit/HitObjectComposer.cs +++ b/osu.Game/Rulesets/Edit/HitObjectComposer.cs @@ -151,10 +151,10 @@ namespace osu.Game.Rulesets.Edit protected abstract IReadOnlyList CompositionTools { get; } /// - /// Creates a for a specific . + /// Creates a for a specific . /// /// The to create the overlay for. - public virtual HitObjectMask CreateMaskFor(DrawableHitObject hitObject) => null; + public virtual SelectionMask CreateMaskFor(DrawableHitObject hitObject) => null; /// /// Creates a which outlines s diff --git a/osu.Game/Rulesets/Edit/HitObjectMask.cs b/osu.Game/Rulesets/Edit/SelectionMask.cs similarity index 80% rename from osu.Game/Rulesets/Edit/HitObjectMask.cs rename to osu.Game/Rulesets/Edit/SelectionMask.cs index 636ea418f3..9582c30457 100644 --- a/osu.Game/Rulesets/Edit/HitObjectMask.cs +++ b/osu.Game/Rulesets/Edit/SelectionMask.cs @@ -16,31 +16,31 @@ namespace osu.Game.Rulesets.Edit /// /// A mask placed above a adding editing functionality. /// - public class HitObjectMask : CompositeDrawable, IStateful + public class SelectionMask : CompositeDrawable, IStateful { /// - /// Invoked when this has been selected. + /// Invoked when this has been selected. /// - public event Action Selected; + public event Action Selected; /// - /// Invoked when this has been deselected. + /// Invoked when this has been deselected. /// - public event Action Deselected; + public event Action Deselected; /// - /// Invoked when this has requested selection. + /// Invoked when this has requested selection. /// Will fire even if already selected. Does not actually perform selection. /// - public event Action SelectionRequested; + public event Action SelectionRequested; /// - /// Invoked when this has requested drag. + /// Invoked when this has requested drag. /// - public event Action DragRequested; + public event Action DragRequested; /// - /// The which this applies to. + /// The which this applies to. /// public readonly DrawableHitObject HitObject; @@ -48,7 +48,7 @@ namespace osu.Game.Rulesets.Edit public override bool HandlePositionalInput => ShouldBeAlive; public override bool RemoveWhenNotAlive => false; - public HitObjectMask(DrawableHitObject hitObject) + public SelectionMask(DrawableHitObject hitObject) { HitObject = hitObject; @@ -83,12 +83,12 @@ namespace osu.Game.Rulesets.Edit } /// - /// Selects this , causing it to become visible. + /// Selects this , causing it to become visible. /// public void Select() => State = SelectionState.Selected; /// - /// Deselects this , causing it to become invisible. + /// Deselects this , causing it to become invisible. /// public void Deselect() => State = SelectionState.NotSelected; @@ -130,12 +130,12 @@ namespace osu.Game.Rulesets.Edit } /// - /// The screen-space point that causes this to be selected. + /// The screen-space point that causes this to be selected. /// public virtual Vector2 SelectionPoint => ScreenSpaceDrawQuad.Centre; /// - /// The screen-space quad that outlines this for selections. + /// The screen-space quad that outlines this for selections. /// public virtual Quad SelectionQuad => ScreenSpaceDrawQuad; } diff --git a/osu.Game/Screens/Edit/Screens/Compose/Layers/DragLayer.cs b/osu.Game/Screens/Edit/Screens/Compose/Layers/DragLayer.cs index 981ddd989c..fdc0dee0ce 100644 --- a/osu.Game/Screens/Edit/Screens/Compose/Layers/DragLayer.cs +++ b/osu.Game/Screens/Edit/Screens/Compose/Layers/DragLayer.cs @@ -14,7 +14,7 @@ using OpenTK.Graphics; namespace osu.Game.Screens.Edit.Screens.Compose.Layers { /// - /// A layer that handles and displays drag selection for a collection of s. + /// A layer that handles and displays drag selection for a collection of s. /// public class DragLayer : CompositeDrawable { @@ -30,7 +30,7 @@ namespace osu.Game.Screens.Edit.Screens.Compose.Layers /// /// Creates a new . /// - /// The selectable s. + /// The selectable s. public DragLayer(Action performSelection) { this.performSelection = performSelection; diff --git a/osu.Game/Screens/Edit/Screens/Compose/Layers/MaskContainer.cs b/osu.Game/Screens/Edit/Screens/Compose/Layers/MaskContainer.cs index 19258d669e..42a7757721 100644 --- a/osu.Game/Screens/Edit/Screens/Compose/Layers/MaskContainer.cs +++ b/osu.Game/Screens/Edit/Screens/Compose/Layers/MaskContainer.cs @@ -13,36 +13,36 @@ using RectangleF = osu.Framework.Graphics.Primitives.RectangleF; namespace osu.Game.Screens.Edit.Screens.Compose.Layers { - public class MaskContainer : Container + public class MaskContainer : Container { /// - /// Invoked when any is selected. + /// Invoked when any is selected. /// - public event Action MaskSelected; + public event Action MaskSelected; /// - /// Invoked when any is deselected. + /// Invoked when any is deselected. /// - public event Action MaskDeselected; + public event Action MaskDeselected; /// - /// Invoked when any requests selection. + /// Invoked when any requests selection. /// - public event Action MaskSelectionRequested; + public event Action MaskSelectionRequested; /// - /// Invoked when any requests drag. + /// Invoked when any requests drag. /// - public event Action MaskDragRequested; + public event Action MaskDragRequested; - private IEnumerable aliveMasks => AliveInternalChildren.Cast(); + private IEnumerable aliveMasks => AliveInternalChildren.Cast(); public MaskContainer() { RelativeSizeAxes = Axes.Both; } - public override void Add(HitObjectMask drawable) + public override void Add(SelectionMask drawable) { if (drawable == null) throw new ArgumentNullException(nameof(drawable)); @@ -54,7 +54,7 @@ namespace osu.Game.Screens.Edit.Screens.Compose.Layers drawable.DragRequested += onDragRequested; } - public override bool Remove(HitObjectMask drawable) + public override bool Remove(SelectionMask drawable) { if (drawable == null) throw new ArgumentNullException(nameof(drawable)); @@ -87,33 +87,33 @@ namespace osu.Game.Screens.Edit.Screens.Compose.Layers } /// - /// Deselects all selected s. + /// Deselects all selected s. /// public void DeselectAll() => aliveMasks.ToList().ForEach(m => m.Deselect()); - private void onMaskSelected(HitObjectMask mask) + private void onMaskSelected(SelectionMask mask) { MaskSelected?.Invoke(mask); ChangeChildDepth(mask, 1); } - private void onMaskDeselected(HitObjectMask mask) + private void onMaskDeselected(SelectionMask mask) { MaskDeselected?.Invoke(mask); ChangeChildDepth(mask, 0); } - private void onSelectionRequested(HitObjectMask mask, InputState state) => MaskSelectionRequested?.Invoke(mask, state); - private void onDragRequested(HitObjectMask mask, Vector2 delta, InputState state) => MaskDragRequested?.Invoke(mask, delta, state); + private void onSelectionRequested(SelectionMask mask, InputState state) => MaskSelectionRequested?.Invoke(mask, state); + private void onDragRequested(SelectionMask mask, Vector2 delta, InputState state) => MaskDragRequested?.Invoke(mask, delta, state); protected override int Compare(Drawable x, Drawable y) { - if (!(x is HitObjectMask xMask) || !(y is HitObjectMask yMask)) + if (!(x is SelectionMask xMask) || !(y is SelectionMask yMask)) return base.Compare(x, y); return Compare(xMask, yMask); } - public int Compare(HitObjectMask x, HitObjectMask y) + public int Compare(SelectionMask x, SelectionMask y) { // dpeth is used to denote selected status (we always want selected masks to handle input first). int d = x.Depth.CompareTo(y.Depth); diff --git a/osu.Game/Screens/Edit/Screens/Compose/Layers/MaskSelection.cs b/osu.Game/Screens/Edit/Screens/Compose/Layers/MaskSelection.cs index 635edf82da..1231737122 100644 --- a/osu.Game/Screens/Edit/Screens/Compose/Layers/MaskSelection.cs +++ b/osu.Game/Screens/Edit/Screens/Compose/Layers/MaskSelection.cs @@ -16,19 +16,19 @@ using OpenTK; namespace osu.Game.Screens.Edit.Screens.Compose.Layers { /// - /// A box which surrounds s and provides interactive handles, context menus etc. + /// A box which surrounds s and provides interactive handles, context menus etc. /// public class MaskSelection : CompositeDrawable { public const float BORDER_RADIUS = 2; - private readonly List selectedMasks; + private readonly List selectedMasks; private Drawable outline; public MaskSelection() { - selectedMasks = new List(); + selectedMasks = new List(); RelativeSizeAxes = Axes.Both; AlwaysPresent = true; @@ -54,7 +54,7 @@ namespace osu.Game.Screens.Edit.Screens.Compose.Layers #region User Input Handling - public void HandleDrag(HitObjectMask m, Vector2 delta, InputState state) + public void HandleDrag(SelectionMask m, Vector2 delta, InputState state) { // Todo: Various forms of snapping @@ -82,13 +82,13 @@ namespace osu.Game.Screens.Edit.Screens.Compose.Layers /// Handle a mask becoming selected. /// /// The mask. - public void HandleSelected(HitObjectMask mask) => selectedMasks.Add(mask); + public void HandleSelected(SelectionMask mask) => selectedMasks.Add(mask); /// /// Handle a mask becoming deselected. /// /// The mask. - public void HandleDeselected(HitObjectMask mask) + public void HandleDeselected(SelectionMask mask) { selectedMasks.Remove(mask); @@ -101,7 +101,7 @@ namespace osu.Game.Screens.Edit.Screens.Compose.Layers /// Handle a mask requesting selection. /// /// The mask. - public void HandleSelectionRequested(HitObjectMask mask, InputState state) + public void HandleSelectionRequested(SelectionMask mask, InputState state) { if (state.Keyboard.ControlPressed) { From 1164108a95da3d9d32b7c6cd1d3cfe7402b391d1 Mon Sep 17 00:00:00 2001 From: smoogipoo Date: Wed, 3 Oct 2018 13:45:41 +0900 Subject: [PATCH 191/417] Renamespace ruleset masks --- osu.Game.Rulesets.Mania/Edit/ManiaHitObjectComposer.cs | 2 +- .../Selection/Overlays => Masks}/HoldNoteSelectionMask.cs | 2 +- .../{Layers/Selection/Overlays => Masks}/NoteSelectionMask.cs | 2 +- .../Selection/Overlays => Masks}/HitCircleSelectionMask.cs | 4 ++-- .../Selection/Overlays => Masks}/SliderCircleSelectionMask.cs | 2 +- .../Selection/Overlays => Masks}/SliderSelectionMask.cs | 2 +- osu.Game.Rulesets.Osu/Edit/OsuHitObjectComposer.cs | 2 +- 7 files changed, 8 insertions(+), 8 deletions(-) rename osu.Game.Rulesets.Mania/Edit/{Layers/Selection/Overlays => Masks}/HoldNoteSelectionMask.cs (97%) rename osu.Game.Rulesets.Mania/Edit/{Layers/Selection/Overlays => Masks}/NoteSelectionMask.cs (93%) rename osu.Game.Rulesets.Osu/Edit/{Layers/Selection/Overlays => Masks}/HitCircleSelectionMask.cs (94%) rename osu.Game.Rulesets.Osu/Edit/{Layers/Selection/Overlays => Masks}/SliderCircleSelectionMask.cs (96%) rename osu.Game.Rulesets.Osu/Edit/{Layers/Selection/Overlays => Masks}/SliderSelectionMask.cs (97%) diff --git a/osu.Game.Rulesets.Mania/Edit/ManiaHitObjectComposer.cs b/osu.Game.Rulesets.Mania/Edit/ManiaHitObjectComposer.cs index 7cc473c712..1053e998be 100644 --- a/osu.Game.Rulesets.Mania/Edit/ManiaHitObjectComposer.cs +++ b/osu.Game.Rulesets.Mania/Edit/ManiaHitObjectComposer.cs @@ -4,7 +4,6 @@ using osu.Game.Beatmaps; using osu.Game.Rulesets.Edit; using osu.Game.Rulesets.Edit.Tools; -using osu.Game.Rulesets.Mania.Edit.Layers.Selection.Overlays; using osu.Game.Rulesets.Mania.Objects; using osu.Game.Rulesets.Mania.Objects.Drawables; using osu.Game.Rulesets.Objects.Drawables; @@ -12,6 +11,7 @@ using osu.Game.Rulesets.UI; using System.Collections.Generic; using osu.Framework.Allocation; using osu.Game.Rulesets.Mania.Configuration; +using osu.Game.Rulesets.Mania.Edit.Masks; using osu.Game.Rulesets.Mania.UI; namespace osu.Game.Rulesets.Mania.Edit diff --git a/osu.Game.Rulesets.Mania/Edit/Layers/Selection/Overlays/HoldNoteSelectionMask.cs b/osu.Game.Rulesets.Mania/Edit/Masks/HoldNoteSelectionMask.cs similarity index 97% rename from osu.Game.Rulesets.Mania/Edit/Layers/Selection/Overlays/HoldNoteSelectionMask.cs rename to osu.Game.Rulesets.Mania/Edit/Masks/HoldNoteSelectionMask.cs index b4f62ea170..a2c01d7a0e 100644 --- a/osu.Game.Rulesets.Mania/Edit/Layers/Selection/Overlays/HoldNoteSelectionMask.cs +++ b/osu.Game.Rulesets.Mania/Edit/Masks/HoldNoteSelectionMask.cs @@ -13,7 +13,7 @@ using osu.Game.Rulesets.UI.Scrolling; using OpenTK; using OpenTK.Graphics; -namespace osu.Game.Rulesets.Mania.Edit.Layers.Selection.Overlays +namespace osu.Game.Rulesets.Mania.Edit.Masks { public class HoldNoteSelectionMask : SelectionMask { diff --git a/osu.Game.Rulesets.Mania/Edit/Layers/Selection/Overlays/NoteSelectionMask.cs b/osu.Game.Rulesets.Mania/Edit/Masks/NoteSelectionMask.cs similarity index 93% rename from osu.Game.Rulesets.Mania/Edit/Layers/Selection/Overlays/NoteSelectionMask.cs rename to osu.Game.Rulesets.Mania/Edit/Masks/NoteSelectionMask.cs index d976386d6e..18f042a483 100644 --- a/osu.Game.Rulesets.Mania/Edit/Layers/Selection/Overlays/NoteSelectionMask.cs +++ b/osu.Game.Rulesets.Mania/Edit/Masks/NoteSelectionMask.cs @@ -7,7 +7,7 @@ using osu.Game.Rulesets.Edit; using osu.Game.Rulesets.Mania.Objects.Drawables; using osu.Game.Rulesets.Mania.Objects.Drawables.Pieces; -namespace osu.Game.Rulesets.Mania.Edit.Layers.Selection.Overlays +namespace osu.Game.Rulesets.Mania.Edit.Masks { public class NoteSelectionMask : SelectionMask { diff --git a/osu.Game.Rulesets.Osu/Edit/Layers/Selection/Overlays/HitCircleSelectionMask.cs b/osu.Game.Rulesets.Osu/Edit/Masks/HitCircleSelectionMask.cs similarity index 94% rename from osu.Game.Rulesets.Osu/Edit/Layers/Selection/Overlays/HitCircleSelectionMask.cs rename to osu.Game.Rulesets.Osu/Edit/Masks/HitCircleSelectionMask.cs index aa8044af15..6c96b40b33 100644 --- a/osu.Game.Rulesets.Osu/Edit/Layers/Selection/Overlays/HitCircleSelectionMask.cs +++ b/osu.Game.Rulesets.Osu/Edit/Masks/HitCircleSelectionMask.cs @@ -1,14 +1,14 @@ // Copyright (c) 2007-2018 ppy Pty Ltd . // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE -using osu.Framework.Graphics; using osu.Framework.Allocation; +using osu.Framework.Graphics; using osu.Game.Graphics; using osu.Game.Rulesets.Edit; using osu.Game.Rulesets.Osu.Objects.Drawables; using osu.Game.Rulesets.Osu.Objects.Drawables.Pieces; -namespace osu.Game.Rulesets.Osu.Edit.Layers.Selection.Overlays +namespace osu.Game.Rulesets.Osu.Edit.Masks { public class HitCircleSelectionMask : SelectionMask { diff --git a/osu.Game.Rulesets.Osu/Edit/Layers/Selection/Overlays/SliderCircleSelectionMask.cs b/osu.Game.Rulesets.Osu/Edit/Masks/SliderCircleSelectionMask.cs similarity index 96% rename from osu.Game.Rulesets.Osu/Edit/Layers/Selection/Overlays/SliderCircleSelectionMask.cs rename to osu.Game.Rulesets.Osu/Edit/Masks/SliderCircleSelectionMask.cs index 4d6a530eda..1ed22c2ac1 100644 --- a/osu.Game.Rulesets.Osu/Edit/Layers/Selection/Overlays/SliderCircleSelectionMask.cs +++ b/osu.Game.Rulesets.Osu/Edit/Masks/SliderCircleSelectionMask.cs @@ -10,7 +10,7 @@ using osu.Game.Rulesets.Osu.Objects.Drawables; using osu.Game.Rulesets.Osu.Objects.Drawables.Pieces; using OpenTK; -namespace osu.Game.Rulesets.Osu.Edit.Layers.Selection.Overlays +namespace osu.Game.Rulesets.Osu.Edit.Masks { public class SliderCircleSelectionMask : SelectionMask { diff --git a/osu.Game.Rulesets.Osu/Edit/Layers/Selection/Overlays/SliderSelectionMask.cs b/osu.Game.Rulesets.Osu/Edit/Masks/SliderSelectionMask.cs similarity index 97% rename from osu.Game.Rulesets.Osu/Edit/Layers/Selection/Overlays/SliderSelectionMask.cs rename to osu.Game.Rulesets.Osu/Edit/Masks/SliderSelectionMask.cs index 40c2026937..b775854038 100644 --- a/osu.Game.Rulesets.Osu/Edit/Layers/Selection/Overlays/SliderSelectionMask.cs +++ b/osu.Game.Rulesets.Osu/Edit/Masks/SliderSelectionMask.cs @@ -12,7 +12,7 @@ using osu.Game.Rulesets.Osu.Objects.Drawables.Pieces; using OpenTK; using OpenTK.Graphics; -namespace osu.Game.Rulesets.Osu.Edit.Layers.Selection.Overlays +namespace osu.Game.Rulesets.Osu.Edit.Masks { public class SliderSelectionMask : SelectionMask { diff --git a/osu.Game.Rulesets.Osu/Edit/OsuHitObjectComposer.cs b/osu.Game.Rulesets.Osu/Edit/OsuHitObjectComposer.cs index 04f573596b..3e88004e6e 100644 --- a/osu.Game.Rulesets.Osu/Edit/OsuHitObjectComposer.cs +++ b/osu.Game.Rulesets.Osu/Edit/OsuHitObjectComposer.cs @@ -7,7 +7,7 @@ using osu.Game.Beatmaps; using osu.Game.Rulesets.Edit; using osu.Game.Rulesets.Edit.Tools; using osu.Game.Rulesets.Objects.Drawables; -using osu.Game.Rulesets.Osu.Edit.Layers.Selection.Overlays; +using osu.Game.Rulesets.Osu.Edit.Masks; using osu.Game.Rulesets.Osu.Objects; using osu.Game.Rulesets.Osu.Objects.Drawables; using osu.Game.Rulesets.Osu.UI; From 28b0ab6123c9935f81ee99f3a4b3f3b78124afcf Mon Sep 17 00:00:00 2001 From: smoogipoo Date: Wed, 3 Oct 2018 14:35:26 +0900 Subject: [PATCH 192/417] Split visuals of HitCircleSelectionMask into HitCircleMask --- .../Edit/Masks/HitCircleMask.cs | 35 +++++++++++++++++++ .../Edit/Masks/HitCircleSelectionMask.cs | 18 ++-------- 2 files changed, 38 insertions(+), 15 deletions(-) create mode 100644 osu.Game.Rulesets.Osu/Edit/Masks/HitCircleMask.cs diff --git a/osu.Game.Rulesets.Osu/Edit/Masks/HitCircleMask.cs b/osu.Game.Rulesets.Osu/Edit/Masks/HitCircleMask.cs new file mode 100644 index 0000000000..76f876fb42 --- /dev/null +++ b/osu.Game.Rulesets.Osu/Edit/Masks/HitCircleMask.cs @@ -0,0 +1,35 @@ +// Copyright (c) 2007-2018 ppy Pty Ltd . +// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE + +using osu.Framework.Allocation; +using osu.Framework.Graphics; +using osu.Framework.Graphics.Containers; +using osu.Game.Graphics; +using osu.Game.Rulesets.Osu.Objects; +using osu.Game.Rulesets.Osu.Objects.Drawables.Pieces; +using OpenTK; + +namespace osu.Game.Rulesets.Osu.Edit.Masks +{ + public class HitCircleMask : CompositeDrawable + { + public HitCircleMask(HitCircle hitCircle) + { + Anchor = Anchor.Centre; + Origin = Anchor.Centre; + + Size = new Vector2((float)OsuHitObject.OBJECT_RADIUS * 2); + Scale = new Vector2(hitCircle.Scale); + + CornerRadius = Size.X / 2; + + AddInternal(new RingPiece()); + } + + [BackgroundDependencyLoader] + private void load(OsuColour colours) + { + Colour = colours.Yellow; + } + } +} diff --git a/osu.Game.Rulesets.Osu/Edit/Masks/HitCircleSelectionMask.cs b/osu.Game.Rulesets.Osu/Edit/Masks/HitCircleSelectionMask.cs index 6c96b40b33..b9ca95b837 100644 --- a/osu.Game.Rulesets.Osu/Edit/Masks/HitCircleSelectionMask.cs +++ b/osu.Game.Rulesets.Osu/Edit/Masks/HitCircleSelectionMask.cs @@ -1,12 +1,10 @@ // Copyright (c) 2007-2018 ppy Pty Ltd . // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE -using osu.Framework.Allocation; using osu.Framework.Graphics; -using osu.Game.Graphics; using osu.Game.Rulesets.Edit; +using osu.Game.Rulesets.Osu.Objects; using osu.Game.Rulesets.Osu.Objects.Drawables; -using osu.Game.Rulesets.Osu.Objects.Drawables.Pieces; namespace osu.Game.Rulesets.Osu.Edit.Masks { @@ -16,22 +14,12 @@ namespace osu.Game.Rulesets.Osu.Edit.Masks : base(hitCircle) { Origin = Anchor.Centre; - + AutoSizeAxes = Axes.Both; Position = hitCircle.Position; - Size = hitCircle.Size; - Scale = hitCircle.Scale; - CornerRadius = Size.X / 2; - - AddInternal(new RingPiece()); + InternalChild = new HitCircleMask((HitCircle)hitCircle.HitObject); hitCircle.HitObject.PositionChanged += _ => Position = hitCircle.Position; } - - [BackgroundDependencyLoader] - private void load(OsuColour colours) - { - Colour = colours.Yellow; - } } } From 10d0e2fef11ed5cc0568dbe0559683f38b4aed7e Mon Sep 17 00:00:00 2001 From: smoogipoo Date: Wed, 3 Oct 2018 14:35:32 +0900 Subject: [PATCH 193/417] Fix up testcase --- osu.Game.Tests/Visual/TestCaseHitObjectComposer.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu.Game.Tests/Visual/TestCaseHitObjectComposer.cs b/osu.Game.Tests/Visual/TestCaseHitObjectComposer.cs index 5df371dd09..55dc0c4eb0 100644 --- a/osu.Game.Tests/Visual/TestCaseHitObjectComposer.cs +++ b/osu.Game.Tests/Visual/TestCaseHitObjectComposer.cs @@ -49,7 +49,7 @@ namespace osu.Game.Tests.Visual Vector2.Zero, new Vector2(216, 0), }, - Distance = 400, + Distance = 216, Velocity = 1, TickDistance = 100, Scale = 0.5f, From 540a010fbb52b327c010d4dd34946e9713b2a439 Mon Sep 17 00:00:00 2001 From: smoogipoo Date: Wed, 3 Oct 2018 15:36:14 +0900 Subject: [PATCH 194/417] Implement an intermediary EditRulesetContainer --- .../UI/CatchRulesetContainer.cs | 2 +- .../Edit/ManiaEditRulesetContainer.cs | 31 ++++++--- .../Edit/ManiaHitObjectComposer.cs | 3 +- .../UI/ManiaRulesetContainer.cs | 2 +- .../Edit/OsuEditRulesetContainer.cs | 24 +++++-- .../Edit/OsuHitObjectComposer.cs | 3 +- .../UI/OsuRulesetContainer.cs | 2 +- .../UI/TaikoRulesetContainer.cs | 2 +- .../Rulesets/Edit/EditRulesetContainer.cs | 67 +++++++++++++++++++ osu.Game/Rulesets/Edit/HitObjectComposer.cs | 4 +- osu.Game/Rulesets/UI/RulesetContainer.cs | 31 +++++---- 11 files changed, 136 insertions(+), 35 deletions(-) create mode 100644 osu.Game/Rulesets/Edit/EditRulesetContainer.cs diff --git a/osu.Game.Rulesets.Catch/UI/CatchRulesetContainer.cs b/osu.Game.Rulesets.Catch/UI/CatchRulesetContainer.cs index 1ac052de4d..9bec270468 100644 --- a/osu.Game.Rulesets.Catch/UI/CatchRulesetContainer.cs +++ b/osu.Game.Rulesets.Catch/UI/CatchRulesetContainer.cs @@ -34,7 +34,7 @@ namespace osu.Game.Rulesets.Catch.UI protected override Vector2 PlayfieldArea => new Vector2(0.86f); // matches stable's vertical offset for catcher plate - protected override DrawableHitObject GetVisualRepresentation(CatchHitObject h) + public override DrawableHitObject GetVisualRepresentation(CatchHitObject h) { switch (h) { diff --git a/osu.Game.Rulesets.Mania/Edit/ManiaEditRulesetContainer.cs b/osu.Game.Rulesets.Mania/Edit/ManiaEditRulesetContainer.cs index a01947a60b..ca844220cf 100644 --- a/osu.Game.Rulesets.Mania/Edit/ManiaEditRulesetContainer.cs +++ b/osu.Game.Rulesets.Mania/Edit/ManiaEditRulesetContainer.cs @@ -4,24 +4,37 @@ using osu.Framework.Graphics; using OpenTK; using osu.Game.Beatmaps; +using osu.Game.Rulesets.Edit; +using osu.Game.Rulesets.Mania.Objects; using osu.Game.Rulesets.Mania.UI; using osu.Game.Rulesets.UI; namespace osu.Game.Rulesets.Mania.Edit { - public class ManiaEditRulesetContainer : ManiaRulesetContainer + public class ManiaEditRulesetContainer : EditRulesetContainer { - public ManiaEditRulesetContainer(Ruleset ruleset, WorkingBeatmap beatmap) - : base(ruleset, beatmap) + public ManiaEditRulesetContainer(Ruleset ruleset, WorkingBeatmap workingBeatmap) + : base(ruleset, workingBeatmap) { } - protected override Playfield CreatePlayfield() => new ManiaEditPlayfield(Beatmap.Stages) - { - Anchor = Anchor.Centre, - Origin = Anchor.Centre, - }; + protected override RulesetContainer CreateRulesetContainer(Ruleset ruleset, WorkingBeatmap workingBeatmap) + => new RulesetContainer(ruleset, workingBeatmap); - protected override Vector2 PlayfieldArea => Vector2.One; + private new class RulesetContainer : ManiaRulesetContainer + { + public RulesetContainer(Ruleset ruleset, WorkingBeatmap beatmap) + : base(ruleset, beatmap) + { + } + + protected override Playfield CreatePlayfield() => new ManiaEditPlayfield(Beatmap.Stages) + { + Anchor = Anchor.Centre, + Origin = Anchor.Centre, + }; + + protected override Vector2 PlayfieldArea => Vector2.One; + } } } diff --git a/osu.Game.Rulesets.Mania/Edit/ManiaHitObjectComposer.cs b/osu.Game.Rulesets.Mania/Edit/ManiaHitObjectComposer.cs index 1053e998be..75dc475d52 100644 --- a/osu.Game.Rulesets.Mania/Edit/ManiaHitObjectComposer.cs +++ b/osu.Game.Rulesets.Mania/Edit/ManiaHitObjectComposer.cs @@ -7,7 +7,6 @@ using osu.Game.Rulesets.Edit.Tools; using osu.Game.Rulesets.Mania.Objects; using osu.Game.Rulesets.Mania.Objects.Drawables; using osu.Game.Rulesets.Objects.Drawables; -using osu.Game.Rulesets.UI; using System.Collections.Generic; using osu.Framework.Allocation; using osu.Game.Rulesets.Mania.Configuration; @@ -32,7 +31,7 @@ namespace osu.Game.Rulesets.Mania.Edit return dependencies; } - protected override RulesetContainer CreateRulesetContainer(Ruleset ruleset, WorkingBeatmap beatmap) => new ManiaEditRulesetContainer(ruleset, beatmap); + protected override EditRulesetContainer CreateRulesetContainer(Ruleset ruleset, WorkingBeatmap beatmap) => new ManiaEditRulesetContainer(ruleset, beatmap); protected override IReadOnlyList CompositionTools => new ICompositionTool[] { diff --git a/osu.Game.Rulesets.Mania/UI/ManiaRulesetContainer.cs b/osu.Game.Rulesets.Mania/UI/ManiaRulesetContainer.cs index 09ebde2799..425e0db237 100644 --- a/osu.Game.Rulesets.Mania/UI/ManiaRulesetContainer.cs +++ b/osu.Game.Rulesets.Mania/UI/ManiaRulesetContainer.cs @@ -97,7 +97,7 @@ namespace osu.Game.Rulesets.Mania.UI public override PassThroughInputManager CreateInputManager() => new ManiaInputManager(Ruleset.RulesetInfo, Variant); - protected override DrawableHitObject GetVisualRepresentation(ManiaHitObject h) + public override DrawableHitObject GetVisualRepresentation(ManiaHitObject h) { switch (h) { diff --git a/osu.Game.Rulesets.Osu/Edit/OsuEditRulesetContainer.cs b/osu.Game.Rulesets.Osu/Edit/OsuEditRulesetContainer.cs index 6efa16bf56..8d3a0c25f0 100644 --- a/osu.Game.Rulesets.Osu/Edit/OsuEditRulesetContainer.cs +++ b/osu.Game.Rulesets.Osu/Edit/OsuEditRulesetContainer.cs @@ -3,20 +3,34 @@ using osu.Framework.Graphics.Cursor; using osu.Game.Beatmaps; +using osu.Game.Rulesets.Edit; +using osu.Game.Rulesets.Osu.Objects; using osu.Game.Rulesets.Osu.UI; +using osu.Game.Rulesets.UI; using OpenTK; namespace osu.Game.Rulesets.Osu.Edit { - public class OsuEditRulesetContainer : OsuRulesetContainer + public class OsuEditRulesetContainer : EditRulesetContainer { - public OsuEditRulesetContainer(Ruleset ruleset, WorkingBeatmap beatmap) - : base(ruleset, beatmap) + public OsuEditRulesetContainer(Ruleset ruleset, WorkingBeatmap workingBeatmap) + : base(ruleset, workingBeatmap) { } - protected override Vector2 PlayfieldArea => Vector2.One; + protected override RulesetContainer CreateRulesetContainer(Ruleset ruleset, WorkingBeatmap workingBeatmap) + => new RulesetContainer(ruleset, workingBeatmap); - protected override CursorContainer CreateCursor() => null; + private new class RulesetContainer : OsuRulesetContainer + { + public RulesetContainer(Ruleset ruleset, WorkingBeatmap beatmap) + : base(ruleset, beatmap) + { + } + + protected override Vector2 PlayfieldArea => Vector2.One; + + protected override CursorContainer CreateCursor() => null; + } } } diff --git a/osu.Game.Rulesets.Osu/Edit/OsuHitObjectComposer.cs b/osu.Game.Rulesets.Osu/Edit/OsuHitObjectComposer.cs index 3e88004e6e..de8c39b0b2 100644 --- a/osu.Game.Rulesets.Osu/Edit/OsuHitObjectComposer.cs +++ b/osu.Game.Rulesets.Osu/Edit/OsuHitObjectComposer.cs @@ -3,6 +3,7 @@ using System.Collections.Generic; using osu.Framework.Graphics; +using osu.Framework.Input.Events; using osu.Game.Beatmaps; using osu.Game.Rulesets.Edit; using osu.Game.Rulesets.Edit.Tools; @@ -22,7 +23,7 @@ namespace osu.Game.Rulesets.Osu.Edit { } - protected override RulesetContainer CreateRulesetContainer(Ruleset ruleset, WorkingBeatmap beatmap) => new OsuEditRulesetContainer(ruleset, beatmap); + protected override EditRulesetContainer CreateRulesetContainer(Ruleset ruleset, WorkingBeatmap beatmap) => new OsuEditRulesetContainer(ruleset, beatmap); protected override IReadOnlyList CompositionTools => new ICompositionTool[] { diff --git a/osu.Game.Rulesets.Osu/UI/OsuRulesetContainer.cs b/osu.Game.Rulesets.Osu/UI/OsuRulesetContainer.cs index 4bc6992445..10f6a824f8 100644 --- a/osu.Game.Rulesets.Osu/UI/OsuRulesetContainer.cs +++ b/osu.Game.Rulesets.Osu/UI/OsuRulesetContainer.cs @@ -32,7 +32,7 @@ namespace osu.Game.Rulesets.Osu.UI public override PassThroughInputManager CreateInputManager() => new OsuInputManager(Ruleset.RulesetInfo); - protected override DrawableHitObject GetVisualRepresentation(OsuHitObject h) + public override DrawableHitObject GetVisualRepresentation(OsuHitObject h) { switch (h) { diff --git a/osu.Game.Rulesets.Taiko/UI/TaikoRulesetContainer.cs b/osu.Game.Rulesets.Taiko/UI/TaikoRulesetContainer.cs index 229ab69ceb..eb14aa74f1 100644 --- a/osu.Game.Rulesets.Taiko/UI/TaikoRulesetContainer.cs +++ b/osu.Game.Rulesets.Taiko/UI/TaikoRulesetContainer.cs @@ -96,7 +96,7 @@ namespace osu.Game.Rulesets.Taiko.UI Origin = Anchor.CentreLeft }; - protected override DrawableHitObject GetVisualRepresentation(TaikoHitObject h) + public override DrawableHitObject GetVisualRepresentation(TaikoHitObject h) { switch (h) { diff --git a/osu.Game/Rulesets/Edit/EditRulesetContainer.cs b/osu.Game/Rulesets/Edit/EditRulesetContainer.cs new file mode 100644 index 0000000000..98783b366e --- /dev/null +++ b/osu.Game/Rulesets/Edit/EditRulesetContainer.cs @@ -0,0 +1,67 @@ +// Copyright (c) 2007-2018 ppy Pty Ltd . +// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE + +using osu.Framework.Graphics; +using osu.Framework.Graphics.Containers; +using osu.Game.Beatmaps; +using osu.Game.Rulesets.Objects; +using osu.Game.Rulesets.UI; + +namespace osu.Game.Rulesets.Edit +{ + public abstract class EditRulesetContainer : CompositeDrawable + { + public Playfield Playfield => RulesetContainer.Playfield; + + protected abstract RulesetContainer RulesetContainer { get; } + + internal EditRulesetContainer() + { + RelativeSizeAxes = Axes.Both; + } + + public abstract void AddHitObject(HitObject hitObject); + } + + public abstract class EditRulesetContainer : EditRulesetContainer + where TObject : HitObject + { + private readonly Ruleset ruleset; + + private readonly RulesetContainer rulesetContainer; + protected override RulesetContainer RulesetContainer => rulesetContainer; + + private Beatmap beatmap => rulesetContainer.Beatmap; + + protected EditRulesetContainer(Ruleset ruleset, WorkingBeatmap workingBeatmap) + { + this.ruleset = ruleset; + + InternalChild = rulesetContainer = CreateRulesetContainer(ruleset, workingBeatmap); + } + + public override void AddHitObject(HitObject hitObject) + { + var tObject = (TObject)hitObject; + + // Insert into beatmap while maintaining sorting order + var insertionIndex = beatmap.HitObjects.FindLastIndex(h => h.StartTime <= hitObject.StartTime); + beatmap.HitObjects.Insert(insertionIndex + 1, tObject); + + var processor = ruleset.CreateBeatmapProcessor(beatmap); + + processor.PreProcess(); + tObject.ApplyDefaults(beatmap.ControlPointInfo, beatmap.BeatmapInfo.BaseDifficulty); + processor.PostProcess(); + + rulesetContainer.Playfield.Add(rulesetContainer.GetVisualRepresentation(tObject)); + rulesetContainer.Playfield.PostProcess(); + } + + /// + /// Creates the underlying . + /// + /// + protected abstract RulesetContainer CreateRulesetContainer(Ruleset ruleset, WorkingBeatmap workingBeatmap); + } +} diff --git a/osu.Game/Rulesets/Edit/HitObjectComposer.cs b/osu.Game/Rulesets/Edit/HitObjectComposer.cs index 8e8bc7edb8..a3f5cb80a3 100644 --- a/osu.Game/Rulesets/Edit/HitObjectComposer.cs +++ b/osu.Game/Rulesets/Edit/HitObjectComposer.cs @@ -32,7 +32,7 @@ namespace osu.Game.Rulesets.Edit private readonly List layerContainers = new List(); private readonly IBindable beatmap = new Bindable(); - private RulesetContainer rulesetContainer; + private EditRulesetContainer rulesetContainer; protected HitObjectComposer(Ruleset ruleset) { @@ -146,7 +146,7 @@ namespace osu.Game.Rulesets.Edit private void setCompositionTool(ICompositionTool tool) => CurrentTool = tool; - protected virtual RulesetContainer CreateRulesetContainer(Ruleset ruleset, WorkingBeatmap beatmap) => ruleset.CreateRulesetContainerWith(beatmap); + protected abstract EditRulesetContainer CreateRulesetContainer(Ruleset ruleset, WorkingBeatmap beatmap); protected abstract IReadOnlyList CompositionTools { get; } diff --git a/osu.Game/Rulesets/UI/RulesetContainer.cs b/osu.Game/Rulesets/UI/RulesetContainer.cs index a830803fb1..340ae7077d 100644 --- a/osu.Game/Rulesets/UI/RulesetContainer.cs +++ b/osu.Game/Rulesets/UI/RulesetContainer.cs @@ -291,17 +291,7 @@ namespace osu.Game.Rulesets.UI private void loadObjects() { foreach (TObject h in Beatmap.HitObjects) - { - var drawableObject = GetVisualRepresentation(h); - - if (drawableObject == null) - continue; - - drawableObject.OnNewResult += (_, r) => OnNewResult?.Invoke(r); - drawableObject.OnRevertResult += (_, r) => OnRevertResult?.Invoke(r); - - Playfield.Add(drawableObject); - } + AddRepresentation(h); Playfield.PostProcess(); @@ -309,6 +299,23 @@ namespace osu.Game.Rulesets.UI mod.ApplyToDrawableHitObjects(Playfield.HitObjectContainer.Objects); } + /// + /// Creates and adds the visual representation of a to this . + /// + /// The to add the visual representation for. + internal void AddRepresentation(TObject hitObject) + { + var drawableObject = GetVisualRepresentation(hitObject); + + if (drawableObject == null) + return; + + drawableObject.OnNewResult += (_, r) => OnNewResult?.Invoke(r); + drawableObject.OnRevertResult += (_, r) => OnRevertResult?.Invoke(r); + + Playfield.Add(drawableObject); + } + protected override void Update() { base.Update(); @@ -334,7 +341,7 @@ namespace osu.Game.Rulesets.UI /// /// The HitObject to make drawable. /// The DrawableHitObject. - protected abstract DrawableHitObject GetVisualRepresentation(TObject h); + public abstract DrawableHitObject GetVisualRepresentation(TObject h); } /// From 3420e0c7ebae674755821cc7e5d970b2187f0309 Mon Sep 17 00:00:00 2001 From: smoogipoo Date: Wed, 3 Oct 2018 16:27:26 +0900 Subject: [PATCH 195/417] Re-implement composition tools + implement placement masks --- .../Edit/ManiaHitObjectComposer.cs | 8 +-- .../Edit/HitCircleCompositionTool.cs | 20 ++++++ .../Edit/Masks/HitCircleMask.cs | 11 ++- .../Edit/Masks/HitCirclePlacementMask.cs | 36 ++++++++++ .../Edit/OsuHitObjectComposer.cs | 8 +-- osu.Game/Rulesets/Edit/HitObjectComposer.cs | 29 ++++++-- osu.Game/Rulesets/Edit/PlacementMask.cs | 71 +++++++++++++++++++ .../Edit/Tools/HitObjectCompositionTool.cs | 16 ++--- .../Rulesets/Edit/Tools/ICompositionTool.cs | 10 --- 9 files changed, 171 insertions(+), 38 deletions(-) create mode 100644 osu.Game.Rulesets.Osu/Edit/HitCircleCompositionTool.cs create mode 100644 osu.Game.Rulesets.Osu/Edit/Masks/HitCirclePlacementMask.cs create mode 100644 osu.Game/Rulesets/Edit/PlacementMask.cs delete mode 100644 osu.Game/Rulesets/Edit/Tools/ICompositionTool.cs diff --git a/osu.Game.Rulesets.Mania/Edit/ManiaHitObjectComposer.cs b/osu.Game.Rulesets.Mania/Edit/ManiaHitObjectComposer.cs index 75dc475d52..8363d1dc44 100644 --- a/osu.Game.Rulesets.Mania/Edit/ManiaHitObjectComposer.cs +++ b/osu.Game.Rulesets.Mania/Edit/ManiaHitObjectComposer.cs @@ -1,10 +1,10 @@ // Copyright (c) 2007-2018 ppy Pty Ltd . // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE +using System; using osu.Game.Beatmaps; using osu.Game.Rulesets.Edit; using osu.Game.Rulesets.Edit.Tools; -using osu.Game.Rulesets.Mania.Objects; using osu.Game.Rulesets.Mania.Objects.Drawables; using osu.Game.Rulesets.Objects.Drawables; using System.Collections.Generic; @@ -33,11 +33,7 @@ namespace osu.Game.Rulesets.Mania.Edit protected override EditRulesetContainer CreateRulesetContainer(Ruleset ruleset, WorkingBeatmap beatmap) => new ManiaEditRulesetContainer(ruleset, beatmap); - protected override IReadOnlyList CompositionTools => new ICompositionTool[] - { - new HitObjectCompositionTool("Note"), - new HitObjectCompositionTool("Hold"), - }; + protected override IReadOnlyList CompositionTools => Array.Empty(); public override SelectionMask CreateMaskFor(DrawableHitObject hitObject) { diff --git a/osu.Game.Rulesets.Osu/Edit/HitCircleCompositionTool.cs b/osu.Game.Rulesets.Osu/Edit/HitCircleCompositionTool.cs new file mode 100644 index 0000000000..fdf791d2d1 --- /dev/null +++ b/osu.Game.Rulesets.Osu/Edit/HitCircleCompositionTool.cs @@ -0,0 +1,20 @@ +// Copyright (c) 2007-2018 ppy Pty Ltd . +// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE + +using osu.Game.Rulesets.Edit; +using osu.Game.Rulesets.Edit.Tools; +using osu.Game.Rulesets.Osu.Edit.Masks; +using osu.Game.Rulesets.Osu.Objects; + +namespace osu.Game.Rulesets.Osu.Edit +{ + public class HitCircleCompositionTool : HitObjectCompositionTool + { + public HitCircleCompositionTool() + : base(nameof(HitCircle)) + { + } + + public override PlacementMask CreatePlacementMask() => new HitCirclePlacementMask(); + } +} diff --git a/osu.Game.Rulesets.Osu/Edit/Masks/HitCircleMask.cs b/osu.Game.Rulesets.Osu/Edit/Masks/HitCircleMask.cs index 76f876fb42..9576e0fa91 100644 --- a/osu.Game.Rulesets.Osu/Edit/Masks/HitCircleMask.cs +++ b/osu.Game.Rulesets.Osu/Edit/Masks/HitCircleMask.cs @@ -13,13 +13,15 @@ namespace osu.Game.Rulesets.Osu.Edit.Masks { public class HitCircleMask : CompositeDrawable { + private readonly HitCircle hitCircle; + public HitCircleMask(HitCircle hitCircle) { + this.hitCircle = hitCircle; Anchor = Anchor.Centre; Origin = Anchor.Centre; Size = new Vector2((float)OsuHitObject.OBJECT_RADIUS * 2); - Scale = new Vector2(hitCircle.Scale); CornerRadius = Size.X / 2; @@ -31,5 +33,12 @@ namespace osu.Game.Rulesets.Osu.Edit.Masks { Colour = colours.Yellow; } + + protected override void Update() + { + base.Update(); + + Scale = new Vector2(hitCircle.Scale); + } } } diff --git a/osu.Game.Rulesets.Osu/Edit/Masks/HitCirclePlacementMask.cs b/osu.Game.Rulesets.Osu/Edit/Masks/HitCirclePlacementMask.cs new file mode 100644 index 0000000000..33de02af05 --- /dev/null +++ b/osu.Game.Rulesets.Osu/Edit/Masks/HitCirclePlacementMask.cs @@ -0,0 +1,36 @@ +// Copyright (c) 2007-2018 ppy Pty Ltd . +// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE + +using osu.Framework.Graphics; +using osu.Framework.Input.Events; +using osu.Game.Rulesets.Edit; +using osu.Game.Rulesets.Osu.Objects; + +namespace osu.Game.Rulesets.Osu.Edit.Masks +{ + public class HitCirclePlacementMask : PlacementMask + { + public new HitCircle HitObject => (HitCircle)base.HitObject; + + public HitCirclePlacementMask() + : base(new HitCircle()) + { + Origin = Anchor.Centre; + AutoSizeAxes = Axes.Both; + + InternalChild = new HitCircleMask(HitObject); + } + + protected override bool OnClick(ClickEvent e) + { + Finish(); + return true; + } + + protected override bool OnMouseMove(MouseMoveEvent e) + { + HitObject.Position = e.MousePosition; + return base.OnMouseMove(e); + } + } +} diff --git a/osu.Game.Rulesets.Osu/Edit/OsuHitObjectComposer.cs b/osu.Game.Rulesets.Osu/Edit/OsuHitObjectComposer.cs index de8c39b0b2..5472cf3890 100644 --- a/osu.Game.Rulesets.Osu/Edit/OsuHitObjectComposer.cs +++ b/osu.Game.Rulesets.Osu/Edit/OsuHitObjectComposer.cs @@ -3,13 +3,11 @@ using System.Collections.Generic; using osu.Framework.Graphics; -using osu.Framework.Input.Events; using osu.Game.Beatmaps; using osu.Game.Rulesets.Edit; using osu.Game.Rulesets.Edit.Tools; using osu.Game.Rulesets.Objects.Drawables; using osu.Game.Rulesets.Osu.Edit.Masks; -using osu.Game.Rulesets.Osu.Objects; using osu.Game.Rulesets.Osu.Objects.Drawables; using osu.Game.Rulesets.Osu.UI; using osu.Game.Rulesets.UI; @@ -25,11 +23,9 @@ namespace osu.Game.Rulesets.Osu.Edit protected override EditRulesetContainer CreateRulesetContainer(Ruleset ruleset, WorkingBeatmap beatmap) => new OsuEditRulesetContainer(ruleset, beatmap); - protected override IReadOnlyList CompositionTools => new ICompositionTool[] + protected override IReadOnlyList CompositionTools => new[] { - new HitObjectCompositionTool(), - new HitObjectCompositionTool(), - new HitObjectCompositionTool() + new HitCircleCompositionTool(), }; protected override ScalableContainer CreateLayerContainer() => new ScalableContainer(OsuPlayfield.BASE_SIZE.X) { RelativeSizeAxes = Axes.Both }; diff --git a/osu.Game/Rulesets/Edit/HitObjectComposer.cs b/osu.Game/Rulesets/Edit/HitObjectComposer.cs index a3f5cb80a3..5f84006a1e 100644 --- a/osu.Game/Rulesets/Edit/HitObjectComposer.cs +++ b/osu.Game/Rulesets/Edit/HitObjectComposer.cs @@ -26,12 +26,12 @@ namespace osu.Game.Rulesets.Edit public IEnumerable HitObjects => rulesetContainer.Playfield.AllHitObjects; - protected ICompositionTool CurrentTool { get; private set; } protected IRulesetConfigManager Config { get; private set; } private readonly List layerContainers = new List(); private readonly IBindable beatmap = new Bindable(); + private Container placementContainer; private EditRulesetContainer rulesetContainer; protected HitObjectComposer(Ruleset ruleset) @@ -64,7 +64,11 @@ namespace osu.Game.Rulesets.Edit }; var layerAboveRuleset = CreateLayerContainer(); - layerAboveRuleset.Child = new HitObjectMaskLayer(); + layerAboveRuleset.Children = new Drawable[] + { + new HitObjectMaskLayer(), + placementContainer = new Container { RelativeSizeAxes = Axes.Both } + }; layerContainers.Add(layerBelowRuleset); layerContainers.Add(layerAboveRuleset); @@ -144,11 +148,28 @@ namespace osu.Game.Rulesets.Edit }); } - private void setCompositionTool(ICompositionTool tool) => CurrentTool = tool; + private void setCompositionTool(HitObjectCompositionTool tool) + { + placementContainer.Clear(true); + + if (tool != null) + { + var mask = tool.CreatePlacementMask(); + mask.PlacementFinished += h => + { + rulesetContainer.AddHitObject(h); + + // Re-construct the mask + setCompositionTool(tool); + }; + + placementContainer.Child = mask; + } + } protected abstract EditRulesetContainer CreateRulesetContainer(Ruleset ruleset, WorkingBeatmap beatmap); - protected abstract IReadOnlyList CompositionTools { get; } + protected abstract IReadOnlyList CompositionTools { get; } /// /// Creates a for a specific . diff --git a/osu.Game/Rulesets/Edit/PlacementMask.cs b/osu.Game/Rulesets/Edit/PlacementMask.cs new file mode 100644 index 0000000000..7742448b1d --- /dev/null +++ b/osu.Game/Rulesets/Edit/PlacementMask.cs @@ -0,0 +1,71 @@ +// Copyright (c) 2007-2018 ppy Pty Ltd . +// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE + +using System; +using osu.Framework.Allocation; +using osu.Framework.Graphics.Containers; +using osu.Framework.Input; +using osu.Framework.Input.Events; +using osu.Game.Beatmaps; +using osu.Game.Rulesets.Objects; +using OpenTK; + +namespace osu.Game.Rulesets.Edit +{ + public class PlacementMask : CompositeDrawable, IRequireHighFrequencyMousePosition + { + /// + /// Invoked when the placement of has finished. + /// + public event Action PlacementFinished; + + /// + /// The that is being placed. + /// + protected readonly HitObject HitObject; + + public PlacementMask(HitObject hitObject) + { + HitObject = hitObject; + } + + [BackgroundDependencyLoader] + private void load(IBindableBeatmap workingBeatmap) + { + HitObject.ApplyDefaults(workingBeatmap.Value.Beatmap.ControlPointInfo, workingBeatmap.Value.Beatmap.BeatmapInfo.BaseDifficulty); + } + + /// + /// Finishes the placement of . + /// + public void Finish() => PlacementFinished?.Invoke(HitObject); + + public override bool ReceivePositionalInputAt(Vector2 screenSpacePos) => Parent?.ReceivePositionalInputAt(screenSpacePos) ?? false; + + protected override bool Handle(UIEvent e) + { + base.Handle(e); + + switch (e) + { + case MouseEvent _: + return true; + default: + return false; + } + } + + protected override bool OnMouseMove(MouseMoveEvent e) + { + Position = e.MousePosition; + return true; + } + + protected override void Dispose(bool isDisposing) + { + base.Dispose(isDisposing); + + PlacementFinished = null; + } + } +} diff --git a/osu.Game/Rulesets/Edit/Tools/HitObjectCompositionTool.cs b/osu.Game/Rulesets/Edit/Tools/HitObjectCompositionTool.cs index 78ad236e74..c5d64e3d4d 100644 --- a/osu.Game/Rulesets/Edit/Tools/HitObjectCompositionTool.cs +++ b/osu.Game/Rulesets/Edit/Tools/HitObjectCompositionTool.cs @@ -1,23 +1,17 @@ // Copyright (c) 2007-2018 ppy Pty Ltd . // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE -using osu.Game.Rulesets.Objects; - namespace osu.Game.Rulesets.Edit.Tools { - public class HitObjectCompositionTool : ICompositionTool - where T : HitObject + public abstract class HitObjectCompositionTool { - public string Name { get; } + public readonly string Name; - public HitObjectCompositionTool() - : this(typeof(T).Name) - { - } - - public HitObjectCompositionTool(string name) + protected HitObjectCompositionTool(string name) { Name = name; } + + public abstract PlacementMask CreatePlacementMask(); } } diff --git a/osu.Game/Rulesets/Edit/Tools/ICompositionTool.cs b/osu.Game/Rulesets/Edit/Tools/ICompositionTool.cs deleted file mode 100644 index ce8b139b43..0000000000 --- a/osu.Game/Rulesets/Edit/Tools/ICompositionTool.cs +++ /dev/null @@ -1,10 +0,0 @@ -// Copyright (c) 2007-2018 ppy Pty Ltd . -// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE - -namespace osu.Game.Rulesets.Edit.Tools -{ - public interface ICompositionTool - { - string Name { get; } - } -} From 34ed60830c6bf7f4538797237fcf5e361be1132e Mon Sep 17 00:00:00 2001 From: smoogipoo Date: Wed, 3 Oct 2018 16:44:37 +0900 Subject: [PATCH 196/417] Keep the placement hitobject time up-to-date --- osu.Game/Rulesets/Edit/PlacementMask.cs | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/osu.Game/Rulesets/Edit/PlacementMask.cs b/osu.Game/Rulesets/Edit/PlacementMask.cs index 7742448b1d..f68e5a829c 100644 --- a/osu.Game/Rulesets/Edit/PlacementMask.cs +++ b/osu.Game/Rulesets/Edit/PlacementMask.cs @@ -6,6 +6,7 @@ using osu.Framework.Allocation; using osu.Framework.Graphics.Containers; using osu.Framework.Input; using osu.Framework.Input.Events; +using osu.Framework.Timing; using osu.Game.Beatmaps; using osu.Game.Rulesets.Objects; using OpenTK; @@ -24,14 +25,18 @@ namespace osu.Game.Rulesets.Edit /// protected readonly HitObject HitObject; + private IAdjustableClock clock; + public PlacementMask(HitObject hitObject) { HitObject = hitObject; } [BackgroundDependencyLoader] - private void load(IBindableBeatmap workingBeatmap) + private void load(IBindableBeatmap workingBeatmap, IAdjustableClock clock) { + this.clock = clock; + HitObject.ApplyDefaults(workingBeatmap.Value.Beatmap.ControlPointInfo, workingBeatmap.Value.Beatmap.BeatmapInfo.BaseDifficulty); } @@ -40,6 +45,13 @@ namespace osu.Game.Rulesets.Edit /// public void Finish() => PlacementFinished?.Invoke(HitObject); + protected override void Update() + { + base.Update(); + + HitObject.StartTime = clock.CurrentTime; + } + public override bool ReceivePositionalInputAt(Vector2 screenSpacePos) => Parent?.ReceivePositionalInputAt(screenSpacePos) ?? false; protected override bool Handle(UIEvent e) From 934b687965d966107bf2aa20658f7ffda4d16ea6 Mon Sep 17 00:00:00 2001 From: smoogipoo Date: Wed, 3 Oct 2018 16:49:59 +0900 Subject: [PATCH 197/417] Fix selection masks not being added for new objects --- osu.Game/Rulesets/Edit/EditRulesetContainer.cs | 11 ++++++++--- osu.Game/Rulesets/Edit/HitObjectComposer.cs | 7 +++++-- .../Edit/Screens/Compose/Layers/HitObjectMaskLayer.cs | 4 ++-- 3 files changed, 15 insertions(+), 7 deletions(-) diff --git a/osu.Game/Rulesets/Edit/EditRulesetContainer.cs b/osu.Game/Rulesets/Edit/EditRulesetContainer.cs index 98783b366e..41f17337de 100644 --- a/osu.Game/Rulesets/Edit/EditRulesetContainer.cs +++ b/osu.Game/Rulesets/Edit/EditRulesetContainer.cs @@ -5,6 +5,7 @@ using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Game.Beatmaps; using osu.Game.Rulesets.Objects; +using osu.Game.Rulesets.Objects.Drawables; using osu.Game.Rulesets.UI; namespace osu.Game.Rulesets.Edit @@ -20,7 +21,7 @@ namespace osu.Game.Rulesets.Edit RelativeSizeAxes = Axes.Both; } - public abstract void AddHitObject(HitObject hitObject); + public abstract DrawableHitObject AddHitObject(HitObject hitObject); } public abstract class EditRulesetContainer : EditRulesetContainer @@ -40,7 +41,7 @@ namespace osu.Game.Rulesets.Edit InternalChild = rulesetContainer = CreateRulesetContainer(ruleset, workingBeatmap); } - public override void AddHitObject(HitObject hitObject) + public override DrawableHitObject AddHitObject(HitObject hitObject) { var tObject = (TObject)hitObject; @@ -54,8 +55,12 @@ namespace osu.Game.Rulesets.Edit tObject.ApplyDefaults(beatmap.ControlPointInfo, beatmap.BeatmapInfo.BaseDifficulty); processor.PostProcess(); - rulesetContainer.Playfield.Add(rulesetContainer.GetVisualRepresentation(tObject)); + var drawableObject = rulesetContainer.GetVisualRepresentation(tObject); + + rulesetContainer.Playfield.Add(drawableObject); rulesetContainer.Playfield.PostProcess(); + + return drawableObject; } /// diff --git a/osu.Game/Rulesets/Edit/HitObjectComposer.cs b/osu.Game/Rulesets/Edit/HitObjectComposer.cs index 5f84006a1e..5bb3299038 100644 --- a/osu.Game/Rulesets/Edit/HitObjectComposer.cs +++ b/osu.Game/Rulesets/Edit/HitObjectComposer.cs @@ -31,6 +31,7 @@ namespace osu.Game.Rulesets.Edit private readonly List layerContainers = new List(); private readonly IBindable beatmap = new Bindable(); + private HitObjectMaskLayer maskLayer; private Container placementContainer; private EditRulesetContainer rulesetContainer; @@ -66,7 +67,7 @@ namespace osu.Game.Rulesets.Edit var layerAboveRuleset = CreateLayerContainer(); layerAboveRuleset.Children = new Drawable[] { - new HitObjectMaskLayer(), + maskLayer = new HitObjectMaskLayer(), placementContainer = new Container { RelativeSizeAxes = Axes.Both } }; @@ -157,7 +158,9 @@ namespace osu.Game.Rulesets.Edit var mask = tool.CreatePlacementMask(); mask.PlacementFinished += h => { - rulesetContainer.AddHitObject(h); + var drawableObject = rulesetContainer.AddHitObject(h); + + maskLayer.AddMask(drawableObject); // Re-construct the mask setCompositionTool(tool); diff --git a/osu.Game/Screens/Edit/Screens/Compose/Layers/HitObjectMaskLayer.cs b/osu.Game/Screens/Edit/Screens/Compose/Layers/HitObjectMaskLayer.cs index 65f31dd56d..7a1ad32140 100644 --- a/osu.Game/Screens/Edit/Screens/Compose/Layers/HitObjectMaskLayer.cs +++ b/osu.Game/Screens/Edit/Screens/Compose/Layers/HitObjectMaskLayer.cs @@ -48,7 +48,7 @@ namespace osu.Game.Screens.Edit.Screens.Compose.Layers }; foreach (var obj in composer.HitObjects) - addMask(obj); + AddMask(obj); } protected override bool OnMouseDown(MouseDownEvent e) @@ -61,7 +61,7 @@ namespace osu.Game.Screens.Edit.Screens.Compose.Layers /// Adds a mask for a which adds movement support. /// /// The to create a mask for. - private void addMask(DrawableHitObject hitObject) + public void AddMask(DrawableHitObject hitObject) { var mask = composer.CreateMaskFor(hitObject); if (mask == null) From 7809ce9361ed0f8c59c5ed3bce8d6046429da642 Mon Sep 17 00:00:00 2001 From: smoogipoo Date: Wed, 3 Oct 2018 17:05:22 +0900 Subject: [PATCH 198/417] Fix 1-frame position discrepancy --- osu.Game/Rulesets/Edit/PlacementMask.cs | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/osu.Game/Rulesets/Edit/PlacementMask.cs b/osu.Game/Rulesets/Edit/PlacementMask.cs index f68e5a829c..bfeb0c17fd 100644 --- a/osu.Game/Rulesets/Edit/PlacementMask.cs +++ b/osu.Game/Rulesets/Edit/PlacementMask.cs @@ -40,6 +40,14 @@ namespace osu.Game.Rulesets.Edit HitObject.ApplyDefaults(workingBeatmap.Value.Beatmap.ControlPointInfo, workingBeatmap.Value.Beatmap.BeatmapInfo.BaseDifficulty); } + protected override void LoadComplete() + { + base.LoadComplete(); + + // Fixes a 1-frame position discrpancy due to the first mouse move event happening in the next frame + Position = GetContainingInputManager().CurrentState.Mouse.Position; + } + /// /// Finishes the placement of . /// From 1cd11a6e5b78d8891e16d6cd98da290de3608239 Mon Sep 17 00:00:00 2001 From: smoogipoo Date: Wed, 3 Oct 2018 17:06:18 +0900 Subject: [PATCH 199/417] Fix StackHeight changes not causing position updates --- .../Objects/Drawables/DrawableHitCircle.cs | 1 + osu.Game.Rulesets.Osu/Objects/OsuHitObject.cs | 16 +++++++++++++++- 2 files changed, 16 insertions(+), 1 deletion(-) diff --git a/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableHitCircle.cs b/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableHitCircle.cs index 4bdddcef11..8b0973e3d3 100644 --- a/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableHitCircle.cs +++ b/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableHitCircle.cs @@ -61,6 +61,7 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables Size = circle.DrawSize; HitObject.PositionChanged += _ => Position = HitObject.StackedPosition; + HitObject.StackHeightChanged += _ => Position = HitObject.StackedPosition; } public override Color4 AccentColour diff --git a/osu.Game.Rulesets.Osu/Objects/OsuHitObject.cs b/osu.Game.Rulesets.Osu/Objects/OsuHitObject.cs index fdf5aaffa8..ab8f01f5d3 100644 --- a/osu.Game.Rulesets.Osu/Objects/OsuHitObject.cs +++ b/osu.Game.Rulesets.Osu/Objects/OsuHitObject.cs @@ -16,6 +16,7 @@ namespace osu.Game.Rulesets.Osu.Objects public const double OBJECT_RADIUS = 64; public event Action PositionChanged; + public event Action StackHeightChanged; public double TimePreempt = 600; public double TimeFadeIn = 400; @@ -44,7 +45,20 @@ namespace osu.Game.Rulesets.Osu.Objects public Vector2 StackedEndPosition => EndPosition + StackOffset; - public virtual int StackHeight { get; set; } + private int stackHeight; + + public int StackHeight + { + get => stackHeight; + set + { + if (stackHeight == value) + return; + stackHeight = value; + + StackHeightChanged?.Invoke(value); + } + } public Vector2 StackOffset => new Vector2(StackHeight * Scale * -6.4f); From 593dee202c9d3ed492e1817121b4b01edfb5e576 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Thu, 4 Oct 2018 03:03:59 +0900 Subject: [PATCH 200/417] Fix gameplay mouse button disable setting no longer having any effect Regressed at https://github.com/ppy/osu/commit/50091252e272564807e046b699d6619382a44891#diff-20562da8cde558aacafa9540b97b7975 --- osu.Game/Rulesets/UI/RulesetInputManager.cs | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/osu.Game/Rulesets/UI/RulesetInputManager.cs b/osu.Game/Rulesets/UI/RulesetInputManager.cs index b0c75a4990..64bbb8b52b 100644 --- a/osu.Game/Rulesets/UI/RulesetInputManager.cs +++ b/osu.Game/Rulesets/UI/RulesetInputManager.cs @@ -73,12 +73,10 @@ namespace osu.Game.Rulesets.UI #region IHasReplayHandler private ReplayInputHandler replayInputHandler; + public ReplayInputHandler ReplayInputHandler { - get - { - return replayInputHandler; - } + get => replayInputHandler; set { if (replayInputHandler != null) RemoveHandler(replayInputHandler); @@ -220,6 +218,13 @@ namespace osu.Game.Rulesets.UI return base.OnMouseUp(e); } + protected override bool Handle(UIEvent e) + { + if (mouseDisabled.Value && e is MouseDownEvent me && (me.Button == MouseButton.Left || me.Button == MouseButton.Right)) return false; + + return base.Handle(e); + } + #endregion #region Key Counter Attachment @@ -269,7 +274,7 @@ namespace osu.Game.Rulesets.UI } public class RulesetInputManagerInputState : InputState - where T : struct + where T : struct { public ReplayState LastReplayState; From 6a658025282aa4d52360ec75858fa966b5e46a23 Mon Sep 17 00:00:00 2001 From: smoogipoo Date: Thu, 4 Oct 2018 12:19:11 +0900 Subject: [PATCH 201/417] Fix hitcircle selections not responding to stacking changes --- osu.Game.Rulesets.Osu/Edit/Masks/HitCircleSelectionMask.cs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/osu.Game.Rulesets.Osu/Edit/Masks/HitCircleSelectionMask.cs b/osu.Game.Rulesets.Osu/Edit/Masks/HitCircleSelectionMask.cs index b9ca95b837..f4e4bb2145 100644 --- a/osu.Game.Rulesets.Osu/Edit/Masks/HitCircleSelectionMask.cs +++ b/osu.Game.Rulesets.Osu/Edit/Masks/HitCircleSelectionMask.cs @@ -19,7 +19,8 @@ namespace osu.Game.Rulesets.Osu.Edit.Masks InternalChild = new HitCircleMask((HitCircle)hitCircle.HitObject); - hitCircle.HitObject.PositionChanged += _ => Position = hitCircle.Position; + hitCircle.HitObject.PositionChanged += _ => Position = hitCircle.HitObject.StackedPosition; + hitCircle.HitObject.StackHeightChanged += _ => Position = hitCircle.HitObject.StackedPosition; } } } From e931aa3d9e0ee346e87f62715a199980e6c02401 Mon Sep 17 00:00:00 2001 From: smoogipoo Date: Thu, 4 Oct 2018 13:43:50 +0900 Subject: [PATCH 202/417] Move positional modifications to HitCirclePlacementMask --- .../Edit/Masks/HitCirclePlacementMask.cs | 13 +++++++++++-- osu.Game.Tests/Visual/TestCaseHitObjectComposer.cs | 6 +++++- osu.Game/Rulesets/Edit/PlacementMask.cs | 14 -------------- 3 files changed, 16 insertions(+), 17 deletions(-) diff --git a/osu.Game.Rulesets.Osu/Edit/Masks/HitCirclePlacementMask.cs b/osu.Game.Rulesets.Osu/Edit/Masks/HitCirclePlacementMask.cs index 33de02af05..9082f40445 100644 --- a/osu.Game.Rulesets.Osu/Edit/Masks/HitCirclePlacementMask.cs +++ b/osu.Game.Rulesets.Osu/Edit/Masks/HitCirclePlacementMask.cs @@ -21,16 +21,25 @@ namespace osu.Game.Rulesets.Osu.Edit.Masks InternalChild = new HitCircleMask(HitObject); } + protected override void LoadComplete() + { + base.LoadComplete(); + + // Fixes a 1-frame position discrpancy due to the first mouse move event happening in the next frame + Position = GetContainingInputManager().CurrentState.Mouse.Position; + } + protected override bool OnClick(ClickEvent e) { + HitObject.Position = e.MousePosition; Finish(); return true; } protected override bool OnMouseMove(MouseMoveEvent e) { - HitObject.Position = e.MousePosition; - return base.OnMouseMove(e); + Position = e.MousePosition; + return true; } } } diff --git a/osu.Game.Tests/Visual/TestCaseHitObjectComposer.cs b/osu.Game.Tests/Visual/TestCaseHitObjectComposer.cs index 55dc0c4eb0..d6e59587a4 100644 --- a/osu.Game.Tests/Visual/TestCaseHitObjectComposer.cs +++ b/osu.Game.Tests/Visual/TestCaseHitObjectComposer.cs @@ -13,6 +13,7 @@ using osu.Game.Rulesets.Edit; using osu.Game.Rulesets.Objects; using osu.Game.Rulesets.Osu; using osu.Game.Rulesets.Osu.Edit; +using osu.Game.Rulesets.Osu.Edit.Masks; using osu.Game.Rulesets.Osu.Objects; using osu.Game.Screens.Edit.Screens.Compose.Layers; using osu.Game.Tests.Beatmaps; @@ -29,7 +30,10 @@ namespace osu.Game.Tests.Visual typeof(HitObjectComposer), typeof(OsuHitObjectComposer), typeof(HitObjectMaskLayer), - typeof(NotNullAttribute) + typeof(NotNullAttribute), + typeof(HitCircleMask), + typeof(HitCircleSelectionMask), + typeof(HitCirclePlacementMask), }; [BackgroundDependencyLoader] diff --git a/osu.Game/Rulesets/Edit/PlacementMask.cs b/osu.Game/Rulesets/Edit/PlacementMask.cs index bfeb0c17fd..3cee09a8ee 100644 --- a/osu.Game/Rulesets/Edit/PlacementMask.cs +++ b/osu.Game/Rulesets/Edit/PlacementMask.cs @@ -40,14 +40,6 @@ namespace osu.Game.Rulesets.Edit HitObject.ApplyDefaults(workingBeatmap.Value.Beatmap.ControlPointInfo, workingBeatmap.Value.Beatmap.BeatmapInfo.BaseDifficulty); } - protected override void LoadComplete() - { - base.LoadComplete(); - - // Fixes a 1-frame position discrpancy due to the first mouse move event happening in the next frame - Position = GetContainingInputManager().CurrentState.Mouse.Position; - } - /// /// Finishes the placement of . /// @@ -75,12 +67,6 @@ namespace osu.Game.Rulesets.Edit } } - protected override bool OnMouseMove(MouseMoveEvent e) - { - Position = e.MousePosition; - return true; - } - protected override void Dispose(bool isDisposing) { base.Dispose(isDisposing); From b9d0fc927b54a3bb801dc8a600a3ce443b85c61a Mon Sep 17 00:00:00 2001 From: ekrctb Date: Thu, 4 Oct 2018 17:55:31 +0900 Subject: [PATCH 203/417] Remove duplicated code --- osu.Game/Rulesets/UI/RulesetInputManager.cs | 25 +++++++++------------ 1 file changed, 11 insertions(+), 14 deletions(-) diff --git a/osu.Game/Rulesets/UI/RulesetInputManager.cs b/osu.Game/Rulesets/UI/RulesetInputManager.cs index 64bbb8b52b..340833c090 100644 --- a/osu.Game/Rulesets/UI/RulesetInputManager.cs +++ b/osu.Game/Rulesets/UI/RulesetInputManager.cs @@ -206,22 +206,19 @@ namespace osu.Game.Rulesets.UI mouseDisabled = config.GetBindable(OsuSetting.MouseDisableButtons); } - protected override bool OnMouseDown(MouseDownEvent e) - { - if (mouseDisabled.Value && (e.Button == MouseButton.Left || e.Button == MouseButton.Right)) return false; - return base.OnMouseDown(e); - } - - protected override bool OnMouseUp(MouseUpEvent e) - { - if (!CurrentState.Mouse.IsPressed(e.Button)) return false; - return base.OnMouseUp(e); - } - protected override bool Handle(UIEvent e) { - if (mouseDisabled.Value && e is MouseDownEvent me && (me.Button == MouseButton.Left || me.Button == MouseButton.Right)) return false; - + switch (e) + { + case MouseDownEvent mouseDown when mouseDown.Button == MouseButton.Left || mouseDown.Button == MouseButton.Right: + if (mouseDisabled.Value) + return false; + break; + case MouseUpEvent mouseUp: + if (!CurrentState.Mouse.IsPressed(mouseUp.Button)) + return false; + break; + } return base.Handle(e); } From 716eee9a5cdc3738fe4e4758b89ba1547abede73 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Fri, 5 Oct 2018 00:25:40 +0900 Subject: [PATCH 204/417] Fix last visit not supporting null values Can now be null if a user chooses to hide their online status --- osu.Game/Overlays/Profile/ProfileHeader.cs | 11 +++++++---- osu.Game/Users/User.cs | 2 +- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/osu.Game/Overlays/Profile/ProfileHeader.cs b/osu.Game/Overlays/Profile/ProfileHeader.cs index 9d09836d25..4839348e0e 100644 --- a/osu.Game/Overlays/Profile/ProfileHeader.cs +++ b/osu.Game/Overlays/Profile/ProfileHeader.cs @@ -386,10 +386,13 @@ namespace osu.Game.Overlays.Profile infoTextLeft.AddText(new DrawableJoinDate(user.JoinDate), boldItalic); } - infoTextLeft.NewLine(); - infoTextLeft.AddText("Last seen ", lightText); - infoTextLeft.AddText(new DrawableDate(user.LastVisit), boldItalic); - infoTextLeft.NewParagraph(); + if (user.LastVisit.HasValue) + { + infoTextLeft.NewLine(); + infoTextLeft.AddText("Last seen ", lightText); + infoTextLeft.AddText(new DrawableDate(user.LastVisit.Value), boldItalic); + infoTextLeft.NewParagraph(); + } if (user.PlayStyle?.Length > 0) { diff --git a/osu.Game/Users/User.cs b/osu.Game/Users/User.cs index 353bae286f..a5d8c03a67 100644 --- a/osu.Game/Users/User.cs +++ b/osu.Game/Users/User.cs @@ -84,7 +84,7 @@ namespace osu.Game.Users public string Location; [JsonProperty(@"last_visit")] - public DateTimeOffset LastVisit; + public DateTimeOffset? LastVisit; [JsonProperty(@"twitter")] public string Twitter; From 0724b47334e2e51558b23fbcb3f65cbee13e5243 Mon Sep 17 00:00:00 2001 From: miterosan Date: Thu, 4 Oct 2018 18:57:14 +0200 Subject: [PATCH 205/417] Minify the buildscript and update to cake.0.30.0 Also remove the dependency on Cake.CoreCLR cake.tool does not use the packages.config. --- .gitignore | 3 +-- build.ps1 | 17 +++++++++-------- tools/cake.csproj | 9 --------- tools/cakebuild.csproj | 11 +++++++++++ tools/packages.config | 4 ---- 5 files changed, 21 insertions(+), 23 deletions(-) delete mode 100644 tools/cake.csproj create mode 100644 tools/cakebuild.csproj delete mode 100644 tools/packages.config diff --git a/.gitignore b/.gitignore index c75c19f9f5..8f011deabe 100644 --- a/.gitignore +++ b/.gitignore @@ -12,8 +12,7 @@ ### Cake ### tools/* -!tools/packages.config -!tools/cake.csproj +!tools/cakebuild.csproj # Build results bin/[Dd]ebug/ diff --git a/build.ps1 b/build.ps1 index e923331793..64303e67d5 100644 --- a/build.ps1 +++ b/build.ps1 @@ -1,7 +1,5 @@ ########################################################################## -# This is the Cake bootstrapper script for PowerShell. -# This file was downloaded from https://github.com/cake-build/resources -# Feel free to change this file to fit your needs. +# This is a customized Cake bootstrapper script for PowerShell. ########################################################################## <# @@ -10,7 +8,7 @@ This is a Powershell script to bootstrap a Cake build. .DESCRIPTION -This Powershell script will download NuGet if missing, restore NuGet tools (including Cake) +This Powershell script restores NuGet tools (including Cake) and execute your Cake build script with the parameters you provide. .PARAMETER Script @@ -49,17 +47,21 @@ Param( Write-Host "Preparing to run build script..." +# Determine the script root for resolving other paths. if(!$PSScriptRoot){ $PSScriptRoot = Split-Path $MyInvocation.MyCommand.Path -Parent } +# Resolve the paths for resources used for debugging. $TOOLS_DIR = Join-Path $PSScriptRoot "tools" -$CAKE_CSPROJ = Join-Path $TOOLS_DIR "cake.csproj" +$CAKE_CSPROJ = Join-Path $TOOLS_DIR "cakebootstrap.csproj" -Invoke-Expression "dotnet restore `"$CAKE_CSPROJ`" --packages `"$TOOLS_DIR`"" +# Install the required tools locally. +Write-Host "Restoring cake tools..." +Invoke-Expression "dotnet restore `"$CAKE_CSPROJ`" --packages `"$TOOLS_DIR`"" | Out-Null # Find the Cake executable -$CAKE_EXECUTABLE = (Get-ChildItem -Path ./tools/cake.coreclr/ -Filter Cake.dll -Recurse).FullName +$CAKE_EXECUTABLE = (Get-ChildItem -Path ./tools/cake.tool/ -Filter Cake.dll -Recurse).FullName # Build Cake arguments $cakeArguments = @("$Script"); @@ -69,7 +71,6 @@ if ($Verbosity) { $cakeArguments += "-verbosity=$Verbosity" } if ($ShowDescription) { $cakeArguments += "-showdescription" } if ($DryRun) { $cakeArguments += "-dryrun" } if ($Experimental) { $cakeArguments += "-experimental" } -if ($Mono) { $cakeArguments += "-mono" } $cakeArguments += $ScriptArgs # Start Cake diff --git a/tools/cake.csproj b/tools/cake.csproj deleted file mode 100644 index 06692627d2..0000000000 --- a/tools/cake.csproj +++ /dev/null @@ -1,9 +0,0 @@ - - - Exe - netcoreapp2.0 - - - - - \ No newline at end of file diff --git a/tools/cakebuild.csproj b/tools/cakebuild.csproj new file mode 100644 index 0000000000..eaa25ccb24 --- /dev/null +++ b/tools/cakebuild.csproj @@ -0,0 +1,11 @@ + + + Exe + true + netcoreapp2.0 + + + + + + \ No newline at end of file diff --git a/tools/packages.config b/tools/packages.config deleted file mode 100644 index e37e9304d5..0000000000 --- a/tools/packages.config +++ /dev/null @@ -1,4 +0,0 @@ - - - - From 5abe3a0233a7cb1c84ddd03f8a3f73db2b1bd207 Mon Sep 17 00:00:00 2001 From: miterosan Date: Thu, 4 Oct 2018 19:02:59 +0200 Subject: [PATCH 206/417] Also rename the cake project in the bootstrap script --- build.ps1 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build.ps1 b/build.ps1 index 64303e67d5..624a6e5de4 100644 --- a/build.ps1 +++ b/build.ps1 @@ -54,7 +54,7 @@ if(!$PSScriptRoot){ # Resolve the paths for resources used for debugging. $TOOLS_DIR = Join-Path $PSScriptRoot "tools" -$CAKE_CSPROJ = Join-Path $TOOLS_DIR "cakebootstrap.csproj" +$CAKE_CSPROJ = Join-Path $TOOLS_DIR "cakebuild.csproj" # Install the required tools locally. Write-Host "Restoring cake tools..." From d0007c047a9d296da0cc4d47eebfdb2aac5529f3 Mon Sep 17 00:00:00 2001 From: smoogipoo Date: Fri, 5 Oct 2018 10:39:18 +0900 Subject: [PATCH 207/417] PlayfieldLayer -> PlayfieldAdjustmentContainer --- osu.Game.Rulesets.Catch/UI/CatchPlayfield.cs | 2 +- .../UI/{PlayfieldLayer.cs => PlayfieldAdjustmentContainer.cs} | 4 ++-- osu.Game.Rulesets.Osu/Edit/OsuHitObjectComposer.cs | 2 +- osu.Game.Rulesets.Osu/UI/OsuPlayfield.cs | 2 +- .../UI/{PlayfieldLayer.cs => PlayfieldAdjustmentContainer.cs} | 4 ++-- .../UI/{PlayfieldLayer.cs => PlayfieldAdjustmentContainer.cs} | 2 +- osu.Game.Rulesets.Taiko/UI/TaikoPlayfield.cs | 2 +- 7 files changed, 9 insertions(+), 9 deletions(-) rename osu.Game.Rulesets.Catch/UI/{PlayfieldLayer.cs => PlayfieldAdjustmentContainer.cs} (92%) rename osu.Game.Rulesets.Osu/UI/{PlayfieldLayer.cs => PlayfieldAdjustmentContainer.cs} (92%) rename osu.Game.Rulesets.Taiko/UI/{PlayfieldLayer.cs => PlayfieldAdjustmentContainer.cs} (92%) diff --git a/osu.Game.Rulesets.Catch/UI/CatchPlayfield.cs b/osu.Game.Rulesets.Catch/UI/CatchPlayfield.cs index b90b90f45a..386c8d71c7 100644 --- a/osu.Game.Rulesets.Catch/UI/CatchPlayfield.cs +++ b/osu.Game.Rulesets.Catch/UI/CatchPlayfield.cs @@ -33,7 +33,7 @@ namespace osu.Game.Rulesets.Catch.UI Size = new Vector2(0.86f); // matches stable's vertical offset for catcher plate - InternalChild = new PlayfieldLayer + InternalChild = new PlayfieldAdjustmentContainer { RelativeSizeAxes = Axes.Both, Children = new Drawable[] diff --git a/osu.Game.Rulesets.Catch/UI/PlayfieldLayer.cs b/osu.Game.Rulesets.Catch/UI/PlayfieldAdjustmentContainer.cs similarity index 92% rename from osu.Game.Rulesets.Catch/UI/PlayfieldLayer.cs rename to osu.Game.Rulesets.Catch/UI/PlayfieldAdjustmentContainer.cs index d167dc59cc..ad0073ff12 100644 --- a/osu.Game.Rulesets.Catch/UI/PlayfieldLayer.cs +++ b/osu.Game.Rulesets.Catch/UI/PlayfieldAdjustmentContainer.cs @@ -7,12 +7,12 @@ using OpenTK; namespace osu.Game.Rulesets.Catch.UI { - public class PlayfieldLayer : Container + public class PlayfieldAdjustmentContainer : Container { protected override Container Content => content; private readonly Container content; - public PlayfieldLayer() + public PlayfieldAdjustmentContainer() { InternalChild = new Container { diff --git a/osu.Game.Rulesets.Osu/Edit/OsuHitObjectComposer.cs b/osu.Game.Rulesets.Osu/Edit/OsuHitObjectComposer.cs index ad92ea15d4..d6972d55d2 100644 --- a/osu.Game.Rulesets.Osu/Edit/OsuHitObjectComposer.cs +++ b/osu.Game.Rulesets.Osu/Edit/OsuHitObjectComposer.cs @@ -32,7 +32,7 @@ namespace osu.Game.Rulesets.Osu.Edit new HitObjectCompositionTool() }; - protected override Container CreateLayerContainer() => new PlayfieldLayer { RelativeSizeAxes = Axes.Both }; + protected override Container CreateLayerContainer() => new PlayfieldAdjustmentContainer { RelativeSizeAxes = Axes.Both }; public override HitObjectMask CreateMaskFor(DrawableHitObject hitObject) { diff --git a/osu.Game.Rulesets.Osu/UI/OsuPlayfield.cs b/osu.Game.Rulesets.Osu/UI/OsuPlayfield.cs index ae8dc7397d..47a38dccb3 100644 --- a/osu.Game.Rulesets.Osu/UI/OsuPlayfield.cs +++ b/osu.Game.Rulesets.Osu/UI/OsuPlayfield.cs @@ -29,7 +29,7 @@ namespace osu.Game.Rulesets.Osu.UI Size = new Vector2(0.75f); - InternalChild = new PlayfieldLayer + InternalChild = new PlayfieldAdjustmentContainer { RelativeSizeAxes = Axes.Both, Children = new Drawable[] diff --git a/osu.Game.Rulesets.Osu/UI/PlayfieldLayer.cs b/osu.Game.Rulesets.Osu/UI/PlayfieldAdjustmentContainer.cs similarity index 92% rename from osu.Game.Rulesets.Osu/UI/PlayfieldLayer.cs rename to osu.Game.Rulesets.Osu/UI/PlayfieldAdjustmentContainer.cs index a4c84e4905..00d5692fda 100644 --- a/osu.Game.Rulesets.Osu/UI/PlayfieldLayer.cs +++ b/osu.Game.Rulesets.Osu/UI/PlayfieldAdjustmentContainer.cs @@ -7,12 +7,12 @@ using OpenTK; namespace osu.Game.Rulesets.Osu.UI { - public class PlayfieldLayer : Container + public class PlayfieldAdjustmentContainer : Container { protected override Container Content => content; private readonly Container content; - public PlayfieldLayer() + public PlayfieldAdjustmentContainer() { InternalChild = new Container { diff --git a/osu.Game.Rulesets.Taiko/UI/PlayfieldLayer.cs b/osu.Game.Rulesets.Taiko/UI/PlayfieldAdjustmentContainer.cs similarity index 92% rename from osu.Game.Rulesets.Taiko/UI/PlayfieldLayer.cs rename to osu.Game.Rulesets.Taiko/UI/PlayfieldAdjustmentContainer.cs index c4e2f32c92..661a4e135c 100644 --- a/osu.Game.Rulesets.Taiko/UI/PlayfieldLayer.cs +++ b/osu.Game.Rulesets.Taiko/UI/PlayfieldAdjustmentContainer.cs @@ -6,7 +6,7 @@ using OpenTK; namespace osu.Game.Rulesets.Taiko.UI { - public class PlayfieldLayer : Container + public class PlayfieldAdjustmentContainer : Container { private const float default_relative_height = TaikoPlayfield.DEFAULT_HEIGHT / 768; private const float default_aspect = 16f / 9f; diff --git a/osu.Game.Rulesets.Taiko/UI/TaikoPlayfield.cs b/osu.Game.Rulesets.Taiko/UI/TaikoPlayfield.cs index 82ab327993..c6389e3f28 100644 --- a/osu.Game.Rulesets.Taiko/UI/TaikoPlayfield.cs +++ b/osu.Game.Rulesets.Taiko/UI/TaikoPlayfield.cs @@ -58,7 +58,7 @@ namespace osu.Game.Rulesets.Taiko.UI { Direction.Value = ScrollingDirection.Left; - InternalChild = new PlayfieldLayer + InternalChild = new PlayfieldAdjustmentContainer { Anchor = Anchor.CentreLeft, Origin = Anchor.CentreLeft, From cb1703c6e2181cd2ada72d90dba67c874d068887 Mon Sep 17 00:00:00 2001 From: smoogipoo Date: Fri, 5 Oct 2018 11:19:01 +0900 Subject: [PATCH 208/417] Fix colours with alpha components not being parsed --- .../Beatmaps/Formats/LegacyBeatmapDecoderTest.cs | 3 ++- .../Resources/Soleily - Renatus (Gamu) [Insane].osu | 1 + osu.Game/Beatmaps/Formats/LegacyDecoder.cs | 13 +++++++++---- 3 files changed, 12 insertions(+), 5 deletions(-) diff --git a/osu.Game.Tests/Beatmaps/Formats/LegacyBeatmapDecoderTest.cs b/osu.Game.Tests/Beatmaps/Formats/LegacyBeatmapDecoderTest.cs index d3351f86f8..af63a39662 100644 --- a/osu.Game.Tests/Beatmaps/Formats/LegacyBeatmapDecoderTest.cs +++ b/osu.Game.Tests/Beatmaps/Formats/LegacyBeatmapDecoderTest.cs @@ -165,7 +165,7 @@ namespace osu.Game.Tests.Beatmaps.Formats } [Test] - public void TestDecodeBeatmapColors() + public void TestDecodeBeatmapColours() { var decoder = new LegacySkinDecoder(); using (var resStream = Resource.OpenResource("Soleily - Renatus (Gamu) [Insane].osu")) @@ -181,6 +181,7 @@ namespace osu.Game.Tests.Beatmaps.Formats new Color4(128, 255, 128, 255), new Color4(255, 187, 255, 255), new Color4(255, 177, 140, 255), + new Color4(100, 100, 100, 100), }; Assert.AreEqual(expectedColors.Length, comboColors.Count); for (int i = 0; i < expectedColors.Length; i++) diff --git a/osu.Game.Tests/Resources/Soleily - Renatus (Gamu) [Insane].osu b/osu.Game.Tests/Resources/Soleily - Renatus (Gamu) [Insane].osu index 3e44dc0af8..67570ad21b 100644 --- a/osu.Game.Tests/Resources/Soleily - Renatus (Gamu) [Insane].osu +++ b/osu.Game.Tests/Resources/Soleily - Renatus (Gamu) [Insane].osu @@ -101,6 +101,7 @@ Combo3 : 128,255,255 Combo4 : 128,255,128 Combo5 : 255,187,255 Combo6 : 255,177,140 +Combo7 : 100,100,100,100 [HitObjects] 192,168,956,6,0,P|184:128|200:80,1,90,4|0,1:2|0:0,0:0:0:0: diff --git a/osu.Game/Beatmaps/Formats/LegacyDecoder.cs b/osu.Game/Beatmaps/Formats/LegacyDecoder.cs index e9f37e583b..7ac88dfc5b 100644 --- a/osu.Game/Beatmaps/Formats/LegacyDecoder.cs +++ b/osu.Game/Beatmaps/Formats/LegacyDecoder.cs @@ -85,13 +85,18 @@ namespace osu.Game.Beatmaps.Formats string[] split = pair.Value.Split(','); - if (split.Length != 3) - throw new InvalidOperationException($@"Color specified in incorrect format (should be R,G,B): {pair.Value}"); + if (split.Length != 3 && split.Length != 4) + throw new InvalidOperationException($@"Color specified in incorrect format (should be R,G,B or R,G,B,A): {pair.Value}"); - if (!byte.TryParse(split[0], out var r) || !byte.TryParse(split[1], out var g) || !byte.TryParse(split[2], out var b)) + byte a = 255; + + if (!byte.TryParse(split[0], out var r) || !byte.TryParse(split[1], out var g) || !byte.TryParse(split[2], out var b) + || split.Length == 4 && !byte.TryParse(split[3], out a)) + { throw new InvalidOperationException(@"Color must be specified with 8-bit integer components"); + } - Color4 colour = new Color4(r, g, b, 255); + Color4 colour = new Color4(r, g, b, a); if (isCombo) { From 40c17cfa5a504577e1c1c119b4970f76d880c67c Mon Sep 17 00:00:00 2001 From: smoogipoo Date: Fri, 5 Oct 2018 11:55:59 +0900 Subject: [PATCH 209/417] Remove ugly if-statement --- osu.Game/Beatmaps/Formats/LegacyDecoder.cs | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/osu.Game/Beatmaps/Formats/LegacyDecoder.cs b/osu.Game/Beatmaps/Formats/LegacyDecoder.cs index 7ac88dfc5b..222f3589dc 100644 --- a/osu.Game/Beatmaps/Formats/LegacyDecoder.cs +++ b/osu.Game/Beatmaps/Formats/LegacyDecoder.cs @@ -88,16 +88,17 @@ namespace osu.Game.Beatmaps.Formats if (split.Length != 3 && split.Length != 4) throw new InvalidOperationException($@"Color specified in incorrect format (should be R,G,B or R,G,B,A): {pair.Value}"); - byte a = 255; + Color4 colour; - if (!byte.TryParse(split[0], out var r) || !byte.TryParse(split[1], out var g) || !byte.TryParse(split[2], out var b) - || split.Length == 4 && !byte.TryParse(split[3], out a)) + try + { + colour = new Color4(byte.Parse(split[0]), byte.Parse(split[1]), byte.Parse(split[2]), split.Length == 4 ? byte.Parse(split[3]) : 255); + } + catch (Exception e) { throw new InvalidOperationException(@"Color must be specified with 8-bit integer components"); } - Color4 colour = new Color4(r, g, b, a); - if (isCombo) { if (!(output is IHasComboColours tHasComboColours)) return; From 794501cc5a5297dff081c69eaf87e4a3e1a9ce2b Mon Sep 17 00:00:00 2001 From: smoogipoo Date: Fri, 5 Oct 2018 12:06:24 +0900 Subject: [PATCH 210/417] Fix incorrect result of ternary --- osu.Game/Beatmaps/Formats/LegacyDecoder.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu.Game/Beatmaps/Formats/LegacyDecoder.cs b/osu.Game/Beatmaps/Formats/LegacyDecoder.cs index 222f3589dc..a9e1e4c55d 100644 --- a/osu.Game/Beatmaps/Formats/LegacyDecoder.cs +++ b/osu.Game/Beatmaps/Formats/LegacyDecoder.cs @@ -92,7 +92,7 @@ namespace osu.Game.Beatmaps.Formats try { - colour = new Color4(byte.Parse(split[0]), byte.Parse(split[1]), byte.Parse(split[2]), split.Length == 4 ? byte.Parse(split[3]) : 255); + colour = new Color4(byte.Parse(split[0]), byte.Parse(split[1]), byte.Parse(split[2]), split.Length == 4 ? byte.Parse(split[3]) : (byte)255); } catch (Exception e) { From 42664f1c190a065e4f11b3afea5f408ece96d739 Mon Sep 17 00:00:00 2001 From: smoogipoo Date: Fri, 5 Oct 2018 15:45:45 +0900 Subject: [PATCH 211/417] Make SliderBody use the new SmoothPath --- .../Objects/Drawables/Pieces/SliderBody.cs | 120 +++++++++--------- 1 file changed, 60 insertions(+), 60 deletions(-) diff --git a/osu.Game.Rulesets.Osu/Objects/Drawables/Pieces/SliderBody.cs b/osu.Game.Rulesets.Osu/Objects/Drawables/Pieces/SliderBody.cs index f3924ec43b..f4ccf673e9 100644 --- a/osu.Game.Rulesets.Osu/Objects/Drawables/Pieces/SliderBody.cs +++ b/osu.Game.Rulesets.Osu/Objects/Drawables/Pieces/SliderBody.cs @@ -8,26 +8,23 @@ using osu.Framework.Configuration; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Lines; -using osu.Framework.Graphics.Textures; using OpenTK.Graphics.ES30; using OpenTK.Graphics; using osu.Framework.Graphics.Primitives; using osu.Game.Rulesets.Objects.Types; using OpenTK; -using SixLabors.ImageSharp; -using SixLabors.ImageSharp.PixelFormats; namespace osu.Game.Rulesets.Osu.Objects.Drawables.Pieces { public class SliderBody : Container, ISliderProgress { - private readonly Path path; + private readonly SliderPath path; private readonly BufferedContainer container; public float PathWidth { - get { return path.PathWidth; } - set { path.PathWidth = value; } + get => path.PathWidth; + set => path.PathWidth = value; } /// @@ -43,48 +40,40 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables.Pieces public double? SnakedStart { get; private set; } public double? SnakedEnd { get; private set; } - private Color4 accentColour = Color4.White; - /// /// Used to colour the path. /// public Color4 AccentColour { - get { return accentColour; } + get => path.AccentColour; set { - if (accentColour == value) + if (path.AccentColour == value) return; - accentColour = value; + path.AccentColour = value; - if (LoadState >= LoadState.Ready) - reloadTexture(); + container.ForceRedraw(); } } - private Color4 borderColour = Color4.White; - /// /// Used to colour the path border. /// public new Color4 BorderColour { - get { return borderColour; } + get => path.BorderColour; set { - if (borderColour == value) + if (path.BorderColour == value) return; - borderColour = value; + path.BorderColour = value; - if (LoadState >= LoadState.Ready) - reloadTexture(); + container.ForceRedraw(); } } public Quad PathDrawQuad => container.ScreenSpaceDrawQuad; - private int textureWidth => (int)PathWidth * 2; - private Vector2 topLeftOffset; private readonly Slider slider; @@ -101,7 +90,7 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables.Pieces CacheDrawnFrameBuffer = true, Children = new Drawable[] { - path = new Path + path = new SliderPath { Blending = BlendingMode.None, }, @@ -134,46 +123,9 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables.Pieces [BackgroundDependencyLoader] private void load() { - reloadTexture(); computeSize(); } - private void reloadTexture() - { - var texture = new Texture(textureWidth, 1); - - //initialise background - var raw = new Image(textureWidth, 1); - - const float aa_portion = 0.02f; - const float border_portion = 0.128f; - const float gradient_portion = 1 - border_portion; - - const float opacity_at_centre = 0.3f; - const float opacity_at_edge = 0.8f; - - for (int i = 0; i < textureWidth; i++) - { - float progress = (float)i / (textureWidth - 1); - - if (progress <= border_portion) - { - raw[i, 0] = new Rgba32(BorderColour.R, BorderColour.G, BorderColour.B, Math.Min(progress / aa_portion, 1) * BorderColour.A); - } - else - { - progress -= border_portion; - raw[i, 0] = new Rgba32(AccentColour.R, AccentColour.G, AccentColour.B, - (opacity_at_edge - (opacity_at_edge - opacity_at_centre) * progress / gradient_portion) * AccentColour.A); - } - } - - texture.SetData(new TextureUpload(raw)); - path.Texture = texture; - - container.ForceRedraw(); - } - private void computeSize() { // Generate the entire curve @@ -226,5 +178,53 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables.Pieces SetRange(start, end); } + + private class SliderPath : SmoothPath + { + private const float border_portion = 0.128f; + private const float gradient_portion = 1 - border_portion; + + private const float opacity_at_centre = 0.3f; + private const float opacity_at_edge = 0.8f; + + private Color4 borderColour = Color4.White; + + public Color4 BorderColour + { + get => borderColour; + set + { + if (borderColour == value) + return; + borderColour = value; + + InvalidateTexture(); + } + } + + private Color4 accentColour = Color4.White; + + public Color4 AccentColour + { + get => accentColour; + set + { + if (accentColour == value) + return; + accentColour = value; + + InvalidateTexture(); + } + } + + protected override Color4 ColourAt(float position) + { + if (position <= border_portion) + return BorderColour; + + position -= border_portion; + return new Color4(AccentColour.R, AccentColour.G, AccentColour.B, (opacity_at_edge - (opacity_at_edge - opacity_at_centre) * position / gradient_portion) * AccentColour.A); + } + } } } From f7ebd063c39f66a0dd24cc61ad875fddd26f63e6 Mon Sep 17 00:00:00 2001 From: smoogipoo Date: Fri, 5 Oct 2018 15:45:53 +0900 Subject: [PATCH 212/417] Make user profile graph use a smooth path --- osu.Game/Graphics/UserInterface/LineGraph.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu.Game/Graphics/UserInterface/LineGraph.cs b/osu.Game/Graphics/UserInterface/LineGraph.cs index 3cb2446acc..ff2c4cf7cd 100644 --- a/osu.Game/Graphics/UserInterface/LineGraph.cs +++ b/osu.Game/Graphics/UserInterface/LineGraph.cs @@ -69,7 +69,7 @@ namespace osu.Game.Graphics.UserInterface { Masking = true, RelativeSizeAxes = Axes.Both, - Child = path = new Path { RelativeSizeAxes = Axes.Both, PathWidth = 1 } + Child = path = new SmoothPath { RelativeSizeAxes = Axes.Both, PathWidth = 1 } }); } From 8264dd49de638342b182996e7c6761d8831e46ca Mon Sep 17 00:00:00 2001 From: Paul Teng Date: Fri, 5 Oct 2018 07:13:18 -0400 Subject: [PATCH 213/417] Update bindable only if enabled --- osu.Game/Overlays/Toolbar/ToolbarRulesetSelector.cs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/osu.Game/Overlays/Toolbar/ToolbarRulesetSelector.cs b/osu.Game/Overlays/Toolbar/ToolbarRulesetSelector.cs index 7470dd0cd5..c698e9eeb0 100644 --- a/osu.Game/Overlays/Toolbar/ToolbarRulesetSelector.cs +++ b/osu.Game/Overlays/Toolbar/ToolbarRulesetSelector.cs @@ -76,7 +76,10 @@ namespace osu.Game.Overlays.Toolbar modeButtons.Add(new ToolbarRulesetButton { Ruleset = r, - Action = delegate { ruleset.Value = r; } + Action = delegate + { + if (!ruleset.Disabled) ruleset.Value = r; + } }); } From 74e89fd9452069fb293d6fab34d0c5aeded179a3 Mon Sep 17 00:00:00 2001 From: miterosan Date: Fri, 5 Oct 2018 14:54:11 +0200 Subject: [PATCH 214/417] Add config file --- cake.config | 5 +++++ 1 file changed, 5 insertions(+) create mode 100644 cake.config diff --git a/cake.config b/cake.config new file mode 100644 index 0000000000..187d825591 --- /dev/null +++ b/cake.config @@ -0,0 +1,5 @@ + +[Nuget] +Source=https://api.nuget.org/v3/index.json +UseInProcessClient=true +LoadDependencies=true From 6977b2825f46e1a02bc62c073fc23208825813cf Mon Sep 17 00:00:00 2001 From: miterosan Date: Fri, 5 Oct 2018 14:57:09 +0200 Subject: [PATCH 215/417] Use the coreclr instead of caketool, hoping that the version fixes running it on linux --- build.ps1 | 2 +- tools/cakebuild.csproj | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/build.ps1 b/build.ps1 index 624a6e5de4..9968673c90 100644 --- a/build.ps1 +++ b/build.ps1 @@ -61,7 +61,7 @@ Write-Host "Restoring cake tools..." Invoke-Expression "dotnet restore `"$CAKE_CSPROJ`" --packages `"$TOOLS_DIR`"" | Out-Null # Find the Cake executable -$CAKE_EXECUTABLE = (Get-ChildItem -Path ./tools/cake.tool/ -Filter Cake.dll -Recurse).FullName +$CAKE_EXECUTABLE = (Get-ChildItem -Path ./tools/cake.coreclr/ -Filter Cake.dll -Recurse).FullName # Build Cake arguments $cakeArguments = @("$Script"); diff --git a/tools/cakebuild.csproj b/tools/cakebuild.csproj index eaa25ccb24..8ccce35e26 100644 --- a/tools/cakebuild.csproj +++ b/tools/cakebuild.csproj @@ -6,6 +6,6 @@ - + \ No newline at end of file From 8b27741cb0fb83a05766f14aefae59490e3a26b2 Mon Sep 17 00:00:00 2001 From: Paul Teng Date: Fri, 5 Oct 2018 11:37:44 -0400 Subject: [PATCH 216/417] Do not propagate positional input to subtree --- osu.Game/Overlays/Toolbar/ToolbarRulesetSelector.cs | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/osu.Game/Overlays/Toolbar/ToolbarRulesetSelector.cs b/osu.Game/Overlays/Toolbar/ToolbarRulesetSelector.cs index c698e9eeb0..c5b583f390 100644 --- a/osu.Game/Overlays/Toolbar/ToolbarRulesetSelector.cs +++ b/osu.Game/Overlays/Toolbar/ToolbarRulesetSelector.cs @@ -76,10 +76,7 @@ namespace osu.Game.Overlays.Toolbar modeButtons.Add(new ToolbarRulesetButton { Ruleset = r, - Action = delegate - { - if (!ruleset.Disabled) ruleset.Value = r; - } + Action = delegate { ruleset.Value = r; } }); } @@ -108,6 +105,8 @@ namespace osu.Game.Overlays.Toolbar public override bool HandleNonPositionalInput => !ruleset.Disabled && base.HandleNonPositionalInput; public override bool HandlePositionalInput => !ruleset.Disabled && base.HandlePositionalInput; + public override bool PropagatePositionalInputSubTree => false; + private void disabledChanged(bool isDisabled) => this.FadeColour(isDisabled ? Color4.Gray : Color4.White, 300); protected override void Update() From ca9cbf1aead025c873fca0675030ec149cca6cd0 Mon Sep 17 00:00:00 2001 From: Paul Teng Date: Sat, 6 Oct 2018 07:51:56 -0400 Subject: [PATCH 217/417] Fix rulsets being completed unselectable --- osu.Game/Overlays/Toolbar/ToolbarRulesetSelector.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu.Game/Overlays/Toolbar/ToolbarRulesetSelector.cs b/osu.Game/Overlays/Toolbar/ToolbarRulesetSelector.cs index c5b583f390..138f3ffc3f 100644 --- a/osu.Game/Overlays/Toolbar/ToolbarRulesetSelector.cs +++ b/osu.Game/Overlays/Toolbar/ToolbarRulesetSelector.cs @@ -105,7 +105,7 @@ namespace osu.Game.Overlays.Toolbar public override bool HandleNonPositionalInput => !ruleset.Disabled && base.HandleNonPositionalInput; public override bool HandlePositionalInput => !ruleset.Disabled && base.HandlePositionalInput; - public override bool PropagatePositionalInputSubTree => false; + public override bool PropagatePositionalInputSubTree => !ruleset.Disabled; private void disabledChanged(bool isDisabled) => this.FadeColour(isDisabled ? Color4.Gray : Color4.White, 300); From 6b236e3f2a097279f57477f08ef0c486320ac33a Mon Sep 17 00:00:00 2001 From: Paul Teng Date: Sat, 6 Oct 2018 08:06:26 -0400 Subject: [PATCH 218/417] Handle non positional input only when opened --- osu.Game/Graphics/UserInterface/OsuDropdown.cs | 2 ++ 1 file changed, 2 insertions(+) diff --git a/osu.Game/Graphics/UserInterface/OsuDropdown.cs b/osu.Game/Graphics/UserInterface/OsuDropdown.cs index 26caf09b1b..41bdb78a4d 100644 --- a/osu.Game/Graphics/UserInterface/OsuDropdown.cs +++ b/osu.Game/Graphics/UserInterface/OsuDropdown.cs @@ -51,6 +51,8 @@ namespace osu.Game.Graphics.UserInterface #region OsuDropdownMenu protected class OsuDropdownMenu : DropdownMenu, IHasAccentColour { + public override bool HandleNonPositionalInput => this.State == MenuState.Open; + // todo: this uses the same styling as OsuMenu. hopefully we can just use OsuMenu in the future with some refactoring public OsuDropdownMenu() { From aedb6e3bb77c331087632ce34c93c53c0cbfe600 Mon Sep 17 00:00:00 2001 From: Paul Teng Date: Sat, 6 Oct 2018 08:12:29 -0400 Subject: [PATCH 219/417] Remove dedundant this qualifier --- osu.Game/Graphics/UserInterface/OsuDropdown.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu.Game/Graphics/UserInterface/OsuDropdown.cs b/osu.Game/Graphics/UserInterface/OsuDropdown.cs index 41bdb78a4d..04a7cb64d3 100644 --- a/osu.Game/Graphics/UserInterface/OsuDropdown.cs +++ b/osu.Game/Graphics/UserInterface/OsuDropdown.cs @@ -51,7 +51,7 @@ namespace osu.Game.Graphics.UserInterface #region OsuDropdownMenu protected class OsuDropdownMenu : DropdownMenu, IHasAccentColour { - public override bool HandleNonPositionalInput => this.State == MenuState.Open; + public override bool HandleNonPositionalInput => State == MenuState.Open; // todo: this uses the same styling as OsuMenu. hopefully we can just use OsuMenu in the future with some refactoring public OsuDropdownMenu() From db443babb6e9281525c65cda4cf71db065eddbb0 Mon Sep 17 00:00:00 2001 From: HoLLy Date: Sun, 7 Oct 2018 19:15:42 +0200 Subject: [PATCH 220/417] Fix database entries using platform-specific path separator --- osu.Game/Database/ArchiveModelManager.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu.Game/Database/ArchiveModelManager.cs b/osu.Game/Database/ArchiveModelManager.cs index 723bb90e7e..3686b702c4 100644 --- a/osu.Game/Database/ArchiveModelManager.cs +++ b/osu.Game/Database/ArchiveModelManager.cs @@ -404,7 +404,7 @@ namespace osu.Game.Database using (Stream s = reader.GetStream(file)) fileInfos.Add(new TFileModel { - Filename = FileSafety.PathSanitise(file), + Filename = FileSafety.PathStandardise(file), FileInfo = files.Add(s) }); From 97f86193018b9e15bac824a1b737580ab643ab83 Mon Sep 17 00:00:00 2001 From: HoLLy Date: Sun, 7 Oct 2018 21:07:30 +0200 Subject: [PATCH 221/417] Add database migration for standardizing paths --- ...0181007180454_StandardizePaths.Designer.cs | 380 ++++++++++++++++++ .../20181007180454_StandardizePaths.cs | 42 ++ .../Migrations/OsuDbContextModelSnapshot.cs | 2 +- 3 files changed, 423 insertions(+), 1 deletion(-) create mode 100644 osu.Game/Migrations/20181007180454_StandardizePaths.Designer.cs create mode 100644 osu.Game/Migrations/20181007180454_StandardizePaths.cs diff --git a/osu.Game/Migrations/20181007180454_StandardizePaths.Designer.cs b/osu.Game/Migrations/20181007180454_StandardizePaths.Designer.cs new file mode 100644 index 0000000000..b387a45ecf --- /dev/null +++ b/osu.Game/Migrations/20181007180454_StandardizePaths.Designer.cs @@ -0,0 +1,380 @@ +// +using System; +using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore.Infrastructure; +using Microsoft.EntityFrameworkCore.Migrations; +using Microsoft.EntityFrameworkCore.Storage.ValueConversion; +using osu.Game.Database; + +namespace osu.Game.Migrations +{ + [DbContext(typeof(OsuDbContext))] + [Migration("20181007180454_StandardizePaths")] + partial class StandardizePaths + { + protected override void BuildTargetModel(ModelBuilder modelBuilder) + { +#pragma warning disable 612, 618 + modelBuilder + .HasAnnotation("ProductVersion", "2.1.3-rtm-32065"); + + modelBuilder.Entity("osu.Game.Beatmaps.BeatmapDifficulty", b => + { + b.Property("ID") + .ValueGeneratedOnAdd(); + + b.Property("ApproachRate"); + + b.Property("CircleSize"); + + b.Property("DrainRate"); + + b.Property("OverallDifficulty"); + + b.Property("SliderMultiplier"); + + b.Property("SliderTickRate"); + + b.HasKey("ID"); + + b.ToTable("BeatmapDifficulty"); + }); + + modelBuilder.Entity("osu.Game.Beatmaps.BeatmapInfo", b => + { + b.Property("ID") + .ValueGeneratedOnAdd(); + + b.Property("AudioLeadIn"); + + b.Property("BaseDifficultyID"); + + b.Property("BeatDivisor"); + + b.Property("BeatmapSetInfoID"); + + b.Property("Countdown"); + + b.Property("DistanceSpacing"); + + b.Property("GridSize"); + + b.Property("Hash"); + + b.Property("Hidden"); + + b.Property("LetterboxInBreaks"); + + b.Property("MD5Hash"); + + b.Property("MetadataID"); + + b.Property("OnlineBeatmapID"); + + b.Property("Path"); + + b.Property("RulesetID"); + + b.Property("SpecialStyle"); + + b.Property("StackLeniency"); + + b.Property("StarDifficulty"); + + b.Property("Status"); + + b.Property("StoredBookmarks"); + + b.Property("TimelineZoom"); + + b.Property("Version"); + + b.Property("WidescreenStoryboard"); + + b.HasKey("ID"); + + b.HasIndex("BaseDifficultyID"); + + b.HasIndex("BeatmapSetInfoID"); + + b.HasIndex("Hash"); + + b.HasIndex("MD5Hash"); + + b.HasIndex("MetadataID"); + + b.HasIndex("OnlineBeatmapID") + .IsUnique(); + + b.HasIndex("RulesetID"); + + b.ToTable("BeatmapInfo"); + }); + + modelBuilder.Entity("osu.Game.Beatmaps.BeatmapMetadata", b => + { + b.Property("ID") + .ValueGeneratedOnAdd(); + + b.Property("Artist"); + + b.Property("ArtistUnicode"); + + b.Property("AudioFile"); + + b.Property("AuthorString") + .HasColumnName("Author"); + + b.Property("BackgroundFile"); + + b.Property("PreviewTime"); + + b.Property("Source"); + + b.Property("Tags"); + + b.Property("Title"); + + b.Property("TitleUnicode"); + + b.HasKey("ID"); + + b.ToTable("BeatmapMetadata"); + }); + + modelBuilder.Entity("osu.Game.Beatmaps.BeatmapSetFileInfo", b => + { + b.Property("ID") + .ValueGeneratedOnAdd(); + + b.Property("BeatmapSetInfoID"); + + b.Property("FileInfoID"); + + b.Property("Filename") + .IsRequired(); + + b.HasKey("ID"); + + b.HasIndex("BeatmapSetInfoID"); + + b.HasIndex("FileInfoID"); + + b.ToTable("BeatmapSetFileInfo"); + }); + + modelBuilder.Entity("osu.Game.Beatmaps.BeatmapSetInfo", b => + { + b.Property("ID") + .ValueGeneratedOnAdd(); + + b.Property("DeletePending"); + + b.Property("Hash"); + + b.Property("MetadataID"); + + b.Property("OnlineBeatmapSetID"); + + b.Property("Protected"); + + b.Property("Status"); + + b.HasKey("ID"); + + b.HasIndex("DeletePending"); + + b.HasIndex("Hash") + .IsUnique(); + + b.HasIndex("MetadataID"); + + b.HasIndex("OnlineBeatmapSetID") + .IsUnique(); + + b.ToTable("BeatmapSetInfo"); + }); + + modelBuilder.Entity("osu.Game.Configuration.DatabasedSetting", b => + { + b.Property("ID") + .ValueGeneratedOnAdd(); + + b.Property("IntKey") + .HasColumnName("Key"); + + b.Property("RulesetID"); + + b.Property("StringValue") + .HasColumnName("Value"); + + b.Property("Variant"); + + b.HasKey("ID"); + + b.HasIndex("RulesetID", "Variant"); + + b.ToTable("Settings"); + }); + + modelBuilder.Entity("osu.Game.Input.Bindings.DatabasedKeyBinding", b => + { + b.Property("ID") + .ValueGeneratedOnAdd(); + + b.Property("IntAction") + .HasColumnName("Action"); + + b.Property("KeysString") + .HasColumnName("Keys"); + + b.Property("RulesetID"); + + b.Property("Variant"); + + b.HasKey("ID"); + + b.HasIndex("IntAction"); + + b.HasIndex("RulesetID", "Variant"); + + b.ToTable("KeyBinding"); + }); + + modelBuilder.Entity("osu.Game.IO.FileInfo", b => + { + b.Property("ID") + .ValueGeneratedOnAdd(); + + b.Property("Hash"); + + b.Property("ReferenceCount"); + + b.HasKey("ID"); + + b.HasIndex("Hash") + .IsUnique(); + + b.HasIndex("ReferenceCount"); + + b.ToTable("FileInfo"); + }); + + modelBuilder.Entity("osu.Game.Rulesets.RulesetInfo", b => + { + b.Property("ID") + .ValueGeneratedOnAdd(); + + b.Property("Available"); + + b.Property("InstantiationInfo"); + + b.Property("Name"); + + b.Property("ShortName"); + + b.HasKey("ID"); + + b.HasIndex("Available"); + + b.HasIndex("ShortName") + .IsUnique(); + + b.ToTable("RulesetInfo"); + }); + + modelBuilder.Entity("osu.Game.Skinning.SkinFileInfo", b => + { + b.Property("ID") + .ValueGeneratedOnAdd(); + + b.Property("FileInfoID"); + + b.Property("Filename") + .IsRequired(); + + b.Property("SkinInfoID"); + + b.HasKey("ID"); + + b.HasIndex("FileInfoID"); + + b.HasIndex("SkinInfoID"); + + b.ToTable("SkinFileInfo"); + }); + + modelBuilder.Entity("osu.Game.Skinning.SkinInfo", b => + { + b.Property("ID") + .ValueGeneratedOnAdd(); + + b.Property("Creator"); + + b.Property("DeletePending"); + + b.Property("Name"); + + b.HasKey("ID"); + + b.ToTable("SkinInfo"); + }); + + modelBuilder.Entity("osu.Game.Beatmaps.BeatmapInfo", b => + { + b.HasOne("osu.Game.Beatmaps.BeatmapDifficulty", "BaseDifficulty") + .WithMany() + .HasForeignKey("BaseDifficultyID") + .OnDelete(DeleteBehavior.Cascade); + + b.HasOne("osu.Game.Beatmaps.BeatmapSetInfo", "BeatmapSet") + .WithMany("Beatmaps") + .HasForeignKey("BeatmapSetInfoID") + .OnDelete(DeleteBehavior.Cascade); + + b.HasOne("osu.Game.Beatmaps.BeatmapMetadata", "Metadata") + .WithMany("Beatmaps") + .HasForeignKey("MetadataID"); + + b.HasOne("osu.Game.Rulesets.RulesetInfo", "Ruleset") + .WithMany() + .HasForeignKey("RulesetID") + .OnDelete(DeleteBehavior.Cascade); + }); + + modelBuilder.Entity("osu.Game.Beatmaps.BeatmapSetFileInfo", b => + { + b.HasOne("osu.Game.Beatmaps.BeatmapSetInfo") + .WithMany("Files") + .HasForeignKey("BeatmapSetInfoID") + .OnDelete(DeleteBehavior.Cascade); + + b.HasOne("osu.Game.IO.FileInfo", "FileInfo") + .WithMany() + .HasForeignKey("FileInfoID") + .OnDelete(DeleteBehavior.Cascade); + }); + + modelBuilder.Entity("osu.Game.Beatmaps.BeatmapSetInfo", b => + { + b.HasOne("osu.Game.Beatmaps.BeatmapMetadata", "Metadata") + .WithMany("BeatmapSets") + .HasForeignKey("MetadataID"); + }); + + modelBuilder.Entity("osu.Game.Skinning.SkinFileInfo", b => + { + b.HasOne("osu.Game.IO.FileInfo", "FileInfo") + .WithMany() + .HasForeignKey("FileInfoID") + .OnDelete(DeleteBehavior.Cascade); + + b.HasOne("osu.Game.Skinning.SkinInfo") + .WithMany("Files") + .HasForeignKey("SkinInfoID") + .OnDelete(DeleteBehavior.Cascade); + }); +#pragma warning restore 612, 618 + } + } +} diff --git a/osu.Game/Migrations/20181007180454_StandardizePaths.cs b/osu.Game/Migrations/20181007180454_StandardizePaths.cs new file mode 100644 index 0000000000..08b34507ce --- /dev/null +++ b/osu.Game/Migrations/20181007180454_StandardizePaths.cs @@ -0,0 +1,42 @@ +using System; +using Microsoft.EntityFrameworkCore.Migrations; +using System.IO; + +namespace osu.Game.Migrations +{ + public partial class StandardizePaths : Migration + { + protected override void Up(MigrationBuilder migrationBuilder) + { + string sanitized = Path.DirectorySeparatorChar.ToString(); + string standardized = "/"; + + // If we are not on Windows, no changes are needed. + if (string.Equals(standardized, sanitized, StringComparison.Ordinal)) + return; + + // Escaping \ does not seem to be needed. + migrationBuilder.Sql($"UPDATE `BeatmapInfo` SET `Path` = REPLACE(`Path`, '{sanitized}', '{standardized}')"); + migrationBuilder.Sql($"UPDATE `BeatmapMetadata` SET `AudioFile` = REPLACE(`AudioFile`, '{sanitized}', '{standardized}')"); + migrationBuilder.Sql($"UPDATE `BeatmapMetadata` SET `BackgroundFile` = REPLACE(`BackgroundFile`, '{sanitized}', '{standardized}')"); + migrationBuilder.Sql($"UPDATE `BeatmapSetFileInfo` SET `Filename` = REPLACE(`Filename`, '{sanitized}', '{standardized}')"); + migrationBuilder.Sql($"UPDATE `SkinFileInfo` SET `Filename` = REPLACE(`Filename`, '{sanitized}', '{standardized}')"); + } + + protected override void Down(MigrationBuilder migrationBuilder) + { + string sanitized = Path.DirectorySeparatorChar.ToString(); + string standardized = "/"; + + // If we are not on Windows, no changes are needed. + if (string.Equals(standardized, sanitized, StringComparison.Ordinal)) + return; + + migrationBuilder.Sql($"UPDATE `BeatmapInfo` SET `Path` = REPLACE(`Path`, '{standardized}', '{sanitized}')"); + migrationBuilder.Sql($"UPDATE `BeatmapMetadata` SET `AudioFile` = REPLACE(`AudioFile`, '{standardized}', '{sanitized}')"); + migrationBuilder.Sql($"UPDATE `BeatmapMetadata` SET `BackgroundFile` = REPLACE(`BackgroundFile`, '{standardized}', '{sanitized}')"); + migrationBuilder.Sql($"UPDATE `BeatmapSetFileInfo` SET `Filename` = REPLACE(`Filename`, '{standardized}', '{sanitized}')"); + migrationBuilder.Sql($"UPDATE `SkinFileInfo` SET `Filename` = REPLACE(`Filename`, '{standardized}', '{sanitized}')"); + } + } +} diff --git a/osu.Game/Migrations/OsuDbContextModelSnapshot.cs b/osu.Game/Migrations/OsuDbContextModelSnapshot.cs index fde5c9fd82..663676a6d3 100644 --- a/osu.Game/Migrations/OsuDbContextModelSnapshot.cs +++ b/osu.Game/Migrations/OsuDbContextModelSnapshot.cs @@ -14,7 +14,7 @@ namespace osu.Game.Migrations { #pragma warning disable 612, 618 modelBuilder - .HasAnnotation("ProductVersion", "2.1.2-rtm-30932"); + .HasAnnotation("ProductVersion", "2.1.3-rtm-32065"); modelBuilder.Entity("osu.Game.Beatmaps.BeatmapDifficulty", b => { From da976000763e6bcf7975714fa971a08b48777bed Mon Sep 17 00:00:00 2001 From: smoogipoo Date: Mon, 8 Oct 2018 16:46:58 +0900 Subject: [PATCH 222/417] Fix inaccurate section lengths for first hitobject --- osu.Game.Rulesets.Osu/Difficulty/OsuDifficultyCalculator.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu.Game.Rulesets.Osu/Difficulty/OsuDifficultyCalculator.cs b/osu.Game.Rulesets.Osu/Difficulty/OsuDifficultyCalculator.cs index 5e91ed7a97..028e3acc57 100644 --- a/osu.Game.Rulesets.Osu/Difficulty/OsuDifficultyCalculator.cs +++ b/osu.Game.Rulesets.Osu/Difficulty/OsuDifficultyCalculator.cs @@ -38,7 +38,7 @@ namespace osu.Game.Rulesets.Osu.Difficulty double sectionLength = section_length * timeRate; // The first object doesn't generate a strain, so we begin with an incremented section end - double currentSectionEnd = 2 * sectionLength; + double currentSectionEnd = Math.Ceiling(beatmap.HitObjects.First().StartTime / sectionLength) * sectionLength; foreach (OsuDifficultyHitObject h in difficultyBeatmap) { From 61e7ada977c3567463af8d48a38f7145c2605046 Mon Sep 17 00:00:00 2001 From: smoogipoo Date: Mon, 8 Oct 2018 17:36:06 +0900 Subject: [PATCH 223/417] Use ints + fix position calculation --- .../Difficulty/Preprocessing/OsuDifficultyHitObject.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu.Game.Rulesets.Osu/Difficulty/Preprocessing/OsuDifficultyHitObject.cs b/osu.Game.Rulesets.Osu/Difficulty/Preprocessing/OsuDifficultyHitObject.cs index 29de23406b..7f293fd099 100644 --- a/osu.Game.Rulesets.Osu/Difficulty/Preprocessing/OsuDifficultyHitObject.cs +++ b/osu.Game.Rulesets.Osu/Difficulty/Preprocessing/OsuDifficultyHitObject.cs @@ -88,7 +88,7 @@ namespace osu.Game.Rulesets.Osu.Difficulty.Preprocessing var computeVertex = new Action(t => { // ReSharper disable once PossibleInvalidOperationException (bugged in current r# version) - var diff = slider.StackedPositionAt(t) - slider.LazyEndPosition.Value; + var diff = slider.StackedPositionAt(((int)t - (int)slider.StartTime) / (float)(int)slider.Duration) - slider.LazyEndPosition.Value; float dist = diff.Length; if (dist > approxFollowCircleRadius) From 1ad5090ad68b52da6a49114c5f5187e200bc05cc Mon Sep 17 00:00:00 2001 From: smoogipoo Date: Mon, 8 Oct 2018 17:37:33 +0900 Subject: [PATCH 224/417] Separate travel distance from jump distance --- .../Preprocessing/OsuDifficultyHitObject.cs | 16 +++++++++++----- osu.Game.Rulesets.Osu/Difficulty/Skills/Aim.cs | 2 +- osu.Game.Rulesets.Osu/Difficulty/Skills/Speed.cs | 2 +- 3 files changed, 13 insertions(+), 7 deletions(-) diff --git a/osu.Game.Rulesets.Osu/Difficulty/Preprocessing/OsuDifficultyHitObject.cs b/osu.Game.Rulesets.Osu/Difficulty/Preprocessing/OsuDifficultyHitObject.cs index 7f293fd099..2419709e41 100644 --- a/osu.Game.Rulesets.Osu/Difficulty/Preprocessing/OsuDifficultyHitObject.cs +++ b/osu.Game.Rulesets.Osu/Difficulty/Preprocessing/OsuDifficultyHitObject.cs @@ -21,9 +21,14 @@ namespace osu.Game.Rulesets.Osu.Difficulty.Preprocessing public OsuHitObject BaseObject { get; } /// - /// Normalized distance from the of the previous . + /// Normalized distance from the end position of the previous . /// - public double Distance { get; private set; } + public double JumpDistance { get; private set; } + + /// + /// Normalized distance from the start position to the end position of the previous . + /// + public double TravelDistance { get; private set; } /// /// Milliseconds elapsed since the StartTime of the previous . @@ -51,10 +56,10 @@ namespace osu.Game.Rulesets.Osu.Difficulty.Preprocessing private void setDistances() { // We will scale distances by this factor, so we can assume a uniform CircleSize among beatmaps. - double scalingFactor = normalized_radius / BaseObject.Radius; + float scalingFactor = normalized_radius / (float)BaseObject.Radius; if (BaseObject.Radius < 30) { - double smallCircleBonus = Math.Min(30 - BaseObject.Radius, 5) / 50; + float smallCircleBonus = Math.Min(30 - (float)BaseObject.Radius, 5) / 50; scalingFactor *= 1 + smallCircleBonus; } @@ -69,7 +74,8 @@ namespace osu.Game.Rulesets.Osu.Difficulty.Preprocessing lastTravelDistance = lastSlider.LazyTravelDistance; } - Distance = (lastTravelDistance + (BaseObject.StackedPosition - lastCursorPosition).Length) * scalingFactor; + JumpDistance = (BaseObject.StackedPosition - lastCursorPosition).Length * scalingFactor; + TravelDistance = lastTravelDistance * scalingFactor; } private void setTimingValues() diff --git a/osu.Game.Rulesets.Osu/Difficulty/Skills/Aim.cs b/osu.Game.Rulesets.Osu/Difficulty/Skills/Aim.cs index 0a45c62671..9ffdd280aa 100644 --- a/osu.Game.Rulesets.Osu/Difficulty/Skills/Aim.cs +++ b/osu.Game.Rulesets.Osu/Difficulty/Skills/Aim.cs @@ -14,6 +14,6 @@ namespace osu.Game.Rulesets.Osu.Difficulty.Skills protected override double SkillMultiplier => 26.25; protected override double StrainDecayBase => 0.15; - protected override double StrainValueOf(OsuDifficultyHitObject current) => Math.Pow(current.Distance, 0.99) / current.DeltaTime; + protected override double StrainValueOf(OsuDifficultyHitObject current) => (Math.Pow(current.TravelDistance, 0.99) + Math.Pow(current.JumpDistance, 0.99)) / current.DeltaTime; } } diff --git a/osu.Game.Rulesets.Osu/Difficulty/Skills/Speed.cs b/osu.Game.Rulesets.Osu/Difficulty/Skills/Speed.cs index b807f20037..501a8e8e01 100644 --- a/osu.Game.Rulesets.Osu/Difficulty/Skills/Speed.cs +++ b/osu.Game.Rulesets.Osu/Difficulty/Skills/Speed.cs @@ -19,7 +19,7 @@ namespace osu.Game.Rulesets.Osu.Difficulty.Skills protected override double StrainValueOf(OsuDifficultyHitObject current) { - double distance = current.Distance; + double distance = current.TravelDistance + current.JumpDistance; double speedValue; if (distance > single_spacing_threshold) From 35f45e74dc2e5e41da3dd186e78652b329610687 Mon Sep 17 00:00:00 2001 From: smoogipoo Date: Mon, 8 Oct 2018 17:39:10 +0900 Subject: [PATCH 225/417] Calculate scaled positions prior to square-rooting --- .../Difficulty/Preprocessing/OsuDifficultyHitObject.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu.Game.Rulesets.Osu/Difficulty/Preprocessing/OsuDifficultyHitObject.cs b/osu.Game.Rulesets.Osu/Difficulty/Preprocessing/OsuDifficultyHitObject.cs index 2419709e41..b9eaf9ff04 100644 --- a/osu.Game.Rulesets.Osu/Difficulty/Preprocessing/OsuDifficultyHitObject.cs +++ b/osu.Game.Rulesets.Osu/Difficulty/Preprocessing/OsuDifficultyHitObject.cs @@ -74,7 +74,7 @@ namespace osu.Game.Rulesets.Osu.Difficulty.Preprocessing lastTravelDistance = lastSlider.LazyTravelDistance; } - JumpDistance = (BaseObject.StackedPosition - lastCursorPosition).Length * scalingFactor; + JumpDistance = (BaseObject.StackedPosition * scalingFactor - lastCursorPosition * scalingFactor).Length; TravelDistance = lastTravelDistance * scalingFactor; } From 0116db95d0363f0ac15932980a307fd7ff458b5f Mon Sep 17 00:00:00 2001 From: smoogipoo Date: Mon, 8 Oct 2018 18:37:30 +0900 Subject: [PATCH 226/417] Fix progress calculation --- .../Difficulty/Preprocessing/OsuDifficultyHitObject.cs | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/osu.Game.Rulesets.Osu/Difficulty/Preprocessing/OsuDifficultyHitObject.cs b/osu.Game.Rulesets.Osu/Difficulty/Preprocessing/OsuDifficultyHitObject.cs index b9eaf9ff04..26db2e3faa 100644 --- a/osu.Game.Rulesets.Osu/Difficulty/Preprocessing/OsuDifficultyHitObject.cs +++ b/osu.Game.Rulesets.Osu/Difficulty/Preprocessing/OsuDifficultyHitObject.cs @@ -3,6 +3,7 @@ using System; using System.Linq; +using osu.Game.Rulesets.Objects.Types; using osu.Game.Rulesets.Osu.Objects; using OpenTK; @@ -93,8 +94,14 @@ namespace osu.Game.Rulesets.Osu.Difficulty.Preprocessing float approxFollowCircleRadius = (float)(slider.Radius * 3); var computeVertex = new Action(t => { + double progress = ((int)t - (int)slider.StartTime) / (float)(int)slider.SpanDuration; + if (progress % 2 > 1) + progress = 1 - progress % 1; + else + progress = progress % 1; + // ReSharper disable once PossibleInvalidOperationException (bugged in current r# version) - var diff = slider.StackedPositionAt(((int)t - (int)slider.StartTime) / (float)(int)slider.Duration) - slider.LazyEndPosition.Value; + var diff = slider.StackedPosition + slider.Curve.PositionAt(progress) - slider.LazyEndPosition.Value; float dist = diff.Length; if (dist > approxFollowCircleRadius) From f8eaccddda1d1b1657127e6ae29778d909904edb Mon Sep 17 00:00:00 2001 From: smoogipoo Date: Mon, 8 Oct 2018 18:37:49 +0900 Subject: [PATCH 227/417] Stable doesn't use stacked positions --- .../Difficulty/Preprocessing/OsuDifficultyHitObject.cs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/osu.Game.Rulesets.Osu/Difficulty/Preprocessing/OsuDifficultyHitObject.cs b/osu.Game.Rulesets.Osu/Difficulty/Preprocessing/OsuDifficultyHitObject.cs index 26db2e3faa..44bec47e14 100644 --- a/osu.Game.Rulesets.Osu/Difficulty/Preprocessing/OsuDifficultyHitObject.cs +++ b/osu.Game.Rulesets.Osu/Difficulty/Preprocessing/OsuDifficultyHitObject.cs @@ -64,7 +64,7 @@ namespace osu.Game.Rulesets.Osu.Difficulty.Preprocessing scalingFactor *= 1 + smallCircleBonus; } - Vector2 lastCursorPosition = lastObject.StackedPosition; + Vector2 lastCursorPosition = lastObject.Position; float lastTravelDistance = 0; var lastSlider = lastObject as Slider; @@ -75,7 +75,7 @@ namespace osu.Game.Rulesets.Osu.Difficulty.Preprocessing lastTravelDistance = lastSlider.LazyTravelDistance; } - JumpDistance = (BaseObject.StackedPosition * scalingFactor - lastCursorPosition * scalingFactor).Length; + JumpDistance = (BaseObject.Position * scalingFactor - lastCursorPosition * scalingFactor).Length; TravelDistance = lastTravelDistance * scalingFactor; } @@ -89,7 +89,7 @@ namespace osu.Game.Rulesets.Osu.Difficulty.Preprocessing { if (slider.LazyEndPosition != null) return; - slider.LazyEndPosition = slider.StackedPosition; + slider.LazyEndPosition = slider.Position; float approxFollowCircleRadius = (float)(slider.Radius * 3); var computeVertex = new Action(t => @@ -101,7 +101,7 @@ namespace osu.Game.Rulesets.Osu.Difficulty.Preprocessing progress = progress % 1; // ReSharper disable once PossibleInvalidOperationException (bugged in current r# version) - var diff = slider.StackedPosition + slider.Curve.PositionAt(progress) - slider.LazyEndPosition.Value; + var diff = slider.Position + slider.Curve.PositionAt(progress) - slider.LazyEndPosition.Value; float dist = diff.Length; if (dist > approxFollowCircleRadius) From b7499fa95627d054e9a3a881420a92808cf12ebe Mon Sep 17 00:00:00 2001 From: smoogipoo Date: Tue, 9 Oct 2018 11:34:38 +0900 Subject: [PATCH 228/417] Allow TimingControlPoint to be overridden --- .../Beatmaps/ControlPoints/TimingControlPoint.cs | 2 +- osu.Game/Beatmaps/Formats/LegacyBeatmapDecoder.cs | 14 ++++++++------ 2 files changed, 9 insertions(+), 7 deletions(-) diff --git a/osu.Game/Beatmaps/ControlPoints/TimingControlPoint.cs b/osu.Game/Beatmaps/ControlPoints/TimingControlPoint.cs index eb60133fed..81eddaa43a 100644 --- a/osu.Game/Beatmaps/ControlPoints/TimingControlPoint.cs +++ b/osu.Game/Beatmaps/ControlPoints/TimingControlPoint.cs @@ -16,7 +16,7 @@ namespace osu.Game.Beatmaps.ControlPoints /// /// The beat length at this control point. /// - public double BeatLength + public virtual double BeatLength { get => beatLength; set => beatLength = MathHelper.Clamp(value, 6, 60000); diff --git a/osu.Game/Beatmaps/Formats/LegacyBeatmapDecoder.cs b/osu.Game/Beatmaps/Formats/LegacyBeatmapDecoder.cs index 181d17932d..5b5bc5d936 100644 --- a/osu.Game/Beatmaps/Formats/LegacyBeatmapDecoder.cs +++ b/osu.Game/Beatmaps/Formats/LegacyBeatmapDecoder.cs @@ -318,12 +318,12 @@ namespace osu.Game.Beatmaps.Formats if (timingChange) { - handleTimingControlPoint(new TimingControlPoint - { - Time = time, - BeatLength = beatLength, - TimeSignature = timeSignature - }); + var controlPoint = CreateTimingControlPoint(); + controlPoint.Time = time; + controlPoint.BeatLength = beatLength; + controlPoint.TimeSignature = timeSignature; + + handleTimingControlPoint(controlPoint); } handleDifficultyControlPoint(new DifficultyControlPoint @@ -418,6 +418,8 @@ namespace osu.Game.Beatmaps.Formats private double getOffsetTime(double time) => time + (ApplyOffsets ? offset : 0); + protected virtual TimingControlPoint CreateTimingControlPoint() => new TimingControlPoint(); + [Flags] internal enum EffectFlags { From 9facf707be57018b816417d6a8677f5719d87c35 Mon Sep 17 00:00:00 2001 From: smoogipoo Date: Tue, 9 Oct 2018 11:49:24 +0900 Subject: [PATCH 229/417] Add diffcalc beatmap decoder --- .../Preprocessing/OsuDifficultyHitObject.cs | 1 - ...egacyDifficultyCalculatorBeatmapDecoder.cs | 36 +++++++++++++++++++ 2 files changed, 36 insertions(+), 1 deletion(-) create mode 100644 osu.Game/Beatmaps/Formats/LegacyDifficultyCalculatorBeatmapDecoder.cs diff --git a/osu.Game.Rulesets.Osu/Difficulty/Preprocessing/OsuDifficultyHitObject.cs b/osu.Game.Rulesets.Osu/Difficulty/Preprocessing/OsuDifficultyHitObject.cs index 44bec47e14..448dc140a3 100644 --- a/osu.Game.Rulesets.Osu/Difficulty/Preprocessing/OsuDifficultyHitObject.cs +++ b/osu.Game.Rulesets.Osu/Difficulty/Preprocessing/OsuDifficultyHitObject.cs @@ -3,7 +3,6 @@ using System; using System.Linq; -using osu.Game.Rulesets.Objects.Types; using osu.Game.Rulesets.Osu.Objects; using OpenTK; diff --git a/osu.Game/Beatmaps/Formats/LegacyDifficultyCalculatorBeatmapDecoder.cs b/osu.Game/Beatmaps/Formats/LegacyDifficultyCalculatorBeatmapDecoder.cs new file mode 100644 index 0000000000..61efd329c0 --- /dev/null +++ b/osu.Game/Beatmaps/Formats/LegacyDifficultyCalculatorBeatmapDecoder.cs @@ -0,0 +1,36 @@ +// Copyright (c) 2007-2018 ppy Pty Ltd . +// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE + +using System.Linq; +using osu.Game.Beatmaps.ControlPoints; + +namespace osu.Game.Beatmaps.Formats +{ + /// + /// A built for difficulty calculation of legacy s + /// + /// To use this, the decoder must be registered by the application through . + /// Doing so will override any existing decoders. + /// + /// + public class LegacyDifficultyCalculatorBeatmapDecoder : LegacyBeatmapDecoder + { + public LegacyDifficultyCalculatorBeatmapDecoder(int version = LATEST_VERSION) + : base(version) + { + } + + public new static void Register() + { + AddDecoder(@"osu file format v", m => new LegacyDifficultyCalculatorBeatmapDecoder(int.Parse(m.Split('v').Last()))); + } + + protected override TimingControlPoint CreateTimingControlPoint() + => new LegacyDifficultyCalculatorControlPoint(); + + private class LegacyDifficultyCalculatorControlPoint : TimingControlPoint + { + public override double BeatLength { get; set; } = 1000; + } + } +} From 0a3be0d253c076bfda1a95ebb26854808be30293 Mon Sep 17 00:00:00 2001 From: smoogipoo Date: Tue, 9 Oct 2018 12:03:47 +0900 Subject: [PATCH 230/417] Adjust comments slightly --- .../Difficulty/Preprocessing/OsuDifficultyHitObject.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/osu.Game.Rulesets.Osu/Difficulty/Preprocessing/OsuDifficultyHitObject.cs b/osu.Game.Rulesets.Osu/Difficulty/Preprocessing/OsuDifficultyHitObject.cs index 448dc140a3..a118d95ff7 100644 --- a/osu.Game.Rulesets.Osu/Difficulty/Preprocessing/OsuDifficultyHitObject.cs +++ b/osu.Game.Rulesets.Osu/Difficulty/Preprocessing/OsuDifficultyHitObject.cs @@ -21,12 +21,12 @@ namespace osu.Game.Rulesets.Osu.Difficulty.Preprocessing public OsuHitObject BaseObject { get; } /// - /// Normalized distance from the end position of the previous . + /// Normalized distance from the end position of the previous to the start position of this . /// public double JumpDistance { get; private set; } /// - /// Normalized distance from the start position to the end position of the previous . + /// Normalized distance between the start and end position of the previous . /// public double TravelDistance { get; private set; } From a171ed350006fa6f918d527dbefccddf920c13c7 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Tue, 9 Oct 2018 16:12:20 +0900 Subject: [PATCH 231/417] Fix joined channels not appearing as joined in the channel list --- osu.Game/Overlays/ChatOverlay.cs | 20 ++++---------------- 1 file changed, 4 insertions(+), 16 deletions(-) diff --git a/osu.Game/Overlays/ChatOverlay.cs b/osu.Game/Overlays/ChatOverlay.cs index eeadac8e8c..ff2ff9af14 100644 --- a/osu.Game/Overlays/ChatOverlay.cs +++ b/osu.Game/Overlays/ChatOverlay.cs @@ -291,7 +291,7 @@ namespace osu.Game.Overlays messageRequest?.Cancel(); ListChannelsRequest req = new ListChannelsRequest(); - req.Success += delegate (List channels) + req.Success += delegate(List channels) { AvailableChannels = channels; @@ -323,10 +323,7 @@ namespace osu.Game.Overlays protected Channel CurrentChannel { - get - { - return currentChannel; - } + get { return currentChannel; } set { @@ -445,13 +442,7 @@ namespace osu.Game.Overlays if (updates?.Presence != null) { foreach (var channel in updates.Presence) - { - if (careChannels.Find(c => c.Id == channel.Id) == null) - { - channel.Joined.Value = true; - addChannel(channel); - } - } + addChannel(AvailableChannels.Find(c => c.Id == channel.Id)); foreach (var group in updates.Messages.GroupBy(m => m.ChannelId)) careChannels.Find(c => c.Id == group.Key)?.AddNewMessages(group.ToArray()); @@ -462,10 +453,7 @@ namespace osu.Game.Overlays fetchReq = null; }; - fetchReq.Failure += delegate - { - fetchReq = null; - }; + fetchReq.Failure += delegate { fetchReq = null; }; api.Queue(fetchReq); } From ccb6723711351e66a509f5c1ce6392a8fcdb27e4 Mon Sep 17 00:00:00 2001 From: smoogipoo Date: Tue, 9 Oct 2018 16:50:29 +0900 Subject: [PATCH 232/417] Debounce music controller seeks --- osu.Game/Overlays/MusicController.cs | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/osu.Game/Overlays/MusicController.cs b/osu.Game/Overlays/MusicController.cs index e3dc504e4d..b32fd265cb 100644 --- a/osu.Game/Overlays/MusicController.cs +++ b/osu.Game/Overlays/MusicController.cs @@ -196,10 +196,16 @@ namespace osu.Game.Overlays playlist.StateChanged += s => playlistButton.FadeColour(s == Visibility.Visible ? colours.Yellow : Color4.White, 200, Easing.OutQuint); } + private ScheduledDelegate seekDelegate; + private void attemptSeek(double progress) { - if (!beatmap.Disabled) - current?.Track.Seek(progress); + seekDelegate?.Cancel(); + seekDelegate = Schedule(() => + { + if (!beatmap.Disabled) + current?.Track.Seek(progress); + }); } private void playlistOrderChanged(BeatmapSetInfo beatmapSetInfo, int index) From 6d24bde72ba8cd3ac6d932d2de8b685a21689d9b Mon Sep 17 00:00:00 2001 From: smoogipoo Date: Tue, 9 Oct 2018 17:39:27 +0900 Subject: [PATCH 233/417] Fix beatmap details not displaying --- osu.Game/Screens/Select/BeatmapDetails.cs | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/osu.Game/Screens/Select/BeatmapDetails.cs b/osu.Game/Screens/Select/BeatmapDetails.cs index f1bd2b945f..f7b955941d 100644 --- a/osu.Game/Screens/Select/BeatmapDetails.cs +++ b/osu.Game/Screens/Select/BeatmapDetails.cs @@ -327,11 +327,6 @@ namespace osu.Game.Screens.Select TextSize = 14, }, }, - textFlow = new OsuTextFlowContainer - { - RelativeSizeAxes = Axes.X, - AutoSizeAxes = Axes.Y, - }, }, }; } @@ -350,6 +345,8 @@ namespace osu.Game.Screens.Select } } + public override bool IsPresent => base.IsPresent || textFlow == null; // Visibility is updated in the LoadComponentAsync callback + private void setTextAsync(string text) { LoadComponentAsync(new OsuTextFlowContainer(s => s.TextSize = 14) From ae79c3832e720eef2b26cd9efeacf1081e93415a Mon Sep 17 00:00:00 2001 From: Paul Teng Date: Tue, 9 Oct 2018 11:05:15 -0400 Subject: [PATCH 234/417] Add base. for safety --- osu.Game/Overlays/Toolbar/ToolbarRulesetSelector.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu.Game/Overlays/Toolbar/ToolbarRulesetSelector.cs b/osu.Game/Overlays/Toolbar/ToolbarRulesetSelector.cs index 138f3ffc3f..fa35e53531 100644 --- a/osu.Game/Overlays/Toolbar/ToolbarRulesetSelector.cs +++ b/osu.Game/Overlays/Toolbar/ToolbarRulesetSelector.cs @@ -105,7 +105,7 @@ namespace osu.Game.Overlays.Toolbar public override bool HandleNonPositionalInput => !ruleset.Disabled && base.HandleNonPositionalInput; public override bool HandlePositionalInput => !ruleset.Disabled && base.HandlePositionalInput; - public override bool PropagatePositionalInputSubTree => !ruleset.Disabled; + public override bool PropagatePositionalInputSubTree => !ruleset.Disabled && base.PropagatePositionalInputSubTree; private void disabledChanged(bool isDisabled) => this.FadeColour(isDisabled ? Color4.Gray : Color4.White, 300); From b35f88b8ba460be6d7d4a36e3c5761a1a2938bef Mon Sep 17 00:00:00 2001 From: HoLLy Date: Tue, 9 Oct 2018 17:49:18 +0200 Subject: [PATCH 235/417] Standardize AudioFile and BackgroundImage paths --- osu.Game/Beatmaps/Formats/LegacyBeatmapDecoder.cs | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/osu.Game/Beatmaps/Formats/LegacyBeatmapDecoder.cs b/osu.Game/Beatmaps/Formats/LegacyBeatmapDecoder.cs index 181d17932d..3030fcb9da 100644 --- a/osu.Game/Beatmaps/Formats/LegacyBeatmapDecoder.cs +++ b/osu.Game/Beatmaps/Formats/LegacyBeatmapDecoder.cs @@ -5,6 +5,7 @@ using System; using System.Globalization; using System.IO; using System.Linq; +using osu.Framework.IO.File; using osu.Game.Beatmaps.Timing; using osu.Game.Rulesets.Objects.Legacy; using osu.Game.Beatmaps.ControlPoints; @@ -100,7 +101,7 @@ namespace osu.Game.Beatmaps.Formats switch (pair.Key) { case @"AudioFilename": - metadata.AudioFile = pair.Value; + metadata.AudioFile = FileSafety.PathStandardise(pair.Value); break; case @"AudioLeadIn": beatmap.BeatmapInfo.AudioLeadIn = int.Parse(pair.Value); @@ -256,7 +257,7 @@ namespace osu.Game.Beatmaps.Formats { case EventType.Background: string filename = split[2].Trim('"'); - beatmap.BeatmapInfo.Metadata.BackgroundFile = filename; + beatmap.BeatmapInfo.Metadata.BackgroundFile = FileSafety.PathStandardise(filename); break; case EventType.Break: var breakEvent = new BreakPeriod From d6784c818e02d02c72a86ee3bb5071009b18be63 Mon Sep 17 00:00:00 2001 From: smoogipoo Date: Wed, 10 Oct 2018 11:49:54 +0900 Subject: [PATCH 236/417] Fix jump/travel distances in some scenarios --- .../Difficulty/Preprocessing/OsuDifficultyHitObject.cs | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/osu.Game.Rulesets.Osu/Difficulty/Preprocessing/OsuDifficultyHitObject.cs b/osu.Game.Rulesets.Osu/Difficulty/Preprocessing/OsuDifficultyHitObject.cs index a118d95ff7..0400f080d9 100644 --- a/osu.Game.Rulesets.Osu/Difficulty/Preprocessing/OsuDifficultyHitObject.cs +++ b/osu.Game.Rulesets.Osu/Difficulty/Preprocessing/OsuDifficultyHitObject.cs @@ -74,8 +74,13 @@ namespace osu.Game.Rulesets.Osu.Difficulty.Preprocessing lastTravelDistance = lastSlider.LazyTravelDistance; } - JumpDistance = (BaseObject.Position * scalingFactor - lastCursorPosition * scalingFactor).Length; - TravelDistance = lastTravelDistance * scalingFactor; + // Don't need to jump to reach spinners + if (!(BaseObject is Spinner)) + JumpDistance = (BaseObject.Position * scalingFactor - lastCursorPosition * scalingFactor).Length; + + // Todo: BUG!!! Last slider's travel distance is considered ONLY IF we ourselves are also sliders! + if (BaseObject is Slider) + TravelDistance = lastTravelDistance * scalingFactor; } private void setTimingValues() From 1125075b374ea717111998ab4f0f20a357baf98d Mon Sep 17 00:00:00 2001 From: smoogipoo Date: Wed, 10 Oct 2018 13:02:27 +0900 Subject: [PATCH 237/417] Use list with post-sort for nested hitobjects --- osu.Game/Rulesets/Objects/HitObject.cs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/osu.Game/Rulesets/Objects/HitObject.cs b/osu.Game/Rulesets/Objects/HitObject.cs index beb9620f78..80a3677b12 100644 --- a/osu.Game/Rulesets/Objects/HitObject.cs +++ b/osu.Game/Rulesets/Objects/HitObject.cs @@ -58,7 +58,7 @@ namespace osu.Game.Rulesets.Objects /// public HitWindows HitWindows { get; set; } - private readonly Lazy> nestedHitObjects = new Lazy>(() => new SortedList((h1, h2) => h1.StartTime.CompareTo(h2.StartTime))); + private readonly Lazy> nestedHitObjects = new Lazy>(() => new List()); [JsonIgnore] public IReadOnlyList NestedHitObjects => nestedHitObjects.Value; @@ -79,6 +79,8 @@ namespace osu.Game.Rulesets.Objects if (nestedHitObjects.IsValueCreated) { + nestedHitObjects.Value.Sort((h1, h2) => h1.StartTime.CompareTo(h2.StartTime)); + nestedHitObjects.Value.ForEach(h => { h.HitWindows = HitWindows; From 417ebaeb857a50f65f484ca5c6d424539046f3b0 Mon Sep 17 00:00:00 2001 From: smoogipoo Date: Wed, 10 Oct 2018 13:03:18 +0900 Subject: [PATCH 238/417] Reduce hitobject size by removing lazy --- osu.Game/Rulesets/Objects/HitObject.cs | 27 ++++++++++---------------- 1 file changed, 10 insertions(+), 17 deletions(-) diff --git a/osu.Game/Rulesets/Objects/HitObject.cs b/osu.Game/Rulesets/Objects/HitObject.cs index 80a3677b12..e52d6b416f 100644 --- a/osu.Game/Rulesets/Objects/HitObject.cs +++ b/osu.Game/Rulesets/Objects/HitObject.cs @@ -1,11 +1,8 @@ // Copyright (c) 2007-2018 ppy Pty Ltd . // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE -using System; using System.Collections.Generic; using Newtonsoft.Json; -using osu.Framework.Extensions.IEnumerableExtensions; -using osu.Framework.Lists; using osu.Game.Audio; using osu.Game.Beatmaps; using osu.Game.Beatmaps.ControlPoints; @@ -58,10 +55,10 @@ namespace osu.Game.Rulesets.Objects /// public HitWindows HitWindows { get; set; } - private readonly Lazy> nestedHitObjects = new Lazy>(() => new List()); + private readonly List nestedHitObjects = new List(); [JsonIgnore] - public IReadOnlyList NestedHitObjects => nestedHitObjects.Value; + public IReadOnlyList NestedHitObjects => nestedHitObjects; /// /// Applies default values to this HitObject. @@ -72,21 +69,17 @@ namespace osu.Game.Rulesets.Objects { ApplyDefaultsToSelf(controlPointInfo, difficulty); - if (nestedHitObjects.IsValueCreated) - nestedHitObjects.Value.Clear(); + nestedHitObjects.Clear(); CreateNestedHitObjects(); - if (nestedHitObjects.IsValueCreated) - { - nestedHitObjects.Value.Sort((h1, h2) => h1.StartTime.CompareTo(h2.StartTime)); + nestedHitObjects.Sort((h1, h2) => h1.StartTime.CompareTo(h2.StartTime)); - nestedHitObjects.Value.ForEach(h => - { - h.HitWindows = HitWindows; - h.ApplyDefaults(controlPointInfo, difficulty); - }); - } + nestedHitObjects.ForEach(h => + { + h.HitWindows = HitWindows; + h.ApplyDefaults(controlPointInfo, difficulty); + }); } protected virtual void ApplyDefaultsToSelf(ControlPointInfo controlPointInfo, BeatmapDifficulty difficulty) @@ -106,7 +99,7 @@ namespace osu.Game.Rulesets.Objects { } - protected void AddNested(HitObject hitObject) => nestedHitObjects.Value.Add(hitObject); + protected void AddNested(HitObject hitObject) => nestedHitObjects.Add(hitObject); /// /// Creates the that represents the scoring information for this . From f53bb81723372ab9bb462b616ecdb89e73058b4c Mon Sep 17 00:00:00 2001 From: smoogipoo Date: Wed, 10 Oct 2018 14:58:29 +0900 Subject: [PATCH 239/417] Remove unnecessary lambda allocation --- osu.Game/Rulesets/Objects/HitObject.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/osu.Game/Rulesets/Objects/HitObject.cs b/osu.Game/Rulesets/Objects/HitObject.cs index e52d6b416f..67a3db7a00 100644 --- a/osu.Game/Rulesets/Objects/HitObject.cs +++ b/osu.Game/Rulesets/Objects/HitObject.cs @@ -75,11 +75,11 @@ namespace osu.Game.Rulesets.Objects nestedHitObjects.Sort((h1, h2) => h1.StartTime.CompareTo(h2.StartTime)); - nestedHitObjects.ForEach(h => + foreach (var h in nestedHitObjects) { h.HitWindows = HitWindows; h.ApplyDefaults(controlPointInfo, difficulty); - }); + } } protected virtual void ApplyDefaultsToSelf(ControlPointInfo controlPointInfo, BeatmapDifficulty difficulty) From b56d09c83b918a8c209d08802cd550f1078f6bdb Mon Sep 17 00:00:00 2001 From: smoogipoo Date: Wed, 10 Oct 2018 15:32:55 +0900 Subject: [PATCH 240/417] Set hitobject placement time manually --- .../Edit/Masks/HitCirclePlacementMask.cs | 1 + osu.Game/Rulesets/Edit/PlacementMask.cs | 11 ++--------- 2 files changed, 3 insertions(+), 9 deletions(-) diff --git a/osu.Game.Rulesets.Osu/Edit/Masks/HitCirclePlacementMask.cs b/osu.Game.Rulesets.Osu/Edit/Masks/HitCirclePlacementMask.cs index 9082f40445..0b248e20fe 100644 --- a/osu.Game.Rulesets.Osu/Edit/Masks/HitCirclePlacementMask.cs +++ b/osu.Game.Rulesets.Osu/Edit/Masks/HitCirclePlacementMask.cs @@ -31,6 +31,7 @@ namespace osu.Game.Rulesets.Osu.Edit.Masks protected override bool OnClick(ClickEvent e) { + HitObject.StartTime = EditorClock.CurrentTime; HitObject.Position = e.MousePosition; Finish(); return true; diff --git a/osu.Game/Rulesets/Edit/PlacementMask.cs b/osu.Game/Rulesets/Edit/PlacementMask.cs index 3cee09a8ee..fd1b670274 100644 --- a/osu.Game/Rulesets/Edit/PlacementMask.cs +++ b/osu.Game/Rulesets/Edit/PlacementMask.cs @@ -25,7 +25,7 @@ namespace osu.Game.Rulesets.Edit /// protected readonly HitObject HitObject; - private IAdjustableClock clock; + protected IClock EditorClock { get; private set; } public PlacementMask(HitObject hitObject) { @@ -35,7 +35,7 @@ namespace osu.Game.Rulesets.Edit [BackgroundDependencyLoader] private void load(IBindableBeatmap workingBeatmap, IAdjustableClock clock) { - this.clock = clock; + EditorClock = clock; HitObject.ApplyDefaults(workingBeatmap.Value.Beatmap.ControlPointInfo, workingBeatmap.Value.Beatmap.BeatmapInfo.BaseDifficulty); } @@ -45,13 +45,6 @@ namespace osu.Game.Rulesets.Edit /// public void Finish() => PlacementFinished?.Invoke(HitObject); - protected override void Update() - { - base.Update(); - - HitObject.StartTime = clock.CurrentTime; - } - public override bool ReceivePositionalInputAt(Vector2 screenSpacePos) => Parent?.ReceivePositionalInputAt(screenSpacePos) ?? false; protected override bool Handle(UIEvent e) From 03a95113994fa92d8a296370c373acc0cad65cd7 Mon Sep 17 00:00:00 2001 From: smoogipoo Date: Wed, 10 Oct 2018 18:08:46 +0900 Subject: [PATCH 241/417] Apparently stable does use stacking --- .../Difficulty/Preprocessing/OsuDifficultyHitObject.cs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/osu.Game.Rulesets.Osu/Difficulty/Preprocessing/OsuDifficultyHitObject.cs b/osu.Game.Rulesets.Osu/Difficulty/Preprocessing/OsuDifficultyHitObject.cs index 0400f080d9..fd36e85f26 100644 --- a/osu.Game.Rulesets.Osu/Difficulty/Preprocessing/OsuDifficultyHitObject.cs +++ b/osu.Game.Rulesets.Osu/Difficulty/Preprocessing/OsuDifficultyHitObject.cs @@ -63,7 +63,7 @@ namespace osu.Game.Rulesets.Osu.Difficulty.Preprocessing scalingFactor *= 1 + smallCircleBonus; } - Vector2 lastCursorPosition = lastObject.Position; + Vector2 lastCursorPosition = lastObject.StackedPosition; float lastTravelDistance = 0; var lastSlider = lastObject as Slider; @@ -76,7 +76,7 @@ namespace osu.Game.Rulesets.Osu.Difficulty.Preprocessing // Don't need to jump to reach spinners if (!(BaseObject is Spinner)) - JumpDistance = (BaseObject.Position * scalingFactor - lastCursorPosition * scalingFactor).Length; + JumpDistance = (BaseObject.StackedPosition * scalingFactor - lastCursorPosition * scalingFactor).Length; // Todo: BUG!!! Last slider's travel distance is considered ONLY IF we ourselves are also sliders! if (BaseObject is Slider) @@ -105,7 +105,7 @@ namespace osu.Game.Rulesets.Osu.Difficulty.Preprocessing progress = progress % 1; // ReSharper disable once PossibleInvalidOperationException (bugged in current r# version) - var diff = slider.Position + slider.Curve.PositionAt(progress) - slider.LazyEndPosition.Value; + var diff = slider.StackedPosition + slider.Curve.PositionAt(progress) - slider.LazyEndPosition.Value; float dist = diff.Length; if (dist > approxFollowCircleRadius) From d8f77feddd705e9fc986b4c4ec3b0b3c4472f273 Mon Sep 17 00:00:00 2001 From: smoogipoo Date: Wed, 10 Oct 2018 18:52:57 +0900 Subject: [PATCH 242/417] Fix using the wrong slider's travel distance --- .../Difficulty/Preprocessing/OsuDifficultyHitObject.cs | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/osu.Game.Rulesets.Osu/Difficulty/Preprocessing/OsuDifficultyHitObject.cs b/osu.Game.Rulesets.Osu/Difficulty/Preprocessing/OsuDifficultyHitObject.cs index fd36e85f26..1c5b28f407 100644 --- a/osu.Game.Rulesets.Osu/Difficulty/Preprocessing/OsuDifficultyHitObject.cs +++ b/osu.Game.Rulesets.Osu/Difficulty/Preprocessing/OsuDifficultyHitObject.cs @@ -64,23 +64,21 @@ namespace osu.Game.Rulesets.Osu.Difficulty.Preprocessing } Vector2 lastCursorPosition = lastObject.StackedPosition; - float lastTravelDistance = 0; var lastSlider = lastObject as Slider; if (lastSlider != null) { computeSliderCursorPosition(lastSlider); lastCursorPosition = lastSlider.LazyEndPosition ?? lastCursorPosition; - lastTravelDistance = lastSlider.LazyTravelDistance; } // Don't need to jump to reach spinners if (!(BaseObject is Spinner)) JumpDistance = (BaseObject.StackedPosition * scalingFactor - lastCursorPosition * scalingFactor).Length; - // Todo: BUG!!! Last slider's travel distance is considered ONLY IF we ourselves are also sliders! + // Todo: BUG!!! Last slider's travel distance is considered ONLY IF we ourselves are also a slider! if (BaseObject is Slider) - TravelDistance = lastTravelDistance * scalingFactor; + TravelDistance = (lastSlider?.LazyTravelDistance ?? 0) * scalingFactor; } private void setTimingValues() From 4e37b5c4a7878b11905efd2c4be80ba5e10f33f0 Mon Sep 17 00:00:00 2001 From: smoogipoo Date: Wed, 10 Oct 2018 18:53:54 +0900 Subject: [PATCH 243/417] 50ms cap shouldn't be included in the strain decay --- .../Preprocessing/OsuDifficultyHitObject.cs | 11 +++++++++-- osu.Game.Rulesets.Osu/Difficulty/Skills/Aim.cs | 3 ++- osu.Game.Rulesets.Osu/Difficulty/Skills/Speed.cs | 2 +- 3 files changed, 12 insertions(+), 4 deletions(-) diff --git a/osu.Game.Rulesets.Osu/Difficulty/Preprocessing/OsuDifficultyHitObject.cs b/osu.Game.Rulesets.Osu/Difficulty/Preprocessing/OsuDifficultyHitObject.cs index 1c5b28f407..4905c007b9 100644 --- a/osu.Game.Rulesets.Osu/Difficulty/Preprocessing/OsuDifficultyHitObject.cs +++ b/osu.Game.Rulesets.Osu/Difficulty/Preprocessing/OsuDifficultyHitObject.cs @@ -35,6 +35,11 @@ namespace osu.Game.Rulesets.Osu.Difficulty.Preprocessing /// public double DeltaTime { get; private set; } + /// + /// Milliseconds elapsed since the start time of the previous , with a minimum of 50ms. + /// + public double StrainTime { get; private set; } + private readonly OsuHitObject lastObject; private readonly double timeRate; @@ -83,8 +88,10 @@ namespace osu.Game.Rulesets.Osu.Difficulty.Preprocessing private void setTimingValues() { - // Every timing inverval is hard capped at the equivalent of 375 BPM streaming speed as a safety measure. - DeltaTime = Math.Max(50, (BaseObject.StartTime - lastObject.StartTime) / timeRate); + DeltaTime = (BaseObject.StartTime - lastObject.StartTime) / timeRate; + + // Every strain interval is hard capped at the equivalent of 375 BPM streaming speed as a safety measure + StrainTime = Math.Max(50, DeltaTime); } private void computeSliderCursorPosition(Slider slider) diff --git a/osu.Game.Rulesets.Osu/Difficulty/Skills/Aim.cs b/osu.Game.Rulesets.Osu/Difficulty/Skills/Aim.cs index 9ffdd280aa..f11b6d66f6 100644 --- a/osu.Game.Rulesets.Osu/Difficulty/Skills/Aim.cs +++ b/osu.Game.Rulesets.Osu/Difficulty/Skills/Aim.cs @@ -14,6 +14,7 @@ namespace osu.Game.Rulesets.Osu.Difficulty.Skills protected override double SkillMultiplier => 26.25; protected override double StrainDecayBase => 0.15; - protected override double StrainValueOf(OsuDifficultyHitObject current) => (Math.Pow(current.TravelDistance, 0.99) + Math.Pow(current.JumpDistance, 0.99)) / current.DeltaTime; + protected override double StrainValueOf(OsuDifficultyHitObject current) + => (Math.Pow(current.TravelDistance, 0.99) + Math.Pow(current.JumpDistance, 0.99)) / current.StrainTime; } } diff --git a/osu.Game.Rulesets.Osu/Difficulty/Skills/Speed.cs b/osu.Game.Rulesets.Osu/Difficulty/Skills/Speed.cs index 501a8e8e01..1cde03624b 100644 --- a/osu.Game.Rulesets.Osu/Difficulty/Skills/Speed.cs +++ b/osu.Game.Rulesets.Osu/Difficulty/Skills/Speed.cs @@ -33,7 +33,7 @@ namespace osu.Game.Rulesets.Osu.Difficulty.Skills else speedValue = 0.95; - return speedValue / current.DeltaTime; + return speedValue / current.StrainTime; } } } From d28b9860ff5e47ea467f871405626f619b881569 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Wed, 10 Oct 2018 19:26:35 +0900 Subject: [PATCH 244/417] Don't use "beatmapset" terminology --- osu.Game/Screens/Select/SongSelect.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu.Game/Screens/Select/SongSelect.cs b/osu.Game/Screens/Select/SongSelect.cs index f17496e200..b4f552ce93 100644 --- a/osu.Game/Screens/Select/SongSelect.cs +++ b/osu.Game/Screens/Select/SongSelect.cs @@ -204,7 +204,7 @@ namespace osu.Game.Screens.Select Footer.AddButton(@"random", colours.Green, triggerRandom, Key.F2); Footer.AddButton(@"options", colours.Blue, BeatmapOptions, Key.F3); - BeatmapOptions.AddButton(@"Delete", @"beatmapset", FontAwesome.fa_trash, colours.Pink, () => delete(Beatmap.Value.BeatmapSetInfo), Key.Number4, float.MaxValue); + BeatmapOptions.AddButton(@"Delete", @"all difficulties", FontAwesome.fa_trash, colours.Pink, () => delete(Beatmap.Value.BeatmapSetInfo), Key.Number4, float.MaxValue); } if (this.beatmaps == null) From ed0dcb2e7333e47d5cf66d4cdd27cd48d4300292 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Wed, 10 Oct 2018 19:41:40 +0900 Subject: [PATCH 245/417] Add comment explaining why --- osu.Game/Rulesets/Mods/IApplicableToDrawableHitObject.cs | 1 + 1 file changed, 1 insertion(+) diff --git a/osu.Game/Rulesets/Mods/IApplicableToDrawableHitObject.cs b/osu.Game/Rulesets/Mods/IApplicableToDrawableHitObject.cs index d871cdd322..fca04ca513 100644 --- a/osu.Game/Rulesets/Mods/IApplicableToDrawableHitObject.cs +++ b/osu.Game/Rulesets/Mods/IApplicableToDrawableHitObject.cs @@ -13,6 +13,7 @@ namespace osu.Game.Rulesets.Mods { /// /// Applies this to a list of s. + /// This will only be invoked with top-level s. Access if adjusting nested objects is necessary. /// /// The list of s to apply to. void ApplyToDrawableHitObjects(IEnumerable drawables); From f675c939356a9140c7a4e77b7adbbd602f0e986e Mon Sep 17 00:00:00 2001 From: smoogipoo Date: Wed, 10 Oct 2018 21:37:02 +0900 Subject: [PATCH 246/417] Stably-sort hitobjects --- .../Difficulty/Preprocessing/OsuDifficultyBeatmap.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/osu.Game.Rulesets.Osu/Difficulty/Preprocessing/OsuDifficultyBeatmap.cs b/osu.Game.Rulesets.Osu/Difficulty/Preprocessing/OsuDifficultyBeatmap.cs index 4443a0e66b..24d4677981 100644 --- a/osu.Game.Rulesets.Osu/Difficulty/Preprocessing/OsuDifficultyBeatmap.cs +++ b/osu.Game.Rulesets.Osu/Difficulty/Preprocessing/OsuDifficultyBeatmap.cs @@ -3,6 +3,7 @@ using System.Collections; using System.Collections.Generic; +using System.Linq; using osu.Game.Rulesets.Osu.Objects; namespace osu.Game.Rulesets.Osu.Difficulty.Preprocessing @@ -23,8 +24,7 @@ namespace osu.Game.Rulesets.Osu.Difficulty.Preprocessing { // Sort OsuHitObjects by StartTime - they are not correctly ordered in some cases. // This should probably happen before the objects reach the difficulty calculator. - objects.Sort((a, b) => a.StartTime.CompareTo(b.StartTime)); - difficultyObjects = createDifficultyObjectEnumerator(objects, timeRate); + difficultyObjects = createDifficultyObjectEnumerator(objects.OrderBy(h => h.StartTime).ToList(), timeRate); } /// From 7d20efed2c9318b5bd7e1391902714438085a206 Mon Sep 17 00:00:00 2001 From: smoogipoo Date: Thu, 11 Oct 2018 13:53:29 +0900 Subject: [PATCH 247/417] Fix missing stack position --- .../Difficulty/Preprocessing/OsuDifficultyHitObject.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu.Game.Rulesets.Osu/Difficulty/Preprocessing/OsuDifficultyHitObject.cs b/osu.Game.Rulesets.Osu/Difficulty/Preprocessing/OsuDifficultyHitObject.cs index 4905c007b9..ccfcc1ef25 100644 --- a/osu.Game.Rulesets.Osu/Difficulty/Preprocessing/OsuDifficultyHitObject.cs +++ b/osu.Game.Rulesets.Osu/Difficulty/Preprocessing/OsuDifficultyHitObject.cs @@ -98,7 +98,7 @@ namespace osu.Game.Rulesets.Osu.Difficulty.Preprocessing { if (slider.LazyEndPosition != null) return; - slider.LazyEndPosition = slider.Position; + slider.LazyEndPosition = slider.StackedPosition; float approxFollowCircleRadius = (float)(slider.Radius * 3); var computeVertex = new Action(t => From 0c4403ef16b17a71208537321b4ed6fd80c3a975 Mon Sep 17 00:00:00 2001 From: smoogipoo Date: Thu, 11 Oct 2018 13:53:49 +0900 Subject: [PATCH 248/417] Don't apply version offset during diff calc --- .../Beatmaps/Formats/LegacyDifficultyCalculatorBeatmapDecoder.cs | 1 + 1 file changed, 1 insertion(+) diff --git a/osu.Game/Beatmaps/Formats/LegacyDifficultyCalculatorBeatmapDecoder.cs b/osu.Game/Beatmaps/Formats/LegacyDifficultyCalculatorBeatmapDecoder.cs index 61efd329c0..13a71aac3d 100644 --- a/osu.Game/Beatmaps/Formats/LegacyDifficultyCalculatorBeatmapDecoder.cs +++ b/osu.Game/Beatmaps/Formats/LegacyDifficultyCalculatorBeatmapDecoder.cs @@ -18,6 +18,7 @@ namespace osu.Game.Beatmaps.Formats public LegacyDifficultyCalculatorBeatmapDecoder(int version = LATEST_VERSION) : base(version) { + ApplyOffsets = false; } public new static void Register() From 83fd251c7b1f4d6f2ba4a31f551fc0548e81f4b0 Mon Sep 17 00:00:00 2001 From: smoogipoo Date: Thu, 11 Oct 2018 17:44:25 +0900 Subject: [PATCH 249/417] Pass sub-controlpoints as span slices --- .../TestCaseAutoJuiceStream.cs | 3 +- .../Objects/JuiceStream.cs | 2 +- osu.Game.Rulesets.Osu.Tests/TestCaseSlider.cs | 14 ++--- osu.Game.Rulesets.Osu/Mods/OsuModHardRock.cs | 6 +-- osu.Game.Rulesets.Osu/Objects/Slider.cs | 2 +- .../Visual/TestCaseHitObjectComposer.cs | 2 +- osu.Game.props | 2 +- .../Rulesets/Objects/BezierApproximator.cs | 9 ++-- .../Rulesets/Objects/CatmullApproximator.cs | 16 +++--- .../Objects/CircularArcApproximator.cs | 22 ++++---- .../Legacy/Catch/ConvertHitObjectParser.cs | 2 +- .../Objects/Legacy/ConvertHitObjectParser.cs | 24 ++++++--- .../Rulesets/Objects/Legacy/ConvertSlider.cs | 2 +- .../Legacy/Mania/ConvertHitObjectParser.cs | 2 +- .../Legacy/Osu/ConvertHitObjectParser.cs | 2 +- .../Legacy/Taiko/ConvertHitObjectParser.cs | 2 +- osu.Game/Rulesets/Objects/SliderCurve.cs | 51 ++++++++++++------- osu.Game/Rulesets/Objects/Types/IHasCurve.cs | 3 +- 18 files changed, 93 insertions(+), 73 deletions(-) diff --git a/osu.Game.Rulesets.Catch.Tests/TestCaseAutoJuiceStream.cs b/osu.Game.Rulesets.Catch.Tests/TestCaseAutoJuiceStream.cs index 34e07170bd..5e68acde94 100644 --- a/osu.Game.Rulesets.Catch.Tests/TestCaseAutoJuiceStream.cs +++ b/osu.Game.Rulesets.Catch.Tests/TestCaseAutoJuiceStream.cs @@ -1,7 +1,6 @@ // Copyright (c) 2007-2018 ppy Pty Ltd . // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE -using System.Collections.Generic; using System.Linq; using osu.Game.Beatmaps; using osu.Game.Rulesets.Catch.Objects; @@ -38,7 +37,7 @@ namespace osu.Game.Rulesets.Catch.Tests beatmap.HitObjects.Add(new JuiceStream { X = 0.5f - width / 2, - ControlPoints = new List + ControlPoints = new[] { Vector2.Zero, new Vector2(width * CatchPlayfield.BASE_WIDTH, 0) diff --git a/osu.Game.Rulesets.Catch/Objects/JuiceStream.cs b/osu.Game.Rulesets.Catch/Objects/JuiceStream.cs index 0344189af5..82e32d24d2 100644 --- a/osu.Game.Rulesets.Catch/Objects/JuiceStream.cs +++ b/osu.Game.Rulesets.Catch/Objects/JuiceStream.cs @@ -146,7 +146,7 @@ namespace osu.Game.Rulesets.Catch.Objects public SliderCurve Curve { get; } = new SliderCurve(); - public List ControlPoints + public Vector2[] ControlPoints { get { return Curve.ControlPoints; } set { Curve.ControlPoints = value; } diff --git a/osu.Game.Rulesets.Osu.Tests/TestCaseSlider.cs b/osu.Game.Rulesets.Osu.Tests/TestCaseSlider.cs index 3f9464a98f..300ac16155 100644 --- a/osu.Game.Rulesets.Osu.Tests/TestCaseSlider.cs +++ b/osu.Game.Rulesets.Osu.Tests/TestCaseSlider.cs @@ -108,7 +108,7 @@ namespace osu.Game.Rulesets.Osu.Tests { StartTime = Time.Current + 1000, Position = new Vector2(239, 176), - ControlPoints = new List + ControlPoints = new[] { Vector2.Zero, new Vector2(154, 28), @@ -141,7 +141,7 @@ namespace osu.Game.Rulesets.Osu.Tests { StartTime = Time.Current + 1000, Position = new Vector2(-(distance / 2), 0), - ControlPoints = new List + ControlPoints = new[] { Vector2.Zero, new Vector2(distance, 0), @@ -161,7 +161,7 @@ namespace osu.Game.Rulesets.Osu.Tests { StartTime = Time.Current + 1000, Position = new Vector2(-200, 0), - ControlPoints = new List + ControlPoints = new[] { Vector2.Zero, new Vector2(200, 200), @@ -184,7 +184,7 @@ namespace osu.Game.Rulesets.Osu.Tests CurveType = CurveType.Linear, StartTime = Time.Current + 1000, Position = new Vector2(-200, 0), - ControlPoints = new List + ControlPoints = new[] { Vector2.Zero, new Vector2(150, 75), @@ -210,7 +210,7 @@ namespace osu.Game.Rulesets.Osu.Tests CurveType = CurveType.Bezier, StartTime = Time.Current + 1000, Position = new Vector2(-200, 0), - ControlPoints = new List + ControlPoints = new[] { Vector2.Zero, new Vector2(150, 75), @@ -235,7 +235,7 @@ namespace osu.Game.Rulesets.Osu.Tests CurveType = CurveType.Linear, StartTime = Time.Current + 1000, Position = new Vector2(0, 0), - ControlPoints = new List + ControlPoints = new[] { Vector2.Zero, new Vector2(-200, 0), @@ -265,7 +265,7 @@ namespace osu.Game.Rulesets.Osu.Tests StartTime = Time.Current + 1000, Position = new Vector2(-100, 0), CurveType = CurveType.Catmull, - ControlPoints = new List + ControlPoints = new[] { Vector2.Zero, new Vector2(50, -50), diff --git a/osu.Game.Rulesets.Osu/Mods/OsuModHardRock.cs b/osu.Game.Rulesets.Osu/Mods/OsuModHardRock.cs index 7a30e6b134..1b3725a15e 100644 --- a/osu.Game.Rulesets.Osu/Mods/OsuModHardRock.cs +++ b/osu.Game.Rulesets.Osu/Mods/OsuModHardRock.cs @@ -1,7 +1,6 @@ // Copyright (c) 2007-2018 ppy Pty Ltd . // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE -using System.Collections.Generic; using System.Linq; using osu.Framework.Extensions.IEnumerableExtensions; using osu.Game.Rulesets.Mods; @@ -33,8 +32,9 @@ namespace osu.Game.Rulesets.Osu.Mods slider.NestedHitObjects.OfType().ForEach(h => h.Position = new Vector2(h.Position.X, OsuPlayfield.BASE_SIZE.Y - h.Position.Y)); slider.NestedHitObjects.OfType().ForEach(h => h.Position = new Vector2(h.Position.X, OsuPlayfield.BASE_SIZE.Y - h.Position.Y)); - var newControlPoints = new List(); - slider.ControlPoints.ForEach(c => newControlPoints.Add(new Vector2(c.X, -c.Y))); + var newControlPoints = new Vector2[slider.ControlPoints.Length]; + for (int i = 0; i < slider.ControlPoints.Length; i++) + newControlPoints[i] = new Vector2(slider.ControlPoints[i].X, -slider.ControlPoints[i].Y); slider.ControlPoints = newControlPoints; slider.Curve?.Calculate(); // Recalculate the slider curve diff --git a/osu.Game.Rulesets.Osu/Objects/Slider.cs b/osu.Game.Rulesets.Osu/Objects/Slider.cs index 7a0dcc77a6..c284335c98 100644 --- a/osu.Game.Rulesets.Osu/Objects/Slider.cs +++ b/osu.Game.Rulesets.Osu/Objects/Slider.cs @@ -52,7 +52,7 @@ namespace osu.Game.Rulesets.Osu.Objects public SliderCurve Curve { get; } = new SliderCurve(); - public List ControlPoints + public Vector2[] ControlPoints { get { return Curve.ControlPoints; } set { Curve.ControlPoints = value; } diff --git a/osu.Game.Tests/Visual/TestCaseHitObjectComposer.cs b/osu.Game.Tests/Visual/TestCaseHitObjectComposer.cs index 5df371dd09..a2bc28bc3c 100644 --- a/osu.Game.Tests/Visual/TestCaseHitObjectComposer.cs +++ b/osu.Game.Tests/Visual/TestCaseHitObjectComposer.cs @@ -44,7 +44,7 @@ namespace osu.Game.Tests.Visual new Slider { Position = new Vector2(128, 256), - ControlPoints = new List + ControlPoints = new[] { Vector2.Zero, new Vector2(216, 0), diff --git a/osu.Game.props b/osu.Game.props index ec859e64a5..4bcac479a0 100644 --- a/osu.Game.props +++ b/osu.Game.props @@ -1,7 +1,7 @@ - 7 + 7.2 ..\app.manifest diff --git a/osu.Game/Rulesets/Objects/BezierApproximator.cs b/osu.Game/Rulesets/Objects/BezierApproximator.cs index 6094934510..a1803e32f7 100644 --- a/osu.Game/Rulesets/Objects/BezierApproximator.cs +++ b/osu.Game/Rulesets/Objects/BezierApproximator.cs @@ -1,25 +1,26 @@ // Copyright (c) 2007-2018 ppy Pty Ltd . // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE +using System; using System.Collections.Generic; using OpenTK; namespace osu.Game.Rulesets.Objects { - public class BezierApproximator + public readonly ref struct BezierApproximator { private readonly int count; - private readonly List controlPoints; + private readonly ReadOnlySpan controlPoints; private readonly Vector2[] subdivisionBuffer1; private readonly Vector2[] subdivisionBuffer2; private const float tolerance = 0.25f; private const float tolerance_sq = tolerance * tolerance; - public BezierApproximator(List controlPoints) + public BezierApproximator(ReadOnlySpan controlPoints) { this.controlPoints = controlPoints; - count = controlPoints.Count; + count = controlPoints.Length; subdivisionBuffer1 = new Vector2[count]; subdivisionBuffer2 = new Vector2[count * 2 - 1]; diff --git a/osu.Game/Rulesets/Objects/CatmullApproximator.cs b/osu.Game/Rulesets/Objects/CatmullApproximator.cs index fabb55e8f6..78f8e471f3 100644 --- a/osu.Game/Rulesets/Objects/CatmullApproximator.cs +++ b/osu.Game/Rulesets/Objects/CatmullApproximator.cs @@ -1,40 +1,40 @@ // Copyright (c) 2007-2018 ppy Pty Ltd . // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE +using System; using System.Collections.Generic; using OpenTK; namespace osu.Game.Rulesets.Objects { - public class CatmullApproximator + public readonly ref struct CatmullApproximator { /// /// The amount of pieces to calculate for each controlpoint quadruplet. /// private const int detail = 50; - private readonly List controlPoints; + private readonly ReadOnlySpan controlPoints; - public CatmullApproximator(List controlPoints) + public CatmullApproximator(ReadOnlySpan controlPoints) { this.controlPoints = controlPoints; } - /// /// Creates a piecewise-linear approximation of a Catmull-Rom spline. /// /// A list of vectors representing the piecewise-linear approximation. public List CreateCatmull() { - var result = new List(); + var result = new List((controlPoints.Length - 1) * detail * 2); - for (int i = 0; i < controlPoints.Count - 1; i++) + for (int i = 0; i < controlPoints.Length - 1; i++) { var v1 = i > 0 ? controlPoints[i - 1] : controlPoints[i]; var v2 = controlPoints[i]; - var v3 = i < controlPoints.Count - 1 ? controlPoints[i + 1] : v2 + v2 - v1; - var v4 = i < controlPoints.Count - 2 ? controlPoints[i + 2] : v3 + v3 - v2; + var v3 = i < controlPoints.Length - 1 ? controlPoints[i + 1] : v2 + v2 - v1; + var v4 = i < controlPoints.Length - 2 ? controlPoints[i + 2] : v3 + v3 - v2; for (int c = 0; c < detail; c++) { diff --git a/osu.Game/Rulesets/Objects/CircularArcApproximator.cs b/osu.Game/Rulesets/Objects/CircularArcApproximator.cs index 7fb8d8a40e..28d7442aaf 100644 --- a/osu.Game/Rulesets/Objects/CircularArcApproximator.cs +++ b/osu.Game/Rulesets/Objects/CircularArcApproximator.cs @@ -8,21 +8,15 @@ using OpenTK; namespace osu.Game.Rulesets.Objects { - public class CircularArcApproximator + public readonly ref struct CircularArcApproximator { - private readonly Vector2 a; - private readonly Vector2 b; - private readonly Vector2 c; - - private int amountPoints; - private const float tolerance = 0.1f; - public CircularArcApproximator(Vector2 a, Vector2 b, Vector2 c) + private readonly ReadOnlySpan controlPoints; + + public CircularArcApproximator(ReadOnlySpan controlPoints) { - this.a = a; - this.b = b; - this.c = c; + this.controlPoints = controlPoints; } /// @@ -31,6 +25,10 @@ namespace osu.Game.Rulesets.Objects /// A list of vectors representing the piecewise-linear approximation. public List CreateArc() { + Vector2 a = controlPoints[0]; + Vector2 b = controlPoints[1]; + Vector2 c = controlPoints[2]; + float aSq = (b - c).LengthSquared; float bSq = (a - c).LengthSquared; float cSq = (a - b).LengthSquared; @@ -81,7 +79,7 @@ namespace osu.Game.Rulesets.Objects // is: 2 * Math.Acos(1 - TOLERANCE / r) // The special case is required for extremely short sliders where the radius is smaller than // the tolerance. This is a pathological rather than a realistic case. - amountPoints = 2 * r <= tolerance ? 2 : Math.Max(2, (int)Math.Ceiling(thetaRange / (2 * Math.Acos(1 - tolerance / r)))); + int amountPoints = 2 * r <= tolerance ? 2 : Math.Max(2, (int)Math.Ceiling(thetaRange / (2 * Math.Acos(1 - tolerance / r)))); List output = new List(amountPoints); diff --git a/osu.Game/Rulesets/Objects/Legacy/Catch/ConvertHitObjectParser.cs b/osu.Game/Rulesets/Objects/Legacy/Catch/ConvertHitObjectParser.cs index 802080aedb..9c9fc2e742 100644 --- a/osu.Game/Rulesets/Objects/Legacy/Catch/ConvertHitObjectParser.cs +++ b/osu.Game/Rulesets/Objects/Legacy/Catch/ConvertHitObjectParser.cs @@ -37,7 +37,7 @@ namespace osu.Game.Rulesets.Objects.Legacy.Catch }; } - protected override HitObject CreateSlider(Vector2 position, bool newCombo, int comboOffset, List controlPoints, double length, CurveType curveType, int repeatCount, List> repeatSamples) + protected override HitObject CreateSlider(Vector2 position, bool newCombo, int comboOffset, Vector2[] controlPoints, double length, CurveType curveType, int repeatCount, List> repeatSamples) { newCombo |= forceNewCombo; comboOffset += extraComboOffset; diff --git a/osu.Game/Rulesets/Objects/Legacy/ConvertHitObjectParser.cs b/osu.Game/Rulesets/Objects/Legacy/ConvertHitObjectParser.cs index 72168a4cd2..965e76d27a 100644 --- a/osu.Game/Rulesets/Objects/Legacy/ConvertHitObjectParser.cs +++ b/osu.Game/Rulesets/Objects/Legacy/ConvertHitObjectParser.cs @@ -72,10 +72,18 @@ namespace osu.Game.Rulesets.Objects.Legacy { CurveType curveType = CurveType.Catmull; double length = 0; - var points = new List { Vector2.Zero }; - string[] pointsplit = split[5].Split('|'); - foreach (string t in pointsplit) + string[] pointSplit = split[5].Split('|'); + + int pointCount = 1; + foreach (var t in pointSplit) + if (t.Length > 1) + pointCount++; + + var points = new Vector2[pointCount]; + + int pointIndex = 1; + foreach (string t in pointSplit) { if (t.Length == 1) { @@ -94,16 +102,18 @@ namespace osu.Game.Rulesets.Objects.Legacy curveType = CurveType.PerfectCurve; break; } + continue; } string[] temp = t.Split(':'); - points.Add(new Vector2((int)Convert.ToDouble(temp[0], CultureInfo.InvariantCulture), (int)Convert.ToDouble(temp[1], CultureInfo.InvariantCulture)) - pos); + points[pointIndex++] = new Vector2((int)Convert.ToDouble(temp[0], CultureInfo.InvariantCulture), (int)Convert.ToDouble(temp[1], CultureInfo.InvariantCulture)) - pos; } // osu-stable special-cased colinear perfect curves to a CurveType.Linear - bool isLinear(List p) => Precision.AlmostEquals(0, (p[1].Y - p[0].Y) * (p[2].X - p[0].X) - (p[1].X - p[0].X) * (p[2].Y - p[0].Y)); - if (points.Count == 3 && curveType == CurveType.PerfectCurve && isLinear(points)) + bool isLinear(Vector2[] p) => Precision.AlmostEquals(0, (p[1].Y - p[0].Y) * (p[2].X - p[0].X) - (p[1].X - p[0].X) * (p[2].Y - p[0].Y)); + + if (points.Length == 3 && curveType == CurveType.PerfectCurve && isLinear(points)) curveType = CurveType.Linear; int repeatCount = Convert.ToInt32(split[6], CultureInfo.InvariantCulture); @@ -262,7 +272,7 @@ namespace osu.Game.Rulesets.Objects.Legacy /// The slider repeat count. /// The samples to be played when the repeat nodes are hit. This includes the head and tail of the slider. /// The hit object. - protected abstract HitObject CreateSlider(Vector2 position, bool newCombo, int comboOffset, List controlPoints, double length, CurveType curveType, int repeatCount, List> repeatSamples); + protected abstract HitObject CreateSlider(Vector2 position, bool newCombo, int comboOffset, Vector2[] controlPoints, double length, CurveType curveType, int repeatCount, List> repeatSamples); /// /// Creates a legacy Spinner-type hit object. diff --git a/osu.Game/Rulesets/Objects/Legacy/ConvertSlider.cs b/osu.Game/Rulesets/Objects/Legacy/ConvertSlider.cs index ef1eecec3d..93c49ea3ce 100644 --- a/osu.Game/Rulesets/Objects/Legacy/ConvertSlider.cs +++ b/osu.Game/Rulesets/Objects/Legacy/ConvertSlider.cs @@ -21,7 +21,7 @@ namespace osu.Game.Rulesets.Objects.Legacy /// s don't need a curve since they're converted to ruleset-specific hitobjects. /// public SliderCurve Curve { get; } = null; - public List ControlPoints { get; set; } + public Vector2[] ControlPoints { get; set; } public CurveType CurveType { get; set; } public double Distance { get; set; } diff --git a/osu.Game/Rulesets/Objects/Legacy/Mania/ConvertHitObjectParser.cs b/osu.Game/Rulesets/Objects/Legacy/Mania/ConvertHitObjectParser.cs index 6f59965e18..68e05f6223 100644 --- a/osu.Game/Rulesets/Objects/Legacy/Mania/ConvertHitObjectParser.cs +++ b/osu.Game/Rulesets/Objects/Legacy/Mania/ConvertHitObjectParser.cs @@ -26,7 +26,7 @@ namespace osu.Game.Rulesets.Objects.Legacy.Mania }; } - protected override HitObject CreateSlider(Vector2 position, bool newCombo, int comboOffset, List controlPoints, double length, CurveType curveType, int repeatCount, List> repeatSamples) + protected override HitObject CreateSlider(Vector2 position, bool newCombo, int comboOffset, Vector2[] controlPoints, double length, CurveType curveType, int repeatCount, List> repeatSamples) { return new ConvertSlider { diff --git a/osu.Game/Rulesets/Objects/Legacy/Osu/ConvertHitObjectParser.cs b/osu.Game/Rulesets/Objects/Legacy/Osu/ConvertHitObjectParser.cs index acd0de8688..f3c815fc32 100644 --- a/osu.Game/Rulesets/Objects/Legacy/Osu/ConvertHitObjectParser.cs +++ b/osu.Game/Rulesets/Objects/Legacy/Osu/ConvertHitObjectParser.cs @@ -38,7 +38,7 @@ namespace osu.Game.Rulesets.Objects.Legacy.Osu }; } - protected override HitObject CreateSlider(Vector2 position, bool newCombo, int comboOffset, List controlPoints, double length, CurveType curveType, int repeatCount, List> repeatSamples) + protected override HitObject CreateSlider(Vector2 position, bool newCombo, int comboOffset, Vector2[] controlPoints, double length, CurveType curveType, int repeatCount, List> repeatSamples) { newCombo |= forceNewCombo; comboOffset += extraComboOffset; diff --git a/osu.Game/Rulesets/Objects/Legacy/Taiko/ConvertHitObjectParser.cs b/osu.Game/Rulesets/Objects/Legacy/Taiko/ConvertHitObjectParser.cs index e5904825c2..985a032640 100644 --- a/osu.Game/Rulesets/Objects/Legacy/Taiko/ConvertHitObjectParser.cs +++ b/osu.Game/Rulesets/Objects/Legacy/Taiko/ConvertHitObjectParser.cs @@ -23,7 +23,7 @@ namespace osu.Game.Rulesets.Objects.Legacy.Taiko return new ConvertHit(); } - protected override HitObject CreateSlider(Vector2 position, bool newCombo, int comboOffset, List controlPoints, double length, CurveType curveType, int repeatCount, List> repeatSamples) + protected override HitObject CreateSlider(Vector2 position, bool newCombo, int comboOffset, Vector2[] controlPoints, double length, CurveType curveType, int repeatCount, List> repeatSamples) { return new ConvertSlider { diff --git a/osu.Game/Rulesets/Objects/SliderCurve.cs b/osu.Game/Rulesets/Objects/SliderCurve.cs index 3932d8ed9d..60f7901a48 100644 --- a/osu.Game/Rulesets/Objects/SliderCurve.cs +++ b/osu.Game/Rulesets/Objects/SliderCurve.cs @@ -1,6 +1,7 @@ // Copyright (c) 2007-2018 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 osu.Framework.MathUtils; @@ -13,7 +14,7 @@ namespace osu.Game.Rulesets.Objects { public double Distance; - public List ControlPoints; + public Vector2[] ControlPoints; public CurveType CurveType = CurveType.PerfectCurve; @@ -22,19 +23,17 @@ namespace osu.Game.Rulesets.Objects private readonly List calculatedPath = new List(); private readonly List cumulativeLength = new List(); - private List calculateSubpath(List subControlPoints) + private List calculateSubpath(ReadOnlySpan subControlPoints) { switch (CurveType) { - case CurveType.Linear: - return subControlPoints; case CurveType.PerfectCurve: //we can only use CircularArc iff we have exactly three control points and no dissection. - if (ControlPoints.Count != 3 || subControlPoints.Count != 3) + if (ControlPoints.Length != 3 || subControlPoints.Length != 3) break; // Here we have exactly 3 control points. Attempt to fit a circular arc. - List subpath = new CircularArcApproximator(subControlPoints[0], subControlPoints[1], subControlPoints[2]).CreateArc(); + List subpath = new CircularArcApproximator(subControlPoints).CreateArc(); // If for some reason a circular arc could not be fit to the 3 given points, fall back to a numerically stable bezier approximation. if (subpath.Count == 0) @@ -55,18 +54,32 @@ namespace osu.Game.Rulesets.Objects // Sliders may consist of various subpaths separated by two consecutive vertices // with the same position. The following loop parses these subpaths and computes // their shape independently, consecutively appending them to calculatedPath. - List subControlPoints = new List(); - for (int i = 0; i < ControlPoints.Count; ++i) - { - subControlPoints.Add(ControlPoints[i]); - if (i == ControlPoints.Count - 1 || ControlPoints[i] == ControlPoints[i + 1]) - { - List subpath = calculateSubpath(subControlPoints); - foreach (Vector2 t in subpath) - if (calculatedPath.Count == 0 || calculatedPath.Last() != t) - calculatedPath.Add(t); - subControlPoints.Clear(); + int start = 0; + int end = 0; + + for (int i = 0; i < ControlPoints.Length; ++i) + { + end++; + + if (i == ControlPoints.Length - 1 || ControlPoints[i] == ControlPoints[i + 1]) + { + ReadOnlySpan cpSpan = ControlPoints.AsSpan().Slice(start, end - start); + + if (CurveType == CurveType.Linear) + { + foreach (var t in cpSpan) + if (calculatedPath.Count == 0 || calculatedPath.Last() != t) + calculatedPath.Add(t); + } + else + { + foreach (Vector2 t in calculateSubpath(cpSpan)) + if (calculatedPath.Count == 0 || calculatedPath.Last() != t) + calculatedPath.Add(t); + } + + start = end; } } } @@ -166,7 +179,7 @@ namespace osu.Game.Rulesets.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) + if (calculatedPath.Count == 0 && ControlPoints.Length > 0) Calculate(); double d0 = progressToDistance(p0); @@ -193,7 +206,7 @@ namespace osu.Game.Rulesets.Objects /// public Vector2 PositionAt(double progress) { - if (calculatedPath.Count == 0 && ControlPoints.Count > 0) + if (calculatedPath.Count == 0 && ControlPoints.Length > 0) Calculate(); double d = progressToDistance(progress); diff --git a/osu.Game/Rulesets/Objects/Types/IHasCurve.cs b/osu.Game/Rulesets/Objects/Types/IHasCurve.cs index 54dcb26ae2..69b2f722e7 100644 --- a/osu.Game/Rulesets/Objects/Types/IHasCurve.cs +++ b/osu.Game/Rulesets/Objects/Types/IHasCurve.cs @@ -1,7 +1,6 @@ // Copyright (c) 2007-2018 ppy Pty Ltd . // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE -using System.Collections.Generic; using OpenTK; namespace osu.Game.Rulesets.Objects.Types @@ -19,7 +18,7 @@ namespace osu.Game.Rulesets.Objects.Types /// /// The control points that shape the curve. /// - List ControlPoints { get; } + Vector2[] ControlPoints { get; } /// /// The type of curve. From bd99a872988ba09a33ab837c3187abb34e78a3f6 Mon Sep 17 00:00:00 2001 From: smoogipoo Date: Thu, 11 Oct 2018 17:48:47 +0900 Subject: [PATCH 250/417] Use ordinal comparison in LegacyBeatmapDecoder --- osu.Game/Beatmaps/Formats/LegacyBeatmapDecoder.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu.Game/Beatmaps/Formats/LegacyBeatmapDecoder.cs b/osu.Game/Beatmaps/Formats/LegacyBeatmapDecoder.cs index 5b5bc5d936..d9f72315ee 100644 --- a/osu.Game/Beatmaps/Formats/LegacyBeatmapDecoder.cs +++ b/osu.Game/Beatmaps/Formats/LegacyBeatmapDecoder.cs @@ -58,7 +58,7 @@ namespace osu.Game.Beatmaps.Formats hitObject.ApplyDefaults(this.beatmap.ControlPointInfo, this.beatmap.BeatmapInfo.BaseDifficulty); } - protected override bool ShouldSkipLine(string line) => base.ShouldSkipLine(line) || line.StartsWith(" ") || line.StartsWith("_"); + protected override bool ShouldSkipLine(string line) => base.ShouldSkipLine(line) || line.StartsWith(" ", StringComparison.Ordinal) || line.StartsWith("_", StringComparison.Ordinal); protected override void ParseLine(Beatmap beatmap, Section section, string line) { From 5b544a0c97bf8fe29d93897abe4ba2a38244d3b2 Mon Sep 17 00:00:00 2001 From: smoogipoo Date: Thu, 11 Oct 2018 18:09:19 +0900 Subject: [PATCH 251/417] Remove allocation of string.IndexOf() --- osu.Game/Beatmaps/Formats/LegacyDecoder.cs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/osu.Game/Beatmaps/Formats/LegacyDecoder.cs b/osu.Game/Beatmaps/Formats/LegacyDecoder.cs index a9e1e4c55d..db1fe6b2ed 100644 --- a/osu.Game/Beatmaps/Formats/LegacyDecoder.cs +++ b/osu.Game/Beatmaps/Formats/LegacyDecoder.cs @@ -69,7 +69,9 @@ namespace osu.Game.Beatmaps.Formats protected string StripComments(string line) { - var index = line.IndexOf("//", StringComparison.Ordinal); + const string comment_prefix = "//"; + + var index = line.AsSpan().IndexOf(comment_prefix.AsSpan()); if (index > 0) return line.Substring(0, index); return line; From 10fb1d20d1c4498ec232d91f2ffdc8781ebeae61 Mon Sep 17 00:00:00 2001 From: smoogipoo Date: Thu, 11 Oct 2018 18:38:04 +0900 Subject: [PATCH 252/417] Remove allocation of control point with every binarysearch --- .../Beatmaps/ControlPoints/ControlPointInfo.cs | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/osu.Game/Beatmaps/ControlPoints/ControlPointInfo.cs b/osu.Game/Beatmaps/ControlPoints/ControlPointInfo.cs index dad69321a5..2be7f4e16d 100644 --- a/osu.Game/Beatmaps/ControlPoints/ControlPointInfo.cs +++ b/osu.Game/Beatmaps/ControlPoints/ControlPointInfo.cs @@ -12,6 +12,11 @@ namespace osu.Game.Beatmaps.ControlPoints [Serializable] public class ControlPointInfo { + private readonly TimingControlPoint timingPointSearch = new TimingControlPoint(); + private readonly DifficultyControlPoint difficultyPointSearch = new DifficultyControlPoint(); + private readonly SampleControlPoint samplePointSearch = new SampleControlPoint(); + private readonly EffectControlPoint effectPointSearch = new EffectControlPoint(); + /// /// All timing points. /// @@ -41,28 +46,28 @@ namespace osu.Game.Beatmaps.ControlPoints /// /// The time to find the difficulty control point at. /// The difficulty control point. - public DifficultyControlPoint DifficultyPointAt(double time) => binarySearch(DifficultyPoints, time); + public DifficultyControlPoint DifficultyPointAt(double time) => binarySearch(DifficultyPoints, time, difficultyPointSearch); /// /// Finds the effect control point that is active at . /// /// The time to find the effect control point at. /// The effect control point. - public EffectControlPoint EffectPointAt(double time) => binarySearch(EffectPoints, time); + public EffectControlPoint EffectPointAt(double time) => binarySearch(EffectPoints, time, effectPointSearch); /// /// Finds the sound control point that is active at . /// /// The time to find the sound control point at. /// The sound control point. - public SampleControlPoint SamplePointAt(double time) => binarySearch(SamplePoints, time, SamplePoints.FirstOrDefault()); + public SampleControlPoint SamplePointAt(double time) => binarySearch(SamplePoints, time, samplePointSearch, SamplePoints.FirstOrDefault()); /// /// Finds the timing control point that is active at . /// /// The time to find the timing control point at. /// The timing control point. - public TimingControlPoint TimingPointAt(double time) => binarySearch(TimingPoints, time, TimingPoints.FirstOrDefault()); + public TimingControlPoint TimingPointAt(double time) => binarySearch(TimingPoints, time, timingPointSearch, TimingPoints.FirstOrDefault()); /// /// Finds the maximum BPM represented by any timing control point. @@ -92,7 +97,7 @@ namespace osu.Game.Beatmaps.ControlPoints /// The time to find the control point at. /// The control point to use when is before any control points. If null, a new control point will be constructed. /// The active control point at . - private T binarySearch(SortedList list, double time, T prePoint = null) + private T binarySearch(SortedList list, double time, T searchPoint, T prePoint = null) where T : ControlPoint, new() { if (list == null) @@ -104,7 +109,8 @@ namespace osu.Game.Beatmaps.ControlPoints if (time < list[0].Time) return prePoint ?? new T(); - int index = list.BinarySearch(new T { Time = time }); + searchPoint.Time = time; + int index = list.BinarySearch(searchPoint); // Check if we've found an exact match (t == time) if (index >= 0) From 7b2a30f5b4624481cd5ab23bb3e9b59d6712ac79 Mon Sep 17 00:00:00 2001 From: smoogipoo Date: Thu, 11 Oct 2018 19:52:03 +0900 Subject: [PATCH 253/417] Reduce some high-profile enumerator allocations --- osu.Game/Beatmaps/ControlPoints/ControlPointInfo.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/osu.Game/Beatmaps/ControlPoints/ControlPointInfo.cs b/osu.Game/Beatmaps/ControlPoints/ControlPointInfo.cs index 2be7f4e16d..db5574e5ce 100644 --- a/osu.Game/Beatmaps/ControlPoints/ControlPointInfo.cs +++ b/osu.Game/Beatmaps/ControlPoints/ControlPointInfo.cs @@ -60,14 +60,14 @@ namespace osu.Game.Beatmaps.ControlPoints /// /// The time to find the sound control point at. /// The sound control point. - public SampleControlPoint SamplePointAt(double time) => binarySearch(SamplePoints, time, samplePointSearch, SamplePoints.FirstOrDefault()); + public SampleControlPoint SamplePointAt(double time) => binarySearch(SamplePoints, time, samplePointSearch, SamplePoints.Count > 0 ? SamplePoints[0] : null); /// /// Finds the timing control point that is active at . /// /// The time to find the timing control point at. /// The timing control point. - public TimingControlPoint TimingPointAt(double time) => binarySearch(TimingPoints, time, timingPointSearch, TimingPoints.FirstOrDefault()); + public TimingControlPoint TimingPointAt(double time) => binarySearch(TimingPoints, time, timingPointSearch, TimingPoints.Count > 0 ? TimingPoints[0] : null); /// /// Finds the maximum BPM represented by any timing control point. From ec9f23ab73849fff9b626f935b3e2c8ffbbc9b4e Mon Sep 17 00:00:00 2001 From: smoogipoo Date: Thu, 11 Oct 2018 19:53:07 +0900 Subject: [PATCH 254/417] Make IBeatmap.HitObjects an IReadOnlyList --- osu.Game.Rulesets.Mania/Beatmaps/ManiaBeatmapConverter.cs | 2 +- .../Beatmaps/Patterns/Legacy/PatternGenerator.cs | 2 +- osu.Game.Rulesets.Osu/Difficulty/OsuDifficultyCalculator.cs | 2 +- osu.Game.Rulesets.Osu/Difficulty/OsuPerformanceCalculator.cs | 2 +- osu.Game/Beatmaps/Beatmap.cs | 2 +- osu.Game/Beatmaps/IBeatmap.cs | 2 +- 6 files changed, 6 insertions(+), 6 deletions(-) diff --git a/osu.Game.Rulesets.Mania/Beatmaps/ManiaBeatmapConverter.cs b/osu.Game.Rulesets.Mania/Beatmaps/ManiaBeatmapConverter.cs index c15b303048..5d8480d969 100644 --- a/osu.Game.Rulesets.Mania/Beatmaps/ManiaBeatmapConverter.cs +++ b/osu.Game.Rulesets.Mania/Beatmaps/ManiaBeatmapConverter.cs @@ -48,7 +48,7 @@ namespace osu.Game.Rulesets.Mania.Beatmaps TargetColumns = (int)Math.Max(1, roundedCircleSize); else { - float percentSliderOrSpinner = (float)beatmap.HitObjects.Count(h => h is IHasEndTime) / beatmap.HitObjects.Count(); + float percentSliderOrSpinner = (float)beatmap.HitObjects.Count(h => h is IHasEndTime) / beatmap.HitObjects.Count; if (percentSliderOrSpinner < 0.2) TargetColumns = 7; else if (percentSliderOrSpinner < 0.3 || roundedCircleSize >= 5) diff --git a/osu.Game.Rulesets.Mania/Beatmaps/Patterns/Legacy/PatternGenerator.cs b/osu.Game.Rulesets.Mania/Beatmaps/Patterns/Legacy/PatternGenerator.cs index 05ca1d4365..7bd39adb45 100644 --- a/osu.Game.Rulesets.Mania/Beatmaps/Patterns/Legacy/PatternGenerator.cs +++ b/osu.Game.Rulesets.Mania/Beatmaps/Patterns/Legacy/PatternGenerator.cs @@ -112,7 +112,7 @@ namespace osu.Game.Rulesets.Mania.Beatmaps.Patterns.Legacy drainTime = 10000; BeatmapDifficulty difficulty = OriginalBeatmap.BeatmapInfo.BaseDifficulty; - conversionDifficulty = ((difficulty.DrainRate + MathHelper.Clamp(difficulty.ApproachRate, 4, 7)) / 1.5 + (double)OriginalBeatmap.HitObjects.Count() / drainTime * 9f) / 38f * 5f / 1.15; + conversionDifficulty = ((difficulty.DrainRate + MathHelper.Clamp(difficulty.ApproachRate, 4, 7)) / 1.5 + (double)OriginalBeatmap.HitObjects.Count / drainTime * 9f) / 38f * 5f / 1.15; conversionDifficulty = Math.Min(conversionDifficulty.Value, 12); return conversionDifficulty.Value; diff --git a/osu.Game.Rulesets.Osu/Difficulty/OsuDifficultyCalculator.cs b/osu.Game.Rulesets.Osu/Difficulty/OsuDifficultyCalculator.cs index 028e3acc57..8fc2b69267 100644 --- a/osu.Game.Rulesets.Osu/Difficulty/OsuDifficultyCalculator.cs +++ b/osu.Game.Rulesets.Osu/Difficulty/OsuDifficultyCalculator.cs @@ -65,7 +65,7 @@ namespace osu.Game.Rulesets.Osu.Difficulty double hitWindowGreat = (int)(beatmap.HitObjects.First().HitWindows.Great / 2) / timeRate; double preempt = (int)BeatmapDifficulty.DifficultyRange(beatmap.BeatmapInfo.BaseDifficulty.ApproachRate, 1800, 1200, 450) / timeRate; - int maxCombo = beatmap.HitObjects.Count(); + int maxCombo = beatmap.HitObjects.Count; // Add the ticks + tail of the slider. 1 is subtracted because the head circle would be counted twice (once for the slider itself in the line above) maxCombo += beatmap.HitObjects.OfType().Sum(s => s.NestedHitObjects.Count - 1); diff --git a/osu.Game.Rulesets.Osu/Difficulty/OsuPerformanceCalculator.cs b/osu.Game.Rulesets.Osu/Difficulty/OsuPerformanceCalculator.cs index d4a60dd52f..b0887ac72b 100644 --- a/osu.Game.Rulesets.Osu/Difficulty/OsuPerformanceCalculator.cs +++ b/osu.Game.Rulesets.Osu/Difficulty/OsuPerformanceCalculator.cs @@ -34,7 +34,7 @@ namespace osu.Game.Rulesets.Osu.Difficulty { countHitCircles = Beatmap.HitObjects.Count(h => h is HitCircle); - beatmapMaxCombo = Beatmap.HitObjects.Count(); + beatmapMaxCombo = Beatmap.HitObjects.Count; // Add the ticks + tail of the slider. 1 is subtracted because the "headcircle" would be counted twice (once for the slider itself in the line above) beatmapMaxCombo += Beatmap.HitObjects.OfType().Sum(s => s.NestedHitObjects.Count - 1); } diff --git a/osu.Game/Beatmaps/Beatmap.cs b/osu.Game/Beatmaps/Beatmap.cs index 9aabb434a3..4ef7b28d49 100644 --- a/osu.Game/Beatmaps/Beatmap.cs +++ b/osu.Game/Beatmaps/Beatmap.cs @@ -48,7 +48,7 @@ namespace osu.Game.Beatmaps [JsonConverter(typeof(TypedListConverter))] public List HitObjects = new List(); - IEnumerable IBeatmap.HitObjects => HitObjects; + IReadOnlyList IBeatmap.HitObjects => HitObjects; public virtual IEnumerable GetStatistics() => Enumerable.Empty(); diff --git a/osu.Game/Beatmaps/IBeatmap.cs b/osu.Game/Beatmaps/IBeatmap.cs index fe20bce98a..3d8b94dc46 100644 --- a/osu.Game/Beatmaps/IBeatmap.cs +++ b/osu.Game/Beatmaps/IBeatmap.cs @@ -39,7 +39,7 @@ namespace osu.Game.Beatmaps /// /// The hitobjects contained by this beatmap. /// - IEnumerable HitObjects { get; } + IReadOnlyList HitObjects { get; } /// /// Returns statistics for the contained in this beatmap. From fb1760f580ca6c6ec90526f6dd3fd7398e9decdb Mon Sep 17 00:00:00 2001 From: smoogipoo Date: Thu, 11 Oct 2018 20:29:26 +0900 Subject: [PATCH 255/417] Simplify linq from beatmap conversion --- osu.Game/Beatmaps/BeatmapConverter.cs | 43 +++++++++++++-------------- 1 file changed, 21 insertions(+), 22 deletions(-) diff --git a/osu.Game/Beatmaps/BeatmapConverter.cs b/osu.Game/Beatmaps/BeatmapConverter.cs index a1bb70135a..6496a84803 100644 --- a/osu.Game/Beatmaps/BeatmapConverter.cs +++ b/osu.Game/Beatmaps/BeatmapConverter.cs @@ -55,39 +55,38 @@ namespace osu.Game.Beatmaps beatmap.BeatmapInfo = original.BeatmapInfo; beatmap.ControlPointInfo = original.ControlPointInfo; - beatmap.HitObjects = original.HitObjects.SelectMany(h => convert(h, original)).ToList(); + beatmap.HitObjects = convertHitObjects(original.HitObjects, original); beatmap.Breaks = original.Breaks; return beatmap; } - /// - /// Converts a hit object. - /// - /// The hit object to convert. - /// The un-converted Beatmap. - /// The converted hit object. - private IEnumerable convert(HitObject original, IBeatmap beatmap) + private List convertHitObjects(IReadOnlyList hitObjects, IBeatmap beatmap) { - // Check if the hitobject is already the converted type - T tObject = original as T; - if (tObject != null) - { - yield return tObject; - yield break; - } + var result = new List(hitObjects.Count); - var converted = ConvertHitObject(original, beatmap).ToList(); - ObjectConverted?.Invoke(original, converted); - - // Convert the hit object - foreach (var obj in converted) + // ReSharper disable once ForCanBeConvertedToForeach + foreach (var obj in hitObjects) { - if (obj == null) + if (obj is T tObj) + { + result.Add(tObj); continue; + } - yield return obj; + var converted = ConvertHitObject(obj, beatmap); + + // Note: This will not perform .ToList() if ObjectConverted is null + ObjectConverted?.Invoke(obj, converted.ToList()); + + foreach (var c in converted) + { + if (c != null) + result.Add(c); + } } + + return result; } /// From d282d16e1cb31595e4e140d8a49179a182ee8c98 Mon Sep 17 00:00:00 2001 From: smoogipoo Date: Thu, 11 Oct 2018 20:49:12 +0900 Subject: [PATCH 256/417] Use SortedList again --- osu.Game/Rulesets/Objects/HitObject.cs | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/osu.Game/Rulesets/Objects/HitObject.cs b/osu.Game/Rulesets/Objects/HitObject.cs index 67a3db7a00..f5613e927f 100644 --- a/osu.Game/Rulesets/Objects/HitObject.cs +++ b/osu.Game/Rulesets/Objects/HitObject.cs @@ -3,6 +3,7 @@ using System.Collections.Generic; using Newtonsoft.Json; +using osu.Framework.Lists; using osu.Game.Audio; using osu.Game.Beatmaps; using osu.Game.Beatmaps.ControlPoints; @@ -55,7 +56,7 @@ namespace osu.Game.Rulesets.Objects /// public HitWindows HitWindows { get; set; } - private readonly List nestedHitObjects = new List(); + private readonly SortedList nestedHitObjects = new SortedList(compareObjects); [JsonIgnore] public IReadOnlyList NestedHitObjects => nestedHitObjects; @@ -73,8 +74,6 @@ namespace osu.Game.Rulesets.Objects CreateNestedHitObjects(); - nestedHitObjects.Sort((h1, h2) => h1.StartTime.CompareTo(h2.StartTime)); - foreach (var h in nestedHitObjects) { h.HitWindows = HitWindows; @@ -115,5 +114,7 @@ namespace osu.Game.Rulesets.Objects /// /// protected virtual HitWindows CreateHitWindows() => new HitWindows(); + + private static int compareObjects(HitObject first, HitObject second) => first.StartTime.CompareTo(second.StartTime); } } From c52a2929352280e75c32396db4a5a2ce2c9be413 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Fri, 12 Oct 2018 16:10:32 +0900 Subject: [PATCH 257/417] Update framework --- osu.Game/osu.Game.csproj | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu.Game/osu.Game.csproj b/osu.Game/osu.Game.csproj index 66bae277b3..9ff79550fa 100644 --- a/osu.Game/osu.Game.csproj +++ b/osu.Game/osu.Game.csproj @@ -18,7 +18,7 @@ - + From 72c8ae8705bae27510e112b311237f3df4ff749a Mon Sep 17 00:00:00 2001 From: smoogipoo Date: Fri, 12 Oct 2018 16:47:18 +0900 Subject: [PATCH 258/417] Port the old stacking algorithm --- .../Beatmaps/OsuBeatmapProcessor.cs | 55 ++++++++++++++++--- 1 file changed, 48 insertions(+), 7 deletions(-) diff --git a/osu.Game.Rulesets.Osu/Beatmaps/OsuBeatmapProcessor.cs b/osu.Game.Rulesets.Osu/Beatmaps/OsuBeatmapProcessor.cs index cfb1b0f050..db80948c94 100644 --- a/osu.Game.Rulesets.Osu/Beatmaps/OsuBeatmapProcessor.cs +++ b/osu.Game.Rulesets.Osu/Beatmaps/OsuBeatmapProcessor.cs @@ -10,6 +10,8 @@ namespace osu.Game.Rulesets.Osu.Beatmaps { public class OsuBeatmapProcessor : BeatmapProcessor { + private const int stack_distance = 3; + public OsuBeatmapProcessor(IBeatmap beatmap) : base(beatmap) { @@ -18,17 +20,21 @@ namespace osu.Game.Rulesets.Osu.Beatmaps public override void PostProcess() { base.PostProcess(); - applyStacking((Beatmap)Beatmap); + + var osuBeatmap = (Beatmap)Beatmap; + + // Reset stacking + foreach (var h in osuBeatmap.HitObjects) + h.StackHeight = 0; + + if (Beatmap.BeatmapInfo.BeatmapVersion >= 6) + applyStacking(osuBeatmap); + else + applyStackingOld(osuBeatmap); } private void applyStacking(Beatmap beatmap) { - const int stack_distance = 3; - - // Reset stacking - for (int i = 0; i <= beatmap.HitObjects.Count - 1; i++) - beatmap.HitObjects[i].StackHeight = 0; - // Extend the end index to include objects they are stacked on int extendedEndIndex = beatmap.HitObjects.Count - 1; for (int i = beatmap.HitObjects.Count - 1; i >= 0; i--) @@ -167,5 +173,40 @@ namespace osu.Game.Rulesets.Osu.Beatmaps } } } + + private void applyStackingOld(Beatmap beatmap) + { + for (int i = 0; i < beatmap.HitObjects.Count; i++) + { + OsuHitObject currHitObject = beatmap.HitObjects[i]; + + if (currHitObject.StackHeight != 0 && !(currHitObject is Slider)) + continue; + + double startTime = (currHitObject as IHasEndTime)?.EndTime ?? currHitObject.StartTime; + int sliderStack = 0; + + for (int j = i + 1; j < beatmap.HitObjects.Count; j++) + { + double stackThreshold = beatmap.HitObjects[i].TimePreempt * beatmap.BeatmapInfo.StackLeniency; + + if (beatmap.HitObjects[j].StartTime - stackThreshold > startTime) + break; + + if (Vector2Extensions.Distance(beatmap.HitObjects[j].Position, currHitObject.Position) < stack_distance) + { + currHitObject.StackHeight++; + startTime = (beatmap.HitObjects[j] as IHasEndTime)?.EndTime ?? beatmap.HitObjects[i].StartTime; + } + else if (Vector2Extensions.Distance(beatmap.HitObjects[j].Position, currHitObject.EndPosition) < stack_distance) + { + //Case for sliders - bump notes down and right, rather than up and left. + sliderStack++; + beatmap.HitObjects[j].StackHeight -= sliderStack; + startTime = (beatmap.HitObjects[j] as IHasEndTime)?.EndTime ?? beatmap.HitObjects[i].StartTime; + } + } + } + } } } From 182aa63cc8acd7637d91cf95dd6bb685f2c59373 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Fri, 12 Oct 2018 17:08:59 +0900 Subject: [PATCH 259/417] Update nuget dependencies --- osu.Desktop/osu.Desktop.csproj | 6 +++--- .../osu.Game.Rulesets.Catch.Tests.csproj | 4 ++-- .../osu.Game.Rulesets.Mania.Tests.csproj | 2 +- .../osu.Game.Rulesets.Osu.Tests.csproj | 2 +- .../osu.Game.Rulesets.Taiko.Tests.csproj | 2 +- osu.Game.Tests/osu.Game.Tests.csproj | 2 +- osu.Game/osu.Game.csproj | 6 +++--- 7 files changed, 12 insertions(+), 12 deletions(-) diff --git a/osu.Desktop/osu.Desktop.csproj b/osu.Desktop/osu.Desktop.csproj index 803927bc6f..1e8bf05e01 100644 --- a/osu.Desktop/osu.Desktop.csproj +++ b/osu.Desktop/osu.Desktop.csproj @@ -27,9 +27,9 @@ - - - + + + diff --git a/osu.Game.Rulesets.Catch.Tests/osu.Game.Rulesets.Catch.Tests.csproj b/osu.Game.Rulesets.Catch.Tests/osu.Game.Rulesets.Catch.Tests.csproj index 51343d9e91..9e89539e25 100644 --- a/osu.Game.Rulesets.Catch.Tests/osu.Game.Rulesets.Catch.Tests.csproj +++ b/osu.Game.Rulesets.Catch.Tests/osu.Game.Rulesets.Catch.Tests.csproj @@ -2,8 +2,8 @@ - - + + diff --git a/osu.Game.Rulesets.Mania.Tests/osu.Game.Rulesets.Mania.Tests.csproj b/osu.Game.Rulesets.Mania.Tests/osu.Game.Rulesets.Mania.Tests.csproj index 3165f69a6b..724614e8d5 100644 --- a/osu.Game.Rulesets.Mania.Tests/osu.Game.Rulesets.Mania.Tests.csproj +++ b/osu.Game.Rulesets.Mania.Tests/osu.Game.Rulesets.Mania.Tests.csproj @@ -3,7 +3,7 @@ - + diff --git a/osu.Game.Rulesets.Osu.Tests/osu.Game.Rulesets.Osu.Tests.csproj b/osu.Game.Rulesets.Osu.Tests/osu.Game.Rulesets.Osu.Tests.csproj index 247d5e18c1..69982b1914 100644 --- a/osu.Game.Rulesets.Osu.Tests/osu.Game.Rulesets.Osu.Tests.csproj +++ b/osu.Game.Rulesets.Osu.Tests/osu.Game.Rulesets.Osu.Tests.csproj @@ -3,7 +3,7 @@ - + diff --git a/osu.Game.Rulesets.Taiko.Tests/osu.Game.Rulesets.Taiko.Tests.csproj b/osu.Game.Rulesets.Taiko.Tests/osu.Game.Rulesets.Taiko.Tests.csproj index 08a0579561..11d6025f6d 100644 --- a/osu.Game.Rulesets.Taiko.Tests/osu.Game.Rulesets.Taiko.Tests.csproj +++ b/osu.Game.Rulesets.Taiko.Tests/osu.Game.Rulesets.Taiko.Tests.csproj @@ -3,7 +3,7 @@ - + diff --git a/osu.Game.Tests/osu.Game.Tests.csproj b/osu.Game.Tests/osu.Game.Tests.csproj index d638af0c38..eb9d819fcb 100644 --- a/osu.Game.Tests/osu.Game.Tests.csproj +++ b/osu.Game.Tests/osu.Game.Tests.csproj @@ -3,7 +3,7 @@ - + diff --git a/osu.Game/osu.Game.csproj b/osu.Game/osu.Game.csproj index 9ff79550fa..22e5901ed6 100644 --- a/osu.Game/osu.Game.csproj +++ b/osu.Game/osu.Game.csproj @@ -14,13 +14,13 @@ - + - + - + From 15dae9b2e44e12c78ffad179b7970d55184ccafe Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Fri, 12 Oct 2018 18:51:51 +0900 Subject: [PATCH 260/417] Update nuget dependencies (version mismatches) --- .../osu.Game.Rulesets.Catch.Tests.csproj | 1 + .../osu.Game.Rulesets.Mania.Tests.csproj | 3 ++- osu.Game.Rulesets.Osu.Tests/osu.Game.Rulesets.Osu.Tests.csproj | 3 ++- .../osu.Game.Rulesets.Taiko.Tests.csproj | 3 ++- osu.Game.Tests/osu.Game.Tests.csproj | 3 ++- osu.Game/osu.Game.csproj | 2 +- 6 files changed, 10 insertions(+), 5 deletions(-) diff --git a/osu.Game.Rulesets.Catch.Tests/osu.Game.Rulesets.Catch.Tests.csproj b/osu.Game.Rulesets.Catch.Tests/osu.Game.Rulesets.Catch.Tests.csproj index 9e89539e25..326791f506 100644 --- a/osu.Game.Rulesets.Catch.Tests/osu.Game.Rulesets.Catch.Tests.csproj +++ b/osu.Game.Rulesets.Catch.Tests/osu.Game.Rulesets.Catch.Tests.csproj @@ -5,6 +5,7 @@ + WinExe diff --git a/osu.Game.Rulesets.Mania.Tests/osu.Game.Rulesets.Mania.Tests.csproj b/osu.Game.Rulesets.Mania.Tests/osu.Game.Rulesets.Mania.Tests.csproj index 724614e8d5..bf75ebbff8 100644 --- a/osu.Game.Rulesets.Mania.Tests/osu.Game.Rulesets.Mania.Tests.csproj +++ b/osu.Game.Rulesets.Mania.Tests/osu.Game.Rulesets.Mania.Tests.csproj @@ -2,9 +2,10 @@ - + + WinExe diff --git a/osu.Game.Rulesets.Osu.Tests/osu.Game.Rulesets.Osu.Tests.csproj b/osu.Game.Rulesets.Osu.Tests/osu.Game.Rulesets.Osu.Tests.csproj index 69982b1914..23c6150b6a 100644 --- a/osu.Game.Rulesets.Osu.Tests/osu.Game.Rulesets.Osu.Tests.csproj +++ b/osu.Game.Rulesets.Osu.Tests/osu.Game.Rulesets.Osu.Tests.csproj @@ -2,9 +2,10 @@ - + + WinExe diff --git a/osu.Game.Rulesets.Taiko.Tests/osu.Game.Rulesets.Taiko.Tests.csproj b/osu.Game.Rulesets.Taiko.Tests/osu.Game.Rulesets.Taiko.Tests.csproj index 11d6025f6d..6ae9a018c5 100644 --- a/osu.Game.Rulesets.Taiko.Tests/osu.Game.Rulesets.Taiko.Tests.csproj +++ b/osu.Game.Rulesets.Taiko.Tests/osu.Game.Rulesets.Taiko.Tests.csproj @@ -2,9 +2,10 @@ - + + WinExe diff --git a/osu.Game.Tests/osu.Game.Tests.csproj b/osu.Game.Tests/osu.Game.Tests.csproj index eb9d819fcb..4e55e23aaf 100644 --- a/osu.Game.Tests/osu.Game.Tests.csproj +++ b/osu.Game.Tests/osu.Game.Tests.csproj @@ -2,9 +2,10 @@ - + + WinExe diff --git a/osu.Game/osu.Game.csproj b/osu.Game/osu.Game.csproj index 22e5901ed6..cc21f4f6a4 100644 --- a/osu.Game/osu.Game.csproj +++ b/osu.Game/osu.Game.csproj @@ -15,7 +15,7 @@ - + From 4a64cb7f85543cbb4813c1643b284407c30e93c6 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Fri, 12 Oct 2018 18:55:12 +0900 Subject: [PATCH 261/417] Remove nuget includes im props --- osu.Game.Tests/osu.Game.Tests.csproj | 1 + osu.TestProject.props | 4 ---- osu.sln.DotSettings | 1 + 3 files changed, 2 insertions(+), 4 deletions(-) diff --git a/osu.Game.Tests/osu.Game.Tests.csproj b/osu.Game.Tests/osu.Game.Tests.csproj index 4e55e23aaf..520e0b8940 100644 --- a/osu.Game.Tests/osu.Game.Tests.csproj +++ b/osu.Game.Tests/osu.Game.Tests.csproj @@ -2,6 +2,7 @@ + diff --git a/osu.TestProject.props b/osu.TestProject.props index 506d634555..456ecfd468 100644 --- a/osu.TestProject.props +++ b/osu.TestProject.props @@ -10,10 +10,6 @@ - - - - VisualTestRunner.cs diff --git a/osu.sln.DotSettings b/osu.sln.DotSettings index 404b19deda..345400305c 100644 --- a/osu.sln.DotSettings +++ b/osu.sln.DotSettings @@ -666,6 +666,7 @@ Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/maste True True True + True True True True From ad42f2244dc4ea7189a7fe96a326aac5414f1669 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Fri, 12 Oct 2018 19:15:11 +0900 Subject: [PATCH 262/417] Add fallback logic in case a ruleset consumer forgets to add the HitObjectContainer --- osu.Game/Rulesets/UI/Playfield.cs | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/osu.Game/Rulesets/UI/Playfield.cs b/osu.Game/Rulesets/UI/Playfield.cs index f5db0cd3ce..886eb3ac0e 100644 --- a/osu.Game/Rulesets/UI/Playfield.cs +++ b/osu.Game/Rulesets/UI/Playfield.cs @@ -93,6 +93,15 @@ namespace osu.Game.Rulesets.UI nestedPlayfields.Value.Add(otherPlayfield); } + protected override void LoadComplete() + { + base.LoadComplete(); + + // in the case a consumer forgets to add the HitObjectContainer, we will add it here. + if (HitObjectContainer.Parent == null) + AddInternal(HitObjectContainer); + } + protected override void Update() { base.Update(); From 710b0a46648e2a005ac1d17a539035ceac5a795f Mon Sep 17 00:00:00 2001 From: HoLLy Date: Fri, 12 Oct 2018 15:30:24 +0200 Subject: [PATCH 263/417] Remove unnecessary PathSanitise call --- osu.Game/Beatmaps/Formats/LegacyStoryboardDecoder.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu.Game/Beatmaps/Formats/LegacyStoryboardDecoder.cs b/osu.Game/Beatmaps/Formats/LegacyStoryboardDecoder.cs index a73a32325a..375c0b29c0 100644 --- a/osu.Game/Beatmaps/Formats/LegacyStoryboardDecoder.cs +++ b/osu.Game/Beatmaps/Formats/LegacyStoryboardDecoder.cs @@ -298,6 +298,6 @@ namespace osu.Game.Beatmaps.Formats } } - private string cleanFilename(string path) => FileSafety.PathStandardise(FileSafety.PathSanitise(path.Trim('\"'))); + private string cleanFilename(string path) => FileSafety.PathStandardise(path.Trim('"')); } } From 26b91c96fbfdc1568e79c39f1041d9b584914e1f Mon Sep 17 00:00:00 2001 From: smoogipoo Date: Mon, 15 Oct 2018 12:25:42 +0900 Subject: [PATCH 264/417] Fix wrong number of ticks on some legacy beatmaps --- osu.Game.Rulesets.Osu/Beatmaps/OsuBeatmapConverter.cs | 3 ++- osu.Game.Rulesets.Osu/Objects/Slider.cs | 8 +++++++- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/osu.Game.Rulesets.Osu/Beatmaps/OsuBeatmapConverter.cs b/osu.Game.Rulesets.Osu/Beatmaps/OsuBeatmapConverter.cs index 9e0e649eb2..14245ec8ac 100644 --- a/osu.Game.Rulesets.Osu/Beatmaps/OsuBeatmapConverter.cs +++ b/osu.Game.Rulesets.Osu/Beatmaps/OsuBeatmapConverter.cs @@ -43,7 +43,8 @@ namespace osu.Game.Rulesets.Osu.Beatmaps Position = positionData?.Position ?? Vector2.Zero, NewCombo = comboData?.NewCombo ?? false, ComboOffset = comboData?.ComboOffset ?? 0, - LegacyLastTickOffset = legacyOffset?.LegacyLastTickOffset + LegacyLastTickOffset = legacyOffset?.LegacyLastTickOffset, + TickDistanceMultiplier = beatmap.BeatmapInfo.BeatmapVersion < 8 ? 1f / beatmap.ControlPointInfo.DifficultyPointAt(original.StartTime).SpeedMultiplier : 1 }; } else if (endTimeData != null) diff --git a/osu.Game.Rulesets.Osu/Objects/Slider.cs b/osu.Game.Rulesets.Osu/Objects/Slider.cs index 7a0dcc77a6..1901c852ed 100644 --- a/osu.Game.Rulesets.Osu/Objects/Slider.cs +++ b/osu.Game.Rulesets.Osu/Objects/Slider.cs @@ -95,6 +95,12 @@ namespace osu.Game.Rulesets.Osu.Objects public double Velocity; public double TickDistance; + /// + /// An extra multiplier that affects the number of ticks generated by this . + /// An increase in this value increases , which reduces the number of ticks generated. + /// + public double TickDistanceMultiplier = 1; + public HitCircle HeadCircle; public SliderTailCircle TailCircle; @@ -108,7 +114,7 @@ namespace osu.Game.Rulesets.Osu.Objects double scoringDistance = base_scoring_distance * difficulty.SliderMultiplier * difficultyPoint.SpeedMultiplier; Velocity = scoringDistance / timingPoint.BeatLength; - TickDistance = scoringDistance / difficulty.SliderTickRate; + TickDistance = scoringDistance / difficulty.SliderTickRate * TickDistanceMultiplier; } protected override void CreateNestedHitObjects() From 2f943e77aa29440460dbc36237cbe8a88f21fdc3 Mon Sep 17 00:00:00 2001 From: smoogipoo Date: Mon, 15 Oct 2018 12:31:52 +0900 Subject: [PATCH 265/417] Make Velocity and TickDistance private set --- osu.Game.Rulesets.Osu/Objects/Slider.cs | 4 ++-- osu.Game.Tests/Visual/TestCaseHitObjectComposer.cs | 4 +--- 2 files changed, 3 insertions(+), 5 deletions(-) diff --git a/osu.Game.Rulesets.Osu/Objects/Slider.cs b/osu.Game.Rulesets.Osu/Objects/Slider.cs index 1901c852ed..85c5d7a30a 100644 --- a/osu.Game.Rulesets.Osu/Objects/Slider.cs +++ b/osu.Game.Rulesets.Osu/Objects/Slider.cs @@ -92,8 +92,8 @@ namespace osu.Game.Rulesets.Osu.Objects /// public double SpanDuration => Duration / this.SpanCount(); - public double Velocity; - public double TickDistance; + public double Velocity { get; private set; } + public double TickDistance { get; private set; } /// /// An extra multiplier that affects the number of ticks generated by this . diff --git a/osu.Game.Tests/Visual/TestCaseHitObjectComposer.cs b/osu.Game.Tests/Visual/TestCaseHitObjectComposer.cs index 5df371dd09..fe00821254 100644 --- a/osu.Game.Tests/Visual/TestCaseHitObjectComposer.cs +++ b/osu.Game.Tests/Visual/TestCaseHitObjectComposer.cs @@ -49,9 +49,7 @@ namespace osu.Game.Tests.Visual Vector2.Zero, new Vector2(216, 0), }, - Distance = 400, - Velocity = 1, - TickDistance = 100, + Distance = 216, Scale = 0.5f, } }, From 657bd5e37139dc10ac2b69015bb91c45d0f0b652 Mon Sep 17 00:00:00 2001 From: smoogipoo Date: Mon, 15 Oct 2018 12:32:59 +0900 Subject: [PATCH 266/417] Add some xmldocs --- osu.Game.Rulesets.Osu/Objects/Slider.cs | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/osu.Game.Rulesets.Osu/Objects/Slider.cs b/osu.Game.Rulesets.Osu/Objects/Slider.cs index 85c5d7a30a..4fc0d76e2b 100644 --- a/osu.Game.Rulesets.Osu/Objects/Slider.cs +++ b/osu.Game.Rulesets.Osu/Objects/Slider.cs @@ -92,11 +92,18 @@ namespace osu.Game.Rulesets.Osu.Objects /// public double SpanDuration => Duration / this.SpanCount(); + /// + /// Velocity of this . + /// public double Velocity { get; private set; } + + /// + /// Spacing between s of this . + /// public double TickDistance { get; private set; } /// - /// An extra multiplier that affects the number of ticks generated by this . + /// An extra multiplier that affects the number of s generated by this . /// An increase in this value increases , which reduces the number of ticks generated. /// public double TickDistanceMultiplier = 1; From 72aaaa4a7426bb11a9e2bbe5859b4197654cfe9e Mon Sep 17 00:00:00 2001 From: smoogipoo Date: Tue, 16 Oct 2018 10:29:53 +0900 Subject: [PATCH 267/417] PointSearch -> SearchPoint --- .../Beatmaps/ControlPoints/ControlPointInfo.cs | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/osu.Game/Beatmaps/ControlPoints/ControlPointInfo.cs b/osu.Game/Beatmaps/ControlPoints/ControlPointInfo.cs index db5574e5ce..4e36a755d1 100644 --- a/osu.Game/Beatmaps/ControlPoints/ControlPointInfo.cs +++ b/osu.Game/Beatmaps/ControlPoints/ControlPointInfo.cs @@ -12,10 +12,10 @@ namespace osu.Game.Beatmaps.ControlPoints [Serializable] public class ControlPointInfo { - private readonly TimingControlPoint timingPointSearch = new TimingControlPoint(); - private readonly DifficultyControlPoint difficultyPointSearch = new DifficultyControlPoint(); - private readonly SampleControlPoint samplePointSearch = new SampleControlPoint(); - private readonly EffectControlPoint effectPointSearch = new EffectControlPoint(); + private readonly TimingControlPoint timingSearchPoint = new TimingControlPoint(); + private readonly DifficultyControlPoint difficultySearchPoint = new DifficultyControlPoint(); + private readonly SampleControlPoint sampleSearchPoint = new SampleControlPoint(); + private readonly EffectControlPoint effectSearchPoint = new EffectControlPoint(); /// /// All timing points. @@ -46,28 +46,28 @@ namespace osu.Game.Beatmaps.ControlPoints /// /// The time to find the difficulty control point at. /// The difficulty control point. - public DifficultyControlPoint DifficultyPointAt(double time) => binarySearch(DifficultyPoints, time, difficultyPointSearch); + public DifficultyControlPoint DifficultyPointAt(double time) => binarySearch(DifficultyPoints, time, difficultySearchPoint); /// /// Finds the effect control point that is active at . /// /// The time to find the effect control point at. /// The effect control point. - public EffectControlPoint EffectPointAt(double time) => binarySearch(EffectPoints, time, effectPointSearch); + public EffectControlPoint EffectPointAt(double time) => binarySearch(EffectPoints, time, effectSearchPoint); /// /// Finds the sound control point that is active at . /// /// The time to find the sound control point at. /// The sound control point. - public SampleControlPoint SamplePointAt(double time) => binarySearch(SamplePoints, time, samplePointSearch, SamplePoints.Count > 0 ? SamplePoints[0] : null); + public SampleControlPoint SamplePointAt(double time) => binarySearch(SamplePoints, time, sampleSearchPoint, SamplePoints.Count > 0 ? SamplePoints[0] : null); /// /// Finds the timing control point that is active at . /// /// The time to find the timing control point at. /// The timing control point. - public TimingControlPoint TimingPointAt(double time) => binarySearch(TimingPoints, time, timingPointSearch, TimingPoints.Count > 0 ? TimingPoints[0] : null); + public TimingControlPoint TimingPointAt(double time) => binarySearch(TimingPoints, time, timingSearchPoint, TimingPoints.Count > 0 ? TimingPoints[0] : null); /// /// Finds the maximum BPM represented by any timing control point. From 060cc24dba4fef9e38ab56339aa6386839474bdd Mon Sep 17 00:00:00 2001 From: smoogipoo Date: Tue, 16 Oct 2018 11:11:04 +0900 Subject: [PATCH 268/417] Cleanup slidercurve calculation --- osu.Game/Rulesets/Objects/SliderCurve.cs | 21 +++++++++------------ 1 file changed, 9 insertions(+), 12 deletions(-) diff --git a/osu.Game/Rulesets/Objects/SliderCurve.cs b/osu.Game/Rulesets/Objects/SliderCurve.cs index 60f7901a48..dfccdf68f2 100644 --- a/osu.Game/Rulesets/Objects/SliderCurve.cs +++ b/osu.Game/Rulesets/Objects/SliderCurve.cs @@ -27,6 +27,12 @@ namespace osu.Game.Rulesets.Objects { switch (CurveType) { + case CurveType.Linear: + var result = new List(subControlPoints.Length); + foreach (var c in subControlPoints) + result.Add(c); + + return result; case CurveType.PerfectCurve: //we can only use CircularArc iff we have exactly three control points and no dissection. if (ControlPoints.Length != 3 || subControlPoints.Length != 3) @@ -66,18 +72,9 @@ namespace osu.Game.Rulesets.Objects { ReadOnlySpan cpSpan = ControlPoints.AsSpan().Slice(start, end - start); - if (CurveType == CurveType.Linear) - { - foreach (var t in cpSpan) - if (calculatedPath.Count == 0 || calculatedPath.Last() != t) - calculatedPath.Add(t); - } - else - { - foreach (Vector2 t in calculateSubpath(cpSpan)) - if (calculatedPath.Count == 0 || calculatedPath.Last() != t) - calculatedPath.Add(t); - } + foreach (Vector2 t in calculateSubpath(cpSpan)) + if (calculatedPath.Count == 0 || calculatedPath.Last() != t) + calculatedPath.Add(t); start = end; } From 3ad93d5a07f666ab6f790e324dfd8b29f5a97253 Mon Sep 17 00:00:00 2001 From: smoogipoo Date: Tue, 16 Oct 2018 11:40:51 +0900 Subject: [PATCH 269/417] Remove redundant type specifications --- osu.Game/Graphics/UserInterface/OsuDropdown.cs | 2 +- osu.Game/Graphics/UserInterface/OsuTabControl.cs | 4 ++-- osu.Game/Graphics/UserInterface/RollingCounter.cs | 2 +- osu.Game/Storyboards/CommandTimeline.cs | 4 ++-- 4 files changed, 6 insertions(+), 6 deletions(-) diff --git a/osu.Game/Graphics/UserInterface/OsuDropdown.cs b/osu.Game/Graphics/UserInterface/OsuDropdown.cs index 04a7cb64d3..30803d1545 100644 --- a/osu.Game/Graphics/UserInterface/OsuDropdown.cs +++ b/osu.Game/Graphics/UserInterface/OsuDropdown.cs @@ -30,7 +30,7 @@ namespace osu.Game.Graphics.UserInterface [BackgroundDependencyLoader] private void load(OsuColour colours) { - if (accentColour == default(Color4)) + if (accentColour == default) accentColour = colours.PinkDarker; updateAccentColour(); } diff --git a/osu.Game/Graphics/UserInterface/OsuTabControl.cs b/osu.Game/Graphics/UserInterface/OsuTabControl.cs index 24183e07a0..e7d6a87349 100644 --- a/osu.Game/Graphics/UserInterface/OsuTabControl.cs +++ b/osu.Game/Graphics/UserInterface/OsuTabControl.cs @@ -53,7 +53,7 @@ namespace osu.Game.Graphics.UserInterface [BackgroundDependencyLoader] private void load(OsuColour colours) { - if (accentColour == default(Color4)) + if (accentColour == default) AccentColour = colours.Blue; } @@ -142,7 +142,7 @@ namespace osu.Game.Graphics.UserInterface [BackgroundDependencyLoader] private void load(OsuColour colours) { - if (accentColour == default(Color4)) + if (accentColour == default) AccentColour = colours.Blue; } diff --git a/osu.Game/Graphics/UserInterface/RollingCounter.cs b/osu.Game/Graphics/UserInterface/RollingCounter.cs index f84404a911..c2162b8a42 100644 --- a/osu.Game/Graphics/UserInterface/RollingCounter.cs +++ b/osu.Game/Graphics/UserInterface/RollingCounter.cs @@ -134,7 +134,7 @@ namespace osu.Game.Graphics.UserInterface /// public virtual void ResetCount() { - SetCountWithoutRolling(default(T)); + SetCountWithoutRolling(default); } /// diff --git a/osu.Game/Storyboards/CommandTimeline.cs b/osu.Game/Storyboards/CommandTimeline.cs index 8a032064d3..64b0a45fcd 100644 --- a/osu.Game/Storyboards/CommandTimeline.cs +++ b/osu.Game/Storyboards/CommandTimeline.cs @@ -21,8 +21,8 @@ namespace osu.Game.Storyboards private Cached endTimeBacking; public double EndTime => endTimeBacking.IsValid ? endTimeBacking : endTimeBacking.Value = HasCommands ? commands.Max(c => c.EndTime) : double.MaxValue; - public T StartValue => HasCommands ? commands.OrderBy(c => c.StartTime).First().StartValue : default(T); - public T EndValue => HasCommands ? commands.OrderByDescending(c => c.EndTime).First().EndValue : default(T); + public T StartValue => HasCommands ? commands.OrderBy(c => c.StartTime).First().StartValue : default; + public T EndValue => HasCommands ? commands.OrderByDescending(c => c.EndTime).First().EndValue : default; public void Add(Easing easing, double startTime, double endTime, T startValue, T endValue) { From 41391a66278494926572fa8d60cf758afa14307a Mon Sep 17 00:00:00 2001 From: smoogipoo Date: Tue, 16 Oct 2018 12:01:58 +0900 Subject: [PATCH 270/417] Fix beatmap conversion tests failing --- osu.Game/Beatmaps/BeatmapConverter.cs | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/osu.Game/Beatmaps/BeatmapConverter.cs b/osu.Game/Beatmaps/BeatmapConverter.cs index 6496a84803..a2d7a69b5d 100644 --- a/osu.Game/Beatmaps/BeatmapConverter.cs +++ b/osu.Game/Beatmaps/BeatmapConverter.cs @@ -76,8 +76,11 @@ namespace osu.Game.Beatmaps var converted = ConvertHitObject(obj, beatmap); - // Note: This will not perform .ToList() if ObjectConverted is null - ObjectConverted?.Invoke(obj, converted.ToList()); + if (ObjectConverted != null) + { + converted = converted.ToList(); + ObjectConverted.Invoke(obj, converted); + } foreach (var c in converted) { From eb9199e07ae40fbf73cb9a447ea17996f49b6799 Mon Sep 17 00:00:00 2001 From: HoLLy Date: Tue, 16 Oct 2018 08:29:47 +0200 Subject: [PATCH 271/417] Run database migration unconditionally, remove downwards migration --- .../20181007180454_StandardizePaths.cs | 16 ---------------- 1 file changed, 16 deletions(-) diff --git a/osu.Game/Migrations/20181007180454_StandardizePaths.cs b/osu.Game/Migrations/20181007180454_StandardizePaths.cs index 08b34507ce..e1b46dd018 100644 --- a/osu.Game/Migrations/20181007180454_StandardizePaths.cs +++ b/osu.Game/Migrations/20181007180454_StandardizePaths.cs @@ -11,10 +11,6 @@ namespace osu.Game.Migrations string sanitized = Path.DirectorySeparatorChar.ToString(); string standardized = "/"; - // If we are not on Windows, no changes are needed. - if (string.Equals(standardized, sanitized, StringComparison.Ordinal)) - return; - // Escaping \ does not seem to be needed. migrationBuilder.Sql($"UPDATE `BeatmapInfo` SET `Path` = REPLACE(`Path`, '{sanitized}', '{standardized}')"); migrationBuilder.Sql($"UPDATE `BeatmapMetadata` SET `AudioFile` = REPLACE(`AudioFile`, '{sanitized}', '{standardized}')"); @@ -25,18 +21,6 @@ namespace osu.Game.Migrations protected override void Down(MigrationBuilder migrationBuilder) { - string sanitized = Path.DirectorySeparatorChar.ToString(); - string standardized = "/"; - - // If we are not on Windows, no changes are needed. - if (string.Equals(standardized, sanitized, StringComparison.Ordinal)) - return; - - migrationBuilder.Sql($"UPDATE `BeatmapInfo` SET `Path` = REPLACE(`Path`, '{standardized}', '{sanitized}')"); - migrationBuilder.Sql($"UPDATE `BeatmapMetadata` SET `AudioFile` = REPLACE(`AudioFile`, '{standardized}', '{sanitized}')"); - migrationBuilder.Sql($"UPDATE `BeatmapMetadata` SET `BackgroundFile` = REPLACE(`BackgroundFile`, '{standardized}', '{sanitized}')"); - migrationBuilder.Sql($"UPDATE `BeatmapSetFileInfo` SET `Filename` = REPLACE(`Filename`, '{standardized}', '{sanitized}')"); - migrationBuilder.Sql($"UPDATE `SkinFileInfo` SET `Filename` = REPLACE(`Filename`, '{standardized}', '{sanitized}')"); } } } From 47be95ce0baa351e0f3a8de03906e61fec9b1b80 Mon Sep 17 00:00:00 2001 From: smoogipoo Date: Tue, 16 Oct 2018 17:10:24 +0900 Subject: [PATCH 272/417] Fix slider nodes using the wrong samples --- .../Beatmaps/CatchBeatmapConverter.cs | 2 +- .../Objects/JuiceStream.cs | 2 +- .../Beatmaps/ManiaBeatmapConverter.cs | 2 +- .../Legacy/DistanceObjectPatternGenerator.cs | 2 +- osu.Game.Rulesets.Osu.Tests/TestCaseSlider.cs | 14 +++--- .../Beatmaps/OsuBeatmapConverter.cs | 2 +- osu.Game.Rulesets.Osu/Objects/Slider.cs | 7 +-- .../Beatmaps/TaikoBeatmapConverter.cs | 2 +- .../Formats/LegacyBeatmapDecoderTest.cs | 44 +++++++++++++++++++ osu.Game.Tests/Resources/slider-samples.osu | 23 ++++++++++ .../Legacy/Catch/ConvertHitObjectParser.cs | 4 +- .../Objects/Legacy/ConvertHitObjectParser.cs | 11 +++-- .../Rulesets/Objects/Legacy/ConvertSlider.cs | 2 +- .../Legacy/Mania/ConvertHitObjectParser.cs | 4 +- .../Legacy/Osu/ConvertHitObjectParser.cs | 4 +- .../Legacy/Taiko/ConvertHitObjectParser.cs | 4 +- .../Rulesets/Objects/Types/IHasRepeats.cs | 10 ++++- 17 files changed, 109 insertions(+), 30 deletions(-) create mode 100644 osu.Game.Tests/Resources/slider-samples.osu diff --git a/osu.Game.Rulesets.Catch/Beatmaps/CatchBeatmapConverter.cs b/osu.Game.Rulesets.Catch/Beatmaps/CatchBeatmapConverter.cs index 15d4edc411..88686ac243 100644 --- a/osu.Game.Rulesets.Catch/Beatmaps/CatchBeatmapConverter.cs +++ b/osu.Game.Rulesets.Catch/Beatmaps/CatchBeatmapConverter.cs @@ -37,7 +37,7 @@ namespace osu.Game.Rulesets.Catch.Beatmaps ControlPoints = curveData.ControlPoints, CurveType = curveData.CurveType, Distance = curveData.Distance, - RepeatSamples = curveData.RepeatSamples, + NodeSamples = curveData.NodeSamples, RepeatCount = curveData.RepeatCount, X = (positionData?.X ?? 0) / CatchPlayfield.BASE_WIDTH, NewCombo = comboData?.NewCombo ?? false, diff --git a/osu.Game.Rulesets.Catch/Objects/JuiceStream.cs b/osu.Game.Rulesets.Catch/Objects/JuiceStream.cs index 0344189af5..d7eed72563 100644 --- a/osu.Game.Rulesets.Catch/Objects/JuiceStream.cs +++ b/osu.Game.Rulesets.Catch/Objects/JuiceStream.cs @@ -152,7 +152,7 @@ namespace osu.Game.Rulesets.Catch.Objects set { Curve.ControlPoints = value; } } - public List> RepeatSamples { get; set; } = new List>(); + public List> NodeSamples { get; set; } = new List>(); public CurveType CurveType { diff --git a/osu.Game.Rulesets.Mania/Beatmaps/ManiaBeatmapConverter.cs b/osu.Game.Rulesets.Mania/Beatmaps/ManiaBeatmapConverter.cs index c15b303048..835c4474d7 100644 --- a/osu.Game.Rulesets.Mania/Beatmaps/ManiaBeatmapConverter.cs +++ b/osu.Game.Rulesets.Mania/Beatmaps/ManiaBeatmapConverter.cs @@ -247,7 +247,7 @@ namespace osu.Game.Rulesets.Mania.Beatmaps double segmentTime = (curveData.EndTime - HitObject.StartTime) / curveData.SpanCount(); int index = (int)(segmentTime == 0 ? 0 : (time - HitObject.StartTime) / segmentTime); - return curveData.RepeatSamples[index]; + return curveData.NodeSamples[index]; } } } diff --git a/osu.Game.Rulesets.Mania/Beatmaps/Patterns/Legacy/DistanceObjectPatternGenerator.cs b/osu.Game.Rulesets.Mania/Beatmaps/Patterns/Legacy/DistanceObjectPatternGenerator.cs index 37a8062d75..635004d2f6 100644 --- a/osu.Game.Rulesets.Mania/Beatmaps/Patterns/Legacy/DistanceObjectPatternGenerator.cs +++ b/osu.Game.Rulesets.Mania/Beatmaps/Patterns/Legacy/DistanceObjectPatternGenerator.cs @@ -470,7 +470,7 @@ namespace osu.Game.Rulesets.Mania.Beatmaps.Patterns.Legacy double segmentTime = (EndTime - HitObject.StartTime) / spanCount; int index = (int)(segmentTime == 0 ? 0 : (time - HitObject.StartTime) / segmentTime); - return curveData.RepeatSamples[index]; + return curveData.NodeSamples[index]; } /// diff --git a/osu.Game.Rulesets.Osu.Tests/TestCaseSlider.cs b/osu.Game.Rulesets.Osu.Tests/TestCaseSlider.cs index 3f9464a98f..f3d3fb6e7f 100644 --- a/osu.Game.Rulesets.Osu.Tests/TestCaseSlider.cs +++ b/osu.Game.Rulesets.Osu.Tests/TestCaseSlider.cs @@ -116,7 +116,7 @@ namespace osu.Game.Rulesets.Osu.Tests }, Distance = 700, RepeatCount = repeats, - RepeatSamples = createEmptySamples(repeats), + NodeSamples = createEmptySamples(repeats), StackHeight = 10 }; @@ -148,7 +148,7 @@ namespace osu.Game.Rulesets.Osu.Tests }, Distance = distance, RepeatCount = repeats, - RepeatSamples = createEmptySamples(repeats), + NodeSamples = createEmptySamples(repeats), StackHeight = stackHeight }; @@ -169,7 +169,7 @@ namespace osu.Game.Rulesets.Osu.Tests }, Distance = 600, RepeatCount = repeats, - RepeatSamples = createEmptySamples(repeats) + NodeSamples = createEmptySamples(repeats) }; addSlider(slider, 2, 3); @@ -195,7 +195,7 @@ namespace osu.Game.Rulesets.Osu.Tests }, Distance = 793.4417, RepeatCount = repeats, - RepeatSamples = createEmptySamples(repeats) + NodeSamples = createEmptySamples(repeats) }; addSlider(slider, 2, 3); @@ -220,7 +220,7 @@ namespace osu.Game.Rulesets.Osu.Tests }, Distance = 480, RepeatCount = repeats, - RepeatSamples = createEmptySamples(repeats) + NodeSamples = createEmptySamples(repeats) }; addSlider(slider, 2, 3); @@ -246,7 +246,7 @@ namespace osu.Game.Rulesets.Osu.Tests }, Distance = 1000, RepeatCount = repeats, - RepeatSamples = createEmptySamples(repeats) + NodeSamples = createEmptySamples(repeats) }; addSlider(slider, 2, 3); @@ -274,7 +274,7 @@ namespace osu.Game.Rulesets.Osu.Tests }, Distance = 300, RepeatCount = repeats, - RepeatSamples = repeatSamples + NodeSamples = repeatSamples }; addSlider(slider, 3, 1); diff --git a/osu.Game.Rulesets.Osu/Beatmaps/OsuBeatmapConverter.cs b/osu.Game.Rulesets.Osu/Beatmaps/OsuBeatmapConverter.cs index 9e0e649eb2..8130d25890 100644 --- a/osu.Game.Rulesets.Osu/Beatmaps/OsuBeatmapConverter.cs +++ b/osu.Game.Rulesets.Osu/Beatmaps/OsuBeatmapConverter.cs @@ -38,7 +38,7 @@ namespace osu.Game.Rulesets.Osu.Beatmaps ControlPoints = curveData.ControlPoints, CurveType = curveData.CurveType, Distance = curveData.Distance, - RepeatSamples = curveData.RepeatSamples, + NodeSamples = curveData.NodeSamples, RepeatCount = curveData.RepeatCount, Position = positionData?.Position ?? Vector2.Zero, NewCombo = comboData?.NewCombo ?? false, diff --git a/osu.Game.Rulesets.Osu/Objects/Slider.cs b/osu.Game.Rulesets.Osu/Objects/Slider.cs index 7a0dcc77a6..844dcfb933 100644 --- a/osu.Game.Rulesets.Osu/Objects/Slider.cs +++ b/osu.Game.Rulesets.Osu/Objects/Slider.cs @@ -84,7 +84,8 @@ namespace osu.Game.Rulesets.Osu.Objects /// internal float LazyTravelDistance; - public List> RepeatSamples { get; set; } = new List>(); + public List> NodeSamples { get; set; } = new List>(); + public int RepeatCount { get; set; } /// @@ -129,7 +130,7 @@ namespace osu.Game.Rulesets.Osu.Objects { StartTime = StartTime, Position = Position, - Samples = Samples, + Samples = NodeSamples[0], SampleControlPoint = SampleControlPoint, IndexInCurrentCombo = IndexInCurrentCombo, ComboIndex = ComboIndex, @@ -209,7 +210,7 @@ namespace osu.Game.Rulesets.Osu.Objects Position = Position + Curve.PositionAt(repeat % 2), StackHeight = StackHeight, Scale = Scale, - Samples = new List(RepeatSamples[repeatIndex]) + Samples = new List(NodeSamples[1 + repeatIndex]) }); } } diff --git a/osu.Game.Rulesets.Taiko/Beatmaps/TaikoBeatmapConverter.cs b/osu.Game.Rulesets.Taiko/Beatmaps/TaikoBeatmapConverter.cs index c2cde332e8..c4a84f416e 100644 --- a/osu.Game.Rulesets.Taiko/Beatmaps/TaikoBeatmapConverter.cs +++ b/osu.Game.Rulesets.Taiko/Beatmaps/TaikoBeatmapConverter.cs @@ -117,7 +117,7 @@ namespace osu.Game.Rulesets.Taiko.Beatmaps if (!isForCurrentRuleset && tickSpacing > 0 && osuDuration < 2 * speedAdjustedBeatLength) { - List> allSamples = curveData != null ? curveData.RepeatSamples : new List>(new[] { samples }); + List> allSamples = curveData != null ? curveData.NodeSamples : new List>(new[] { samples }); int i = 0; for (double j = obj.StartTime; j <= obj.StartTime + taikoDuration + tickSpacing / 8; j += tickSpacing) diff --git a/osu.Game.Tests/Beatmaps/Formats/LegacyBeatmapDecoderTest.cs b/osu.Game.Tests/Beatmaps/Formats/LegacyBeatmapDecoderTest.cs index af63a39662..60bd87dda7 100644 --- a/osu.Game.Tests/Beatmaps/Formats/LegacyBeatmapDecoderTest.cs +++ b/osu.Game.Tests/Beatmaps/Formats/LegacyBeatmapDecoderTest.cs @@ -13,6 +13,7 @@ using osu.Game.Beatmaps.Formats; using osu.Game.Beatmaps.Timing; using osu.Game.Rulesets.Catch.Beatmaps; using osu.Game.Rulesets.Objects; +using osu.Game.Rulesets.Objects.Legacy; using osu.Game.Rulesets.Osu.Beatmaps; using osu.Game.Skinning; @@ -312,5 +313,48 @@ namespace osu.Game.Tests.Beatmaps.Formats SampleInfo getTestableSampleInfo(HitObject hitObject) => hitObject.SampleControlPoint.ApplyTo(hitObject.Samples[0]); } + + [Test] + public void TestDecodeSliderSamples() + { + var decoder = new LegacyBeatmapDecoder { ApplyOffsets = false }; + using (var resStream = Resource.OpenResource("slider-samples.osu")) + using (var stream = new StreamReader(resStream)) + { + var hitObjects = decoder.Decode(stream).HitObjects; + + var slider1 = (ConvertSlider)hitObjects[0]; + + Assert.AreEqual(1, slider1.NodeSamples[0].Count); + Assert.AreEqual(SampleInfo.HIT_NORMAL, slider1.NodeSamples[0][0].Name); + Assert.AreEqual(1, slider1.NodeSamples[1].Count); + Assert.AreEqual(SampleInfo.HIT_NORMAL, slider1.NodeSamples[1][0].Name); + Assert.AreEqual(1, slider1.NodeSamples[2].Count); + Assert.AreEqual(SampleInfo.HIT_NORMAL, slider1.NodeSamples[2][0].Name); + + var slider2 = (ConvertSlider)hitObjects[1]; + + Assert.AreEqual(2, slider2.NodeSamples[0].Count); + Assert.AreEqual(SampleInfo.HIT_NORMAL, slider2.NodeSamples[0][0].Name); + Assert.AreEqual(SampleInfo.HIT_CLAP, slider2.NodeSamples[0][1].Name); + Assert.AreEqual(2, slider2.NodeSamples[1].Count); + Assert.AreEqual(SampleInfo.HIT_NORMAL, slider2.NodeSamples[1][0].Name); + Assert.AreEqual(SampleInfo.HIT_CLAP, slider2.NodeSamples[1][1].Name); + Assert.AreEqual(2, slider2.NodeSamples[2].Count); + Assert.AreEqual(SampleInfo.HIT_NORMAL, slider2.NodeSamples[2][0].Name); + Assert.AreEqual(SampleInfo.HIT_CLAP, slider2.NodeSamples[2][1].Name); + + var slider3 = (ConvertSlider)hitObjects[2]; + + Assert.AreEqual(2, slider3.NodeSamples[0].Count); + Assert.AreEqual(SampleInfo.HIT_NORMAL, slider3.NodeSamples[0][0].Name); + Assert.AreEqual(SampleInfo.HIT_WHISTLE, slider3.NodeSamples[0][1].Name); + Assert.AreEqual(1, slider3.NodeSamples[1].Count); + Assert.AreEqual(SampleInfo.HIT_NORMAL, slider3.NodeSamples[1][0].Name); + Assert.AreEqual(2, slider3.NodeSamples[2].Count); + Assert.AreEqual(SampleInfo.HIT_NORMAL, slider3.NodeSamples[2][0].Name); + Assert.AreEqual(SampleInfo.HIT_CLAP, slider3.NodeSamples[2][1].Name); + } + } } } diff --git a/osu.Game.Tests/Resources/slider-samples.osu b/osu.Game.Tests/Resources/slider-samples.osu new file mode 100644 index 0000000000..7759a2e35f --- /dev/null +++ b/osu.Game.Tests/Resources/slider-samples.osu @@ -0,0 +1,23 @@ +osu file format v14 + +[General] +SampleSet: Normal + +[Difficulty] + +SliderMultiplier:1.6 +SliderTickRate:2 + +[TimingPoints] +24735,389.61038961039,4,1,1,25,1,0 + +[HitObjects] +// Unified: Normal, Normal, Normal +168,256,30579,6,0,B|248:320|320:248,2,160 + +// Unified: Normal+Clap, Normal+Clap, Normal+Clap +168,256,32137,6,8,B|248:320|320:248,2,160 + +// Nodal: Normal+Whistle, Normal, Normal+Clap +// Nodal sounds should override the unified clap sound +168,256,33696,6,8,B|248:320|320:248,2,160,2|0|8 \ No newline at end of file diff --git a/osu.Game/Rulesets/Objects/Legacy/Catch/ConvertHitObjectParser.cs b/osu.Game/Rulesets/Objects/Legacy/Catch/ConvertHitObjectParser.cs index 802080aedb..6050e87841 100644 --- a/osu.Game/Rulesets/Objects/Legacy/Catch/ConvertHitObjectParser.cs +++ b/osu.Game/Rulesets/Objects/Legacy/Catch/ConvertHitObjectParser.cs @@ -37,7 +37,7 @@ namespace osu.Game.Rulesets.Objects.Legacy.Catch }; } - protected override HitObject CreateSlider(Vector2 position, bool newCombo, int comboOffset, List controlPoints, double length, CurveType curveType, int repeatCount, List> repeatSamples) + protected override HitObject CreateSlider(Vector2 position, bool newCombo, int comboOffset, List controlPoints, double length, CurveType curveType, int repeatCount, List> nodeSamples) { newCombo |= forceNewCombo; comboOffset += extraComboOffset; @@ -53,7 +53,7 @@ namespace osu.Game.Rulesets.Objects.Legacy.Catch ControlPoints = controlPoints, Distance = length, CurveType = curveType, - RepeatSamples = repeatSamples, + NodeSamples = nodeSamples, RepeatCount = repeatCount }; } diff --git a/osu.Game/Rulesets/Objects/Legacy/ConvertHitObjectParser.cs b/osu.Game/Rulesets/Objects/Legacy/ConvertHitObjectParser.cs index 72168a4cd2..7cd15543ca 100644 --- a/osu.Game/Rulesets/Objects/Legacy/ConvertHitObjectParser.cs +++ b/osu.Game/Rulesets/Objects/Legacy/ConvertHitObjectParser.cs @@ -169,6 +169,9 @@ namespace osu.Game.Rulesets.Objects.Legacy nodeSamples.Add(convertSoundType(nodeSoundTypes[i], nodeBankInfos[i])); result = CreateSlider(pos, combo, comboOffset, points, length, curveType, repeatCount, nodeSamples); + + // The samples are played when the slider ends, which is the last node + result.Samples = nodeSamples[nodeSamples.Count - 1]; } else if (type.HasFlag(ConvertHitObjectType.Spinner)) { @@ -200,7 +203,9 @@ namespace osu.Game.Rulesets.Objects.Legacy } result.StartTime = Convert.ToDouble(split[2], CultureInfo.InvariantCulture) + Offset; - result.Samples = convertSoundType(soundType, bankInfo); + + if (result.Samples.Count == 0) + result.Samples = convertSoundType(soundType, bankInfo); FirstObject = false; @@ -260,9 +265,9 @@ namespace osu.Game.Rulesets.Objects.Legacy /// The slider length. /// The slider curve type. /// The slider repeat count. - /// The samples to be played when the repeat nodes are hit. This includes the head and tail of the slider. + /// The samples to be played when the slider nodes are hit. This includes the head and tail of the slider. /// The hit object. - protected abstract HitObject CreateSlider(Vector2 position, bool newCombo, int comboOffset, List controlPoints, double length, CurveType curveType, int repeatCount, List> repeatSamples); + protected abstract HitObject CreateSlider(Vector2 position, bool newCombo, int comboOffset, List controlPoints, double length, CurveType curveType, int repeatCount, List> nodeSamples); /// /// Creates a legacy Spinner-type hit object. diff --git a/osu.Game/Rulesets/Objects/Legacy/ConvertSlider.cs b/osu.Game/Rulesets/Objects/Legacy/ConvertSlider.cs index ef1eecec3d..997418b5cd 100644 --- a/osu.Game/Rulesets/Objects/Legacy/ConvertSlider.cs +++ b/osu.Game/Rulesets/Objects/Legacy/ConvertSlider.cs @@ -26,7 +26,7 @@ namespace osu.Game.Rulesets.Objects.Legacy public double Distance { get; set; } - public List> RepeatSamples { get; set; } + public List> NodeSamples { get; set; } public int RepeatCount { get; set; } public double EndTime => StartTime + this.SpanCount() * Distance / Velocity; diff --git a/osu.Game/Rulesets/Objects/Legacy/Mania/ConvertHitObjectParser.cs b/osu.Game/Rulesets/Objects/Legacy/Mania/ConvertHitObjectParser.cs index 6f59965e18..eda37cc152 100644 --- a/osu.Game/Rulesets/Objects/Legacy/Mania/ConvertHitObjectParser.cs +++ b/osu.Game/Rulesets/Objects/Legacy/Mania/ConvertHitObjectParser.cs @@ -26,7 +26,7 @@ namespace osu.Game.Rulesets.Objects.Legacy.Mania }; } - protected override HitObject CreateSlider(Vector2 position, bool newCombo, int comboOffset, List controlPoints, double length, CurveType curveType, int repeatCount, List> repeatSamples) + protected override HitObject CreateSlider(Vector2 position, bool newCombo, int comboOffset, List controlPoints, double length, CurveType curveType, int repeatCount, List> nodeSamples) { return new ConvertSlider { @@ -34,7 +34,7 @@ namespace osu.Game.Rulesets.Objects.Legacy.Mania ControlPoints = controlPoints, Distance = length, CurveType = curveType, - RepeatSamples = repeatSamples, + NodeSamples = nodeSamples, RepeatCount = repeatCount }; } diff --git a/osu.Game/Rulesets/Objects/Legacy/Osu/ConvertHitObjectParser.cs b/osu.Game/Rulesets/Objects/Legacy/Osu/ConvertHitObjectParser.cs index acd0de8688..9269746f2b 100644 --- a/osu.Game/Rulesets/Objects/Legacy/Osu/ConvertHitObjectParser.cs +++ b/osu.Game/Rulesets/Objects/Legacy/Osu/ConvertHitObjectParser.cs @@ -38,7 +38,7 @@ namespace osu.Game.Rulesets.Objects.Legacy.Osu }; } - protected override HitObject CreateSlider(Vector2 position, bool newCombo, int comboOffset, List controlPoints, double length, CurveType curveType, int repeatCount, List> repeatSamples) + protected override HitObject CreateSlider(Vector2 position, bool newCombo, int comboOffset, List controlPoints, double length, CurveType curveType, int repeatCount, List> nodeSamples) { newCombo |= forceNewCombo; comboOffset += extraComboOffset; @@ -54,7 +54,7 @@ namespace osu.Game.Rulesets.Objects.Legacy.Osu ControlPoints = controlPoints, Distance = Math.Max(0, length), CurveType = curveType, - RepeatSamples = repeatSamples, + NodeSamples = nodeSamples, RepeatCount = repeatCount }; } diff --git a/osu.Game/Rulesets/Objects/Legacy/Taiko/ConvertHitObjectParser.cs b/osu.Game/Rulesets/Objects/Legacy/Taiko/ConvertHitObjectParser.cs index e5904825c2..35c66e18a7 100644 --- a/osu.Game/Rulesets/Objects/Legacy/Taiko/ConvertHitObjectParser.cs +++ b/osu.Game/Rulesets/Objects/Legacy/Taiko/ConvertHitObjectParser.cs @@ -23,14 +23,14 @@ namespace osu.Game.Rulesets.Objects.Legacy.Taiko return new ConvertHit(); } - protected override HitObject CreateSlider(Vector2 position, bool newCombo, int comboOffset, List controlPoints, double length, CurveType curveType, int repeatCount, List> repeatSamples) + protected override HitObject CreateSlider(Vector2 position, bool newCombo, int comboOffset, List controlPoints, double length, CurveType curveType, int repeatCount, List> nodeSamples) { return new ConvertSlider { ControlPoints = controlPoints, Distance = length, CurveType = curveType, - RepeatSamples = repeatSamples, + NodeSamples = nodeSamples, RepeatCount = repeatCount }; } diff --git a/osu.Game/Rulesets/Objects/Types/IHasRepeats.cs b/osu.Game/Rulesets/Objects/Types/IHasRepeats.cs index 7d918ff160..ea8784db47 100644 --- a/osu.Game/Rulesets/Objects/Types/IHasRepeats.cs +++ b/osu.Game/Rulesets/Objects/Types/IHasRepeats.cs @@ -17,9 +17,15 @@ namespace osu.Game.Rulesets.Objects.Types int RepeatCount { get; } /// - /// The samples to be played when each repeat node is hit (0 -> first repeat node, 1 -> second repeat node, etc). + /// The samples to be played when each node of the is hit.
+ /// 0: The first node.
+ /// 1: The first repeat.
+ /// 2: The second repeat.
+ /// ...
+ /// n-1: The last repeat.
+ /// n: The last node. ///
- List> RepeatSamples { get; } + List> NodeSamples { get; } } public static class HasRepeatsExtensions From f384c7228e7a0dc81f4c140318f805386e972bf0 Mon Sep 17 00:00:00 2001 From: smoogipoo Date: Tue, 16 Oct 2018 17:28:23 +0900 Subject: [PATCH 273/417] Fix post-merge issues --- osu.Game.Rulesets.Mania/Edit/ManiaEditRulesetContainer.cs | 2 +- osu.Game.Rulesets.Osu/Edit/OsuEditRulesetContainer.cs | 3 ++- osu.Game.Rulesets.Osu/Edit/OsuHitObjectComposer.cs | 1 - 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/osu.Game.Rulesets.Mania/Edit/ManiaEditRulesetContainer.cs b/osu.Game.Rulesets.Mania/Edit/ManiaEditRulesetContainer.cs index 1ddec9681f..dbe6ebb02a 100644 --- a/osu.Game.Rulesets.Mania/Edit/ManiaEditRulesetContainer.cs +++ b/osu.Game.Rulesets.Mania/Edit/ManiaEditRulesetContainer.cs @@ -32,7 +32,7 @@ namespace osu.Game.Rulesets.Mania.Edit { Anchor = Anchor.Centre, Origin = Anchor.Centre, - Size = Vector2.One + Size = Vector2.One }; } } diff --git a/osu.Game.Rulesets.Osu/Edit/OsuEditRulesetContainer.cs b/osu.Game.Rulesets.Osu/Edit/OsuEditRulesetContainer.cs index 7b02682688..5da6c2535d 100644 --- a/osu.Game.Rulesets.Osu/Edit/OsuEditRulesetContainer.cs +++ b/osu.Game.Rulesets.Osu/Edit/OsuEditRulesetContainer.cs @@ -29,7 +29,8 @@ namespace osu.Game.Rulesets.Osu.Edit } protected override CursorContainer CreateCursor() => null; + + protected override Playfield CreatePlayfield() => new OsuPlayfield { Size = Vector2.One }; } - protected override Playfield CreatePlayfield() => new OsuPlayfield { Size = Vector2.One }; } } diff --git a/osu.Game.Rulesets.Osu/Edit/OsuHitObjectComposer.cs b/osu.Game.Rulesets.Osu/Edit/OsuHitObjectComposer.cs index 5fb71505eb..8bf14e3730 100644 --- a/osu.Game.Rulesets.Osu/Edit/OsuHitObjectComposer.cs +++ b/osu.Game.Rulesets.Osu/Edit/OsuHitObjectComposer.cs @@ -11,7 +11,6 @@ using osu.Game.Rulesets.Objects.Drawables; using osu.Game.Rulesets.Osu.Edit.Masks; using osu.Game.Rulesets.Osu.Objects.Drawables; using osu.Game.Rulesets.Osu.UI; -using osu.Game.Rulesets.UI; namespace osu.Game.Rulesets.Osu.Edit { From e8ce5a7e6c60eec3ec0a5cad9fd77384216aa95f Mon Sep 17 00:00:00 2001 From: smoogipoo Date: Tue, 16 Oct 2018 18:27:09 +0900 Subject: [PATCH 274/417] Fix crashes when manually creating sliders --- osu.Game.Rulesets.Osu/Objects/Slider.cs | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/osu.Game.Rulesets.Osu/Objects/Slider.cs b/osu.Game.Rulesets.Osu/Objects/Slider.cs index 844dcfb933..c33e089178 100644 --- a/osu.Game.Rulesets.Osu/Objects/Slider.cs +++ b/osu.Game.Rulesets.Osu/Objects/Slider.cs @@ -130,7 +130,7 @@ namespace osu.Game.Rulesets.Osu.Objects { StartTime = StartTime, Position = Position, - Samples = NodeSamples[0], + Samples = getNodeSamples(0), SampleControlPoint = SampleControlPoint, IndexInCurrentCombo = IndexInCurrentCombo, ComboIndex = ComboIndex, @@ -210,11 +210,18 @@ namespace osu.Game.Rulesets.Osu.Objects Position = Position + Curve.PositionAt(repeat % 2), StackHeight = StackHeight, Scale = Scale, - Samples = new List(NodeSamples[1 + repeatIndex]) + Samples = getNodeSamples(1 + repeatIndex) }); } } + private List getNodeSamples(int nodeIndex) + { + if (nodeIndex < NodeSamples.Count) + return NodeSamples[nodeIndex]; + return Samples; + } + public override Judgement CreateJudgement() => new OsuJudgement(); } } From d431dd59a8a12e43ed9c3310d5ebbe9b15acab09 Mon Sep 17 00:00:00 2001 From: smoogipoo Date: Wed, 17 Oct 2018 10:53:21 +0900 Subject: [PATCH 275/417] Cleanups --- osu.Game/Beatmaps/BeatmapConverter.cs | 1 - osu.Game/Beatmaps/Formats/LegacyDecoder.cs | 4 +--- 2 files changed, 1 insertion(+), 4 deletions(-) diff --git a/osu.Game/Beatmaps/BeatmapConverter.cs b/osu.Game/Beatmaps/BeatmapConverter.cs index a2d7a69b5d..3cb7833a12 100644 --- a/osu.Game/Beatmaps/BeatmapConverter.cs +++ b/osu.Game/Beatmaps/BeatmapConverter.cs @@ -65,7 +65,6 @@ namespace osu.Game.Beatmaps { var result = new List(hitObjects.Count); - // ReSharper disable once ForCanBeConvertedToForeach foreach (var obj in hitObjects) { if (obj is T tObj) diff --git a/osu.Game/Beatmaps/Formats/LegacyDecoder.cs b/osu.Game/Beatmaps/Formats/LegacyDecoder.cs index db1fe6b2ed..2ef7c5de30 100644 --- a/osu.Game/Beatmaps/Formats/LegacyDecoder.cs +++ b/osu.Game/Beatmaps/Formats/LegacyDecoder.cs @@ -69,9 +69,7 @@ namespace osu.Game.Beatmaps.Formats protected string StripComments(string line) { - const string comment_prefix = "//"; - - var index = line.AsSpan().IndexOf(comment_prefix.AsSpan()); + var index = line.AsSpan().IndexOf("//".AsSpan()); if (index > 0) return line.Substring(0, index); return line; From 336b6fa38ef95f7047f56c86044d1867064935be Mon Sep 17 00:00:00 2001 From: smoogipoo Date: Wed, 17 Oct 2018 11:23:18 +0900 Subject: [PATCH 276/417] Perform a custom binary search to remove thread-unsafeness --- .../ControlPoints/ControlPointInfo.cs | 38 +++++++++---------- 1 file changed, 19 insertions(+), 19 deletions(-) diff --git a/osu.Game/Beatmaps/ControlPoints/ControlPointInfo.cs b/osu.Game/Beatmaps/ControlPoints/ControlPointInfo.cs index 4e36a755d1..d5826e85b0 100644 --- a/osu.Game/Beatmaps/ControlPoints/ControlPointInfo.cs +++ b/osu.Game/Beatmaps/ControlPoints/ControlPointInfo.cs @@ -12,11 +12,6 @@ namespace osu.Game.Beatmaps.ControlPoints [Serializable] public class ControlPointInfo { - private readonly TimingControlPoint timingSearchPoint = new TimingControlPoint(); - private readonly DifficultyControlPoint difficultySearchPoint = new DifficultyControlPoint(); - private readonly SampleControlPoint sampleSearchPoint = new SampleControlPoint(); - private readonly EffectControlPoint effectSearchPoint = new EffectControlPoint(); - /// /// All timing points. /// @@ -46,28 +41,28 @@ namespace osu.Game.Beatmaps.ControlPoints ///
/// The time to find the difficulty control point at. /// The difficulty control point. - public DifficultyControlPoint DifficultyPointAt(double time) => binarySearch(DifficultyPoints, time, difficultySearchPoint); + public DifficultyControlPoint DifficultyPointAt(double time) => binarySearch(DifficultyPoints, time); /// /// Finds the effect control point that is active at . /// /// The time to find the effect control point at. /// The effect control point. - public EffectControlPoint EffectPointAt(double time) => binarySearch(EffectPoints, time, effectSearchPoint); + public EffectControlPoint EffectPointAt(double time) => binarySearch(EffectPoints, time); /// /// Finds the sound control point that is active at . /// /// The time to find the sound control point at. /// The sound control point. - public SampleControlPoint SamplePointAt(double time) => binarySearch(SamplePoints, time, sampleSearchPoint, SamplePoints.Count > 0 ? SamplePoints[0] : null); + public SampleControlPoint SamplePointAt(double time) => binarySearch(SamplePoints, time, SamplePoints.Count > 0 ? SamplePoints[0] : null); /// /// Finds the timing control point that is active at . /// /// The time to find the timing control point at. /// The timing control point. - public TimingControlPoint TimingPointAt(double time) => binarySearch(TimingPoints, time, timingSearchPoint, TimingPoints.Count > 0 ? TimingPoints[0] : null); + public TimingControlPoint TimingPointAt(double time) => binarySearch(TimingPoints, time, TimingPoints.Count > 0 ? TimingPoints[0] : null); /// /// Finds the maximum BPM represented by any timing control point. @@ -97,7 +92,7 @@ namespace osu.Game.Beatmaps.ControlPoints /// The time to find the control point at. /// The control point to use when is before any control points. If null, a new control point will be constructed. /// The active control point at . - private T binarySearch(SortedList list, double time, T searchPoint, T prePoint = null) + private T binarySearch(SortedList list, double time, T prePoint = null) where T : ControlPoint, new() { if (list == null) @@ -109,18 +104,23 @@ namespace osu.Game.Beatmaps.ControlPoints if (time < list[0].Time) return prePoint ?? new T(); - searchPoint.Time = time; - int index = list.BinarySearch(searchPoint); + int l = 0; + int r = list.Count - 1; - // Check if we've found an exact match (t == time) - if (index >= 0) - return list[index]; + while (l <= r) + { + int pivot = l + ((r - l) >> 1); - index = ~index; + if (list[pivot].Time < time) + l = pivot + 1; + else if (list[pivot].Time > time) + r = pivot - 1; + else + return list[pivot]; + } - // BinarySearch will return the index of the first element _greater_ than the search - // This is the inactive point - the active point is the one before it (index - 1) - return list[index - 1]; + // l will be the first control point with Time > time, but we want the one before it + return list[l - 1]; } } } From 1bebceada7084e10f1a1df80f955c0d98cd5ba73 Mon Sep 17 00:00:00 2001 From: smoogipoo Date: Wed, 17 Oct 2018 11:39:29 +0900 Subject: [PATCH 277/417] Unroll loop for the last control point --- osu.Game/Beatmaps/ControlPoints/ControlPointInfo.cs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/osu.Game/Beatmaps/ControlPoints/ControlPointInfo.cs b/osu.Game/Beatmaps/ControlPoints/ControlPointInfo.cs index d5826e85b0..f064d53358 100644 --- a/osu.Game/Beatmaps/ControlPoints/ControlPointInfo.cs +++ b/osu.Game/Beatmaps/ControlPoints/ControlPointInfo.cs @@ -104,8 +104,11 @@ namespace osu.Game.Beatmaps.ControlPoints if (time < list[0].Time) return prePoint ?? new T(); + if (time >= list[list.Count - 1].Time) + return list[list.Count - 1]; + int l = 0; - int r = list.Count - 1; + int r = list.Count - 2; while (l <= r) { From 08e3fe1def87187fe297fbfbf29441ce5500618e Mon Sep 17 00:00:00 2001 From: smoogipoo Date: Wed, 17 Oct 2018 14:37:39 +0900 Subject: [PATCH 278/417] Add PlacementStarted event, rename placement methods --- .../Edit/Masks/HitCirclePlacementMask.cs | 3 ++- osu.Game/Rulesets/Edit/PlacementMask.cs | 27 +++++++++++++++++-- 2 files changed, 27 insertions(+), 3 deletions(-) diff --git a/osu.Game.Rulesets.Osu/Edit/Masks/HitCirclePlacementMask.cs b/osu.Game.Rulesets.Osu/Edit/Masks/HitCirclePlacementMask.cs index 0b248e20fe..08e417cf1a 100644 --- a/osu.Game.Rulesets.Osu/Edit/Masks/HitCirclePlacementMask.cs +++ b/osu.Game.Rulesets.Osu/Edit/Masks/HitCirclePlacementMask.cs @@ -33,7 +33,8 @@ namespace osu.Game.Rulesets.Osu.Edit.Masks { HitObject.StartTime = EditorClock.CurrentTime; HitObject.Position = e.MousePosition; - Finish(); + + EndPlacement(); return true; } diff --git a/osu.Game/Rulesets/Edit/PlacementMask.cs b/osu.Game/Rulesets/Edit/PlacementMask.cs index fd1b670274..109244c34f 100644 --- a/osu.Game/Rulesets/Edit/PlacementMask.cs +++ b/osu.Game/Rulesets/Edit/PlacementMask.cs @@ -15,6 +15,11 @@ namespace osu.Game.Rulesets.Edit { public class PlacementMask : CompositeDrawable, IRequireHighFrequencyMousePosition { + /// + /// Invoked when the placement of has started. + /// + public event Action PlacementStarted; + /// /// Invoked when the placement of has finished. /// @@ -40,10 +45,27 @@ namespace osu.Game.Rulesets.Edit HitObject.ApplyDefaults(workingBeatmap.Value.Beatmap.ControlPointInfo, workingBeatmap.Value.Beatmap.BeatmapInfo.BaseDifficulty); } + private bool placementBegun; + /// - /// Finishes the placement of . + /// Signals that the placement of has started. /// - public void Finish() => PlacementFinished?.Invoke(HitObject); + protected void BeginPlacement() + { + PlacementStarted?.Invoke(HitObject); + placementBegun = true; + } + + /// + /// Signals that the placement of has finished. + /// This will destroy this , and add the to the . + /// + protected void EndPlacement() + { + if (!placementBegun) + BeginPlacement(); + PlacementFinished?.Invoke(HitObject); + } public override bool ReceivePositionalInputAt(Vector2 screenSpacePos) => Parent?.ReceivePositionalInputAt(screenSpacePos) ?? false; @@ -64,6 +86,7 @@ namespace osu.Game.Rulesets.Edit { base.Dispose(isDisposing); + PlacementStarted = null; PlacementFinished = null; } } From 4ea4ec0d2527374eccfb04f451cd8c1043ede796 Mon Sep 17 00:00:00 2001 From: smoogipoo Date: Wed, 17 Oct 2018 15:46:30 +0900 Subject: [PATCH 279/417] Move placement handling events to a higher level --- .../Visual/TestCaseHitObjectComposer.cs | 11 ++++++- osu.Game/Rulesets/Edit/HitObjectComposer.cs | 33 +++++++++++-------- osu.Game/Rulesets/Edit/PlacementMask.cs | 27 ++++----------- .../Screens/Edit/Screens/Compose/Compose.cs | 19 ++++++++++- .../Edit/Screens/Compose/IPlacementHandler.cs | 17 ++++++++++ 5 files changed, 70 insertions(+), 37 deletions(-) create mode 100644 osu.Game/Screens/Edit/Screens/Compose/IPlacementHandler.cs diff --git a/osu.Game.Tests/Visual/TestCaseHitObjectComposer.cs b/osu.Game.Tests/Visual/TestCaseHitObjectComposer.cs index d6e59587a4..042b60b66b 100644 --- a/osu.Game.Tests/Visual/TestCaseHitObjectComposer.cs +++ b/osu.Game.Tests/Visual/TestCaseHitObjectComposer.cs @@ -15,13 +15,15 @@ using osu.Game.Rulesets.Osu; using osu.Game.Rulesets.Osu.Edit; using osu.Game.Rulesets.Osu.Edit.Masks; using osu.Game.Rulesets.Osu.Objects; +using osu.Game.Screens.Edit.Screens.Compose; using osu.Game.Screens.Edit.Screens.Compose.Layers; using osu.Game.Tests.Beatmaps; namespace osu.Game.Tests.Visual { [TestFixture] - public class TestCaseHitObjectComposer : OsuTestCase + [Cached(Type = typeof(IPlacementHandler))] + public class TestCaseHitObjectComposer : OsuTestCase, IPlacementHandler { public override IReadOnlyList RequiredTypes => new[] { @@ -36,6 +38,9 @@ namespace osu.Game.Tests.Visual typeof(HitCirclePlacementMask), }; + public event Action PlacementStarted; + public event Action PlacementFinished; + [BackgroundDependencyLoader] private void load() { @@ -67,5 +72,9 @@ namespace osu.Game.Tests.Visual Child = new OsuHitObjectComposer(new OsuRuleset()); } + + public void BeginPlacement(HitObject hitObject) => PlacementStarted?.Invoke(hitObject); + + public void EndPlacement(HitObject hitObject) => PlacementFinished?.Invoke(hitObject); } } diff --git a/osu.Game/Rulesets/Edit/HitObjectComposer.cs b/osu.Game/Rulesets/Edit/HitObjectComposer.cs index b5b7e6fe99..8cd26da166 100644 --- a/osu.Game/Rulesets/Edit/HitObjectComposer.cs +++ b/osu.Game/Rulesets/Edit/HitObjectComposer.cs @@ -15,6 +15,7 @@ using osu.Game.Rulesets.Configuration; using osu.Game.Rulesets.Edit.Tools; using osu.Game.Rulesets.Objects.Drawables; using osu.Game.Rulesets.UI; +using osu.Game.Screens.Edit.Screens.Compose; using osu.Game.Screens.Edit.Screens.Compose.Layers; using osu.Game.Screens.Edit.Screens.Compose.RadioButtons; @@ -31,10 +32,15 @@ namespace osu.Game.Rulesets.Edit private readonly List layerContainers = new List(); private readonly IBindable beatmap = new Bindable(); + [Resolved] + private IPlacementHandler placementHandler { get; set; } + private HitObjectMaskLayer maskLayer; private Container placementContainer; private EditRulesetContainer rulesetContainer; + private HitObjectCompositionTool compositionTool; + protected HitObjectComposer(Ruleset ruleset) { this.ruleset = ruleset; @@ -117,6 +123,16 @@ namespace osu.Game.Rulesets.Edit .ToList(); toolboxCollection.Items[0].Select(); + + placementHandler.PlacementFinished += h => + { + var drawableObject = rulesetContainer.AddHitObject(h); + + maskLayer.AddMask(drawableObject); + + // Re-construct the mask + setCompositionTool(compositionTool); + }; } protected override IReadOnlyDependencyContainer CreateChildDependencies(IReadOnlyDependencyContainer parent) @@ -151,23 +167,12 @@ namespace osu.Game.Rulesets.Edit private void setCompositionTool(HitObjectCompositionTool tool) { + compositionTool = tool; + placementContainer.Clear(true); if (tool != null) - { - var mask = tool.CreatePlacementMask(); - mask.PlacementFinished += h => - { - var drawableObject = rulesetContainer.AddHitObject(h); - - maskLayer.AddMask(drawableObject); - - // Re-construct the mask - setCompositionTool(tool); - }; - - placementContainer.Child = mask; - } + placementContainer.Child = tool.CreatePlacementMask(); } protected abstract EditRulesetContainer CreateRulesetContainer(Ruleset ruleset, WorkingBeatmap beatmap); diff --git a/osu.Game/Rulesets/Edit/PlacementMask.cs b/osu.Game/Rulesets/Edit/PlacementMask.cs index 109244c34f..d253638374 100644 --- a/osu.Game/Rulesets/Edit/PlacementMask.cs +++ b/osu.Game/Rulesets/Edit/PlacementMask.cs @@ -1,7 +1,6 @@ // Copyright (c) 2007-2018 ppy Pty Ltd . // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE -using System; using osu.Framework.Allocation; using osu.Framework.Graphics.Containers; using osu.Framework.Input; @@ -9,22 +8,13 @@ using osu.Framework.Input.Events; using osu.Framework.Timing; using osu.Game.Beatmaps; using osu.Game.Rulesets.Objects; +using osu.Game.Screens.Edit.Screens.Compose; using OpenTK; namespace osu.Game.Rulesets.Edit { public class PlacementMask : CompositeDrawable, IRequireHighFrequencyMousePosition { - /// - /// Invoked when the placement of has started. - /// - public event Action PlacementStarted; - - /// - /// Invoked when the placement of has finished. - /// - public event Action PlacementFinished; - /// /// The that is being placed. /// @@ -32,6 +22,9 @@ namespace osu.Game.Rulesets.Edit protected IClock EditorClock { get; private set; } + [Resolved] + private IPlacementHandler placementHandler { get; set; } + public PlacementMask(HitObject hitObject) { HitObject = hitObject; @@ -52,7 +45,7 @@ namespace osu.Game.Rulesets.Edit /// protected void BeginPlacement() { - PlacementStarted?.Invoke(HitObject); + placementHandler.BeginPlacement(HitObject); placementBegun = true; } @@ -64,7 +57,7 @@ namespace osu.Game.Rulesets.Edit { if (!placementBegun) BeginPlacement(); - PlacementFinished?.Invoke(HitObject); + placementHandler.EndPlacement(HitObject); } public override bool ReceivePositionalInputAt(Vector2 screenSpacePos) => Parent?.ReceivePositionalInputAt(screenSpacePos) ?? false; @@ -81,13 +74,5 @@ namespace osu.Game.Rulesets.Edit return false; } } - - protected override void Dispose(bool isDisposing) - { - base.Dispose(isDisposing); - - PlacementStarted = null; - PlacementFinished = null; - } } } diff --git a/osu.Game/Screens/Edit/Screens/Compose/Compose.cs b/osu.Game/Screens/Edit/Screens/Compose/Compose.cs index a862485fd6..7f720705e1 100644 --- a/osu.Game/Screens/Edit/Screens/Compose/Compose.cs +++ b/osu.Game/Screens/Edit/Screens/Compose/Compose.cs @@ -1,6 +1,7 @@ // Copyright (c) 2007-2018 ppy Pty Ltd . // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE +using System; using JetBrains.Annotations; using osu.Framework.Allocation; using OpenTK.Graphics; @@ -9,15 +10,27 @@ using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Shapes; using osu.Framework.Logging; +using osu.Game.Rulesets.Objects; using osu.Game.Screens.Edit.Screens.Compose.Timeline; namespace osu.Game.Screens.Edit.Screens.Compose { - public class Compose : EditorScreen + [Cached(Type = typeof(IPlacementHandler))] + public class Compose : EditorScreen, IPlacementHandler { private const float vertical_margins = 10; private const float horizontal_margins = 20; + /// + /// Invoked when the placement of a has started. + /// + public event Action PlacementStarted; + + /// + /// Invoked when the placement of a has finished. + /// + public event Action PlacementFinished; + private readonly BindableBeatDivisor beatDivisor = new BindableBeatDivisor(); private Container composerContainer; @@ -111,5 +124,9 @@ namespace osu.Game.Screens.Edit.Screens.Compose composerContainer.Child = composer; } + + public void BeginPlacement(HitObject hitObject) => PlacementStarted?.Invoke(hitObject); + + public void EndPlacement(HitObject hitObject) => PlacementFinished?.Invoke(hitObject); } } diff --git a/osu.Game/Screens/Edit/Screens/Compose/IPlacementHandler.cs b/osu.Game/Screens/Edit/Screens/Compose/IPlacementHandler.cs new file mode 100644 index 0000000000..2bab9334a2 --- /dev/null +++ b/osu.Game/Screens/Edit/Screens/Compose/IPlacementHandler.cs @@ -0,0 +1,17 @@ +// Copyright (c) 2007-2018 ppy Pty Ltd . +// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE + +using System; +using osu.Game.Rulesets.Objects; + +namespace osu.Game.Screens.Edit.Screens.Compose +{ + public interface IPlacementHandler + { + event Action PlacementStarted; + event Action PlacementFinished; + + void BeginPlacement(HitObject hitObject); + void EndPlacement(HitObject hitObject); + } +} From 62635c5ab8fa6134c872de7e91e1e004e361344f Mon Sep 17 00:00:00 2001 From: smoogipoo Date: Wed, 17 Oct 2018 16:17:12 +0900 Subject: [PATCH 280/417] Add container to handle placement mask --- osu.Game/Rulesets/Edit/HitObjectComposer.cs | 30 +++--------- .../Compose/Layers/HitObjectMaskLayer.cs | 3 ++ .../Compose/Layers/PlacementContainer.cs | 47 +++++++++++++++++++ 3 files changed, 56 insertions(+), 24 deletions(-) create mode 100644 osu.Game/Screens/Edit/Screens/Compose/Layers/PlacementContainer.cs diff --git a/osu.Game/Rulesets/Edit/HitObjectComposer.cs b/osu.Game/Rulesets/Edit/HitObjectComposer.cs index 8cd26da166..bea638c0fb 100644 --- a/osu.Game/Rulesets/Edit/HitObjectComposer.cs +++ b/osu.Game/Rulesets/Edit/HitObjectComposer.cs @@ -36,10 +36,9 @@ namespace osu.Game.Rulesets.Edit private IPlacementHandler placementHandler { get; set; } private HitObjectMaskLayer maskLayer; - private Container placementContainer; private EditRulesetContainer rulesetContainer; - private HitObjectCompositionTool compositionTool; + private readonly Bindable compositionTool = new Bindable(); protected HitObjectComposer(Ruleset ruleset) { @@ -74,7 +73,7 @@ namespace osu.Game.Rulesets.Edit layerAboveRuleset.Children = new Drawable[] { maskLayer = new HitObjectMaskLayer(), - placementContainer = new Container { RelativeSizeAxes = Axes.Both } + new PlacementContainer(compositionTool), }; layerContainers.Add(layerBelowRuleset); @@ -118,21 +117,14 @@ namespace osu.Game.Rulesets.Edit }; toolboxCollection.Items = - CompositionTools.Select(t => new RadioButton(t.Name, () => setCompositionTool(t))) - .Prepend(new RadioButton("Select", () => setCompositionTool(null))) + CompositionTools.Select(t => new RadioButton(t.Name, () => compositionTool.Value = t)) + .Prepend(new RadioButton("Select", () => compositionTool.Value = null)) .ToList(); toolboxCollection.Items[0].Select(); - placementHandler.PlacementFinished += h => - { - var drawableObject = rulesetContainer.AddHitObject(h); - - maskLayer.AddMask(drawableObject); - - // Re-construct the mask - setCompositionTool(compositionTool); - }; + // Todo: no + placementHandler.PlacementFinished += h => maskLayer.AddMask(rulesetContainer.AddHitObject(h)); } protected override IReadOnlyDependencyContainer CreateChildDependencies(IReadOnlyDependencyContainer parent) @@ -165,16 +157,6 @@ namespace osu.Game.Rulesets.Edit }); } - private void setCompositionTool(HitObjectCompositionTool tool) - { - compositionTool = tool; - - placementContainer.Clear(true); - - if (tool != null) - placementContainer.Child = tool.CreatePlacementMask(); - } - protected abstract EditRulesetContainer CreateRulesetContainer(Ruleset ruleset, WorkingBeatmap beatmap); protected abstract IReadOnlyList CompositionTools { get; } diff --git a/osu.Game/Screens/Edit/Screens/Compose/Layers/HitObjectMaskLayer.cs b/osu.Game/Screens/Edit/Screens/Compose/Layers/HitObjectMaskLayer.cs index 7a1ad32140..63fcf09d2a 100644 --- a/osu.Game/Screens/Edit/Screens/Compose/Layers/HitObjectMaskLayer.cs +++ b/osu.Game/Screens/Edit/Screens/Compose/Layers/HitObjectMaskLayer.cs @@ -15,6 +15,9 @@ namespace osu.Game.Screens.Edit.Screens.Compose.Layers private MaskContainer maskContainer; private HitObjectComposer composer; + [Resolved] + private IPlacementHandler placementHandler { get; set; } + public HitObjectMaskLayer() { RelativeSizeAxes = Axes.Both; diff --git a/osu.Game/Screens/Edit/Screens/Compose/Layers/PlacementContainer.cs b/osu.Game/Screens/Edit/Screens/Compose/Layers/PlacementContainer.cs new file mode 100644 index 0000000000..41635565dd --- /dev/null +++ b/osu.Game/Screens/Edit/Screens/Compose/Layers/PlacementContainer.cs @@ -0,0 +1,47 @@ +// Copyright (c) 2007-2018 ppy Pty Ltd . +// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE + +using osu.Framework.Allocation; +using osu.Framework.Configuration; +using osu.Framework.Graphics; +using osu.Framework.Graphics.Containers; +using osu.Game.Rulesets.Edit.Tools; +using Container = System.ComponentModel.Container; + +namespace osu.Game.Screens.Edit.Screens.Compose.Layers +{ + public class PlacementContainer : CompositeDrawable + { + private readonly Container maskContainer; + + private readonly IBindable compositionTool = new Bindable(); + + [Resolved] + private IPlacementHandler placementHandler { get; set; } + + public PlacementContainer(IBindable compositionTool) + { + this.compositionTool.BindTo(compositionTool); + + RelativeSizeAxes = Axes.Both; + + this.compositionTool.BindValueChanged(onToolChanged); + } + + [BackgroundDependencyLoader] + private void load() + { + // Refresh the mask after each placement + placementHandler.PlacementFinished += _ => onToolChanged(compositionTool.Value); + } + + private void onToolChanged(HitObjectCompositionTool tool) + { + ClearInternal(); + + var mask = tool?.CreatePlacementMask(); + if (mask != null) + InternalChild = mask; + } + } +} From a6d05febff65539ae34163b6e69c588d9ac2fb74 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Wed, 17 Oct 2018 16:26:41 +0900 Subject: [PATCH 281/417] Attempt with different key source --- appveyor_deploy.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/appveyor_deploy.yml b/appveyor_deploy.yml index 22a4859885..355f0603be 100644 --- a/appveyor_deploy.yml +++ b/appveyor_deploy.yml @@ -10,8 +10,8 @@ before_build: - cmd: nuget restore -verbosity quiet build_script: - ps: iex ((New-Object Net.WebClient).DownloadString('https://raw.githubusercontent.com/appveyor/secure-file/master/install.ps1')) - - appveyor DownloadFile https://puu.sh/BCrS8/7faccf7876.enc # signing certificate - - cmd: appveyor-tools\secure-file -decrypt 7faccf7876.enc -secret %decode_secret% -out %HOMEPATH%\deanherbert.pfx + - appveyor DownloadFile https://www.dropbox.com/s/f7hv069mr5tqi2j/deanherbert.pfx.enc?dl=1 # signing certificate + - cmd: appveyor-tools\secure-file -decrypt deanherbert.pfx.enc -secret %decode_secret% -out %HOMEPATH%\deanherbert.pfx - appveyor DownloadFile https://puu.sh/A6g75/fdc6f19b04.enc # deploy configuration - cd osu-deploy - nuget restore -verbosity quiet From 969477dadd247badf77303f1fb013bfb7172a924 Mon Sep 17 00:00:00 2001 From: smoogipoo Date: Wed, 17 Oct 2018 17:41:17 +0900 Subject: [PATCH 282/417] Remove placement events, make everything pass top-down --- .../Visual/TestCaseHitObjectComposer.cs | 11 +++--- .../Rulesets/Edit/EditRulesetContainer.cs | 13 +++++-- osu.Game/Rulesets/Edit/HitObjectComposer.cs | 24 ++++++------ .../Screens/Edit/Screens/Compose/Compose.cs | 24 +++++------- .../Edit/Screens/Compose/IPlacementHandler.cs | 4 -- .../Compose/Layers/HitObjectMaskLayer.cs | 11 ++---- .../Compose/Layers/PlacementContainer.cs | 39 ++++++++++--------- 7 files changed, 62 insertions(+), 64 deletions(-) diff --git a/osu.Game.Tests/Visual/TestCaseHitObjectComposer.cs b/osu.Game.Tests/Visual/TestCaseHitObjectComposer.cs index 042b60b66b..73df413699 100644 --- a/osu.Game.Tests/Visual/TestCaseHitObjectComposer.cs +++ b/osu.Game.Tests/Visual/TestCaseHitObjectComposer.cs @@ -38,8 +38,7 @@ namespace osu.Game.Tests.Visual typeof(HitCirclePlacementMask), }; - public event Action PlacementStarted; - public event Action PlacementFinished; + private HitObjectComposer composer; [BackgroundDependencyLoader] private void load() @@ -70,11 +69,13 @@ namespace osu.Game.Tests.Visual Dependencies.CacheAs(clock); Dependencies.CacheAs(clock); - Child = new OsuHitObjectComposer(new OsuRuleset()); + Child = composer = new OsuHitObjectComposer(new OsuRuleset()); } - public void BeginPlacement(HitObject hitObject) => PlacementStarted?.Invoke(hitObject); + public void BeginPlacement(HitObject hitObject) + { + } - public void EndPlacement(HitObject hitObject) => PlacementFinished?.Invoke(hitObject); + public void EndPlacement(HitObject hitObject) => composer.Add(hitObject); } } diff --git a/osu.Game/Rulesets/Edit/EditRulesetContainer.cs b/osu.Game/Rulesets/Edit/EditRulesetContainer.cs index 41f17337de..8a2d4431b2 100644 --- a/osu.Game/Rulesets/Edit/EditRulesetContainer.cs +++ b/osu.Game/Rulesets/Edit/EditRulesetContainer.cs @@ -21,7 +21,12 @@ namespace osu.Game.Rulesets.Edit RelativeSizeAxes = Axes.Both; } - public abstract DrawableHitObject AddHitObject(HitObject hitObject); + /// + /// Adds a to the and displays a visual representation of it. + /// + /// The to add. + /// The visual representation of . + internal abstract DrawableHitObject Add(HitObject hitObject); } public abstract class EditRulesetContainer : EditRulesetContainer @@ -41,20 +46,22 @@ namespace osu.Game.Rulesets.Edit InternalChild = rulesetContainer = CreateRulesetContainer(ruleset, workingBeatmap); } - public override DrawableHitObject AddHitObject(HitObject hitObject) + internal override DrawableHitObject Add(HitObject hitObject) { var tObject = (TObject)hitObject; - // Insert into beatmap while maintaining sorting order + // Add to beatmap, preserving sorting order var insertionIndex = beatmap.HitObjects.FindLastIndex(h => h.StartTime <= hitObject.StartTime); beatmap.HitObjects.Insert(insertionIndex + 1, tObject); + // Process object var processor = ruleset.CreateBeatmapProcessor(beatmap); processor.PreProcess(); tObject.ApplyDefaults(beatmap.ControlPointInfo, beatmap.BeatmapInfo.BaseDifficulty); processor.PostProcess(); + // Add visual representation var drawableObject = rulesetContainer.GetVisualRepresentation(tObject); rulesetContainer.Playfield.Add(drawableObject); diff --git a/osu.Game/Rulesets/Edit/HitObjectComposer.cs b/osu.Game/Rulesets/Edit/HitObjectComposer.cs index bea638c0fb..6212f8adcf 100644 --- a/osu.Game/Rulesets/Edit/HitObjectComposer.cs +++ b/osu.Game/Rulesets/Edit/HitObjectComposer.cs @@ -13,9 +13,9 @@ using osu.Framework.Timing; using osu.Game.Beatmaps; using osu.Game.Rulesets.Configuration; using osu.Game.Rulesets.Edit.Tools; +using osu.Game.Rulesets.Objects; using osu.Game.Rulesets.Objects.Drawables; using osu.Game.Rulesets.UI; -using osu.Game.Screens.Edit.Screens.Compose; using osu.Game.Screens.Edit.Screens.Compose.Layers; using osu.Game.Screens.Edit.Screens.Compose.RadioButtons; @@ -32,13 +32,10 @@ namespace osu.Game.Rulesets.Edit private readonly List layerContainers = new List(); private readonly IBindable beatmap = new Bindable(); - [Resolved] - private IPlacementHandler placementHandler { get; set; } - - private HitObjectMaskLayer maskLayer; private EditRulesetContainer rulesetContainer; - private readonly Bindable compositionTool = new Bindable(); + private HitObjectMaskLayer maskLayer; + private PlacementContainer placementContainer; protected HitObjectComposer(Ruleset ruleset) { @@ -73,7 +70,7 @@ namespace osu.Game.Rulesets.Edit layerAboveRuleset.Children = new Drawable[] { maskLayer = new HitObjectMaskLayer(), - new PlacementContainer(compositionTool), + placementContainer = new PlacementContainer(), }; layerContainers.Add(layerBelowRuleset); @@ -117,14 +114,11 @@ namespace osu.Game.Rulesets.Edit }; toolboxCollection.Items = - CompositionTools.Select(t => new RadioButton(t.Name, () => compositionTool.Value = t)) - .Prepend(new RadioButton("Select", () => compositionTool.Value = null)) + CompositionTools.Select(t => new RadioButton(t.Name, () => placementContainer.CurrentTool = t)) + .Prepend(new RadioButton("Select", () => placementContainer.CurrentTool = null)) .ToList(); toolboxCollection.Items[0].Select(); - - // Todo: no - placementHandler.PlacementFinished += h => maskLayer.AddMask(rulesetContainer.AddHitObject(h)); } protected override IReadOnlyDependencyContainer CreateChildDependencies(IReadOnlyDependencyContainer parent) @@ -157,6 +151,12 @@ namespace osu.Game.Rulesets.Edit }); } + /// + /// Adds a to the and visualises it. + /// + /// The to add. + public void Add(HitObject hitObject) => maskLayer.AddMaskFor(rulesetContainer.Add(hitObject)); + protected abstract EditRulesetContainer CreateRulesetContainer(Ruleset ruleset, WorkingBeatmap beatmap); protected abstract IReadOnlyList CompositionTools { get; } diff --git a/osu.Game/Screens/Edit/Screens/Compose/Compose.cs b/osu.Game/Screens/Edit/Screens/Compose/Compose.cs index 7f720705e1..1617313ecd 100644 --- a/osu.Game/Screens/Edit/Screens/Compose/Compose.cs +++ b/osu.Game/Screens/Edit/Screens/Compose/Compose.cs @@ -1,7 +1,6 @@ // Copyright (c) 2007-2018 ppy Pty Ltd . // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE -using System; using JetBrains.Annotations; using osu.Framework.Allocation; using OpenTK.Graphics; @@ -10,6 +9,7 @@ using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Shapes; using osu.Framework.Logging; +using osu.Game.Rulesets.Edit; using osu.Game.Rulesets.Objects; using osu.Game.Screens.Edit.Screens.Compose.Timeline; @@ -21,19 +21,9 @@ namespace osu.Game.Screens.Edit.Screens.Compose private const float vertical_margins = 10; private const float horizontal_margins = 20; - /// - /// Invoked when the placement of a has started. - /// - public event Action PlacementStarted; - - /// - /// Invoked when the placement of a has finished. - /// - public event Action PlacementFinished; - private readonly BindableBeatDivisor beatDivisor = new BindableBeatDivisor(); - private Container composerContainer; + private HitObjectComposer composer; [BackgroundDependencyLoader(true)] private void load([CanBeNull] BindableBeatDivisor beatDivisor) @@ -41,6 +31,8 @@ namespace osu.Game.Screens.Edit.Screens.Compose if (beatDivisor != null) this.beatDivisor.BindTo(beatDivisor); + Container composerContainer; + Children = new Drawable[] { new GridContainer @@ -114,7 +106,7 @@ namespace osu.Game.Screens.Edit.Screens.Compose return; } - var composer = ruleset.CreateHitObjectComposer(); + composer = ruleset.CreateHitObjectComposer(); if (composer == null) { Logger.Log($"Ruleset {ruleset.Description} doesn't support hitobject composition."); @@ -125,8 +117,10 @@ namespace osu.Game.Screens.Edit.Screens.Compose composerContainer.Child = composer; } - public void BeginPlacement(HitObject hitObject) => PlacementStarted?.Invoke(hitObject); + public void BeginPlacement(HitObject hitObject) + { + } - public void EndPlacement(HitObject hitObject) => PlacementFinished?.Invoke(hitObject); + public void EndPlacement(HitObject hitObject) => composer.Add(hitObject); } } diff --git a/osu.Game/Screens/Edit/Screens/Compose/IPlacementHandler.cs b/osu.Game/Screens/Edit/Screens/Compose/IPlacementHandler.cs index 2bab9334a2..894d23b90e 100644 --- a/osu.Game/Screens/Edit/Screens/Compose/IPlacementHandler.cs +++ b/osu.Game/Screens/Edit/Screens/Compose/IPlacementHandler.cs @@ -1,16 +1,12 @@ // Copyright (c) 2007-2018 ppy Pty Ltd . // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE -using System; using osu.Game.Rulesets.Objects; namespace osu.Game.Screens.Edit.Screens.Compose { public interface IPlacementHandler { - event Action PlacementStarted; - event Action PlacementFinished; - void BeginPlacement(HitObject hitObject); void EndPlacement(HitObject hitObject); } diff --git a/osu.Game/Screens/Edit/Screens/Compose/Layers/HitObjectMaskLayer.cs b/osu.Game/Screens/Edit/Screens/Compose/Layers/HitObjectMaskLayer.cs index 63fcf09d2a..c6a4c3de13 100644 --- a/osu.Game/Screens/Edit/Screens/Compose/Layers/HitObjectMaskLayer.cs +++ b/osu.Game/Screens/Edit/Screens/Compose/Layers/HitObjectMaskLayer.cs @@ -13,10 +13,9 @@ namespace osu.Game.Screens.Edit.Screens.Compose.Layers public class HitObjectMaskLayer : CompositeDrawable { private MaskContainer maskContainer; - private HitObjectComposer composer; [Resolved] - private IPlacementHandler placementHandler { get; set; } + private HitObjectComposer composer { get; set; } public HitObjectMaskLayer() { @@ -24,10 +23,8 @@ namespace osu.Game.Screens.Edit.Screens.Compose.Layers } [BackgroundDependencyLoader] - private void load(HitObjectComposer composer) + private void load() { - this.composer = composer; - maskContainer = new MaskContainer(); var maskSelection = composer.CreateMaskSelection(); @@ -51,7 +48,7 @@ namespace osu.Game.Screens.Edit.Screens.Compose.Layers }; foreach (var obj in composer.HitObjects) - AddMask(obj); + AddMaskFor(obj); } protected override bool OnMouseDown(MouseDownEvent e) @@ -64,7 +61,7 @@ namespace osu.Game.Screens.Edit.Screens.Compose.Layers /// Adds a mask for a which adds movement support. ///
/// The to create a mask for. - public void AddMask(DrawableHitObject hitObject) + public void AddMaskFor(DrawableHitObject hitObject) { var mask = composer.CreateMaskFor(hitObject); if (mask == null) diff --git a/osu.Game/Screens/Edit/Screens/Compose/Layers/PlacementContainer.cs b/osu.Game/Screens/Edit/Screens/Compose/Layers/PlacementContainer.cs index 41635565dd..ea167a5c6b 100644 --- a/osu.Game/Screens/Edit/Screens/Compose/Layers/PlacementContainer.cs +++ b/osu.Game/Screens/Edit/Screens/Compose/Layers/PlacementContainer.cs @@ -1,8 +1,6 @@ // Copyright (c) 2007-2018 ppy Pty Ltd . // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE -using osu.Framework.Allocation; -using osu.Framework.Configuration; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Game.Rulesets.Edit.Tools; @@ -14,32 +12,37 @@ namespace osu.Game.Screens.Edit.Screens.Compose.Layers { private readonly Container maskContainer; - private readonly IBindable compositionTool = new Bindable(); - - [Resolved] - private IPlacementHandler placementHandler { get; set; } - - public PlacementContainer(IBindable compositionTool) + public PlacementContainer() { - this.compositionTool.BindTo(compositionTool); - RelativeSizeAxes = Axes.Both; - - this.compositionTool.BindValueChanged(onToolChanged); } - [BackgroundDependencyLoader] - private void load() + private HitObjectCompositionTool currentTool; + + /// + /// The current placement tool. + /// + public HitObjectCompositionTool CurrentTool { - // Refresh the mask after each placement - placementHandler.PlacementFinished += _ => onToolChanged(compositionTool.Value); + get => currentTool; + set + { + if (currentTool == value) + return; + currentTool = value; + + Refresh(); + } } - private void onToolChanged(HitObjectCompositionTool tool) + /// + /// Refreshes the current placement tool. + /// + public void Refresh() { ClearInternal(); - var mask = tool?.CreatePlacementMask(); + var mask = CurrentTool?.CreatePlacementMask(); if (mask != null) InternalChild = mask; } From d36ac59ca278018e9e9df41de0665c3a0bb5af8d Mon Sep 17 00:00:00 2001 From: smoogipoo Date: Wed, 17 Oct 2018 18:01:38 +0900 Subject: [PATCH 283/417] Reduce complexity of creating edit ruleset containers --- .../Edit/ManiaEditRulesetContainer.cs | 29 ++++--------- .../Edit/ManiaHitObjectComposer.cs | 7 +++- .../Edit/OsuEditRulesetContainer.cs | 23 +++------- .../Edit/OsuHitObjectComposer.cs | 7 +++- .../Rulesets/Edit/EditRulesetContainer.cs | 33 +++++++-------- osu.Game/Rulesets/Edit/HitObjectComposer.cs | 42 +++++++++++-------- osu.Game/Rulesets/UI/RulesetContainer.cs | 2 +- 7 files changed, 64 insertions(+), 79 deletions(-) diff --git a/osu.Game.Rulesets.Mania/Edit/ManiaEditRulesetContainer.cs b/osu.Game.Rulesets.Mania/Edit/ManiaEditRulesetContainer.cs index dbe6ebb02a..138a2c0273 100644 --- a/osu.Game.Rulesets.Mania/Edit/ManiaEditRulesetContainer.cs +++ b/osu.Game.Rulesets.Mania/Edit/ManiaEditRulesetContainer.cs @@ -4,36 +4,23 @@ using osu.Framework.Graphics; using OpenTK; using osu.Game.Beatmaps; -using osu.Game.Rulesets.Edit; -using osu.Game.Rulesets.Mania.Objects; using osu.Game.Rulesets.Mania.UI; using osu.Game.Rulesets.UI; namespace osu.Game.Rulesets.Mania.Edit { - public class ManiaEditRulesetContainer : EditRulesetContainer + public class ManiaEditRulesetContainer : ManiaRulesetContainer { - public ManiaEditRulesetContainer(Ruleset ruleset, WorkingBeatmap workingBeatmap) - : base(ruleset, workingBeatmap) + public ManiaEditRulesetContainer(Ruleset ruleset, WorkingBeatmap beatmap) + : base(ruleset, beatmap) { } - protected override RulesetContainer CreateRulesetContainer(Ruleset ruleset, WorkingBeatmap workingBeatmap) - => new RulesetContainer(ruleset, workingBeatmap); - - private new class RulesetContainer : ManiaRulesetContainer + protected override Playfield CreatePlayfield() => new ManiaEditPlayfield(Beatmap.Stages) { - public RulesetContainer(Ruleset ruleset, WorkingBeatmap beatmap) - : base(ruleset, beatmap) - { - } - - protected override Playfield CreatePlayfield() => new ManiaEditPlayfield(Beatmap.Stages) - { - Anchor = Anchor.Centre, - Origin = Anchor.Centre, - Size = Vector2.One - }; - } + Anchor = Anchor.Centre, + Origin = Anchor.Centre, + Size = Vector2.One + }; } } diff --git a/osu.Game.Rulesets.Mania/Edit/ManiaHitObjectComposer.cs b/osu.Game.Rulesets.Mania/Edit/ManiaHitObjectComposer.cs index 8363d1dc44..fe97f9bc8e 100644 --- a/osu.Game.Rulesets.Mania/Edit/ManiaHitObjectComposer.cs +++ b/osu.Game.Rulesets.Mania/Edit/ManiaHitObjectComposer.cs @@ -11,11 +11,13 @@ using System.Collections.Generic; using osu.Framework.Allocation; using osu.Game.Rulesets.Mania.Configuration; using osu.Game.Rulesets.Mania.Edit.Masks; +using osu.Game.Rulesets.Mania.Objects; using osu.Game.Rulesets.Mania.UI; +using osu.Game.Rulesets.UI; namespace osu.Game.Rulesets.Mania.Edit { - public class ManiaHitObjectComposer : HitObjectComposer + public class ManiaHitObjectComposer : HitObjectComposer { protected new ManiaConfigManager Config => (ManiaConfigManager)base.Config; @@ -31,7 +33,8 @@ namespace osu.Game.Rulesets.Mania.Edit return dependencies; } - protected override EditRulesetContainer CreateRulesetContainer(Ruleset ruleset, WorkingBeatmap beatmap) => new ManiaEditRulesetContainer(ruleset, beatmap); + protected override RulesetContainer CreateRulesetContainer(Ruleset ruleset, WorkingBeatmap beatmap) + => new ManiaEditRulesetContainer(ruleset, beatmap); protected override IReadOnlyList CompositionTools => Array.Empty(); diff --git a/osu.Game.Rulesets.Osu/Edit/OsuEditRulesetContainer.cs b/osu.Game.Rulesets.Osu/Edit/OsuEditRulesetContainer.cs index 5da6c2535d..8571de39f4 100644 --- a/osu.Game.Rulesets.Osu/Edit/OsuEditRulesetContainer.cs +++ b/osu.Game.Rulesets.Osu/Edit/OsuEditRulesetContainer.cs @@ -3,34 +3,21 @@ using osu.Framework.Graphics.Cursor; using osu.Game.Beatmaps; -using osu.Game.Rulesets.Edit; -using osu.Game.Rulesets.Osu.Objects; using osu.Game.Rulesets.Osu.UI; using osu.Game.Rulesets.UI; using OpenTK; namespace osu.Game.Rulesets.Osu.Edit { - public class OsuEditRulesetContainer : EditRulesetContainer + public class OsuEditRulesetContainer : OsuRulesetContainer { - public OsuEditRulesetContainer(Ruleset ruleset, WorkingBeatmap workingBeatmap) - : base(ruleset, workingBeatmap) + public OsuEditRulesetContainer(Ruleset ruleset, WorkingBeatmap beatmap) + : base(ruleset, beatmap) { } - protected override RulesetContainer CreateRulesetContainer(Ruleset ruleset, WorkingBeatmap workingBeatmap) - => new RulesetContainer(ruleset, workingBeatmap); + protected override CursorContainer CreateCursor() => null; - private new class RulesetContainer : OsuRulesetContainer - { - public RulesetContainer(Ruleset ruleset, WorkingBeatmap beatmap) - : base(ruleset, beatmap) - { - } - - protected override CursorContainer CreateCursor() => null; - - protected override Playfield CreatePlayfield() => new OsuPlayfield { Size = Vector2.One }; - } + protected override Playfield CreatePlayfield() => new OsuPlayfield { Size = Vector2.One }; } } diff --git a/osu.Game.Rulesets.Osu/Edit/OsuHitObjectComposer.cs b/osu.Game.Rulesets.Osu/Edit/OsuHitObjectComposer.cs index 8bf14e3730..2dbd15fdc0 100644 --- a/osu.Game.Rulesets.Osu/Edit/OsuHitObjectComposer.cs +++ b/osu.Game.Rulesets.Osu/Edit/OsuHitObjectComposer.cs @@ -9,19 +9,22 @@ using osu.Game.Rulesets.Edit; using osu.Game.Rulesets.Edit.Tools; using osu.Game.Rulesets.Objects.Drawables; using osu.Game.Rulesets.Osu.Edit.Masks; +using osu.Game.Rulesets.Osu.Objects; using osu.Game.Rulesets.Osu.Objects.Drawables; using osu.Game.Rulesets.Osu.UI; +using osu.Game.Rulesets.UI; namespace osu.Game.Rulesets.Osu.Edit { - public class OsuHitObjectComposer : HitObjectComposer + public class OsuHitObjectComposer : HitObjectComposer { public OsuHitObjectComposer(Ruleset ruleset) : base(ruleset) { } - protected override EditRulesetContainer CreateRulesetContainer(Ruleset ruleset, WorkingBeatmap beatmap) => new OsuEditRulesetContainer(ruleset, beatmap); + protected override RulesetContainer CreateRulesetContainer(Ruleset ruleset, WorkingBeatmap beatmap) + => new OsuEditRulesetContainer(ruleset, beatmap); protected override IReadOnlyList CompositionTools => new[] { diff --git a/osu.Game/Rulesets/Edit/EditRulesetContainer.cs b/osu.Game/Rulesets/Edit/EditRulesetContainer.cs index 8a2d4431b2..d993a7cca2 100644 --- a/osu.Game/Rulesets/Edit/EditRulesetContainer.cs +++ b/osu.Game/Rulesets/Edit/EditRulesetContainer.cs @@ -12,9 +12,10 @@ namespace osu.Game.Rulesets.Edit { public abstract class EditRulesetContainer : CompositeDrawable { - public Playfield Playfield => RulesetContainer.Playfield; - - protected abstract RulesetContainer RulesetContainer { get; } + /// + /// The contained by this . + /// + public abstract Playfield Playfield { get; } internal EditRulesetContainer() { @@ -29,21 +30,23 @@ namespace osu.Game.Rulesets.Edit internal abstract DrawableHitObject Add(HitObject hitObject); } - public abstract class EditRulesetContainer : EditRulesetContainer + public class EditRulesetContainer : EditRulesetContainer where TObject : HitObject { - private readonly Ruleset ruleset; - - private readonly RulesetContainer rulesetContainer; - protected override RulesetContainer RulesetContainer => rulesetContainer; + public override Playfield Playfield => rulesetContainer.Playfield; + private Ruleset ruleset => rulesetContainer.Ruleset; private Beatmap beatmap => rulesetContainer.Beatmap; - protected EditRulesetContainer(Ruleset ruleset, WorkingBeatmap workingBeatmap) - { - this.ruleset = ruleset; + private readonly RulesetContainer rulesetContainer; - InternalChild = rulesetContainer = CreateRulesetContainer(ruleset, workingBeatmap); + public EditRulesetContainer(RulesetContainer rulesetContainer) + { + this.rulesetContainer = rulesetContainer; + + InternalChild = rulesetContainer; + + Playfield.DisplayJudgements.Value = false; } internal override DrawableHitObject Add(HitObject hitObject) @@ -69,11 +72,5 @@ namespace osu.Game.Rulesets.Edit return drawableObject; } - - /// - /// Creates the underlying . - /// - /// - protected abstract RulesetContainer CreateRulesetContainer(Ruleset ruleset, WorkingBeatmap workingBeatmap); } } diff --git a/osu.Game/Rulesets/Edit/HitObjectComposer.cs b/osu.Game/Rulesets/Edit/HitObjectComposer.cs index 6212f8adcf..90a3fcd933 100644 --- a/osu.Game/Rulesets/Edit/HitObjectComposer.cs +++ b/osu.Game/Rulesets/Edit/HitObjectComposer.cs @@ -23,23 +23,24 @@ namespace osu.Game.Rulesets.Edit { public abstract class HitObjectComposer : CompositeDrawable { - private readonly Ruleset ruleset; - public IEnumerable HitObjects => rulesetContainer.Playfield.AllHitObjects; + protected readonly Ruleset Ruleset; + + protected readonly IBindable Beatmap = new Bindable(); + protected IRulesetConfigManager Config { get; private set; } private readonly List layerContainers = new List(); - private readonly IBindable beatmap = new Bindable(); private EditRulesetContainer rulesetContainer; private HitObjectMaskLayer maskLayer; private PlacementContainer placementContainer; - protected HitObjectComposer(Ruleset ruleset) + internal HitObjectComposer(Ruleset ruleset) { - this.ruleset = ruleset; + Ruleset = ruleset; RelativeSizeAxes = Axes.Both; } @@ -47,11 +48,11 @@ namespace osu.Game.Rulesets.Edit [BackgroundDependencyLoader] private void load(IBindableBeatmap beatmap, IFrameBasedClock framedClock) { - this.beatmap.BindTo(beatmap); + Beatmap.BindTo(beatmap); try { - rulesetContainer = CreateRulesetContainer(ruleset, beatmap.Value); + rulesetContainer = CreateRulesetContainer(); rulesetContainer.Clock = framedClock; } catch (Exception e) @@ -126,18 +127,11 @@ namespace osu.Game.Rulesets.Edit var dependencies = new DependencyContainer(base.CreateChildDependencies(parent)); dependencies.CacheAs(this); - Config = dependencies.Get().GetConfigFor(ruleset); + Config = dependencies.Get().GetConfigFor(Ruleset); return dependencies; } - protected override void LoadComplete() - { - base.LoadComplete(); - - rulesetContainer.Playfield.DisplayJudgements.Value = false; - } - protected override void UpdateAfterChildren() { base.UpdateAfterChildren(); @@ -152,12 +146,12 @@ namespace osu.Game.Rulesets.Edit } /// - /// Adds a to the and visualises it. + /// Adds a to the and visualises it. /// /// The to add. public void Add(HitObject hitObject) => maskLayer.AddMaskFor(rulesetContainer.Add(hitObject)); - protected abstract EditRulesetContainer CreateRulesetContainer(Ruleset ruleset, WorkingBeatmap beatmap); + internal abstract EditRulesetContainer CreateRulesetContainer(); protected abstract IReadOnlyList CompositionTools { get; } @@ -178,4 +172,18 @@ namespace osu.Game.Rulesets.Edit ///
protected virtual Container CreateLayerContainer() => new Container { RelativeSizeAxes = Axes.Both }; } + + public abstract class HitObjectComposer : HitObjectComposer + where TObject : HitObject + { + protected HitObjectComposer(Ruleset ruleset) + : base(ruleset) + { + } + + internal override EditRulesetContainer CreateRulesetContainer() + => new EditRulesetContainer(CreateRulesetContainer(Ruleset, Beatmap.Value)); + + protected abstract RulesetContainer CreateRulesetContainer(Ruleset ruleset, WorkingBeatmap beatmap); + } } diff --git a/osu.Game/Rulesets/UI/RulesetContainer.cs b/osu.Game/Rulesets/UI/RulesetContainer.cs index e2b5754b9e..3484018fc0 100644 --- a/osu.Game/Rulesets/UI/RulesetContainer.cs +++ b/osu.Game/Rulesets/UI/RulesetContainer.cs @@ -73,7 +73,7 @@ namespace osu.Game.Rulesets.UI ///
public readonly CursorContainer Cursor; - protected readonly Ruleset Ruleset; + public readonly Ruleset Ruleset; protected IRulesetConfigManager Config { get; private set; } From 6eb7a030d0aa71dd3e0e1d6771fcf832026c2015 Mon Sep 17 00:00:00 2001 From: smoogipoo Date: Wed, 17 Oct 2018 18:11:44 +0900 Subject: [PATCH 284/417] Fix placement container not being refreshed upon placement --- osu.Game/Rulesets/Edit/HitObjectComposer.cs | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/osu.Game/Rulesets/Edit/HitObjectComposer.cs b/osu.Game/Rulesets/Edit/HitObjectComposer.cs index 90a3fcd933..4010218c8c 100644 --- a/osu.Game/Rulesets/Edit/HitObjectComposer.cs +++ b/osu.Game/Rulesets/Edit/HitObjectComposer.cs @@ -149,7 +149,11 @@ namespace osu.Game.Rulesets.Edit /// Adds a to the and visualises it. ///
/// The to add. - public void Add(HitObject hitObject) => maskLayer.AddMaskFor(rulesetContainer.Add(hitObject)); + public void Add(HitObject hitObject) + { + maskLayer.AddMaskFor(rulesetContainer.Add(hitObject)); + placementContainer.Refresh(); + } internal abstract EditRulesetContainer CreateRulesetContainer(); From f42f9cffe34a57b516c298feb9e5a52ee548f96d Mon Sep 17 00:00:00 2001 From: smoogipoo Date: Wed, 17 Oct 2018 18:12:29 +0900 Subject: [PATCH 285/417] Make HitCirclePlacementMask directly modify hitcircle position --- .../Edit/Masks/HitCirclePlacementMask.cs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/osu.Game.Rulesets.Osu/Edit/Masks/HitCirclePlacementMask.cs b/osu.Game.Rulesets.Osu/Edit/Masks/HitCirclePlacementMask.cs index 08e417cf1a..ca250e25e6 100644 --- a/osu.Game.Rulesets.Osu/Edit/Masks/HitCirclePlacementMask.cs +++ b/osu.Game.Rulesets.Osu/Edit/Masks/HitCirclePlacementMask.cs @@ -19,6 +19,8 @@ namespace osu.Game.Rulesets.Osu.Edit.Masks AutoSizeAxes = Axes.Both; InternalChild = new HitCircleMask(HitObject); + + HitObject.PositionChanged += _ => Position = HitObject.StackedPosition; } protected override void LoadComplete() @@ -26,21 +28,19 @@ namespace osu.Game.Rulesets.Osu.Edit.Masks base.LoadComplete(); // Fixes a 1-frame position discrpancy due to the first mouse move event happening in the next frame - Position = GetContainingInputManager().CurrentState.Mouse.Position; + HitObject.Position = GetContainingInputManager().CurrentState.Mouse.Position; } protected override bool OnClick(ClickEvent e) { HitObject.StartTime = EditorClock.CurrentTime; - HitObject.Position = e.MousePosition; - EndPlacement(); return true; } protected override bool OnMouseMove(MouseMoveEvent e) { - Position = e.MousePosition; + HitObject.Position = e.MousePosition; return true; } } From b7435c0c5ffb6054ecd49c42c791d14d2b4e67a8 Mon Sep 17 00:00:00 2001 From: smoogipoo Date: Wed, 17 Oct 2018 18:29:30 +0900 Subject: [PATCH 286/417] Fix border layer not working --- osu.Game/Rulesets/Edit/HitObjectComposer.cs | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/osu.Game/Rulesets/Edit/HitObjectComposer.cs b/osu.Game/Rulesets/Edit/HitObjectComposer.cs index 4010218c8c..38aad42081 100644 --- a/osu.Game/Rulesets/Edit/HitObjectComposer.cs +++ b/osu.Game/Rulesets/Edit/HitObjectComposer.cs @@ -61,11 +61,8 @@ namespace osu.Game.Rulesets.Edit return; } - var layerBelowRuleset = new BorderLayer - { - RelativeSizeAxes = Axes.Both, - Child = CreateLayerContainer() - }; + var layerBelowRuleset = CreateLayerContainer(); + layerBelowRuleset.Child = new BorderLayer { RelativeSizeAxes = Axes.Both }; var layerAboveRuleset = CreateLayerContainer(); layerAboveRuleset.Children = new Drawable[] From 5a5e91eaed0eacaaae467e2daaf963d5c9a04c23 Mon Sep 17 00:00:00 2001 From: smoogipoo Date: Wed, 17 Oct 2018 18:36:47 +0900 Subject: [PATCH 287/417] Add a way to re-invoke ApplyDefaults on placement object --- osu.Game/Rulesets/Edit/PlacementMask.cs | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/osu.Game/Rulesets/Edit/PlacementMask.cs b/osu.Game/Rulesets/Edit/PlacementMask.cs index d253638374..36c706db37 100644 --- a/osu.Game/Rulesets/Edit/PlacementMask.cs +++ b/osu.Game/Rulesets/Edit/PlacementMask.cs @@ -2,6 +2,7 @@ // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE using osu.Framework.Allocation; +using osu.Framework.Configuration; using osu.Framework.Graphics.Containers; using osu.Framework.Input; using osu.Framework.Input.Events; @@ -22,6 +23,8 @@ namespace osu.Game.Rulesets.Edit protected IClock EditorClock { get; private set; } + private readonly IBindable beatmap = new Bindable(); + [Resolved] private IPlacementHandler placementHandler { get; set; } @@ -31,11 +34,13 @@ namespace osu.Game.Rulesets.Edit } [BackgroundDependencyLoader] - private void load(IBindableBeatmap workingBeatmap, IAdjustableClock clock) + private void load(IBindableBeatmap beatmap, IAdjustableClock clock) { + this.beatmap.BindTo(beatmap); + EditorClock = clock; - HitObject.ApplyDefaults(workingBeatmap.Value.Beatmap.ControlPointInfo, workingBeatmap.Value.Beatmap.BeatmapInfo.BaseDifficulty); + ApplyDefaultsToHitObject(); } private bool placementBegun; @@ -60,6 +65,11 @@ namespace osu.Game.Rulesets.Edit placementHandler.EndPlacement(HitObject); } + /// + /// Invokes , refreshing and parameters for the . + /// + protected void ApplyDefaultsToHitObject() => HitObject.ApplyDefaults(beatmap.Value.Beatmap.ControlPointInfo, beatmap.Value.Beatmap.BeatmapInfo.BaseDifficulty); + public override bool ReceivePositionalInputAt(Vector2 screenSpacePos) => Parent?.ReceivePositionalInputAt(screenSpacePos) ?? false; protected override bool Handle(UIEvent e) From 9aeba149f664806fc15029ad17bbaaa1387d8a3c Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Wed, 17 Oct 2018 19:39:32 +0900 Subject: [PATCH 288/417] Update squirrel for more diagnostics --- osu.Desktop/osu.Desktop.csproj | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu.Desktop/osu.Desktop.csproj b/osu.Desktop/osu.Desktop.csproj index 1e8bf05e01..2be352165e 100644 --- a/osu.Desktop/osu.Desktop.csproj +++ b/osu.Desktop/osu.Desktop.csproj @@ -27,7 +27,7 @@
- + From 7720fa10eb075ce7fc1318958129860590e78c63 Mon Sep 17 00:00:00 2001 From: Paul Teng Date: Wed, 17 Oct 2018 20:19:01 -0400 Subject: [PATCH 289/417] Reduce height of RankChartLineGraph --- osu.Game/Overlays/Profile/Header/RankGraph.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu.Game/Overlays/Profile/Header/RankGraph.cs b/osu.Game/Overlays/Profile/Header/RankGraph.cs index fc80370cf9..bfb01ce1c8 100644 --- a/osu.Game/Overlays/Profile/Header/RankGraph.cs +++ b/osu.Game/Overlays/Profile/Header/RankGraph.cs @@ -74,7 +74,7 @@ namespace osu.Game.Overlays.Profile.Header Anchor = Anchor.BottomCentre, Origin = Anchor.BottomCentre, RelativeSizeAxes = Axes.X, - Height = 75, + Height = 60, Y = -secondary_textsize, Alpha = 0, } From 1cf6cd10bb1dc1fa87217c9e4e0b1d03088d7096 Mon Sep 17 00:00:00 2001 From: smoogipoo Date: Thu, 18 Oct 2018 11:29:50 +0900 Subject: [PATCH 290/417] Fix slider travel distances sometimes not being considered --- .../Difficulty/Preprocessing/OsuDifficultyHitObject.cs | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/osu.Game.Rulesets.Osu/Difficulty/Preprocessing/OsuDifficultyHitObject.cs b/osu.Game.Rulesets.Osu/Difficulty/Preprocessing/OsuDifficultyHitObject.cs index ccfcc1ef25..d6684f55af 100644 --- a/osu.Game.Rulesets.Osu/Difficulty/Preprocessing/OsuDifficultyHitObject.cs +++ b/osu.Game.Rulesets.Osu/Difficulty/Preprocessing/OsuDifficultyHitObject.cs @@ -75,15 +75,13 @@ namespace osu.Game.Rulesets.Osu.Difficulty.Preprocessing { computeSliderCursorPosition(lastSlider); lastCursorPosition = lastSlider.LazyEndPosition ?? lastCursorPosition; + + TravelDistance = lastSlider.LazyTravelDistance * scalingFactor; } // Don't need to jump to reach spinners if (!(BaseObject is Spinner)) JumpDistance = (BaseObject.StackedPosition * scalingFactor - lastCursorPosition * scalingFactor).Length; - - // Todo: BUG!!! Last slider's travel distance is considered ONLY IF we ourselves are also a slider! - if (BaseObject is Slider) - TravelDistance = (lastSlider?.LazyTravelDistance ?? 0) * scalingFactor; } private void setTimingValues() From d284f29637b2afddfced8c1dbcb74dcd20814938 Mon Sep 17 00:00:00 2001 From: Dan Balasescu <1329837+smoogipoo@users.noreply.github.com> Date: Thu, 18 Oct 2018 14:16:46 +0900 Subject: [PATCH 291/417] Add comment describing the speed multiplier --- osu.Game.Rulesets.Osu/Beatmaps/OsuBeatmapConverter.cs | 1 + 1 file changed, 1 insertion(+) diff --git a/osu.Game.Rulesets.Osu/Beatmaps/OsuBeatmapConverter.cs b/osu.Game.Rulesets.Osu/Beatmaps/OsuBeatmapConverter.cs index 14245ec8ac..b8aae1c28f 100644 --- a/osu.Game.Rulesets.Osu/Beatmaps/OsuBeatmapConverter.cs +++ b/osu.Game.Rulesets.Osu/Beatmaps/OsuBeatmapConverter.cs @@ -44,6 +44,7 @@ namespace osu.Game.Rulesets.Osu.Beatmaps NewCombo = comboData?.NewCombo ?? false, ComboOffset = comboData?.ComboOffset ?? 0, LegacyLastTickOffset = legacyOffset?.LegacyLastTickOffset, + // prior to v8, speed multipliers don't affect how many ticks are generated. TickDistanceMultiplier = beatmap.BeatmapInfo.BeatmapVersion < 8 ? 1f / beatmap.ControlPointInfo.DifficultyPointAt(original.StartTime).SpeedMultiplier : 1 }; } From 3f185a44defeabc22d662e0938553cf594230098 Mon Sep 17 00:00:00 2001 From: HoLLy Date: Thu, 18 Oct 2018 08:29:12 +0200 Subject: [PATCH 292/417] Fix Windows-style path separators not being migrated on Unix systems --- .../Migrations/20181007180454_StandardizePaths.cs | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/osu.Game/Migrations/20181007180454_StandardizePaths.cs b/osu.Game/Migrations/20181007180454_StandardizePaths.cs index e1b46dd018..274b8030a9 100644 --- a/osu.Game/Migrations/20181007180454_StandardizePaths.cs +++ b/osu.Game/Migrations/20181007180454_StandardizePaths.cs @@ -8,15 +8,15 @@ namespace osu.Game.Migrations { protected override void Up(MigrationBuilder migrationBuilder) { - string sanitized = Path.DirectorySeparatorChar.ToString(); + string windowsStyle = @"\"; string standardized = "/"; // Escaping \ does not seem to be needed. - migrationBuilder.Sql($"UPDATE `BeatmapInfo` SET `Path` = REPLACE(`Path`, '{sanitized}', '{standardized}')"); - migrationBuilder.Sql($"UPDATE `BeatmapMetadata` SET `AudioFile` = REPLACE(`AudioFile`, '{sanitized}', '{standardized}')"); - migrationBuilder.Sql($"UPDATE `BeatmapMetadata` SET `BackgroundFile` = REPLACE(`BackgroundFile`, '{sanitized}', '{standardized}')"); - migrationBuilder.Sql($"UPDATE `BeatmapSetFileInfo` SET `Filename` = REPLACE(`Filename`, '{sanitized}', '{standardized}')"); - migrationBuilder.Sql($"UPDATE `SkinFileInfo` SET `Filename` = REPLACE(`Filename`, '{sanitized}', '{standardized}')"); + migrationBuilder.Sql($"UPDATE `BeatmapInfo` SET `Path` = REPLACE(`Path`, '{windowsStyle}', '{standardized}')"); + migrationBuilder.Sql($"UPDATE `BeatmapMetadata` SET `AudioFile` = REPLACE(`AudioFile`, '{windowsStyle}', '{standardized}')"); + migrationBuilder.Sql($"UPDATE `BeatmapMetadata` SET `BackgroundFile` = REPLACE(`BackgroundFile`, '{windowsStyle}', '{standardized}')"); + migrationBuilder.Sql($"UPDATE `BeatmapSetFileInfo` SET `Filename` = REPLACE(`Filename`, '{windowsStyle}', '{standardized}')"); + migrationBuilder.Sql($"UPDATE `SkinFileInfo` SET `Filename` = REPLACE(`Filename`, '{windowsStyle}', '{standardized}')"); } protected override void Down(MigrationBuilder migrationBuilder) From 0e841628b64d44cbef02ba1bffa6e26f8dfd8bfe Mon Sep 17 00:00:00 2001 From: smoogipoo Date: Thu, 18 Oct 2018 16:36:06 +0900 Subject: [PATCH 293/417] Implement hitobject deletion --- .../Visual/TestCaseHitObjectComposer.cs | 2 ++ .../Rulesets/Edit/EditRulesetContainer.cs | 30 +++++++++++++++++++ osu.Game/Rulesets/Edit/HitObjectComposer.cs | 2 ++ .../Screens/Edit/Screens/Compose/Compose.cs | 2 ++ .../Edit/Screens/Compose/IPlacementHandler.cs | 2 ++ .../Compose/Layers/HitObjectMaskLayer.cs | 15 ++++++++++ .../Screens/Compose/Layers/MaskSelection.cs | 21 +++++++++++++ 7 files changed, 74 insertions(+) diff --git a/osu.Game.Tests/Visual/TestCaseHitObjectComposer.cs b/osu.Game.Tests/Visual/TestCaseHitObjectComposer.cs index 73df413699..9e1ec7feb2 100644 --- a/osu.Game.Tests/Visual/TestCaseHitObjectComposer.cs +++ b/osu.Game.Tests/Visual/TestCaseHitObjectComposer.cs @@ -77,5 +77,7 @@ namespace osu.Game.Tests.Visual } public void EndPlacement(HitObject hitObject) => composer.Add(hitObject); + + public void Delete(HitObject hitObject) => composer.Remove(hitObject); } } diff --git a/osu.Game/Rulesets/Edit/EditRulesetContainer.cs b/osu.Game/Rulesets/Edit/EditRulesetContainer.cs index d993a7cca2..bc54c907ab 100644 --- a/osu.Game/Rulesets/Edit/EditRulesetContainer.cs +++ b/osu.Game/Rulesets/Edit/EditRulesetContainer.cs @@ -1,6 +1,7 @@ // Copyright (c) 2007-2018 ppy Pty Ltd . // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE +using System.Linq; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Game.Beatmaps; @@ -28,6 +29,13 @@ namespace osu.Game.Rulesets.Edit /// The to add. /// The visual representation of . internal abstract DrawableHitObject Add(HitObject hitObject); + + /// + /// Removes a from the and the display. + /// + /// The to remove. + /// The visual representation of the removed . + internal abstract DrawableHitObject Remove(HitObject hitObject); } public class EditRulesetContainer : EditRulesetContainer @@ -72,5 +80,27 @@ namespace osu.Game.Rulesets.Edit return drawableObject; } + + internal override DrawableHitObject Remove(HitObject hitObject) + { + var tObject = (TObject)hitObject; + + // Remove from beatmap + beatmap.HitObjects.Remove(tObject); + + // Process the beatmap + var processor = ruleset.CreateBeatmapProcessor(beatmap); + + processor.PreProcess(); + processor.PostProcess(); + + // Remove visual representation + var drawableObject = Playfield.AllHitObjects.Single(d => d.HitObject == hitObject); + + rulesetContainer.Playfield.Remove(drawableObject); + rulesetContainer.Playfield.PostProcess(); + + return drawableObject; + } } } diff --git a/osu.Game/Rulesets/Edit/HitObjectComposer.cs b/osu.Game/Rulesets/Edit/HitObjectComposer.cs index 38aad42081..13571bda84 100644 --- a/osu.Game/Rulesets/Edit/HitObjectComposer.cs +++ b/osu.Game/Rulesets/Edit/HitObjectComposer.cs @@ -152,6 +152,8 @@ namespace osu.Game.Rulesets.Edit placementContainer.Refresh(); } + public void Remove(HitObject hitObject) => maskLayer.RemoveMaskFor(rulesetContainer.Remove(hitObject)); + internal abstract EditRulesetContainer CreateRulesetContainer(); protected abstract IReadOnlyList CompositionTools { get; } diff --git a/osu.Game/Screens/Edit/Screens/Compose/Compose.cs b/osu.Game/Screens/Edit/Screens/Compose/Compose.cs index 1617313ecd..ae42942d24 100644 --- a/osu.Game/Screens/Edit/Screens/Compose/Compose.cs +++ b/osu.Game/Screens/Edit/Screens/Compose/Compose.cs @@ -122,5 +122,7 @@ namespace osu.Game.Screens.Edit.Screens.Compose } public void EndPlacement(HitObject hitObject) => composer.Add(hitObject); + + public void Delete(HitObject hitObject) => composer.Remove(hitObject); } } diff --git a/osu.Game/Screens/Edit/Screens/Compose/IPlacementHandler.cs b/osu.Game/Screens/Edit/Screens/Compose/IPlacementHandler.cs index 894d23b90e..7c788cc7e0 100644 --- a/osu.Game/Screens/Edit/Screens/Compose/IPlacementHandler.cs +++ b/osu.Game/Screens/Edit/Screens/Compose/IPlacementHandler.cs @@ -9,5 +9,7 @@ namespace osu.Game.Screens.Edit.Screens.Compose { void BeginPlacement(HitObject hitObject); void EndPlacement(HitObject hitObject); + + void Delete(HitObject hitObject); } } diff --git a/osu.Game/Screens/Edit/Screens/Compose/Layers/HitObjectMaskLayer.cs b/osu.Game/Screens/Edit/Screens/Compose/Layers/HitObjectMaskLayer.cs index c6a4c3de13..3e33ceefcd 100644 --- a/osu.Game/Screens/Edit/Screens/Compose/Layers/HitObjectMaskLayer.cs +++ b/osu.Game/Screens/Edit/Screens/Compose/Layers/HitObjectMaskLayer.cs @@ -1,6 +1,7 @@ // Copyright (c) 2007-2018 ppy Pty Ltd . // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE +using System.Linq; using osu.Framework.Allocation; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; @@ -69,5 +70,19 @@ namespace osu.Game.Screens.Edit.Screens.Compose.Layers maskContainer.Add(mask); } + + /// + /// Removes a mask for a . + /// + /// The for which to remove the mask. + public void RemoveMaskFor(DrawableHitObject hitObject) + { + var maskToRemove = maskContainer.Single(m => m.HitObject == hitObject); + if (maskToRemove == null) + return; + + maskToRemove.Deselect(); + maskContainer.Remove(maskToRemove); + } } } diff --git a/osu.Game/Screens/Edit/Screens/Compose/Layers/MaskSelection.cs b/osu.Game/Screens/Edit/Screens/Compose/Layers/MaskSelection.cs index 1231737122..4946b35abb 100644 --- a/osu.Game/Screens/Edit/Screens/Compose/Layers/MaskSelection.cs +++ b/osu.Game/Screens/Edit/Screens/Compose/Layers/MaskSelection.cs @@ -3,15 +3,18 @@ using System; using System.Collections.Generic; +using System.Linq; using osu.Framework.Allocation; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Shapes; +using osu.Framework.Input.Events; using osu.Framework.Input.States; using osu.Game.Graphics; using osu.Game.Rulesets.Edit; using osu.Game.Rulesets.Edit.Types; using OpenTK; +using OpenTK.Input; namespace osu.Game.Screens.Edit.Screens.Compose.Layers { @@ -26,6 +29,9 @@ namespace osu.Game.Screens.Edit.Screens.Compose.Layers private Drawable outline; + [Resolved] + private IPlacementHandler placementHandler { get; set; } + public MaskSelection() { selectedMasks = new List(); @@ -69,6 +75,21 @@ namespace osu.Game.Screens.Edit.Screens.Compose.Layers } } + protected override bool OnKeyDown(KeyDownEvent e) + { + if (e.Repeat) + return base.OnKeyDown(e); + + switch (e.Key) + { + case Key.Delete: + foreach (var h in selectedMasks.ToList()) + placementHandler.Delete(h.HitObject.HitObject); + return true; + } + return base.OnKeyDown(e); + } + #endregion #region Selection Handling From 72d48aa7f5b40cc542ce60b5050d2abe7f4ff0e1 Mon Sep 17 00:00:00 2001 From: smoogipoo Date: Thu, 18 Oct 2018 16:46:30 +0900 Subject: [PATCH 294/417] Add xmldocs to IPlacementHandler --- .../Edit/Screens/Compose/IPlacementHandler.cs | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/osu.Game/Screens/Edit/Screens/Compose/IPlacementHandler.cs b/osu.Game/Screens/Edit/Screens/Compose/IPlacementHandler.cs index 7c788cc7e0..cd213c2885 100644 --- a/osu.Game/Screens/Edit/Screens/Compose/IPlacementHandler.cs +++ b/osu.Game/Screens/Edit/Screens/Compose/IPlacementHandler.cs @@ -7,9 +7,22 @@ namespace osu.Game.Screens.Edit.Screens.Compose { public interface IPlacementHandler { + /// + /// Notifies that a placement has begun. + /// + /// The being placed. void BeginPlacement(HitObject hitObject); + + /// + /// Notifies that a placement has finished. + /// + /// The that has been placed. void EndPlacement(HitObject hitObject); + /// + /// Deletes a . + /// + /// The to delete. void Delete(HitObject hitObject); } } From b351aae93fe5d27810e1561228de9d8cc786a6e5 Mon Sep 17 00:00:00 2001 From: Paul Teng Date: Thu, 18 Oct 2018 07:02:18 -0400 Subject: [PATCH 295/417] Reduce height of song progress handle --- osu.Game/Screens/Play/SongProgress.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu.Game/Screens/Play/SongProgress.cs b/osu.Game/Screens/Play/SongProgress.cs index 2e2c77c1c8..e921cd602b 100644 --- a/osu.Game/Screens/Play/SongProgress.cs +++ b/osu.Game/Screens/Play/SongProgress.cs @@ -21,7 +21,7 @@ namespace osu.Game.Screens.Play { private const int bottom_bar_height = 5; - private static readonly Vector2 handle_size = new Vector2(14, 25); + private static readonly Vector2 handle_size = new Vector2(14, 18); private const float transition_duration = 200; From ae94aab677e8654eeb3ec93b578f3355e44e0459 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Thu, 18 Oct 2018 20:50:36 +0900 Subject: [PATCH 296/417] Update framework --- osu.Desktop/osu.Desktop.csproj | 2 +- osu.Game/osu.Game.csproj | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/osu.Desktop/osu.Desktop.csproj b/osu.Desktop/osu.Desktop.csproj index 2be352165e..e1e59804e5 100644 --- a/osu.Desktop/osu.Desktop.csproj +++ b/osu.Desktop/osu.Desktop.csproj @@ -27,7 +27,7 @@
- + diff --git a/osu.Game/osu.Game.csproj b/osu.Game/osu.Game.csproj index cc21f4f6a4..26004b513f 100644 --- a/osu.Game/osu.Game.csproj +++ b/osu.Game/osu.Game.csproj @@ -18,7 +18,7 @@ - + From 86b29064c6ed6e476dc4b05f674e10cbf5554b0a Mon Sep 17 00:00:00 2001 From: Paul Teng Date: Thu, 18 Oct 2018 08:51:05 -0400 Subject: [PATCH 297/417] Change DownloadState only when Download is possible --- osu.Game/Beatmaps/BeatmapManager.cs | 8 +++++--- osu.Game/Beatmaps/Drawables/BeatmapSetDownloader.cs | 7 ++++--- 2 files changed, 9 insertions(+), 6 deletions(-) diff --git a/osu.Game/Beatmaps/BeatmapManager.cs b/osu.Game/Beatmaps/BeatmapManager.cs index aa653d88f9..fad94dcdfd 100644 --- a/osu.Game/Beatmaps/BeatmapManager.cs +++ b/osu.Game/Beatmaps/BeatmapManager.cs @@ -148,11 +148,12 @@ namespace osu.Game.Beatmaps /// /// The to be downloaded. /// Whether the beatmap should be downloaded without video. Defaults to false. - public void Download(BeatmapSetInfo beatmapSetInfo, bool noVideo = false) + /// Downloading can happen + public bool Download(BeatmapSetInfo beatmapSetInfo, bool noVideo = false) { var existing = GetExistingDownload(beatmapSetInfo); - if (existing != null || api == null) return; + if (existing != null || api == null) return false; if (!api.LocalUser.Value.IsSupporter) { @@ -161,7 +162,7 @@ namespace osu.Game.Beatmaps Icon = FontAwesome.fa_superpowers, Text = "You gotta be an osu!supporter to download for now 'yo" }); - return; + return false; } var downloadNotification = new DownloadNotification @@ -227,6 +228,7 @@ namespace osu.Game.Beatmaps // don't run in the main api queue as this is a long-running task. Task.Factory.StartNew(() => request.Perform(api), TaskCreationOptions.LongRunning); BeatmapDownloadBegan?.Invoke(request); + return true; } protected override void PresentCompletedImport(IEnumerable imported) diff --git a/osu.Game/Beatmaps/Drawables/BeatmapSetDownloader.cs b/osu.Game/Beatmaps/Drawables/BeatmapSetDownloader.cs index 6f4d4c0d6f..de19c24d2f 100644 --- a/osu.Game/Beatmaps/Drawables/BeatmapSetDownloader.cs +++ b/osu.Game/Beatmaps/Drawables/BeatmapSetDownloader.cs @@ -71,9 +71,10 @@ namespace osu.Game.Beatmaps.Drawables if (DownloadState.Value > DownloadStatus.NotDownloaded) return; - beatmaps.Download(set, noVideo); - - DownloadState.Value = DownloadStatus.Downloading; + if (beatmaps.Download(set, noVideo)) { + // Only change state if download can happen + DownloadState.Value = DownloadStatus.Downloading; + } } private void setAdded(BeatmapSetInfo s) From 39fb7ac743ab7f818bd3b8380c53e4bb6245fe0d Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Fri, 19 Oct 2018 20:32:14 +0900 Subject: [PATCH 298/417] Remove deploy configuration Has been moved to buildkite. --- appveyor_deploy.yml | 30 ------------------------------ 1 file changed, 30 deletions(-) delete mode 100644 appveyor_deploy.yml diff --git a/appveyor_deploy.yml b/appveyor_deploy.yml deleted file mode 100644 index 355f0603be..0000000000 --- a/appveyor_deploy.yml +++ /dev/null @@ -1,30 +0,0 @@ -clone_depth: 1 -version: '{build}' -skip_non_tags: true -image: Visual Studio 2017 -install: - - git clone https://github.com/ppy/osu-deploy -before_build: - - ps: if($env:appveyor_repo_tag -eq 'True') { Update-AppveyorBuild -Version $env:appveyor_repo_tag_name } - - cmd: git submodule update --init --recursive --depth=5 - - cmd: nuget restore -verbosity quiet -build_script: - - ps: iex ((New-Object Net.WebClient).DownloadString('https://raw.githubusercontent.com/appveyor/secure-file/master/install.ps1')) - - appveyor DownloadFile https://www.dropbox.com/s/f7hv069mr5tqi2j/deanherbert.pfx.enc?dl=1 # signing certificate - - cmd: appveyor-tools\secure-file -decrypt deanherbert.pfx.enc -secret %decode_secret% -out %HOMEPATH%\deanherbert.pfx - - appveyor DownloadFile https://puu.sh/A6g75/fdc6f19b04.enc # deploy configuration - - cd osu-deploy - - nuget restore -verbosity quiet - - msbuild osu.Desktop.Deploy.csproj - - cmd: ..\appveyor-tools\secure-file -decrypt ..\fdc6f19b04.enc -secret %decode_secret% -out bin\Debug\netcoreapp2.1\osu.Desktop.Deploy.dll.config - - dotnet bin/Debug/netcoreapp2.1/osu.Desktop.Deploy.dll %code_signing_password% %APPVEYOR_REPO_TAG_NAME% -environment: - decode_secret: - secure: i67IC2xj6DjjxmA6Oj2jing3+MwzLkq6CbGsjfZ7rdY= - code_signing_password: - secure: 34tLNqvjmmZEi97MLKfrnQ== -artifacts: - - path: 'osu-deploy/releases/*' -deploy: - - provider: Environment - name: github \ No newline at end of file From 93a3e9fe1168407faa737fbe2389c69d452e511a Mon Sep 17 00:00:00 2001 From: TPGPL Date: Fri, 19 Oct 2018 19:27:24 +0200 Subject: [PATCH 299/417] Add bug issue template --- .github/ISSUE_TEMPLATE/bug-issues.md | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) create mode 100644 .github/ISSUE_TEMPLATE/bug-issues.md diff --git a/.github/ISSUE_TEMPLATE/bug-issues.md b/.github/ISSUE_TEMPLATE/bug-issues.md new file mode 100644 index 0000000000..1f3c8e4450 --- /dev/null +++ b/.github/ISSUE_TEMPLATE/bug-issues.md @@ -0,0 +1,16 @@ +--- +name: Bug Report +about: For issues regarding encountered game bugs +--- + + + +**What is your problem:** + +**Describe your problem:** + +**Screenshots or videos showing encountered issue:** + +**osu!lazer version:** + +**Logs:** \ No newline at end of file From 294569f96622b48b83067e31daa86c4ef8e7c560 Mon Sep 17 00:00:00 2001 From: TPGPL Date: Fri, 19 Oct 2018 19:29:56 +0200 Subject: [PATCH 300/417] Add crash issue template --- .github/ISSUE_TEMPLATE/crash-issues.md | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) create mode 100644 .github/ISSUE_TEMPLATE/crash-issues.md diff --git a/.github/ISSUE_TEMPLATE/crash-issues.md b/.github/ISSUE_TEMPLATE/crash-issues.md new file mode 100644 index 0000000000..4d60c684ab --- /dev/null +++ b/.github/ISSUE_TEMPLATE/crash-issues.md @@ -0,0 +1,18 @@ +--- +name: Crash Report +about: For issues regarding game crashes or permanent freezes +--- + + + +**What is your problem:** + +**Describe your problem:** + +**Screenshots or videos showing encountered issue:** + +**osu!lazer version:** + +**Logs:** + +**Computer Specifications:** \ No newline at end of file From fc95a0a2d592a732cd84b0414a21226243480b68 Mon Sep 17 00:00:00 2001 From: TPGPL Date: Fri, 19 Oct 2018 19:36:02 +0200 Subject: [PATCH 301/417] Add feature issue request --- .github/ISSUE_TEMPLATE/feature-issues.md | 12 ++++++++++++ 1 file changed, 12 insertions(+) create mode 100644 .github/ISSUE_TEMPLATE/feature-issues.md diff --git a/.github/ISSUE_TEMPLATE/feature-issues.md b/.github/ISSUE_TEMPLATE/feature-issues.md new file mode 100644 index 0000000000..ea17bf0e5b --- /dev/null +++ b/.github/ISSUE_TEMPLATE/feature-issues.md @@ -0,0 +1,12 @@ +--- +name: Feature Request +about: Let us know what you would like to see in the game! +--- + + + +**Feature Request:** + +**Describe the feature:** + +**Proposal designs of the feature:** + +**Feature Request:** + +**Describe the feature:** + +**Designs:** From 1682090cd54cac05ca6341da8da5705cea14fcd1 Mon Sep 17 00:00:00 2001 From: TPGPL Date: Fri, 19 Oct 2018 19:40:55 +0200 Subject: [PATCH 303/417] Fix minor issues --- .github/ISSUE_TEMPLATE/bug-issues.md | 10 +++++----- .github/ISSUE_TEMPLATE/crash-issues.md | 12 ++++++------ .github/ISSUE_TEMPLATE/feature-issues.md | 8 ++++---- .github/ISSUE_TEMPLATE/gamefeatures-issues.md | 6 +++--- 4 files changed, 18 insertions(+), 18 deletions(-) diff --git a/.github/ISSUE_TEMPLATE/bug-issues.md b/.github/ISSUE_TEMPLATE/bug-issues.md index 1f3c8e4450..3021a2079d 100644 --- a/.github/ISSUE_TEMPLATE/bug-issues.md +++ b/.github/ISSUE_TEMPLATE/bug-issues.md @@ -3,14 +3,14 @@ name: Bug Report about: For issues regarding encountered game bugs --- - + -**What is your problem:** +**What is your problem:** -**Describe your problem:** +**Describe your problem:** **Screenshots or videos showing encountered issue:** -**osu!lazer version:** +**osu!lazer version:** -**Logs:** \ No newline at end of file +**Logs:** \ No newline at end of file diff --git a/.github/ISSUE_TEMPLATE/crash-issues.md b/.github/ISSUE_TEMPLATE/crash-issues.md index 4d60c684ab..d5598145c8 100644 --- a/.github/ISSUE_TEMPLATE/crash-issues.md +++ b/.github/ISSUE_TEMPLATE/crash-issues.md @@ -3,16 +3,16 @@ name: Crash Report about: For issues regarding game crashes or permanent freezes --- - + -**What is your problem:** +**What is your problem:** -**Describe your problem:** +**Describe your problem:** **Screenshots or videos showing encountered issue:** -**osu!lazer version:** +**osu!lazer version:** -**Logs:** +**Logs:** -**Computer Specifications:** \ No newline at end of file +**Computer Specifications:** \ No newline at end of file diff --git a/.github/ISSUE_TEMPLATE/feature-issues.md b/.github/ISSUE_TEMPLATE/feature-issues.md index ea17bf0e5b..fbc44c5a03 100644 --- a/.github/ISSUE_TEMPLATE/feature-issues.md +++ b/.github/ISSUE_TEMPLATE/feature-issues.md @@ -3,10 +3,10 @@ name: Feature Request about: Let us know what you would like to see in the game! --- - + -**Feature Request:** +**Feature Request:** -**Describe the feature:** +**Describe the feature:** -**Proposal designs of the feature:** diff --git a/.github/ISSUE_TEMPLATE/gamefeatures-issues.md b/.github/ISSUE_TEMPLATE/gamefeatures-issues.md index 0ec4ae3f5a..a94efed32f 100644 --- a/.github/ISSUE_TEMPLATE/gamefeatures-issues.md +++ b/.github/ISSUE_TEMPLATE/gamefeatures-issues.md @@ -3,10 +3,10 @@ name: Game Feature about: For issues regarding features to be found in the game --- - + -**Feature Request:** +**Feature Request:** -**Describe the feature:** +**Describe the feature:** **Designs:** From 6882735d6f9054537e4c3093018faa35b801ea95 Mon Sep 17 00:00:00 2001 From: TPGPL Date: Fri, 19 Oct 2018 20:02:08 +0200 Subject: [PATCH 304/417] Add local storages for macOS and Linux --- .github/ISSUE_TEMPLATE/bug-issues.md | 2 +- .github/ISSUE_TEMPLATE/crash-issues.md | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/ISSUE_TEMPLATE/bug-issues.md b/.github/ISSUE_TEMPLATE/bug-issues.md index 3021a2079d..ea29402902 100644 --- a/.github/ISSUE_TEMPLATE/bug-issues.md +++ b/.github/ISSUE_TEMPLATE/bug-issues.md @@ -13,4 +13,4 @@ about: For issues regarding encountered game bugs **osu!lazer version:** -**Logs:** \ No newline at end of file +**Logs:** \ No newline at end of file diff --git a/.github/ISSUE_TEMPLATE/crash-issues.md b/.github/ISSUE_TEMPLATE/crash-issues.md index d5598145c8..7cf6acd549 100644 --- a/.github/ISSUE_TEMPLATE/crash-issues.md +++ b/.github/ISSUE_TEMPLATE/crash-issues.md @@ -13,6 +13,6 @@ about: For issues regarding game crashes or permanent freezes **osu!lazer version:** -**Logs:** +**Logs:** **Computer Specifications:** \ No newline at end of file From 0952c20c84d3ea40c9835b03ba1a1fd2566174ec Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Sat, 20 Oct 2018 23:06:48 +0900 Subject: [PATCH 305/417] Adjust comment slightly --- osu.Game.Rulesets.Osu/Beatmaps/OsuBeatmapConverter.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu.Game.Rulesets.Osu/Beatmaps/OsuBeatmapConverter.cs b/osu.Game.Rulesets.Osu/Beatmaps/OsuBeatmapConverter.cs index b8aae1c28f..5b8a7acf58 100644 --- a/osu.Game.Rulesets.Osu/Beatmaps/OsuBeatmapConverter.cs +++ b/osu.Game.Rulesets.Osu/Beatmaps/OsuBeatmapConverter.cs @@ -44,7 +44,7 @@ namespace osu.Game.Rulesets.Osu.Beatmaps NewCombo = comboData?.NewCombo ?? false, ComboOffset = comboData?.ComboOffset ?? 0, LegacyLastTickOffset = legacyOffset?.LegacyLastTickOffset, - // prior to v8, speed multipliers don't affect how many ticks are generated. + // prior to v8, speed multipliers don't adjust for how many ticks are generated over the same distance. TickDistanceMultiplier = beatmap.BeatmapInfo.BeatmapVersion < 8 ? 1f / beatmap.ControlPointInfo.DifficultyPointAt(original.StartTime).SpeedMultiplier : 1 }; } From f19cc98e6aa43a8b4d792bb1fedbefd7065da1f4 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Sat, 20 Oct 2018 23:10:33 +0900 Subject: [PATCH 306/417] Add slightly more explanation --- osu.Game.Rulesets.Osu/Beatmaps/OsuBeatmapConverter.cs | 1 + 1 file changed, 1 insertion(+) diff --git a/osu.Game.Rulesets.Osu/Beatmaps/OsuBeatmapConverter.cs b/osu.Game.Rulesets.Osu/Beatmaps/OsuBeatmapConverter.cs index 5b8a7acf58..b2914d4b82 100644 --- a/osu.Game.Rulesets.Osu/Beatmaps/OsuBeatmapConverter.cs +++ b/osu.Game.Rulesets.Osu/Beatmaps/OsuBeatmapConverter.cs @@ -45,6 +45,7 @@ namespace osu.Game.Rulesets.Osu.Beatmaps ComboOffset = comboData?.ComboOffset ?? 0, LegacyLastTickOffset = legacyOffset?.LegacyLastTickOffset, // prior to v8, speed multipliers don't adjust for how many ticks are generated over the same distance. + // this results in more (or less) ticks being generated in Date: Mon, 22 Oct 2018 12:17:23 +0900 Subject: [PATCH 307/417] Move brace on new line --- osu.Game/Beatmaps/Drawables/BeatmapSetDownloader.cs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/osu.Game/Beatmaps/Drawables/BeatmapSetDownloader.cs b/osu.Game/Beatmaps/Drawables/BeatmapSetDownloader.cs index de19c24d2f..5b5dbec9c8 100644 --- a/osu.Game/Beatmaps/Drawables/BeatmapSetDownloader.cs +++ b/osu.Game/Beatmaps/Drawables/BeatmapSetDownloader.cs @@ -71,7 +71,8 @@ namespace osu.Game.Beatmaps.Drawables if (DownloadState.Value > DownloadStatus.NotDownloaded) return; - if (beatmaps.Download(set, noVideo)) { + if (beatmaps.Download(set, noVideo)) + { // Only change state if download can happen DownloadState.Value = DownloadStatus.Downloading; } From 8a2a6a3ecbf7cc9507c66b601a17a917a1d6fe58 Mon Sep 17 00:00:00 2001 From: smoogipoo Date: Tue, 23 Oct 2018 14:38:27 +0900 Subject: [PATCH 308/417] Preserve the beatmap's version --- .../Formats/LegacyBeatmapDecoderTest.cs | 21 +++++++++++++++++++ osu.Game.Tests/Resources/beatmap-version.osu | 1 + osu.Game/Beatmaps/BeatmapInfo.cs | 1 - osu.Game/Beatmaps/WorkingBeatmap.cs | 7 ++++++- 4 files changed, 28 insertions(+), 2 deletions(-) create mode 100644 osu.Game.Tests/Resources/beatmap-version.osu diff --git a/osu.Game.Tests/Beatmaps/Formats/LegacyBeatmapDecoderTest.cs b/osu.Game.Tests/Beatmaps/Formats/LegacyBeatmapDecoderTest.cs index af63a39662..f1ae366ee1 100644 --- a/osu.Game.Tests/Beatmaps/Formats/LegacyBeatmapDecoderTest.cs +++ b/osu.Game.Tests/Beatmaps/Formats/LegacyBeatmapDecoderTest.cs @@ -8,11 +8,13 @@ using OpenTK.Graphics; using osu.Game.Tests.Resources; using System.Linq; using osu.Game.Audio; +using osu.Game.Beatmaps; using osu.Game.Rulesets.Objects.Types; using osu.Game.Beatmaps.Formats; using osu.Game.Beatmaps.Timing; using osu.Game.Rulesets.Catch.Beatmaps; using osu.Game.Rulesets.Objects; +using osu.Game.Rulesets.Osu; using osu.Game.Rulesets.Osu.Beatmaps; using osu.Game.Skinning; @@ -21,6 +23,25 @@ namespace osu.Game.Tests.Beatmaps.Formats [TestFixture] public class LegacyBeatmapDecoderTest { + [Test] + public void TestDecodeBeatmapVersion() + { + using (var resStream = Resource.OpenResource("beatmap-version.osu")) + using (var stream = new StreamReader(resStream)) + { + var decoder = Decoder.GetDecoder(stream); + + stream.BaseStream.Position = 0; + stream.DiscardBufferedData(); + + var working = new TestWorkingBeatmap(decoder.Decode(stream)); + + Assert.AreEqual(6, working.BeatmapInfo.BeatmapVersion); + Assert.AreEqual(6, working.Beatmap.BeatmapInfo.BeatmapVersion); + Assert.AreEqual(6, working.GetPlayableBeatmap(new OsuRuleset().RulesetInfo).BeatmapInfo.BeatmapVersion); + } + } + [Test] public void TestDecodeBeatmapGeneral() { diff --git a/osu.Game.Tests/Resources/beatmap-version.osu b/osu.Game.Tests/Resources/beatmap-version.osu new file mode 100644 index 0000000000..5749054ac4 --- /dev/null +++ b/osu.Game.Tests/Resources/beatmap-version.osu @@ -0,0 +1 @@ +osu file format v6 \ No newline at end of file diff --git a/osu.Game/Beatmaps/BeatmapInfo.cs b/osu.Game/Beatmaps/BeatmapInfo.cs index 1aa4818393..3e1f3bdf54 100644 --- a/osu.Game/Beatmaps/BeatmapInfo.cs +++ b/osu.Game/Beatmaps/BeatmapInfo.cs @@ -19,7 +19,6 @@ namespace osu.Game.Beatmaps [JsonIgnore] public int ID { get; set; } - //TODO: should be in database public int BeatmapVersion; private int? onlineBeatmapID; diff --git a/osu.Game/Beatmaps/WorkingBeatmap.cs b/osu.Game/Beatmaps/WorkingBeatmap.cs index e0a22460ef..5b76122616 100644 --- a/osu.Game/Beatmaps/WorkingBeatmap.cs +++ b/osu.Game/Beatmaps/WorkingBeatmap.cs @@ -41,8 +41,13 @@ namespace osu.Game.Beatmaps beatmap = new RecyclableLazy(() => { var b = GetBeatmap() ?? new Beatmap(); - // use the database-backed info. + + // The original beatmap version needs to be preserved as the database doesn't contain it + BeatmapInfo.BeatmapVersion = b.BeatmapInfo.BeatmapVersion; + + // Use the database-backed info for more up-to-date values (beatmap id, ranked status, etc) b.BeatmapInfo = BeatmapInfo; + return b; }); From 94093ac9488c5065737cd20f731a458dd16ef722 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Tue, 23 Oct 2018 18:04:38 +0900 Subject: [PATCH 309/417] Update beatmap search API to match latest osu-web structure --- .../API/Requests/SearchBeatmapSetsRequest.cs | 6 +++--- .../API/Requests/SearchBeatmapSetsResponse.cs | 20 +++++++++++++++++++ osu.Game/Overlays/DirectOverlay.cs | 2 +- 3 files changed, 24 insertions(+), 4 deletions(-) create mode 100644 osu.Game/Online/API/Requests/SearchBeatmapSetsResponse.cs diff --git a/osu.Game/Online/API/Requests/SearchBeatmapSetsRequest.cs b/osu.Game/Online/API/Requests/SearchBeatmapSetsRequest.cs index 3c808d1bee..ffea7b83e1 100644 --- a/osu.Game/Online/API/Requests/SearchBeatmapSetsRequest.cs +++ b/osu.Game/Online/API/Requests/SearchBeatmapSetsRequest.cs @@ -1,16 +1,14 @@ // Copyright (c) 2007-2018 ppy Pty Ltd . // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE -using System.Collections.Generic; using System.ComponentModel; -using osu.Game.Online.API.Requests.Responses; using osu.Game.Overlays; using osu.Game.Overlays.Direct; using osu.Game.Rulesets; namespace osu.Game.Online.API.Requests { - public class SearchBeatmapSetsRequest : APIRequest> + public class SearchBeatmapSetsRequest : APIRequest { private readonly string query; private readonly RulesetInfo ruleset; @@ -35,6 +33,7 @@ namespace osu.Game.Online.API.Requests public enum BeatmapSearchCategory { Any = 7, + [Description("Ranked & Approved")] RankedApproved = 0, Approved = 1, @@ -43,6 +42,7 @@ namespace osu.Game.Online.API.Requests Qualified = 3, Pending = 4, Graveyard = 5, + [Description("My Maps")] MyMaps = 6, } diff --git a/osu.Game/Online/API/Requests/SearchBeatmapSetsResponse.cs b/osu.Game/Online/API/Requests/SearchBeatmapSetsResponse.cs new file mode 100644 index 0000000000..cf8b40d068 --- /dev/null +++ b/osu.Game/Online/API/Requests/SearchBeatmapSetsResponse.cs @@ -0,0 +1,20 @@ +// Copyright (c) 2007-2018 ppy Pty Ltd . +// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE + +using System.Collections.Generic; +using Newtonsoft.Json; +using osu.Game.Online.API.Requests.Responses; + +namespace osu.Game.Online.API.Requests +{ + public class SearchBeatmapSetsResponse + { + public IEnumerable BeatmapSets; + + /// + /// A collection of parameters which should be passed to the search endpoint to fetch the next page. + /// + [JsonProperty("cursor")] + public dynamic CursorJson; + } +} diff --git a/osu.Game/Overlays/DirectOverlay.cs b/osu.Game/Overlays/DirectOverlay.cs index f63d314053..641f57d25f 100644 --- a/osu.Game/Overlays/DirectOverlay.cs +++ b/osu.Game/Overlays/DirectOverlay.cs @@ -288,7 +288,7 @@ namespace osu.Game.Overlays { Task.Run(() => { - var sets = response.Select(r => r.ToBeatmapSet(rulesets)).ToList(); + var sets = response.BeatmapSets.Select(r => r.ToBeatmapSet(rulesets)).ToList(); // may not need scheduling; loads async internally. Schedule(() => From 88aca465006312db05761539387e3e67605f0e8d Mon Sep 17 00:00:00 2001 From: HoLLy Date: Wed, 24 Oct 2018 18:53:22 +0200 Subject: [PATCH 310/417] Fade MetadataSection back in if non-null Text is set --- osu.Game/Screens/Select/BeatmapDetails.cs | 1 + 1 file changed, 1 insertion(+) diff --git a/osu.Game/Screens/Select/BeatmapDetails.cs b/osu.Game/Screens/Select/BeatmapDetails.cs index f7b955941d..9a16c76c44 100644 --- a/osu.Game/Screens/Select/BeatmapDetails.cs +++ b/osu.Game/Screens/Select/BeatmapDetails.cs @@ -341,6 +341,7 @@ namespace osu.Game.Screens.Select return; } + this.FadeIn(transition_duration); setTextAsync(value); } } From ea6db8b79376c56f4d9b2a8f81f8fe35ae54645b Mon Sep 17 00:00:00 2001 From: smoogipoo Date: Thu, 25 Oct 2018 18:16:25 +0900 Subject: [PATCH 311/417] Make the hitobject masks move within their placement/selection --- .../Edit/Masks/HitCircleMask.cs | 12 +++-- .../Edit/Masks/HitCirclePlacementMask.cs | 6 --- .../Edit/Masks/HitCircleSelectionMask.cs | 8 --- .../Edit/Masks/SliderBodyMask.cs | 51 +++++++++++++++++++ .../Edit/Masks/SliderCircleMask.cs | 33 ++++++++++++ .../Edit/Masks/SliderCircleSelectionMask.cs | 42 +-------------- .../Edit/Masks/SliderPosition.cs | 11 ++++ .../Edit/Masks/SliderSelectionMask.cs | 46 ++--------------- osu.Game.Rulesets.Osu/Objects/OsuHitObject.cs | 2 +- osu.Game.Rulesets.Osu/Objects/Slider.cs | 15 ++++++ osu.Game/Rulesets/Edit/PlacementMask.cs | 3 ++ osu.Game/Rulesets/Edit/SelectionMask.cs | 9 +++- 12 files changed, 137 insertions(+), 101 deletions(-) create mode 100644 osu.Game.Rulesets.Osu/Edit/Masks/SliderBodyMask.cs create mode 100644 osu.Game.Rulesets.Osu/Edit/Masks/SliderCircleMask.cs create mode 100644 osu.Game.Rulesets.Osu/Edit/Masks/SliderPosition.cs diff --git a/osu.Game.Rulesets.Osu/Edit/Masks/HitCircleMask.cs b/osu.Game.Rulesets.Osu/Edit/Masks/HitCircleMask.cs index 9576e0fa91..696726e8bf 100644 --- a/osu.Game.Rulesets.Osu/Edit/Masks/HitCircleMask.cs +++ b/osu.Game.Rulesets.Osu/Edit/Masks/HitCircleMask.cs @@ -18,22 +18,28 @@ namespace osu.Game.Rulesets.Osu.Edit.Masks public HitCircleMask(HitCircle hitCircle) { this.hitCircle = hitCircle; - Anchor = Anchor.Centre; + Origin = Anchor.Centre; Size = new Vector2((float)OsuHitObject.OBJECT_RADIUS * 2); - CornerRadius = Size.X / 2; - AddInternal(new RingPiece()); + InternalChild = new RingPiece(); + + hitCircle.PositionChanged += _ => UpdatePosition(); + hitCircle.StackHeightChanged += _ => UpdatePosition(); } [BackgroundDependencyLoader] private void load(OsuColour colours) { Colour = colours.Yellow; + + UpdatePosition(); } + protected virtual void UpdatePosition() => Position = hitCircle.StackedPosition; + protected override void Update() { base.Update(); diff --git a/osu.Game.Rulesets.Osu/Edit/Masks/HitCirclePlacementMask.cs b/osu.Game.Rulesets.Osu/Edit/Masks/HitCirclePlacementMask.cs index ca250e25e6..2c259f562d 100644 --- a/osu.Game.Rulesets.Osu/Edit/Masks/HitCirclePlacementMask.cs +++ b/osu.Game.Rulesets.Osu/Edit/Masks/HitCirclePlacementMask.cs @@ -1,7 +1,6 @@ // Copyright (c) 2007-2018 ppy Pty Ltd . // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE -using osu.Framework.Graphics; using osu.Framework.Input.Events; using osu.Game.Rulesets.Edit; using osu.Game.Rulesets.Osu.Objects; @@ -15,12 +14,7 @@ namespace osu.Game.Rulesets.Osu.Edit.Masks public HitCirclePlacementMask() : base(new HitCircle()) { - Origin = Anchor.Centre; - AutoSizeAxes = Axes.Both; - InternalChild = new HitCircleMask(HitObject); - - HitObject.PositionChanged += _ => Position = HitObject.StackedPosition; } protected override void LoadComplete() diff --git a/osu.Game.Rulesets.Osu/Edit/Masks/HitCircleSelectionMask.cs b/osu.Game.Rulesets.Osu/Edit/Masks/HitCircleSelectionMask.cs index f4e4bb2145..49ff955896 100644 --- a/osu.Game.Rulesets.Osu/Edit/Masks/HitCircleSelectionMask.cs +++ b/osu.Game.Rulesets.Osu/Edit/Masks/HitCircleSelectionMask.cs @@ -1,7 +1,6 @@ // Copyright (c) 2007-2018 ppy Pty Ltd . // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE -using osu.Framework.Graphics; using osu.Game.Rulesets.Edit; using osu.Game.Rulesets.Osu.Objects; using osu.Game.Rulesets.Osu.Objects.Drawables; @@ -13,14 +12,7 @@ namespace osu.Game.Rulesets.Osu.Edit.Masks public HitCircleSelectionMask(DrawableHitCircle hitCircle) : base(hitCircle) { - Origin = Anchor.Centre; - AutoSizeAxes = Axes.Both; - Position = hitCircle.Position; - InternalChild = new HitCircleMask((HitCircle)hitCircle.HitObject); - - hitCircle.HitObject.PositionChanged += _ => Position = hitCircle.HitObject.StackedPosition; - hitCircle.HitObject.StackHeightChanged += _ => Position = hitCircle.HitObject.StackedPosition; } } } diff --git a/osu.Game.Rulesets.Osu/Edit/Masks/SliderBodyMask.cs b/osu.Game.Rulesets.Osu/Edit/Masks/SliderBodyMask.cs new file mode 100644 index 0000000000..c95b2d7722 --- /dev/null +++ b/osu.Game.Rulesets.Osu/Edit/Masks/SliderBodyMask.cs @@ -0,0 +1,51 @@ +// Copyright (c) 2007-2018 ppy Pty Ltd . +// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE + +using osu.Framework.Allocation; +using osu.Framework.Graphics.Containers; +using osu.Game.Graphics; +using osu.Game.Rulesets.Osu.Objects; +using osu.Game.Rulesets.Osu.Objects.Drawables.Pieces; +using OpenTK.Graphics; + +namespace osu.Game.Rulesets.Osu.Edit.Masks +{ + public class SliderBodyMask : CompositeDrawable + { + private readonly Slider slider; + private readonly SliderBody body; + + public SliderBodyMask(Slider slider) + { + this.slider = slider; + InternalChild = body = new SliderBody(slider) + { + AccentColour = Color4.Transparent, + PathWidth = slider.Scale * 64 + }; + + slider.PositionChanged += _ => updatePosition(); + } + + [BackgroundDependencyLoader] + private void load(OsuColour colours) + { + body.BorderColour = colours.Yellow; + + updatePosition(); + } + + private void updatePosition() => Position = slider.StackedPosition; + + protected override void Update() + { + base.Update(); + + Size = body.Size; + OriginPosition = body.PathOffset; + + // Need to cause one update + body.UpdateProgress(0); + } + } +} diff --git a/osu.Game.Rulesets.Osu/Edit/Masks/SliderCircleMask.cs b/osu.Game.Rulesets.Osu/Edit/Masks/SliderCircleMask.cs new file mode 100644 index 0000000000..de128552c6 --- /dev/null +++ b/osu.Game.Rulesets.Osu/Edit/Masks/SliderCircleMask.cs @@ -0,0 +1,33 @@ +// Copyright (c) 2007-2018 ppy Pty Ltd . +// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE + +using osu.Game.Rulesets.Osu.Objects; + +namespace osu.Game.Rulesets.Osu.Edit.Masks +{ + public class SliderCircleMask : HitCircleMask + { + private readonly Slider slider; + private readonly SliderPosition position; + + public SliderCircleMask(Slider slider, SliderPosition position) + : base(slider.HeadCircle) + { + this.slider = slider; + this.position = position; + } + + protected override void UpdatePosition() + { + switch (position) + { + case SliderPosition.Start: + Position = slider.StackedPosition + slider.Curve.PositionAt(0); + break; + case SliderPosition.End: + Position = slider.StackedPosition + slider.Curve.PositionAt(1); + break; + } + } + } +} diff --git a/osu.Game.Rulesets.Osu/Edit/Masks/SliderCircleSelectionMask.cs b/osu.Game.Rulesets.Osu/Edit/Masks/SliderCircleSelectionMask.cs index 1ed22c2ac1..ebbb050c18 100644 --- a/osu.Game.Rulesets.Osu/Edit/Masks/SliderCircleSelectionMask.cs +++ b/osu.Game.Rulesets.Osu/Edit/Masks/SliderCircleSelectionMask.cs @@ -1,60 +1,22 @@ // Copyright (c) 2007-2018 ppy Pty Ltd . // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE -using osu.Framework.Allocation; -using osu.Framework.Graphics; -using osu.Game.Graphics; using osu.Game.Rulesets.Edit; using osu.Game.Rulesets.Osu.Objects; using osu.Game.Rulesets.Osu.Objects.Drawables; -using osu.Game.Rulesets.Osu.Objects.Drawables.Pieces; -using OpenTK; namespace osu.Game.Rulesets.Osu.Edit.Masks { public class SliderCircleSelectionMask : SelectionMask { - public SliderCircleSelectionMask(DrawableHitCircle sliderHead, DrawableSlider slider) - : this(sliderHead, Vector2.Zero, slider) - { - } - - public SliderCircleSelectionMask(DrawableSliderTail sliderTail, DrawableSlider slider) - : this(sliderTail, ((Slider)slider.HitObject).Curve.PositionAt(1), slider) - { - } - - private readonly DrawableOsuHitObject hitObject; - - private SliderCircleSelectionMask(DrawableOsuHitObject hitObject, Vector2 position, DrawableSlider slider) + public SliderCircleSelectionMask(DrawableOsuHitObject hitObject, Slider slider, SliderPosition position) : base(hitObject) { - this.hitObject = hitObject; - - Origin = Anchor.Centre; - - Position = position; - Size = slider.HeadCircle.Size; - Scale = slider.HeadCircle.Scale; - - AddInternal(new RingPiece()); + InternalChild = new SliderCircleMask(slider, position); Select(); } - [BackgroundDependencyLoader] - private void load(OsuColour colours) - { - Colour = colours.Yellow; - } - - protected override void Update() - { - base.Update(); - - RelativeAnchorPosition = hitObject.RelativeAnchorPosition; - } - // Todo: This is temporary, since the slider circle masks don't do anything special yet. In the future they will handle input. public override bool HandlePositionalInput => false; } diff --git a/osu.Game.Rulesets.Osu/Edit/Masks/SliderPosition.cs b/osu.Game.Rulesets.Osu/Edit/Masks/SliderPosition.cs new file mode 100644 index 0000000000..dc5f670d48 --- /dev/null +++ b/osu.Game.Rulesets.Osu/Edit/Masks/SliderPosition.cs @@ -0,0 +1,11 @@ +// Copyright (c) 2007-2018 ppy Pty Ltd . +// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE + +namespace osu.Game.Rulesets.Osu.Edit.Masks +{ + public enum SliderPosition + { + Start, + End + } +} diff --git a/osu.Game.Rulesets.Osu/Edit/Masks/SliderSelectionMask.cs b/osu.Game.Rulesets.Osu/Edit/Masks/SliderSelectionMask.cs index b775854038..c330641bcf 100644 --- a/osu.Game.Rulesets.Osu/Edit/Masks/SliderSelectionMask.cs +++ b/osu.Game.Rulesets.Osu/Edit/Masks/SliderSelectionMask.cs @@ -1,67 +1,31 @@ // Copyright (c) 2007-2018 ppy Pty Ltd . // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE -using osu.Framework.Allocation; using osu.Framework.Graphics; -using osu.Framework.Graphics.Primitives; -using osu.Game.Graphics; using osu.Game.Rulesets.Edit; using osu.Game.Rulesets.Osu.Objects; using osu.Game.Rulesets.Osu.Objects.Drawables; -using osu.Game.Rulesets.Osu.Objects.Drawables.Pieces; using OpenTK; -using OpenTK.Graphics; namespace osu.Game.Rulesets.Osu.Edit.Masks { public class SliderSelectionMask : SelectionMask { - private readonly SliderBody body; - private readonly DrawableSlider slider; + private readonly SliderCircleSelectionMask headMask; public SliderSelectionMask(DrawableSlider slider) : base(slider) { - this.slider = slider; - - Position = slider.Position; - var sliderObject = (Slider)slider.HitObject; InternalChildren = new Drawable[] { - body = new SliderBody(sliderObject) - { - AccentColour = Color4.Transparent, - PathWidth = sliderObject.Scale * 64 - }, - new SliderCircleSelectionMask(slider.HeadCircle, slider), - new SliderCircleSelectionMask(slider.TailCircle, slider), + new SliderBodyMask(sliderObject), + headMask = new SliderCircleSelectionMask(slider.HeadCircle, sliderObject, SliderPosition.Start), + new SliderCircleSelectionMask(slider.TailCircle, sliderObject, SliderPosition.End), }; - - sliderObject.PositionChanged += _ => Position = slider.Position; } - [BackgroundDependencyLoader] - private void load(OsuColour colours) - { - body.BorderColour = colours.Yellow; - } - - protected override void Update() - { - base.Update(); - - Size = slider.Size; - OriginPosition = slider.OriginPosition; - - // Need to cause one update - body.UpdateProgress(0); - } - - public override bool ReceivePositionalInputAt(Vector2 screenSpacePos) => body.ReceivePositionalInputAt(screenSpacePos); - - public override Vector2 SelectionPoint => ToScreenSpace(OriginPosition); - public override Quad SelectionQuad => body.PathDrawQuad; + public override Vector2 SelectionPoint => headMask.SelectionPoint; } } diff --git a/osu.Game.Rulesets.Osu/Objects/OsuHitObject.cs b/osu.Game.Rulesets.Osu/Objects/OsuHitObject.cs index ab8f01f5d3..140f875a6f 100644 --- a/osu.Game.Rulesets.Osu/Objects/OsuHitObject.cs +++ b/osu.Game.Rulesets.Osu/Objects/OsuHitObject.cs @@ -23,7 +23,7 @@ namespace osu.Game.Rulesets.Osu.Objects private Vector2 position; - public Vector2 Position + public virtual Vector2 Position { get => position; set diff --git a/osu.Game.Rulesets.Osu/Objects/Slider.cs b/osu.Game.Rulesets.Osu/Objects/Slider.cs index 7a0dcc77a6..9a3bae96b0 100644 --- a/osu.Game.Rulesets.Osu/Objects/Slider.cs +++ b/osu.Game.Rulesets.Osu/Objects/Slider.cs @@ -70,6 +70,21 @@ namespace osu.Game.Rulesets.Osu.Objects set { Curve.Distance = value; } } + public override Vector2 Position + { + get => base.Position; + set + { + base.Position = value; + + if (HeadCircle != null) + HeadCircle.Position = value; + + if (TailCircle != null) + TailCircle.Position = EndPosition; + } + } + public double? LegacyLastTickOffset { get; set; } /// diff --git a/osu.Game/Rulesets/Edit/PlacementMask.cs b/osu.Game/Rulesets/Edit/PlacementMask.cs index 36c706db37..381dc5f7f0 100644 --- a/osu.Game/Rulesets/Edit/PlacementMask.cs +++ b/osu.Game/Rulesets/Edit/PlacementMask.cs @@ -3,6 +3,7 @@ using osu.Framework.Allocation; using osu.Framework.Configuration; +using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Framework.Input; using osu.Framework.Input.Events; @@ -31,6 +32,8 @@ namespace osu.Game.Rulesets.Edit public PlacementMask(HitObject hitObject) { HitObject = hitObject; + + RelativeSizeAxes = Axes.Both; } [BackgroundDependencyLoader] diff --git a/osu.Game/Rulesets/Edit/SelectionMask.cs b/osu.Game/Rulesets/Edit/SelectionMask.cs index 9582c30457..3b78d5aaf6 100644 --- a/osu.Game/Rulesets/Edit/SelectionMask.cs +++ b/osu.Game/Rulesets/Edit/SelectionMask.cs @@ -3,6 +3,7 @@ using System; using osu.Framework; +using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Primitives; using osu.Framework.Input.Events; @@ -52,6 +53,8 @@ namespace osu.Game.Rulesets.Edit { HitObject = hitObject; + RelativeSizeAxes = Axes.Both; + AlwaysPresent = true; Alpha = 0; } @@ -94,6 +97,8 @@ namespace osu.Game.Rulesets.Edit public bool IsSelected => State == SelectionState.Selected; + public override bool ReceivePositionalInputAt(Vector2 screenSpacePos) => HitObject.ReceivePositionalInputAt(screenSpacePos); + private bool selectionRequested; protected override bool OnMouseDown(MouseDownEvent e) @@ -132,11 +137,11 @@ namespace osu.Game.Rulesets.Edit /// /// The screen-space point that causes this to be selected. /// - public virtual Vector2 SelectionPoint => ScreenSpaceDrawQuad.Centre; + public virtual Vector2 SelectionPoint => HitObject.ScreenSpaceDrawQuad.Centre; /// /// The screen-space quad that outlines this for selections. /// - public virtual Quad SelectionQuad => ScreenSpaceDrawQuad; + public virtual Quad SelectionQuad => HitObject.ScreenSpaceDrawQuad; } } From d19f80835bbb88f4cf41e5520eb9e34434b15323 Mon Sep 17 00:00:00 2001 From: smoogipoo Date: Thu, 25 Oct 2018 18:26:28 +0900 Subject: [PATCH 312/417] Adjust namespaces --- osu.Game.Rulesets.Osu/Edit/HitCircleCompositionTool.cs | 2 +- .../Masks/{ => HitCircle/Components}/HitCircleMask.cs | 6 +++--- .../Edit/Masks/{ => HitCircle}/HitCirclePlacementMask.cs | 8 ++++---- .../Edit/Masks/{ => HitCircle}/HitCircleSelectionMask.cs | 6 +++--- .../Edit/Masks/{ => Slider/Components}/SliderBodyMask.cs | 7 +++---- .../Masks/{ => Slider/Components}/SliderCircleMask.cs | 8 ++++---- .../Edit/Masks/{ => Slider}/SliderCircleSelectionMask.cs | 6 +++--- .../Edit/Masks/{ => Slider}/SliderPosition.cs | 2 +- .../Edit/Masks/{ => Slider}/SliderSelectionMask.cs | 6 +++--- osu.Game.Rulesets.Osu/Edit/OsuHitObjectComposer.cs | 3 ++- osu.Game.Tests/Visual/TestCaseHitObjectComposer.cs | 3 ++- 11 files changed, 29 insertions(+), 28 deletions(-) rename osu.Game.Rulesets.Osu/Edit/Masks/{ => HitCircle/Components}/HitCircleMask.cs (87%) rename osu.Game.Rulesets.Osu/Edit/Masks/{ => HitCircle}/HitCirclePlacementMask.cs (81%) rename osu.Game.Rulesets.Osu/Edit/Masks/{ => HitCircle}/HitCircleSelectionMask.cs (67%) rename osu.Game.Rulesets.Osu/Edit/Masks/{ => Slider/Components}/SliderBodyMask.cs (88%) rename osu.Game.Rulesets.Osu/Edit/Masks/{ => Slider/Components}/SliderCircleMask.cs (76%) rename osu.Game.Rulesets.Osu/Edit/Masks/{ => Slider}/SliderCircleSelectionMask.cs (81%) rename osu.Game.Rulesets.Osu/Edit/Masks/{ => Slider}/SliderPosition.cs (82%) rename osu.Game.Rulesets.Osu/Edit/Masks/{ => Slider}/SliderSelectionMask.cs (84%) diff --git a/osu.Game.Rulesets.Osu/Edit/HitCircleCompositionTool.cs b/osu.Game.Rulesets.Osu/Edit/HitCircleCompositionTool.cs index fdf791d2d1..7f53409a32 100644 --- a/osu.Game.Rulesets.Osu/Edit/HitCircleCompositionTool.cs +++ b/osu.Game.Rulesets.Osu/Edit/HitCircleCompositionTool.cs @@ -3,7 +3,7 @@ using osu.Game.Rulesets.Edit; using osu.Game.Rulesets.Edit.Tools; -using osu.Game.Rulesets.Osu.Edit.Masks; +using osu.Game.Rulesets.Osu.Edit.Masks.HitCircle; using osu.Game.Rulesets.Osu.Objects; namespace osu.Game.Rulesets.Osu.Edit diff --git a/osu.Game.Rulesets.Osu/Edit/Masks/HitCircleMask.cs b/osu.Game.Rulesets.Osu/Edit/Masks/HitCircle/Components/HitCircleMask.cs similarity index 87% rename from osu.Game.Rulesets.Osu/Edit/Masks/HitCircleMask.cs rename to osu.Game.Rulesets.Osu/Edit/Masks/HitCircle/Components/HitCircleMask.cs index 696726e8bf..b43399ff18 100644 --- a/osu.Game.Rulesets.Osu/Edit/Masks/HitCircleMask.cs +++ b/osu.Game.Rulesets.Osu/Edit/Masks/HitCircle/Components/HitCircleMask.cs @@ -9,13 +9,13 @@ using osu.Game.Rulesets.Osu.Objects; using osu.Game.Rulesets.Osu.Objects.Drawables.Pieces; using OpenTK; -namespace osu.Game.Rulesets.Osu.Edit.Masks +namespace osu.Game.Rulesets.Osu.Edit.Masks.HitCircle.Components { public class HitCircleMask : CompositeDrawable { - private readonly HitCircle hitCircle; + private readonly Objects.HitCircle hitCircle; - public HitCircleMask(HitCircle hitCircle) + public HitCircleMask(Objects.HitCircle hitCircle) { this.hitCircle = hitCircle; diff --git a/osu.Game.Rulesets.Osu/Edit/Masks/HitCirclePlacementMask.cs b/osu.Game.Rulesets.Osu/Edit/Masks/HitCircle/HitCirclePlacementMask.cs similarity index 81% rename from osu.Game.Rulesets.Osu/Edit/Masks/HitCirclePlacementMask.cs rename to osu.Game.Rulesets.Osu/Edit/Masks/HitCircle/HitCirclePlacementMask.cs index 2c259f562d..c7bc7decc4 100644 --- a/osu.Game.Rulesets.Osu/Edit/Masks/HitCirclePlacementMask.cs +++ b/osu.Game.Rulesets.Osu/Edit/Masks/HitCircle/HitCirclePlacementMask.cs @@ -3,16 +3,16 @@ using osu.Framework.Input.Events; using osu.Game.Rulesets.Edit; -using osu.Game.Rulesets.Osu.Objects; +using osu.Game.Rulesets.Osu.Edit.Masks.HitCircle.Components; -namespace osu.Game.Rulesets.Osu.Edit.Masks +namespace osu.Game.Rulesets.Osu.Edit.Masks.HitCircle { public class HitCirclePlacementMask : PlacementMask { - public new HitCircle HitObject => (HitCircle)base.HitObject; + public new Objects.HitCircle HitObject => (Objects.HitCircle)base.HitObject; public HitCirclePlacementMask() - : base(new HitCircle()) + : base(new Objects.HitCircle()) { InternalChild = new HitCircleMask(HitObject); } diff --git a/osu.Game.Rulesets.Osu/Edit/Masks/HitCircleSelectionMask.cs b/osu.Game.Rulesets.Osu/Edit/Masks/HitCircle/HitCircleSelectionMask.cs similarity index 67% rename from osu.Game.Rulesets.Osu/Edit/Masks/HitCircleSelectionMask.cs rename to osu.Game.Rulesets.Osu/Edit/Masks/HitCircle/HitCircleSelectionMask.cs index 49ff955896..dd6bcc6fad 100644 --- a/osu.Game.Rulesets.Osu/Edit/Masks/HitCircleSelectionMask.cs +++ b/osu.Game.Rulesets.Osu/Edit/Masks/HitCircle/HitCircleSelectionMask.cs @@ -2,17 +2,17 @@ // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE using osu.Game.Rulesets.Edit; -using osu.Game.Rulesets.Osu.Objects; +using osu.Game.Rulesets.Osu.Edit.Masks.HitCircle.Components; using osu.Game.Rulesets.Osu.Objects.Drawables; -namespace osu.Game.Rulesets.Osu.Edit.Masks +namespace osu.Game.Rulesets.Osu.Edit.Masks.HitCircle { public class HitCircleSelectionMask : SelectionMask { public HitCircleSelectionMask(DrawableHitCircle hitCircle) : base(hitCircle) { - InternalChild = new HitCircleMask((HitCircle)hitCircle.HitObject); + InternalChild = new HitCircleMask((Objects.HitCircle)hitCircle.HitObject); } } } diff --git a/osu.Game.Rulesets.Osu/Edit/Masks/SliderBodyMask.cs b/osu.Game.Rulesets.Osu/Edit/Masks/Slider/Components/SliderBodyMask.cs similarity index 88% rename from osu.Game.Rulesets.Osu/Edit/Masks/SliderBodyMask.cs rename to osu.Game.Rulesets.Osu/Edit/Masks/Slider/Components/SliderBodyMask.cs index c95b2d7722..733a777dff 100644 --- a/osu.Game.Rulesets.Osu/Edit/Masks/SliderBodyMask.cs +++ b/osu.Game.Rulesets.Osu/Edit/Masks/Slider/Components/SliderBodyMask.cs @@ -4,18 +4,17 @@ using osu.Framework.Allocation; using osu.Framework.Graphics.Containers; using osu.Game.Graphics; -using osu.Game.Rulesets.Osu.Objects; using osu.Game.Rulesets.Osu.Objects.Drawables.Pieces; using OpenTK.Graphics; -namespace osu.Game.Rulesets.Osu.Edit.Masks +namespace osu.Game.Rulesets.Osu.Edit.Masks.Slider.Components { public class SliderBodyMask : CompositeDrawable { - private readonly Slider slider; + private readonly Objects.Slider slider; private readonly SliderBody body; - public SliderBodyMask(Slider slider) + public SliderBodyMask(Objects.Slider slider) { this.slider = slider; InternalChild = body = new SliderBody(slider) diff --git a/osu.Game.Rulesets.Osu/Edit/Masks/SliderCircleMask.cs b/osu.Game.Rulesets.Osu/Edit/Masks/Slider/Components/SliderCircleMask.cs similarity index 76% rename from osu.Game.Rulesets.Osu/Edit/Masks/SliderCircleMask.cs rename to osu.Game.Rulesets.Osu/Edit/Masks/Slider/Components/SliderCircleMask.cs index de128552c6..37c0846285 100644 --- a/osu.Game.Rulesets.Osu/Edit/Masks/SliderCircleMask.cs +++ b/osu.Game.Rulesets.Osu/Edit/Masks/Slider/Components/SliderCircleMask.cs @@ -1,16 +1,16 @@ // Copyright (c) 2007-2018 ppy Pty Ltd . // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE -using osu.Game.Rulesets.Osu.Objects; +using osu.Game.Rulesets.Osu.Edit.Masks.HitCircle.Components; -namespace osu.Game.Rulesets.Osu.Edit.Masks +namespace osu.Game.Rulesets.Osu.Edit.Masks.Slider.Components { public class SliderCircleMask : HitCircleMask { - private readonly Slider slider; + private readonly Objects.Slider slider; private readonly SliderPosition position; - public SliderCircleMask(Slider slider, SliderPosition position) + public SliderCircleMask(Objects.Slider slider, SliderPosition position) : base(slider.HeadCircle) { this.slider = slider; diff --git a/osu.Game.Rulesets.Osu/Edit/Masks/SliderCircleSelectionMask.cs b/osu.Game.Rulesets.Osu/Edit/Masks/Slider/SliderCircleSelectionMask.cs similarity index 81% rename from osu.Game.Rulesets.Osu/Edit/Masks/SliderCircleSelectionMask.cs rename to osu.Game.Rulesets.Osu/Edit/Masks/Slider/SliderCircleSelectionMask.cs index ebbb050c18..22aadba478 100644 --- a/osu.Game.Rulesets.Osu/Edit/Masks/SliderCircleSelectionMask.cs +++ b/osu.Game.Rulesets.Osu/Edit/Masks/Slider/SliderCircleSelectionMask.cs @@ -2,14 +2,14 @@ // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE using osu.Game.Rulesets.Edit; -using osu.Game.Rulesets.Osu.Objects; +using osu.Game.Rulesets.Osu.Edit.Masks.Slider.Components; using osu.Game.Rulesets.Osu.Objects.Drawables; -namespace osu.Game.Rulesets.Osu.Edit.Masks +namespace osu.Game.Rulesets.Osu.Edit.Masks.Slider { public class SliderCircleSelectionMask : SelectionMask { - public SliderCircleSelectionMask(DrawableOsuHitObject hitObject, Slider slider, SliderPosition position) + public SliderCircleSelectionMask(DrawableOsuHitObject hitObject, Objects.Slider slider, SliderPosition position) : base(hitObject) { InternalChild = new SliderCircleMask(slider, position); diff --git a/osu.Game.Rulesets.Osu/Edit/Masks/SliderPosition.cs b/osu.Game.Rulesets.Osu/Edit/Masks/Slider/SliderPosition.cs similarity index 82% rename from osu.Game.Rulesets.Osu/Edit/Masks/SliderPosition.cs rename to osu.Game.Rulesets.Osu/Edit/Masks/Slider/SliderPosition.cs index dc5f670d48..07f45af3ef 100644 --- a/osu.Game.Rulesets.Osu/Edit/Masks/SliderPosition.cs +++ b/osu.Game.Rulesets.Osu/Edit/Masks/Slider/SliderPosition.cs @@ -1,7 +1,7 @@ // Copyright (c) 2007-2018 ppy Pty Ltd . // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE -namespace osu.Game.Rulesets.Osu.Edit.Masks +namespace osu.Game.Rulesets.Osu.Edit.Masks.Slider { public enum SliderPosition { diff --git a/osu.Game.Rulesets.Osu/Edit/Masks/SliderSelectionMask.cs b/osu.Game.Rulesets.Osu/Edit/Masks/Slider/SliderSelectionMask.cs similarity index 84% rename from osu.Game.Rulesets.Osu/Edit/Masks/SliderSelectionMask.cs rename to osu.Game.Rulesets.Osu/Edit/Masks/Slider/SliderSelectionMask.cs index c330641bcf..e22a8119f9 100644 --- a/osu.Game.Rulesets.Osu/Edit/Masks/SliderSelectionMask.cs +++ b/osu.Game.Rulesets.Osu/Edit/Masks/Slider/SliderSelectionMask.cs @@ -3,11 +3,11 @@ using osu.Framework.Graphics; using osu.Game.Rulesets.Edit; -using osu.Game.Rulesets.Osu.Objects; +using osu.Game.Rulesets.Osu.Edit.Masks.Slider.Components; using osu.Game.Rulesets.Osu.Objects.Drawables; using OpenTK; -namespace osu.Game.Rulesets.Osu.Edit.Masks +namespace osu.Game.Rulesets.Osu.Edit.Masks.Slider { public class SliderSelectionMask : SelectionMask { @@ -16,7 +16,7 @@ namespace osu.Game.Rulesets.Osu.Edit.Masks public SliderSelectionMask(DrawableSlider slider) : base(slider) { - var sliderObject = (Slider)slider.HitObject; + var sliderObject = (Objects.Slider)slider.HitObject; InternalChildren = new Drawable[] { diff --git a/osu.Game.Rulesets.Osu/Edit/OsuHitObjectComposer.cs b/osu.Game.Rulesets.Osu/Edit/OsuHitObjectComposer.cs index 2dbd15fdc0..df72d2acca 100644 --- a/osu.Game.Rulesets.Osu/Edit/OsuHitObjectComposer.cs +++ b/osu.Game.Rulesets.Osu/Edit/OsuHitObjectComposer.cs @@ -8,7 +8,8 @@ using osu.Game.Beatmaps; using osu.Game.Rulesets.Edit; using osu.Game.Rulesets.Edit.Tools; using osu.Game.Rulesets.Objects.Drawables; -using osu.Game.Rulesets.Osu.Edit.Masks; +using osu.Game.Rulesets.Osu.Edit.Masks.HitCircle; +using osu.Game.Rulesets.Osu.Edit.Masks.Slider; using osu.Game.Rulesets.Osu.Objects; using osu.Game.Rulesets.Osu.Objects.Drawables; using osu.Game.Rulesets.Osu.UI; diff --git a/osu.Game.Tests/Visual/TestCaseHitObjectComposer.cs b/osu.Game.Tests/Visual/TestCaseHitObjectComposer.cs index 9e1ec7feb2..8b7355e456 100644 --- a/osu.Game.Tests/Visual/TestCaseHitObjectComposer.cs +++ b/osu.Game.Tests/Visual/TestCaseHitObjectComposer.cs @@ -13,7 +13,8 @@ using osu.Game.Rulesets.Edit; using osu.Game.Rulesets.Objects; using osu.Game.Rulesets.Osu; using osu.Game.Rulesets.Osu.Edit; -using osu.Game.Rulesets.Osu.Edit.Masks; +using osu.Game.Rulesets.Osu.Edit.Masks.HitCircle; +using osu.Game.Rulesets.Osu.Edit.Masks.HitCircle.Components; using osu.Game.Rulesets.Osu.Objects; using osu.Game.Screens.Edit.Screens.Compose; using osu.Game.Screens.Edit.Screens.Compose.Layers; From e14719e44086c4556d80d52c57d8e28465745193 Mon Sep 17 00:00:00 2001 From: smoogipoo Date: Thu, 25 Oct 2018 18:28:04 +0900 Subject: [PATCH 313/417] Mask -> Piece for non-mask components --- .../Components/{HitCircleMask.cs => HitCirclePiece.cs} | 4 ++-- .../Edit/Masks/HitCircle/HitCirclePlacementMask.cs | 2 +- .../Edit/Masks/HitCircle/HitCircleSelectionMask.cs | 2 +- .../Slider/Components/{SliderBodyMask.cs => BodyPiece.cs} | 4 ++-- .../Components/{SliderCircleMask.cs => SliderCirclePiece.cs} | 4 ++-- .../Edit/Masks/Slider/SliderCircleSelectionMask.cs | 2 +- .../Edit/Masks/Slider/SliderSelectionMask.cs | 2 +- osu.Game.Tests/Visual/TestCaseHitObjectComposer.cs | 2 +- 8 files changed, 11 insertions(+), 11 deletions(-) rename osu.Game.Rulesets.Osu/Edit/Masks/HitCircle/Components/{HitCircleMask.cs => HitCirclePiece.cs} (92%) rename osu.Game.Rulesets.Osu/Edit/Masks/Slider/Components/{SliderBodyMask.cs => BodyPiece.cs} (92%) rename osu.Game.Rulesets.Osu/Edit/Masks/Slider/Components/{SliderCircleMask.cs => SliderCirclePiece.cs} (87%) diff --git a/osu.Game.Rulesets.Osu/Edit/Masks/HitCircle/Components/HitCircleMask.cs b/osu.Game.Rulesets.Osu/Edit/Masks/HitCircle/Components/HitCirclePiece.cs similarity index 92% rename from osu.Game.Rulesets.Osu/Edit/Masks/HitCircle/Components/HitCircleMask.cs rename to osu.Game.Rulesets.Osu/Edit/Masks/HitCircle/Components/HitCirclePiece.cs index b43399ff18..7f6ee32427 100644 --- a/osu.Game.Rulesets.Osu/Edit/Masks/HitCircle/Components/HitCircleMask.cs +++ b/osu.Game.Rulesets.Osu/Edit/Masks/HitCircle/Components/HitCirclePiece.cs @@ -11,11 +11,11 @@ using OpenTK; namespace osu.Game.Rulesets.Osu.Edit.Masks.HitCircle.Components { - public class HitCircleMask : CompositeDrawable + public class HitCirclePiece : CompositeDrawable { private readonly Objects.HitCircle hitCircle; - public HitCircleMask(Objects.HitCircle hitCircle) + public HitCirclePiece(Objects.HitCircle hitCircle) { this.hitCircle = hitCircle; diff --git a/osu.Game.Rulesets.Osu/Edit/Masks/HitCircle/HitCirclePlacementMask.cs b/osu.Game.Rulesets.Osu/Edit/Masks/HitCircle/HitCirclePlacementMask.cs index c7bc7decc4..d172b87b44 100644 --- a/osu.Game.Rulesets.Osu/Edit/Masks/HitCircle/HitCirclePlacementMask.cs +++ b/osu.Game.Rulesets.Osu/Edit/Masks/HitCircle/HitCirclePlacementMask.cs @@ -14,7 +14,7 @@ namespace osu.Game.Rulesets.Osu.Edit.Masks.HitCircle public HitCirclePlacementMask() : base(new Objects.HitCircle()) { - InternalChild = new HitCircleMask(HitObject); + InternalChild = new HitCirclePiece(HitObject); } protected override void LoadComplete() diff --git a/osu.Game.Rulesets.Osu/Edit/Masks/HitCircle/HitCircleSelectionMask.cs b/osu.Game.Rulesets.Osu/Edit/Masks/HitCircle/HitCircleSelectionMask.cs index dd6bcc6fad..eb9696baa0 100644 --- a/osu.Game.Rulesets.Osu/Edit/Masks/HitCircle/HitCircleSelectionMask.cs +++ b/osu.Game.Rulesets.Osu/Edit/Masks/HitCircle/HitCircleSelectionMask.cs @@ -12,7 +12,7 @@ namespace osu.Game.Rulesets.Osu.Edit.Masks.HitCircle public HitCircleSelectionMask(DrawableHitCircle hitCircle) : base(hitCircle) { - InternalChild = new HitCircleMask((Objects.HitCircle)hitCircle.HitObject); + InternalChild = new HitCirclePiece((Objects.HitCircle)hitCircle.HitObject); } } } diff --git a/osu.Game.Rulesets.Osu/Edit/Masks/Slider/Components/SliderBodyMask.cs b/osu.Game.Rulesets.Osu/Edit/Masks/Slider/Components/BodyPiece.cs similarity index 92% rename from osu.Game.Rulesets.Osu/Edit/Masks/Slider/Components/SliderBodyMask.cs rename to osu.Game.Rulesets.Osu/Edit/Masks/Slider/Components/BodyPiece.cs index 733a777dff..ddf591b401 100644 --- a/osu.Game.Rulesets.Osu/Edit/Masks/Slider/Components/SliderBodyMask.cs +++ b/osu.Game.Rulesets.Osu/Edit/Masks/Slider/Components/BodyPiece.cs @@ -9,12 +9,12 @@ using OpenTK.Graphics; namespace osu.Game.Rulesets.Osu.Edit.Masks.Slider.Components { - public class SliderBodyMask : CompositeDrawable + public class BodyPiece : CompositeDrawable { private readonly Objects.Slider slider; private readonly SliderBody body; - public SliderBodyMask(Objects.Slider slider) + public BodyPiece(Objects.Slider slider) { this.slider = slider; InternalChild = body = new SliderBody(slider) diff --git a/osu.Game.Rulesets.Osu/Edit/Masks/Slider/Components/SliderCircleMask.cs b/osu.Game.Rulesets.Osu/Edit/Masks/Slider/Components/SliderCirclePiece.cs similarity index 87% rename from osu.Game.Rulesets.Osu/Edit/Masks/Slider/Components/SliderCircleMask.cs rename to osu.Game.Rulesets.Osu/Edit/Masks/Slider/Components/SliderCirclePiece.cs index 37c0846285..b1c05574d4 100644 --- a/osu.Game.Rulesets.Osu/Edit/Masks/Slider/Components/SliderCircleMask.cs +++ b/osu.Game.Rulesets.Osu/Edit/Masks/Slider/Components/SliderCirclePiece.cs @@ -5,12 +5,12 @@ using osu.Game.Rulesets.Osu.Edit.Masks.HitCircle.Components; namespace osu.Game.Rulesets.Osu.Edit.Masks.Slider.Components { - public class SliderCircleMask : HitCircleMask + public class SliderCirclePiece : HitCirclePiece { private readonly Objects.Slider slider; private readonly SliderPosition position; - public SliderCircleMask(Objects.Slider slider, SliderPosition position) + public SliderCirclePiece(Objects.Slider slider, SliderPosition position) : base(slider.HeadCircle) { this.slider = slider; diff --git a/osu.Game.Rulesets.Osu/Edit/Masks/Slider/SliderCircleSelectionMask.cs b/osu.Game.Rulesets.Osu/Edit/Masks/Slider/SliderCircleSelectionMask.cs index 22aadba478..e65a3f2665 100644 --- a/osu.Game.Rulesets.Osu/Edit/Masks/Slider/SliderCircleSelectionMask.cs +++ b/osu.Game.Rulesets.Osu/Edit/Masks/Slider/SliderCircleSelectionMask.cs @@ -12,7 +12,7 @@ namespace osu.Game.Rulesets.Osu.Edit.Masks.Slider public SliderCircleSelectionMask(DrawableOsuHitObject hitObject, Objects.Slider slider, SliderPosition position) : base(hitObject) { - InternalChild = new SliderCircleMask(slider, position); + InternalChild = new SliderCirclePiece(slider, position); Select(); } diff --git a/osu.Game.Rulesets.Osu/Edit/Masks/Slider/SliderSelectionMask.cs b/osu.Game.Rulesets.Osu/Edit/Masks/Slider/SliderSelectionMask.cs index e22a8119f9..e7a8652ed7 100644 --- a/osu.Game.Rulesets.Osu/Edit/Masks/Slider/SliderSelectionMask.cs +++ b/osu.Game.Rulesets.Osu/Edit/Masks/Slider/SliderSelectionMask.cs @@ -20,7 +20,7 @@ namespace osu.Game.Rulesets.Osu.Edit.Masks.Slider InternalChildren = new Drawable[] { - new SliderBodyMask(sliderObject), + new BodyPiece(sliderObject), headMask = new SliderCircleSelectionMask(slider.HeadCircle, sliderObject, SliderPosition.Start), new SliderCircleSelectionMask(slider.TailCircle, sliderObject, SliderPosition.End), }; diff --git a/osu.Game.Tests/Visual/TestCaseHitObjectComposer.cs b/osu.Game.Tests/Visual/TestCaseHitObjectComposer.cs index 8b7355e456..482e801563 100644 --- a/osu.Game.Tests/Visual/TestCaseHitObjectComposer.cs +++ b/osu.Game.Tests/Visual/TestCaseHitObjectComposer.cs @@ -34,7 +34,7 @@ namespace osu.Game.Tests.Visual typeof(OsuHitObjectComposer), typeof(HitObjectMaskLayer), typeof(NotNullAttribute), - typeof(HitCircleMask), + typeof(HitCirclePiece), typeof(HitCircleSelectionMask), typeof(HitCirclePlacementMask), }; From 4ecd4ca462725ee1f3d96d99f699423d8002048b Mon Sep 17 00:00:00 2001 From: smoogipoo Date: Thu, 25 Oct 2018 18:48:11 +0900 Subject: [PATCH 314/417] Add selection mask test cases --- .../TestCaseHitCircleSelectionMask.cs | 29 ++++++++++++ .../TestCaseSliderSelectionMask.cs | 43 +++++++++++++++++ .../Visual/HitObjectSelectionMaskTestCase.cs | 47 +++++++++++++++++++ 3 files changed, 119 insertions(+) create mode 100644 osu.Game.Rulesets.Osu.Tests/TestCaseHitCircleSelectionMask.cs create mode 100644 osu.Game.Rulesets.Osu.Tests/TestCaseSliderSelectionMask.cs create mode 100644 osu.Game/Tests/Visual/HitObjectSelectionMaskTestCase.cs diff --git a/osu.Game.Rulesets.Osu.Tests/TestCaseHitCircleSelectionMask.cs b/osu.Game.Rulesets.Osu.Tests/TestCaseHitCircleSelectionMask.cs new file mode 100644 index 0000000000..bafd7fa8bf --- /dev/null +++ b/osu.Game.Rulesets.Osu.Tests/TestCaseHitCircleSelectionMask.cs @@ -0,0 +1,29 @@ +// Copyright (c) 2007-2018 ppy Pty Ltd . +// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE + +using osu.Game.Beatmaps; +using osu.Game.Beatmaps.ControlPoints; +using osu.Game.Rulesets.Edit; +using osu.Game.Rulesets.Osu.Edit.Masks.HitCircle; +using osu.Game.Rulesets.Osu.Objects; +using osu.Game.Rulesets.Osu.Objects.Drawables; +using osu.Game.Tests.Visual; +using OpenTK; + +namespace osu.Game.Rulesets.Osu.Tests +{ + public class TestCaseHitCircleSelectionMask : HitObjectSelectionMaskTestCase + { + private readonly DrawableHitCircle drawableObject; + + public TestCaseHitCircleSelectionMask() + { + var hitCircle = new HitCircle { Position = new Vector2(256, 192) }; + hitCircle.ApplyDefaults(new ControlPointInfo(), new BeatmapDifficulty { CircleSize = 2 }); + + Add(drawableObject = new DrawableHitCircle(hitCircle)); + } + + protected override SelectionMask CreateMask() => new HitCircleSelectionMask(drawableObject); + } +} diff --git a/osu.Game.Rulesets.Osu.Tests/TestCaseSliderSelectionMask.cs b/osu.Game.Rulesets.Osu.Tests/TestCaseSliderSelectionMask.cs new file mode 100644 index 0000000000..0478946cb7 --- /dev/null +++ b/osu.Game.Rulesets.Osu.Tests/TestCaseSliderSelectionMask.cs @@ -0,0 +1,43 @@ +// Copyright (c) 2007-2018 ppy Pty Ltd . +// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE + +using System.Collections.Generic; +using osu.Game.Beatmaps; +using osu.Game.Beatmaps.ControlPoints; +using osu.Game.Rulesets.Edit; +using osu.Game.Rulesets.Objects.Types; +using osu.Game.Rulesets.Osu.Edit.Masks.Slider; +using osu.Game.Rulesets.Osu.Objects; +using osu.Game.Rulesets.Osu.Objects.Drawables; +using osu.Game.Tests.Visual; +using OpenTK; + +namespace osu.Game.Rulesets.Osu.Tests +{ + public class TestCaseSliderSelectionMask : HitObjectSelectionMaskTestCase + { + private readonly DrawableSlider drawableObject; + + public TestCaseSliderSelectionMask() + { + var slider = new Slider + { + Position = new Vector2(256, 192), + ControlPoints = new List + { + Vector2.Zero, + new Vector2(150, 150), + new Vector2(300, 0) + }, + CurveType = CurveType.Bezier, + Distance = 350 + }; + + slider.ApplyDefaults(new ControlPointInfo(), new BeatmapDifficulty { CircleSize = 2 }); + + Add(drawableObject = new DrawableSlider(slider)); + } + + protected override SelectionMask CreateMask() => new SliderSelectionMask(drawableObject); + } +} diff --git a/osu.Game/Tests/Visual/HitObjectSelectionMaskTestCase.cs b/osu.Game/Tests/Visual/HitObjectSelectionMaskTestCase.cs new file mode 100644 index 0000000000..3ba6841280 --- /dev/null +++ b/osu.Game/Tests/Visual/HitObjectSelectionMaskTestCase.cs @@ -0,0 +1,47 @@ +// Copyright (c) 2007-2018 ppy Pty Ltd . +// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE + +using osu.Framework.Allocation; +using osu.Framework.Graphics; +using osu.Framework.Graphics.Containers; +using osu.Framework.Input.Events; +using osu.Framework.Timing; +using osu.Game.Rulesets.Edit; + +namespace osu.Game.Tests.Visual +{ + public abstract class HitObjectSelectionMaskTestCase : OsuTestCase + { + private SelectionMask mask; + + protected override Container Content => content ?? base.Content; + private readonly Container content; + + protected HitObjectSelectionMaskTestCase() + { + base.Content.Add(content = new Container + { + Clock = new FramedClock(new StopwatchClock()), + RelativeSizeAxes = Axes.Both + }); + } + + [BackgroundDependencyLoader] + private void load() + { + base.Content.Add(mask = CreateMask()); + mask.SelectionRequested += (_, __) => mask.Select(); + + AddStep("Select", () => mask.Select()); + AddStep("Deselect", () => mask.Deselect()); + } + + protected override bool OnClick(ClickEvent e) + { + mask.Deselect(); + return true; + } + + protected abstract SelectionMask CreateMask(); + } +} From 2b141a2bc1c824dec79b8b5cb20e31f3a14d7cc2 Mon Sep 17 00:00:00 2001 From: smoogipoo Date: Thu, 25 Oct 2018 19:10:59 +0900 Subject: [PATCH 315/417] Make PlacementMask abstract --- osu.Game/Rulesets/Edit/PlacementMask.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/osu.Game/Rulesets/Edit/PlacementMask.cs b/osu.Game/Rulesets/Edit/PlacementMask.cs index 381dc5f7f0..a588a9e181 100644 --- a/osu.Game/Rulesets/Edit/PlacementMask.cs +++ b/osu.Game/Rulesets/Edit/PlacementMask.cs @@ -15,7 +15,7 @@ using OpenTK; namespace osu.Game.Rulesets.Edit { - public class PlacementMask : CompositeDrawable, IRequireHighFrequencyMousePosition + public abstract class PlacementMask : CompositeDrawable, IRequireHighFrequencyMousePosition { /// /// The that is being placed. @@ -29,7 +29,7 @@ namespace osu.Game.Rulesets.Edit [Resolved] private IPlacementHandler placementHandler { get; set; } - public PlacementMask(HitObject hitObject) + protected PlacementMask(HitObject hitObject) { HitObject = hitObject; From 2f42112d87cf935388af170041bbfb40606932d6 Mon Sep 17 00:00:00 2001 From: smoogipoo Date: Thu, 25 Oct 2018 19:11:57 +0900 Subject: [PATCH 316/417] Add placement mask testcase --- .../TestCaseHitCirclePlacementMask.cs | 19 ++++++ .../Visual/HitObjectPlacementMaskTestCase.cs | 63 +++++++++++++++++++ 2 files changed, 82 insertions(+) create mode 100644 osu.Game.Rulesets.Osu.Tests/TestCaseHitCirclePlacementMask.cs create mode 100644 osu.Game/Tests/Visual/HitObjectPlacementMaskTestCase.cs diff --git a/osu.Game.Rulesets.Osu.Tests/TestCaseHitCirclePlacementMask.cs b/osu.Game.Rulesets.Osu.Tests/TestCaseHitCirclePlacementMask.cs new file mode 100644 index 0000000000..4f94f88490 --- /dev/null +++ b/osu.Game.Rulesets.Osu.Tests/TestCaseHitCirclePlacementMask.cs @@ -0,0 +1,19 @@ +// Copyright (c) 2007-2018 ppy Pty Ltd . +// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE + +using osu.Game.Rulesets.Edit; +using osu.Game.Rulesets.Objects; +using osu.Game.Rulesets.Objects.Drawables; +using osu.Game.Rulesets.Osu.Edit.Masks.HitCircle; +using osu.Game.Rulesets.Osu.Objects; +using osu.Game.Rulesets.Osu.Objects.Drawables; +using osu.Game.Tests.Visual; + +namespace osu.Game.Rulesets.Osu.Tests +{ + public class TestCaseHitCirclePlacementMask : HitObjectPlacementMaskTestCase + { + protected override DrawableHitObject CreateHitObject(HitObject hitObject) => new DrawableHitCircle((HitCircle)hitObject); + protected override PlacementMask CreateMask() => new HitCirclePlacementMask(); + } +} diff --git a/osu.Game/Tests/Visual/HitObjectPlacementMaskTestCase.cs b/osu.Game/Tests/Visual/HitObjectPlacementMaskTestCase.cs new file mode 100644 index 0000000000..bb9b8a33bc --- /dev/null +++ b/osu.Game/Tests/Visual/HitObjectPlacementMaskTestCase.cs @@ -0,0 +1,63 @@ +// Copyright (c) 2007-2018 ppy Pty Ltd . +// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE + +using osu.Framework.Allocation; +using osu.Framework.Graphics; +using osu.Framework.Graphics.Containers; +using osu.Framework.Timing; +using osu.Game.Rulesets.Edit; +using osu.Game.Rulesets.Objects; +using osu.Game.Rulesets.Objects.Drawables; +using osu.Game.Screens.Edit.Screens.Compose; + +namespace osu.Game.Tests.Visual +{ + [Cached(Type = typeof(IPlacementHandler))] + public abstract class HitObjectPlacementMaskTestCase : OsuTestCase, IPlacementHandler + { + private readonly Container hitObjectContainer; + private PlacementMask currentMask; + + protected HitObjectPlacementMaskTestCase() + { + Add(hitObjectContainer = new Container + { + RelativeSizeAxes = Axes.Both, + Clock = new FramedClock(new StopwatchClock()) + }); + } + + [BackgroundDependencyLoader] + private void load() + { + Add(currentMask = CreateMask()); + } + + protected override IReadOnlyDependencyContainer CreateChildDependencies(IReadOnlyDependencyContainer parent) + { + var dependencies = new DependencyContainer(base.CreateChildDependencies(parent)); + dependencies.CacheAs(new StopwatchClock()); + + return dependencies; + } + + public void BeginPlacement(HitObject hitObject) + { + } + + public void EndPlacement(HitObject hitObject) + { + hitObjectContainer.Add(CreateHitObject(hitObject)); + + Remove(currentMask); + Add(currentMask = CreateMask()); + } + + public void Delete(HitObject hitObject) + { + } + + protected abstract DrawableHitObject CreateHitObject(HitObject hitObject); + protected abstract PlacementMask CreateMask(); + } +} From 8703db5cc1acae8d7fe776a8c07131bdcc5311d1 Mon Sep 17 00:00:00 2001 From: smoogipoo Date: Wed, 3 Oct 2018 13:28:00 +0900 Subject: [PATCH 317/417] Rename HitObjectMask -> SelectionMask --- ...ldNoteMask.cs => HoldNoteSelectionMask.cs} | 12 +++--- .../{NoteMask.cs => NoteSelectionMask.cs} | 4 +- .../Edit/ManiaHitObjectComposer.cs | 6 +-- ...ircleMask.cs => HitCircleSelectionMask.cs} | 4 +- ...leMask.cs => SliderCircleSelectionMask.cs} | 8 ++-- .../{SliderMask.cs => SliderSelectionMask.cs} | 8 ++-- .../Edit/OsuHitObjectComposer.cs | 6 +-- osu.Game/Beatmaps/BeatmapManager.cs | 2 +- osu.Game/Rulesets/Edit/HitObjectComposer.cs | 4 +- .../{HitObjectMask.cs => SelectionMask.cs} | 30 +++++++-------- .../Edit/Screens/Compose/Layers/DragLayer.cs | 4 +- .../Screens/Compose/Layers/MaskContainer.cs | 38 +++++++++---------- .../Screens/Compose/Layers/MaskSelection.cs | 14 +++---- 13 files changed, 70 insertions(+), 70 deletions(-) rename osu.Game.Rulesets.Mania/Edit/Layers/Selection/Overlays/{HoldNoteMask.cs => HoldNoteSelectionMask.cs} (87%) rename osu.Game.Rulesets.Mania/Edit/Layers/Selection/Overlays/{NoteMask.cs => NoteSelectionMask.cs} (90%) rename osu.Game.Rulesets.Osu/Edit/Layers/Selection/Overlays/{HitCircleMask.cs => HitCircleSelectionMask.cs} (88%) rename osu.Game.Rulesets.Osu/Edit/Layers/Selection/Overlays/{SliderCircleMask.cs => SliderCircleSelectionMask.cs} (81%) rename osu.Game.Rulesets.Osu/Edit/Layers/Selection/Overlays/{SliderMask.cs => SliderSelectionMask.cs} (87%) rename osu.Game/Rulesets/Edit/{HitObjectMask.cs => SelectionMask.cs} (80%) diff --git a/osu.Game.Rulesets.Mania/Edit/Layers/Selection/Overlays/HoldNoteMask.cs b/osu.Game.Rulesets.Mania/Edit/Layers/Selection/Overlays/HoldNoteSelectionMask.cs similarity index 87% rename from osu.Game.Rulesets.Mania/Edit/Layers/Selection/Overlays/HoldNoteMask.cs rename to osu.Game.Rulesets.Mania/Edit/Layers/Selection/Overlays/HoldNoteSelectionMask.cs index 03d2ba19cb..b4f62ea170 100644 --- a/osu.Game.Rulesets.Mania/Edit/Layers/Selection/Overlays/HoldNoteMask.cs +++ b/osu.Game.Rulesets.Mania/Edit/Layers/Selection/Overlays/HoldNoteSelectionMask.cs @@ -15,7 +15,7 @@ using OpenTK.Graphics; namespace osu.Game.Rulesets.Mania.Edit.Layers.Selection.Overlays { - public class HoldNoteMask : HitObjectMask + public class HoldNoteSelectionMask : SelectionMask { public new DrawableHoldNote HitObject => (DrawableHoldNote)base.HitObject; @@ -23,13 +23,13 @@ namespace osu.Game.Rulesets.Mania.Edit.Layers.Selection.Overlays private readonly BodyPiece body; - public HoldNoteMask(DrawableHoldNote hold) + public HoldNoteSelectionMask(DrawableHoldNote hold) : base(hold) { InternalChildren = new Drawable[] { - new HoldNoteNoteMask(hold.Head), - new HoldNoteNoteMask(hold.Tail), + new HoldNoteNoteSelectionMask(hold.Head), + new HoldNoteNoteSelectionMask(hold.Tail), body = new BodyPiece { AccentColour = Color4.Transparent @@ -59,9 +59,9 @@ namespace osu.Game.Rulesets.Mania.Edit.Layers.Selection.Overlays Y -= HitObject.Tail.DrawHeight; } - private class HoldNoteNoteMask : NoteMask + private class HoldNoteNoteSelectionMask : NoteSelectionMask { - public HoldNoteNoteMask(DrawableNote note) + public HoldNoteNoteSelectionMask(DrawableNote note) : base(note) { Select(); diff --git a/osu.Game.Rulesets.Mania/Edit/Layers/Selection/Overlays/NoteMask.cs b/osu.Game.Rulesets.Mania/Edit/Layers/Selection/Overlays/NoteSelectionMask.cs similarity index 90% rename from osu.Game.Rulesets.Mania/Edit/Layers/Selection/Overlays/NoteMask.cs rename to osu.Game.Rulesets.Mania/Edit/Layers/Selection/Overlays/NoteSelectionMask.cs index 78f876cb14..d976386d6e 100644 --- a/osu.Game.Rulesets.Mania/Edit/Layers/Selection/Overlays/NoteMask.cs +++ b/osu.Game.Rulesets.Mania/Edit/Layers/Selection/Overlays/NoteSelectionMask.cs @@ -9,9 +9,9 @@ using osu.Game.Rulesets.Mania.Objects.Drawables.Pieces; namespace osu.Game.Rulesets.Mania.Edit.Layers.Selection.Overlays { - public class NoteMask : HitObjectMask + public class NoteSelectionMask : SelectionMask { - public NoteMask(DrawableNote note) + public NoteSelectionMask(DrawableNote note) : base(note) { Scale = note.Scale; diff --git a/osu.Game.Rulesets.Mania/Edit/ManiaHitObjectComposer.cs b/osu.Game.Rulesets.Mania/Edit/ManiaHitObjectComposer.cs index f37d8134ce..7cc473c712 100644 --- a/osu.Game.Rulesets.Mania/Edit/ManiaHitObjectComposer.cs +++ b/osu.Game.Rulesets.Mania/Edit/ManiaHitObjectComposer.cs @@ -40,14 +40,14 @@ namespace osu.Game.Rulesets.Mania.Edit new HitObjectCompositionTool("Hold"), }; - public override HitObjectMask CreateMaskFor(DrawableHitObject hitObject) + public override SelectionMask CreateMaskFor(DrawableHitObject hitObject) { switch (hitObject) { case DrawableNote note: - return new NoteMask(note); + return new NoteSelectionMask(note); case DrawableHoldNote holdNote: - return new HoldNoteMask(holdNote); + return new HoldNoteSelectionMask(holdNote); } return base.CreateMaskFor(hitObject); diff --git a/osu.Game.Rulesets.Osu/Edit/Layers/Selection/Overlays/HitCircleMask.cs b/osu.Game.Rulesets.Osu/Edit/Layers/Selection/Overlays/HitCircleSelectionMask.cs similarity index 88% rename from osu.Game.Rulesets.Osu/Edit/Layers/Selection/Overlays/HitCircleMask.cs rename to osu.Game.Rulesets.Osu/Edit/Layers/Selection/Overlays/HitCircleSelectionMask.cs index a2aa639004..aa8044af15 100644 --- a/osu.Game.Rulesets.Osu/Edit/Layers/Selection/Overlays/HitCircleMask.cs +++ b/osu.Game.Rulesets.Osu/Edit/Layers/Selection/Overlays/HitCircleSelectionMask.cs @@ -10,9 +10,9 @@ using osu.Game.Rulesets.Osu.Objects.Drawables.Pieces; namespace osu.Game.Rulesets.Osu.Edit.Layers.Selection.Overlays { - public class HitCircleMask : HitObjectMask + public class HitCircleSelectionMask : SelectionMask { - public HitCircleMask(DrawableHitCircle hitCircle) + public HitCircleSelectionMask(DrawableHitCircle hitCircle) : base(hitCircle) { Origin = Anchor.Centre; diff --git a/osu.Game.Rulesets.Osu/Edit/Layers/Selection/Overlays/SliderCircleMask.cs b/osu.Game.Rulesets.Osu/Edit/Layers/Selection/Overlays/SliderCircleSelectionMask.cs similarity index 81% rename from osu.Game.Rulesets.Osu/Edit/Layers/Selection/Overlays/SliderCircleMask.cs rename to osu.Game.Rulesets.Osu/Edit/Layers/Selection/Overlays/SliderCircleSelectionMask.cs index 151564a2a8..4d6a530eda 100644 --- a/osu.Game.Rulesets.Osu/Edit/Layers/Selection/Overlays/SliderCircleMask.cs +++ b/osu.Game.Rulesets.Osu/Edit/Layers/Selection/Overlays/SliderCircleSelectionMask.cs @@ -12,21 +12,21 @@ using OpenTK; namespace osu.Game.Rulesets.Osu.Edit.Layers.Selection.Overlays { - public class SliderCircleMask : HitObjectMask + public class SliderCircleSelectionMask : SelectionMask { - public SliderCircleMask(DrawableHitCircle sliderHead, DrawableSlider slider) + public SliderCircleSelectionMask(DrawableHitCircle sliderHead, DrawableSlider slider) : this(sliderHead, Vector2.Zero, slider) { } - public SliderCircleMask(DrawableSliderTail sliderTail, DrawableSlider slider) + public SliderCircleSelectionMask(DrawableSliderTail sliderTail, DrawableSlider slider) : this(sliderTail, ((Slider)slider.HitObject).Curve.PositionAt(1), slider) { } private readonly DrawableOsuHitObject hitObject; - private SliderCircleMask(DrawableOsuHitObject hitObject, Vector2 position, DrawableSlider slider) + private SliderCircleSelectionMask(DrawableOsuHitObject hitObject, Vector2 position, DrawableSlider slider) : base(hitObject) { this.hitObject = hitObject; diff --git a/osu.Game.Rulesets.Osu/Edit/Layers/Selection/Overlays/SliderMask.cs b/osu.Game.Rulesets.Osu/Edit/Layers/Selection/Overlays/SliderSelectionMask.cs similarity index 87% rename from osu.Game.Rulesets.Osu/Edit/Layers/Selection/Overlays/SliderMask.cs rename to osu.Game.Rulesets.Osu/Edit/Layers/Selection/Overlays/SliderSelectionMask.cs index aff42dd233..40c2026937 100644 --- a/osu.Game.Rulesets.Osu/Edit/Layers/Selection/Overlays/SliderMask.cs +++ b/osu.Game.Rulesets.Osu/Edit/Layers/Selection/Overlays/SliderSelectionMask.cs @@ -14,12 +14,12 @@ using OpenTK.Graphics; namespace osu.Game.Rulesets.Osu.Edit.Layers.Selection.Overlays { - public class SliderMask : HitObjectMask + public class SliderSelectionMask : SelectionMask { private readonly SliderBody body; private readonly DrawableSlider slider; - public SliderMask(DrawableSlider slider) + public SliderSelectionMask(DrawableSlider slider) : base(slider) { this.slider = slider; @@ -35,8 +35,8 @@ namespace osu.Game.Rulesets.Osu.Edit.Layers.Selection.Overlays AccentColour = Color4.Transparent, PathWidth = sliderObject.Scale * 64 }, - new SliderCircleMask(slider.HeadCircle, slider), - new SliderCircleMask(slider.TailCircle, slider), + new SliderCircleSelectionMask(slider.HeadCircle, slider), + new SliderCircleSelectionMask(slider.TailCircle, slider), }; sliderObject.PositionChanged += _ => Position = slider.Position; diff --git a/osu.Game.Rulesets.Osu/Edit/OsuHitObjectComposer.cs b/osu.Game.Rulesets.Osu/Edit/OsuHitObjectComposer.cs index d6972d55d2..115513b60c 100644 --- a/osu.Game.Rulesets.Osu/Edit/OsuHitObjectComposer.cs +++ b/osu.Game.Rulesets.Osu/Edit/OsuHitObjectComposer.cs @@ -34,14 +34,14 @@ namespace osu.Game.Rulesets.Osu.Edit protected override Container CreateLayerContainer() => new PlayfieldAdjustmentContainer { RelativeSizeAxes = Axes.Both }; - public override HitObjectMask CreateMaskFor(DrawableHitObject hitObject) + public override SelectionMask CreateMaskFor(DrawableHitObject hitObject) { switch (hitObject) { case DrawableHitCircle circle: - return new HitCircleMask(circle); + return new HitCircleSelectionMask(circle); case DrawableSlider slider: - return new SliderMask(slider); + return new SliderSelectionMask(slider); } return base.CreateMaskFor(hitObject); diff --git a/osu.Game/Beatmaps/BeatmapManager.cs b/osu.Game/Beatmaps/BeatmapManager.cs index fad94dcdfd..24c68d392b 100644 --- a/osu.Game/Beatmaps/BeatmapManager.cs +++ b/osu.Game/Beatmaps/BeatmapManager.cs @@ -350,7 +350,7 @@ namespace osu.Game.Beatmaps OnlineBeatmapSetID = beatmap.BeatmapInfo.BeatmapSet?.OnlineBeatmapSetID, Beatmaps = new List(), Hash = computeBeatmapSetHash(reader), - Metadata = beatmap.Metadata + Metadata = beatmap.Metadata, }; } diff --git a/osu.Game/Rulesets/Edit/HitObjectComposer.cs b/osu.Game/Rulesets/Edit/HitObjectComposer.cs index 8060ac742a..0188870313 100644 --- a/osu.Game/Rulesets/Edit/HitObjectComposer.cs +++ b/osu.Game/Rulesets/Edit/HitObjectComposer.cs @@ -151,10 +151,10 @@ namespace osu.Game.Rulesets.Edit protected abstract IReadOnlyList CompositionTools { get; } /// - /// Creates a for a specific . + /// Creates a for a specific . /// /// The to create the overlay for. - public virtual HitObjectMask CreateMaskFor(DrawableHitObject hitObject) => null; + public virtual SelectionMask CreateMaskFor(DrawableHitObject hitObject) => null; /// /// Creates a which outlines s diff --git a/osu.Game/Rulesets/Edit/HitObjectMask.cs b/osu.Game/Rulesets/Edit/SelectionMask.cs similarity index 80% rename from osu.Game/Rulesets/Edit/HitObjectMask.cs rename to osu.Game/Rulesets/Edit/SelectionMask.cs index 636ea418f3..9582c30457 100644 --- a/osu.Game/Rulesets/Edit/HitObjectMask.cs +++ b/osu.Game/Rulesets/Edit/SelectionMask.cs @@ -16,31 +16,31 @@ namespace osu.Game.Rulesets.Edit /// /// A mask placed above a adding editing functionality. /// - public class HitObjectMask : CompositeDrawable, IStateful + public class SelectionMask : CompositeDrawable, IStateful { /// - /// Invoked when this has been selected. + /// Invoked when this has been selected. /// - public event Action Selected; + public event Action Selected; /// - /// Invoked when this has been deselected. + /// Invoked when this has been deselected. /// - public event Action Deselected; + public event Action Deselected; /// - /// Invoked when this has requested selection. + /// Invoked when this has requested selection. /// Will fire even if already selected. Does not actually perform selection. /// - public event Action SelectionRequested; + public event Action SelectionRequested; /// - /// Invoked when this has requested drag. + /// Invoked when this has requested drag. /// - public event Action DragRequested; + public event Action DragRequested; /// - /// The which this applies to. + /// The which this applies to. /// public readonly DrawableHitObject HitObject; @@ -48,7 +48,7 @@ namespace osu.Game.Rulesets.Edit public override bool HandlePositionalInput => ShouldBeAlive; public override bool RemoveWhenNotAlive => false; - public HitObjectMask(DrawableHitObject hitObject) + public SelectionMask(DrawableHitObject hitObject) { HitObject = hitObject; @@ -83,12 +83,12 @@ namespace osu.Game.Rulesets.Edit } /// - /// Selects this , causing it to become visible. + /// Selects this , causing it to become visible. /// public void Select() => State = SelectionState.Selected; /// - /// Deselects this , causing it to become invisible. + /// Deselects this , causing it to become invisible. /// public void Deselect() => State = SelectionState.NotSelected; @@ -130,12 +130,12 @@ namespace osu.Game.Rulesets.Edit } /// - /// The screen-space point that causes this to be selected. + /// The screen-space point that causes this to be selected. /// public virtual Vector2 SelectionPoint => ScreenSpaceDrawQuad.Centre; /// - /// The screen-space quad that outlines this for selections. + /// The screen-space quad that outlines this for selections. /// public virtual Quad SelectionQuad => ScreenSpaceDrawQuad; } diff --git a/osu.Game/Screens/Edit/Screens/Compose/Layers/DragLayer.cs b/osu.Game/Screens/Edit/Screens/Compose/Layers/DragLayer.cs index 981ddd989c..fdc0dee0ce 100644 --- a/osu.Game/Screens/Edit/Screens/Compose/Layers/DragLayer.cs +++ b/osu.Game/Screens/Edit/Screens/Compose/Layers/DragLayer.cs @@ -14,7 +14,7 @@ using OpenTK.Graphics; namespace osu.Game.Screens.Edit.Screens.Compose.Layers { /// - /// A layer that handles and displays drag selection for a collection of s. + /// A layer that handles and displays drag selection for a collection of s. /// public class DragLayer : CompositeDrawable { @@ -30,7 +30,7 @@ namespace osu.Game.Screens.Edit.Screens.Compose.Layers /// /// Creates a new . /// - /// The selectable s. + /// The selectable s. public DragLayer(Action performSelection) { this.performSelection = performSelection; diff --git a/osu.Game/Screens/Edit/Screens/Compose/Layers/MaskContainer.cs b/osu.Game/Screens/Edit/Screens/Compose/Layers/MaskContainer.cs index 19258d669e..42a7757721 100644 --- a/osu.Game/Screens/Edit/Screens/Compose/Layers/MaskContainer.cs +++ b/osu.Game/Screens/Edit/Screens/Compose/Layers/MaskContainer.cs @@ -13,36 +13,36 @@ using RectangleF = osu.Framework.Graphics.Primitives.RectangleF; namespace osu.Game.Screens.Edit.Screens.Compose.Layers { - public class MaskContainer : Container + public class MaskContainer : Container { /// - /// Invoked when any is selected. + /// Invoked when any is selected. /// - public event Action MaskSelected; + public event Action MaskSelected; /// - /// Invoked when any is deselected. + /// Invoked when any is deselected. /// - public event Action MaskDeselected; + public event Action MaskDeselected; /// - /// Invoked when any requests selection. + /// Invoked when any requests selection. /// - public event Action MaskSelectionRequested; + public event Action MaskSelectionRequested; /// - /// Invoked when any requests drag. + /// Invoked when any requests drag. /// - public event Action MaskDragRequested; + public event Action MaskDragRequested; - private IEnumerable aliveMasks => AliveInternalChildren.Cast(); + private IEnumerable aliveMasks => AliveInternalChildren.Cast(); public MaskContainer() { RelativeSizeAxes = Axes.Both; } - public override void Add(HitObjectMask drawable) + public override void Add(SelectionMask drawable) { if (drawable == null) throw new ArgumentNullException(nameof(drawable)); @@ -54,7 +54,7 @@ namespace osu.Game.Screens.Edit.Screens.Compose.Layers drawable.DragRequested += onDragRequested; } - public override bool Remove(HitObjectMask drawable) + public override bool Remove(SelectionMask drawable) { if (drawable == null) throw new ArgumentNullException(nameof(drawable)); @@ -87,33 +87,33 @@ namespace osu.Game.Screens.Edit.Screens.Compose.Layers } /// - /// Deselects all selected s. + /// Deselects all selected s. /// public void DeselectAll() => aliveMasks.ToList().ForEach(m => m.Deselect()); - private void onMaskSelected(HitObjectMask mask) + private void onMaskSelected(SelectionMask mask) { MaskSelected?.Invoke(mask); ChangeChildDepth(mask, 1); } - private void onMaskDeselected(HitObjectMask mask) + private void onMaskDeselected(SelectionMask mask) { MaskDeselected?.Invoke(mask); ChangeChildDepth(mask, 0); } - private void onSelectionRequested(HitObjectMask mask, InputState state) => MaskSelectionRequested?.Invoke(mask, state); - private void onDragRequested(HitObjectMask mask, Vector2 delta, InputState state) => MaskDragRequested?.Invoke(mask, delta, state); + private void onSelectionRequested(SelectionMask mask, InputState state) => MaskSelectionRequested?.Invoke(mask, state); + private void onDragRequested(SelectionMask mask, Vector2 delta, InputState state) => MaskDragRequested?.Invoke(mask, delta, state); protected override int Compare(Drawable x, Drawable y) { - if (!(x is HitObjectMask xMask) || !(y is HitObjectMask yMask)) + if (!(x is SelectionMask xMask) || !(y is SelectionMask yMask)) return base.Compare(x, y); return Compare(xMask, yMask); } - public int Compare(HitObjectMask x, HitObjectMask y) + public int Compare(SelectionMask x, SelectionMask y) { // dpeth is used to denote selected status (we always want selected masks to handle input first). int d = x.Depth.CompareTo(y.Depth); diff --git a/osu.Game/Screens/Edit/Screens/Compose/Layers/MaskSelection.cs b/osu.Game/Screens/Edit/Screens/Compose/Layers/MaskSelection.cs index 635edf82da..1231737122 100644 --- a/osu.Game/Screens/Edit/Screens/Compose/Layers/MaskSelection.cs +++ b/osu.Game/Screens/Edit/Screens/Compose/Layers/MaskSelection.cs @@ -16,19 +16,19 @@ using OpenTK; namespace osu.Game.Screens.Edit.Screens.Compose.Layers { /// - /// A box which surrounds s and provides interactive handles, context menus etc. + /// A box which surrounds s and provides interactive handles, context menus etc. /// public class MaskSelection : CompositeDrawable { public const float BORDER_RADIUS = 2; - private readonly List selectedMasks; + private readonly List selectedMasks; private Drawable outline; public MaskSelection() { - selectedMasks = new List(); + selectedMasks = new List(); RelativeSizeAxes = Axes.Both; AlwaysPresent = true; @@ -54,7 +54,7 @@ namespace osu.Game.Screens.Edit.Screens.Compose.Layers #region User Input Handling - public void HandleDrag(HitObjectMask m, Vector2 delta, InputState state) + public void HandleDrag(SelectionMask m, Vector2 delta, InputState state) { // Todo: Various forms of snapping @@ -82,13 +82,13 @@ namespace osu.Game.Screens.Edit.Screens.Compose.Layers /// Handle a mask becoming selected. /// /// The mask. - public void HandleSelected(HitObjectMask mask) => selectedMasks.Add(mask); + public void HandleSelected(SelectionMask mask) => selectedMasks.Add(mask); /// /// Handle a mask becoming deselected. /// /// The mask. - public void HandleDeselected(HitObjectMask mask) + public void HandleDeselected(SelectionMask mask) { selectedMasks.Remove(mask); @@ -101,7 +101,7 @@ namespace osu.Game.Screens.Edit.Screens.Compose.Layers /// Handle a mask requesting selection. /// /// The mask. - public void HandleSelectionRequested(HitObjectMask mask, InputState state) + public void HandleSelectionRequested(SelectionMask mask, InputState state) { if (state.Keyboard.ControlPressed) { From 677d0d4a19cd5a51db2469018e570bf5f5e599c9 Mon Sep 17 00:00:00 2001 From: smoogipoo Date: Wed, 3 Oct 2018 13:45:41 +0900 Subject: [PATCH 318/417] Renamespace ruleset masks --- osu.Game.Rulesets.Mania/Edit/ManiaHitObjectComposer.cs | 2 +- .../Selection/Overlays => Masks}/HoldNoteSelectionMask.cs | 2 +- .../{Layers/Selection/Overlays => Masks}/NoteSelectionMask.cs | 2 +- .../Selection/Overlays => Masks}/HitCircleSelectionMask.cs | 4 ++-- .../Selection/Overlays => Masks}/SliderCircleSelectionMask.cs | 2 +- .../Selection/Overlays => Masks}/SliderSelectionMask.cs | 2 +- osu.Game.Rulesets.Osu/Edit/OsuHitObjectComposer.cs | 2 +- 7 files changed, 8 insertions(+), 8 deletions(-) rename osu.Game.Rulesets.Mania/Edit/{Layers/Selection/Overlays => Masks}/HoldNoteSelectionMask.cs (97%) rename osu.Game.Rulesets.Mania/Edit/{Layers/Selection/Overlays => Masks}/NoteSelectionMask.cs (93%) rename osu.Game.Rulesets.Osu/Edit/{Layers/Selection/Overlays => Masks}/HitCircleSelectionMask.cs (94%) rename osu.Game.Rulesets.Osu/Edit/{Layers/Selection/Overlays => Masks}/SliderCircleSelectionMask.cs (96%) rename osu.Game.Rulesets.Osu/Edit/{Layers/Selection/Overlays => Masks}/SliderSelectionMask.cs (97%) diff --git a/osu.Game.Rulesets.Mania/Edit/ManiaHitObjectComposer.cs b/osu.Game.Rulesets.Mania/Edit/ManiaHitObjectComposer.cs index 7cc473c712..1053e998be 100644 --- a/osu.Game.Rulesets.Mania/Edit/ManiaHitObjectComposer.cs +++ b/osu.Game.Rulesets.Mania/Edit/ManiaHitObjectComposer.cs @@ -4,7 +4,6 @@ using osu.Game.Beatmaps; using osu.Game.Rulesets.Edit; using osu.Game.Rulesets.Edit.Tools; -using osu.Game.Rulesets.Mania.Edit.Layers.Selection.Overlays; using osu.Game.Rulesets.Mania.Objects; using osu.Game.Rulesets.Mania.Objects.Drawables; using osu.Game.Rulesets.Objects.Drawables; @@ -12,6 +11,7 @@ using osu.Game.Rulesets.UI; using System.Collections.Generic; using osu.Framework.Allocation; using osu.Game.Rulesets.Mania.Configuration; +using osu.Game.Rulesets.Mania.Edit.Masks; using osu.Game.Rulesets.Mania.UI; namespace osu.Game.Rulesets.Mania.Edit diff --git a/osu.Game.Rulesets.Mania/Edit/Layers/Selection/Overlays/HoldNoteSelectionMask.cs b/osu.Game.Rulesets.Mania/Edit/Masks/HoldNoteSelectionMask.cs similarity index 97% rename from osu.Game.Rulesets.Mania/Edit/Layers/Selection/Overlays/HoldNoteSelectionMask.cs rename to osu.Game.Rulesets.Mania/Edit/Masks/HoldNoteSelectionMask.cs index b4f62ea170..a2c01d7a0e 100644 --- a/osu.Game.Rulesets.Mania/Edit/Layers/Selection/Overlays/HoldNoteSelectionMask.cs +++ b/osu.Game.Rulesets.Mania/Edit/Masks/HoldNoteSelectionMask.cs @@ -13,7 +13,7 @@ using osu.Game.Rulesets.UI.Scrolling; using OpenTK; using OpenTK.Graphics; -namespace osu.Game.Rulesets.Mania.Edit.Layers.Selection.Overlays +namespace osu.Game.Rulesets.Mania.Edit.Masks { public class HoldNoteSelectionMask : SelectionMask { diff --git a/osu.Game.Rulesets.Mania/Edit/Layers/Selection/Overlays/NoteSelectionMask.cs b/osu.Game.Rulesets.Mania/Edit/Masks/NoteSelectionMask.cs similarity index 93% rename from osu.Game.Rulesets.Mania/Edit/Layers/Selection/Overlays/NoteSelectionMask.cs rename to osu.Game.Rulesets.Mania/Edit/Masks/NoteSelectionMask.cs index d976386d6e..18f042a483 100644 --- a/osu.Game.Rulesets.Mania/Edit/Layers/Selection/Overlays/NoteSelectionMask.cs +++ b/osu.Game.Rulesets.Mania/Edit/Masks/NoteSelectionMask.cs @@ -7,7 +7,7 @@ using osu.Game.Rulesets.Edit; using osu.Game.Rulesets.Mania.Objects.Drawables; using osu.Game.Rulesets.Mania.Objects.Drawables.Pieces; -namespace osu.Game.Rulesets.Mania.Edit.Layers.Selection.Overlays +namespace osu.Game.Rulesets.Mania.Edit.Masks { public class NoteSelectionMask : SelectionMask { diff --git a/osu.Game.Rulesets.Osu/Edit/Layers/Selection/Overlays/HitCircleSelectionMask.cs b/osu.Game.Rulesets.Osu/Edit/Masks/HitCircleSelectionMask.cs similarity index 94% rename from osu.Game.Rulesets.Osu/Edit/Layers/Selection/Overlays/HitCircleSelectionMask.cs rename to osu.Game.Rulesets.Osu/Edit/Masks/HitCircleSelectionMask.cs index aa8044af15..6c96b40b33 100644 --- a/osu.Game.Rulesets.Osu/Edit/Layers/Selection/Overlays/HitCircleSelectionMask.cs +++ b/osu.Game.Rulesets.Osu/Edit/Masks/HitCircleSelectionMask.cs @@ -1,14 +1,14 @@ // Copyright (c) 2007-2018 ppy Pty Ltd . // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE -using osu.Framework.Graphics; using osu.Framework.Allocation; +using osu.Framework.Graphics; using osu.Game.Graphics; using osu.Game.Rulesets.Edit; using osu.Game.Rulesets.Osu.Objects.Drawables; using osu.Game.Rulesets.Osu.Objects.Drawables.Pieces; -namespace osu.Game.Rulesets.Osu.Edit.Layers.Selection.Overlays +namespace osu.Game.Rulesets.Osu.Edit.Masks { public class HitCircleSelectionMask : SelectionMask { diff --git a/osu.Game.Rulesets.Osu/Edit/Layers/Selection/Overlays/SliderCircleSelectionMask.cs b/osu.Game.Rulesets.Osu/Edit/Masks/SliderCircleSelectionMask.cs similarity index 96% rename from osu.Game.Rulesets.Osu/Edit/Layers/Selection/Overlays/SliderCircleSelectionMask.cs rename to osu.Game.Rulesets.Osu/Edit/Masks/SliderCircleSelectionMask.cs index 4d6a530eda..1ed22c2ac1 100644 --- a/osu.Game.Rulesets.Osu/Edit/Layers/Selection/Overlays/SliderCircleSelectionMask.cs +++ b/osu.Game.Rulesets.Osu/Edit/Masks/SliderCircleSelectionMask.cs @@ -10,7 +10,7 @@ using osu.Game.Rulesets.Osu.Objects.Drawables; using osu.Game.Rulesets.Osu.Objects.Drawables.Pieces; using OpenTK; -namespace osu.Game.Rulesets.Osu.Edit.Layers.Selection.Overlays +namespace osu.Game.Rulesets.Osu.Edit.Masks { public class SliderCircleSelectionMask : SelectionMask { diff --git a/osu.Game.Rulesets.Osu/Edit/Layers/Selection/Overlays/SliderSelectionMask.cs b/osu.Game.Rulesets.Osu/Edit/Masks/SliderSelectionMask.cs similarity index 97% rename from osu.Game.Rulesets.Osu/Edit/Layers/Selection/Overlays/SliderSelectionMask.cs rename to osu.Game.Rulesets.Osu/Edit/Masks/SliderSelectionMask.cs index 40c2026937..b775854038 100644 --- a/osu.Game.Rulesets.Osu/Edit/Layers/Selection/Overlays/SliderSelectionMask.cs +++ b/osu.Game.Rulesets.Osu/Edit/Masks/SliderSelectionMask.cs @@ -12,7 +12,7 @@ using osu.Game.Rulesets.Osu.Objects.Drawables.Pieces; using OpenTK; using OpenTK.Graphics; -namespace osu.Game.Rulesets.Osu.Edit.Layers.Selection.Overlays +namespace osu.Game.Rulesets.Osu.Edit.Masks { public class SliderSelectionMask : SelectionMask { diff --git a/osu.Game.Rulesets.Osu/Edit/OsuHitObjectComposer.cs b/osu.Game.Rulesets.Osu/Edit/OsuHitObjectComposer.cs index 115513b60c..fa49aff650 100644 --- a/osu.Game.Rulesets.Osu/Edit/OsuHitObjectComposer.cs +++ b/osu.Game.Rulesets.Osu/Edit/OsuHitObjectComposer.cs @@ -8,7 +8,7 @@ using osu.Game.Beatmaps; using osu.Game.Rulesets.Edit; using osu.Game.Rulesets.Edit.Tools; using osu.Game.Rulesets.Objects.Drawables; -using osu.Game.Rulesets.Osu.Edit.Layers.Selection.Overlays; +using osu.Game.Rulesets.Osu.Edit.Masks; using osu.Game.Rulesets.Osu.Objects; using osu.Game.Rulesets.Osu.Objects.Drawables; using osu.Game.Rulesets.Osu.UI; From e1db2bbc25d0777a4fab8224b882e65a16dfd4b6 Mon Sep 17 00:00:00 2001 From: smoogipoo Date: Wed, 3 Oct 2018 14:35:26 +0900 Subject: [PATCH 319/417] Split visuals of HitCircleSelectionMask into HitCircleMask --- .../Edit/Masks/HitCircleMask.cs | 35 +++++++++++++++++++ .../Edit/Masks/HitCircleSelectionMask.cs | 18 ++-------- 2 files changed, 38 insertions(+), 15 deletions(-) create mode 100644 osu.Game.Rulesets.Osu/Edit/Masks/HitCircleMask.cs diff --git a/osu.Game.Rulesets.Osu/Edit/Masks/HitCircleMask.cs b/osu.Game.Rulesets.Osu/Edit/Masks/HitCircleMask.cs new file mode 100644 index 0000000000..76f876fb42 --- /dev/null +++ b/osu.Game.Rulesets.Osu/Edit/Masks/HitCircleMask.cs @@ -0,0 +1,35 @@ +// Copyright (c) 2007-2018 ppy Pty Ltd . +// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE + +using osu.Framework.Allocation; +using osu.Framework.Graphics; +using osu.Framework.Graphics.Containers; +using osu.Game.Graphics; +using osu.Game.Rulesets.Osu.Objects; +using osu.Game.Rulesets.Osu.Objects.Drawables.Pieces; +using OpenTK; + +namespace osu.Game.Rulesets.Osu.Edit.Masks +{ + public class HitCircleMask : CompositeDrawable + { + public HitCircleMask(HitCircle hitCircle) + { + Anchor = Anchor.Centre; + Origin = Anchor.Centre; + + Size = new Vector2((float)OsuHitObject.OBJECT_RADIUS * 2); + Scale = new Vector2(hitCircle.Scale); + + CornerRadius = Size.X / 2; + + AddInternal(new RingPiece()); + } + + [BackgroundDependencyLoader] + private void load(OsuColour colours) + { + Colour = colours.Yellow; + } + } +} diff --git a/osu.Game.Rulesets.Osu/Edit/Masks/HitCircleSelectionMask.cs b/osu.Game.Rulesets.Osu/Edit/Masks/HitCircleSelectionMask.cs index 6c96b40b33..b9ca95b837 100644 --- a/osu.Game.Rulesets.Osu/Edit/Masks/HitCircleSelectionMask.cs +++ b/osu.Game.Rulesets.Osu/Edit/Masks/HitCircleSelectionMask.cs @@ -1,12 +1,10 @@ // Copyright (c) 2007-2018 ppy Pty Ltd . // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE -using osu.Framework.Allocation; using osu.Framework.Graphics; -using osu.Game.Graphics; using osu.Game.Rulesets.Edit; +using osu.Game.Rulesets.Osu.Objects; using osu.Game.Rulesets.Osu.Objects.Drawables; -using osu.Game.Rulesets.Osu.Objects.Drawables.Pieces; namespace osu.Game.Rulesets.Osu.Edit.Masks { @@ -16,22 +14,12 @@ namespace osu.Game.Rulesets.Osu.Edit.Masks : base(hitCircle) { Origin = Anchor.Centre; - + AutoSizeAxes = Axes.Both; Position = hitCircle.Position; - Size = hitCircle.Size; - Scale = hitCircle.Scale; - CornerRadius = Size.X / 2; - - AddInternal(new RingPiece()); + InternalChild = new HitCircleMask((HitCircle)hitCircle.HitObject); hitCircle.HitObject.PositionChanged += _ => Position = hitCircle.Position; } - - [BackgroundDependencyLoader] - private void load(OsuColour colours) - { - Colour = colours.Yellow; - } } } From 4051864bb43874d55b14fcaf9349cf9475395c68 Mon Sep 17 00:00:00 2001 From: smoogipoo Date: Fri, 26 Oct 2018 13:39:19 +0900 Subject: [PATCH 320/417] Re-namespace --- .../Masks/{ => HitCircleMasks/Components}/HitCircleMask.cs | 2 +- .../Edit/Masks/{ => HitCircleMasks}/HitCircleSelectionMask.cs | 3 ++- .../Edit/Masks/{ => SliderMasks}/SliderCircleSelectionMask.cs | 2 +- .../Edit/Masks/{ => SliderMasks}/SliderSelectionMask.cs | 2 +- osu.Game.Rulesets.Osu/Edit/OsuHitObjectComposer.cs | 3 ++- 5 files changed, 7 insertions(+), 5 deletions(-) rename osu.Game.Rulesets.Osu/Edit/Masks/{ => HitCircleMasks/Components}/HitCircleMask.cs (93%) rename osu.Game.Rulesets.Osu/Edit/Masks/{ => HitCircleMasks}/HitCircleSelectionMask.cs (86%) rename osu.Game.Rulesets.Osu/Edit/Masks/{ => SliderMasks}/SliderCircleSelectionMask.cs (97%) rename osu.Game.Rulesets.Osu/Edit/Masks/{ => SliderMasks}/SliderSelectionMask.cs (97%) diff --git a/osu.Game.Rulesets.Osu/Edit/Masks/HitCircleMask.cs b/osu.Game.Rulesets.Osu/Edit/Masks/HitCircleMasks/Components/HitCircleMask.cs similarity index 93% rename from osu.Game.Rulesets.Osu/Edit/Masks/HitCircleMask.cs rename to osu.Game.Rulesets.Osu/Edit/Masks/HitCircleMasks/Components/HitCircleMask.cs index 76f876fb42..65d9654181 100644 --- a/osu.Game.Rulesets.Osu/Edit/Masks/HitCircleMask.cs +++ b/osu.Game.Rulesets.Osu/Edit/Masks/HitCircleMasks/Components/HitCircleMask.cs @@ -9,7 +9,7 @@ using osu.Game.Rulesets.Osu.Objects; using osu.Game.Rulesets.Osu.Objects.Drawables.Pieces; using OpenTK; -namespace osu.Game.Rulesets.Osu.Edit.Masks +namespace osu.Game.Rulesets.Osu.Edit.Masks.HitCircleMasks.Components { public class HitCircleMask : CompositeDrawable { diff --git a/osu.Game.Rulesets.Osu/Edit/Masks/HitCircleSelectionMask.cs b/osu.Game.Rulesets.Osu/Edit/Masks/HitCircleMasks/HitCircleSelectionMask.cs similarity index 86% rename from osu.Game.Rulesets.Osu/Edit/Masks/HitCircleSelectionMask.cs rename to osu.Game.Rulesets.Osu/Edit/Masks/HitCircleMasks/HitCircleSelectionMask.cs index b9ca95b837..c76d1411ef 100644 --- a/osu.Game.Rulesets.Osu/Edit/Masks/HitCircleSelectionMask.cs +++ b/osu.Game.Rulesets.Osu/Edit/Masks/HitCircleMasks/HitCircleSelectionMask.cs @@ -3,10 +3,11 @@ using osu.Framework.Graphics; using osu.Game.Rulesets.Edit; +using osu.Game.Rulesets.Osu.Edit.Masks.HitCircleMasks.Components; using osu.Game.Rulesets.Osu.Objects; using osu.Game.Rulesets.Osu.Objects.Drawables; -namespace osu.Game.Rulesets.Osu.Edit.Masks +namespace osu.Game.Rulesets.Osu.Edit.Masks.HitCircleMasks { public class HitCircleSelectionMask : SelectionMask { diff --git a/osu.Game.Rulesets.Osu/Edit/Masks/SliderCircleSelectionMask.cs b/osu.Game.Rulesets.Osu/Edit/Masks/SliderMasks/SliderCircleSelectionMask.cs similarity index 97% rename from osu.Game.Rulesets.Osu/Edit/Masks/SliderCircleSelectionMask.cs rename to osu.Game.Rulesets.Osu/Edit/Masks/SliderMasks/SliderCircleSelectionMask.cs index 1ed22c2ac1..5513e1fd84 100644 --- a/osu.Game.Rulesets.Osu/Edit/Masks/SliderCircleSelectionMask.cs +++ b/osu.Game.Rulesets.Osu/Edit/Masks/SliderMasks/SliderCircleSelectionMask.cs @@ -10,7 +10,7 @@ using osu.Game.Rulesets.Osu.Objects.Drawables; using osu.Game.Rulesets.Osu.Objects.Drawables.Pieces; using OpenTK; -namespace osu.Game.Rulesets.Osu.Edit.Masks +namespace osu.Game.Rulesets.Osu.Edit.Masks.SliderMasks { public class SliderCircleSelectionMask : SelectionMask { diff --git a/osu.Game.Rulesets.Osu/Edit/Masks/SliderSelectionMask.cs b/osu.Game.Rulesets.Osu/Edit/Masks/SliderMasks/SliderSelectionMask.cs similarity index 97% rename from osu.Game.Rulesets.Osu/Edit/Masks/SliderSelectionMask.cs rename to osu.Game.Rulesets.Osu/Edit/Masks/SliderMasks/SliderSelectionMask.cs index b775854038..0ff67a0777 100644 --- a/osu.Game.Rulesets.Osu/Edit/Masks/SliderSelectionMask.cs +++ b/osu.Game.Rulesets.Osu/Edit/Masks/SliderMasks/SliderSelectionMask.cs @@ -12,7 +12,7 @@ using osu.Game.Rulesets.Osu.Objects.Drawables.Pieces; using OpenTK; using OpenTK.Graphics; -namespace osu.Game.Rulesets.Osu.Edit.Masks +namespace osu.Game.Rulesets.Osu.Edit.Masks.SliderMasks { public class SliderSelectionMask : SelectionMask { diff --git a/osu.Game.Rulesets.Osu/Edit/OsuHitObjectComposer.cs b/osu.Game.Rulesets.Osu/Edit/OsuHitObjectComposer.cs index fa49aff650..8314be45e0 100644 --- a/osu.Game.Rulesets.Osu/Edit/OsuHitObjectComposer.cs +++ b/osu.Game.Rulesets.Osu/Edit/OsuHitObjectComposer.cs @@ -8,7 +8,8 @@ using osu.Game.Beatmaps; using osu.Game.Rulesets.Edit; using osu.Game.Rulesets.Edit.Tools; using osu.Game.Rulesets.Objects.Drawables; -using osu.Game.Rulesets.Osu.Edit.Masks; +using osu.Game.Rulesets.Osu.Edit.Masks.HitCircleMasks; +using osu.Game.Rulesets.Osu.Edit.Masks.SliderMasks; using osu.Game.Rulesets.Osu.Objects; using osu.Game.Rulesets.Osu.Objects.Drawables; using osu.Game.Rulesets.Osu.UI; From 9656186b64f831377f1ec4e5d1c545eb7d84b561 Mon Sep 17 00:00:00 2001 From: smoogipoo Date: Thu, 25 Oct 2018 18:16:25 +0900 Subject: [PATCH 321/417] Make the hitobject masks move within their placement/selection # Conflicts: # osu.Game.Rulesets.Osu/Edit/Masks/HitCircleMasks/Components/HitCircleMask.cs # osu.Game.Rulesets.Osu/Edit/Masks/HitCircleMasks/HitCircleSelectionMask.cs # osu.Game.Rulesets.Osu/Edit/Masks/HitCirclePlacementMask.cs # osu.Game/Rulesets/Edit/PlacementMask.cs --- .../Components/HitCircleMask.cs | 13 +++-- .../HitCircleMasks/HitCircleSelectionMask.cs | 7 --- .../SliderMasks/Components/SliderBodyMask.cs | 51 +++++++++++++++++++ .../Components/SliderCircleMask.cs | 34 +++++++++++++ .../SliderMasks/SliderCircleSelectionMask.cs | 43 ++-------------- .../Edit/Masks/SliderMasks/SliderPosition.cs | 11 ++++ .../Masks/SliderMasks/SliderSelectionMask.cs | 47 +++-------------- osu.Game.Rulesets.Osu/Objects/OsuHitObject.cs | 2 +- osu.Game.Rulesets.Osu/Objects/Slider.cs | 15 ++++++ osu.Game/Rulesets/Edit/SelectionMask.cs | 9 +++- 10 files changed, 138 insertions(+), 94 deletions(-) create mode 100644 osu.Game.Rulesets.Osu/Edit/Masks/SliderMasks/Components/SliderBodyMask.cs create mode 100644 osu.Game.Rulesets.Osu/Edit/Masks/SliderMasks/Components/SliderCircleMask.cs create mode 100644 osu.Game.Rulesets.Osu/Edit/Masks/SliderMasks/SliderPosition.cs diff --git a/osu.Game.Rulesets.Osu/Edit/Masks/HitCircleMasks/Components/HitCircleMask.cs b/osu.Game.Rulesets.Osu/Edit/Masks/HitCircleMasks/Components/HitCircleMask.cs index 65d9654181..713dedb84f 100644 --- a/osu.Game.Rulesets.Osu/Edit/Masks/HitCircleMasks/Components/HitCircleMask.cs +++ b/osu.Game.Rulesets.Osu/Edit/Masks/HitCircleMasks/Components/HitCircleMask.cs @@ -13,23 +13,30 @@ namespace osu.Game.Rulesets.Osu.Edit.Masks.HitCircleMasks.Components { public class HitCircleMask : CompositeDrawable { + private readonly HitCircle hitCircle; + public HitCircleMask(HitCircle hitCircle) { - Anchor = Anchor.Centre; + this.hitCircle = hitCircle; Origin = Anchor.Centre; Size = new Vector2((float)OsuHitObject.OBJECT_RADIUS * 2); Scale = new Vector2(hitCircle.Scale); - CornerRadius = Size.X / 2; - AddInternal(new RingPiece()); + InternalChild = new RingPiece(); + + hitCircle.PositionChanged += _ => UpdatePosition(); } [BackgroundDependencyLoader] private void load(OsuColour colours) { Colour = colours.Yellow; + + UpdatePosition(); } + + protected virtual void UpdatePosition() => Position = hitCircle.StackedPosition; } } diff --git a/osu.Game.Rulesets.Osu/Edit/Masks/HitCircleMasks/HitCircleSelectionMask.cs b/osu.Game.Rulesets.Osu/Edit/Masks/HitCircleMasks/HitCircleSelectionMask.cs index c76d1411ef..f49f2fc137 100644 --- a/osu.Game.Rulesets.Osu/Edit/Masks/HitCircleMasks/HitCircleSelectionMask.cs +++ b/osu.Game.Rulesets.Osu/Edit/Masks/HitCircleMasks/HitCircleSelectionMask.cs @@ -1,7 +1,6 @@ // Copyright (c) 2007-2018 ppy Pty Ltd . // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE -using osu.Framework.Graphics; using osu.Game.Rulesets.Edit; using osu.Game.Rulesets.Osu.Edit.Masks.HitCircleMasks.Components; using osu.Game.Rulesets.Osu.Objects; @@ -14,13 +13,7 @@ namespace osu.Game.Rulesets.Osu.Edit.Masks.HitCircleMasks public HitCircleSelectionMask(DrawableHitCircle hitCircle) : base(hitCircle) { - Origin = Anchor.Centre; - AutoSizeAxes = Axes.Both; - Position = hitCircle.Position; - InternalChild = new HitCircleMask((HitCircle)hitCircle.HitObject); - - hitCircle.HitObject.PositionChanged += _ => Position = hitCircle.Position; } } } diff --git a/osu.Game.Rulesets.Osu/Edit/Masks/SliderMasks/Components/SliderBodyMask.cs b/osu.Game.Rulesets.Osu/Edit/Masks/SliderMasks/Components/SliderBodyMask.cs new file mode 100644 index 0000000000..a0f8a5be7b --- /dev/null +++ b/osu.Game.Rulesets.Osu/Edit/Masks/SliderMasks/Components/SliderBodyMask.cs @@ -0,0 +1,51 @@ +// Copyright (c) 2007-2018 ppy Pty Ltd . +// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE + +using osu.Framework.Allocation; +using osu.Framework.Graphics.Containers; +using osu.Game.Graphics; +using osu.Game.Rulesets.Osu.Objects; +using osu.Game.Rulesets.Osu.Objects.Drawables.Pieces; +using OpenTK.Graphics; + +namespace osu.Game.Rulesets.Osu.Edit.Masks.SliderMasks.Components +{ + public class SliderBodyMask : CompositeDrawable + { + private readonly Slider slider; + private readonly SliderBody body; + + public SliderBodyMask(Slider slider) + { + this.slider = slider; + InternalChild = body = new SliderBody(slider) + { + AccentColour = Color4.Transparent, + PathWidth = slider.Scale * 64 + }; + + slider.PositionChanged += _ => updatePosition(); + } + + [BackgroundDependencyLoader] + private void load(OsuColour colours) + { + body.BorderColour = colours.Yellow; + + updatePosition(); + } + + private void updatePosition() => Position = slider.StackedPosition; + + protected override void Update() + { + base.Update(); + + Size = body.Size; + OriginPosition = body.PathOffset; + + // Need to cause one update + body.UpdateProgress(0); + } + } +} diff --git a/osu.Game.Rulesets.Osu/Edit/Masks/SliderMasks/Components/SliderCircleMask.cs b/osu.Game.Rulesets.Osu/Edit/Masks/SliderMasks/Components/SliderCircleMask.cs new file mode 100644 index 0000000000..3595d01582 --- /dev/null +++ b/osu.Game.Rulesets.Osu/Edit/Masks/SliderMasks/Components/SliderCircleMask.cs @@ -0,0 +1,34 @@ +// Copyright (c) 2007-2018 ppy Pty Ltd . +// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE + +using osu.Game.Rulesets.Osu.Edit.Masks.HitCircleMasks.Components; +using osu.Game.Rulesets.Osu.Objects; + +namespace osu.Game.Rulesets.Osu.Edit.Masks.SliderMasks.Components +{ + public class SliderCircleMask : HitCircleMask + { + private readonly Slider slider; + private readonly SliderPosition position; + + public SliderCircleMask(Slider slider, SliderPosition position) + : base(slider.HeadCircle) + { + this.slider = slider; + this.position = position; + } + + protected override void UpdatePosition() + { + switch (position) + { + case SliderPosition.Start: + Position = slider.StackedPosition + slider.Curve.PositionAt(0); + break; + case SliderPosition.End: + Position = slider.StackedPosition + slider.Curve.PositionAt(1); + break; + } + } + } +} diff --git a/osu.Game.Rulesets.Osu/Edit/Masks/SliderMasks/SliderCircleSelectionMask.cs b/osu.Game.Rulesets.Osu/Edit/Masks/SliderMasks/SliderCircleSelectionMask.cs index 5513e1fd84..7a4d3ab5db 100644 --- a/osu.Game.Rulesets.Osu/Edit/Masks/SliderMasks/SliderCircleSelectionMask.cs +++ b/osu.Game.Rulesets.Osu/Edit/Masks/SliderMasks/SliderCircleSelectionMask.cs @@ -1,60 +1,23 @@ // Copyright (c) 2007-2018 ppy Pty Ltd . // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE -using osu.Framework.Allocation; -using osu.Framework.Graphics; -using osu.Game.Graphics; using osu.Game.Rulesets.Edit; +using osu.Game.Rulesets.Osu.Edit.Masks.SliderMasks.Components; using osu.Game.Rulesets.Osu.Objects; using osu.Game.Rulesets.Osu.Objects.Drawables; -using osu.Game.Rulesets.Osu.Objects.Drawables.Pieces; -using OpenTK; namespace osu.Game.Rulesets.Osu.Edit.Masks.SliderMasks { public class SliderCircleSelectionMask : SelectionMask { - public SliderCircleSelectionMask(DrawableHitCircle sliderHead, DrawableSlider slider) - : this(sliderHead, Vector2.Zero, slider) - { - } - - public SliderCircleSelectionMask(DrawableSliderTail sliderTail, DrawableSlider slider) - : this(sliderTail, ((Slider)slider.HitObject).Curve.PositionAt(1), slider) - { - } - - private readonly DrawableOsuHitObject hitObject; - - private SliderCircleSelectionMask(DrawableOsuHitObject hitObject, Vector2 position, DrawableSlider slider) + public SliderCircleSelectionMask(DrawableOsuHitObject hitObject, Slider slider, SliderPosition position) : base(hitObject) { - this.hitObject = hitObject; - - Origin = Anchor.Centre; - - Position = position; - Size = slider.HeadCircle.Size; - Scale = slider.HeadCircle.Scale; - - AddInternal(new RingPiece()); + InternalChild = new SliderCircleMask(slider, position); Select(); } - [BackgroundDependencyLoader] - private void load(OsuColour colours) - { - Colour = colours.Yellow; - } - - protected override void Update() - { - base.Update(); - - RelativeAnchorPosition = hitObject.RelativeAnchorPosition; - } - // Todo: This is temporary, since the slider circle masks don't do anything special yet. In the future they will handle input. public override bool HandlePositionalInput => false; } diff --git a/osu.Game.Rulesets.Osu/Edit/Masks/SliderMasks/SliderPosition.cs b/osu.Game.Rulesets.Osu/Edit/Masks/SliderMasks/SliderPosition.cs new file mode 100644 index 0000000000..01c1871131 --- /dev/null +++ b/osu.Game.Rulesets.Osu/Edit/Masks/SliderMasks/SliderPosition.cs @@ -0,0 +1,11 @@ +// Copyright (c) 2007-2018 ppy Pty Ltd . +// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE + +namespace osu.Game.Rulesets.Osu.Edit.Masks.SliderMasks +{ + public enum SliderPosition + { + Start, + End + } +} diff --git a/osu.Game.Rulesets.Osu/Edit/Masks/SliderMasks/SliderSelectionMask.cs b/osu.Game.Rulesets.Osu/Edit/Masks/SliderMasks/SliderSelectionMask.cs index 0ff67a0777..5ba264f2cb 100644 --- a/osu.Game.Rulesets.Osu/Edit/Masks/SliderMasks/SliderSelectionMask.cs +++ b/osu.Game.Rulesets.Osu/Edit/Masks/SliderMasks/SliderSelectionMask.cs @@ -1,67 +1,32 @@ // Copyright (c) 2007-2018 ppy Pty Ltd . // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE -using osu.Framework.Allocation; using osu.Framework.Graphics; -using osu.Framework.Graphics.Primitives; -using osu.Game.Graphics; using osu.Game.Rulesets.Edit; +using osu.Game.Rulesets.Osu.Edit.Masks.SliderMasks.Components; using osu.Game.Rulesets.Osu.Objects; using osu.Game.Rulesets.Osu.Objects.Drawables; -using osu.Game.Rulesets.Osu.Objects.Drawables.Pieces; using OpenTK; -using OpenTK.Graphics; namespace osu.Game.Rulesets.Osu.Edit.Masks.SliderMasks { public class SliderSelectionMask : SelectionMask { - private readonly SliderBody body; - private readonly DrawableSlider slider; + private readonly SliderCircleSelectionMask headMask; public SliderSelectionMask(DrawableSlider slider) : base(slider) { - this.slider = slider; - - Position = slider.Position; - var sliderObject = (Slider)slider.HitObject; InternalChildren = new Drawable[] { - body = new SliderBody(sliderObject) - { - AccentColour = Color4.Transparent, - PathWidth = sliderObject.Scale * 64 - }, - new SliderCircleSelectionMask(slider.HeadCircle, slider), - new SliderCircleSelectionMask(slider.TailCircle, slider), + new SliderBodyMask(sliderObject), + headMask = new SliderCircleSelectionMask(slider.HeadCircle, sliderObject, SliderPosition.Start), + new SliderCircleSelectionMask(slider.TailCircle, sliderObject, SliderPosition.End), }; - - sliderObject.PositionChanged += _ => Position = slider.Position; } - [BackgroundDependencyLoader] - private void load(OsuColour colours) - { - body.BorderColour = colours.Yellow; - } - - protected override void Update() - { - base.Update(); - - Size = slider.Size; - OriginPosition = slider.OriginPosition; - - // Need to cause one update - body.UpdateProgress(0); - } - - public override bool ReceivePositionalInputAt(Vector2 screenSpacePos) => body.ReceivePositionalInputAt(screenSpacePos); - - public override Vector2 SelectionPoint => ToScreenSpace(OriginPosition); - public override Quad SelectionQuad => body.PathDrawQuad; + public override Vector2 SelectionPoint => headMask.SelectionPoint; } } diff --git a/osu.Game.Rulesets.Osu/Objects/OsuHitObject.cs b/osu.Game.Rulesets.Osu/Objects/OsuHitObject.cs index fdf5aaffa8..9ababead13 100644 --- a/osu.Game.Rulesets.Osu/Objects/OsuHitObject.cs +++ b/osu.Game.Rulesets.Osu/Objects/OsuHitObject.cs @@ -22,7 +22,7 @@ namespace osu.Game.Rulesets.Osu.Objects private Vector2 position; - public Vector2 Position + public virtual Vector2 Position { get => position; set diff --git a/osu.Game.Rulesets.Osu/Objects/Slider.cs b/osu.Game.Rulesets.Osu/Objects/Slider.cs index 80be192b77..a6f5bdb24e 100644 --- a/osu.Game.Rulesets.Osu/Objects/Slider.cs +++ b/osu.Game.Rulesets.Osu/Objects/Slider.cs @@ -70,6 +70,21 @@ namespace osu.Game.Rulesets.Osu.Objects set { Curve.Distance = value; } } + public override Vector2 Position + { + get => base.Position; + set + { + base.Position = value; + + if (HeadCircle != null) + HeadCircle.Position = value; + + if (TailCircle != null) + TailCircle.Position = EndPosition; + } + } + public double? LegacyLastTickOffset { get; set; } /// diff --git a/osu.Game/Rulesets/Edit/SelectionMask.cs b/osu.Game/Rulesets/Edit/SelectionMask.cs index 9582c30457..3b78d5aaf6 100644 --- a/osu.Game/Rulesets/Edit/SelectionMask.cs +++ b/osu.Game/Rulesets/Edit/SelectionMask.cs @@ -3,6 +3,7 @@ using System; using osu.Framework; +using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Primitives; using osu.Framework.Input.Events; @@ -52,6 +53,8 @@ namespace osu.Game.Rulesets.Edit { HitObject = hitObject; + RelativeSizeAxes = Axes.Both; + AlwaysPresent = true; Alpha = 0; } @@ -94,6 +97,8 @@ namespace osu.Game.Rulesets.Edit public bool IsSelected => State == SelectionState.Selected; + public override bool ReceivePositionalInputAt(Vector2 screenSpacePos) => HitObject.ReceivePositionalInputAt(screenSpacePos); + private bool selectionRequested; protected override bool OnMouseDown(MouseDownEvent e) @@ -132,11 +137,11 @@ namespace osu.Game.Rulesets.Edit /// /// The screen-space point that causes this to be selected. /// - public virtual Vector2 SelectionPoint => ScreenSpaceDrawQuad.Centre; + public virtual Vector2 SelectionPoint => HitObject.ScreenSpaceDrawQuad.Centre; /// /// The screen-space quad that outlines this for selections. /// - public virtual Quad SelectionQuad => ScreenSpaceDrawQuad; + public virtual Quad SelectionQuad => HitObject.ScreenSpaceDrawQuad; } } From ea3c960b5b9f2039a842965476c4e545e8445017 Mon Sep 17 00:00:00 2001 From: smoogipoo Date: Fri, 26 Oct 2018 13:51:03 +0900 Subject: [PATCH 322/417] Mask -> Piece for components --- .../Components/{HitCircleMask.cs => HitCirclePiece.cs} | 4 ++-- .../Edit/Masks/HitCircleMasks/HitCircleSelectionMask.cs | 2 +- .../Components/{SliderBodyMask.cs => SliderBodyPiece.cs} | 4 ++-- .../Components/{SliderCircleMask.cs => SliderCirclePiece.cs} | 4 ++-- .../Edit/Masks/SliderMasks/SliderCircleSelectionMask.cs | 2 +- .../Edit/Masks/SliderMasks/SliderSelectionMask.cs | 2 +- 6 files changed, 9 insertions(+), 9 deletions(-) rename osu.Game.Rulesets.Osu/Edit/Masks/HitCircleMasks/Components/{HitCircleMask.cs => HitCirclePiece.cs} (91%) rename osu.Game.Rulesets.Osu/Edit/Masks/SliderMasks/Components/{SliderBodyMask.cs => SliderBodyPiece.cs} (93%) rename osu.Game.Rulesets.Osu/Edit/Masks/SliderMasks/Components/{SliderCircleMask.cs => SliderCirclePiece.cs} (88%) diff --git a/osu.Game.Rulesets.Osu/Edit/Masks/HitCircleMasks/Components/HitCircleMask.cs b/osu.Game.Rulesets.Osu/Edit/Masks/HitCircleMasks/Components/HitCirclePiece.cs similarity index 91% rename from osu.Game.Rulesets.Osu/Edit/Masks/HitCircleMasks/Components/HitCircleMask.cs rename to osu.Game.Rulesets.Osu/Edit/Masks/HitCircleMasks/Components/HitCirclePiece.cs index 713dedb84f..0450db5c13 100644 --- a/osu.Game.Rulesets.Osu/Edit/Masks/HitCircleMasks/Components/HitCircleMask.cs +++ b/osu.Game.Rulesets.Osu/Edit/Masks/HitCircleMasks/Components/HitCirclePiece.cs @@ -11,11 +11,11 @@ using OpenTK; namespace osu.Game.Rulesets.Osu.Edit.Masks.HitCircleMasks.Components { - public class HitCircleMask : CompositeDrawable + public class HitCirclePiece : CompositeDrawable { private readonly HitCircle hitCircle; - public HitCircleMask(HitCircle hitCircle) + public HitCirclePiece(HitCircle hitCircle) { this.hitCircle = hitCircle; Origin = Anchor.Centre; diff --git a/osu.Game.Rulesets.Osu/Edit/Masks/HitCircleMasks/HitCircleSelectionMask.cs b/osu.Game.Rulesets.Osu/Edit/Masks/HitCircleMasks/HitCircleSelectionMask.cs index f49f2fc137..da46da92a5 100644 --- a/osu.Game.Rulesets.Osu/Edit/Masks/HitCircleMasks/HitCircleSelectionMask.cs +++ b/osu.Game.Rulesets.Osu/Edit/Masks/HitCircleMasks/HitCircleSelectionMask.cs @@ -13,7 +13,7 @@ namespace osu.Game.Rulesets.Osu.Edit.Masks.HitCircleMasks public HitCircleSelectionMask(DrawableHitCircle hitCircle) : base(hitCircle) { - InternalChild = new HitCircleMask((HitCircle)hitCircle.HitObject); + InternalChild = new HitCirclePiece((HitCircle)hitCircle.HitObject); } } } diff --git a/osu.Game.Rulesets.Osu/Edit/Masks/SliderMasks/Components/SliderBodyMask.cs b/osu.Game.Rulesets.Osu/Edit/Masks/SliderMasks/Components/SliderBodyPiece.cs similarity index 93% rename from osu.Game.Rulesets.Osu/Edit/Masks/SliderMasks/Components/SliderBodyMask.cs rename to osu.Game.Rulesets.Osu/Edit/Masks/SliderMasks/Components/SliderBodyPiece.cs index a0f8a5be7b..0595b046d1 100644 --- a/osu.Game.Rulesets.Osu/Edit/Masks/SliderMasks/Components/SliderBodyMask.cs +++ b/osu.Game.Rulesets.Osu/Edit/Masks/SliderMasks/Components/SliderBodyPiece.cs @@ -10,12 +10,12 @@ using OpenTK.Graphics; namespace osu.Game.Rulesets.Osu.Edit.Masks.SliderMasks.Components { - public class SliderBodyMask : CompositeDrawable + public class SliderBodyPiece : CompositeDrawable { private readonly Slider slider; private readonly SliderBody body; - public SliderBodyMask(Slider slider) + public SliderBodyPiece(Slider slider) { this.slider = slider; InternalChild = body = new SliderBody(slider) diff --git a/osu.Game.Rulesets.Osu/Edit/Masks/SliderMasks/Components/SliderCircleMask.cs b/osu.Game.Rulesets.Osu/Edit/Masks/SliderMasks/Components/SliderCirclePiece.cs similarity index 88% rename from osu.Game.Rulesets.Osu/Edit/Masks/SliderMasks/Components/SliderCircleMask.cs rename to osu.Game.Rulesets.Osu/Edit/Masks/SliderMasks/Components/SliderCirclePiece.cs index 3595d01582..c5ecde5c4c 100644 --- a/osu.Game.Rulesets.Osu/Edit/Masks/SliderMasks/Components/SliderCircleMask.cs +++ b/osu.Game.Rulesets.Osu/Edit/Masks/SliderMasks/Components/SliderCirclePiece.cs @@ -6,12 +6,12 @@ using osu.Game.Rulesets.Osu.Objects; namespace osu.Game.Rulesets.Osu.Edit.Masks.SliderMasks.Components { - public class SliderCircleMask : HitCircleMask + public class SliderCirclePiece : HitCirclePiece { private readonly Slider slider; private readonly SliderPosition position; - public SliderCircleMask(Slider slider, SliderPosition position) + public SliderCirclePiece(Slider slider, SliderPosition position) : base(slider.HeadCircle) { this.slider = slider; diff --git a/osu.Game.Rulesets.Osu/Edit/Masks/SliderMasks/SliderCircleSelectionMask.cs b/osu.Game.Rulesets.Osu/Edit/Masks/SliderMasks/SliderCircleSelectionMask.cs index 7a4d3ab5db..a1b3fd545c 100644 --- a/osu.Game.Rulesets.Osu/Edit/Masks/SliderMasks/SliderCircleSelectionMask.cs +++ b/osu.Game.Rulesets.Osu/Edit/Masks/SliderMasks/SliderCircleSelectionMask.cs @@ -13,7 +13,7 @@ namespace osu.Game.Rulesets.Osu.Edit.Masks.SliderMasks public SliderCircleSelectionMask(DrawableOsuHitObject hitObject, Slider slider, SliderPosition position) : base(hitObject) { - InternalChild = new SliderCircleMask(slider, position); + InternalChild = new SliderCirclePiece(slider, position); Select(); } diff --git a/osu.Game.Rulesets.Osu/Edit/Masks/SliderMasks/SliderSelectionMask.cs b/osu.Game.Rulesets.Osu/Edit/Masks/SliderMasks/SliderSelectionMask.cs index 5ba264f2cb..a411064f68 100644 --- a/osu.Game.Rulesets.Osu/Edit/Masks/SliderMasks/SliderSelectionMask.cs +++ b/osu.Game.Rulesets.Osu/Edit/Masks/SliderMasks/SliderSelectionMask.cs @@ -21,7 +21,7 @@ namespace osu.Game.Rulesets.Osu.Edit.Masks.SliderMasks InternalChildren = new Drawable[] { - new SliderBodyMask(sliderObject), + new SliderBodyPiece(sliderObject), headMask = new SliderCircleSelectionMask(slider.HeadCircle, sliderObject, SliderPosition.Start), new SliderCircleSelectionMask(slider.TailCircle, sliderObject, SliderPosition.End), }; From ce9b400c4c70c0fc30f16ef4418af63a915adcca Mon Sep 17 00:00:00 2001 From: smoogipoo Date: Thu, 25 Oct 2018 18:48:11 +0900 Subject: [PATCH 323/417] Add selection mask test cases --- .../TestCaseHitCircleSelectionMask.cs | 29 ++++++++++++ .../TestCaseSliderSelectionMask.cs | 42 +++++++++++++++++ .../Visual/HitObjectSelectionMaskTestCase.cs | 47 +++++++++++++++++++ 3 files changed, 118 insertions(+) create mode 100644 osu.Game.Rulesets.Osu.Tests/TestCaseHitCircleSelectionMask.cs create mode 100644 osu.Game.Rulesets.Osu.Tests/TestCaseSliderSelectionMask.cs create mode 100644 osu.Game/Tests/Visual/HitObjectSelectionMaskTestCase.cs diff --git a/osu.Game.Rulesets.Osu.Tests/TestCaseHitCircleSelectionMask.cs b/osu.Game.Rulesets.Osu.Tests/TestCaseHitCircleSelectionMask.cs new file mode 100644 index 0000000000..e3d61623bf --- /dev/null +++ b/osu.Game.Rulesets.Osu.Tests/TestCaseHitCircleSelectionMask.cs @@ -0,0 +1,29 @@ +// Copyright (c) 2007-2018 ppy Pty Ltd . +// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE + +using osu.Game.Beatmaps; +using osu.Game.Beatmaps.ControlPoints; +using osu.Game.Rulesets.Edit; +using osu.Game.Rulesets.Osu.Edit.Masks.HitCircleMasks; +using osu.Game.Rulesets.Osu.Objects; +using osu.Game.Rulesets.Osu.Objects.Drawables; +using osu.Game.Tests.Visual; +using OpenTK; + +namespace osu.Game.Rulesets.Osu.Tests +{ + public class TestCaseHitCircleSelectionMask : HitObjectSelectionMaskTestCase + { + private readonly DrawableHitCircle drawableObject; + + public TestCaseHitCircleSelectionMask() + { + var hitCircle = new HitCircle { Position = new Vector2(256, 192) }; + hitCircle.ApplyDefaults(new ControlPointInfo(), new BeatmapDifficulty { CircleSize = 2 }); + + Add(drawableObject = new DrawableHitCircle(hitCircle)); + } + + protected override SelectionMask CreateMask() => new HitCircleSelectionMask(drawableObject); + } +} diff --git a/osu.Game.Rulesets.Osu.Tests/TestCaseSliderSelectionMask.cs b/osu.Game.Rulesets.Osu.Tests/TestCaseSliderSelectionMask.cs new file mode 100644 index 0000000000..5e68d5cdc9 --- /dev/null +++ b/osu.Game.Rulesets.Osu.Tests/TestCaseSliderSelectionMask.cs @@ -0,0 +1,42 @@ +// Copyright (c) 2007-2018 ppy Pty Ltd . +// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE + +using osu.Game.Beatmaps; +using osu.Game.Beatmaps.ControlPoints; +using osu.Game.Rulesets.Edit; +using osu.Game.Rulesets.Objects.Types; +using osu.Game.Rulesets.Osu.Edit.Masks.SliderMasks; +using osu.Game.Rulesets.Osu.Objects; +using osu.Game.Rulesets.Osu.Objects.Drawables; +using osu.Game.Tests.Visual; +using OpenTK; + +namespace osu.Game.Rulesets.Osu.Tests +{ + public class TestCaseSliderSelectionMask : HitObjectSelectionMaskTestCase + { + private readonly DrawableSlider drawableObject; + + public TestCaseSliderSelectionMask() + { + var slider = new Slider + { + Position = new Vector2(256, 192), + ControlPoints = new[] + { + Vector2.Zero, + new Vector2(150, 150), + new Vector2(300, 0) + }, + CurveType = CurveType.Bezier, + Distance = 350 + }; + + slider.ApplyDefaults(new ControlPointInfo(), new BeatmapDifficulty { CircleSize = 2 }); + + Add(drawableObject = new DrawableSlider(slider)); + } + + protected override SelectionMask CreateMask() => new SliderSelectionMask(drawableObject); + } +} diff --git a/osu.Game/Tests/Visual/HitObjectSelectionMaskTestCase.cs b/osu.Game/Tests/Visual/HitObjectSelectionMaskTestCase.cs new file mode 100644 index 0000000000..3ba6841280 --- /dev/null +++ b/osu.Game/Tests/Visual/HitObjectSelectionMaskTestCase.cs @@ -0,0 +1,47 @@ +// Copyright (c) 2007-2018 ppy Pty Ltd . +// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE + +using osu.Framework.Allocation; +using osu.Framework.Graphics; +using osu.Framework.Graphics.Containers; +using osu.Framework.Input.Events; +using osu.Framework.Timing; +using osu.Game.Rulesets.Edit; + +namespace osu.Game.Tests.Visual +{ + public abstract class HitObjectSelectionMaskTestCase : OsuTestCase + { + private SelectionMask mask; + + protected override Container Content => content ?? base.Content; + private readonly Container content; + + protected HitObjectSelectionMaskTestCase() + { + base.Content.Add(content = new Container + { + Clock = new FramedClock(new StopwatchClock()), + RelativeSizeAxes = Axes.Both + }); + } + + [BackgroundDependencyLoader] + private void load() + { + base.Content.Add(mask = CreateMask()); + mask.SelectionRequested += (_, __) => mask.Select(); + + AddStep("Select", () => mask.Select()); + AddStep("Deselect", () => mask.Deselect()); + } + + protected override bool OnClick(ClickEvent e) + { + mask.Deselect(); + return true; + } + + protected abstract SelectionMask CreateMask(); + } +} From 4a507c66ee50710f4b0d9e37c8654cccb733caee Mon Sep 17 00:00:00 2001 From: smoogipoo Date: Fri, 26 Oct 2018 15:26:08 +0900 Subject: [PATCH 324/417] Cleanup --- .../Edit/Masks/HitCircleMasks/HitCirclePlacementMask.cs | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/osu.Game.Rulesets.Osu/Edit/Masks/HitCircleMasks/HitCirclePlacementMask.cs b/osu.Game.Rulesets.Osu/Edit/Masks/HitCircleMasks/HitCirclePlacementMask.cs index 930ccde814..0d0acbed7d 100644 --- a/osu.Game.Rulesets.Osu/Edit/Masks/HitCircleMasks/HitCirclePlacementMask.cs +++ b/osu.Game.Rulesets.Osu/Edit/Masks/HitCircleMasks/HitCirclePlacementMask.cs @@ -4,15 +4,16 @@ using osu.Framework.Input.Events; using osu.Game.Rulesets.Edit; using osu.Game.Rulesets.Osu.Edit.Masks.HitCircleMasks.Components; +using osu.Game.Rulesets.Osu.Objects; namespace osu.Game.Rulesets.Osu.Edit.Masks.HitCircleMasks { public class HitCirclePlacementMask : PlacementMask { - public new Objects.HitCircle HitObject => (Objects.HitCircle)base.HitObject; + public new HitCircle HitObject => (HitCircle)base.HitObject; public HitCirclePlacementMask() - : base(new Objects.HitCircle()) + : base(new HitCircle()) { InternalChild = new HitCirclePiece(HitObject); } From 22c545ea8c94adea9e8c7285efe1f2b3746a6a66 Mon Sep 17 00:00:00 2001 From: smoogipoo Date: Fri, 26 Oct 2018 15:26:19 +0900 Subject: [PATCH 325/417] Make circle piece respond to hitobject scale --- .../HitCircleMasks/Components/HitCirclePiece.cs | 1 + .../Objects/Drawables/DrawableHitCircle.cs | 1 + osu.Game.Rulesets.Osu/Objects/OsuHitObject.cs | 16 +++++++++++++++- 3 files changed, 17 insertions(+), 1 deletion(-) diff --git a/osu.Game.Rulesets.Osu/Edit/Masks/HitCircleMasks/Components/HitCirclePiece.cs b/osu.Game.Rulesets.Osu/Edit/Masks/HitCircleMasks/Components/HitCirclePiece.cs index 2c76a2e443..c11ae096a7 100644 --- a/osu.Game.Rulesets.Osu/Edit/Masks/HitCircleMasks/Components/HitCirclePiece.cs +++ b/osu.Game.Rulesets.Osu/Edit/Masks/HitCircleMasks/Components/HitCirclePiece.cs @@ -28,6 +28,7 @@ namespace osu.Game.Rulesets.Osu.Edit.Masks.HitCircleMasks.Components hitCircle.PositionChanged += _ => UpdatePosition(); hitCircle.StackHeightChanged += _ => UpdatePosition(); + hitCircle.ScaleChanged += _ => Scale = new Vector2(hitCircle.Scale); } [BackgroundDependencyLoader] diff --git a/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableHitCircle.cs b/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableHitCircle.cs index 8b0973e3d3..e663989eeb 100644 --- a/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableHitCircle.cs +++ b/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableHitCircle.cs @@ -62,6 +62,7 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables HitObject.PositionChanged += _ => Position = HitObject.StackedPosition; HitObject.StackHeightChanged += _ => Position = HitObject.StackedPosition; + HitObject.ScaleChanged += s => Scale = new Vector2(s); } public override Color4 AccentColour diff --git a/osu.Game.Rulesets.Osu/Objects/OsuHitObject.cs b/osu.Game.Rulesets.Osu/Objects/OsuHitObject.cs index 140f875a6f..67396c7ae4 100644 --- a/osu.Game.Rulesets.Osu/Objects/OsuHitObject.cs +++ b/osu.Game.Rulesets.Osu/Objects/OsuHitObject.cs @@ -17,6 +17,7 @@ namespace osu.Game.Rulesets.Osu.Objects public event Action PositionChanged; public event Action StackHeightChanged; + public event Action ScaleChanged; public double TimePreempt = 600; public double TimeFadeIn = 400; @@ -64,7 +65,20 @@ namespace osu.Game.Rulesets.Osu.Objects public double Radius => OBJECT_RADIUS * Scale; - public float Scale { get; set; } = 1; + private float scale = 1; + + public float Scale + { + get => scale; + set + { + if (scale == value) + return; + scale = value; + + ScaleChanged?.Invoke(value); + } + } public virtual bool NewCombo { get; set; } From 951a309d0447ed06c6691a2faed003bcf6c3e291 Mon Sep 17 00:00:00 2001 From: smoogipoo Date: Fri, 26 Oct 2018 15:36:09 +0900 Subject: [PATCH 326/417] Increase placement testcase circlesize --- osu.Game/Tests/Visual/HitObjectPlacementMaskTestCase.cs | 2 ++ 1 file changed, 2 insertions(+) diff --git a/osu.Game/Tests/Visual/HitObjectPlacementMaskTestCase.cs b/osu.Game/Tests/Visual/HitObjectPlacementMaskTestCase.cs index bb9b8a33bc..adf74b9a7d 100644 --- a/osu.Game/Tests/Visual/HitObjectPlacementMaskTestCase.cs +++ b/osu.Game/Tests/Visual/HitObjectPlacementMaskTestCase.cs @@ -20,6 +20,8 @@ namespace osu.Game.Tests.Visual protected HitObjectPlacementMaskTestCase() { + Beatmap.Value.BeatmapInfo.BaseDifficulty.CircleSize = 2; + Add(hitObjectContainer = new Container { RelativeSizeAxes = Axes.Both, From cf3b4447eb04413d0b3de61500abf417d9c0ee68 Mon Sep 17 00:00:00 2001 From: HoLLy Date: Fri, 26 Oct 2018 13:35:51 +0200 Subject: [PATCH 327/417] Fade only textContainer instead of entire MetadataSection --- osu.Game/Screens/Select/BeatmapDetails.cs | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/osu.Game/Screens/Select/BeatmapDetails.cs b/osu.Game/Screens/Select/BeatmapDetails.cs index 9a16c76c44..3999adfede 100644 --- a/osu.Game/Screens/Select/BeatmapDetails.cs +++ b/osu.Game/Screens/Select/BeatmapDetails.cs @@ -307,10 +307,10 @@ namespace osu.Game.Screens.Select { RelativeSizeAxes = Axes.X; AutoSizeAxes = Axes.Y; - Alpha = 0; InternalChild = textContainer = new FillFlowContainer { + Alpha = 0, RelativeSizeAxes = Axes.X, AutoSizeAxes = Axes.Y, Spacing = new Vector2(spacing / 2), @@ -337,17 +337,14 @@ namespace osu.Game.Screens.Select { if (string.IsNullOrEmpty(value)) { - this.FadeOut(transition_duration); + textContainer.FadeOut(transition_duration); return; } - this.FadeIn(transition_duration); setTextAsync(value); } } - public override bool IsPresent => base.IsPresent || textFlow == null; // Visibility is updated in the LoadComponentAsync callback - private void setTextAsync(string text) { LoadComponentAsync(new OsuTextFlowContainer(s => s.TextSize = 14) @@ -362,7 +359,7 @@ namespace osu.Game.Screens.Select textContainer.Add(textFlow = loaded); // fade in if we haven't yet. - this.FadeIn(transition_duration); + textContainer.FadeIn(transition_duration); }); } } From a711112074d4eb30c4e452f498798a5af4d75785 Mon Sep 17 00:00:00 2001 From: TPGPL Date: Fri, 26 Oct 2018 14:08:29 +0200 Subject: [PATCH 328/417] Delete redundant fields --- .github/ISSUE_TEMPLATE/bug-issues.md | 2 -- .github/ISSUE_TEMPLATE/crash-issues.md | 2 -- .github/ISSUE_TEMPLATE/feature-issues.md | 2 -- .github/ISSUE_TEMPLATE/gamefeatures-issues.md | 2 -- 4 files changed, 8 deletions(-) diff --git a/.github/ISSUE_TEMPLATE/bug-issues.md b/.github/ISSUE_TEMPLATE/bug-issues.md index ea29402902..8d85c92fec 100644 --- a/.github/ISSUE_TEMPLATE/bug-issues.md +++ b/.github/ISSUE_TEMPLATE/bug-issues.md @@ -5,8 +5,6 @@ about: For issues regarding encountered game bugs -**What is your problem:** - **Describe your problem:** **Screenshots or videos showing encountered issue:** diff --git a/.github/ISSUE_TEMPLATE/crash-issues.md b/.github/ISSUE_TEMPLATE/crash-issues.md index 7cf6acd549..6c82fdb1d1 100644 --- a/.github/ISSUE_TEMPLATE/crash-issues.md +++ b/.github/ISSUE_TEMPLATE/crash-issues.md @@ -5,8 +5,6 @@ about: For issues regarding game crashes or permanent freezes -**What is your problem:** - **Describe your problem:** **Screenshots or videos showing encountered issue:** diff --git a/.github/ISSUE_TEMPLATE/feature-issues.md b/.github/ISSUE_TEMPLATE/feature-issues.md index fbc44c5a03..73c4f37a3e 100644 --- a/.github/ISSUE_TEMPLATE/feature-issues.md +++ b/.github/ISSUE_TEMPLATE/feature-issues.md @@ -5,8 +5,6 @@ about: Let us know what you would like to see in the game! -**Feature Request:** - **Describe the feature:** **Proposal designs of the feature:** diff --git a/.github/ISSUE_TEMPLATE/gamefeatures-issues.md b/.github/ISSUE_TEMPLATE/gamefeatures-issues.md index a94efed32f..473fb4ae20 100644 --- a/.github/ISSUE_TEMPLATE/gamefeatures-issues.md +++ b/.github/ISSUE_TEMPLATE/gamefeatures-issues.md @@ -5,8 +5,6 @@ about: For issues regarding features to be found in the game -**Feature Request:** - **Describe the feature:** **Designs:** From daf7337fba8ffc774d7b59b39dcde38d2ea8923e Mon Sep 17 00:00:00 2001 From: TPGPL Date: Fri, 26 Oct 2018 14:09:17 +0200 Subject: [PATCH 329/417] Rename the issue templates --- .../{feature-issues.md => feature-request-issues.md} | 0 .../{gamefeatures-issues.md => missing-for-live-issues.md} | 0 2 files changed, 0 insertions(+), 0 deletions(-) rename .github/ISSUE_TEMPLATE/{feature-issues.md => feature-request-issues.md} (100%) rename .github/ISSUE_TEMPLATE/{gamefeatures-issues.md => missing-for-live-issues.md} (100%) diff --git a/.github/ISSUE_TEMPLATE/feature-issues.md b/.github/ISSUE_TEMPLATE/feature-request-issues.md similarity index 100% rename from .github/ISSUE_TEMPLATE/feature-issues.md rename to .github/ISSUE_TEMPLATE/feature-request-issues.md diff --git a/.github/ISSUE_TEMPLATE/gamefeatures-issues.md b/.github/ISSUE_TEMPLATE/missing-for-live-issues.md similarity index 100% rename from .github/ISSUE_TEMPLATE/gamefeatures-issues.md rename to .github/ISSUE_TEMPLATE/missing-for-live-issues.md From 52a9e21d3256dee3084feb40d401e25ce912ff6e Mon Sep 17 00:00:00 2001 From: TPGPL Date: Fri, 26 Oct 2018 14:12:18 +0200 Subject: [PATCH 330/417] Restructure the MfL issue template --- .github/ISSUE_TEMPLATE/missing-for-live-issues.md | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/ISSUE_TEMPLATE/missing-for-live-issues.md b/.github/ISSUE_TEMPLATE/missing-for-live-issues.md index 473fb4ae20..929399d192 100644 --- a/.github/ISSUE_TEMPLATE/missing-for-live-issues.md +++ b/.github/ISSUE_TEMPLATE/missing-for-live-issues.md @@ -1,10 +1,10 @@ --- -name: Game Feature -about: For issues regarding features to be found in the game +name: Missing for Live +about: For issues regarding game features required for live --- -**Describe the feature:** +**Describe the feature:** -**Designs:** +**Designs:** From df6fc4013a6e34c21b416e015726b1a533132365 Mon Sep 17 00:00:00 2001 From: Kyle Chang Date: Sun, 28 Oct 2018 01:40:19 -0400 Subject: [PATCH 331/417] Add interface to adjust Beatmaps --- .../Rulesets/Mods/IApplicableToBeatmap.cs | 19 +++++++++++++++++++ osu.Game/Rulesets/UI/RulesetContainer.cs | 19 +++++++++++++++++-- 2 files changed, 36 insertions(+), 2 deletions(-) create mode 100644 osu.Game/Rulesets/Mods/IApplicableToBeatmap.cs diff --git a/osu.Game/Rulesets/Mods/IApplicableToBeatmap.cs b/osu.Game/Rulesets/Mods/IApplicableToBeatmap.cs new file mode 100644 index 0000000000..e1398ecf2b --- /dev/null +++ b/osu.Game/Rulesets/Mods/IApplicableToBeatmap.cs @@ -0,0 +1,19 @@ +// Copyright (c) 2007-2018 ppy Pty Ltd . +// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE + +using osu.Game.Beatmaps; + +namespace osu.Game.Rulesets.Mods +{ + /// + /// Interface for a that applies changes to a . + /// + public interface IApplicableToBeatmap : IApplicableMod + { + /// + /// Applies this to a . + /// + /// The to apply to. + void ApplyToBeatmap(IBeatmap beatmap); + } +} diff --git a/osu.Game/Rulesets/UI/RulesetContainer.cs b/osu.Game/Rulesets/UI/RulesetContainer.cs index a23a5a78f7..4b55bb558d 100644 --- a/osu.Game/Rulesets/UI/RulesetContainer.cs +++ b/osu.Game/Rulesets/UI/RulesetContainer.cs @@ -238,6 +238,8 @@ namespace osu.Game.Rulesets.UI KeyBindingInputManager = CreateInputManager(); KeyBindingInputManager.RelativeSizeAxes = Axes.Both; + + applyBeatmapMods(Mods); } [BackgroundDependencyLoader] @@ -255,16 +257,29 @@ namespace osu.Game.Rulesets.UI KeyBindingInputManager.Add(Cursor); // Apply mods - applyMods(Mods, config); + applyRulesetMods(Mods, config); loadObjects(); } + /// + /// Applies the active mods to the Beatmap. + /// + /// + private void applyBeatmapMods(IEnumerable mods) + { + if (mods == null) + return; + + foreach (var mod in mods.OfType()) + mod.ApplyToBeatmap(Beatmap); + } + /// /// Applies the active mods to this RulesetContainer. /// /// - private void applyMods(IEnumerable mods, OsuConfigManager config) + private void applyRulesetMods(IEnumerable mods, OsuConfigManager config) { if (mods == null) return; From 9b246f065c07769e8623edf9bf7e9885b0b5130c Mon Sep 17 00:00:00 2001 From: Kyle Chang Date: Sun, 28 Oct 2018 02:20:46 -0400 Subject: [PATCH 332/417] Have dual stage mod apply changes to beatmap directly --- .../Mods/ManiaModDualStages.cs | 16 ++++++---------- 1 file changed, 6 insertions(+), 10 deletions(-) diff --git a/osu.Game.Rulesets.Mania/Mods/ManiaModDualStages.cs b/osu.Game.Rulesets.Mania/Mods/ManiaModDualStages.cs index aecfb50fbe..12b62d2b65 100644 --- a/osu.Game.Rulesets.Mania/Mods/ManiaModDualStages.cs +++ b/osu.Game.Rulesets.Mania/Mods/ManiaModDualStages.cs @@ -4,14 +4,11 @@ using System.Collections.Generic; using osu.Game.Beatmaps; using osu.Game.Rulesets.Mania.Beatmaps; -using osu.Game.Rulesets.Mania.Objects; -using osu.Game.Rulesets.Mania.UI; using osu.Game.Rulesets.Mods; -using osu.Game.Rulesets.UI; namespace osu.Game.Rulesets.Mania.Mods { - public class ManiaModDualStages : Mod, IPlayfieldTypeMod, IApplicableToBeatmapConverter, IApplicableToRulesetContainer + public class ManiaModDualStages : Mod, IPlayfieldTypeMod, IApplicableToBeatmapConverter, IApplicableToBeatmap { public override string Name => "Dual Stages"; public override string ShortenedName => "DS"; @@ -34,22 +31,21 @@ namespace osu.Game.Rulesets.Mania.Mods mbc.TargetColumns *= 2; } - public void ApplyToRulesetContainer(RulesetContainer rulesetContainer) + public void ApplyToBeatmap(IBeatmap beatmap) { - var mrc = (ManiaRulesetContainer)rulesetContainer; - - // Although this can work, for now let's not allow keymods for mania-specific beatmaps if (isForCurrentRuleset) return; + var maniaBeatmap = (ManiaBeatmap) beatmap; + var newDefinitions = new List(); - foreach (var existing in mrc.Beatmap.Stages) + foreach (var existing in maniaBeatmap.Stages) { newDefinitions.Add(new StageDefinition { Columns = existing.Columns / 2 }); newDefinitions.Add(new StageDefinition { Columns = existing.Columns / 2 }); } - mrc.Beatmap.Stages = newDefinitions; + maniaBeatmap.Stages = newDefinitions; } public PlayfieldType PlayfieldType => PlayfieldType.Dual; From 3a61594da4924803d860536a7829c1e1d5854025 Mon Sep 17 00:00:00 2001 From: miterosan Date: Sun, 28 Oct 2018 13:04:54 +0100 Subject: [PATCH 333/417] Reference the build script in the README. --- README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/README.md b/README.md index dc36145337..d0919e1d82 100644 --- a/README.md +++ b/README.md @@ -25,6 +25,7 @@ Build and run - Using Visual Studio 2017, Rider or Visual Studio Code (configurations are included) - From command line using `dotnet run --project osu.Desktop`. When building for non-development purposes, add `-c Release` to gain higher performance. +- And from command line using `powershell ./build.ps1`. This will also run tests and code analysis. This command is used on CI. The code analysis is windows only. Note: If you run from command line under linux, you will need to prefix the output folder to your `LD_LIBRARY_PATH`. See `.vscode/launch.json` for an example From f8a8c7cb6bc229170f5715ea4463d1c8542c7d1c Mon Sep 17 00:00:00 2001 From: Kyle Chang Date: Sun, 28 Oct 2018 12:43:19 -0400 Subject: [PATCH 334/417] Stop transferring track when editing --- osu.Game/Screens/Select/SongSelect.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu.Game/Screens/Select/SongSelect.cs b/osu.Game/Screens/Select/SongSelect.cs index b4f552ce93..9d7e84aa04 100644 --- a/osu.Game/Screens/Select/SongSelect.cs +++ b/osu.Game/Screens/Select/SongSelect.cs @@ -225,7 +225,7 @@ namespace osu.Game.Screens.Select public void Edit(BeatmapInfo beatmap) { - Beatmap.Value = beatmaps.GetWorkingBeatmap(beatmap, Beatmap.Value); + Beatmap.Value = beatmaps.GetWorkingBeatmap(beatmap); Push(new Editor()); } From 2b736c3cd64727a720e0b8e23973804facb295ba Mon Sep 17 00:00:00 2001 From: Kyle Chang Date: Sun, 28 Oct 2018 13:04:45 -0400 Subject: [PATCH 335/417] Make beatmap edit button reload beatmap without mods --- osu.Game/Screens/Select/PlaySongSelect.cs | 2 +- osu.Game/Screens/Select/SongSelect.cs | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/osu.Game/Screens/Select/PlaySongSelect.cs b/osu.Game/Screens/Select/PlaySongSelect.cs index 917a08d172..fdb82f9e7f 100644 --- a/osu.Game/Screens/Select/PlaySongSelect.cs +++ b/osu.Game/Screens/Select/PlaySongSelect.cs @@ -68,7 +68,7 @@ namespace osu.Game.Screens.Select BeatmapOptions.AddButton(@"Edit", @"beatmap", FontAwesome.fa_pencil, colours.Yellow, () => { ValidForResume = false; - Push(new Editor()); + EditSelected(); }, Key.Number3); if (dialogOverlay != null) diff --git a/osu.Game/Screens/Select/SongSelect.cs b/osu.Game/Screens/Select/SongSelect.cs index 9d7e84aa04..32e77bb914 100644 --- a/osu.Game/Screens/Select/SongSelect.cs +++ b/osu.Game/Screens/Select/SongSelect.cs @@ -229,6 +229,8 @@ namespace osu.Game.Screens.Select Push(new Editor()); } + protected void EditSelected() => Edit(beatmapNoDebounce); + /// /// Call to make a selection and perform the default action for this SongSelect. /// From 886dd0f0d46fe2ba4f1192f2d01024a4e95d5560 Mon Sep 17 00:00:00 2001 From: Kyle Chang Date: Sun, 28 Oct 2018 13:21:12 -0400 Subject: [PATCH 336/417] Remove unneeded using directive --- osu.Game/Screens/Select/PlaySongSelect.cs | 1 - 1 file changed, 1 deletion(-) diff --git a/osu.Game/Screens/Select/PlaySongSelect.cs b/osu.Game/Screens/Select/PlaySongSelect.cs index fdb82f9e7f..1c4a0c58e9 100644 --- a/osu.Game/Screens/Select/PlaySongSelect.cs +++ b/osu.Game/Screens/Select/PlaySongSelect.cs @@ -16,7 +16,6 @@ using osu.Game.Graphics; using osu.Game.Overlays; using osu.Game.Overlays.Mods; using osu.Game.Rulesets.Mods; -using osu.Game.Screens.Edit; using osu.Game.Screens.Play; using osu.Game.Screens.Ranking; using osu.Game.Skinning; From c7e950af7f86ebaf2693b3f46eb035869fbe504d Mon Sep 17 00:00:00 2001 From: Kyle Chang Date: Mon, 29 Oct 2018 00:04:51 -0400 Subject: [PATCH 337/417] Remove EditSelected in favor in inlining beatmapNoDebounce in Edit --- osu.Game/Screens/Select/PlaySongSelect.cs | 2 +- osu.Game/Screens/Select/SongSelect.cs | 6 ++---- 2 files changed, 3 insertions(+), 5 deletions(-) diff --git a/osu.Game/Screens/Select/PlaySongSelect.cs b/osu.Game/Screens/Select/PlaySongSelect.cs index 1c4a0c58e9..285410ce20 100644 --- a/osu.Game/Screens/Select/PlaySongSelect.cs +++ b/osu.Game/Screens/Select/PlaySongSelect.cs @@ -67,7 +67,7 @@ namespace osu.Game.Screens.Select BeatmapOptions.AddButton(@"Edit", @"beatmap", FontAwesome.fa_pencil, colours.Yellow, () => { ValidForResume = false; - EditSelected(); + Edit(); }, Key.Number3); if (dialogOverlay != null) diff --git a/osu.Game/Screens/Select/SongSelect.cs b/osu.Game/Screens/Select/SongSelect.cs index 32e77bb914..4288483caf 100644 --- a/osu.Game/Screens/Select/SongSelect.cs +++ b/osu.Game/Screens/Select/SongSelect.cs @@ -223,14 +223,12 @@ namespace osu.Game.Screens.Select Carousel.LoadBeatmapSetsFromManager(this.beatmaps); } - public void Edit(BeatmapInfo beatmap) + public void Edit(BeatmapInfo beatmap = null) { - Beatmap.Value = beatmaps.GetWorkingBeatmap(beatmap); + Beatmap.Value = beatmaps.GetWorkingBeatmap(beatmap ?? beatmapNoDebounce); Push(new Editor()); } - protected void EditSelected() => Edit(beatmapNoDebounce); - /// /// Call to make a selection and perform the default action for this SongSelect. /// From 86e09a68f7749dd35f5056859ea4f8f7e0df415c Mon Sep 17 00:00:00 2001 From: smoogipoo Date: Thu, 25 Oct 2018 15:49:45 +0900 Subject: [PATCH 338/417] Separate slider body to bypass snaking logic The snaking logic contains a lot of caching/optimisations and offsetting of the path which is tedious to re-compute when the path changes. --- .../Objects/Drawables/DrawableSlider.cs | 4 +- .../Drawables/Pieces/ManualSliderBody.cs | 20 +++ .../Objects/Drawables/Pieces/SliderBody.cs | 129 +++--------------- .../Drawables/Pieces/SnakingSliderBody.cs | 105 ++++++++++++++ 4 files changed, 146 insertions(+), 112 deletions(-) create mode 100644 osu.Game.Rulesets.Osu/Objects/Drawables/Pieces/ManualSliderBody.cs create mode 100644 osu.Game.Rulesets.Osu/Objects/Drawables/Pieces/SnakingSliderBody.cs diff --git a/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableSlider.cs b/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableSlider.cs index 89f380db4e..16bd522c1d 100644 --- a/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableSlider.cs +++ b/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableSlider.cs @@ -23,7 +23,7 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables public readonly DrawableHitCircle HeadCircle; public readonly DrawableSliderTail TailCircle; - public readonly SliderBody Body; + public readonly SnakingSliderBody Body; public readonly SliderBall Ball; public DrawableSlider(Slider s) @@ -38,7 +38,7 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables InternalChildren = new Drawable[] { - Body = new SliderBody(s) + Body = new SnakingSliderBody(s) { PathWidth = s.Scale * 64, }, diff --git a/osu.Game.Rulesets.Osu/Objects/Drawables/Pieces/ManualSliderBody.cs b/osu.Game.Rulesets.Osu/Objects/Drawables/Pieces/ManualSliderBody.cs new file mode 100644 index 0000000000..9d239c15f2 --- /dev/null +++ b/osu.Game.Rulesets.Osu/Objects/Drawables/Pieces/ManualSliderBody.cs @@ -0,0 +1,20 @@ +// Copyright (c) 2007-2018 ppy Pty Ltd . +// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE + +using System.Collections.Generic; +using OpenTK; + +namespace osu.Game.Rulesets.Osu.Objects.Drawables.Pieces +{ + /// + /// A with the ability to set the drawn vertices manually. + /// + public class ManualSliderBody : SliderBody + { + public new void SetVertices(IReadOnlyList vertices) + { + base.SetVertices(vertices); + Size = Path.Size; + } + } +} diff --git a/osu.Game.Rulesets.Osu/Objects/Drawables/Pieces/SliderBody.cs b/osu.Game.Rulesets.Osu/Objects/Drawables/Pieces/SliderBody.cs index f4ccf673e9..ca2daa3adb 100644 --- a/osu.Game.Rulesets.Osu/Objects/Drawables/Pieces/SliderBody.cs +++ b/osu.Game.Rulesets.Osu/Objects/Drawables/Pieces/SliderBody.cs @@ -1,24 +1,22 @@ -// Copyright (c) 2007-2018 ppy Pty Ltd . +// Copyright (c) 2007-2018 ppy Pty Ltd . // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE -using System; using System.Collections.Generic; -using osu.Framework.Allocation; -using osu.Framework.Configuration; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Lines; -using OpenTK.Graphics.ES30; -using OpenTK.Graphics; using osu.Framework.Graphics.Primitives; -using osu.Game.Rulesets.Objects.Types; using OpenTK; +using OpenTK.Graphics; +using OpenTK.Graphics.ES30; namespace osu.Game.Rulesets.Osu.Objects.Drawables.Pieces { - public class SliderBody : Container, ISliderProgress + public abstract class SliderBody : CompositeDrawable { private readonly SliderPath path; + protected Path Path => path; + private readonly BufferedContainer container; public float PathWidth @@ -30,15 +28,7 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables.Pieces /// /// Offset in absolute coordinates from the start of the curve. /// - public Vector2 PathOffset { get; private set; } - - public readonly List CurrentCurve = new List(); - - public readonly Bindable SnakingIn = new Bindable(); - public readonly Bindable SnakingOut = new Bindable(); - - public double? SnakedStart { get; private set; } - public double? SnakedEnd { get; private set; } + public virtual Vector2 PathOffset => path.PositionInBoundingBox(path.Vertices[0]); /// /// Used to colour the path. @@ -74,28 +64,13 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables.Pieces public Quad PathDrawQuad => container.ScreenSpaceDrawQuad; - private Vector2 topLeftOffset; - - private readonly Slider slider; - - public SliderBody(Slider s) + protected SliderBody() { - slider = s; - - Children = new Drawable[] + InternalChild = container = new BufferedContainer { - container = new BufferedContainer - { - RelativeSizeAxes = Axes.Both, - CacheDrawnFrameBuffer = true, - Children = new Drawable[] - { - path = new SliderPath - { - Blending = BlendingMode.None, - }, - } - }, + RelativeSizeAxes = Axes.Both, + CacheDrawnFrameBuffer = true, + Child = path = new SliderPath { Blending = BlendingMode.None } }; container.Attach(RenderbufferInternalFormat.DepthComponent16); @@ -103,80 +78,14 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables.Pieces public override bool ReceivePositionalInputAt(Vector2 screenSpacePos) => path.ReceivePositionalInputAt(screenSpacePos); - public void SetRange(double p0, double p1) + /// + /// Sets the vertices of the path which should be drawn by this . + /// + /// The vertices + protected void SetVertices(IReadOnlyList vertices) { - if (p0 > p1) - MathHelper.Swap(ref p0, ref p1); - - if (updateSnaking(p0, p1)) - { - // The path is generated such that its size encloses it. This change of size causes the path - // to move around while snaking, so we need to offset it to make sure it maintains the - // same position as when it is fully snaked. - var newTopLeftOffset = path.PositionInBoundingBox(Vector2.Zero); - path.Position = topLeftOffset - newTopLeftOffset; - - container.ForceRedraw(); - } - } - - [BackgroundDependencyLoader] - private void load() - { - computeSize(); - } - - private void computeSize() - { - // Generate the entire curve - slider.Curve.GetPathToProgress(CurrentCurve, 0, 1); - foreach (Vector2 p in CurrentCurve) - path.AddVertex(p); - - Size = path.Size; - - topLeftOffset = path.PositionInBoundingBox(Vector2.Zero); - PathOffset = path.PositionInBoundingBox(CurrentCurve[0]); - } - - private bool updateSnaking(double p0, double p1) - { - if (SnakedStart == p0 && SnakedEnd == p1) return false; - - SnakedStart = p0; - SnakedEnd = p1; - - slider.Curve.GetPathToProgress(CurrentCurve, p0, p1); - - path.ClearVertices(); - foreach (Vector2 p in CurrentCurve) - path.AddVertex(p); - - return true; - } - - public void UpdateProgress(double completionProgress) - { - var span = slider.SpanAt(completionProgress); - var spanProgress = slider.ProgressAt(completionProgress); - - double start = 0; - double end = SnakingIn ? MathHelper.Clamp((Time.Current - (slider.StartTime - slider.TimePreempt)) / slider.TimeFadeIn, 0, 1) : 1; - - if (span >= slider.SpanCount() - 1) - { - if (Math.Min(span, slider.SpanCount() - 1) % 2 == 1) - { - start = 0; - end = SnakingOut ? spanProgress : 1; - } - else - { - start = SnakingOut ? spanProgress : 0; - } - } - - SetRange(start, end); + path.Vertices = vertices; + container.ForceRedraw(); } private class SliderPath : SmoothPath diff --git a/osu.Game.Rulesets.Osu/Objects/Drawables/Pieces/SnakingSliderBody.cs b/osu.Game.Rulesets.Osu/Objects/Drawables/Pieces/SnakingSliderBody.cs new file mode 100644 index 0000000000..09d6f9459a --- /dev/null +++ b/osu.Game.Rulesets.Osu/Objects/Drawables/Pieces/SnakingSliderBody.cs @@ -0,0 +1,105 @@ +// Copyright (c) 2007-2018 ppy Pty Ltd . +// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE + +using System; +using System.Collections.Generic; +using osu.Framework.Allocation; +using osu.Framework.Configuration; +using osu.Game.Rulesets.Objects.Types; +using OpenTK; + +namespace osu.Game.Rulesets.Osu.Objects.Drawables.Pieces +{ + /// + /// A which changes its curve depending on the snaking progress. + /// + public class SnakingSliderBody : SliderBody, ISliderProgress + { + public readonly List CurrentCurve = new List(); + + public readonly Bindable SnakingIn = new Bindable(); + public readonly Bindable SnakingOut = new Bindable(); + + public double? SnakedStart { get; private set; } + public double? SnakedEnd { get; private set; } + + public override Vector2 PathOffset => snakedPathOffset; + + /// + /// The top-left position of the path when fully snaked. + /// + private Vector2 snakedPosition; + + /// + /// The offset of the path from when fully snaked. + /// + private Vector2 snakedPathOffset; + + private readonly Slider slider; + + public SnakingSliderBody(Slider slider) + { + this.slider = slider; + } + + [BackgroundDependencyLoader] + private void load() + { + // Generate the entire curve + slider.Curve.GetPathToProgress(CurrentCurve, 0, 1); + SetVertices(CurrentCurve); + + // The body is sized to the full path size to avoid excessive autosize computations + Size = Path.Size; + + snakedPosition = Path.PositionInBoundingBox(Vector2.Zero); + snakedPathOffset = Path.PositionInBoundingBox(Path.Vertices[0]); + } + + public void UpdateProgress(double completionProgress) + { + var span = slider.SpanAt(completionProgress); + var spanProgress = slider.ProgressAt(completionProgress); + + double start = 0; + double end = SnakingIn ? MathHelper.Clamp((Time.Current - (slider.StartTime - slider.TimePreempt)) / slider.TimeFadeIn, 0, 1) : 1; + + if (span >= slider.SpanCount() - 1) + { + if (Math.Min(span, slider.SpanCount() - 1) % 2 == 1) + { + start = 0; + end = SnakingOut ? spanProgress : 1; + } + else + { + start = SnakingOut ? spanProgress : 0; + } + } + + setRange(start, end); + } + + private void setRange(double p0, double p1) + { + if (p0 > p1) + MathHelper.Swap(ref p0, ref p1); + + if (SnakedStart == p0 && SnakedEnd == p1) return; + + SnakedStart = p0; + SnakedEnd = p1; + + slider.Curve.GetPathToProgress(CurrentCurve, p0, p1); + + SetVertices(CurrentCurve); + + // The bounding box of the path expands as it snakes, which in turn shifts the position of the path. + // Depending on the direction of expansion, it may appear as if the path is expanding towards the position of the slider + // rather than expanding out from the position of the slider. + // To remove this effect, the path's position is shifted towards its final snaked position + + Path.Position = snakedPosition - Path.PositionInBoundingBox(Vector2.Zero); + } + } +} From dd5a3ad59cfef2e37cf778eb1adb1cc8650d9b67 Mon Sep 17 00:00:00 2001 From: smoogipoo Date: Mon, 29 Oct 2018 15:17:45 +0900 Subject: [PATCH 339/417] Fix SliderMask not working --- .../Edit/Layers/Selection/Overlays/SliderMask.cs | 4 ++-- osu.Game/osu.Game.csproj | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/osu.Game.Rulesets.Osu/Edit/Layers/Selection/Overlays/SliderMask.cs b/osu.Game.Rulesets.Osu/Edit/Layers/Selection/Overlays/SliderMask.cs index aff42dd233..90d1b8f31a 100644 --- a/osu.Game.Rulesets.Osu/Edit/Layers/Selection/Overlays/SliderMask.cs +++ b/osu.Game.Rulesets.Osu/Edit/Layers/Selection/Overlays/SliderMask.cs @@ -16,7 +16,7 @@ namespace osu.Game.Rulesets.Osu.Edit.Layers.Selection.Overlays { public class SliderMask : HitObjectMask { - private readonly SliderBody body; + private readonly SnakingSliderBody body; private readonly DrawableSlider slider; public SliderMask(DrawableSlider slider) @@ -30,7 +30,7 @@ namespace osu.Game.Rulesets.Osu.Edit.Layers.Selection.Overlays InternalChildren = new Drawable[] { - body = new SliderBody(sliderObject) + body = new SnakingSliderBody(sliderObject) { AccentColour = Color4.Transparent, PathWidth = sliderObject.Scale * 64 diff --git a/osu.Game/osu.Game.csproj b/osu.Game/osu.Game.csproj index 26004b513f..e2b466c69f 100644 --- a/osu.Game/osu.Game.csproj +++ b/osu.Game/osu.Game.csproj @@ -18,7 +18,7 @@ - + From 9b19050fafde5ebe051f7b2daa478805644552e1 Mon Sep 17 00:00:00 2001 From: smoogipoo Date: Mon, 29 Oct 2018 15:25:20 +0900 Subject: [PATCH 340/417] Update with slider body changes --- .../Edit/Masks/SliderMasks/Components/SliderBodyPiece.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/osu.Game.Rulesets.Osu/Edit/Masks/SliderMasks/Components/SliderBodyPiece.cs b/osu.Game.Rulesets.Osu/Edit/Masks/SliderMasks/Components/SliderBodyPiece.cs index 0595b046d1..3123a4fcea 100644 --- a/osu.Game.Rulesets.Osu/Edit/Masks/SliderMasks/Components/SliderBodyPiece.cs +++ b/osu.Game.Rulesets.Osu/Edit/Masks/SliderMasks/Components/SliderBodyPiece.cs @@ -13,12 +13,12 @@ namespace osu.Game.Rulesets.Osu.Edit.Masks.SliderMasks.Components public class SliderBodyPiece : CompositeDrawable { private readonly Slider slider; - private readonly SliderBody body; + private readonly SnakingSliderBody body; public SliderBodyPiece(Slider slider) { this.slider = slider; - InternalChild = body = new SliderBody(slider) + InternalChild = body = new SnakingSliderBody(slider) { AccentColour = Color4.Transparent, PathWidth = slider.Scale * 64 From 38ce8f8af1fec6b7ff25b0594edca3a820c281b8 Mon Sep 17 00:00:00 2001 From: smoogipoo Date: Thu, 4 Oct 2018 13:44:20 +0900 Subject: [PATCH 341/417] Refactor SliderSelectionMask --- .../Edit/Masks/SliderSelectionMask.cs | 67 +++++++++++++++++++ ...SliderSelectionMask_CircleSelectionMask.cs | 64 ++++++++++++++++++ .../Visual/TestCaseHitObjectComposer.cs | 1 + 3 files changed, 132 insertions(+) create mode 100644 osu.Game.Rulesets.Osu/Edit/Masks/SliderSelectionMask.cs create mode 100644 osu.Game.Rulesets.Osu/Edit/Masks/SliderSelectionMask_CircleSelectionMask.cs diff --git a/osu.Game.Rulesets.Osu/Edit/Masks/SliderSelectionMask.cs b/osu.Game.Rulesets.Osu/Edit/Masks/SliderSelectionMask.cs new file mode 100644 index 0000000000..46c807f4b3 --- /dev/null +++ b/osu.Game.Rulesets.Osu/Edit/Masks/SliderSelectionMask.cs @@ -0,0 +1,67 @@ +// Copyright (c) 2007-2018 ppy Pty Ltd . +// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE + +using osu.Framework.Allocation; +using osu.Framework.Graphics; +using osu.Framework.Graphics.Primitives; +using osu.Game.Graphics; +using osu.Game.Rulesets.Edit; +using osu.Game.Rulesets.Osu.Objects; +using osu.Game.Rulesets.Osu.Objects.Drawables; +using osu.Game.Rulesets.Osu.Objects.Drawables.Pieces; +using OpenTK; +using OpenTK.Graphics; + +namespace osu.Game.Rulesets.Osu.Edit.Masks +{ + public partial class SliderSelectionMask : SelectionMask + { + private readonly SliderBody body; + private readonly DrawableSlider slider; + + public SliderSelectionMask(DrawableSlider slider) + : base(slider) + { + this.slider = slider; + + Position = slider.Position; + + var sliderObject = (Slider)slider.HitObject; + + InternalChildren = new Drawable[] + { + body = new SliderBody(sliderObject) + { + AccentColour = Color4.Transparent, + PathWidth = sliderObject.Scale * 64 + }, + new CircleSelectionMask(slider.HeadCircle, slider), + new CircleSelectionMask(slider.TailCircle, slider), + }; + + sliderObject.PositionChanged += _ => Position = slider.Position; + } + + [BackgroundDependencyLoader] + private void load(OsuColour colours) + { + body.BorderColour = colours.Yellow; + } + + protected override void Update() + { + base.Update(); + + Size = slider.Size; + OriginPosition = slider.OriginPosition; + + // Need to cause one update + body.UpdateProgress(0); + } + + public override bool ReceivePositionalInputAt(Vector2 screenSpacePos) => body.ReceivePositionalInputAt(screenSpacePos); + + public override Vector2 SelectionPoint => ToScreenSpace(OriginPosition); + public override Quad SelectionQuad => body.PathDrawQuad; + } +} diff --git a/osu.Game.Rulesets.Osu/Edit/Masks/SliderSelectionMask_CircleSelectionMask.cs b/osu.Game.Rulesets.Osu/Edit/Masks/SliderSelectionMask_CircleSelectionMask.cs new file mode 100644 index 0000000000..f4d4749343 --- /dev/null +++ b/osu.Game.Rulesets.Osu/Edit/Masks/SliderSelectionMask_CircleSelectionMask.cs @@ -0,0 +1,64 @@ +// Copyright (c) 2007-2018 ppy Pty Ltd . +// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE + +using osu.Framework.Allocation; +using osu.Framework.Graphics; +using osu.Game.Graphics; +using osu.Game.Rulesets.Edit; +using osu.Game.Rulesets.Osu.Objects; +using osu.Game.Rulesets.Osu.Objects.Drawables; +using osu.Game.Rulesets.Osu.Objects.Drawables.Pieces; +using OpenTK; + +namespace osu.Game.Rulesets.Osu.Edit.Masks +{ + public partial class SliderSelectionMask + { + private class CircleSelectionMask : SelectionMask + { + public CircleSelectionMask(DrawableHitCircle sliderHead, DrawableSlider slider) + : this(sliderHead, Vector2.Zero, slider) + { + } + + public CircleSelectionMask(DrawableSliderTail sliderTail, DrawableSlider slider) + : this(sliderTail, ((Slider)slider.HitObject).Curve.PositionAt(1), slider) + { + } + + private readonly DrawableOsuHitObject hitObject; + + private CircleSelectionMask(DrawableOsuHitObject hitObject, Vector2 position, DrawableSlider slider) + : base(hitObject) + { + this.hitObject = hitObject; + + Origin = Anchor.Centre; + + Position = position; + Size = slider.HeadCircle.Size; + Scale = slider.HeadCircle.Scale; + + AddInternal(new RingPiece()); + + Select(); + } + + [BackgroundDependencyLoader] + private void load(OsuColour colours) + { + Colour = colours.Yellow; + } + + protected override void Update() + { + base.Update(); + + RelativeAnchorPosition = hitObject.RelativeAnchorPosition; + } + + // Todo: This is temporary, since the slider circle masks don't do anything special yet. In the future they will handle input. + public override bool HandlePositionalInput => false; + } + } +} diff --git a/osu.Game.Tests/Visual/TestCaseHitObjectComposer.cs b/osu.Game.Tests/Visual/TestCaseHitObjectComposer.cs index 61647ffdc5..99a8f3f51b 100644 --- a/osu.Game.Tests/Visual/TestCaseHitObjectComposer.cs +++ b/osu.Game.Tests/Visual/TestCaseHitObjectComposer.cs @@ -37,6 +37,7 @@ namespace osu.Game.Tests.Visual typeof(HitCirclePiece), typeof(HitCircleSelectionMask), typeof(HitCirclePlacementMask), + typeof(SliderSelectionMask), }; private HitObjectComposer composer; From bd915e8dca19e43468b12a3a592249064c5e8137 Mon Sep 17 00:00:00 2001 From: smoogipoo Date: Thu, 4 Oct 2018 13:44:49 +0900 Subject: [PATCH 342/417] Implement initial slider placement (linear) --- .../Edit/Masks/SliderPlacementMask.cs | 99 +++++++++++++++++++ ...SliderPlacementMask_CirclePlacementMask.cs | 29 ++++++ .../Edit/OsuHitObjectComposer.cs | 3 +- .../Edit/SliderCompositionTool.cs | 20 ++++ .../Visual/TestCaseHitObjectComposer.cs | 1 + 5 files changed, 151 insertions(+), 1 deletion(-) create mode 100644 osu.Game.Rulesets.Osu/Edit/Masks/SliderPlacementMask.cs create mode 100644 osu.Game.Rulesets.Osu/Edit/Masks/SliderPlacementMask_CirclePlacementMask.cs create mode 100644 osu.Game.Rulesets.Osu/Edit/SliderCompositionTool.cs diff --git a/osu.Game.Rulesets.Osu/Edit/Masks/SliderPlacementMask.cs b/osu.Game.Rulesets.Osu/Edit/Masks/SliderPlacementMask.cs new file mode 100644 index 0000000000..287d19ed93 --- /dev/null +++ b/osu.Game.Rulesets.Osu/Edit/Masks/SliderPlacementMask.cs @@ -0,0 +1,99 @@ +// Copyright (c) 2007-2018 ppy Pty Ltd . +// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE + +using System.Collections.Generic; +using System.Drawing.Imaging; +using System.Linq; +using osu.Framework.Graphics; +using osu.Framework.Input.Events; +using osu.Game.Rulesets.Edit; +using osu.Game.Rulesets.Objects.Types; +using osu.Game.Rulesets.Osu.Objects; +using OpenTK; + +namespace osu.Game.Rulesets.Osu.Edit.Masks +{ + public partial class SliderPlacementMask : PlacementMask + { + public new Slider HitObject => (Slider)base.HitObject; + + private readonly CirclePlacementMask headMask; + private readonly CirclePlacementMask tailMask; + + private readonly List controlPoints = new List(); + + private PlacementState state = PlacementState.Head; + + public SliderPlacementMask() + : base(new Slider()) + { + RelativeSizeAxes = Axes.Both; + + InternalChildren = new Drawable[] + { + headMask = new CirclePlacementMask(), + tailMask = new CirclePlacementMask(), + }; + + setState(PlacementState.Head); + } + + protected override bool OnMouseMove(MouseMoveEvent e) + { + switch (state) + { + case PlacementState.Head: + headMask.Position = e.MousePosition; + return true; + case PlacementState.Tail: + tailMask.Position = ToLocalSpace(e.ScreenSpaceMousePosition); + return true; + } + + return false; + } + + protected override bool OnClick(ClickEvent e) + { + switch (state) + { + case PlacementState.Head: + setState(PlacementState.Tail); + controlPoints.Add(Vector2.Zero); + break; + case PlacementState.Tail: + controlPoints.Add(tailMask.Position - headMask.Position); + HitObject.Position = headMask.Position; + HitObject.ControlPoints = controlPoints.ToList(); + HitObject.CurveType = CurveType.Linear; + HitObject.Distance = Vector2.Distance(controlPoints.First(), controlPoints.Last()); + Finish(); + break; + } + + return base.OnClick(e); + } + + private void setState(PlacementState newState) + { + switch (newState) + { + case PlacementState.Head: + tailMask.Alpha = 0; + break; + case PlacementState.Tail: + tailMask.Alpha = 1; + break; + } + + state = newState; + } + + private enum PlacementState + { + Head, + Body, + Tail + } + } +} diff --git a/osu.Game.Rulesets.Osu/Edit/Masks/SliderPlacementMask_CirclePlacementMask.cs b/osu.Game.Rulesets.Osu/Edit/Masks/SliderPlacementMask_CirclePlacementMask.cs new file mode 100644 index 0000000000..4a3574c885 --- /dev/null +++ b/osu.Game.Rulesets.Osu/Edit/Masks/SliderPlacementMask_CirclePlacementMask.cs @@ -0,0 +1,29 @@ +// Copyright (c) 2007-2018 ppy Pty Ltd . +// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE + +using osu.Framework.Graphics; +using osu.Framework.Input.Events; +using osu.Game.Rulesets.Edit; +using osu.Game.Rulesets.Osu.Objects; + +namespace osu.Game.Rulesets.Osu.Edit.Masks +{ + public partial class SliderPlacementMask + { + private class CirclePlacementMask : PlacementMask + { + public new HitCircle HitObject => (HitCircle)base.HitObject; + + public CirclePlacementMask() + : base(new HitCircle()) + { + Origin = Anchor.Centre; + AutoSizeAxes = Axes.Both; + + InternalChild = new HitCircleMask(HitObject); + } + + protected override bool Handle(UIEvent e) => false; + } + } +} diff --git a/osu.Game.Rulesets.Osu/Edit/OsuHitObjectComposer.cs b/osu.Game.Rulesets.Osu/Edit/OsuHitObjectComposer.cs index ac41d6ef27..c54cec94f6 100644 --- a/osu.Game.Rulesets.Osu/Edit/OsuHitObjectComposer.cs +++ b/osu.Game.Rulesets.Osu/Edit/OsuHitObjectComposer.cs @@ -27,9 +27,10 @@ namespace osu.Game.Rulesets.Osu.Edit protected override RulesetContainer CreateRulesetContainer(Ruleset ruleset, WorkingBeatmap beatmap) => new OsuEditRulesetContainer(ruleset, beatmap); - protected override IReadOnlyList CompositionTools => new[] + protected override IReadOnlyList CompositionTools => new HitObjectCompositionTool[] { new HitCircleCompositionTool(), + new SliderCompositionTool(), }; protected override Container CreateLayerContainer() => new PlayfieldAdjustmentContainer { RelativeSizeAxes = Axes.Both }; diff --git a/osu.Game.Rulesets.Osu/Edit/SliderCompositionTool.cs b/osu.Game.Rulesets.Osu/Edit/SliderCompositionTool.cs new file mode 100644 index 0000000000..f7cdd76655 --- /dev/null +++ b/osu.Game.Rulesets.Osu/Edit/SliderCompositionTool.cs @@ -0,0 +1,20 @@ +// Copyright (c) 2007-2018 ppy Pty Ltd . +// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE + +using osu.Game.Rulesets.Edit; +using osu.Game.Rulesets.Edit.Tools; +using osu.Game.Rulesets.Osu.Edit.Masks; +using osu.Game.Rulesets.Osu.Objects; + +namespace osu.Game.Rulesets.Osu.Edit +{ + public class SliderCompositionTool : HitObjectCompositionTool + { + public SliderCompositionTool() + : base(nameof(Slider)) + { + } + + public override PlacementMask CreatePlacementMask() => new SliderPlacementMask(); + } +} diff --git a/osu.Game.Tests/Visual/TestCaseHitObjectComposer.cs b/osu.Game.Tests/Visual/TestCaseHitObjectComposer.cs index 99a8f3f51b..196cb9320a 100644 --- a/osu.Game.Tests/Visual/TestCaseHitObjectComposer.cs +++ b/osu.Game.Tests/Visual/TestCaseHitObjectComposer.cs @@ -38,6 +38,7 @@ namespace osu.Game.Tests.Visual typeof(HitCircleSelectionMask), typeof(HitCirclePlacementMask), typeof(SliderSelectionMask), + typeof(SliderPlacementMask) }; private HitObjectComposer composer; From b3e105ba932146c5c9753d68148799e12f1dfe02 Mon Sep 17 00:00:00 2001 From: smoogipoo Date: Thu, 4 Oct 2018 16:13:18 +0900 Subject: [PATCH 343/417] Make curve approximators implement common interface --- .../Rulesets/Objects/BezierApproximator.cs | 125 +++++++++--------- .../Rulesets/Objects/CatmullApproximator.cs | 20 +-- .../Objects/CircularArcApproximator.cs | 14 +- osu.Game/Rulesets/Objects/IApproximator.cs | 13 ++ .../Rulesets/Objects/LinearApproximator.cs | 13 ++ 5 files changed, 96 insertions(+), 89 deletions(-) create mode 100644 osu.Game/Rulesets/Objects/IApproximator.cs create mode 100644 osu.Game/Rulesets/Objects/LinearApproximator.cs diff --git a/osu.Game/Rulesets/Objects/BezierApproximator.cs b/osu.Game/Rulesets/Objects/BezierApproximator.cs index a1803e32f7..011526339e 100644 --- a/osu.Game/Rulesets/Objects/BezierApproximator.cs +++ b/osu.Game/Rulesets/Objects/BezierApproximator.cs @@ -1,29 +1,77 @@ // Copyright (c) 2007-2018 ppy Pty Ltd . // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE -using System; using System.Collections.Generic; using OpenTK; namespace osu.Game.Rulesets.Objects { - public readonly ref struct BezierApproximator + public class BezierApproximator : IApproximator { - private readonly int count; - private readonly ReadOnlySpan controlPoints; - private readonly Vector2[] subdivisionBuffer1; - private readonly Vector2[] subdivisionBuffer2; - private const float tolerance = 0.25f; private const float tolerance_sq = tolerance * tolerance; - public BezierApproximator(ReadOnlySpan controlPoints) - { - this.controlPoints = controlPoints; - count = controlPoints.Length; + private int count; + private Vector2[] subdivisionBuffer1; + private Vector2[] subdivisionBuffer2; + /// + /// Creates a piecewise-linear approximation of a bezier curve, by adaptively repeatedly subdividing + /// the control points until their approximation error vanishes below a given threshold. + /// + /// A list of vectors representing the piecewise-linear approximation. + public List Approximate(List controlPoints) + { + count = controlPoints.Count; subdivisionBuffer1 = new Vector2[count]; subdivisionBuffer2 = new Vector2[count * 2 - 1]; + + List output = new List(); + + if (count == 0) + return output; + + Stack toFlatten = new Stack(); + Stack freeBuffers = new Stack(); + + // "toFlatten" contains all the curves which are not yet approximated well enough. + // We use a stack to emulate recursion without the risk of running into a stack overflow. + // (More specifically, we iteratively and adaptively refine our curve with a + // Depth-first search + // over the tree resulting from the subdivisions we make.) + toFlatten.Push(controlPoints.ToArray()); + + Vector2[] leftChild = subdivisionBuffer2; + + while (toFlatten.Count > 0) + { + Vector2[] parent = toFlatten.Pop(); + if (isFlatEnough(parent)) + { + // If the control points we currently operate on are sufficiently "flat", we use + // an extension to De Casteljau's algorithm to obtain a piecewise-linear approximation + // of the bezier curve represented by our control points, consisting of the same amount + // of points as there are control points. + approximate(parent, output); + freeBuffers.Push(parent); + continue; + } + + // If we do not yet have a sufficiently "flat" (in other words, detailed) approximation we keep + // subdividing the curve we are currently operating on. + Vector2[] rightChild = freeBuffers.Count > 0 ? freeBuffers.Pop() : new Vector2[count]; + subdivide(parent, leftChild, rightChild); + + // We re-use the buffer of the parent for one of the children, so that we save one allocation per iteration. + for (int i = 0; i < count; ++i) + parent[i] = leftChild[i]; + + toFlatten.Push(rightChild); + toFlatten.Push(parent); + } + + output.Add(controlPoints[count - 1]); + return output; } /// @@ -92,60 +140,5 @@ namespace osu.Game.Rulesets.Objects output.Add(p); } } - - /// - /// Creates a piecewise-linear approximation of a bezier curve, by adaptively repeatedly subdividing - /// the control points until their approximation error vanishes below a given threshold. - /// - /// A list of vectors representing the piecewise-linear approximation. - public List CreateBezier() - { - List output = new List(); - - if (count == 0) - return output; - - Stack toFlatten = new Stack(); - Stack freeBuffers = new Stack(); - - // "toFlatten" contains all the curves which are not yet approximated well enough. - // We use a stack to emulate recursion without the risk of running into a stack overflow. - // (More specifically, we iteratively and adaptively refine our curve with a - // Depth-first search - // over the tree resulting from the subdivisions we make.) - toFlatten.Push(controlPoints.ToArray()); - - Vector2[] leftChild = subdivisionBuffer2; - - while (toFlatten.Count > 0) - { - Vector2[] parent = toFlatten.Pop(); - if (isFlatEnough(parent)) - { - // If the control points we currently operate on are sufficiently "flat", we use - // an extension to De Casteljau's algorithm to obtain a piecewise-linear approximation - // of the bezier curve represented by our control points, consisting of the same amount - // of points as there are control points. - approximate(parent, output); - freeBuffers.Push(parent); - continue; - } - - // If we do not yet have a sufficiently "flat" (in other words, detailed) approximation we keep - // subdividing the curve we are currently operating on. - Vector2[] rightChild = freeBuffers.Count > 0 ? freeBuffers.Pop() : new Vector2[count]; - subdivide(parent, leftChild, rightChild); - - // We re-use the buffer of the parent for one of the children, so that we save one allocation per iteration. - for (int i = 0; i < count; ++i) - parent[i] = leftChild[i]; - - toFlatten.Push(rightChild); - toFlatten.Push(parent); - } - - output.Add(controlPoints[count - 1]); - return output; - } } } diff --git a/osu.Game/Rulesets/Objects/CatmullApproximator.cs b/osu.Game/Rulesets/Objects/CatmullApproximator.cs index 78f8e471f3..624f5fc9ab 100644 --- a/osu.Game/Rulesets/Objects/CatmullApproximator.cs +++ b/osu.Game/Rulesets/Objects/CatmullApproximator.cs @@ -1,40 +1,32 @@ // Copyright (c) 2007-2018 ppy Pty Ltd . // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE -using System; using System.Collections.Generic; using OpenTK; namespace osu.Game.Rulesets.Objects { - public readonly ref struct CatmullApproximator + public class CatmullApproximator : IApproximator { /// /// The amount of pieces to calculate for each controlpoint quadruplet. /// private const int detail = 50; - private readonly ReadOnlySpan controlPoints; - - public CatmullApproximator(ReadOnlySpan controlPoints) - { - this.controlPoints = controlPoints; - } - /// /// Creates a piecewise-linear approximation of a Catmull-Rom spline. /// /// A list of vectors representing the piecewise-linear approximation. - public List CreateCatmull() + public List Approximate(List controlPoints) { - var result = new List((controlPoints.Length - 1) * detail * 2); + var result = new List(); - for (int i = 0; i < controlPoints.Length - 1; i++) + for (int i = 0; i < controlPoints.Count - 1; i++) { var v1 = i > 0 ? controlPoints[i - 1] : controlPoints[i]; var v2 = controlPoints[i]; - var v3 = i < controlPoints.Length - 1 ? controlPoints[i + 1] : v2 + v2 - v1; - var v4 = i < controlPoints.Length - 2 ? controlPoints[i + 2] : v3 + v3 - v2; + var v3 = i < controlPoints.Count - 1 ? controlPoints[i + 1] : v2 + v2 - v1; + var v4 = i < controlPoints.Count - 2 ? controlPoints[i + 2] : v3 + v3 - v2; for (int c = 0; c < detail; c++) { diff --git a/osu.Game/Rulesets/Objects/CircularArcApproximator.cs b/osu.Game/Rulesets/Objects/CircularArcApproximator.cs index 28d7442aaf..201c6296ba 100644 --- a/osu.Game/Rulesets/Objects/CircularArcApproximator.cs +++ b/osu.Game/Rulesets/Objects/CircularArcApproximator.cs @@ -8,23 +8,19 @@ using OpenTK; namespace osu.Game.Rulesets.Objects { - public readonly ref struct CircularArcApproximator + public class CircularArcApproximator : IApproximator { private const float tolerance = 0.1f; - private readonly ReadOnlySpan controlPoints; - - public CircularArcApproximator(ReadOnlySpan controlPoints) - { - this.controlPoints = controlPoints; - } - /// /// Creates a piecewise-linear approximation of a circular arc curve. /// /// A list of vectors representing the piecewise-linear approximation. - public List CreateArc() + public List Approximate(List controlPoints) { + if (controlPoints.Count != 3) + throw new ArgumentException("Must have 3 control points to perform circular arc approximation.", nameof(controlPoints)); + Vector2 a = controlPoints[0]; Vector2 b = controlPoints[1]; Vector2 c = controlPoints[2]; diff --git a/osu.Game/Rulesets/Objects/IApproximator.cs b/osu.Game/Rulesets/Objects/IApproximator.cs new file mode 100644 index 0000000000..f865172bb4 --- /dev/null +++ b/osu.Game/Rulesets/Objects/IApproximator.cs @@ -0,0 +1,13 @@ +// Copyright (c) 2007-2018 ppy Pty Ltd . +// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE + +using System.Collections.Generic; +using OpenTK; + +namespace osu.Game.Rulesets.Objects +{ + public interface IApproximator + { + List Approximate(List controlPoints); + } +} diff --git a/osu.Game/Rulesets/Objects/LinearApproximator.cs b/osu.Game/Rulesets/Objects/LinearApproximator.cs new file mode 100644 index 0000000000..a2c2dd5a93 --- /dev/null +++ b/osu.Game/Rulesets/Objects/LinearApproximator.cs @@ -0,0 +1,13 @@ +// Copyright (c) 2007-2018 ppy Pty Ltd . +// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE + +using System.Collections.Generic; +using OpenTK; + +namespace osu.Game.Rulesets.Objects +{ + public class LinearApproximator : IApproximator + { + public List Approximate(List controlpoints) => controlpoints; + } +} From 402950b132666db4ca4dea2c20df16731f18f16d Mon Sep 17 00:00:00 2001 From: smoogipoo Date: Thu, 4 Oct 2018 18:24:25 +0900 Subject: [PATCH 344/417] Implement path drawing --- .../Edit/Masks/SliderPlacementMask.cs | 157 +++++++++++++++--- 1 file changed, 135 insertions(+), 22 deletions(-) diff --git a/osu.Game.Rulesets.Osu/Edit/Masks/SliderPlacementMask.cs b/osu.Game.Rulesets.Osu/Edit/Masks/SliderPlacementMask.cs index 287d19ed93..3ee63b1d7b 100644 --- a/osu.Game.Rulesets.Osu/Edit/Masks/SliderPlacementMask.cs +++ b/osu.Game.Rulesets.Osu/Edit/Masks/SliderPlacementMask.cs @@ -2,14 +2,19 @@ // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE using System.Collections.Generic; -using System.Drawing.Imaging; using System.Linq; +using osu.Framework.Allocation; +using osu.Framework.Extensions.IEnumerableExtensions; using osu.Framework.Graphics; +using osu.Framework.Graphics.Lines; using osu.Framework.Input.Events; +using osu.Game.Graphics; using osu.Game.Rulesets.Edit; +using osu.Game.Rulesets.Objects; using osu.Game.Rulesets.Objects.Types; using osu.Game.Rulesets.Osu.Objects; using OpenTK; +using OpenTK.Input; namespace osu.Game.Rulesets.Osu.Edit.Masks { @@ -19,10 +24,12 @@ namespace osu.Game.Rulesets.Osu.Edit.Masks private readonly CirclePlacementMask headMask; private readonly CirclePlacementMask tailMask; + private readonly Path path; - private readonly List controlPoints = new List(); + private readonly List segments = new List(); + private Vector2 cursor; - private PlacementState state = PlacementState.Head; + private PlacementState state; public SliderPlacementMask() : base(new Slider()) @@ -31,22 +38,32 @@ namespace osu.Game.Rulesets.Osu.Edit.Masks InternalChildren = new Drawable[] { + path = new Path { PathWidth = 5 }, headMask = new CirclePlacementMask(), tailMask = new CirclePlacementMask(), }; - setState(PlacementState.Head); + segments.Add(new Segment(Vector2.Zero)); + + setState(PlacementState.Initial); + } + + [BackgroundDependencyLoader] + private void load(OsuColour colours) + { + path.Colour = colours.Yellow; } protected override bool OnMouseMove(MouseMoveEvent e) { switch (state) { - case PlacementState.Head: + case PlacementState.Initial: headMask.Position = e.MousePosition; return true; - case PlacementState.Tail: - tailMask.Position = ToLocalSpace(e.ScreenSpaceMousePosition); + case PlacementState.Body: + tailMask.Position = e.MousePosition; + cursor = tailMask.Position - headMask.Position; return true; } @@ -57,31 +74,84 @@ namespace osu.Game.Rulesets.Osu.Edit.Masks { switch (state) { - case PlacementState.Head: - setState(PlacementState.Tail); - controlPoints.Add(Vector2.Zero); + case PlacementState.Initial: + beginCurve(); break; - case PlacementState.Tail: - controlPoints.Add(tailMask.Position - headMask.Position); - HitObject.Position = headMask.Position; - HitObject.ControlPoints = controlPoints.ToList(); - HitObject.CurveType = CurveType.Linear; - HitObject.Distance = Vector2.Distance(controlPoints.First(), controlPoints.Last()); - Finish(); + case PlacementState.Body: + switch (e.Button) + { + case MouseButton.Left: + segments.Last().ControlPoints.Add(cursor); + break; + } + break; } - return base.OnClick(e); + return true; + } + + protected override bool OnMouseUp(MouseUpEvent e) + { + if (state == PlacementState.Body && e.Button == MouseButton.Right) + endCurve(); + return base.OnMouseUp(e); + } + + protected override bool OnDoubleClick(DoubleClickEvent e) + { + segments.Add(new Segment(segments[segments.Count - 1].ControlPoints.Last())); + return true; + } + + private void beginCurve() + { + setState(PlacementState.Body); + } + + private void endCurve() + { + HitObject.Position = headMask.Position; + HitObject.ControlPoints = segments.SelectMany(s => s.ControlPoints).Concat(cursor.Yield()).ToList(); + HitObject.CurveType = HitObject.ControlPoints.Count > 2 ? CurveType.Bezier : CurveType.Linear; + HitObject.Distance = segments.Sum(s => s.Distance); + + Finish(); + } + + protected override void Update() + { + base.Update(); + + segments.ForEach(s => s.Calculate()); + + switch (state) + { + case PlacementState.Body: + path.Position = headMask.Position; + path.PathWidth = 10; + + path.ClearVertices(); + + for (int i = 0; i < segments.Count; i++) + { + var segmentPath = segments[i].Calculate(i == segments.Count - 1 ? (Vector2?)cursor : null); + segmentPath.ForEach(v => path.AddVertex(v)); + } + + path.OriginPosition = path.PositionInBoundingBox(Vector2.Zero); + break; + } } private void setState(PlacementState newState) { switch (newState) { - case PlacementState.Head: + case PlacementState.Initial: tailMask.Alpha = 0; break; - case PlacementState.Tail: + case PlacementState.Body: tailMask.Alpha = 1; break; } @@ -91,9 +161,52 @@ namespace osu.Game.Rulesets.Osu.Edit.Masks private enum PlacementState { - Head, + Initial, Body, - Tail + } + + private class Segment + { + public float Distance { get; private set; } + + public readonly List ControlPoints = new List(); + public IApproximator Approximator = new LinearApproximator(); + + public Segment(Vector2 offset) + { + ControlPoints.Add(offset); + } + + public List Calculate(Vector2? cursor = null) + { + var allControlPoints = ControlPoints.ToList(); + if (cursor.HasValue) + allControlPoints.Add(cursor.Value); + + IApproximator approximator; + + switch (Approximator) + { + case null: + approximator = new LinearApproximator(); + break; + case LinearApproximator _ when allControlPoints.Count > 2: + case CircularArcApproximator _ when allControlPoints.Count > 3: + approximator = new BezierApproximator(); + break; + default: + approximator = Approximator; + break; + } + + Distance = 0; + + var points = approximator.Approximate(allControlPoints); + for (int i = 0; i < points.Count - 1; i++) + Distance += Vector2.Distance(points[i], points[i + 1]); + + return points; + } } } } From 2c4616dbb1b89a7aec5a0864a9a221c907e6f223 Mon Sep 17 00:00:00 2001 From: smoogipoo Date: Fri, 5 Oct 2018 15:59:37 +0900 Subject: [PATCH 345/417] Adjust visual display of the placement curve --- osu.Game.Rulesets.Osu/Edit/Masks/SliderPlacementMask.cs | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/osu.Game.Rulesets.Osu/Edit/Masks/SliderPlacementMask.cs b/osu.Game.Rulesets.Osu/Edit/Masks/SliderPlacementMask.cs index 3ee63b1d7b..1308b5ae3a 100644 --- a/osu.Game.Rulesets.Osu/Edit/Masks/SliderPlacementMask.cs +++ b/osu.Game.Rulesets.Osu/Edit/Masks/SliderPlacementMask.cs @@ -38,7 +38,7 @@ namespace osu.Game.Rulesets.Osu.Edit.Masks InternalChildren = new Drawable[] { - path = new Path { PathWidth = 5 }, + path = new SmoothPath { PathWidth = 3 }, headMask = new CirclePlacementMask(), tailMask = new CirclePlacementMask(), }; @@ -51,7 +51,7 @@ namespace osu.Game.Rulesets.Osu.Edit.Masks [BackgroundDependencyLoader] private void load(OsuColour colours) { - path.Colour = colours.Yellow; + path.Colour = colours.YellowDark; } protected override bool OnMouseMove(MouseMoveEvent e) @@ -129,8 +129,6 @@ namespace osu.Game.Rulesets.Osu.Edit.Masks { case PlacementState.Body: path.Position = headMask.Position; - path.PathWidth = 10; - path.ClearVertices(); for (int i = 0; i < segments.Count; i++) From 9540e53e32fed8e4e45bce4f00207b233aed08a3 Mon Sep 17 00:00:00 2001 From: smoogipoo Date: Fri, 5 Oct 2018 17:05:39 +0900 Subject: [PATCH 346/417] Initial controlpoint implementation --- .../Edit/Masks/SliderPlacementMask.cs | 19 ++-- .../Masks/SliderPlacementMask_ControlPoint.cs | 95 +++++++++++++++++++ 2 files changed, 106 insertions(+), 8 deletions(-) create mode 100644 osu.Game.Rulesets.Osu/Edit/Masks/SliderPlacementMask_ControlPoint.cs diff --git a/osu.Game.Rulesets.Osu/Edit/Masks/SliderPlacementMask.cs b/osu.Game.Rulesets.Osu/Edit/Masks/SliderPlacementMask.cs index 1308b5ae3a..ec5d09d530 100644 --- a/osu.Game.Rulesets.Osu/Edit/Masks/SliderPlacementMask.cs +++ b/osu.Game.Rulesets.Osu/Edit/Masks/SliderPlacementMask.cs @@ -6,6 +6,7 @@ using System.Linq; using osu.Framework.Allocation; using osu.Framework.Extensions.IEnumerableExtensions; using osu.Framework.Graphics; +using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Lines; using osu.Framework.Input.Events; using osu.Game.Graphics; @@ -27,6 +28,7 @@ namespace osu.Game.Rulesets.Osu.Edit.Masks private readonly Path path; private readonly List segments = new List(); + private readonly Container controlPointContainer; private Vector2 cursor; private PlacementState state; @@ -41,6 +43,7 @@ namespace osu.Game.Rulesets.Osu.Edit.Masks path = new SmoothPath { PathWidth = 3 }, headMask = new CirclePlacementMask(), tailMask = new CirclePlacementMask(), + controlPointContainer = new Container { RelativeSizeAxes = Axes.Both } }; segments.Add(new Segment(Vector2.Zero)); @@ -64,6 +67,7 @@ namespace osu.Game.Rulesets.Osu.Edit.Masks case PlacementState.Body: tailMask.Position = e.MousePosition; cursor = tailMask.Position - headMask.Position; + controlPointContainer.Last().NextPoint = e.MousePosition; return true; } @@ -88,6 +92,8 @@ namespace osu.Game.Rulesets.Osu.Edit.Masks break; } + controlPointContainer.Add(new SliderControlPoint { Position = e.MousePosition }); + return true; } @@ -101,6 +107,7 @@ namespace osu.Game.Rulesets.Osu.Edit.Masks protected override bool OnDoubleClick(DoubleClickEvent e) { segments.Add(new Segment(segments[segments.Count - 1].ControlPoints.Last())); + controlPointContainer.Last().SegmentSeparator = true; return true; } @@ -168,7 +175,6 @@ namespace osu.Game.Rulesets.Osu.Edit.Masks public float Distance { get; private set; } public readonly List ControlPoints = new List(); - public IApproximator Approximator = new LinearApproximator(); public Segment(Vector2 offset) { @@ -183,17 +189,14 @@ namespace osu.Game.Rulesets.Osu.Edit.Masks IApproximator approximator; - switch (Approximator) + switch (allControlPoints.Count) { - case null: + case 1: + case 2: approximator = new LinearApproximator(); break; - case LinearApproximator _ when allControlPoints.Count > 2: - case CircularArcApproximator _ when allControlPoints.Count > 3: - approximator = new BezierApproximator(); - break; default: - approximator = Approximator; + approximator = new BezierApproximator(); break; } diff --git a/osu.Game.Rulesets.Osu/Edit/Masks/SliderPlacementMask_ControlPoint.cs b/osu.Game.Rulesets.Osu/Edit/Masks/SliderPlacementMask_ControlPoint.cs new file mode 100644 index 0000000000..d4aba5c1f5 --- /dev/null +++ b/osu.Game.Rulesets.Osu/Edit/Masks/SliderPlacementMask_ControlPoint.cs @@ -0,0 +1,95 @@ +// Copyright (c) 2007-2018 ppy Pty Ltd . +// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE + +using osu.Framework.Allocation; +using osu.Framework.Caching; +using osu.Framework.Graphics; +using osu.Framework.Graphics.Containers; +using osu.Framework.Graphics.Lines; +using osu.Framework.Graphics.Shapes; +using osu.Game.Graphics; +using OpenTK; + +namespace osu.Game.Rulesets.Osu.Edit.Masks +{ + public partial class SliderPlacementMask + { + /// + /// Todo: Move this out of SliderPlacementMask... + /// + private class SliderControlPoint : CompositeDrawable + { + private readonly Path path; + private readonly CircularContainer marker; + + private OsuColour colours; + + public SliderControlPoint() + { + Size = new Vector2(5); + Origin = Anchor.Centre; + + NextPoint = Position; + + InternalChildren = new Drawable[] + { + path = new SmoothPath + { + BypassAutoSizeAxes = Axes.Both, + Anchor = Anchor.Centre, + PathWidth = 1, + }, + marker = new CircularContainer + { + RelativeSizeAxes = Axes.Both, + Masking = true, + Child = new Box { RelativeSizeAxes = Axes.Both } + } + }; + } + + [BackgroundDependencyLoader] + private void load(OsuColour colours) + { + this.colours = colours; + + marker.Colour = colours.YellowDark; + } + + public bool SegmentSeparator { set => marker.Colour = value ? colours.Red : colours.YellowDark; } + + private Vector2 nextPoint; + + public Vector2 NextPoint + { + set + { + nextPoint = value; + pathCache.Invalidate(); + } + } + + protected override void Update() + { + base.Update(); + + validatePath(); + } + + private Cached pathCache = new Cached(); + + private void validatePath() + { + if (pathCache.IsValid) + return; + + path.ClearVertices(); + path.AddVertex(nextPoint - Position); + path.AddVertex(Vector2.Zero); + path.OriginPosition = path.PositionInBoundingBox(Vector2.Zero); + + pathCache.Validate(); + } + } + } +} From a491fb42df113a8d7c58737d5d0c3cbfbcce2b16 Mon Sep 17 00:00:00 2001 From: smoogipoo Date: Wed, 10 Oct 2018 15:37:42 +0900 Subject: [PATCH 347/417] Set slider start time when head is placed --- osu.Game.Rulesets.Osu/Edit/Masks/SliderPlacementMask.cs | 1 + 1 file changed, 1 insertion(+) diff --git a/osu.Game.Rulesets.Osu/Edit/Masks/SliderPlacementMask.cs b/osu.Game.Rulesets.Osu/Edit/Masks/SliderPlacementMask.cs index ec5d09d530..f48dfeacb4 100644 --- a/osu.Game.Rulesets.Osu/Edit/Masks/SliderPlacementMask.cs +++ b/osu.Game.Rulesets.Osu/Edit/Masks/SliderPlacementMask.cs @@ -113,6 +113,7 @@ namespace osu.Game.Rulesets.Osu.Edit.Masks private void beginCurve() { + HitObject.StartTime = EditorClock.CurrentTime; setState(PlacementState.Body); } From 8fa783b4c56272d1125c66c715d723bafab10fea Mon Sep 17 00:00:00 2001 From: smoogipoo Date: Wed, 17 Oct 2018 18:20:39 +0900 Subject: [PATCH 348/417] Use begin/end placement methods --- osu.Game.Rulesets.Osu/Edit/Masks/SliderPlacementMask.cs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/osu.Game.Rulesets.Osu/Edit/Masks/SliderPlacementMask.cs b/osu.Game.Rulesets.Osu/Edit/Masks/SliderPlacementMask.cs index f48dfeacb4..71093927c2 100644 --- a/osu.Game.Rulesets.Osu/Edit/Masks/SliderPlacementMask.cs +++ b/osu.Game.Rulesets.Osu/Edit/Masks/SliderPlacementMask.cs @@ -113,6 +113,8 @@ namespace osu.Game.Rulesets.Osu.Edit.Masks private void beginCurve() { + BeginPlacement(); + HitObject.StartTime = EditorClock.CurrentTime; setState(PlacementState.Body); } @@ -124,7 +126,7 @@ namespace osu.Game.Rulesets.Osu.Edit.Masks HitObject.CurveType = HitObject.ControlPoints.Count > 2 ? CurveType.Bezier : CurveType.Linear; HitObject.Distance = segments.Sum(s => s.Distance); - Finish(); + EndPlacement(); } protected override void Update() From 6310c183fa93ba604725a12fa31e5db0e2c19f92 Mon Sep 17 00:00:00 2001 From: smoogipoo Date: Wed, 24 Oct 2018 13:42:51 +0900 Subject: [PATCH 349/417] Modify slider position directly --- .../Edit/Masks/SliderPlacementMask.cs | 45 +++++++------------ ...SliderPlacementMask_CirclePlacementMask.cs | 10 ++--- 2 files changed, 20 insertions(+), 35 deletions(-) diff --git a/osu.Game.Rulesets.Osu/Edit/Masks/SliderPlacementMask.cs b/osu.Game.Rulesets.Osu/Edit/Masks/SliderPlacementMask.cs index 71093927c2..f663104acb 100644 --- a/osu.Game.Rulesets.Osu/Edit/Masks/SliderPlacementMask.cs +++ b/osu.Game.Rulesets.Osu/Edit/Masks/SliderPlacementMask.cs @@ -23,12 +23,10 @@ namespace osu.Game.Rulesets.Osu.Edit.Masks { public new Slider HitObject => (Slider)base.HitObject; - private readonly CirclePlacementMask headMask; - private readonly CirclePlacementMask tailMask; - private readonly Path path; + private Path path; + private Container controlPointContainer; private readonly List segments = new List(); - private readonly Container controlPointContainer; private Vector2 cursor; private PlacementState state; @@ -37,24 +35,23 @@ namespace osu.Game.Rulesets.Osu.Edit.Masks : base(new Slider()) { RelativeSizeAxes = Axes.Both; - - InternalChildren = new Drawable[] - { - path = new SmoothPath { PathWidth = 3 }, - headMask = new CirclePlacementMask(), - tailMask = new CirclePlacementMask(), - controlPointContainer = new Container { RelativeSizeAxes = Axes.Both } - }; - segments.Add(new Segment(Vector2.Zero)); - - setState(PlacementState.Initial); } [BackgroundDependencyLoader] private void load(OsuColour colours) { + InternalChildren = new Drawable[] + { + path = new SmoothPath { PathWidth = 3 }, + new CirclePlacementMask(HitObject.HeadCircle), + new CirclePlacementMask(HitObject.TailCircle), + controlPointContainer = new Container { RelativeSizeAxes = Axes.Both } + }; + path.Colour = colours.YellowDark; + + setState(PlacementState.Initial); } protected override bool OnMouseMove(MouseMoveEvent e) @@ -62,11 +59,10 @@ namespace osu.Game.Rulesets.Osu.Edit.Masks switch (state) { case PlacementState.Initial: - headMask.Position = e.MousePosition; + HitObject.Position = e.MousePosition; return true; case PlacementState.Body: - tailMask.Position = e.MousePosition; - cursor = tailMask.Position - headMask.Position; + cursor = e.MousePosition - HitObject.Position; controlPointContainer.Last().NextPoint = e.MousePosition; return true; } @@ -121,7 +117,6 @@ namespace osu.Game.Rulesets.Osu.Edit.Masks private void endCurve() { - HitObject.Position = headMask.Position; HitObject.ControlPoints = segments.SelectMany(s => s.ControlPoints).Concat(cursor.Yield()).ToList(); HitObject.CurveType = HitObject.ControlPoints.Count > 2 ? CurveType.Bezier : CurveType.Linear; HitObject.Distance = segments.Sum(s => s.Distance); @@ -138,7 +133,7 @@ namespace osu.Game.Rulesets.Osu.Edit.Masks switch (state) { case PlacementState.Body: - path.Position = headMask.Position; + path.Position = HitObject.Position; path.ClearVertices(); for (int i = 0; i < segments.Count; i++) @@ -154,16 +149,6 @@ namespace osu.Game.Rulesets.Osu.Edit.Masks private void setState(PlacementState newState) { - switch (newState) - { - case PlacementState.Initial: - tailMask.Alpha = 0; - break; - case PlacementState.Body: - tailMask.Alpha = 1; - break; - } - state = newState; } diff --git a/osu.Game.Rulesets.Osu/Edit/Masks/SliderPlacementMask_CirclePlacementMask.cs b/osu.Game.Rulesets.Osu/Edit/Masks/SliderPlacementMask_CirclePlacementMask.cs index 4a3574c885..390ea50e0d 100644 --- a/osu.Game.Rulesets.Osu/Edit/Masks/SliderPlacementMask_CirclePlacementMask.cs +++ b/osu.Game.Rulesets.Osu/Edit/Masks/SliderPlacementMask_CirclePlacementMask.cs @@ -12,15 +12,15 @@ namespace osu.Game.Rulesets.Osu.Edit.Masks { private class CirclePlacementMask : PlacementMask { - public new HitCircle HitObject => (HitCircle)base.HitObject; - - public CirclePlacementMask() - : base(new HitCircle()) + public CirclePlacementMask(HitCircle hitCircle) + : base(hitCircle) { Origin = Anchor.Centre; AutoSizeAxes = Axes.Both; - InternalChild = new HitCircleMask(HitObject); + InternalChild = new HitCircleMask(hitCircle); + + hitCircle.PositionChanged += _ => Position = hitCircle.StackedPosition; } protected override bool Handle(UIEvent e) => false; From 8b36d9b482352403a173f8cbf859be1ad0135a7f Mon Sep 17 00:00:00 2001 From: smoogipoo Date: Thu, 25 Oct 2018 14:24:50 +0900 Subject: [PATCH 350/417] Remove SliderCurve.Offset (unused) --- osu.Game/Rulesets/Objects/SliderCurve.cs | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/osu.Game/Rulesets/Objects/SliderCurve.cs b/osu.Game/Rulesets/Objects/SliderCurve.cs index dfccdf68f2..124195b033 100644 --- a/osu.Game/Rulesets/Objects/SliderCurve.cs +++ b/osu.Game/Rulesets/Objects/SliderCurve.cs @@ -18,8 +18,6 @@ namespace osu.Game.Rulesets.Objects public CurveType CurveType = CurveType.PerfectCurve; - public Vector2 Offset; - private readonly List calculatedPath = new List(); private readonly List cumulativeLength = new List(); @@ -187,12 +185,12 @@ namespace osu.Game.Rulesets.Objects int i = 0; for (; i < calculatedPath.Count && cumulativeLength[i] < d0; ++i) { } - path.Add(interpolateVertices(i, d0) + Offset); + path.Add(interpolateVertices(i, d0)); for (; i < calculatedPath.Count && cumulativeLength[i] <= d1; ++i) - path.Add(calculatedPath[i] + Offset); + path.Add(calculatedPath[i]); - path.Add(interpolateVertices(i, d1) + Offset); + path.Add(interpolateVertices(i, d1)); } /// @@ -207,7 +205,7 @@ namespace osu.Game.Rulesets.Objects Calculate(); double d = progressToDistance(progress); - return interpolateVertices(indexOfDistance(d), d) + Offset; + return interpolateVertices(indexOfDistance(d), d); } } } From b28f44087d614ecfca8b17fe9498d6fb9b797327 Mon Sep 17 00:00:00 2001 From: smoogipoo Date: Thu, 25 Oct 2018 19:34:35 +0900 Subject: [PATCH 351/417] Bring up to date with further placement changes --- .../TestCaseSliderPlacementMask.cs | 19 ++++ .../Slider/Components/SliderControlPoint.cs | 95 +++++++++++++++++++ .../Masks/{ => Slider}/SliderPlacementMask.cs | 14 +-- .../SliderMasks/Components/SliderBodyPiece.cs | 17 +++- ...SliderPlacementMask_CirclePlacementMask.cs | 29 ------ .../Masks/SliderPlacementMask_ControlPoint.cs | 95 ------------------- .../Edit/Masks/SliderSelectionMask.cs | 67 ------------- ...SliderSelectionMask_CircleSelectionMask.cs | 64 ------------- .../Edit/SliderCompositionTool.cs | 2 +- .../Visual/TestCaseHitObjectComposer.cs | 2 - 10 files changed, 134 insertions(+), 270 deletions(-) create mode 100644 osu.Game.Rulesets.Osu.Tests/TestCaseSliderPlacementMask.cs create mode 100644 osu.Game.Rulesets.Osu/Edit/Masks/Slider/Components/SliderControlPoint.cs rename osu.Game.Rulesets.Osu/Edit/Masks/{ => Slider}/SliderPlacementMask.cs (93%) delete mode 100644 osu.Game.Rulesets.Osu/Edit/Masks/SliderPlacementMask_CirclePlacementMask.cs delete mode 100644 osu.Game.Rulesets.Osu/Edit/Masks/SliderPlacementMask_ControlPoint.cs delete mode 100644 osu.Game.Rulesets.Osu/Edit/Masks/SliderSelectionMask.cs delete mode 100644 osu.Game.Rulesets.Osu/Edit/Masks/SliderSelectionMask_CircleSelectionMask.cs diff --git a/osu.Game.Rulesets.Osu.Tests/TestCaseSliderPlacementMask.cs b/osu.Game.Rulesets.Osu.Tests/TestCaseSliderPlacementMask.cs new file mode 100644 index 0000000000..ad75779d80 --- /dev/null +++ b/osu.Game.Rulesets.Osu.Tests/TestCaseSliderPlacementMask.cs @@ -0,0 +1,19 @@ +// Copyright (c) 2007-2018 ppy Pty Ltd . +// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE + +using osu.Game.Rulesets.Edit; +using osu.Game.Rulesets.Objects; +using osu.Game.Rulesets.Objects.Drawables; +using osu.Game.Rulesets.Osu.Edit.Masks.Slider; +using osu.Game.Rulesets.Osu.Objects; +using osu.Game.Rulesets.Osu.Objects.Drawables; +using osu.Game.Tests.Visual; + +namespace osu.Game.Rulesets.Osu.Tests +{ + public class TestCaseSliderPlacementMask : HitObjectPlacementMaskTestCase + { + protected override DrawableHitObject CreateHitObject(HitObject hitObject) => new DrawableSlider((Slider)hitObject); + protected override PlacementMask CreateMask() => new SliderPlacementMask(); + } +} diff --git a/osu.Game.Rulesets.Osu/Edit/Masks/Slider/Components/SliderControlPoint.cs b/osu.Game.Rulesets.Osu/Edit/Masks/Slider/Components/SliderControlPoint.cs new file mode 100644 index 0000000000..47bae20c30 --- /dev/null +++ b/osu.Game.Rulesets.Osu/Edit/Masks/Slider/Components/SliderControlPoint.cs @@ -0,0 +1,95 @@ +// Copyright (c) 2007-2018 ppy Pty Ltd . +// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE + +using osu.Framework.Allocation; +using osu.Framework.Caching; +using osu.Framework.Graphics; +using osu.Framework.Graphics.Containers; +using osu.Framework.Graphics.Lines; +using osu.Framework.Graphics.Shapes; +using osu.Game.Graphics; +using OpenTK; + +namespace osu.Game.Rulesets.Osu.Edit.Masks.Slider.Components +{ + /// + /// Todo: Move this out of SliderPlacementMask... + /// + public class SliderControlPoint : CompositeDrawable + { + private readonly Path path; + private readonly CircularContainer marker; + + private OsuColour colours; + + public SliderControlPoint() + { + Size = new Vector2(5); + Origin = Anchor.Centre; + + NextPoint = Position; + + InternalChildren = new Drawable[] + { + path = new SmoothPath + { + BypassAutoSizeAxes = Axes.Both, + Anchor = Anchor.Centre, + PathWidth = 1, + }, + marker = new CircularContainer + { + RelativeSizeAxes = Axes.Both, + Masking = true, + Child = new Box { RelativeSizeAxes = Axes.Both } + } + }; + } + + [BackgroundDependencyLoader] + private void load(OsuColour colours) + { + this.colours = colours; + + marker.Colour = colours.YellowDark; + } + + public bool SegmentSeparator + { + set => marker.Colour = value ? colours.Red : colours.YellowDark; + } + + private Vector2 nextPoint; + + public Vector2 NextPoint + { + set + { + nextPoint = value; + pathCache.Invalidate(); + } + } + + protected override void Update() + { + base.Update(); + + validatePath(); + } + + private Cached pathCache = new Cached(); + + private void validatePath() + { + if (pathCache.IsValid) + return; + + path.ClearVertices(); + path.AddVertex(nextPoint - Position); + path.AddVertex(Vector2.Zero); + path.OriginPosition = path.PositionInBoundingBox(Vector2.Zero); + + pathCache.Validate(); + } + } +} diff --git a/osu.Game.Rulesets.Osu/Edit/Masks/SliderPlacementMask.cs b/osu.Game.Rulesets.Osu/Edit/Masks/Slider/SliderPlacementMask.cs similarity index 93% rename from osu.Game.Rulesets.Osu/Edit/Masks/SliderPlacementMask.cs rename to osu.Game.Rulesets.Osu/Edit/Masks/Slider/SliderPlacementMask.cs index f663104acb..f23ab5b4dd 100644 --- a/osu.Game.Rulesets.Osu/Edit/Masks/SliderPlacementMask.cs +++ b/osu.Game.Rulesets.Osu/Edit/Masks/Slider/SliderPlacementMask.cs @@ -13,15 +13,15 @@ using osu.Game.Graphics; using osu.Game.Rulesets.Edit; using osu.Game.Rulesets.Objects; using osu.Game.Rulesets.Objects.Types; -using osu.Game.Rulesets.Osu.Objects; +using osu.Game.Rulesets.Osu.Edit.Masks.Slider.Components; using OpenTK; using OpenTK.Input; -namespace osu.Game.Rulesets.Osu.Edit.Masks +namespace osu.Game.Rulesets.Osu.Edit.Masks.Slider { - public partial class SliderPlacementMask : PlacementMask + public class SliderPlacementMask : PlacementMask { - public new Slider HitObject => (Slider)base.HitObject; + public new Objects.Slider HitObject => (Objects.Slider)base.HitObject; private Path path; private Container controlPointContainer; @@ -32,7 +32,7 @@ namespace osu.Game.Rulesets.Osu.Edit.Masks private PlacementState state; public SliderPlacementMask() - : base(new Slider()) + : base(new Objects.Slider()) { RelativeSizeAxes = Axes.Both; segments.Add(new Segment(Vector2.Zero)); @@ -44,8 +44,8 @@ namespace osu.Game.Rulesets.Osu.Edit.Masks InternalChildren = new Drawable[] { path = new SmoothPath { PathWidth = 3 }, - new CirclePlacementMask(HitObject.HeadCircle), - new CirclePlacementMask(HitObject.TailCircle), + new SliderCirclePiece(HitObject, SliderPosition.Start), + new SliderCirclePiece(HitObject, SliderPosition.End), controlPointContainer = new Container { RelativeSizeAxes = Axes.Both } }; diff --git a/osu.Game.Rulesets.Osu/Edit/Masks/SliderMasks/Components/SliderBodyPiece.cs b/osu.Game.Rulesets.Osu/Edit/Masks/SliderMasks/Components/SliderBodyPiece.cs index 3123a4fcea..141459a0d8 100644 --- a/osu.Game.Rulesets.Osu/Edit/Masks/SliderMasks/Components/SliderBodyPiece.cs +++ b/osu.Game.Rulesets.Osu/Edit/Masks/SliderMasks/Components/SliderBodyPiece.cs @@ -1,11 +1,13 @@ // Copyright (c) 2007-2018 ppy Pty Ltd . // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE +using System.Collections.Generic; using osu.Framework.Allocation; using osu.Framework.Graphics.Containers; using osu.Game.Graphics; using osu.Game.Rulesets.Osu.Objects; using osu.Game.Rulesets.Osu.Objects.Drawables.Pieces; +using OpenTK; using OpenTK.Graphics; namespace osu.Game.Rulesets.Osu.Edit.Masks.SliderMasks.Components @@ -13,12 +15,13 @@ namespace osu.Game.Rulesets.Osu.Edit.Masks.SliderMasks.Components public class SliderBodyPiece : CompositeDrawable { private readonly Slider slider; - private readonly SnakingSliderBody body; + private readonly ManualSliderBody body; public SliderBodyPiece(Slider slider) { this.slider = slider; - InternalChild = body = new SnakingSliderBody(slider) + + InternalChild = body = new ManualSliderBody { AccentColour = Color4.Transparent, PathWidth = slider.Scale * 64 @@ -41,11 +44,15 @@ namespace osu.Game.Rulesets.Osu.Edit.Masks.SliderMasks.Components { base.Update(); + slider.Curve.Calculate(); + + var vertices = new List(); + slider.Curve.GetPathToProgress(vertices, 0, 1); + + body.SetVertices(vertices); + Size = body.Size; OriginPosition = body.PathOffset; - - // Need to cause one update - body.UpdateProgress(0); } } } diff --git a/osu.Game.Rulesets.Osu/Edit/Masks/SliderPlacementMask_CirclePlacementMask.cs b/osu.Game.Rulesets.Osu/Edit/Masks/SliderPlacementMask_CirclePlacementMask.cs deleted file mode 100644 index 390ea50e0d..0000000000 --- a/osu.Game.Rulesets.Osu/Edit/Masks/SliderPlacementMask_CirclePlacementMask.cs +++ /dev/null @@ -1,29 +0,0 @@ -// Copyright (c) 2007-2018 ppy Pty Ltd . -// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE - -using osu.Framework.Graphics; -using osu.Framework.Input.Events; -using osu.Game.Rulesets.Edit; -using osu.Game.Rulesets.Osu.Objects; - -namespace osu.Game.Rulesets.Osu.Edit.Masks -{ - public partial class SliderPlacementMask - { - private class CirclePlacementMask : PlacementMask - { - public CirclePlacementMask(HitCircle hitCircle) - : base(hitCircle) - { - Origin = Anchor.Centre; - AutoSizeAxes = Axes.Both; - - InternalChild = new HitCircleMask(hitCircle); - - hitCircle.PositionChanged += _ => Position = hitCircle.StackedPosition; - } - - protected override bool Handle(UIEvent e) => false; - } - } -} diff --git a/osu.Game.Rulesets.Osu/Edit/Masks/SliderPlacementMask_ControlPoint.cs b/osu.Game.Rulesets.Osu/Edit/Masks/SliderPlacementMask_ControlPoint.cs deleted file mode 100644 index d4aba5c1f5..0000000000 --- a/osu.Game.Rulesets.Osu/Edit/Masks/SliderPlacementMask_ControlPoint.cs +++ /dev/null @@ -1,95 +0,0 @@ -// Copyright (c) 2007-2018 ppy Pty Ltd . -// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE - -using osu.Framework.Allocation; -using osu.Framework.Caching; -using osu.Framework.Graphics; -using osu.Framework.Graphics.Containers; -using osu.Framework.Graphics.Lines; -using osu.Framework.Graphics.Shapes; -using osu.Game.Graphics; -using OpenTK; - -namespace osu.Game.Rulesets.Osu.Edit.Masks -{ - public partial class SliderPlacementMask - { - /// - /// Todo: Move this out of SliderPlacementMask... - /// - private class SliderControlPoint : CompositeDrawable - { - private readonly Path path; - private readonly CircularContainer marker; - - private OsuColour colours; - - public SliderControlPoint() - { - Size = new Vector2(5); - Origin = Anchor.Centre; - - NextPoint = Position; - - InternalChildren = new Drawable[] - { - path = new SmoothPath - { - BypassAutoSizeAxes = Axes.Both, - Anchor = Anchor.Centre, - PathWidth = 1, - }, - marker = new CircularContainer - { - RelativeSizeAxes = Axes.Both, - Masking = true, - Child = new Box { RelativeSizeAxes = Axes.Both } - } - }; - } - - [BackgroundDependencyLoader] - private void load(OsuColour colours) - { - this.colours = colours; - - marker.Colour = colours.YellowDark; - } - - public bool SegmentSeparator { set => marker.Colour = value ? colours.Red : colours.YellowDark; } - - private Vector2 nextPoint; - - public Vector2 NextPoint - { - set - { - nextPoint = value; - pathCache.Invalidate(); - } - } - - protected override void Update() - { - base.Update(); - - validatePath(); - } - - private Cached pathCache = new Cached(); - - private void validatePath() - { - if (pathCache.IsValid) - return; - - path.ClearVertices(); - path.AddVertex(nextPoint - Position); - path.AddVertex(Vector2.Zero); - path.OriginPosition = path.PositionInBoundingBox(Vector2.Zero); - - pathCache.Validate(); - } - } - } -} diff --git a/osu.Game.Rulesets.Osu/Edit/Masks/SliderSelectionMask.cs b/osu.Game.Rulesets.Osu/Edit/Masks/SliderSelectionMask.cs deleted file mode 100644 index 46c807f4b3..0000000000 --- a/osu.Game.Rulesets.Osu/Edit/Masks/SliderSelectionMask.cs +++ /dev/null @@ -1,67 +0,0 @@ -// Copyright (c) 2007-2018 ppy Pty Ltd . -// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE - -using osu.Framework.Allocation; -using osu.Framework.Graphics; -using osu.Framework.Graphics.Primitives; -using osu.Game.Graphics; -using osu.Game.Rulesets.Edit; -using osu.Game.Rulesets.Osu.Objects; -using osu.Game.Rulesets.Osu.Objects.Drawables; -using osu.Game.Rulesets.Osu.Objects.Drawables.Pieces; -using OpenTK; -using OpenTK.Graphics; - -namespace osu.Game.Rulesets.Osu.Edit.Masks -{ - public partial class SliderSelectionMask : SelectionMask - { - private readonly SliderBody body; - private readonly DrawableSlider slider; - - public SliderSelectionMask(DrawableSlider slider) - : base(slider) - { - this.slider = slider; - - Position = slider.Position; - - var sliderObject = (Slider)slider.HitObject; - - InternalChildren = new Drawable[] - { - body = new SliderBody(sliderObject) - { - AccentColour = Color4.Transparent, - PathWidth = sliderObject.Scale * 64 - }, - new CircleSelectionMask(slider.HeadCircle, slider), - new CircleSelectionMask(slider.TailCircle, slider), - }; - - sliderObject.PositionChanged += _ => Position = slider.Position; - } - - [BackgroundDependencyLoader] - private void load(OsuColour colours) - { - body.BorderColour = colours.Yellow; - } - - protected override void Update() - { - base.Update(); - - Size = slider.Size; - OriginPosition = slider.OriginPosition; - - // Need to cause one update - body.UpdateProgress(0); - } - - public override bool ReceivePositionalInputAt(Vector2 screenSpacePos) => body.ReceivePositionalInputAt(screenSpacePos); - - public override Vector2 SelectionPoint => ToScreenSpace(OriginPosition); - public override Quad SelectionQuad => body.PathDrawQuad; - } -} diff --git a/osu.Game.Rulesets.Osu/Edit/Masks/SliderSelectionMask_CircleSelectionMask.cs b/osu.Game.Rulesets.Osu/Edit/Masks/SliderSelectionMask_CircleSelectionMask.cs deleted file mode 100644 index f4d4749343..0000000000 --- a/osu.Game.Rulesets.Osu/Edit/Masks/SliderSelectionMask_CircleSelectionMask.cs +++ /dev/null @@ -1,64 +0,0 @@ -// Copyright (c) 2007-2018 ppy Pty Ltd . -// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE - -using osu.Framework.Allocation; -using osu.Framework.Graphics; -using osu.Game.Graphics; -using osu.Game.Rulesets.Edit; -using osu.Game.Rulesets.Osu.Objects; -using osu.Game.Rulesets.Osu.Objects.Drawables; -using osu.Game.Rulesets.Osu.Objects.Drawables.Pieces; -using OpenTK; - -namespace osu.Game.Rulesets.Osu.Edit.Masks -{ - public partial class SliderSelectionMask - { - private class CircleSelectionMask : SelectionMask - { - public CircleSelectionMask(DrawableHitCircle sliderHead, DrawableSlider slider) - : this(sliderHead, Vector2.Zero, slider) - { - } - - public CircleSelectionMask(DrawableSliderTail sliderTail, DrawableSlider slider) - : this(sliderTail, ((Slider)slider.HitObject).Curve.PositionAt(1), slider) - { - } - - private readonly DrawableOsuHitObject hitObject; - - private CircleSelectionMask(DrawableOsuHitObject hitObject, Vector2 position, DrawableSlider slider) - : base(hitObject) - { - this.hitObject = hitObject; - - Origin = Anchor.Centre; - - Position = position; - Size = slider.HeadCircle.Size; - Scale = slider.HeadCircle.Scale; - - AddInternal(new RingPiece()); - - Select(); - } - - [BackgroundDependencyLoader] - private void load(OsuColour colours) - { - Colour = colours.Yellow; - } - - protected override void Update() - { - base.Update(); - - RelativeAnchorPosition = hitObject.RelativeAnchorPosition; - } - - // Todo: This is temporary, since the slider circle masks don't do anything special yet. In the future they will handle input. - public override bool HandlePositionalInput => false; - } - } -} diff --git a/osu.Game.Rulesets.Osu/Edit/SliderCompositionTool.cs b/osu.Game.Rulesets.Osu/Edit/SliderCompositionTool.cs index f7cdd76655..30ebc51179 100644 --- a/osu.Game.Rulesets.Osu/Edit/SliderCompositionTool.cs +++ b/osu.Game.Rulesets.Osu/Edit/SliderCompositionTool.cs @@ -3,7 +3,7 @@ using osu.Game.Rulesets.Edit; using osu.Game.Rulesets.Edit.Tools; -using osu.Game.Rulesets.Osu.Edit.Masks; +using osu.Game.Rulesets.Osu.Edit.Masks.Slider; using osu.Game.Rulesets.Osu.Objects; namespace osu.Game.Rulesets.Osu.Edit diff --git a/osu.Game.Tests/Visual/TestCaseHitObjectComposer.cs b/osu.Game.Tests/Visual/TestCaseHitObjectComposer.cs index 196cb9320a..61647ffdc5 100644 --- a/osu.Game.Tests/Visual/TestCaseHitObjectComposer.cs +++ b/osu.Game.Tests/Visual/TestCaseHitObjectComposer.cs @@ -37,8 +37,6 @@ namespace osu.Game.Tests.Visual typeof(HitCirclePiece), typeof(HitCircleSelectionMask), typeof(HitCirclePlacementMask), - typeof(SliderSelectionMask), - typeof(SliderPlacementMask) }; private HitObjectComposer composer; From e964a555d0bdf4a4ad1f7f5a7553c88ef8caa00b Mon Sep 17 00:00:00 2001 From: smoogipoo Date: Thu, 25 Oct 2018 19:34:49 +0900 Subject: [PATCH 352/417] Fix DummyWorkingBeatmap having unrealistic defaults --- osu.Game/Beatmaps/DummyWorkingBeatmap.cs | 10 +--------- 1 file changed, 1 insertion(+), 9 deletions(-) diff --git a/osu.Game/Beatmaps/DummyWorkingBeatmap.cs b/osu.Game/Beatmaps/DummyWorkingBeatmap.cs index 25a76b52a7..5c129f76ec 100644 --- a/osu.Game/Beatmaps/DummyWorkingBeatmap.cs +++ b/osu.Game/Beatmaps/DummyWorkingBeatmap.cs @@ -26,15 +26,7 @@ namespace osu.Game.Beatmaps Title = "no beatmaps available!" }, BeatmapSet = new BeatmapSetInfo(), - BaseDifficulty = new BeatmapDifficulty - { - DrainRate = 0, - CircleSize = 0, - OverallDifficulty = 0, - ApproachRate = 0, - SliderMultiplier = 0, - SliderTickRate = 0, - }, + BaseDifficulty = new BeatmapDifficulty(), Ruleset = new DummyRulesetInfo() }) { From 4fa511043e8f708ddce9df6a1e18b62096f81de2 Mon Sep 17 00:00:00 2001 From: smoogipoo Date: Thu, 25 Oct 2018 19:38:00 +0900 Subject: [PATCH 353/417] Use common body piece --- .../Edit/Masks/Slider/SliderPlacementMask.cs | 27 +++++-------------- 1 file changed, 6 insertions(+), 21 deletions(-) diff --git a/osu.Game.Rulesets.Osu/Edit/Masks/Slider/SliderPlacementMask.cs b/osu.Game.Rulesets.Osu/Edit/Masks/Slider/SliderPlacementMask.cs index f23ab5b4dd..94ac8208f4 100644 --- a/osu.Game.Rulesets.Osu/Edit/Masks/Slider/SliderPlacementMask.cs +++ b/osu.Game.Rulesets.Osu/Edit/Masks/Slider/SliderPlacementMask.cs @@ -7,7 +7,6 @@ using osu.Framework.Allocation; using osu.Framework.Extensions.IEnumerableExtensions; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; -using osu.Framework.Graphics.Lines; using osu.Framework.Input.Events; using osu.Game.Graphics; using osu.Game.Rulesets.Edit; @@ -23,7 +22,6 @@ namespace osu.Game.Rulesets.Osu.Edit.Masks.Slider { public new Objects.Slider HitObject => (Objects.Slider)base.HitObject; - private Path path; private Container controlPointContainer; private readonly List segments = new List(); @@ -43,14 +41,12 @@ namespace osu.Game.Rulesets.Osu.Edit.Masks.Slider { InternalChildren = new Drawable[] { - path = new SmoothPath { PathWidth = 3 }, + new BodyPiece(HitObject), new SliderCirclePiece(HitObject, SliderPosition.Start), new SliderCirclePiece(HitObject, SliderPosition.End), controlPointContainer = new Container { RelativeSizeAxes = Axes.Both } }; - path.Colour = colours.YellowDark; - setState(PlacementState.Initial); } @@ -128,23 +124,12 @@ namespace osu.Game.Rulesets.Osu.Edit.Masks.Slider { base.Update(); - segments.ForEach(s => s.Calculate()); + for (int i = 0; i < segments.Count; i++) + segments[i].Calculate(i == segments.Count - 1 ? (Vector2?)cursor : null); - switch (state) - { - case PlacementState.Body: - path.Position = HitObject.Position; - path.ClearVertices(); - - for (int i = 0; i < segments.Count; i++) - { - var segmentPath = segments[i].Calculate(i == segments.Count - 1 ? (Vector2?)cursor : null); - segmentPath.ForEach(v => path.AddVertex(v)); - } - - path.OriginPosition = path.PositionInBoundingBox(Vector2.Zero); - break; - } + HitObject.ControlPoints = segments.SelectMany(s => s.ControlPoints).Concat(cursor.Yield()).ToList(); + HitObject.CurveType = HitObject.ControlPoints.Count > 2 ? CurveType.Bezier : CurveType.Linear; + HitObject.Distance = segments.Sum(s => s.Distance); } private void setState(PlacementState newState) From a9f1484e8b2f1a413283893e1da578db592276b2 Mon Sep 17 00:00:00 2001 From: smoogipoo Date: Fri, 26 Oct 2018 14:18:48 +0900 Subject: [PATCH 354/417] Fix some post-rebase issues --- .../TestCaseSliderPlacementMask.cs | 2 +- .../Components/SliderControlPoint.cs | 2 +- .../SliderPlacementMask.cs | 40 +++--- .../Edit/SliderCompositionTool.cs | 2 +- .../Rulesets/Objects/BezierApproximator.cs | 125 +++++++++--------- .../Rulesets/Objects/CatmullApproximator.cs | 20 ++- .../Objects/CircularArcApproximator.cs | 14 +- osu.Game/Rulesets/Objects/IApproximator.cs | 13 -- .../Rulesets/Objects/LinearApproximator.cs | 20 ++- osu.Game/Rulesets/Objects/SliderCurve.cs | 18 ++- 10 files changed, 138 insertions(+), 118 deletions(-) rename osu.Game.Rulesets.Osu/Edit/Masks/{Slider => SliderMasks}/Components/SliderControlPoint.cs (97%) rename osu.Game.Rulesets.Osu/Edit/Masks/{Slider => SliderMasks}/SliderPlacementMask.cs (79%) delete mode 100644 osu.Game/Rulesets/Objects/IApproximator.cs diff --git a/osu.Game.Rulesets.Osu.Tests/TestCaseSliderPlacementMask.cs b/osu.Game.Rulesets.Osu.Tests/TestCaseSliderPlacementMask.cs index ad75779d80..889ea0c311 100644 --- a/osu.Game.Rulesets.Osu.Tests/TestCaseSliderPlacementMask.cs +++ b/osu.Game.Rulesets.Osu.Tests/TestCaseSliderPlacementMask.cs @@ -4,7 +4,7 @@ using osu.Game.Rulesets.Edit; using osu.Game.Rulesets.Objects; using osu.Game.Rulesets.Objects.Drawables; -using osu.Game.Rulesets.Osu.Edit.Masks.Slider; +using osu.Game.Rulesets.Osu.Edit.Masks.SliderMasks; using osu.Game.Rulesets.Osu.Objects; using osu.Game.Rulesets.Osu.Objects.Drawables; using osu.Game.Tests.Visual; diff --git a/osu.Game.Rulesets.Osu/Edit/Masks/Slider/Components/SliderControlPoint.cs b/osu.Game.Rulesets.Osu/Edit/Masks/SliderMasks/Components/SliderControlPoint.cs similarity index 97% rename from osu.Game.Rulesets.Osu/Edit/Masks/Slider/Components/SliderControlPoint.cs rename to osu.Game.Rulesets.Osu/Edit/Masks/SliderMasks/Components/SliderControlPoint.cs index 47bae20c30..7d2f94a82d 100644 --- a/osu.Game.Rulesets.Osu/Edit/Masks/Slider/Components/SliderControlPoint.cs +++ b/osu.Game.Rulesets.Osu/Edit/Masks/SliderMasks/Components/SliderControlPoint.cs @@ -10,7 +10,7 @@ using osu.Framework.Graphics.Shapes; using osu.Game.Graphics; using OpenTK; -namespace osu.Game.Rulesets.Osu.Edit.Masks.Slider.Components +namespace osu.Game.Rulesets.Osu.Edit.Masks.SliderMasks.Components { /// /// Todo: Move this out of SliderPlacementMask... diff --git a/osu.Game.Rulesets.Osu/Edit/Masks/Slider/SliderPlacementMask.cs b/osu.Game.Rulesets.Osu/Edit/Masks/SliderMasks/SliderPlacementMask.cs similarity index 79% rename from osu.Game.Rulesets.Osu/Edit/Masks/Slider/SliderPlacementMask.cs rename to osu.Game.Rulesets.Osu/Edit/Masks/SliderMasks/SliderPlacementMask.cs index 94ac8208f4..2ee996fb00 100644 --- a/osu.Game.Rulesets.Osu/Edit/Masks/Slider/SliderPlacementMask.cs +++ b/osu.Game.Rulesets.Osu/Edit/Masks/SliderMasks/SliderPlacementMask.cs @@ -1,6 +1,7 @@ // Copyright (c) 2007-2018 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 osu.Framework.Allocation; @@ -12,11 +13,11 @@ using osu.Game.Graphics; using osu.Game.Rulesets.Edit; using osu.Game.Rulesets.Objects; using osu.Game.Rulesets.Objects.Types; -using osu.Game.Rulesets.Osu.Edit.Masks.Slider.Components; +using osu.Game.Rulesets.Osu.Edit.Masks.SliderMasks.Components; using OpenTK; using OpenTK.Input; -namespace osu.Game.Rulesets.Osu.Edit.Masks.Slider +namespace osu.Game.Rulesets.Osu.Edit.Masks.SliderMasks { public class SliderPlacementMask : PlacementMask { @@ -41,7 +42,7 @@ namespace osu.Game.Rulesets.Osu.Edit.Masks.Slider { InternalChildren = new Drawable[] { - new BodyPiece(HitObject), + new SliderBodyPiece(HitObject), new SliderCirclePiece(HitObject, SliderPosition.Start), new SliderCirclePiece(HitObject, SliderPosition.End), controlPointContainer = new Container { RelativeSizeAxes = Axes.Both } @@ -113,8 +114,8 @@ namespace osu.Game.Rulesets.Osu.Edit.Masks.Slider private void endCurve() { - HitObject.ControlPoints = segments.SelectMany(s => s.ControlPoints).Concat(cursor.Yield()).ToList(); - HitObject.CurveType = HitObject.ControlPoints.Count > 2 ? CurveType.Bezier : CurveType.Linear; + HitObject.ControlPoints = segments.SelectMany(s => s.ControlPoints).Concat(cursor.Yield()).ToArray(); + HitObject.CurveType = HitObject.ControlPoints.Length > 2 ? CurveType.Bezier : CurveType.Linear; HitObject.Distance = segments.Sum(s => s.Distance); EndPlacement(); @@ -127,8 +128,8 @@ namespace osu.Game.Rulesets.Osu.Edit.Masks.Slider for (int i = 0; i < segments.Count; i++) segments[i].Calculate(i == segments.Count - 1 ? (Vector2?)cursor : null); - HitObject.ControlPoints = segments.SelectMany(s => s.ControlPoints).Concat(cursor.Yield()).ToList(); - HitObject.CurveType = HitObject.ControlPoints.Count > 2 ? CurveType.Bezier : CurveType.Linear; + HitObject.ControlPoints = segments.SelectMany(s => s.ControlPoints).Concat(cursor.Yield()).ToArray(); + HitObject.CurveType = HitObject.ControlPoints.Length > 2 ? CurveType.Bezier : CurveType.Linear; HitObject.Distance = segments.Sum(s => s.Distance); } @@ -154,32 +155,31 @@ namespace osu.Game.Rulesets.Osu.Edit.Masks.Slider ControlPoints.Add(offset); } - public List Calculate(Vector2? cursor = null) + public void Calculate(Vector2? cursor = null) { - var allControlPoints = ControlPoints.ToList(); + Span allControlPoints = stackalloc Vector2[ControlPoints.Count + (cursor.HasValue ? 1 : 0)]; + + for (int i = 0; i < ControlPoints.Count; i++) + allControlPoints[i] = ControlPoints[i]; if (cursor.HasValue) - allControlPoints.Add(cursor.Value); + allControlPoints[allControlPoints.Length - 1] = cursor.Value; - IApproximator approximator; + List result; - switch (allControlPoints.Count) + switch (allControlPoints.Length) { case 1: case 2: - approximator = new LinearApproximator(); + result = new LinearApproximator(allControlPoints).CreateLinear(); break; default: - approximator = new BezierApproximator(); + result = new BezierApproximator(allControlPoints).CreateBezier(); break; } Distance = 0; - - var points = approximator.Approximate(allControlPoints); - for (int i = 0; i < points.Count - 1; i++) - Distance += Vector2.Distance(points[i], points[i + 1]); - - return points; + for (int i = 0; i < result.Count - 1; i++) + Distance += Vector2.Distance(result[i], result[i + 1]); } } } diff --git a/osu.Game.Rulesets.Osu/Edit/SliderCompositionTool.cs b/osu.Game.Rulesets.Osu/Edit/SliderCompositionTool.cs index 30ebc51179..fd0430ce4c 100644 --- a/osu.Game.Rulesets.Osu/Edit/SliderCompositionTool.cs +++ b/osu.Game.Rulesets.Osu/Edit/SliderCompositionTool.cs @@ -3,7 +3,7 @@ using osu.Game.Rulesets.Edit; using osu.Game.Rulesets.Edit.Tools; -using osu.Game.Rulesets.Osu.Edit.Masks.Slider; +using osu.Game.Rulesets.Osu.Edit.Masks.SliderMasks; using osu.Game.Rulesets.Osu.Objects; namespace osu.Game.Rulesets.Osu.Edit diff --git a/osu.Game/Rulesets/Objects/BezierApproximator.cs b/osu.Game/Rulesets/Objects/BezierApproximator.cs index 011526339e..a1803e32f7 100644 --- a/osu.Game/Rulesets/Objects/BezierApproximator.cs +++ b/osu.Game/Rulesets/Objects/BezierApproximator.cs @@ -1,77 +1,29 @@ // Copyright (c) 2007-2018 ppy Pty Ltd . // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE +using System; using System.Collections.Generic; using OpenTK; namespace osu.Game.Rulesets.Objects { - public class BezierApproximator : IApproximator + public readonly ref struct BezierApproximator { + private readonly int count; + private readonly ReadOnlySpan controlPoints; + private readonly Vector2[] subdivisionBuffer1; + private readonly Vector2[] subdivisionBuffer2; + private const float tolerance = 0.25f; private const float tolerance_sq = tolerance * tolerance; - private int count; - private Vector2[] subdivisionBuffer1; - private Vector2[] subdivisionBuffer2; - - /// - /// Creates a piecewise-linear approximation of a bezier curve, by adaptively repeatedly subdividing - /// the control points until their approximation error vanishes below a given threshold. - /// - /// A list of vectors representing the piecewise-linear approximation. - public List Approximate(List controlPoints) + public BezierApproximator(ReadOnlySpan controlPoints) { - count = controlPoints.Count; + this.controlPoints = controlPoints; + count = controlPoints.Length; + subdivisionBuffer1 = new Vector2[count]; subdivisionBuffer2 = new Vector2[count * 2 - 1]; - - List output = new List(); - - if (count == 0) - return output; - - Stack toFlatten = new Stack(); - Stack freeBuffers = new Stack(); - - // "toFlatten" contains all the curves which are not yet approximated well enough. - // We use a stack to emulate recursion without the risk of running into a stack overflow. - // (More specifically, we iteratively and adaptively refine our curve with a - // Depth-first search - // over the tree resulting from the subdivisions we make.) - toFlatten.Push(controlPoints.ToArray()); - - Vector2[] leftChild = subdivisionBuffer2; - - while (toFlatten.Count > 0) - { - Vector2[] parent = toFlatten.Pop(); - if (isFlatEnough(parent)) - { - // If the control points we currently operate on are sufficiently "flat", we use - // an extension to De Casteljau's algorithm to obtain a piecewise-linear approximation - // of the bezier curve represented by our control points, consisting of the same amount - // of points as there are control points. - approximate(parent, output); - freeBuffers.Push(parent); - continue; - } - - // If we do not yet have a sufficiently "flat" (in other words, detailed) approximation we keep - // subdividing the curve we are currently operating on. - Vector2[] rightChild = freeBuffers.Count > 0 ? freeBuffers.Pop() : new Vector2[count]; - subdivide(parent, leftChild, rightChild); - - // We re-use the buffer of the parent for one of the children, so that we save one allocation per iteration. - for (int i = 0; i < count; ++i) - parent[i] = leftChild[i]; - - toFlatten.Push(rightChild); - toFlatten.Push(parent); - } - - output.Add(controlPoints[count - 1]); - return output; } /// @@ -140,5 +92,60 @@ namespace osu.Game.Rulesets.Objects output.Add(p); } } + + /// + /// Creates a piecewise-linear approximation of a bezier curve, by adaptively repeatedly subdividing + /// the control points until their approximation error vanishes below a given threshold. + /// + /// A list of vectors representing the piecewise-linear approximation. + public List CreateBezier() + { + List output = new List(); + + if (count == 0) + return output; + + Stack toFlatten = new Stack(); + Stack freeBuffers = new Stack(); + + // "toFlatten" contains all the curves which are not yet approximated well enough. + // We use a stack to emulate recursion without the risk of running into a stack overflow. + // (More specifically, we iteratively and adaptively refine our curve with a + // Depth-first search + // over the tree resulting from the subdivisions we make.) + toFlatten.Push(controlPoints.ToArray()); + + Vector2[] leftChild = subdivisionBuffer2; + + while (toFlatten.Count > 0) + { + Vector2[] parent = toFlatten.Pop(); + if (isFlatEnough(parent)) + { + // If the control points we currently operate on are sufficiently "flat", we use + // an extension to De Casteljau's algorithm to obtain a piecewise-linear approximation + // of the bezier curve represented by our control points, consisting of the same amount + // of points as there are control points. + approximate(parent, output); + freeBuffers.Push(parent); + continue; + } + + // If we do not yet have a sufficiently "flat" (in other words, detailed) approximation we keep + // subdividing the curve we are currently operating on. + Vector2[] rightChild = freeBuffers.Count > 0 ? freeBuffers.Pop() : new Vector2[count]; + subdivide(parent, leftChild, rightChild); + + // We re-use the buffer of the parent for one of the children, so that we save one allocation per iteration. + for (int i = 0; i < count; ++i) + parent[i] = leftChild[i]; + + toFlatten.Push(rightChild); + toFlatten.Push(parent); + } + + output.Add(controlPoints[count - 1]); + return output; + } } } diff --git a/osu.Game/Rulesets/Objects/CatmullApproximator.cs b/osu.Game/Rulesets/Objects/CatmullApproximator.cs index 624f5fc9ab..78f8e471f3 100644 --- a/osu.Game/Rulesets/Objects/CatmullApproximator.cs +++ b/osu.Game/Rulesets/Objects/CatmullApproximator.cs @@ -1,32 +1,40 @@ // Copyright (c) 2007-2018 ppy Pty Ltd . // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE +using System; using System.Collections.Generic; using OpenTK; namespace osu.Game.Rulesets.Objects { - public class CatmullApproximator : IApproximator + public readonly ref struct CatmullApproximator { /// /// The amount of pieces to calculate for each controlpoint quadruplet. /// private const int detail = 50; + private readonly ReadOnlySpan controlPoints; + + public CatmullApproximator(ReadOnlySpan controlPoints) + { + this.controlPoints = controlPoints; + } + /// /// Creates a piecewise-linear approximation of a Catmull-Rom spline. /// /// A list of vectors representing the piecewise-linear approximation. - public List Approximate(List controlPoints) + public List CreateCatmull() { - var result = new List(); + var result = new List((controlPoints.Length - 1) * detail * 2); - for (int i = 0; i < controlPoints.Count - 1; i++) + for (int i = 0; i < controlPoints.Length - 1; i++) { var v1 = i > 0 ? controlPoints[i - 1] : controlPoints[i]; var v2 = controlPoints[i]; - var v3 = i < controlPoints.Count - 1 ? controlPoints[i + 1] : v2 + v2 - v1; - var v4 = i < controlPoints.Count - 2 ? controlPoints[i + 2] : v3 + v3 - v2; + var v3 = i < controlPoints.Length - 1 ? controlPoints[i + 1] : v2 + v2 - v1; + var v4 = i < controlPoints.Length - 2 ? controlPoints[i + 2] : v3 + v3 - v2; for (int c = 0; c < detail; c++) { diff --git a/osu.Game/Rulesets/Objects/CircularArcApproximator.cs b/osu.Game/Rulesets/Objects/CircularArcApproximator.cs index 201c6296ba..28d7442aaf 100644 --- a/osu.Game/Rulesets/Objects/CircularArcApproximator.cs +++ b/osu.Game/Rulesets/Objects/CircularArcApproximator.cs @@ -8,19 +8,23 @@ using OpenTK; namespace osu.Game.Rulesets.Objects { - public class CircularArcApproximator : IApproximator + public readonly ref struct CircularArcApproximator { private const float tolerance = 0.1f; + private readonly ReadOnlySpan controlPoints; + + public CircularArcApproximator(ReadOnlySpan controlPoints) + { + this.controlPoints = controlPoints; + } + /// /// Creates a piecewise-linear approximation of a circular arc curve. /// /// A list of vectors representing the piecewise-linear approximation. - public List Approximate(List controlPoints) + public List CreateArc() { - if (controlPoints.Count != 3) - throw new ArgumentException("Must have 3 control points to perform circular arc approximation.", nameof(controlPoints)); - Vector2 a = controlPoints[0]; Vector2 b = controlPoints[1]; Vector2 c = controlPoints[2]; diff --git a/osu.Game/Rulesets/Objects/IApproximator.cs b/osu.Game/Rulesets/Objects/IApproximator.cs deleted file mode 100644 index f865172bb4..0000000000 --- a/osu.Game/Rulesets/Objects/IApproximator.cs +++ /dev/null @@ -1,13 +0,0 @@ -// Copyright (c) 2007-2018 ppy Pty Ltd . -// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE - -using System.Collections.Generic; -using OpenTK; - -namespace osu.Game.Rulesets.Objects -{ - public interface IApproximator - { - List Approximate(List controlPoints); - } -} diff --git a/osu.Game/Rulesets/Objects/LinearApproximator.cs b/osu.Game/Rulesets/Objects/LinearApproximator.cs index a2c2dd5a93..c513d40ad6 100644 --- a/osu.Game/Rulesets/Objects/LinearApproximator.cs +++ b/osu.Game/Rulesets/Objects/LinearApproximator.cs @@ -1,13 +1,29 @@ // Copyright (c) 2007-2018 ppy Pty Ltd . // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE +using System; using System.Collections.Generic; using OpenTK; namespace osu.Game.Rulesets.Objects { - public class LinearApproximator : IApproximator + public readonly ref struct LinearApproximator { - public List Approximate(List controlpoints) => controlpoints; + private readonly ReadOnlySpan controlPoints; + + public LinearApproximator(ReadOnlySpan controlPoints) + { + this.controlPoints = controlPoints; + } + + public List CreateLinear() + { + var result = new List(controlPoints.Length); + + foreach (var c in controlPoints) + result.Add(c); + + return result; + } } } diff --git a/osu.Game/Rulesets/Objects/SliderCurve.cs b/osu.Game/Rulesets/Objects/SliderCurve.cs index 124195b033..e3c9c53a2b 100644 --- a/osu.Game/Rulesets/Objects/SliderCurve.cs +++ b/osu.Game/Rulesets/Objects/SliderCurve.cs @@ -14,10 +14,12 @@ namespace osu.Game.Rulesets.Objects { public double Distance; - public Vector2[] ControlPoints; + public Vector2[] ControlPoints = Array.Empty(); public CurveType CurveType = CurveType.PerfectCurve; + public Vector2 Offset; + private readonly List calculatedPath = new List(); private readonly List cumulativeLength = new List(); @@ -26,11 +28,7 @@ namespace osu.Game.Rulesets.Objects switch (CurveType) { case CurveType.Linear: - var result = new List(subControlPoints.Length); - foreach (var c in subControlPoints) - result.Add(c); - - return result; + return new LinearApproximator(subControlPoints).CreateLinear(); case CurveType.PerfectCurve: //we can only use CircularArc iff we have exactly three control points and no dissection. if (ControlPoints.Length != 3 || subControlPoints.Length != 3) @@ -185,12 +183,12 @@ namespace osu.Game.Rulesets.Objects int i = 0; for (; i < calculatedPath.Count && cumulativeLength[i] < d0; ++i) { } - path.Add(interpolateVertices(i, d0)); + path.Add(interpolateVertices(i, d0) + Offset); for (; i < calculatedPath.Count && cumulativeLength[i] <= d1; ++i) - path.Add(calculatedPath[i]); + path.Add(calculatedPath[i] + Offset); - path.Add(interpolateVertices(i, d1)); + path.Add(interpolateVertices(i, d1) + Offset); } /// @@ -205,7 +203,7 @@ namespace osu.Game.Rulesets.Objects Calculate(); double d = progressToDistance(progress); - return interpolateVertices(indexOfDistance(d), d); + return interpolateVertices(indexOfDistance(d), d) + Offset; } } } From 660cd247502dd0663f5e220f2cf6ac74b3004e70 Mon Sep 17 00:00:00 2001 From: smoogipoo Date: Fri, 26 Oct 2018 15:33:21 +0900 Subject: [PATCH 355/417] Make sliders respond to scale changes --- .../Edit/Masks/SliderMasks/Components/SliderBodyPiece.cs | 1 + .../Edit/Masks/SliderMasks/Components/SliderControlPoint.cs | 3 --- osu.Game.Rulesets.Osu/Objects/Drawables/DrawableSlider.cs | 5 +++++ 3 files changed, 6 insertions(+), 3 deletions(-) diff --git a/osu.Game.Rulesets.Osu/Edit/Masks/SliderMasks/Components/SliderBodyPiece.cs b/osu.Game.Rulesets.Osu/Edit/Masks/SliderMasks/Components/SliderBodyPiece.cs index 141459a0d8..78ef42872e 100644 --- a/osu.Game.Rulesets.Osu/Edit/Masks/SliderMasks/Components/SliderBodyPiece.cs +++ b/osu.Game.Rulesets.Osu/Edit/Masks/SliderMasks/Components/SliderBodyPiece.cs @@ -28,6 +28,7 @@ namespace osu.Game.Rulesets.Osu.Edit.Masks.SliderMasks.Components }; slider.PositionChanged += _ => updatePosition(); + slider.ScaleChanged += _ => body.PathWidth = slider.Scale * 64; } [BackgroundDependencyLoader] diff --git a/osu.Game.Rulesets.Osu/Edit/Masks/SliderMasks/Components/SliderControlPoint.cs b/osu.Game.Rulesets.Osu/Edit/Masks/SliderMasks/Components/SliderControlPoint.cs index 7d2f94a82d..e9693e7a3c 100644 --- a/osu.Game.Rulesets.Osu/Edit/Masks/SliderMasks/Components/SliderControlPoint.cs +++ b/osu.Game.Rulesets.Osu/Edit/Masks/SliderMasks/Components/SliderControlPoint.cs @@ -12,9 +12,6 @@ using OpenTK; namespace osu.Game.Rulesets.Osu.Edit.Masks.SliderMasks.Components { - /// - /// Todo: Move this out of SliderPlacementMask... - /// public class SliderControlPoint : CompositeDrawable { private readonly Path path; diff --git a/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableSlider.cs b/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableSlider.cs index 16bd522c1d..7f708ec182 100644 --- a/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableSlider.cs +++ b/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableSlider.cs @@ -85,6 +85,11 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables } HitObject.PositionChanged += _ => Position = HitObject.StackedPosition; + HitObject.ScaleChanged += _ => + { + Body.PathWidth = HitObject.Scale * 64; + Ball.Scale = new Vector2(HitObject.Scale); + }; } public override Color4 AccentColour From b0f5ace0e88b07ee34bbb2ed2020fa0e7ce64b33 Mon Sep 17 00:00:00 2001 From: smoogipoo Date: Mon, 29 Oct 2018 14:07:06 +0900 Subject: [PATCH 356/417] Implement slider control point visualisation --- .../TestCaseSliderSelectionMask.cs | 13 +++ .../Components/ControlPointPiece.cs | 90 +++++++++++++++++++ .../Components/ControlPointVisualiser.cs | 34 +++++++ .../Masks/SliderMasks/SliderSelectionMask.cs | 1 + osu.Game.Rulesets.Osu/Objects/Slider.cs | 13 ++- 5 files changed, 149 insertions(+), 2 deletions(-) create mode 100644 osu.Game.Rulesets.Osu/Edit/Masks/SliderMasks/Components/ControlPointPiece.cs create mode 100644 osu.Game.Rulesets.Osu/Edit/Masks/SliderMasks/Components/ControlPointVisualiser.cs diff --git a/osu.Game.Rulesets.Osu.Tests/TestCaseSliderSelectionMask.cs b/osu.Game.Rulesets.Osu.Tests/TestCaseSliderSelectionMask.cs index 5e68d5cdc9..a73cb69536 100644 --- a/osu.Game.Rulesets.Osu.Tests/TestCaseSliderSelectionMask.cs +++ b/osu.Game.Rulesets.Osu.Tests/TestCaseSliderSelectionMask.cs @@ -1,11 +1,14 @@ // Copyright (c) 2007-2018 ppy Pty Ltd . // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE +using System; +using System.Collections.Generic; using osu.Game.Beatmaps; using osu.Game.Beatmaps.ControlPoints; using osu.Game.Rulesets.Edit; using osu.Game.Rulesets.Objects.Types; using osu.Game.Rulesets.Osu.Edit.Masks.SliderMasks; +using osu.Game.Rulesets.Osu.Edit.Masks.SliderMasks.Components; using osu.Game.Rulesets.Osu.Objects; using osu.Game.Rulesets.Osu.Objects.Drawables; using osu.Game.Tests.Visual; @@ -15,6 +18,16 @@ namespace osu.Game.Rulesets.Osu.Tests { public class TestCaseSliderSelectionMask : HitObjectSelectionMaskTestCase { + public override IReadOnlyList RequiredTypes => new Type[] + { + typeof(SliderSelectionMask), + typeof(SliderCircleSelectionMask), + typeof(SliderBodyPiece), + typeof(SliderCircle), + typeof(ControlPointVisualiser), + typeof(ControlPointPiece) + }; + private readonly DrawableSlider drawableObject; public TestCaseSliderSelectionMask() diff --git a/osu.Game.Rulesets.Osu/Edit/Masks/SliderMasks/Components/ControlPointPiece.cs b/osu.Game.Rulesets.Osu/Edit/Masks/SliderMasks/Components/ControlPointPiece.cs new file mode 100644 index 0000000000..5a3c5d5aaf --- /dev/null +++ b/osu.Game.Rulesets.Osu/Edit/Masks/SliderMasks/Components/ControlPointPiece.cs @@ -0,0 +1,90 @@ +// Copyright (c) 2007-2018 ppy Pty Ltd . +// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE + +using System.Linq; +using osu.Framework.Allocation; +using osu.Framework.Graphics; +using osu.Framework.Graphics.Containers; +using osu.Framework.Graphics.Lines; +using osu.Framework.Graphics.Shapes; +using osu.Framework.Input.Events; +using osu.Game.Graphics; +using osu.Game.Rulesets.Osu.Objects; +using OpenTK; + +namespace osu.Game.Rulesets.Osu.Edit.Masks.SliderMasks.Components +{ + public class ControlPointPiece : CompositeDrawable + { + private readonly Slider slider; + private readonly int index; + + private readonly Path path; + private readonly CircularContainer marker; + + [Resolved] + private OsuColour colours { get; set; } + + public ControlPointPiece(Slider slider, int index) + { + this.slider = slider; + this.index = index; + + Origin = Anchor.Centre; + Size = new Vector2(10); + + InternalChildren = new Drawable[] + { + path = new SmoothPath + { + BypassAutoSizeAxes = Axes.Both, + Anchor = Anchor.Centre, + PathWidth = 1 + }, + marker = new CircularContainer + { + RelativeSizeAxes = Axes.Both, + Masking = true, + Child = new Box { RelativeSizeAxes = Axes.Both } + } + }; + } + + protected override void Update() + { + base.Update(); + + Position = slider.StackedPosition + slider.ControlPoints[index]; + + marker.Colour = segmentSeparator ? colours.Red : colours.Yellow; + + path.ClearVertices(); + + if (index != slider.ControlPoints.Length - 1) + { + path.AddVertex(Vector2.Zero); + path.AddVertex(slider.ControlPoints[index + 1] - slider.ControlPoints[index]); + } + + path.OriginPosition = path.PositionInBoundingBox(Vector2.Zero); + } + + protected override bool OnDragStart(DragStartEvent e) => true; + + protected override bool OnDrag(DragEvent e) + { + var newControlPoints = slider.ControlPoints.ToArray(); + newControlPoints[index] += e.Delta; + + slider.ControlPoints = newControlPoints; + + return true; + } + + protected override bool OnDragEnd(DragEndEvent e) => true; + + private bool segmentSeparator => index != 0 && index != slider.ControlPoints.Length - 1 + && slider.ControlPoints[index - 1] != slider.ControlPoints[index] + && slider.ControlPoints[index + 1] != slider.ControlPoints[index]; + } +} diff --git a/osu.Game.Rulesets.Osu/Edit/Masks/SliderMasks/Components/ControlPointVisualiser.cs b/osu.Game.Rulesets.Osu/Edit/Masks/SliderMasks/Components/ControlPointVisualiser.cs new file mode 100644 index 0000000000..d8031c4f5b --- /dev/null +++ b/osu.Game.Rulesets.Osu/Edit/Masks/SliderMasks/Components/ControlPointVisualiser.cs @@ -0,0 +1,34 @@ +// Copyright (c) 2007-2018 ppy Pty Ltd . +// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE + +using osu.Framework.Graphics; +using osu.Framework.Graphics.Containers; +using osu.Game.Rulesets.Osu.Objects; + +namespace osu.Game.Rulesets.Osu.Edit.Masks.SliderMasks.Components +{ + public class ControlPointVisualiser : CompositeDrawable + { + private readonly Slider slider; + + private readonly Container pieces; + + public ControlPointVisualiser(Slider slider) + { + this.slider = slider; + + InternalChild = pieces = new Container { RelativeSizeAxes = Axes.Both }; + + slider.ControlPointsChanged += _ => updateControlPoints(); + updateControlPoints(); + } + + private void updateControlPoints() + { + while (slider.ControlPoints.Length > pieces.Count) + pieces.Add(new ControlPointPiece(slider, pieces.Count)); + while (slider.ControlPoints.Length < pieces.Count) + pieces.Remove(pieces[pieces.Count - 1]); + } + } +} diff --git a/osu.Game.Rulesets.Osu/Edit/Masks/SliderMasks/SliderSelectionMask.cs b/osu.Game.Rulesets.Osu/Edit/Masks/SliderMasks/SliderSelectionMask.cs index a411064f68..8478374a5f 100644 --- a/osu.Game.Rulesets.Osu/Edit/Masks/SliderMasks/SliderSelectionMask.cs +++ b/osu.Game.Rulesets.Osu/Edit/Masks/SliderMasks/SliderSelectionMask.cs @@ -24,6 +24,7 @@ namespace osu.Game.Rulesets.Osu.Edit.Masks.SliderMasks new SliderBodyPiece(sliderObject), headMask = new SliderCircleSelectionMask(slider.HeadCircle, sliderObject, SliderPosition.Start), new SliderCircleSelectionMask(slider.TailCircle, sliderObject, SliderPosition.End), + new ControlPointVisualiser(sliderObject), }; } diff --git a/osu.Game.Rulesets.Osu/Objects/Slider.cs b/osu.Game.Rulesets.Osu/Objects/Slider.cs index a6f5bdb24e..10ffe82579 100644 --- a/osu.Game.Rulesets.Osu/Objects/Slider.cs +++ b/osu.Game.Rulesets.Osu/Objects/Slider.cs @@ -22,6 +22,8 @@ namespace osu.Game.Rulesets.Osu.Objects /// private const float base_scoring_distance = 100; + public event Action ControlPointsChanged; + public double EndTime => StartTime + this.SpanCount() * Curve.Distance / Velocity; public double Duration => EndTime - StartTime; @@ -54,8 +56,15 @@ namespace osu.Game.Rulesets.Osu.Objects public Vector2[] ControlPoints { - get { return Curve.ControlPoints; } - set { Curve.ControlPoints = value; } + get => Curve.ControlPoints; + set + { + if (Curve.ControlPoints == value) + return; + Curve.ControlPoints = value; + + ControlPointsChanged?.Invoke(value); + } } public CurveType CurveType From acd703c27b3f8d1b147e9e7144524bb1e604beb8 Mon Sep 17 00:00:00 2001 From: smoogipoo Date: Mon, 29 Oct 2018 15:36:43 +0900 Subject: [PATCH 357/417] Make sliders respond to control point changes --- .../TestCaseSliderSelectionMask.cs | 2 +- .../Components/ControlPointPiece.cs | 23 ++++++++++++-- .../SliderMasks/Components/SliderBodyPiece.cs | 1 + .../Components/SliderCirclePiece.cs | 2 ++ .../Objects/Drawables/DrawableSlider.cs | 2 ++ .../Objects/Drawables/DrawableSliderHead.cs | 7 ++++- .../Objects/Drawables/DrawableSliderTail.cs | 11 ++++++- .../Drawables/Pieces/SnakingSliderBody.cs | 31 +++++++++++++------ osu.Game.Rulesets.Osu/Objects/Slider.cs | 3 ++ osu.Game/Rulesets/Objects/SliderCurve.cs | 27 ++++++++++++++-- 10 files changed, 92 insertions(+), 17 deletions(-) diff --git a/osu.Game.Rulesets.Osu.Tests/TestCaseSliderSelectionMask.cs b/osu.Game.Rulesets.Osu.Tests/TestCaseSliderSelectionMask.cs index a73cb69536..1ba3e26e65 100644 --- a/osu.Game.Rulesets.Osu.Tests/TestCaseSliderSelectionMask.cs +++ b/osu.Game.Rulesets.Osu.Tests/TestCaseSliderSelectionMask.cs @@ -18,7 +18,7 @@ namespace osu.Game.Rulesets.Osu.Tests { public class TestCaseSliderSelectionMask : HitObjectSelectionMaskTestCase { - public override IReadOnlyList RequiredTypes => new Type[] + public override IReadOnlyList RequiredTypes => new[] { typeof(SliderSelectionMask), typeof(SliderCircleSelectionMask), diff --git a/osu.Game.Rulesets.Osu/Edit/Masks/SliderMasks/Components/ControlPointPiece.cs b/osu.Game.Rulesets.Osu/Edit/Masks/SliderMasks/Components/ControlPointPiece.cs index 5a3c5d5aaf..401fc24902 100644 --- a/osu.Game.Rulesets.Osu/Edit/Masks/SliderMasks/Components/ControlPointPiece.cs +++ b/osu.Game.Rulesets.Osu/Edit/Masks/SliderMasks/Components/ControlPointPiece.cs @@ -73,10 +73,27 @@ namespace osu.Game.Rulesets.Osu.Edit.Masks.SliderMasks.Components protected override bool OnDrag(DragEvent e) { - var newControlPoints = slider.ControlPoints.ToArray(); - newControlPoints[index] += e.Delta; + if (index == 0) + { + // Special handling for the head - only the position of the slider changes + slider.Position += e.Delta; - slider.ControlPoints = newControlPoints; + // Since control points are relative to the position of the slider, they all need to be offset backwards by the delta + var newControlPoints = slider.ControlPoints.ToArray(); + for (int i = 1; i < newControlPoints.Length; i++) + newControlPoints[i] -= e.Delta; + + slider.ControlPoints = newControlPoints; + slider.Curve.Calculate(true); + } + else + { + var newControlPoints = slider.ControlPoints.ToArray(); + newControlPoints[index] += e.Delta; + + slider.ControlPoints = newControlPoints; + slider.Curve.Calculate(true); + } return true; } diff --git a/osu.Game.Rulesets.Osu/Edit/Masks/SliderMasks/Components/SliderBodyPiece.cs b/osu.Game.Rulesets.Osu/Edit/Masks/SliderMasks/Components/SliderBodyPiece.cs index 3123a4fcea..46d99e1740 100644 --- a/osu.Game.Rulesets.Osu/Edit/Masks/SliderMasks/Components/SliderBodyPiece.cs +++ b/osu.Game.Rulesets.Osu/Edit/Masks/SliderMasks/Components/SliderBodyPiece.cs @@ -46,6 +46,7 @@ namespace osu.Game.Rulesets.Osu.Edit.Masks.SliderMasks.Components // Need to cause one update body.UpdateProgress(0); + body.Refresh(); } } } diff --git a/osu.Game.Rulesets.Osu/Edit/Masks/SliderMasks/Components/SliderCirclePiece.cs b/osu.Game.Rulesets.Osu/Edit/Masks/SliderMasks/Components/SliderCirclePiece.cs index c5ecde5c4c..a8565fafb6 100644 --- a/osu.Game.Rulesets.Osu/Edit/Masks/SliderMasks/Components/SliderCirclePiece.cs +++ b/osu.Game.Rulesets.Osu/Edit/Masks/SliderMasks/Components/SliderCirclePiece.cs @@ -16,6 +16,8 @@ namespace osu.Game.Rulesets.Osu.Edit.Masks.SliderMasks.Components { this.slider = slider; this.position = position; + + slider.ControlPointsChanged += _ => UpdatePosition(); } protected override void UpdatePosition() diff --git a/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableSlider.cs b/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableSlider.cs index 16bd522c1d..7599001a82 100644 --- a/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableSlider.cs +++ b/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableSlider.cs @@ -85,6 +85,8 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables } HitObject.PositionChanged += _ => Position = HitObject.StackedPosition; + + slider.ControlPointsChanged += _ => Body.Refresh(); } public override Color4 AccentColour diff --git a/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableSliderHead.cs b/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableSliderHead.cs index 6d6cba4936..6a836679a2 100644 --- a/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableSliderHead.cs +++ b/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableSliderHead.cs @@ -16,7 +16,10 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables { this.slider = slider; - Position = HitObject.Position - slider.Position; + h.PositionChanged += _ => updatePosition(); + slider.ControlPointsChanged += _ => updatePosition(); + + updatePosition(); } protected override void Update() @@ -33,5 +36,7 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables public Action OnShake; protected override void Shake(double maximumLength) => OnShake?.Invoke(maximumLength); + + private void updatePosition() => Position = HitObject.Position - slider.Position; } } diff --git a/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableSliderTail.cs b/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableSliderTail.cs index 45c925b87a..cc88a6718b 100644 --- a/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableSliderTail.cs +++ b/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableSliderTail.cs @@ -8,6 +8,8 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables { public class DrawableSliderTail : DrawableOsuHitObject, IRequireTracking { + private readonly Slider slider; + /// /// The judgement text is provided by the . /// @@ -18,6 +20,8 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables public DrawableSliderTail(Slider slider, SliderTailCircle hitCircle) : base(hitCircle) { + this.slider = slider; + Origin = Anchor.Centre; RelativeSizeAxes = Axes.Both; @@ -25,7 +29,10 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables AlwaysPresent = true; - Position = HitObject.Position - slider.Position; + hitCircle.PositionChanged += _ => updatePosition(); + slider.ControlPointsChanged += _ => updatePosition(); + + updatePosition(); } protected override void CheckForResult(bool userTriggered, double timeOffset) @@ -33,5 +40,7 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables if (!userTriggered && timeOffset >= 0) ApplyResult(r => r.Type = Tracking ? HitResult.Great : HitResult.Miss); } + + private void updatePosition() => Position = HitObject.Position - slider.Position; } } diff --git a/osu.Game.Rulesets.Osu/Objects/Drawables/Pieces/SnakingSliderBody.cs b/osu.Game.Rulesets.Osu/Objects/Drawables/Pieces/SnakingSliderBody.cs index 09d6f9459a..3d02f9a92d 100644 --- a/osu.Game.Rulesets.Osu/Objects/Drawables/Pieces/SnakingSliderBody.cs +++ b/osu.Game.Rulesets.Osu/Objects/Drawables/Pieces/SnakingSliderBody.cs @@ -45,15 +45,7 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables.Pieces [BackgroundDependencyLoader] private void load() { - // Generate the entire curve - slider.Curve.GetPathToProgress(CurrentCurve, 0, 1); - SetVertices(CurrentCurve); - - // The body is sized to the full path size to avoid excessive autosize computations - Size = Path.Size; - - snakedPosition = Path.PositionInBoundingBox(Vector2.Zero); - snakedPathOffset = Path.PositionInBoundingBox(Path.Vertices[0]); + Refresh(); } public void UpdateProgress(double completionProgress) @@ -80,6 +72,27 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables.Pieces setRange(start, end); } + public void Refresh() + { + // Generate the entire curve + slider.Curve.GetPathToProgress(CurrentCurve, 0, 1); + SetVertices(CurrentCurve); + + // The body is sized to the full path size to avoid excessive autosize computations + Size = Path.Size; + + snakedPosition = Path.PositionInBoundingBox(Vector2.Zero); + snakedPathOffset = Path.PositionInBoundingBox(Path.Vertices[0]); + + var lastSnakedStart = SnakedStart ?? 0; + var lastSnakedEnd = SnakedEnd ?? 0; + + SnakedStart = null; + SnakedEnd = null; + + setRange(lastSnakedStart, lastSnakedEnd); + } + private void setRange(double p0, double p1) { if (p0 > p1) diff --git a/osu.Game.Rulesets.Osu/Objects/Slider.cs b/osu.Game.Rulesets.Osu/Objects/Slider.cs index 10ffe82579..de7ba8451b 100644 --- a/osu.Game.Rulesets.Osu/Objects/Slider.cs +++ b/osu.Game.Rulesets.Osu/Objects/Slider.cs @@ -64,6 +64,9 @@ namespace osu.Game.Rulesets.Osu.Objects Curve.ControlPoints = value; ControlPointsChanged?.Invoke(value); + + if (TailCircle != null) + TailCircle.Position = EndPosition; } } diff --git a/osu.Game/Rulesets/Objects/SliderCurve.cs b/osu.Game/Rulesets/Objects/SliderCurve.cs index dfccdf68f2..6a8192a4f2 100644 --- a/osu.Game/Rulesets/Objects/SliderCurve.cs +++ b/osu.Game/Rulesets/Objects/SliderCurve.cs @@ -124,10 +124,33 @@ namespace osu.Game.Rulesets.Objects } } - public void Calculate() + private void calculateCumulativeLength() + { + double l = 0; + + cumulativeLength.Clear(); + cumulativeLength.Add(l); + + for (int i = 0; i < calculatedPath.Count - 1; ++i) + { + Vector2 diff = calculatedPath[i + 1] - calculatedPath[i]; + double d = diff.Length; + + l += d; + cumulativeLength.Add(l); + } + + Distance = l; + } + + public void Calculate(bool updateDistance = false) { calculatePath(); - calculateCumulativeLengthAndTrimPath(); + + if (!updateDistance) + calculateCumulativeLengthAndTrimPath(); + else + calculateCumulativeLength(); } private int indexOfDistance(double d) From c1fffde10db3cb0ccf508899dc9545f7b0d58816 Mon Sep 17 00:00:00 2001 From: smoogipoo Date: Mon, 29 Oct 2018 15:52:28 +0900 Subject: [PATCH 358/417] Fix broken conditional --- .../Components/ControlPointPiece.cs | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) diff --git a/osu.Game.Rulesets.Osu/Edit/Masks/SliderMasks/Components/ControlPointPiece.cs b/osu.Game.Rulesets.Osu/Edit/Masks/SliderMasks/Components/ControlPointPiece.cs index 401fc24902..7547b4523b 100644 --- a/osu.Game.Rulesets.Osu/Edit/Masks/SliderMasks/Components/ControlPointPiece.cs +++ b/osu.Game.Rulesets.Osu/Edit/Masks/SliderMasks/Components/ControlPointPiece.cs @@ -56,7 +56,7 @@ namespace osu.Game.Rulesets.Osu.Edit.Masks.SliderMasks.Components Position = slider.StackedPosition + slider.ControlPoints[index]; - marker.Colour = segmentSeparator ? colours.Red : colours.Yellow; + marker.Colour = isSegmentSeparator ? colours.Red : colours.Yellow; path.ClearVertices(); @@ -100,8 +100,19 @@ namespace osu.Game.Rulesets.Osu.Edit.Masks.SliderMasks.Components protected override bool OnDragEnd(DragEndEvent e) => true; - private bool segmentSeparator => index != 0 && index != slider.ControlPoints.Length - 1 - && slider.ControlPoints[index - 1] != slider.ControlPoints[index] - && slider.ControlPoints[index + 1] != slider.ControlPoints[index]; + private bool isSegmentSeparator + { + get + { + bool separator = false; + + if (index < slider.ControlPoints.Length - 1) + separator |= slider.ControlPoints[index + 1] == slider.ControlPoints[index]; + if (index > 0) + separator |= slider.ControlPoints[index - 1] == slider.ControlPoints[index]; + + return separator; + } + } } } From 5998d6454b7731168fd36da65ed6e1fa6295ccba Mon Sep 17 00:00:00 2001 From: smoogipoo Date: Mon, 29 Oct 2018 15:56:17 +0900 Subject: [PATCH 359/417] Use ControlPointVisualiser instead of custom implementation --- .../Components/SliderControlPoint.cs | 92 ------------------- .../Masks/SliderMasks/SliderPlacementMask.cs | 9 +- 2 files changed, 1 insertion(+), 100 deletions(-) delete mode 100644 osu.Game.Rulesets.Osu/Edit/Masks/SliderMasks/Components/SliderControlPoint.cs diff --git a/osu.Game.Rulesets.Osu/Edit/Masks/SliderMasks/Components/SliderControlPoint.cs b/osu.Game.Rulesets.Osu/Edit/Masks/SliderMasks/Components/SliderControlPoint.cs deleted file mode 100644 index e9693e7a3c..0000000000 --- a/osu.Game.Rulesets.Osu/Edit/Masks/SliderMasks/Components/SliderControlPoint.cs +++ /dev/null @@ -1,92 +0,0 @@ -// Copyright (c) 2007-2018 ppy Pty Ltd . -// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE - -using osu.Framework.Allocation; -using osu.Framework.Caching; -using osu.Framework.Graphics; -using osu.Framework.Graphics.Containers; -using osu.Framework.Graphics.Lines; -using osu.Framework.Graphics.Shapes; -using osu.Game.Graphics; -using OpenTK; - -namespace osu.Game.Rulesets.Osu.Edit.Masks.SliderMasks.Components -{ - public class SliderControlPoint : CompositeDrawable - { - private readonly Path path; - private readonly CircularContainer marker; - - private OsuColour colours; - - public SliderControlPoint() - { - Size = new Vector2(5); - Origin = Anchor.Centre; - - NextPoint = Position; - - InternalChildren = new Drawable[] - { - path = new SmoothPath - { - BypassAutoSizeAxes = Axes.Both, - Anchor = Anchor.Centre, - PathWidth = 1, - }, - marker = new CircularContainer - { - RelativeSizeAxes = Axes.Both, - Masking = true, - Child = new Box { RelativeSizeAxes = Axes.Both } - } - }; - } - - [BackgroundDependencyLoader] - private void load(OsuColour colours) - { - this.colours = colours; - - marker.Colour = colours.YellowDark; - } - - public bool SegmentSeparator - { - set => marker.Colour = value ? colours.Red : colours.YellowDark; - } - - private Vector2 nextPoint; - - public Vector2 NextPoint - { - set - { - nextPoint = value; - pathCache.Invalidate(); - } - } - - protected override void Update() - { - base.Update(); - - validatePath(); - } - - private Cached pathCache = new Cached(); - - private void validatePath() - { - if (pathCache.IsValid) - return; - - path.ClearVertices(); - path.AddVertex(nextPoint - Position); - path.AddVertex(Vector2.Zero); - path.OriginPosition = path.PositionInBoundingBox(Vector2.Zero); - - pathCache.Validate(); - } - } -} diff --git a/osu.Game.Rulesets.Osu/Edit/Masks/SliderMasks/SliderPlacementMask.cs b/osu.Game.Rulesets.Osu/Edit/Masks/SliderMasks/SliderPlacementMask.cs index 2ee996fb00..727ec4c8d5 100644 --- a/osu.Game.Rulesets.Osu/Edit/Masks/SliderMasks/SliderPlacementMask.cs +++ b/osu.Game.Rulesets.Osu/Edit/Masks/SliderMasks/SliderPlacementMask.cs @@ -7,7 +7,6 @@ using System.Linq; using osu.Framework.Allocation; using osu.Framework.Extensions.IEnumerableExtensions; using osu.Framework.Graphics; -using osu.Framework.Graphics.Containers; using osu.Framework.Input.Events; using osu.Game.Graphics; using osu.Game.Rulesets.Edit; @@ -23,8 +22,6 @@ namespace osu.Game.Rulesets.Osu.Edit.Masks.SliderMasks { public new Objects.Slider HitObject => (Objects.Slider)base.HitObject; - private Container controlPointContainer; - private readonly List segments = new List(); private Vector2 cursor; @@ -45,7 +42,7 @@ namespace osu.Game.Rulesets.Osu.Edit.Masks.SliderMasks new SliderBodyPiece(HitObject), new SliderCirclePiece(HitObject, SliderPosition.Start), new SliderCirclePiece(HitObject, SliderPosition.End), - controlPointContainer = new Container { RelativeSizeAxes = Axes.Both } + new ControlPointVisualiser(HitObject), }; setState(PlacementState.Initial); @@ -60,7 +57,6 @@ namespace osu.Game.Rulesets.Osu.Edit.Masks.SliderMasks return true; case PlacementState.Body: cursor = e.MousePosition - HitObject.Position; - controlPointContainer.Last().NextPoint = e.MousePosition; return true; } @@ -85,8 +81,6 @@ namespace osu.Game.Rulesets.Osu.Edit.Masks.SliderMasks break; } - controlPointContainer.Add(new SliderControlPoint { Position = e.MousePosition }); - return true; } @@ -100,7 +94,6 @@ namespace osu.Game.Rulesets.Osu.Edit.Masks.SliderMasks protected override bool OnDoubleClick(DoubleClickEvent e) { segments.Add(new Segment(segments[segments.Count - 1].ControlPoints.Last())); - controlPointContainer.Last().SegmentSeparator = true; return true; } From 2ae7b4224464bc544598f3d9e1724f6a0e4731d0 Mon Sep 17 00:00:00 2001 From: smoogipoo Date: Mon, 29 Oct 2018 16:15:04 +0900 Subject: [PATCH 360/417] Fix control points disappearing if moved offscreen --- .../Masks/SliderMasks/Components/ControlPointPiece.cs | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/osu.Game.Rulesets.Osu/Edit/Masks/SliderMasks/Components/ControlPointPiece.cs b/osu.Game.Rulesets.Osu/Edit/Masks/SliderMasks/Components/ControlPointPiece.cs index 7547b4523b..b1d157d9b7 100644 --- a/osu.Game.Rulesets.Osu/Edit/Masks/SliderMasks/Components/ControlPointPiece.cs +++ b/osu.Game.Rulesets.Osu/Edit/Masks/SliderMasks/Components/ControlPointPiece.cs @@ -31,19 +31,20 @@ namespace osu.Game.Rulesets.Osu.Edit.Masks.SliderMasks.Components this.index = index; Origin = Anchor.Centre; - Size = new Vector2(10); + AutoSizeAxes = Axes.Both; InternalChildren = new Drawable[] { path = new SmoothPath { - BypassAutoSizeAxes = Axes.Both, Anchor = Anchor.Centre, PathWidth = 1 }, marker = new CircularContainer { - RelativeSizeAxes = Axes.Both, + Anchor = Anchor.Centre, + Origin = Anchor.Centre, + Size = new Vector2(15), Masking = true, Child = new Box { RelativeSizeAxes = Axes.Both } } @@ -69,6 +70,8 @@ namespace osu.Game.Rulesets.Osu.Edit.Masks.SliderMasks.Components path.OriginPosition = path.PositionInBoundingBox(Vector2.Zero); } + public override bool ReceivePositionalInputAt(Vector2 screenSpacePos) => marker.ReceivePositionalInputAt(screenSpacePos); + protected override bool OnDragStart(DragStartEvent e) => true; protected override bool OnDrag(DragEvent e) From af1de01ed61d258a4d579ec0f7354163e9a24e58 Mon Sep 17 00:00:00 2001 From: smoogipoo Date: Mon, 29 Oct 2018 18:23:23 +0900 Subject: [PATCH 361/417] Add a spinner selection mask --- .../TestCaseSpinnerSelectionMask.cs | 50 ++++++++++++++ .../SpinnerMasks/Components/SpinnerPiece.cs | 65 +++++++++++++++++++ .../SpinnerMasks/SpinnerSelectionMask.cs | 24 +++++++ .../Edit/OsuHitObjectComposer.cs | 3 + .../Objects/Drawables/DrawableSpinner.cs | 4 +- 5 files changed, 145 insertions(+), 1 deletion(-) create mode 100644 osu.Game.Rulesets.Osu.Tests/TestCaseSpinnerSelectionMask.cs create mode 100644 osu.Game.Rulesets.Osu/Edit/Masks/SpinnerMasks/Components/SpinnerPiece.cs create mode 100644 osu.Game.Rulesets.Osu/Edit/Masks/SpinnerMasks/SpinnerSelectionMask.cs diff --git a/osu.Game.Rulesets.Osu.Tests/TestCaseSpinnerSelectionMask.cs b/osu.Game.Rulesets.Osu.Tests/TestCaseSpinnerSelectionMask.cs new file mode 100644 index 0000000000..b436ff0e9f --- /dev/null +++ b/osu.Game.Rulesets.Osu.Tests/TestCaseSpinnerSelectionMask.cs @@ -0,0 +1,50 @@ +// Copyright (c) 2007-2018 ppy Pty Ltd . +// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE + +using System; +using System.Collections.Generic; +using osu.Framework.Graphics; +using osu.Framework.Graphics.Containers; +using osu.Game.Beatmaps; +using osu.Game.Beatmaps.ControlPoints; +using osu.Game.Rulesets.Edit; +using osu.Game.Rulesets.Osu.Edit.Masks.SpinnerMasks; +using osu.Game.Rulesets.Osu.Edit.Masks.SpinnerMasks.Components; +using osu.Game.Rulesets.Osu.Objects; +using osu.Game.Rulesets.Osu.Objects.Drawables; +using osu.Game.Tests.Visual; +using OpenTK; + +namespace osu.Game.Rulesets.Osu.Tests +{ + public class TestCaseSpinnerSelectionMask : HitObjectSelectionMaskTestCase + { + public override IReadOnlyList RequiredTypes => new[] + { + typeof(SpinnerSelectionMask), + typeof(SpinnerPiece) + }; + + private readonly DrawableSpinner drawableSpinner; + + public TestCaseSpinnerSelectionMask() + { + var spinner = new Spinner + { + Position = new Vector2(256, 256), + StartTime = -1000, + EndTime = 2000 + }; + spinner.ApplyDefaults(new ControlPointInfo(), new BeatmapDifficulty { CircleSize = 2 }); + + Add(new Container + { + RelativeSizeAxes = Axes.Both, + Size = new Vector2(0.5f), + Child = drawableSpinner = new DrawableSpinner(spinner) + }); + } + + protected override SelectionMask CreateMask() => new SpinnerSelectionMask(drawableSpinner) { Size = new Vector2(0.5f) }; + } +} diff --git a/osu.Game.Rulesets.Osu/Edit/Masks/SpinnerMasks/Components/SpinnerPiece.cs b/osu.Game.Rulesets.Osu/Edit/Masks/SpinnerMasks/Components/SpinnerPiece.cs new file mode 100644 index 0000000000..ce2b5cd1d6 --- /dev/null +++ b/osu.Game.Rulesets.Osu/Edit/Masks/SpinnerMasks/Components/SpinnerPiece.cs @@ -0,0 +1,65 @@ +// Copyright (c) 2007-2018 ppy Pty Ltd . +// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE + +using osu.Framework.Allocation; +using osu.Framework.Graphics; +using osu.Framework.Graphics.Containers; +using osu.Framework.Graphics.Shapes; +using osu.Game.Graphics; +using osu.Game.Rulesets.Osu.Objects; +using osu.Game.Rulesets.Osu.Objects.Drawables.Pieces; +using OpenTK; + +namespace osu.Game.Rulesets.Osu.Edit.Masks.SpinnerMasks.Components +{ + public class SpinnerPiece : CompositeDrawable + { + private readonly Spinner spinner; + private readonly CircularContainer circle; + + public SpinnerPiece(Spinner spinner) + { + this.spinner = spinner; + + Origin = Anchor.Centre; + + RelativeSizeAxes = Axes.Both; + FillMode = FillMode.Fit; + Size = new Vector2(1.3f); + + RingPiece ring; + InternalChildren = new Drawable[] + { + circle = new CircularContainer + { + RelativeSizeAxes = Axes.Both, + Masking = true, + Alpha = 0.5f, + Child = new Box { RelativeSizeAxes = Axes.Both } + }, + ring = new RingPiece + { + Anchor = Anchor.Centre, + Origin = Anchor.Centre + } + }; + + ring.Scale = new Vector2(spinner.Scale); + + spinner.PositionChanged += _ => updatePosition(); + spinner.StackHeightChanged += _ => updatePosition(); + + updatePosition(); + } + + [BackgroundDependencyLoader] + private void load(OsuColour colours) + { + Colour = colours.Yellow; + } + + private void updatePosition() => Position = spinner.Position; + + public override bool ReceivePositionalInputAt(Vector2 screenSpacePos) => circle.ReceivePositionalInputAt(screenSpacePos); + } +} diff --git a/osu.Game.Rulesets.Osu/Edit/Masks/SpinnerMasks/SpinnerSelectionMask.cs b/osu.Game.Rulesets.Osu/Edit/Masks/SpinnerMasks/SpinnerSelectionMask.cs new file mode 100644 index 0000000000..0e47bd2a8b --- /dev/null +++ b/osu.Game.Rulesets.Osu/Edit/Masks/SpinnerMasks/SpinnerSelectionMask.cs @@ -0,0 +1,24 @@ +// Copyright (c) 2007-2018 ppy Pty Ltd . +// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE + +using osu.Game.Rulesets.Edit; +using osu.Game.Rulesets.Osu.Edit.Masks.SpinnerMasks.Components; +using osu.Game.Rulesets.Osu.Objects; +using osu.Game.Rulesets.Osu.Objects.Drawables; +using OpenTK; + +namespace osu.Game.Rulesets.Osu.Edit.Masks.SpinnerMasks +{ + public class SpinnerSelectionMask : SelectionMask + { + private readonly SpinnerPiece piece; + + public SpinnerSelectionMask(DrawableSpinner spinner) + : base(spinner) + { + InternalChild = piece = new SpinnerPiece((Spinner)spinner.HitObject); + } + + public override bool ReceivePositionalInputAt(Vector2 screenSpacePos) => piece.ReceivePositionalInputAt(screenSpacePos); + } +} diff --git a/osu.Game.Rulesets.Osu/Edit/OsuHitObjectComposer.cs b/osu.Game.Rulesets.Osu/Edit/OsuHitObjectComposer.cs index ac41d6ef27..386665ab7c 100644 --- a/osu.Game.Rulesets.Osu/Edit/OsuHitObjectComposer.cs +++ b/osu.Game.Rulesets.Osu/Edit/OsuHitObjectComposer.cs @@ -10,6 +10,7 @@ using osu.Game.Rulesets.Edit.Tools; using osu.Game.Rulesets.Objects.Drawables; using osu.Game.Rulesets.Osu.Edit.Masks.HitCircleMasks; using osu.Game.Rulesets.Osu.Edit.Masks.SliderMasks; +using osu.Game.Rulesets.Osu.Edit.Masks.SpinnerMasks; using osu.Game.Rulesets.Osu.Objects; using osu.Game.Rulesets.Osu.Objects.Drawables; using osu.Game.Rulesets.Osu.UI; @@ -42,6 +43,8 @@ namespace osu.Game.Rulesets.Osu.Edit return new HitCircleSelectionMask(circle); case DrawableSlider slider: return new SliderSelectionMask(slider); + case DrawableSpinner spinner: + return new SpinnerSelectionMask(spinner); } return base.CreateMaskFor(hitObject); diff --git a/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableSpinner.cs b/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableSpinner.cs index 51b1990a21..f3846bd52f 100644 --- a/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableSpinner.cs +++ b/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableSpinner.cs @@ -112,6 +112,8 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables Alpha = 0 } }; + + s.PositionChanged += _ => Position = s.Position; } public float Progress => MathHelper.Clamp(Disc.RotationAbsolute / 360 / Spinner.SpinsRequired, 0, 1); @@ -167,7 +169,7 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables protected override void Update() { - Disc.Tracking = OsuActionInputManager.PressedActions.Any(x => x == OsuAction.LeftButton || x == OsuAction.RightButton); + Disc.Tracking = OsuActionInputManager?.PressedActions.Any(x => x == OsuAction.LeftButton || x == OsuAction.RightButton) ?? false; if (!spmCounter.IsPresent && Disc.Tracking) spmCounter.FadeIn(HitObject.TimeFadeIn); From e04ad8357d1e32b849e059a65c71e10e0cecc97a Mon Sep 17 00:00:00 2001 From: smoogipoo Date: Mon, 29 Oct 2018 18:37:12 +0900 Subject: [PATCH 362/417] Make spinner piece respond to scale changes --- .../Edit/Masks/SpinnerMasks/Components/SpinnerPiece.cs | 1 + 1 file changed, 1 insertion(+) diff --git a/osu.Game.Rulesets.Osu/Edit/Masks/SpinnerMasks/Components/SpinnerPiece.cs b/osu.Game.Rulesets.Osu/Edit/Masks/SpinnerMasks/Components/SpinnerPiece.cs index ce2b5cd1d6..0d9609facf 100644 --- a/osu.Game.Rulesets.Osu/Edit/Masks/SpinnerMasks/Components/SpinnerPiece.cs +++ b/osu.Game.Rulesets.Osu/Edit/Masks/SpinnerMasks/Components/SpinnerPiece.cs @@ -48,6 +48,7 @@ namespace osu.Game.Rulesets.Osu.Edit.Masks.SpinnerMasks.Components spinner.PositionChanged += _ => updatePosition(); spinner.StackHeightChanged += _ => updatePosition(); + spinner.ScaleChanged += _ => ring.Scale = new Vector2(spinner.Scale); updatePosition(); } From aec1d95f045ce65b5b5ef0fe0efaa4416cffd4f6 Mon Sep 17 00:00:00 2001 From: smoogipoo Date: Mon, 29 Oct 2018 18:35:46 +0900 Subject: [PATCH 363/417] Implement spinner placement --- .../TestCaseSpinnerPlacementMask.cs | 20 +++++++ .../SpinnerMasks/SpinnerPlacementMask.cs | 59 +++++++++++++++++++ .../Edit/OsuHitObjectComposer.cs | 3 +- .../Edit/SpinnerCompositionTool.cs | 20 +++++++ 4 files changed, 101 insertions(+), 1 deletion(-) create mode 100644 osu.Game.Rulesets.Osu.Tests/TestCaseSpinnerPlacementMask.cs create mode 100644 osu.Game.Rulesets.Osu/Edit/Masks/SpinnerMasks/SpinnerPlacementMask.cs create mode 100644 osu.Game.Rulesets.Osu/Edit/SpinnerCompositionTool.cs diff --git a/osu.Game.Rulesets.Osu.Tests/TestCaseSpinnerPlacementMask.cs b/osu.Game.Rulesets.Osu.Tests/TestCaseSpinnerPlacementMask.cs new file mode 100644 index 0000000000..c2c7942c57 --- /dev/null +++ b/osu.Game.Rulesets.Osu.Tests/TestCaseSpinnerPlacementMask.cs @@ -0,0 +1,20 @@ +// Copyright (c) 2007-2018 ppy Pty Ltd . +// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE + +using osu.Game.Rulesets.Edit; +using osu.Game.Rulesets.Objects; +using osu.Game.Rulesets.Objects.Drawables; +using osu.Game.Rulesets.Osu.Edit.Masks.SpinnerMasks; +using osu.Game.Rulesets.Osu.Objects; +using osu.Game.Rulesets.Osu.Objects.Drawables; +using osu.Game.Tests.Visual; + +namespace osu.Game.Rulesets.Osu.Tests +{ + public class TestCaseSpinnerPlacementMask : HitObjectPlacementMaskTestCase + { + protected override DrawableHitObject CreateHitObject(HitObject hitObject) => new DrawableSpinner((Spinner)hitObject); + + protected override PlacementMask CreateMask() => new SpinnerPlacementMask(); + } +} diff --git a/osu.Game.Rulesets.Osu/Edit/Masks/SpinnerMasks/SpinnerPlacementMask.cs b/osu.Game.Rulesets.Osu/Edit/Masks/SpinnerMasks/SpinnerPlacementMask.cs new file mode 100644 index 0000000000..97356fa8b6 --- /dev/null +++ b/osu.Game.Rulesets.Osu/Edit/Masks/SpinnerMasks/SpinnerPlacementMask.cs @@ -0,0 +1,59 @@ +// Copyright (c) 2007-2018 ppy Pty Ltd . +// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE + +using osu.Framework.Graphics; +using osu.Framework.Input.Events; +using osu.Game.Rulesets.Edit; +using osu.Game.Rulesets.Osu.Edit.Masks.SpinnerMasks.Components; +using osu.Game.Rulesets.Osu.Objects; + +namespace osu.Game.Rulesets.Osu.Edit.Masks.SpinnerMasks +{ + public class SpinnerPlacementMask : PlacementMask + { + public new Spinner HitObject => (Spinner)base.HitObject; + + private readonly SpinnerPiece piece; + + private bool isPlacingEnd; + + public SpinnerPlacementMask() + : base(new Spinner()) + { + InternalChild = piece = new SpinnerPiece(HitObject) { Alpha = 0.5f }; + } + + protected override void LoadComplete() + { + base.LoadComplete(); + + // Fixes a 1-frame position discrpancy due to the first mouse move event happening in the next frame + HitObject.Position = GetContainingInputManager().CurrentState.Mouse.Position; + } + + protected override bool OnClick(ClickEvent e) + { + if (isPlacingEnd) + { + HitObject.EndTime = EditorClock.CurrentTime; + EndPlacement(); + } + else + { + HitObject.StartTime = EditorClock.CurrentTime; + + isPlacingEnd = true; + piece.FadeTo(1f, 150, Easing.OutQuint); + } + + return true; + } + + protected override bool OnMouseMove(MouseMoveEvent e) + { + if (!isPlacingEnd) + HitObject.Position = e.MousePosition; + return true; + } + } +} diff --git a/osu.Game.Rulesets.Osu/Edit/OsuHitObjectComposer.cs b/osu.Game.Rulesets.Osu/Edit/OsuHitObjectComposer.cs index 386665ab7c..a1629803c0 100644 --- a/osu.Game.Rulesets.Osu/Edit/OsuHitObjectComposer.cs +++ b/osu.Game.Rulesets.Osu/Edit/OsuHitObjectComposer.cs @@ -28,9 +28,10 @@ namespace osu.Game.Rulesets.Osu.Edit protected override RulesetContainer CreateRulesetContainer(Ruleset ruleset, WorkingBeatmap beatmap) => new OsuEditRulesetContainer(ruleset, beatmap); - protected override IReadOnlyList CompositionTools => new[] + protected override IReadOnlyList CompositionTools => new HitObjectCompositionTool[] { new HitCircleCompositionTool(), + new SpinnerCompositionTool() }; protected override Container CreateLayerContainer() => new PlayfieldAdjustmentContainer { RelativeSizeAxes = Axes.Both }; diff --git a/osu.Game.Rulesets.Osu/Edit/SpinnerCompositionTool.cs b/osu.Game.Rulesets.Osu/Edit/SpinnerCompositionTool.cs new file mode 100644 index 0000000000..a1419fe281 --- /dev/null +++ b/osu.Game.Rulesets.Osu/Edit/SpinnerCompositionTool.cs @@ -0,0 +1,20 @@ +// Copyright (c) 2007-2018 ppy Pty Ltd . +// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE + +using osu.Game.Rulesets.Edit; +using osu.Game.Rulesets.Edit.Tools; +using osu.Game.Rulesets.Osu.Edit.Masks.SpinnerMasks; +using osu.Game.Rulesets.Osu.Objects; + +namespace osu.Game.Rulesets.Osu.Edit +{ + public class SpinnerCompositionTool : HitObjectCompositionTool + { + public SpinnerCompositionTool() + : base(nameof(Spinner)) + { + } + + public override PlacementMask CreatePlacementMask() => new SpinnerPlacementMask(); + } +} From ff47b2be7a6eb17cd29b7be24156394597a14a9a Mon Sep 17 00:00:00 2001 From: miterosan Date: Mon, 29 Oct 2018 18:42:35 +0100 Subject: [PATCH 364/417] Create a simple bootstrapper in the bash script language --- build.sh | 37 +++++++++++++++++++++++++++++++++++++ 1 file changed, 37 insertions(+) create mode 100644 build.sh diff --git a/build.sh b/build.sh new file mode 100644 index 0000000000..caf1702f41 --- /dev/null +++ b/build.sh @@ -0,0 +1,37 @@ +#!/usr/bin/env bash + +########################################################################## +# This is a customized Cake bootstrapper script for Shell. +########################################################################## + +echo "Preparing to run build script..." + +SCRIPT_DIR=$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd ) +TOOLS_DIR=$SCRIPT_DIR/tools +CAKE_BINARY_PATH=$TOOLS_DIR/"cake.coreclr" + +SCRIPT="build.cake" +CAKE_CSPROJ=$TOOLS_DIR/"cakebuild.csproj" + +# Parse arguments. +CAKE_ARGUMENTS=() +for i in "$@"; do + case $1 in + -s|--script) SCRIPT="$2"; shift ;; + --) shift; CAKE_ARGUMENTS+=("$@"); break ;; + *) CAKE_ARGUMENTS+=("$1") ;; + esac + shift +done + +# Install the required tools locally. +echo "Restoring cake tools..." +dotnet restore $CAKE_CSPROJ --packages $TOOLS_DIR > /dev/null 2>&1 + +# Search for the CakeBuild binary. +CAKE_BINARY=$(find $CAKE_BINARY_PATH -name "Cake.dll") + +# Start Cake +echo "Running build script..." + +dotnet "$CAKE_BINARY" $SCRIPT "${CAKE_ARGUMENTS[@]}" From bf83c1eb6adaf256172776843cf77bebf0b39f41 Mon Sep 17 00:00:00 2001 From: miterosan Date: Mon, 29 Oct 2018 18:45:08 +0100 Subject: [PATCH 365/417] Mention the bash script in the readme. --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index d0919e1d82..00f55242d2 100644 --- a/README.md +++ b/README.md @@ -25,7 +25,7 @@ Build and run - Using Visual Studio 2017, Rider or Visual Studio Code (configurations are included) - From command line using `dotnet run --project osu.Desktop`. When building for non-development purposes, add `-c Release` to gain higher performance. -- And from command line using `powershell ./build.ps1`. This will also run tests and code analysis. This command is used on CI. The code analysis is windows only. +- And from command line using `powershell ./build.ps1` or if you use bash as your shell: `./build.sh`. This will also run tests and code analysis. This command is used on CI. The code analysis is windows only. Note: If you run from command line under linux, you will need to prefix the output folder to your `LD_LIBRARY_PATH`. See `.vscode/launch.json` for an example From 4d97b96705214a6d8da94363c8cb96236651108d Mon Sep 17 00:00:00 2001 From: miterosan Date: Mon, 29 Oct 2018 18:49:31 +0100 Subject: [PATCH 366/417] Remove the framework settings. It is not used. --- build.cake | 1 - 1 file changed, 1 deletion(-) diff --git a/build.cake b/build.cake index fff39079b6..136ad67ab9 100644 --- a/build.cake +++ b/build.cake @@ -7,7 +7,6 @@ /////////////////////////////////////////////////////////////////////////////// var target = Argument("target", "Build"); -var framework = Argument("framework", "netcoreapp2.1"); var configuration = Argument("configuration", "Release"); var osuSolution = new FilePath("./osu.sln"); From 6d00aff9fd7958227a16e607b32121130b9d3e70 Mon Sep 17 00:00:00 2001 From: Kyle Chang Date: Tue, 30 Oct 2018 00:13:33 -0400 Subject: [PATCH 367/417] Add type parameter to IApplicableToBeatmap --- osu.Game.Rulesets.Mania/Mods/ManiaModDualStages.cs | 7 ++++--- osu.Game/Rulesets/Mods/IApplicableToBeatmap.cs | 13 ++++++++----- osu.Game/Rulesets/UI/RulesetContainer.cs | 2 +- 3 files changed, 13 insertions(+), 9 deletions(-) diff --git a/osu.Game.Rulesets.Mania/Mods/ManiaModDualStages.cs b/osu.Game.Rulesets.Mania/Mods/ManiaModDualStages.cs index 12b62d2b65..4790a77cc0 100644 --- a/osu.Game.Rulesets.Mania/Mods/ManiaModDualStages.cs +++ b/osu.Game.Rulesets.Mania/Mods/ManiaModDualStages.cs @@ -4,11 +4,12 @@ using System.Collections.Generic; using osu.Game.Beatmaps; using osu.Game.Rulesets.Mania.Beatmaps; +using osu.Game.Rulesets.Mania.Objects; using osu.Game.Rulesets.Mods; namespace osu.Game.Rulesets.Mania.Mods { - public class ManiaModDualStages : Mod, IPlayfieldTypeMod, IApplicableToBeatmapConverter, IApplicableToBeatmap + public class ManiaModDualStages : Mod, IPlayfieldTypeMod, IApplicableToBeatmapConverter, IApplicableToBeatmap { public override string Name => "Dual Stages"; public override string ShortenedName => "DS"; @@ -31,12 +32,12 @@ namespace osu.Game.Rulesets.Mania.Mods mbc.TargetColumns *= 2; } - public void ApplyToBeatmap(IBeatmap beatmap) + public void ApplyToBeatmap(Beatmap beatmap) { if (isForCurrentRuleset) return; - var maniaBeatmap = (ManiaBeatmap) beatmap; + var maniaBeatmap = (ManiaBeatmap)beatmap; var newDefinitions = new List(); foreach (var existing in maniaBeatmap.Stages) diff --git a/osu.Game/Rulesets/Mods/IApplicableToBeatmap.cs b/osu.Game/Rulesets/Mods/IApplicableToBeatmap.cs index e1398ecf2b..1eb74ca76a 100644 --- a/osu.Game/Rulesets/Mods/IApplicableToBeatmap.cs +++ b/osu.Game/Rulesets/Mods/IApplicableToBeatmap.cs @@ -2,18 +2,21 @@ // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE using osu.Game.Beatmaps; +using osu.Game.Rulesets.Objects; namespace osu.Game.Rulesets.Mods { /// - /// Interface for a that applies changes to a . + /// Interface for a that applies changes to a + /// after conversion and post-processing has completed. /// - public interface IApplicableToBeatmap : IApplicableMod + public interface IApplicableToBeatmap : IApplicableMod + where TObject : HitObject { /// - /// Applies this to a . + /// Applies this to a . /// - /// The to apply to. - void ApplyToBeatmap(IBeatmap beatmap); + /// The to apply to. + void ApplyToBeatmap(Beatmap beatmap); } } diff --git a/osu.Game/Rulesets/UI/RulesetContainer.cs b/osu.Game/Rulesets/UI/RulesetContainer.cs index 4b55bb558d..d1303e21a9 100644 --- a/osu.Game/Rulesets/UI/RulesetContainer.cs +++ b/osu.Game/Rulesets/UI/RulesetContainer.cs @@ -271,7 +271,7 @@ namespace osu.Game.Rulesets.UI if (mods == null) return; - foreach (var mod in mods.OfType()) + foreach (var mod in mods.OfType>()) mod.ApplyToBeatmap(Beatmap); } From b0ccd614805c9d89dc1da5f3e5fb5b43ab164dd1 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Mon, 29 Oct 2018 12:41:22 -0700 Subject: [PATCH 368/417] Fix weird code formatting --- build.cake | 70 +++++++++++++++++++++++++++--------------------------- 1 file changed, 35 insertions(+), 35 deletions(-) diff --git a/build.cake b/build.cake index 136ad67ab9..bc7dfafb8c 100644 --- a/build.cake +++ b/build.cake @@ -16,57 +16,57 @@ var osuSolution = new FilePath("./osu.sln"); /////////////////////////////////////////////////////////////////////////////// Task("Restore") -.Does(() => { - DotNetCoreRestore(osuSolution.FullPath); -}); + .Does(() => { + DotNetCoreRestore(osuSolution.FullPath); + }); Task("Compile") -.IsDependentOn("Restore") -.Does(() => { - DotNetCoreBuild(osuSolution.FullPath, new DotNetCoreBuildSettings { - Configuration = configuration, - NoRestore = true, + .IsDependentOn("Restore") + .Does(() => { + DotNetCoreBuild(osuSolution.FullPath, new DotNetCoreBuildSettings { + Configuration = configuration, + NoRestore = true, + }); }); -}); Task("Test") -.IsDependentOn("Compile") -.Does(() => { - var testAssemblies = GetFiles("**/*.Tests/bin/**/*.Tests.dll"); + .IsDependentOn("Compile") + .Does(() => { + var testAssemblies = GetFiles("**/*.Tests/bin/**/*.Tests.dll"); - DotNetCoreVSTest(testAssemblies, new DotNetCoreVSTestSettings { - Logger = AppVeyor.IsRunningOnAppVeyor ? "Appveyor" : $"trx", - Parallel = true, - ToolTimeout = TimeSpan.FromMinutes(10), + DotNetCoreVSTest(testAssemblies, new DotNetCoreVSTestSettings { + Logger = AppVeyor.IsRunningOnAppVeyor ? "Appveyor" : $"trx", + Parallel = true, + ToolTimeout = TimeSpan.FromMinutes(10), + }); }); -}); // windows only because both inspectcore and nvika depend on net45 Task("InspectCode") -.WithCriteria(IsRunningOnWindows()) -.IsDependentOn("Compile") -.Does(() => { - var nVikaToolPath = GetFiles("./tools/NVika.MSBuild.*/tools/NVika.exe").First(); + .WithCriteria(IsRunningOnWindows()) + .IsDependentOn("Compile") + .Does(() => { + var nVikaToolPath = GetFiles("./tools/NVika.MSBuild.*/tools/NVika.exe").First(); - InspectCode(osuSolution, new InspectCodeSettings { - CachesHome = "inspectcode", - OutputFile = "inspectcodereport.xml", + InspectCode(osuSolution, new InspectCodeSettings { + CachesHome = "inspectcode", + OutputFile = "inspectcodereport.xml", + }); + + StartProcess(nVikaToolPath, @"parsereport ""inspectcodereport.xml"" --treatwarningsaserrors"); }); - StartProcess(nVikaToolPath, @"parsereport ""inspectcodereport.xml"" --treatwarningsaserrors"); -}); - Task("CodeFileSanity") -.Does(() => { - ValidateCodeSanity(new ValidateCodeSanitySettings { - RootDirectory = ".", - IsAppveyorBuild = AppVeyor.IsRunningOnAppVeyor + .Does(() => { + ValidateCodeSanity(new ValidateCodeSanitySettings { + RootDirectory = ".", + IsAppveyorBuild = AppVeyor.IsRunningOnAppVeyor + }); }); -}); Task("Build") -.IsDependentOn("CodeFileSanity") -.IsDependentOn("InspectCode") -.IsDependentOn("Test"); + .IsDependentOn("CodeFileSanity") + .IsDependentOn("InspectCode") + .IsDependentOn("Test"); RunTarget(target); \ No newline at end of file From d173335b6d2760936d015d814bd7172e79cc2e07 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Tue, 30 Oct 2018 00:02:32 -0700 Subject: [PATCH 369/417] Reword readme --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 00f55242d2..baaba22726 100644 --- a/README.md +++ b/README.md @@ -25,7 +25,7 @@ Build and run - Using Visual Studio 2017, Rider or Visual Studio Code (configurations are included) - From command line using `dotnet run --project osu.Desktop`. When building for non-development purposes, add `-c Release` to gain higher performance. -- And from command line using `powershell ./build.ps1` or if you use bash as your shell: `./build.sh`. This will also run tests and code analysis. This command is used on CI. The code analysis is windows only. +- To run with code analysis, instead use `powershell ./build.ps1` or `build.sh`. This is currently only supported under windows due to [resharper cli shortcomings](https://youtrack.jetbrains.com/issue/RSRP-410004). Alternative, you can install resharper or use rider to get inline support in your IDE of choice. Note: If you run from command line under linux, you will need to prefix the output folder to your `LD_LIBRARY_PATH`. See `.vscode/launch.json` for an example From 0b534885b8a021b72c184983f38d89ac15ad1f08 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Tue, 30 Oct 2018 00:10:34 -0700 Subject: [PATCH 370/417] Update framework --- osu.Game/osu.Game.csproj | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu.Game/osu.Game.csproj b/osu.Game/osu.Game.csproj index e2b466c69f..2f8c743bee 100644 --- a/osu.Game/osu.Game.csproj +++ b/osu.Game/osu.Game.csproj @@ -18,7 +18,7 @@ - + From 71b6789136b786d36163c8f5bb576f8f8f932d28 Mon Sep 17 00:00:00 2001 From: smoogipoo Date: Tue, 30 Oct 2018 16:47:39 +0900 Subject: [PATCH 371/417] Fix post-merge conflict --- .../Edit/Masks/SliderMasks/Components/SliderBodyPiece.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/osu.Game.Rulesets.Osu/Edit/Masks/SliderMasks/Components/SliderBodyPiece.cs b/osu.Game.Rulesets.Osu/Edit/Masks/SliderMasks/Components/SliderBodyPiece.cs index 0595b046d1..3123a4fcea 100644 --- a/osu.Game.Rulesets.Osu/Edit/Masks/SliderMasks/Components/SliderBodyPiece.cs +++ b/osu.Game.Rulesets.Osu/Edit/Masks/SliderMasks/Components/SliderBodyPiece.cs @@ -13,12 +13,12 @@ namespace osu.Game.Rulesets.Osu.Edit.Masks.SliderMasks.Components public class SliderBodyPiece : CompositeDrawable { private readonly Slider slider; - private readonly SliderBody body; + private readonly SnakingSliderBody body; public SliderBodyPiece(Slider slider) { this.slider = slider; - InternalChild = body = new SliderBody(slider) + InternalChild = body = new SnakingSliderBody(slider) { AccentColour = Color4.Transparent, PathWidth = slider.Scale * 64 From 4bc9161cd1412bfcce6179d210fa6e7a4b43d9a1 Mon Sep 17 00:00:00 2001 From: Paul Teng Date: Tue, 30 Oct 2018 08:32:12 -0400 Subject: [PATCH 372/417] Leave bigger gap if replaying --- osu.Game/Screens/Play/HUDOverlay.cs | 2 ++ osu.Game/Screens/Play/SongProgress.cs | 2 ++ 2 files changed, 4 insertions(+) diff --git a/osu.Game/Screens/Play/HUDOverlay.cs b/osu.Game/Screens/Play/HUDOverlay.cs index db0d7b6ccc..0f9f4fc20a 100644 --- a/osu.Game/Screens/Play/HUDOverlay.cs +++ b/osu.Game/Screens/Play/HUDOverlay.cs @@ -134,11 +134,13 @@ namespace osu.Game.Screens.Play { PlayerSettingsOverlay.Show(); ModDisplay.FadeIn(200); + KeyCounter.Margin = new MarginPadding(10) { Bottom = 30 }; } else { PlayerSettingsOverlay.Hide(); ModDisplay.Delay(2000).FadeOut(200); + KeyCounter.Margin = new MarginPadding(10); } } diff --git a/osu.Game/Screens/Play/SongProgress.cs b/osu.Game/Screens/Play/SongProgress.cs index e921cd602b..d1fc7b3378 100644 --- a/osu.Game/Screens/Play/SongProgress.cs +++ b/osu.Game/Screens/Play/SongProgress.cs @@ -135,6 +135,8 @@ namespace osu.Game.Screens.Play { bar.FadeTo(allowSeeking ? 1 : 0, transition_duration, Easing.In); this.MoveTo(new Vector2(0, allowSeeking ? 0 : bottom_bar_height), transition_duration, Easing.In); + + info.Margin = new MarginPadding { Bottom = Height - (allowSeeking ? 0 : handle_size.Y) }; } protected override void PopIn() From 6f1ef3243d2c7bd21e271e01883cbc2bac202ca8 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Wed, 31 Oct 2018 02:56:25 +0900 Subject: [PATCH 373/417] Proportionally adjust width in line with change --- osu.Game/Screens/Play/SongProgress.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu.Game/Screens/Play/SongProgress.cs b/osu.Game/Screens/Play/SongProgress.cs index d1fc7b3378..d4615b3016 100644 --- a/osu.Game/Screens/Play/SongProgress.cs +++ b/osu.Game/Screens/Play/SongProgress.cs @@ -21,7 +21,7 @@ namespace osu.Game.Screens.Play { private const int bottom_bar_height = 5; - private static readonly Vector2 handle_size = new Vector2(14, 18); + private static readonly Vector2 handle_size = new Vector2(10, 18); private const float transition_duration = 200; From 3207a585c6e4dcd0bd82f74c854b5d05f8afaa42 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Wed, 31 Oct 2018 12:01:10 +0900 Subject: [PATCH 374/417] Add missing xmldoc --- osu.Game/Rulesets/Edit/PlacementMask.cs | 3 +++ 1 file changed, 3 insertions(+) diff --git a/osu.Game/Rulesets/Edit/PlacementMask.cs b/osu.Game/Rulesets/Edit/PlacementMask.cs index a588a9e181..be2c42b586 100644 --- a/osu.Game/Rulesets/Edit/PlacementMask.cs +++ b/osu.Game/Rulesets/Edit/PlacementMask.cs @@ -15,6 +15,9 @@ using OpenTK; namespace osu.Game.Rulesets.Edit { + /// + /// A mask which governs the creation of a new to actualisation. + /// public abstract class PlacementMask : CompositeDrawable, IRequireHighFrequencyMousePosition { /// From 5eaf80ab7671c43412cbad7f185c550fb9313ba2 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Wed, 31 Oct 2018 12:07:06 +0900 Subject: [PATCH 375/417] Add missing newline --- osu.Game/Screens/Edit/Screens/Compose/Layers/MaskSelection.cs | 1 + 1 file changed, 1 insertion(+) diff --git a/osu.Game/Screens/Edit/Screens/Compose/Layers/MaskSelection.cs b/osu.Game/Screens/Edit/Screens/Compose/Layers/MaskSelection.cs index 4946b35abb..17b34bfb49 100644 --- a/osu.Game/Screens/Edit/Screens/Compose/Layers/MaskSelection.cs +++ b/osu.Game/Screens/Edit/Screens/Compose/Layers/MaskSelection.cs @@ -87,6 +87,7 @@ namespace osu.Game.Screens.Edit.Screens.Compose.Layers placementHandler.Delete(h.HitObject.HitObject); return true; } + return base.OnKeyDown(e); } From 214ed43b812666383e4cea2098620404ddef4922 Mon Sep 17 00:00:00 2001 From: Kyle Chang Date: Tue, 30 Oct 2018 23:47:54 -0400 Subject: [PATCH 376/417] Check if SongSelect is current screen before playing selected song --- osu.Game/Screens/Select/SongSelect.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu.Game/Screens/Select/SongSelect.cs b/osu.Game/Screens/Select/SongSelect.cs index 4288483caf..acf699aa24 100644 --- a/osu.Game/Screens/Select/SongSelect.cs +++ b/osu.Game/Screens/Select/SongSelect.cs @@ -350,7 +350,7 @@ namespace osu.Game.Screens.Select } } - ensurePlayingSelected(preview); + if (IsCurrentScreen) ensurePlayingSelected(preview); UpdateBeatmap(Beatmap.Value); } From 29a1d092fad67cd2bdbc65c36ce0fca08dbfd6c6 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Wed, 31 Oct 2018 16:43:35 +0900 Subject: [PATCH 377/417] Don't log disk space related IO errors --- osu.Game/Utils/RavenLogger.cs | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/osu.Game/Utils/RavenLogger.cs b/osu.Game/Utils/RavenLogger.cs index b28dd1fb73..6679ff94a9 100644 --- a/osu.Game/Utils/RavenLogger.cs +++ b/osu.Game/Utils/RavenLogger.cs @@ -3,6 +3,7 @@ using System; using System.Collections.Generic; +using System.IO; using System.Threading.Tasks; using osu.Framework.Logging; using SharpRaven; @@ -35,6 +36,9 @@ namespace osu.Game.Utils if (exception != null) { + if (exception is IOException ioe && ioe.Message.StartsWith("There is not enough space on the disk")) + return; + // since we let unhandled exceptions go ignored at times, we want to ensure they don't get submitted on subsequent reports. if (lastException != null && lastException.Message == exception.Message && exception.StackTrace.StartsWith(lastException.StackTrace)) From 9aa88293e2509a9f9a3f3426647519e505e94992 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Wed, 31 Oct 2018 17:07:05 +0900 Subject: [PATCH 378/417] Use HResult --- osu.Game/Utils/RavenLogger.cs | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/osu.Game/Utils/RavenLogger.cs b/osu.Game/Utils/RavenLogger.cs index 6679ff94a9..c6e6d1e9d7 100644 --- a/osu.Game/Utils/RavenLogger.cs +++ b/osu.Game/Utils/RavenLogger.cs @@ -36,8 +36,15 @@ namespace osu.Game.Utils if (exception != null) { - if (exception is IOException ioe && ioe.Message.StartsWith("There is not enough space on the disk")) - return; + if (exception is IOException ioe) + { + // disk full exceptions, see https://stackoverflow.com/a/9294382 + const int hr_error_handle_disk_full = unchecked((int)0x80070027); + const int hr_error_disk_full = unchecked((int)0x80070070); + + if (ioe.HResult == hr_error_handle_disk_full || ioe.HResult == hr_error_disk_full) + return; + } // since we let unhandled exceptions go ignored at times, we want to ensure they don't get submitted on subsequent reports. if (lastException != null && From 85a732591141310e576abbe95c7c073cc32bd2d3 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Wed, 31 Oct 2018 17:23:27 +0900 Subject: [PATCH 379/417] Fix placement masks handling scroll events --- osu.Game/Rulesets/Edit/PlacementMask.cs | 2 ++ 1 file changed, 2 insertions(+) diff --git a/osu.Game/Rulesets/Edit/PlacementMask.cs b/osu.Game/Rulesets/Edit/PlacementMask.cs index be2c42b586..97c6a74c92 100644 --- a/osu.Game/Rulesets/Edit/PlacementMask.cs +++ b/osu.Game/Rulesets/Edit/PlacementMask.cs @@ -84,6 +84,8 @@ namespace osu.Game.Rulesets.Edit switch (e) { + case ScrollEvent _: + return false; case MouseEvent _: return true; default: From d2fbf051377bc1af9bf2e0a61bc0f8715364cc54 Mon Sep 17 00:00:00 2001 From: smoogipoo Date: Wed, 31 Oct 2018 18:01:53 +0900 Subject: [PATCH 380/417] Reduce size of control point --- .../Edit/Masks/SliderMasks/Components/ControlPointPiece.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu.Game.Rulesets.Osu/Edit/Masks/SliderMasks/Components/ControlPointPiece.cs b/osu.Game.Rulesets.Osu/Edit/Masks/SliderMasks/Components/ControlPointPiece.cs index b1d157d9b7..2c6f9120c2 100644 --- a/osu.Game.Rulesets.Osu/Edit/Masks/SliderMasks/Components/ControlPointPiece.cs +++ b/osu.Game.Rulesets.Osu/Edit/Masks/SliderMasks/Components/ControlPointPiece.cs @@ -44,7 +44,7 @@ namespace osu.Game.Rulesets.Osu.Edit.Masks.SliderMasks.Components { Anchor = Anchor.Centre, Origin = Anchor.Centre, - Size = new Vector2(15), + Size = new Vector2(10), Masking = true, Child = new Box { RelativeSizeAxes = Axes.Both } } From ffec532079a74c71478b1e2cda3ac770c76a5ef6 Mon Sep 17 00:00:00 2001 From: smoogipoo Date: Wed, 31 Oct 2018 18:02:08 +0900 Subject: [PATCH 381/417] Fix segment control points not changing in unison --- .../Components/ControlPointPiece.cs | 34 +++++++------------ 1 file changed, 13 insertions(+), 21 deletions(-) diff --git a/osu.Game.Rulesets.Osu/Edit/Masks/SliderMasks/Components/ControlPointPiece.cs b/osu.Game.Rulesets.Osu/Edit/Masks/SliderMasks/Components/ControlPointPiece.cs index 2c6f9120c2..aedde870ca 100644 --- a/osu.Game.Rulesets.Osu/Edit/Masks/SliderMasks/Components/ControlPointPiece.cs +++ b/osu.Game.Rulesets.Osu/Edit/Masks/SliderMasks/Components/ControlPointPiece.cs @@ -76,46 +76,38 @@ namespace osu.Game.Rulesets.Osu.Edit.Masks.SliderMasks.Components protected override bool OnDrag(DragEvent e) { + var newControlPoints = slider.ControlPoints.ToArray(); + if (index == 0) { // Special handling for the head - only the position of the slider changes slider.Position += e.Delta; // Since control points are relative to the position of the slider, they all need to be offset backwards by the delta - var newControlPoints = slider.ControlPoints.ToArray(); for (int i = 1; i < newControlPoints.Length; i++) newControlPoints[i] -= e.Delta; - - slider.ControlPoints = newControlPoints; - slider.Curve.Calculate(true); } else - { - var newControlPoints = slider.ControlPoints.ToArray(); newControlPoints[index] += e.Delta; - slider.ControlPoints = newControlPoints; - slider.Curve.Calculate(true); - } + if (isSegmentSeparatorWithNext) + newControlPoints[index + 1] = newControlPoints[index]; + + if (isSegmentSeparatorWithPrevious) + newControlPoints[index - 1] = newControlPoints[index]; + + slider.ControlPoints = newControlPoints; + slider.Curve.Calculate(true); return true; } protected override bool OnDragEnd(DragEndEvent e) => true; - private bool isSegmentSeparator - { - get - { - bool separator = false; + private bool isSegmentSeparator => isSegmentSeparatorWithNext || isSegmentSeparatorWithPrevious; - if (index < slider.ControlPoints.Length - 1) - separator |= slider.ControlPoints[index + 1] == slider.ControlPoints[index]; - if (index > 0) - separator |= slider.ControlPoints[index - 1] == slider.ControlPoints[index]; + private bool isSegmentSeparatorWithNext => index < slider.ControlPoints.Length - 1 && slider.ControlPoints[index + 1] == slider.ControlPoints[index]; - return separator; - } - } + private bool isSegmentSeparatorWithPrevious => index > 0 && slider.ControlPoints[index - 1] == slider.ControlPoints[index]; } } From bb2f8deb18bff435c70a96d36dee0d1e1c0e1d0a Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Thu, 1 Nov 2018 03:52:24 +0900 Subject: [PATCH 382/417] ControlPoint -> PathControlPoint Also Curve -> Path. --- .../TestCaseAutoJuiceStream.cs | 2 +- .../Beatmaps/CatchBeatmapConverter.cs | 2 +- .../Objects/JuiceStream.cs | 26 +++++++++---------- osu.Game.Rulesets.Osu.Tests/TestCaseSlider.cs | 8 +++--- .../TestCaseSliderSelectionMask.cs | 6 ++--- .../Beatmaps/OsuBeatmapConverter.cs | 2 +- .../Preprocessing/OsuDifficultyHitObject.cs | 2 +- ...PointPiece.cs => PathControlPointPiece.cs} | 6 ++--- ...liser.cs => PathControlPointVisualiser.cs} | 16 ++++++------ .../Components/SliderCirclePiece.cs | 4 +-- .../Masks/SliderMasks/SliderSelectionMask.cs | 2 +- osu.Game.Rulesets.Osu/Mods/OsuModHardRock.cs | 2 +- .../Objects/Drawables/DrawableSlider.cs | 2 +- .../Drawables/Pieces/SnakingSliderBody.cs | 4 +-- osu.Game.Rulesets.Osu/Objects/Slider.cs | 26 +++++++++---------- .../Legacy/Catch/ConvertHitObjectParser.cs | 4 +-- .../Objects/Legacy/ConvertHitObjectParser.cs | 20 +++++++------- .../Rulesets/Objects/Legacy/ConvertSlider.cs | 4 +-- .../Legacy/Mania/ConvertHitObjectParser.cs | 4 +-- .../Legacy/Osu/ConvertHitObjectParser.cs | 4 +-- .../Legacy/Taiko/ConvertHitObjectParser.cs | 4 +-- .../Objects/{SliderCurve.cs => SliderPath.cs} | 26 +++++++++---------- osu.Game/Rulesets/Objects/Types/IHasCurve.cs | 6 ++--- .../Types/{CurveType.cs => PathType.cs} | 2 +- 24 files changed, 92 insertions(+), 92 deletions(-) rename osu.Game.Rulesets.Osu/Edit/Masks/SliderMasks/Components/{ControlPointPiece.cs => PathControlPointPiece.cs} (95%) rename osu.Game.Rulesets.Osu/Edit/Masks/SliderMasks/Components/{ControlPointVisualiser.cs => PathControlPointVisualiser.cs} (54%) rename osu.Game/Rulesets/Objects/{SliderCurve.cs => SliderPath.cs} (92%) rename osu.Game/Rulesets/Objects/Types/{CurveType.cs => PathType.cs} (91%) diff --git a/osu.Game.Rulesets.Catch.Tests/TestCaseAutoJuiceStream.cs b/osu.Game.Rulesets.Catch.Tests/TestCaseAutoJuiceStream.cs index 5e68acde94..cac1356c81 100644 --- a/osu.Game.Rulesets.Catch.Tests/TestCaseAutoJuiceStream.cs +++ b/osu.Game.Rulesets.Catch.Tests/TestCaseAutoJuiceStream.cs @@ -42,7 +42,7 @@ namespace osu.Game.Rulesets.Catch.Tests Vector2.Zero, new Vector2(width * CatchPlayfield.BASE_WIDTH, 0) }, - CurveType = CurveType.Linear, + PathType = PathType.Linear, Distance = width * CatchPlayfield.BASE_WIDTH, StartTime = i * 2000, NewCombo = i % 8 == 0 diff --git a/osu.Game.Rulesets.Catch/Beatmaps/CatchBeatmapConverter.cs b/osu.Game.Rulesets.Catch/Beatmaps/CatchBeatmapConverter.cs index 15d4edc411..a178748bd5 100644 --- a/osu.Game.Rulesets.Catch/Beatmaps/CatchBeatmapConverter.cs +++ b/osu.Game.Rulesets.Catch/Beatmaps/CatchBeatmapConverter.cs @@ -35,7 +35,7 @@ namespace osu.Game.Rulesets.Catch.Beatmaps StartTime = obj.StartTime, Samples = obj.Samples, ControlPoints = curveData.ControlPoints, - CurveType = curveData.CurveType, + PathType = curveData.PathType, Distance = curveData.Distance, RepeatSamples = curveData.RepeatSamples, RepeatCount = curveData.RepeatCount, diff --git a/osu.Game.Rulesets.Catch/Objects/JuiceStream.cs b/osu.Game.Rulesets.Catch/Objects/JuiceStream.cs index 82e32d24d2..da581d9619 100644 --- a/osu.Game.Rulesets.Catch/Objects/JuiceStream.cs +++ b/osu.Game.Rulesets.Catch/Objects/JuiceStream.cs @@ -50,7 +50,7 @@ namespace osu.Game.Rulesets.Catch.Objects if (TickDistance == 0) return; - var length = Curve.Distance; + var length = Path.Distance; var tickDistance = Math.Min(TickDistance, length); var spanDuration = length / Velocity; @@ -95,7 +95,7 @@ namespace osu.Game.Rulesets.Catch.Objects AddNested(new TinyDroplet { StartTime = t, - X = X + Curve.PositionAt(progress).X / CatchPlayfield.BASE_WIDTH, + X = X + Path.PositionAt(progress).X / CatchPlayfield.BASE_WIDTH, Samples = new List(Samples.Select(s => new SampleInfo { Bank = s.Bank, @@ -110,7 +110,7 @@ namespace osu.Game.Rulesets.Catch.Objects AddNested(new Droplet { StartTime = time, - X = X + Curve.PositionAt(distanceProgress).X / CatchPlayfield.BASE_WIDTH, + X = X + Path.PositionAt(distanceProgress).X / CatchPlayfield.BASE_WIDTH, Samples = new List(Samples.Select(s => new SampleInfo { Bank = s.Bank, @@ -127,12 +127,12 @@ namespace osu.Game.Rulesets.Catch.Objects { Samples = Samples, StartTime = spanStartTime + spanDuration, - X = X + Curve.PositionAt(reversed ? 0 : 1).X / CatchPlayfield.BASE_WIDTH + X = X + Path.PositionAt(reversed ? 0 : 1).X / CatchPlayfield.BASE_WIDTH }); } } - public double EndTime => StartTime + this.SpanCount() * Curve.Distance / Velocity; + public double EndTime => StartTime + this.SpanCount() * Path.Distance / Velocity; public float EndX => X + this.CurvePositionAt(1).X / CatchPlayfield.BASE_WIDTH; @@ -140,24 +140,24 @@ namespace osu.Game.Rulesets.Catch.Objects public double Distance { - get { return Curve.Distance; } - set { Curve.Distance = value; } + get { return Path.Distance; } + set { Path.Distance = value; } } - public SliderCurve Curve { get; } = new SliderCurve(); + public SliderPath Path { get; } = new SliderPath(); public Vector2[] ControlPoints { - get { return Curve.ControlPoints; } - set { Curve.ControlPoints = value; } + get { return Path.ControlPoints; } + set { Path.ControlPoints = value; } } public List> RepeatSamples { get; set; } = new List>(); - public CurveType CurveType + public PathType PathType { - get { return Curve.CurveType; } - set { Curve.CurveType = value; } + get { return Path.PathType; } + set { Path.PathType = value; } } public double? LegacyLastTickOffset { get; set; } diff --git a/osu.Game.Rulesets.Osu.Tests/TestCaseSlider.cs b/osu.Game.Rulesets.Osu.Tests/TestCaseSlider.cs index 300ac16155..4c0385deda 100644 --- a/osu.Game.Rulesets.Osu.Tests/TestCaseSlider.cs +++ b/osu.Game.Rulesets.Osu.Tests/TestCaseSlider.cs @@ -181,7 +181,7 @@ namespace osu.Game.Rulesets.Osu.Tests { var slider = new Slider { - CurveType = CurveType.Linear, + PathType = PathType.Linear, StartTime = Time.Current + 1000, Position = new Vector2(-200, 0), ControlPoints = new[] @@ -207,7 +207,7 @@ namespace osu.Game.Rulesets.Osu.Tests { var slider = new Slider { - CurveType = CurveType.Bezier, + PathType = PathType.Bezier, StartTime = Time.Current + 1000, Position = new Vector2(-200, 0), ControlPoints = new[] @@ -232,7 +232,7 @@ namespace osu.Game.Rulesets.Osu.Tests { var slider = new Slider { - CurveType = CurveType.Linear, + PathType = PathType.Linear, StartTime = Time.Current + 1000, Position = new Vector2(0, 0), ControlPoints = new[] @@ -264,7 +264,7 @@ namespace osu.Game.Rulesets.Osu.Tests { StartTime = Time.Current + 1000, Position = new Vector2(-100, 0), - CurveType = CurveType.Catmull, + PathType = PathType.Catmull, ControlPoints = new[] { Vector2.Zero, diff --git a/osu.Game.Rulesets.Osu.Tests/TestCaseSliderSelectionMask.cs b/osu.Game.Rulesets.Osu.Tests/TestCaseSliderSelectionMask.cs index 1ba3e26e65..87e0e1a7ec 100644 --- a/osu.Game.Rulesets.Osu.Tests/TestCaseSliderSelectionMask.cs +++ b/osu.Game.Rulesets.Osu.Tests/TestCaseSliderSelectionMask.cs @@ -24,8 +24,8 @@ namespace osu.Game.Rulesets.Osu.Tests typeof(SliderCircleSelectionMask), typeof(SliderBodyPiece), typeof(SliderCircle), - typeof(ControlPointVisualiser), - typeof(ControlPointPiece) + typeof(PathControlPointVisualiser), + typeof(PathControlPointPiece) }; private readonly DrawableSlider drawableObject; @@ -41,7 +41,7 @@ namespace osu.Game.Rulesets.Osu.Tests new Vector2(150, 150), new Vector2(300, 0) }, - CurveType = CurveType.Bezier, + PathType = PathType.Bezier, Distance = 350 }; diff --git a/osu.Game.Rulesets.Osu/Beatmaps/OsuBeatmapConverter.cs b/osu.Game.Rulesets.Osu/Beatmaps/OsuBeatmapConverter.cs index b2914d4b82..9f432fc31a 100644 --- a/osu.Game.Rulesets.Osu/Beatmaps/OsuBeatmapConverter.cs +++ b/osu.Game.Rulesets.Osu/Beatmaps/OsuBeatmapConverter.cs @@ -36,7 +36,7 @@ namespace osu.Game.Rulesets.Osu.Beatmaps StartTime = original.StartTime, Samples = original.Samples, ControlPoints = curveData.ControlPoints, - CurveType = curveData.CurveType, + PathType = curveData.PathType, Distance = curveData.Distance, RepeatSamples = curveData.RepeatSamples, RepeatCount = curveData.RepeatCount, diff --git a/osu.Game.Rulesets.Osu/Difficulty/Preprocessing/OsuDifficultyHitObject.cs b/osu.Game.Rulesets.Osu/Difficulty/Preprocessing/OsuDifficultyHitObject.cs index d6684f55af..39e3c009da 100644 --- a/osu.Game.Rulesets.Osu/Difficulty/Preprocessing/OsuDifficultyHitObject.cs +++ b/osu.Game.Rulesets.Osu/Difficulty/Preprocessing/OsuDifficultyHitObject.cs @@ -108,7 +108,7 @@ namespace osu.Game.Rulesets.Osu.Difficulty.Preprocessing progress = progress % 1; // ReSharper disable once PossibleInvalidOperationException (bugged in current r# version) - var diff = slider.StackedPosition + slider.Curve.PositionAt(progress) - slider.LazyEndPosition.Value; + var diff = slider.StackedPosition + slider.Path.PositionAt(progress) - slider.LazyEndPosition.Value; float dist = diff.Length; if (dist > approxFollowCircleRadius) diff --git a/osu.Game.Rulesets.Osu/Edit/Masks/SliderMasks/Components/ControlPointPiece.cs b/osu.Game.Rulesets.Osu/Edit/Masks/SliderMasks/Components/PathControlPointPiece.cs similarity index 95% rename from osu.Game.Rulesets.Osu/Edit/Masks/SliderMasks/Components/ControlPointPiece.cs rename to osu.Game.Rulesets.Osu/Edit/Masks/SliderMasks/Components/PathControlPointPiece.cs index aedde870ca..70156578b4 100644 --- a/osu.Game.Rulesets.Osu/Edit/Masks/SliderMasks/Components/ControlPointPiece.cs +++ b/osu.Game.Rulesets.Osu/Edit/Masks/SliderMasks/Components/PathControlPointPiece.cs @@ -14,7 +14,7 @@ using OpenTK; namespace osu.Game.Rulesets.Osu.Edit.Masks.SliderMasks.Components { - public class ControlPointPiece : CompositeDrawable + public class PathControlPointPiece : CompositeDrawable { private readonly Slider slider; private readonly int index; @@ -25,7 +25,7 @@ namespace osu.Game.Rulesets.Osu.Edit.Masks.SliderMasks.Components [Resolved] private OsuColour colours { get; set; } - public ControlPointPiece(Slider slider, int index) + public PathControlPointPiece(Slider slider, int index) { this.slider = slider; this.index = index; @@ -97,7 +97,7 @@ namespace osu.Game.Rulesets.Osu.Edit.Masks.SliderMasks.Components newControlPoints[index - 1] = newControlPoints[index]; slider.ControlPoints = newControlPoints; - slider.Curve.Calculate(true); + slider.Path.Calculate(true); return true; } diff --git a/osu.Game.Rulesets.Osu/Edit/Masks/SliderMasks/Components/ControlPointVisualiser.cs b/osu.Game.Rulesets.Osu/Edit/Masks/SliderMasks/Components/PathControlPointVisualiser.cs similarity index 54% rename from osu.Game.Rulesets.Osu/Edit/Masks/SliderMasks/Components/ControlPointVisualiser.cs rename to osu.Game.Rulesets.Osu/Edit/Masks/SliderMasks/Components/PathControlPointVisualiser.cs index d8031c4f5b..1d25f8cd39 100644 --- a/osu.Game.Rulesets.Osu/Edit/Masks/SliderMasks/Components/ControlPointVisualiser.cs +++ b/osu.Game.Rulesets.Osu/Edit/Masks/SliderMasks/Components/PathControlPointVisualiser.cs @@ -7,26 +7,26 @@ using osu.Game.Rulesets.Osu.Objects; namespace osu.Game.Rulesets.Osu.Edit.Masks.SliderMasks.Components { - public class ControlPointVisualiser : CompositeDrawable + public class PathControlPointVisualiser : CompositeDrawable { private readonly Slider slider; - private readonly Container pieces; + private readonly Container pieces; - public ControlPointVisualiser(Slider slider) + public PathControlPointVisualiser(Slider slider) { this.slider = slider; - InternalChild = pieces = new Container { RelativeSizeAxes = Axes.Both }; + InternalChild = pieces = new Container { RelativeSizeAxes = Axes.Both }; - slider.ControlPointsChanged += _ => updateControlPoints(); - updateControlPoints(); + slider.ControlPointsChanged += _ => updatePathControlPoints(); + updatePathControlPoints(); } - private void updateControlPoints() + private void updatePathControlPoints() { while (slider.ControlPoints.Length > pieces.Count) - pieces.Add(new ControlPointPiece(slider, pieces.Count)); + pieces.Add(new PathControlPointPiece(slider, pieces.Count)); while (slider.ControlPoints.Length < pieces.Count) pieces.Remove(pieces[pieces.Count - 1]); } diff --git a/osu.Game.Rulesets.Osu/Edit/Masks/SliderMasks/Components/SliderCirclePiece.cs b/osu.Game.Rulesets.Osu/Edit/Masks/SliderMasks/Components/SliderCirclePiece.cs index a8565fafb6..7864429d93 100644 --- a/osu.Game.Rulesets.Osu/Edit/Masks/SliderMasks/Components/SliderCirclePiece.cs +++ b/osu.Game.Rulesets.Osu/Edit/Masks/SliderMasks/Components/SliderCirclePiece.cs @@ -25,10 +25,10 @@ namespace osu.Game.Rulesets.Osu.Edit.Masks.SliderMasks.Components switch (position) { case SliderPosition.Start: - Position = slider.StackedPosition + slider.Curve.PositionAt(0); + Position = slider.StackedPosition + slider.Path.PositionAt(0); break; case SliderPosition.End: - Position = slider.StackedPosition + slider.Curve.PositionAt(1); + Position = slider.StackedPosition + slider.Path.PositionAt(1); break; } } diff --git a/osu.Game.Rulesets.Osu/Edit/Masks/SliderMasks/SliderSelectionMask.cs b/osu.Game.Rulesets.Osu/Edit/Masks/SliderMasks/SliderSelectionMask.cs index 8478374a5f..b79b0ba1fb 100644 --- a/osu.Game.Rulesets.Osu/Edit/Masks/SliderMasks/SliderSelectionMask.cs +++ b/osu.Game.Rulesets.Osu/Edit/Masks/SliderMasks/SliderSelectionMask.cs @@ -24,7 +24,7 @@ namespace osu.Game.Rulesets.Osu.Edit.Masks.SliderMasks new SliderBodyPiece(sliderObject), headMask = new SliderCircleSelectionMask(slider.HeadCircle, sliderObject, SliderPosition.Start), new SliderCircleSelectionMask(slider.TailCircle, sliderObject, SliderPosition.End), - new ControlPointVisualiser(sliderObject), + new PathControlPointVisualiser(sliderObject), }; } diff --git a/osu.Game.Rulesets.Osu/Mods/OsuModHardRock.cs b/osu.Game.Rulesets.Osu/Mods/OsuModHardRock.cs index 1b3725a15e..e01d71e1f8 100644 --- a/osu.Game.Rulesets.Osu/Mods/OsuModHardRock.cs +++ b/osu.Game.Rulesets.Osu/Mods/OsuModHardRock.cs @@ -37,7 +37,7 @@ namespace osu.Game.Rulesets.Osu.Mods newControlPoints[i] = new Vector2(slider.ControlPoints[i].X, -slider.ControlPoints[i].Y); slider.ControlPoints = newControlPoints; - slider.Curve?.Calculate(); // Recalculate the slider curve + slider.Path?.Calculate(); // Recalculate the slider curve } } } diff --git a/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableSlider.cs b/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableSlider.cs index 7599001a82..a137343cfe 100644 --- a/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableSlider.cs +++ b/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableSlider.cs @@ -121,7 +121,7 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables double completionProgress = MathHelper.Clamp((Time.Current - slider.StartTime) / slider.Duration, 0, 1); foreach (var c in components.OfType()) c.UpdateProgress(completionProgress); - foreach (var c in components.OfType()) c.UpdateSnakingPosition(slider.Curve.PositionAt(Body.SnakedStart ?? 0), slider.Curve.PositionAt(Body.SnakedEnd ?? 0)); + foreach (var c in components.OfType()) c.UpdateSnakingPosition(slider.Path.PositionAt(Body.SnakedStart ?? 0), slider.Path.PositionAt(Body.SnakedEnd ?? 0)); foreach (var t in components.OfType()) t.Tracking = Ball.Tracking; Size = Body.Size; diff --git a/osu.Game.Rulesets.Osu/Objects/Drawables/Pieces/SnakingSliderBody.cs b/osu.Game.Rulesets.Osu/Objects/Drawables/Pieces/SnakingSliderBody.cs index 3d02f9a92d..0e6f3ad16c 100644 --- a/osu.Game.Rulesets.Osu/Objects/Drawables/Pieces/SnakingSliderBody.cs +++ b/osu.Game.Rulesets.Osu/Objects/Drawables/Pieces/SnakingSliderBody.cs @@ -75,7 +75,7 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables.Pieces public void Refresh() { // Generate the entire curve - slider.Curve.GetPathToProgress(CurrentCurve, 0, 1); + slider.Path.GetPathToProgress(CurrentCurve, 0, 1); SetVertices(CurrentCurve); // The body is sized to the full path size to avoid excessive autosize computations @@ -103,7 +103,7 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables.Pieces SnakedStart = p0; SnakedEnd = p1; - slider.Curve.GetPathToProgress(CurrentCurve, p0, p1); + slider.Path.GetPathToProgress(CurrentCurve, p0, p1); SetVertices(CurrentCurve); diff --git a/osu.Game.Rulesets.Osu/Objects/Slider.cs b/osu.Game.Rulesets.Osu/Objects/Slider.cs index de7ba8451b..b7240991d4 100644 --- a/osu.Game.Rulesets.Osu/Objects/Slider.cs +++ b/osu.Game.Rulesets.Osu/Objects/Slider.cs @@ -24,7 +24,7 @@ namespace osu.Game.Rulesets.Osu.Objects public event Action ControlPointsChanged; - public double EndTime => StartTime + this.SpanCount() * Curve.Distance / Velocity; + public double EndTime => StartTime + this.SpanCount() * Path.Distance / Velocity; public double Duration => EndTime - StartTime; public Vector2 StackedPositionAt(double t) => StackedPosition + this.CurvePositionAt(t); @@ -52,16 +52,16 @@ namespace osu.Game.Rulesets.Osu.Objects } } - public SliderCurve Curve { get; } = new SliderCurve(); + public SliderPath Path { get; } = new SliderPath(); public Vector2[] ControlPoints { - get => Curve.ControlPoints; + get => Path.ControlPoints; set { - if (Curve.ControlPoints == value) + if (Path.ControlPoints == value) return; - Curve.ControlPoints = value; + Path.ControlPoints = value; ControlPointsChanged?.Invoke(value); @@ -70,16 +70,16 @@ namespace osu.Game.Rulesets.Osu.Objects } } - public CurveType CurveType + public PathType PathType { - get { return Curve.CurveType; } - set { Curve.CurveType = value; } + get { return Path.PathType; } + set { Path.PathType = value; } } public double Distance { - get { return Curve.Distance; } - set { Curve.Distance = value; } + get { return Path.Distance; } + set { Path.Distance = value; } } public override Vector2 Position @@ -189,7 +189,7 @@ namespace osu.Game.Rulesets.Osu.Objects private void createTicks() { - var length = Curve.Distance; + var length = Path.Distance; var tickDistance = MathHelper.Clamp(TickDistance, 0, length); if (tickDistance == 0) return; @@ -228,7 +228,7 @@ namespace osu.Game.Rulesets.Osu.Objects SpanIndex = span, SpanStartTime = spanStartTime, StartTime = spanStartTime + timeProgress * SpanDuration, - Position = Position + Curve.PositionAt(distanceProgress), + Position = Position + Path.PositionAt(distanceProgress), StackHeight = StackHeight, Scale = Scale, Samples = sampleList @@ -246,7 +246,7 @@ namespace osu.Game.Rulesets.Osu.Objects RepeatIndex = repeatIndex, SpanDuration = SpanDuration, StartTime = StartTime + repeat * SpanDuration, - Position = Position + Curve.PositionAt(repeat % 2), + Position = Position + Path.PositionAt(repeat % 2), StackHeight = StackHeight, Scale = Scale, Samples = new List(RepeatSamples[repeatIndex]) diff --git a/osu.Game/Rulesets/Objects/Legacy/Catch/ConvertHitObjectParser.cs b/osu.Game/Rulesets/Objects/Legacy/Catch/ConvertHitObjectParser.cs index 9c9fc2e742..85efdca07b 100644 --- a/osu.Game/Rulesets/Objects/Legacy/Catch/ConvertHitObjectParser.cs +++ b/osu.Game/Rulesets/Objects/Legacy/Catch/ConvertHitObjectParser.cs @@ -37,7 +37,7 @@ namespace osu.Game.Rulesets.Objects.Legacy.Catch }; } - protected override HitObject CreateSlider(Vector2 position, bool newCombo, int comboOffset, Vector2[] controlPoints, double length, CurveType curveType, int repeatCount, List> repeatSamples) + protected override HitObject CreateSlider(Vector2 position, bool newCombo, int comboOffset, Vector2[] controlPoints, double length, PathType pathType, int repeatCount, List> repeatSamples) { newCombo |= forceNewCombo; comboOffset += extraComboOffset; @@ -52,7 +52,7 @@ namespace osu.Game.Rulesets.Objects.Legacy.Catch ComboOffset = comboOffset, ControlPoints = controlPoints, Distance = length, - CurveType = curveType, + PathType = pathType, RepeatSamples = repeatSamples, RepeatCount = repeatCount }; diff --git a/osu.Game/Rulesets/Objects/Legacy/ConvertHitObjectParser.cs b/osu.Game/Rulesets/Objects/Legacy/ConvertHitObjectParser.cs index 965e76d27a..73f70d414f 100644 --- a/osu.Game/Rulesets/Objects/Legacy/ConvertHitObjectParser.cs +++ b/osu.Game/Rulesets/Objects/Legacy/ConvertHitObjectParser.cs @@ -70,7 +70,7 @@ namespace osu.Game.Rulesets.Objects.Legacy } else if (type.HasFlag(ConvertHitObjectType.Slider)) { - CurveType curveType = CurveType.Catmull; + PathType pathType = PathType.Catmull; double length = 0; string[] pointSplit = split[5].Split('|'); @@ -90,16 +90,16 @@ namespace osu.Game.Rulesets.Objects.Legacy switch (t) { case @"C": - curveType = CurveType.Catmull; + pathType = PathType.Catmull; break; case @"B": - curveType = CurveType.Bezier; + pathType = PathType.Bezier; break; case @"L": - curveType = CurveType.Linear; + pathType = PathType.Linear; break; case @"P": - curveType = CurveType.PerfectCurve; + pathType = PathType.PerfectCurve; break; } @@ -113,8 +113,8 @@ namespace osu.Game.Rulesets.Objects.Legacy // osu-stable special-cased colinear perfect curves to a CurveType.Linear bool isLinear(Vector2[] p) => Precision.AlmostEquals(0, (p[1].Y - p[0].Y) * (p[2].X - p[0].X) - (p[1].X - p[0].X) * (p[2].Y - p[0].Y)); - if (points.Length == 3 && curveType == CurveType.PerfectCurve && isLinear(points)) - curveType = CurveType.Linear; + if (points.Length == 3 && pathType == PathType.PerfectCurve && isLinear(points)) + pathType = PathType.Linear; int repeatCount = Convert.ToInt32(split[6], CultureInfo.InvariantCulture); @@ -178,7 +178,7 @@ namespace osu.Game.Rulesets.Objects.Legacy for (int i = 0; i < nodes; i++) nodeSamples.Add(convertSoundType(nodeSoundTypes[i], nodeBankInfos[i])); - result = CreateSlider(pos, combo, comboOffset, points, length, curveType, repeatCount, nodeSamples); + result = CreateSlider(pos, combo, comboOffset, points, length, pathType, repeatCount, nodeSamples); } else if (type.HasFlag(ConvertHitObjectType.Spinner)) { @@ -268,11 +268,11 @@ namespace osu.Game.Rulesets.Objects.Legacy /// When starting a new combo, the offset of the new combo relative to the current one. /// The slider control points. /// The slider length. - /// The slider curve type. + /// The slider curve type. /// The slider repeat count. /// The samples to be played when the repeat nodes are hit. This includes the head and tail of the slider. /// The hit object. - protected abstract HitObject CreateSlider(Vector2 position, bool newCombo, int comboOffset, Vector2[] controlPoints, double length, CurveType curveType, int repeatCount, List> repeatSamples); + protected abstract HitObject CreateSlider(Vector2 position, bool newCombo, int comboOffset, Vector2[] controlPoints, double length, PathType pathType, int repeatCount, List> repeatSamples); /// /// Creates a legacy Spinner-type hit object. diff --git a/osu.Game/Rulesets/Objects/Legacy/ConvertSlider.cs b/osu.Game/Rulesets/Objects/Legacy/ConvertSlider.cs index 93c49ea3ce..6030bff427 100644 --- a/osu.Game/Rulesets/Objects/Legacy/ConvertSlider.cs +++ b/osu.Game/Rulesets/Objects/Legacy/ConvertSlider.cs @@ -20,9 +20,9 @@ namespace osu.Game.Rulesets.Objects.Legacy /// /// s don't need a curve since they're converted to ruleset-specific hitobjects. /// - public SliderCurve Curve { get; } = null; + public SliderPath Path { get; } = null; public Vector2[] ControlPoints { get; set; } - public CurveType CurveType { get; set; } + public PathType PathType { get; set; } public double Distance { get; set; } diff --git a/osu.Game/Rulesets/Objects/Legacy/Mania/ConvertHitObjectParser.cs b/osu.Game/Rulesets/Objects/Legacy/Mania/ConvertHitObjectParser.cs index 68e05f6223..6f10880aa2 100644 --- a/osu.Game/Rulesets/Objects/Legacy/Mania/ConvertHitObjectParser.cs +++ b/osu.Game/Rulesets/Objects/Legacy/Mania/ConvertHitObjectParser.cs @@ -26,14 +26,14 @@ namespace osu.Game.Rulesets.Objects.Legacy.Mania }; } - protected override HitObject CreateSlider(Vector2 position, bool newCombo, int comboOffset, Vector2[] controlPoints, double length, CurveType curveType, int repeatCount, List> repeatSamples) + protected override HitObject CreateSlider(Vector2 position, bool newCombo, int comboOffset, Vector2[] controlPoints, double length, PathType pathType, int repeatCount, List> repeatSamples) { return new ConvertSlider { X = position.X, ControlPoints = controlPoints, Distance = length, - CurveType = curveType, + PathType = pathType, RepeatSamples = repeatSamples, RepeatCount = repeatCount }; diff --git a/osu.Game/Rulesets/Objects/Legacy/Osu/ConvertHitObjectParser.cs b/osu.Game/Rulesets/Objects/Legacy/Osu/ConvertHitObjectParser.cs index f3c815fc32..31c200eddc 100644 --- a/osu.Game/Rulesets/Objects/Legacy/Osu/ConvertHitObjectParser.cs +++ b/osu.Game/Rulesets/Objects/Legacy/Osu/ConvertHitObjectParser.cs @@ -38,7 +38,7 @@ namespace osu.Game.Rulesets.Objects.Legacy.Osu }; } - protected override HitObject CreateSlider(Vector2 position, bool newCombo, int comboOffset, Vector2[] controlPoints, double length, CurveType curveType, int repeatCount, List> repeatSamples) + protected override HitObject CreateSlider(Vector2 position, bool newCombo, int comboOffset, Vector2[] controlPoints, double length, PathType pathType, int repeatCount, List> repeatSamples) { newCombo |= forceNewCombo; comboOffset += extraComboOffset; @@ -53,7 +53,7 @@ namespace osu.Game.Rulesets.Objects.Legacy.Osu ComboOffset = comboOffset, ControlPoints = controlPoints, Distance = Math.Max(0, length), - CurveType = curveType, + PathType = pathType, RepeatSamples = repeatSamples, RepeatCount = repeatCount }; diff --git a/osu.Game/Rulesets/Objects/Legacy/Taiko/ConvertHitObjectParser.cs b/osu.Game/Rulesets/Objects/Legacy/Taiko/ConvertHitObjectParser.cs index 985a032640..0a244bb6c6 100644 --- a/osu.Game/Rulesets/Objects/Legacy/Taiko/ConvertHitObjectParser.cs +++ b/osu.Game/Rulesets/Objects/Legacy/Taiko/ConvertHitObjectParser.cs @@ -23,13 +23,13 @@ namespace osu.Game.Rulesets.Objects.Legacy.Taiko return new ConvertHit(); } - protected override HitObject CreateSlider(Vector2 position, bool newCombo, int comboOffset, Vector2[] controlPoints, double length, CurveType curveType, int repeatCount, List> repeatSamples) + protected override HitObject CreateSlider(Vector2 position, bool newCombo, int comboOffset, Vector2[] controlPoints, double length, PathType pathType, int repeatCount, List> repeatSamples) { return new ConvertSlider { ControlPoints = controlPoints, Distance = length, - CurveType = curveType, + PathType = pathType, RepeatSamples = repeatSamples, RepeatCount = repeatCount }; diff --git a/osu.Game/Rulesets/Objects/SliderCurve.cs b/osu.Game/Rulesets/Objects/SliderPath.cs similarity index 92% rename from osu.Game/Rulesets/Objects/SliderCurve.cs rename to osu.Game/Rulesets/Objects/SliderPath.cs index 6a8192a4f2..46f8cae8a0 100644 --- a/osu.Game/Rulesets/Objects/SliderCurve.cs +++ b/osu.Game/Rulesets/Objects/SliderPath.cs @@ -10,13 +10,13 @@ using OpenTK; namespace osu.Game.Rulesets.Objects { - public class SliderCurve + public class SliderPath { public double Distance; public Vector2[] ControlPoints; - public CurveType CurveType = CurveType.PerfectCurve; + public PathType PathType = PathType.PerfectCurve; public Vector2 Offset; @@ -25,15 +25,15 @@ namespace osu.Game.Rulesets.Objects private List calculateSubpath(ReadOnlySpan subControlPoints) { - switch (CurveType) + switch (PathType) { - case CurveType.Linear: + case PathType.Linear: var result = new List(subControlPoints.Length); foreach (var c in subControlPoints) result.Add(c); return result; - case CurveType.PerfectCurve: + case PathType.PerfectCurve: //we can only use CircularArc iff we have exactly three control points and no dissection. if (ControlPoints.Length != 3 || subControlPoints.Length != 3) break; @@ -46,7 +46,7 @@ namespace osu.Game.Rulesets.Objects break; return subpath; - case CurveType.Catmull: + case PathType.Catmull: return new CatmullApproximator(subControlPoints).CreateCatmull(); } @@ -93,7 +93,7 @@ namespace osu.Game.Rulesets.Objects Vector2 diff = calculatedPath[i + 1] - calculatedPath[i]; double d = diff.Length; - // Shorten slider curves that are too long compared to what's + // Shorten slider paths that are too long compared to what's // in the .osu file. if (Distance - l < d) { @@ -109,7 +109,7 @@ namespace osu.Game.Rulesets.Objects cumulativeLength.Add(l); } - // Lengthen slider curves that are too short compared to what's + // Lengthen slider paths that are too short compared to what's // in the .osu file. if (l < Distance && calculatedPath.Count > 1) { @@ -191,10 +191,10 @@ namespace osu.Game.Rulesets.Objects } /// - /// Computes the slider curve until a given progress that ranges from 0 (beginning of the slider) + /// Computes the slider path until a given progress that ranges from 0 (beginning of the slider) /// to 1 (end of the slider) and stores the generated path in the given list. /// - /// The list to be filled with the computed curve. + /// The list to be filled with the computed path. /// Start progress. Ranges from 0 (beginning of the slider) to 1 (end of the slider). /// End progress. Ranges from 0 (beginning of the slider) to 1 (end of the slider). public void GetPathToProgress(List path, double p0, double p1) @@ -219,10 +219,10 @@ namespace osu.Game.Rulesets.Objects } /// - /// Computes the position on the slider at a given progress that ranges from 0 (beginning of the curve) - /// to 1 (end of the curve). + /// Computes the position on the slider at a given progress that ranges from 0 (beginning of the path) + /// to 1 (end of the path). /// - /// Ranges from 0 (beginning of the curve) to 1 (end of the curve). + /// Ranges from 0 (beginning of the path) to 1 (end of the path). /// public Vector2 PositionAt(double progress) { diff --git a/osu.Game/Rulesets/Objects/Types/IHasCurve.cs b/osu.Game/Rulesets/Objects/Types/IHasCurve.cs index 69b2f722e7..2a0d495e94 100644 --- a/osu.Game/Rulesets/Objects/Types/IHasCurve.cs +++ b/osu.Game/Rulesets/Objects/Types/IHasCurve.cs @@ -13,7 +13,7 @@ namespace osu.Game.Rulesets.Objects.Types /// /// The curve. /// - SliderCurve Curve { get; } + SliderPath Path { get; } /// /// The control points that shape the curve. @@ -23,7 +23,7 @@ namespace osu.Game.Rulesets.Objects.Types /// /// The type of curve. /// - CurveType CurveType { get; } + PathType PathType { get; } } public static class HasCurveExtensions @@ -35,7 +35,7 @@ namespace osu.Game.Rulesets.Objects.Types /// [0, 1] where 0 is the start time of the and 1 is the end time of the . /// The position on the curve. public static Vector2 CurvePositionAt(this IHasCurve obj, double progress) - => obj.Curve.PositionAt(obj.ProgressAt(progress)); + => obj.Path.PositionAt(obj.ProgressAt(progress)); /// /// Computes the progress along the curve relative to how much of the has been completed. diff --git a/osu.Game/Rulesets/Objects/Types/CurveType.cs b/osu.Game/Rulesets/Objects/Types/PathType.cs similarity index 91% rename from osu.Game/Rulesets/Objects/Types/CurveType.cs rename to osu.Game/Rulesets/Objects/Types/PathType.cs index 1cee6202b6..5156302fe1 100644 --- a/osu.Game/Rulesets/Objects/Types/CurveType.cs +++ b/osu.Game/Rulesets/Objects/Types/PathType.cs @@ -3,7 +3,7 @@ namespace osu.Game.Rulesets.Objects.Types { - public enum CurveType + public enum PathType { Catmull, Bezier, From 1aae123ff5b66365e122cb701f23ddc413b57ff7 Mon Sep 17 00:00:00 2001 From: smoogipoo Date: Thu, 1 Nov 2018 19:00:14 +0900 Subject: [PATCH 383/417] Make approximators share an interface --- .../Masks/SliderMasks/SliderPlacementMask.cs | 4 +- .../Rulesets/Objects/BezierApproximator.cs | 120 +++++++++--------- .../Rulesets/Objects/CatmullApproximator.cs | 11 +- .../Objects/CircularArcApproximator.cs | 11 +- osu.Game/Rulesets/Objects/IApproximator.cs | 19 +++ .../Rulesets/Objects/LinearApproximator.cs | 11 +- osu.Game/Rulesets/Objects/SliderPath.cs | 8 +- 7 files changed, 88 insertions(+), 96 deletions(-) create mode 100644 osu.Game/Rulesets/Objects/IApproximator.cs diff --git a/osu.Game.Rulesets.Osu/Edit/Masks/SliderMasks/SliderPlacementMask.cs b/osu.Game.Rulesets.Osu/Edit/Masks/SliderMasks/SliderPlacementMask.cs index 37a5251103..1b79b07b58 100644 --- a/osu.Game.Rulesets.Osu/Edit/Masks/SliderMasks/SliderPlacementMask.cs +++ b/osu.Game.Rulesets.Osu/Edit/Masks/SliderMasks/SliderPlacementMask.cs @@ -163,10 +163,10 @@ namespace osu.Game.Rulesets.Osu.Edit.Masks.SliderMasks { case 1: case 2: - result = new LinearApproximator(allControlPoints).CreateLinear(); + result = new LinearApproximator().Approximate(allControlPoints); break; default: - result = new BezierApproximator(allControlPoints).CreateBezier(); + result = new BezierApproximator().Approximate(allControlPoints); break; } diff --git a/osu.Game/Rulesets/Objects/BezierApproximator.cs b/osu.Game/Rulesets/Objects/BezierApproximator.cs index a1803e32f7..68833b655a 100644 --- a/osu.Game/Rulesets/Objects/BezierApproximator.cs +++ b/osu.Game/Rulesets/Objects/BezierApproximator.cs @@ -7,23 +7,72 @@ using OpenTK; namespace osu.Game.Rulesets.Objects { - public readonly ref struct BezierApproximator + public struct BezierApproximator : IApproximator { - private readonly int count; - private readonly ReadOnlySpan controlPoints; - private readonly Vector2[] subdivisionBuffer1; - private readonly Vector2[] subdivisionBuffer2; - private const float tolerance = 0.25f; private const float tolerance_sq = tolerance * tolerance; - public BezierApproximator(ReadOnlySpan controlPoints) + private int count; + private Vector2[] subdivisionBuffer1; + private Vector2[] subdivisionBuffer2; + + /// + /// Creates a piecewise-linear approximation of a bezier curve, by adaptively repeatedly subdividing + /// the control points until their approximation error vanishes below a given threshold. + /// + /// A list of vectors representing the piecewise-linear approximation. + public List Approximate(ReadOnlySpan controlPoints) { - this.controlPoints = controlPoints; + List output = new List(); count = controlPoints.Length; + if (count == 0) + return output; + subdivisionBuffer1 = new Vector2[count]; subdivisionBuffer2 = new Vector2[count * 2 - 1]; + + Stack toFlatten = new Stack(); + Stack freeBuffers = new Stack(); + + // "toFlatten" contains all the curves which are not yet approximated well enough. + // We use a stack to emulate recursion without the risk of running into a stack overflow. + // (More specifically, we iteratively and adaptively refine our curve with a + // Depth-first search + // over the tree resulting from the subdivisions we make.) + toFlatten.Push(controlPoints.ToArray()); + + Vector2[] leftChild = subdivisionBuffer2; + + while (toFlatten.Count > 0) + { + Vector2[] parent = toFlatten.Pop(); + if (isFlatEnough(parent)) + { + // If the control points we currently operate on are sufficiently "flat", we use + // an extension to De Casteljau's algorithm to obtain a piecewise-linear approximation + // of the bezier curve represented by our control points, consisting of the same amount + // of points as there are control points. + approximate(parent, output); + freeBuffers.Push(parent); + continue; + } + + // If we do not yet have a sufficiently "flat" (in other words, detailed) approximation we keep + // subdividing the curve we are currently operating on. + Vector2[] rightChild = freeBuffers.Count > 0 ? freeBuffers.Pop() : new Vector2[count]; + subdivide(parent, leftChild, rightChild); + + // We re-use the buffer of the parent for one of the children, so that we save one allocation per iteration. + for (int i = 0; i < count; ++i) + parent[i] = leftChild[i]; + + toFlatten.Push(rightChild); + toFlatten.Push(parent); + } + + output.Add(controlPoints[count - 1]); + return output; } /// @@ -92,60 +141,5 @@ namespace osu.Game.Rulesets.Objects output.Add(p); } } - - /// - /// Creates a piecewise-linear approximation of a bezier curve, by adaptively repeatedly subdividing - /// the control points until their approximation error vanishes below a given threshold. - /// - /// A list of vectors representing the piecewise-linear approximation. - public List CreateBezier() - { - List output = new List(); - - if (count == 0) - return output; - - Stack toFlatten = new Stack(); - Stack freeBuffers = new Stack(); - - // "toFlatten" contains all the curves which are not yet approximated well enough. - // We use a stack to emulate recursion without the risk of running into a stack overflow. - // (More specifically, we iteratively and adaptively refine our curve with a - // Depth-first search - // over the tree resulting from the subdivisions we make.) - toFlatten.Push(controlPoints.ToArray()); - - Vector2[] leftChild = subdivisionBuffer2; - - while (toFlatten.Count > 0) - { - Vector2[] parent = toFlatten.Pop(); - if (isFlatEnough(parent)) - { - // If the control points we currently operate on are sufficiently "flat", we use - // an extension to De Casteljau's algorithm to obtain a piecewise-linear approximation - // of the bezier curve represented by our control points, consisting of the same amount - // of points as there are control points. - approximate(parent, output); - freeBuffers.Push(parent); - continue; - } - - // If we do not yet have a sufficiently "flat" (in other words, detailed) approximation we keep - // subdividing the curve we are currently operating on. - Vector2[] rightChild = freeBuffers.Count > 0 ? freeBuffers.Pop() : new Vector2[count]; - subdivide(parent, leftChild, rightChild); - - // We re-use the buffer of the parent for one of the children, so that we save one allocation per iteration. - for (int i = 0; i < count; ++i) - parent[i] = leftChild[i]; - - toFlatten.Push(rightChild); - toFlatten.Push(parent); - } - - output.Add(controlPoints[count - 1]); - return output; - } } } diff --git a/osu.Game/Rulesets/Objects/CatmullApproximator.cs b/osu.Game/Rulesets/Objects/CatmullApproximator.cs index 78f8e471f3..5712b508c4 100644 --- a/osu.Game/Rulesets/Objects/CatmullApproximator.cs +++ b/osu.Game/Rulesets/Objects/CatmullApproximator.cs @@ -7,25 +7,18 @@ using OpenTK; namespace osu.Game.Rulesets.Objects { - public readonly ref struct CatmullApproximator + public readonly struct CatmullApproximator : IApproximator { /// /// The amount of pieces to calculate for each controlpoint quadruplet. /// private const int detail = 50; - private readonly ReadOnlySpan controlPoints; - - public CatmullApproximator(ReadOnlySpan controlPoints) - { - this.controlPoints = controlPoints; - } - /// /// Creates a piecewise-linear approximation of a Catmull-Rom spline. /// /// A list of vectors representing the piecewise-linear approximation. - public List CreateCatmull() + public List Approximate(ReadOnlySpan controlPoints) { var result = new List((controlPoints.Length - 1) * detail * 2); diff --git a/osu.Game/Rulesets/Objects/CircularArcApproximator.cs b/osu.Game/Rulesets/Objects/CircularArcApproximator.cs index 28d7442aaf..969a98c48f 100644 --- a/osu.Game/Rulesets/Objects/CircularArcApproximator.cs +++ b/osu.Game/Rulesets/Objects/CircularArcApproximator.cs @@ -8,22 +8,15 @@ using OpenTK; namespace osu.Game.Rulesets.Objects { - public readonly ref struct CircularArcApproximator + public readonly struct CircularArcApproximator : IApproximator { private const float tolerance = 0.1f; - private readonly ReadOnlySpan controlPoints; - - public CircularArcApproximator(ReadOnlySpan controlPoints) - { - this.controlPoints = controlPoints; - } - /// /// Creates a piecewise-linear approximation of a circular arc curve. /// /// A list of vectors representing the piecewise-linear approximation. - public List CreateArc() + public List Approximate(ReadOnlySpan controlPoints) { Vector2 a = controlPoints[0]; Vector2 b = controlPoints[1]; diff --git a/osu.Game/Rulesets/Objects/IApproximator.cs b/osu.Game/Rulesets/Objects/IApproximator.cs new file mode 100644 index 0000000000..4f242993bc --- /dev/null +++ b/osu.Game/Rulesets/Objects/IApproximator.cs @@ -0,0 +1,19 @@ +// Copyright (c) 2007-2018 ppy Pty Ltd . +// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE + +using System; +using System.Collections.Generic; +using OpenTK; + +namespace osu.Game.Rulesets.Objects +{ + public interface IApproximator + { + /// + /// Approximates a path by interpolating a sequence of control points. + /// + /// The control points of the path. + /// A set of points that lie on the path. + List Approximate(ReadOnlySpan controlPoints); + } +} diff --git a/osu.Game/Rulesets/Objects/LinearApproximator.cs b/osu.Game/Rulesets/Objects/LinearApproximator.cs index c513d40ad6..1f36881fda 100644 --- a/osu.Game/Rulesets/Objects/LinearApproximator.cs +++ b/osu.Game/Rulesets/Objects/LinearApproximator.cs @@ -7,16 +7,9 @@ using OpenTK; namespace osu.Game.Rulesets.Objects { - public readonly ref struct LinearApproximator + public readonly struct LinearApproximator : IApproximator { - private readonly ReadOnlySpan controlPoints; - - public LinearApproximator(ReadOnlySpan controlPoints) - { - this.controlPoints = controlPoints; - } - - public List CreateLinear() + public List Approximate(ReadOnlySpan controlPoints) { var result = new List(controlPoints.Length); diff --git a/osu.Game/Rulesets/Objects/SliderPath.cs b/osu.Game/Rulesets/Objects/SliderPath.cs index 03df2d0106..a141051308 100644 --- a/osu.Game/Rulesets/Objects/SliderPath.cs +++ b/osu.Game/Rulesets/Objects/SliderPath.cs @@ -28,14 +28,14 @@ namespace osu.Game.Rulesets.Objects switch (PathType) { case PathType.Linear: - return new LinearApproximator(subControlPoints).CreateLinear(); + return new LinearApproximator().Approximate(subControlPoints); case PathType.PerfectCurve: //we can only use CircularArc iff we have exactly three control points and no dissection. if (ControlPoints.Length != 3 || subControlPoints.Length != 3) break; // Here we have exactly 3 control points. Attempt to fit a circular arc. - List subpath = new CircularArcApproximator(subControlPoints).CreateArc(); + List subpath = new CircularArcApproximator().Approximate(subControlPoints); // If for some reason a circular arc could not be fit to the 3 given points, fall back to a numerically stable bezier approximation. if (subpath.Count == 0) @@ -43,10 +43,10 @@ namespace osu.Game.Rulesets.Objects return subpath; case PathType.Catmull: - return new CatmullApproximator(subControlPoints).CreateCatmull(); + return new CatmullApproximator().Approximate(subControlPoints); } - return new BezierApproximator(subControlPoints).CreateBezier(); + return new BezierApproximator().Approximate(subControlPoints); } private void calculatePath() From d78348f178c52ec0405a1fe337f5e1d47fee1991 Mon Sep 17 00:00:00 2001 From: smoogipoo Date: Thu, 1 Nov 2018 19:23:37 +0900 Subject: [PATCH 384/417] Reduce duplicate code --- .../Edit/Masks/SliderMasks/SliderPlacementMask.cs | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/osu.Game.Rulesets.Osu/Edit/Masks/SliderMasks/SliderPlacementMask.cs b/osu.Game.Rulesets.Osu/Edit/Masks/SliderMasks/SliderPlacementMask.cs index 1b79b07b58..8b38c25bd4 100644 --- a/osu.Game.Rulesets.Osu/Edit/Masks/SliderMasks/SliderPlacementMask.cs +++ b/osu.Game.Rulesets.Osu/Edit/Masks/SliderMasks/SliderPlacementMask.cs @@ -107,17 +107,18 @@ namespace osu.Game.Rulesets.Osu.Edit.Masks.SliderMasks private void endCurve() { - HitObject.ControlPoints = segments.SelectMany(s => s.ControlPoints).Concat(cursor.Yield()).ToArray(); - HitObject.PathType = HitObject.ControlPoints.Length > 2 ? PathType.Bezier : PathType.Linear; - HitObject.Distance = segments.Sum(s => s.Distance); - + updateSlider(); EndPlacement(); } protected override void Update() { base.Update(); + updateSlider(); + } + private void updateSlider() + { for (int i = 0; i < segments.Count; i++) segments[i].Calculate(i == segments.Count - 1 ? (Vector2?)cursor : null); From 2ac4f2b6af4c101e968441fd94ed6dcf4ca70e10 Mon Sep 17 00:00:00 2001 From: smoogipoo Date: Thu, 1 Nov 2018 19:24:58 +0900 Subject: [PATCH 385/417] Lock spinners to centre of screen --- .../Masks/SpinnerMasks/SpinnerPlacementMask.cs | 18 ++---------------- 1 file changed, 2 insertions(+), 16 deletions(-) diff --git a/osu.Game.Rulesets.Osu/Edit/Masks/SpinnerMasks/SpinnerPlacementMask.cs b/osu.Game.Rulesets.Osu/Edit/Masks/SpinnerMasks/SpinnerPlacementMask.cs index 97356fa8b6..cd5d6cff04 100644 --- a/osu.Game.Rulesets.Osu/Edit/Masks/SpinnerMasks/SpinnerPlacementMask.cs +++ b/osu.Game.Rulesets.Osu/Edit/Masks/SpinnerMasks/SpinnerPlacementMask.cs @@ -6,6 +6,7 @@ using osu.Framework.Input.Events; using osu.Game.Rulesets.Edit; using osu.Game.Rulesets.Osu.Edit.Masks.SpinnerMasks.Components; using osu.Game.Rulesets.Osu.Objects; +using osu.Game.Rulesets.Osu.UI; namespace osu.Game.Rulesets.Osu.Edit.Masks.SpinnerMasks { @@ -18,19 +19,11 @@ namespace osu.Game.Rulesets.Osu.Edit.Masks.SpinnerMasks private bool isPlacingEnd; public SpinnerPlacementMask() - : base(new Spinner()) + : base(new Spinner { Position = OsuPlayfield.BASE_SIZE / 2 }) { InternalChild = piece = new SpinnerPiece(HitObject) { Alpha = 0.5f }; } - protected override void LoadComplete() - { - base.LoadComplete(); - - // Fixes a 1-frame position discrpancy due to the first mouse move event happening in the next frame - HitObject.Position = GetContainingInputManager().CurrentState.Mouse.Position; - } - protected override bool OnClick(ClickEvent e) { if (isPlacingEnd) @@ -48,12 +41,5 @@ namespace osu.Game.Rulesets.Osu.Edit.Masks.SpinnerMasks return true; } - - protected override bool OnMouseMove(MouseMoveEvent e) - { - if (!isPlacingEnd) - HitObject.Position = e.MousePosition; - return true; - } } } From d9e371ccbbe16666ce915b0553dcf6f97f700cdc Mon Sep 17 00:00:00 2001 From: TPGPL Date: Thu, 1 Nov 2018 18:08:12 +0100 Subject: [PATCH 386/417] Add new specs-checking methods --- .github/ISSUE_TEMPLATE/crash-issues.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/ISSUE_TEMPLATE/crash-issues.md b/.github/ISSUE_TEMPLATE/crash-issues.md index 6c82fdb1d1..849f042c1f 100644 --- a/.github/ISSUE_TEMPLATE/crash-issues.md +++ b/.github/ISSUE_TEMPLATE/crash-issues.md @@ -13,4 +13,4 @@ about: For issues regarding game crashes or permanent freezes **Logs:** -**Computer Specifications:** \ No newline at end of file +**Computer Specifications:** \ No newline at end of file From 0a0023920fd5268a748134489a87a315b9c02e15 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Fri, 2 Nov 2018 04:09:33 +0900 Subject: [PATCH 387/417] Fix not being able to drag control points mid-snake --- .../Screens/Edit/Screens/Compose/Layers/HitObjectMaskLayer.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu.Game/Screens/Edit/Screens/Compose/Layers/HitObjectMaskLayer.cs b/osu.Game/Screens/Edit/Screens/Compose/Layers/HitObjectMaskLayer.cs index 3e33ceefcd..0392cb5952 100644 --- a/osu.Game/Screens/Edit/Screens/Compose/Layers/HitObjectMaskLayer.cs +++ b/osu.Game/Screens/Edit/Screens/Compose/Layers/HitObjectMaskLayer.cs @@ -52,7 +52,7 @@ namespace osu.Game.Screens.Edit.Screens.Compose.Layers AddMaskFor(obj); } - protected override bool OnMouseDown(MouseDownEvent e) + protected override bool OnClick(ClickEvent e) { maskContainer.DeselectAll(); return true; From 7f1ee3bcb478303719a2c8f8476e1d33083e16dd Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Fri, 2 Nov 2018 12:06:53 +0900 Subject: [PATCH 388/417] Disallow spinner movement for now --- osu.Game.Rulesets.Osu/Objects/Spinner.cs | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/osu.Game.Rulesets.Osu/Objects/Spinner.cs b/osu.Game.Rulesets.Osu/Objects/Spinner.cs index 1c60fd4831..1270685ab5 100644 --- a/osu.Game.Rulesets.Osu/Objects/Spinner.cs +++ b/osu.Game.Rulesets.Osu/Objects/Spinner.cs @@ -7,6 +7,7 @@ using osu.Game.Rulesets.Objects.Types; using osu.Game.Beatmaps.ControlPoints; using osu.Game.Rulesets.Judgements; using osu.Game.Rulesets.Osu.Judgements; +using OpenTK; namespace osu.Game.Rulesets.Osu.Objects { @@ -31,5 +32,10 @@ namespace osu.Game.Rulesets.Osu.Objects } public override Judgement CreateJudgement() => new OsuJudgement(); + + public override void OffsetPosition(Vector2 offset) + { + // for now we don't want to allow spinners to be moved around. + } } } From e6ee3dc73ee7b784929a5635c8412ea161906be1 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Fri, 2 Nov 2018 02:43:43 +0900 Subject: [PATCH 389/417] Use framework helper functions for path approximation --- .../Masks/SliderMasks/SliderPlacementMask.cs | 6 +- .../Rulesets/Objects/BezierApproximator.cs | 145 ------------------ .../Rulesets/Objects/CatmullApproximator.cs | 63 -------- .../Objects/CircularArcApproximator.cs | 90 ----------- osu.Game/Rulesets/Objects/IApproximator.cs | 19 --- .../Rulesets/Objects/LinearApproximator.cs | 22 --- osu.Game/Rulesets/Objects/SliderPath.cs | 8 +- osu.Game/osu.Game.csproj | 2 +- 8 files changed, 8 insertions(+), 347 deletions(-) delete mode 100644 osu.Game/Rulesets/Objects/BezierApproximator.cs delete mode 100644 osu.Game/Rulesets/Objects/CatmullApproximator.cs delete mode 100644 osu.Game/Rulesets/Objects/CircularArcApproximator.cs delete mode 100644 osu.Game/Rulesets/Objects/IApproximator.cs delete mode 100644 osu.Game/Rulesets/Objects/LinearApproximator.cs diff --git a/osu.Game.Rulesets.Osu/Edit/Masks/SliderMasks/SliderPlacementMask.cs b/osu.Game.Rulesets.Osu/Edit/Masks/SliderMasks/SliderPlacementMask.cs index 8b38c25bd4..12e768d58e 100644 --- a/osu.Game.Rulesets.Osu/Edit/Masks/SliderMasks/SliderPlacementMask.cs +++ b/osu.Game.Rulesets.Osu/Edit/Masks/SliderMasks/SliderPlacementMask.cs @@ -8,9 +8,9 @@ using osu.Framework.Allocation; using osu.Framework.Extensions.IEnumerableExtensions; using osu.Framework.Graphics; using osu.Framework.Input.Events; +using osu.Framework.MathUtils; using osu.Game.Graphics; using osu.Game.Rulesets.Edit; -using osu.Game.Rulesets.Objects; using osu.Game.Rulesets.Objects.Types; using osu.Game.Rulesets.Osu.Edit.Masks.SliderMasks.Components; using OpenTK; @@ -164,10 +164,10 @@ namespace osu.Game.Rulesets.Osu.Edit.Masks.SliderMasks { case 1: case 2: - result = new LinearApproximator().Approximate(allControlPoints); + result = PathApproximator.ApproximateLinear(allControlPoints); break; default: - result = new BezierApproximator().Approximate(allControlPoints); + result = PathApproximator.ApproximateBezier(allControlPoints); break; } diff --git a/osu.Game/Rulesets/Objects/BezierApproximator.cs b/osu.Game/Rulesets/Objects/BezierApproximator.cs deleted file mode 100644 index 68833b655a..0000000000 --- a/osu.Game/Rulesets/Objects/BezierApproximator.cs +++ /dev/null @@ -1,145 +0,0 @@ -// Copyright (c) 2007-2018 ppy Pty Ltd . -// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE - -using System; -using System.Collections.Generic; -using OpenTK; - -namespace osu.Game.Rulesets.Objects -{ - public struct BezierApproximator : IApproximator - { - private const float tolerance = 0.25f; - private const float tolerance_sq = tolerance * tolerance; - - private int count; - private Vector2[] subdivisionBuffer1; - private Vector2[] subdivisionBuffer2; - - /// - /// Creates a piecewise-linear approximation of a bezier curve, by adaptively repeatedly subdividing - /// the control points until their approximation error vanishes below a given threshold. - /// - /// A list of vectors representing the piecewise-linear approximation. - public List Approximate(ReadOnlySpan controlPoints) - { - List output = new List(); - count = controlPoints.Length; - - if (count == 0) - return output; - - subdivisionBuffer1 = new Vector2[count]; - subdivisionBuffer2 = new Vector2[count * 2 - 1]; - - Stack toFlatten = new Stack(); - Stack freeBuffers = new Stack(); - - // "toFlatten" contains all the curves which are not yet approximated well enough. - // We use a stack to emulate recursion without the risk of running into a stack overflow. - // (More specifically, we iteratively and adaptively refine our curve with a - // Depth-first search - // over the tree resulting from the subdivisions we make.) - toFlatten.Push(controlPoints.ToArray()); - - Vector2[] leftChild = subdivisionBuffer2; - - while (toFlatten.Count > 0) - { - Vector2[] parent = toFlatten.Pop(); - if (isFlatEnough(parent)) - { - // If the control points we currently operate on are sufficiently "flat", we use - // an extension to De Casteljau's algorithm to obtain a piecewise-linear approximation - // of the bezier curve represented by our control points, consisting of the same amount - // of points as there are control points. - approximate(parent, output); - freeBuffers.Push(parent); - continue; - } - - // If we do not yet have a sufficiently "flat" (in other words, detailed) approximation we keep - // subdividing the curve we are currently operating on. - Vector2[] rightChild = freeBuffers.Count > 0 ? freeBuffers.Pop() : new Vector2[count]; - subdivide(parent, leftChild, rightChild); - - // We re-use the buffer of the parent for one of the children, so that we save one allocation per iteration. - for (int i = 0; i < count; ++i) - parent[i] = leftChild[i]; - - toFlatten.Push(rightChild); - toFlatten.Push(parent); - } - - output.Add(controlPoints[count - 1]); - return output; - } - - /// - /// Make sure the 2nd order derivative (approximated using finite elements) is within tolerable bounds. - /// NOTE: The 2nd order derivative of a 2d curve represents its curvature, so intuitively this function - /// checks (as the name suggests) whether our approximation is _locally_ "flat". More curvy parts - /// need to have a denser approximation to be more "flat". - /// - /// The control points to check for flatness. - /// Whether the control points are flat enough. - private static bool isFlatEnough(Vector2[] controlPoints) - { - for (int i = 1; i < controlPoints.Length - 1; i++) - if ((controlPoints[i - 1] - 2 * controlPoints[i] + controlPoints[i + 1]).LengthSquared > tolerance_sq * 4) - return false; - - return true; - } - - /// - /// Subdivides n control points representing a bezier curve into 2 sets of n control points, each - /// describing a bezier curve equivalent to a half of the original curve. Effectively this splits - /// the original curve into 2 curves which result in the original curve when pieced back together. - /// - /// The control points to split. - /// Output: The control points corresponding to the left half of the curve. - /// Output: The control points corresponding to the right half of the curve. - private void subdivide(Vector2[] controlPoints, Vector2[] l, Vector2[] r) - { - Vector2[] midpoints = subdivisionBuffer1; - - for (int i = 0; i < count; ++i) - midpoints[i] = controlPoints[i]; - - for (int i = 0; i < count; i++) - { - l[i] = midpoints[0]; - r[count - i - 1] = midpoints[count - i - 1]; - - for (int j = 0; j < count - i - 1; j++) - midpoints[j] = (midpoints[j] + midpoints[j + 1]) / 2; - } - } - - /// - /// This uses De Casteljau's algorithm to obtain an optimal - /// piecewise-linear approximation of the bezier curve with the same amount of points as there are control points. - /// - /// The control points describing the bezier curve to be approximated. - /// The points representing the resulting piecewise-linear approximation. - private void approximate(Vector2[] controlPoints, List output) - { - Vector2[] l = subdivisionBuffer2; - Vector2[] r = subdivisionBuffer1; - - subdivide(controlPoints, l, r); - - for (int i = 0; i < count - 1; ++i) - l[count + i] = r[i + 1]; - - output.Add(controlPoints[0]); - for (int i = 1; i < count - 1; ++i) - { - int index = 2 * i; - Vector2 p = 0.25f * (l[index - 1] + 2 * l[index] + l[index + 1]); - output.Add(p); - } - } - } -} diff --git a/osu.Game/Rulesets/Objects/CatmullApproximator.cs b/osu.Game/Rulesets/Objects/CatmullApproximator.cs deleted file mode 100644 index 5712b508c4..0000000000 --- a/osu.Game/Rulesets/Objects/CatmullApproximator.cs +++ /dev/null @@ -1,63 +0,0 @@ -// Copyright (c) 2007-2018 ppy Pty Ltd . -// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE - -using System; -using System.Collections.Generic; -using OpenTK; - -namespace osu.Game.Rulesets.Objects -{ - public readonly struct CatmullApproximator : IApproximator - { - /// - /// The amount of pieces to calculate for each controlpoint quadruplet. - /// - private const int detail = 50; - - /// - /// Creates a piecewise-linear approximation of a Catmull-Rom spline. - /// - /// A list of vectors representing the piecewise-linear approximation. - public List Approximate(ReadOnlySpan controlPoints) - { - var result = new List((controlPoints.Length - 1) * detail * 2); - - for (int i = 0; i < controlPoints.Length - 1; i++) - { - var v1 = i > 0 ? controlPoints[i - 1] : controlPoints[i]; - var v2 = controlPoints[i]; - var v3 = i < controlPoints.Length - 1 ? controlPoints[i + 1] : v2 + v2 - v1; - var v4 = i < controlPoints.Length - 2 ? controlPoints[i + 2] : v3 + v3 - v2; - - for (int c = 0; c < detail; c++) - { - result.Add(findPoint(ref v1, ref v2, ref v3, ref v4, (float)c / detail)); - result.Add(findPoint(ref v1, ref v2, ref v3, ref v4, (float)(c + 1) / detail)); - } - } - - return result; - } - - /// - /// Finds a point on the spline at the position of a parameter. - /// - /// The first vector. - /// The second vector. - /// The third vector. - /// The fourth vector. - /// The parameter at which to find the point on the spline, in the range [0, 1]. - /// The point on the spline at . - private Vector2 findPoint(ref Vector2 vec1, ref Vector2 vec2, ref Vector2 vec3, ref Vector2 vec4, float t) - { - float t2 = t * t; - float t3 = t * t2; - - Vector2 result; - result.X = 0.5f * (2f * vec2.X + (-vec1.X + vec3.X) * t + (2f * vec1.X - 5f * vec2.X + 4f * vec3.X - vec4.X) * t2 + (-vec1.X + 3f * vec2.X - 3f * vec3.X + vec4.X) * t3); - result.Y = 0.5f * (2f * vec2.Y + (-vec1.Y + vec3.Y) * t + (2f * vec1.Y - 5f * vec2.Y + 4f * vec3.Y - vec4.Y) * t2 + (-vec1.Y + 3f * vec2.Y - 3f * vec3.Y + vec4.Y) * t3); - - return result; - } - } -} diff --git a/osu.Game/Rulesets/Objects/CircularArcApproximator.cs b/osu.Game/Rulesets/Objects/CircularArcApproximator.cs deleted file mode 100644 index 969a98c48f..0000000000 --- a/osu.Game/Rulesets/Objects/CircularArcApproximator.cs +++ /dev/null @@ -1,90 +0,0 @@ -// Copyright (c) 2007-2018 ppy Pty Ltd . -// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE - -using System; -using System.Collections.Generic; -using osu.Framework.MathUtils; -using OpenTK; - -namespace osu.Game.Rulesets.Objects -{ - public readonly struct CircularArcApproximator : IApproximator - { - private const float tolerance = 0.1f; - - /// - /// Creates a piecewise-linear approximation of a circular arc curve. - /// - /// A list of vectors representing the piecewise-linear approximation. - public List Approximate(ReadOnlySpan controlPoints) - { - Vector2 a = controlPoints[0]; - Vector2 b = controlPoints[1]; - Vector2 c = controlPoints[2]; - - float aSq = (b - c).LengthSquared; - float bSq = (a - c).LengthSquared; - float cSq = (a - b).LengthSquared; - - // If we have a degenerate triangle where a side-length is almost zero, then give up and fall - // back to a more numerically stable method. - if (Precision.AlmostEquals(aSq, 0) || Precision.AlmostEquals(bSq, 0) || Precision.AlmostEquals(cSq, 0)) - return new List(); - - float s = aSq * (bSq + cSq - aSq); - float t = bSq * (aSq + cSq - bSq); - float u = cSq * (aSq + bSq - cSq); - - float sum = s + t + u; - - // If we have a degenerate triangle with an almost-zero size, then give up and fall - // back to a more numerically stable method. - if (Precision.AlmostEquals(sum, 0)) - return new List(); - - Vector2 centre = (s * a + t * b + u * c) / sum; - Vector2 dA = a - centre; - Vector2 dC = c - centre; - - float r = dA.Length; - - double thetaStart = Math.Atan2(dA.Y, dA.X); - double thetaEnd = Math.Atan2(dC.Y, dC.X); - - while (thetaEnd < thetaStart) - thetaEnd += 2 * Math.PI; - - double dir = 1; - double thetaRange = thetaEnd - thetaStart; - - // Decide in which direction to draw the circle, depending on which side of - // AC B lies. - Vector2 orthoAtoC = c - a; - orthoAtoC = new Vector2(orthoAtoC.Y, -orthoAtoC.X); - if (Vector2.Dot(orthoAtoC, b - a) < 0) - { - dir = -dir; - thetaRange = 2 * Math.PI - thetaRange; - } - - // We select the amount of points for the approximation by requiring the discrete curvature - // to be smaller than the provided tolerance. The exact angle required to meet the tolerance - // is: 2 * Math.Acos(1 - TOLERANCE / r) - // The special case is required for extremely short sliders where the radius is smaller than - // the tolerance. This is a pathological rather than a realistic case. - int amountPoints = 2 * r <= tolerance ? 2 : Math.Max(2, (int)Math.Ceiling(thetaRange / (2 * Math.Acos(1 - tolerance / r)))); - - List output = new List(amountPoints); - - for (int i = 0; i < amountPoints; ++i) - { - double fract = (double)i / (amountPoints - 1); - double theta = thetaStart + dir * fract * thetaRange; - Vector2 o = new Vector2((float)Math.Cos(theta), (float)Math.Sin(theta)) * r; - output.Add(centre + o); - } - - return output; - } - } -} diff --git a/osu.Game/Rulesets/Objects/IApproximator.cs b/osu.Game/Rulesets/Objects/IApproximator.cs deleted file mode 100644 index 4f242993bc..0000000000 --- a/osu.Game/Rulesets/Objects/IApproximator.cs +++ /dev/null @@ -1,19 +0,0 @@ -// Copyright (c) 2007-2018 ppy Pty Ltd . -// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE - -using System; -using System.Collections.Generic; -using OpenTK; - -namespace osu.Game.Rulesets.Objects -{ - public interface IApproximator - { - /// - /// Approximates a path by interpolating a sequence of control points. - /// - /// The control points of the path. - /// A set of points that lie on the path. - List Approximate(ReadOnlySpan controlPoints); - } -} diff --git a/osu.Game/Rulesets/Objects/LinearApproximator.cs b/osu.Game/Rulesets/Objects/LinearApproximator.cs deleted file mode 100644 index 1f36881fda..0000000000 --- a/osu.Game/Rulesets/Objects/LinearApproximator.cs +++ /dev/null @@ -1,22 +0,0 @@ -// Copyright (c) 2007-2018 ppy Pty Ltd . -// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE - -using System; -using System.Collections.Generic; -using OpenTK; - -namespace osu.Game.Rulesets.Objects -{ - public readonly struct LinearApproximator : IApproximator - { - public List Approximate(ReadOnlySpan controlPoints) - { - var result = new List(controlPoints.Length); - - foreach (var c in controlPoints) - result.Add(c); - - return result; - } - } -} diff --git a/osu.Game/Rulesets/Objects/SliderPath.cs b/osu.Game/Rulesets/Objects/SliderPath.cs index a141051308..423cd3b069 100644 --- a/osu.Game/Rulesets/Objects/SliderPath.cs +++ b/osu.Game/Rulesets/Objects/SliderPath.cs @@ -28,14 +28,14 @@ namespace osu.Game.Rulesets.Objects switch (PathType) { case PathType.Linear: - return new LinearApproximator().Approximate(subControlPoints); + return PathApproximator.ApproximateLinear(subControlPoints); case PathType.PerfectCurve: //we can only use CircularArc iff we have exactly three control points and no dissection. if (ControlPoints.Length != 3 || subControlPoints.Length != 3) break; // Here we have exactly 3 control points. Attempt to fit a circular arc. - List subpath = new CircularArcApproximator().Approximate(subControlPoints); + List subpath = PathApproximator.ApproximateCircularArc(subControlPoints); // If for some reason a circular arc could not be fit to the 3 given points, fall back to a numerically stable bezier approximation. if (subpath.Count == 0) @@ -43,10 +43,10 @@ namespace osu.Game.Rulesets.Objects return subpath; case PathType.Catmull: - return new CatmullApproximator().Approximate(subControlPoints); + return PathApproximator.ApproximateCatmull(subControlPoints); } - return new BezierApproximator().Approximate(subControlPoints); + return PathApproximator.ApproximateBezier(subControlPoints); } private void calculatePath() diff --git a/osu.Game/osu.Game.csproj b/osu.Game/osu.Game.csproj index 2f8c743bee..b4cd8f9b66 100644 --- a/osu.Game/osu.Game.csproj +++ b/osu.Game/osu.Game.csproj @@ -18,7 +18,7 @@ - + From 56ff2686acdd03aa6522106dee9f878d71f2b54c Mon Sep 17 00:00:00 2001 From: FreezyLemon Date: Sat, 3 Nov 2018 18:09:11 +0100 Subject: [PATCH 390/417] Update osu-resources and osu-framework to use binary fonts --- osu-resources | 2 +- osu.Game/osu.Game.csproj | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/osu-resources b/osu-resources index c3848d8b1c..9ee64e369f 160000 --- a/osu-resources +++ b/osu-resources @@ -1 +1 @@ -Subproject commit c3848d8b1c84966abe851d915bcca878415614b4 +Subproject commit 9ee64e369fe6fdafc6aed40f5a35b5f01eb82c53 diff --git a/osu.Game/osu.Game.csproj b/osu.Game/osu.Game.csproj index b4cd8f9b66..d953bfd63c 100644 --- a/osu.Game/osu.Game.csproj +++ b/osu.Game/osu.Game.csproj @@ -18,7 +18,7 @@ - + From 292415140bc8a0e578f9314776c8c8e054c2c43f Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Mon, 5 Nov 2018 09:45:15 +0900 Subject: [PATCH 391/417] Update template --- .github/ISSUE_TEMPLATE/missing-for-live-issues.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/ISSUE_TEMPLATE/missing-for-live-issues.md b/.github/ISSUE_TEMPLATE/missing-for-live-issues.md index 929399d192..ae3cf20a8c 100644 --- a/.github/ISSUE_TEMPLATE/missing-for-live-issues.md +++ b/.github/ISSUE_TEMPLATE/missing-for-live-issues.md @@ -1,10 +1,10 @@ --- name: Missing for Live -about: For issues regarding game features required for live +about: Let us know the features you need which are available in osu-stable but not lazer --- **Describe the feature:** -**Designs:** +**Designs:** From 1fffa48aa06b2d593fa18d97e9c04da4948dc9b9 Mon Sep 17 00:00:00 2001 From: smoogipoo Date: Mon, 5 Nov 2018 12:15:45 +0900 Subject: [PATCH 392/417] Sort nested hitobjects post-creation --- osu.Game/Rulesets/Objects/HitObject.cs | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/osu.Game/Rulesets/Objects/HitObject.cs b/osu.Game/Rulesets/Objects/HitObject.cs index f5613e927f..67a3db7a00 100644 --- a/osu.Game/Rulesets/Objects/HitObject.cs +++ b/osu.Game/Rulesets/Objects/HitObject.cs @@ -3,7 +3,6 @@ using System.Collections.Generic; using Newtonsoft.Json; -using osu.Framework.Lists; using osu.Game.Audio; using osu.Game.Beatmaps; using osu.Game.Beatmaps.ControlPoints; @@ -56,7 +55,7 @@ namespace osu.Game.Rulesets.Objects /// public HitWindows HitWindows { get; set; } - private readonly SortedList nestedHitObjects = new SortedList(compareObjects); + private readonly List nestedHitObjects = new List(); [JsonIgnore] public IReadOnlyList NestedHitObjects => nestedHitObjects; @@ -74,6 +73,8 @@ namespace osu.Game.Rulesets.Objects CreateNestedHitObjects(); + nestedHitObjects.Sort((h1, h2) => h1.StartTime.CompareTo(h2.StartTime)); + foreach (var h in nestedHitObjects) { h.HitWindows = HitWindows; @@ -114,7 +115,5 @@ namespace osu.Game.Rulesets.Objects /// /// protected virtual HitWindows CreateHitWindows() => new HitWindows(); - - private static int compareObjects(HitObject first, HitObject second) => first.StartTime.CompareTo(second.StartTime); } } From 171700cb9117f39598c980d67b563ec81346a45b Mon Sep 17 00:00:00 2001 From: smoogipoo Date: Mon, 5 Nov 2018 15:59:40 +0900 Subject: [PATCH 393/417] Debounce editor summary timeline seeks --- .../Timelines/Summary/Parts/MarkerPart.cs | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/osu.Game/Screens/Edit/Components/Timelines/Summary/Parts/MarkerPart.cs b/osu.Game/Screens/Edit/Components/Timelines/Summary/Parts/MarkerPart.cs index 4b57e1e92d..11e9ecddc6 100644 --- a/osu.Game/Screens/Edit/Components/Timelines/Summary/Parts/MarkerPart.cs +++ b/osu.Game/Screens/Edit/Components/Timelines/Summary/Parts/MarkerPart.cs @@ -7,6 +7,7 @@ using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Shapes; using osu.Framework.Input.Events; +using osu.Framework.Threading; using osu.Framework.Timing; using osu.Game.Beatmaps; using osu.Game.Graphics; @@ -43,17 +44,23 @@ namespace osu.Game.Screens.Edit.Components.Timelines.Summary.Parts return true; } + private ScheduledDelegate scheduledSeek; + /// /// Seeks the to the time closest to a position on the screen relative to the . /// /// The position in screen coordinates. private void seekToPosition(Vector2 screenPosition) { - if (Beatmap.Value == null) - return; + scheduledSeek?.Cancel(); + scheduledSeek = Schedule(() => + { + if (Beatmap.Value == null) + return; - float markerPos = MathHelper.Clamp(ToLocalSpace(screenPosition).X, 0, DrawWidth); - adjustableClock.Seek(markerPos / DrawWidth * Beatmap.Value.Track.Length); + float markerPos = MathHelper.Clamp(ToLocalSpace(screenPosition).X, 0, DrawWidth); + adjustableClock.Seek(markerPos / DrawWidth * Beatmap.Value.Track.Length); + }); } protected override void Update() From 92d570342c2f1d2bafcae6f7666cfb1564486c0a Mon Sep 17 00:00:00 2001 From: smoogipoo Date: Mon, 5 Nov 2018 17:35:24 +0900 Subject: [PATCH 394/417] Fix sample additions not falling back to non-addition bank --- .../Beatmaps/Formats/LegacyBeatmapDecoderTest.cs | 13 +++++++++++++ .../Resources/hitobject-no-addition-bank.osu | 4 ++++ .../Objects/Legacy/ConvertHitObjectParser.cs | 2 +- 3 files changed, 18 insertions(+), 1 deletion(-) create mode 100644 osu.Game.Tests/Resources/hitobject-no-addition-bank.osu diff --git a/osu.Game.Tests/Beatmaps/Formats/LegacyBeatmapDecoderTest.cs b/osu.Game.Tests/Beatmaps/Formats/LegacyBeatmapDecoderTest.cs index f1ae366ee1..bd50043ea1 100644 --- a/osu.Game.Tests/Beatmaps/Formats/LegacyBeatmapDecoderTest.cs +++ b/osu.Game.Tests/Beatmaps/Formats/LegacyBeatmapDecoderTest.cs @@ -333,5 +333,18 @@ namespace osu.Game.Tests.Beatmaps.Formats SampleInfo getTestableSampleInfo(HitObject hitObject) => hitObject.SampleControlPoint.ApplyTo(hitObject.Samples[0]); } + + [Test] + public void TestDecodeHitObjectNullAdditionBank() + { + var decoder = new LegacyBeatmapDecoder { ApplyOffsets = false }; + using (var resStream = Resource.OpenResource("hitobject-no-addition-bank.osu")) + using (var stream = new StreamReader(resStream)) + { + var hitObjects = decoder.Decode(stream).HitObjects; + + Assert.AreEqual(hitObjects[0].Samples[0].Bank, hitObjects[0].Samples[1].Bank); + } + } } } diff --git a/osu.Game.Tests/Resources/hitobject-no-addition-bank.osu b/osu.Game.Tests/Resources/hitobject-no-addition-bank.osu new file mode 100644 index 0000000000..43d0b8cc16 --- /dev/null +++ b/osu.Game.Tests/Resources/hitobject-no-addition-bank.osu @@ -0,0 +1,4 @@ +osu file format v14 + +[HitObjects] +444,320,1000,5,2,3:0:1:0: \ No newline at end of file diff --git a/osu.Game/Rulesets/Objects/Legacy/ConvertHitObjectParser.cs b/osu.Game/Rulesets/Objects/Legacy/ConvertHitObjectParser.cs index 73f70d414f..f109be538b 100644 --- a/osu.Game/Rulesets/Objects/Legacy/ConvertHitObjectParser.cs +++ b/osu.Game/Rulesets/Objects/Legacy/ConvertHitObjectParser.cs @@ -240,7 +240,7 @@ namespace osu.Game.Rulesets.Objects.Legacy stringAddBank = null; bankInfo.Normal = stringBank; - bankInfo.Add = stringAddBank; + bankInfo.Add = string.IsNullOrEmpty(stringAddBank) ? stringBank : stringAddBank; if (split.Length > 2) bankInfo.CustomSampleBank = int.Parse(split[2]); From 4554fc2c7bb8db588a665ae5a8e0ddd0a088f100 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Mon, 5 Nov 2018 18:22:16 +0900 Subject: [PATCH 395/417] Update framework and other dependencies --- .../osu.Game.Rulesets.Catch.Tests.csproj | 2 +- .../osu.Game.Rulesets.Mania.Tests.csproj | 2 +- osu.Game.Rulesets.Osu.Tests/osu.Game.Rulesets.Osu.Tests.csproj | 2 +- .../osu.Game.Rulesets.Taiko.Tests.csproj | 2 +- osu.Game.Tests/osu.Game.Tests.csproj | 2 +- osu.Game/osu.Game.csproj | 2 +- 6 files changed, 6 insertions(+), 6 deletions(-) diff --git a/osu.Game.Rulesets.Catch.Tests/osu.Game.Rulesets.Catch.Tests.csproj b/osu.Game.Rulesets.Catch.Tests/osu.Game.Rulesets.Catch.Tests.csproj index 326791f506..b76f591239 100644 --- a/osu.Game.Rulesets.Catch.Tests/osu.Game.Rulesets.Catch.Tests.csproj +++ b/osu.Game.Rulesets.Catch.Tests/osu.Game.Rulesets.Catch.Tests.csproj @@ -4,7 +4,7 @@ - + diff --git a/osu.Game.Rulesets.Mania.Tests/osu.Game.Rulesets.Mania.Tests.csproj b/osu.Game.Rulesets.Mania.Tests/osu.Game.Rulesets.Mania.Tests.csproj index bf75ebbff8..98ad086c66 100644 --- a/osu.Game.Rulesets.Mania.Tests/osu.Game.Rulesets.Mania.Tests.csproj +++ b/osu.Game.Rulesets.Mania.Tests/osu.Game.Rulesets.Mania.Tests.csproj @@ -4,7 +4,7 @@ - + diff --git a/osu.Game.Rulesets.Osu.Tests/osu.Game.Rulesets.Osu.Tests.csproj b/osu.Game.Rulesets.Osu.Tests/osu.Game.Rulesets.Osu.Tests.csproj index 23c6150b6a..6117812f45 100644 --- a/osu.Game.Rulesets.Osu.Tests/osu.Game.Rulesets.Osu.Tests.csproj +++ b/osu.Game.Rulesets.Osu.Tests/osu.Game.Rulesets.Osu.Tests.csproj @@ -4,7 +4,7 @@ - + diff --git a/osu.Game.Rulesets.Taiko.Tests/osu.Game.Rulesets.Taiko.Tests.csproj b/osu.Game.Rulesets.Taiko.Tests/osu.Game.Rulesets.Taiko.Tests.csproj index 6ae9a018c5..3ba64398f3 100644 --- a/osu.Game.Rulesets.Taiko.Tests/osu.Game.Rulesets.Taiko.Tests.csproj +++ b/osu.Game.Rulesets.Taiko.Tests/osu.Game.Rulesets.Taiko.Tests.csproj @@ -4,7 +4,7 @@ - + diff --git a/osu.Game.Tests/osu.Game.Tests.csproj b/osu.Game.Tests/osu.Game.Tests.csproj index 520e0b8940..c0f0695ff8 100644 --- a/osu.Game.Tests/osu.Game.Tests.csproj +++ b/osu.Game.Tests/osu.Game.Tests.csproj @@ -5,7 +5,7 @@ - + diff --git a/osu.Game/osu.Game.csproj b/osu.Game/osu.Game.csproj index d953bfd63c..c9461ea504 100644 --- a/osu.Game/osu.Game.csproj +++ b/osu.Game/osu.Game.csproj @@ -18,7 +18,7 @@ - + From 2c4aa5af65cab016729e60aad050dff25af4282a Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Tue, 6 Nov 2018 16:16:15 +0900 Subject: [PATCH 396/417] Add executable flag to build.sh --- build.sh | 0 1 file changed, 0 insertions(+), 0 deletions(-) mode change 100644 => 100755 build.sh diff --git a/build.sh b/build.sh old mode 100644 new mode 100755 From 779e57f0cab8a91c18e4c40c38acb70067ae2a47 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Tue, 6 Nov 2018 16:32:11 +0900 Subject: [PATCH 397/417] Change .idea ignore rules to not ignore run configurations --- .gitignore | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/.gitignore b/.gitignore index 8f011deabe..f95a04e517 100644 --- a/.gitignore +++ b/.gitignore @@ -252,7 +252,11 @@ paket-files/ .fake/ # JetBrains Rider -.idea/ +.idea/.idea.osu/.idea/*.xml +.idea/.idea.osu/.idea/codeStyles/*.xml +.idea/.idea.osu/.idea/dataSources/*.xml +.idea/.idea.osu/.idea/dictionaries/*.xml +.idea/.idea.osu/*.iml *.sln.iml # CodeRush From faab744cbdecd773f2d3255b0a9602426d0b0206 Mon Sep 17 00:00:00 2001 From: smoogipoo Date: Tue, 6 Nov 2018 17:24:38 +0900 Subject: [PATCH 398/417] DragLayer -> DragBox --- osu.Game.Tests/Visual/TestCaseHitObjectComposer.cs | 2 +- .../Compose/Layers/{DragLayer.cs => DragBox.cs} | 11 +++++------ .../Edit/Screens/Compose/Layers/HitObjectMaskLayer.cs | 8 ++++---- 3 files changed, 10 insertions(+), 11 deletions(-) rename osu.Game/Screens/Edit/Screens/Compose/Layers/{DragLayer.cs => DragBox.cs} (86%) diff --git a/osu.Game.Tests/Visual/TestCaseHitObjectComposer.cs b/osu.Game.Tests/Visual/TestCaseHitObjectComposer.cs index 61647ffdc5..64218233d0 100644 --- a/osu.Game.Tests/Visual/TestCaseHitObjectComposer.cs +++ b/osu.Game.Tests/Visual/TestCaseHitObjectComposer.cs @@ -29,7 +29,7 @@ namespace osu.Game.Tests.Visual public override IReadOnlyList RequiredTypes => new[] { typeof(MaskSelection), - typeof(DragLayer), + typeof(DragBox), typeof(HitObjectComposer), typeof(OsuHitObjectComposer), typeof(HitObjectMaskLayer), diff --git a/osu.Game/Screens/Edit/Screens/Compose/Layers/DragLayer.cs b/osu.Game/Screens/Edit/Screens/Compose/Layers/DragBox.cs similarity index 86% rename from osu.Game/Screens/Edit/Screens/Compose/Layers/DragLayer.cs rename to osu.Game/Screens/Edit/Screens/Compose/Layers/DragBox.cs index fdc0dee0ce..13a3bdc379 100644 --- a/osu.Game/Screens/Edit/Screens/Compose/Layers/DragLayer.cs +++ b/osu.Game/Screens/Edit/Screens/Compose/Layers/DragBox.cs @@ -8,15 +8,14 @@ using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Primitives; using osu.Framework.Graphics.Shapes; using osu.Framework.Input.Events; -using osu.Game.Rulesets.Edit; using OpenTK.Graphics; namespace osu.Game.Screens.Edit.Screens.Compose.Layers { /// - /// A layer that handles and displays drag selection for a collection of s. + /// A box that displays the drag selection and provides selection events for users to handle. /// - public class DragLayer : CompositeDrawable + public class DragBox : CompositeDrawable { private readonly Action performSelection; @@ -28,10 +27,10 @@ namespace osu.Game.Screens.Edit.Screens.Compose.Layers private Drawable box; /// - /// Creates a new . + /// Creates a new . /// - /// The selectable s. - public DragLayer(Action performSelection) + /// A delegate that performs drag selection. + public DragBox(Action performSelection) { this.performSelection = performSelection; diff --git a/osu.Game/Screens/Edit/Screens/Compose/Layers/HitObjectMaskLayer.cs b/osu.Game/Screens/Edit/Screens/Compose/Layers/HitObjectMaskLayer.cs index 0392cb5952..30c4ad7cb9 100644 --- a/osu.Game/Screens/Edit/Screens/Compose/Layers/HitObjectMaskLayer.cs +++ b/osu.Game/Screens/Edit/Screens/Compose/Layers/HitObjectMaskLayer.cs @@ -37,15 +37,15 @@ namespace osu.Game.Screens.Edit.Screens.Compose.Layers maskSelection.DeselectAll = maskContainer.DeselectAll; - var dragLayer = new DragLayer(maskContainer.Select); - dragLayer.DragEnd += () => maskSelection.UpdateVisibility(); + var dragBox = new DragBox(maskContainer.Select); + dragBox.DragEnd += () => maskSelection.UpdateVisibility(); InternalChildren = new[] { - dragLayer, + dragBox, maskSelection, maskContainer, - dragLayer.CreateProxy() + dragBox.CreateProxy() }; foreach (var obj in composer.HitObjects) From 26c9390c167cae9b3187e058f0ea6829d9b45b4b Mon Sep 17 00:00:00 2001 From: smoogipoo Date: Tue, 6 Nov 2018 17:36:10 +0900 Subject: [PATCH 399/417] HitObjectMaskLayer -> BlueprintContainer --- osu.Game.Tests/Visual/TestCaseHitObjectComposer.cs | 2 +- osu.Game/Rulesets/Edit/HitObjectComposer.cs | 8 ++++---- .../{HitObjectMaskLayer.cs => BlueprintContainer.cs} | 4 ++-- 3 files changed, 7 insertions(+), 7 deletions(-) rename osu.Game/Screens/Edit/Screens/Compose/Layers/{HitObjectMaskLayer.cs => BlueprintContainer.cs} (96%) diff --git a/osu.Game.Tests/Visual/TestCaseHitObjectComposer.cs b/osu.Game.Tests/Visual/TestCaseHitObjectComposer.cs index 64218233d0..aa657c9309 100644 --- a/osu.Game.Tests/Visual/TestCaseHitObjectComposer.cs +++ b/osu.Game.Tests/Visual/TestCaseHitObjectComposer.cs @@ -32,7 +32,7 @@ namespace osu.Game.Tests.Visual typeof(DragBox), typeof(HitObjectComposer), typeof(OsuHitObjectComposer), - typeof(HitObjectMaskLayer), + typeof(BlueprintContainer), typeof(NotNullAttribute), typeof(HitCirclePiece), typeof(HitCircleSelectionMask), diff --git a/osu.Game/Rulesets/Edit/HitObjectComposer.cs b/osu.Game/Rulesets/Edit/HitObjectComposer.cs index 13571bda84..a84b6a30a7 100644 --- a/osu.Game/Rulesets/Edit/HitObjectComposer.cs +++ b/osu.Game/Rulesets/Edit/HitObjectComposer.cs @@ -35,7 +35,7 @@ namespace osu.Game.Rulesets.Edit private EditRulesetContainer rulesetContainer; - private HitObjectMaskLayer maskLayer; + private BlueprintContainer blueprintContainer; private PlacementContainer placementContainer; internal HitObjectComposer(Ruleset ruleset) @@ -67,7 +67,7 @@ namespace osu.Game.Rulesets.Edit var layerAboveRuleset = CreateLayerContainer(); layerAboveRuleset.Children = new Drawable[] { - maskLayer = new HitObjectMaskLayer(), + blueprintContainer = new BlueprintContainer(), placementContainer = new PlacementContainer(), }; @@ -148,11 +148,11 @@ namespace osu.Game.Rulesets.Edit /// The to add. public void Add(HitObject hitObject) { - maskLayer.AddMaskFor(rulesetContainer.Add(hitObject)); + blueprintContainer.AddMaskFor(rulesetContainer.Add(hitObject)); placementContainer.Refresh(); } - public void Remove(HitObject hitObject) => maskLayer.RemoveMaskFor(rulesetContainer.Remove(hitObject)); + public void Remove(HitObject hitObject) => blueprintContainer.RemoveMaskFor(rulesetContainer.Remove(hitObject)); internal abstract EditRulesetContainer CreateRulesetContainer(); diff --git a/osu.Game/Screens/Edit/Screens/Compose/Layers/HitObjectMaskLayer.cs b/osu.Game/Screens/Edit/Screens/Compose/Layers/BlueprintContainer.cs similarity index 96% rename from osu.Game/Screens/Edit/Screens/Compose/Layers/HitObjectMaskLayer.cs rename to osu.Game/Screens/Edit/Screens/Compose/Layers/BlueprintContainer.cs index 30c4ad7cb9..ec3e05dc3c 100644 --- a/osu.Game/Screens/Edit/Screens/Compose/Layers/HitObjectMaskLayer.cs +++ b/osu.Game/Screens/Edit/Screens/Compose/Layers/BlueprintContainer.cs @@ -11,14 +11,14 @@ using osu.Game.Rulesets.Objects.Drawables; namespace osu.Game.Screens.Edit.Screens.Compose.Layers { - public class HitObjectMaskLayer : CompositeDrawable + public class BlueprintContainer : CompositeDrawable { private MaskContainer maskContainer; [Resolved] private HitObjectComposer composer { get; set; } - public HitObjectMaskLayer() + public BlueprintContainer() { RelativeSizeAxes = Axes.Both; } From 65bb91dcf797417eb071c5c19d45ec8931edcab2 Mon Sep 17 00:00:00 2001 From: smoogipoo Date: Tue, 6 Nov 2018 17:51:26 +0900 Subject: [PATCH 400/417] Merge MaskContainer into BlueprintContainer --- .../Compose/Layers/BlueprintContainer.cs | 102 +++++++++++--- .../Screens/Compose/Layers/MaskContainer.cs | 128 ------------------ 2 files changed, 85 insertions(+), 145 deletions(-) delete mode 100644 osu.Game/Screens/Edit/Screens/Compose/Layers/MaskContainer.cs diff --git a/osu.Game/Screens/Edit/Screens/Compose/Layers/BlueprintContainer.cs b/osu.Game/Screens/Edit/Screens/Compose/Layers/BlueprintContainer.cs index ec3e05dc3c..6392ffaca1 100644 --- a/osu.Game/Screens/Edit/Screens/Compose/Layers/BlueprintContainer.cs +++ b/osu.Game/Screens/Edit/Screens/Compose/Layers/BlueprintContainer.cs @@ -1,19 +1,26 @@ // Copyright (c) 2007-2018 ppy Pty Ltd . // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE +using System.Collections.Generic; using System.Linq; using osu.Framework.Allocation; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; +using osu.Framework.Graphics.Primitives; using osu.Framework.Input.Events; +using osu.Framework.Input.States; using osu.Game.Rulesets.Edit; using osu.Game.Rulesets.Objects.Drawables; +using OpenTK; namespace osu.Game.Screens.Edit.Screens.Compose.Layers { public class BlueprintContainer : CompositeDrawable { - private MaskContainer maskContainer; + private SelectionBlueprintContainer selectionBlueprints; + private MaskSelection maskSelection; + + private IEnumerable aliveMasks => selectionBlueprints.Children.Where(c => c.IsAlive); [Resolved] private HitObjectComposer composer { get; set; } @@ -26,25 +33,17 @@ namespace osu.Game.Screens.Edit.Screens.Compose.Layers [BackgroundDependencyLoader] private void load() { - maskContainer = new MaskContainer(); + maskSelection = composer.CreateMaskSelection(); + maskSelection.DeselectAll = deselectAll; - var maskSelection = composer.CreateMaskSelection(); - - maskContainer.MaskSelected += maskSelection.HandleSelected; - maskContainer.MaskDeselected += maskSelection.HandleDeselected; - maskContainer.MaskSelectionRequested += maskSelection.HandleSelectionRequested; - maskContainer.MaskDragRequested += maskSelection.HandleDrag; - - maskSelection.DeselectAll = maskContainer.DeselectAll; - - var dragBox = new DragBox(maskContainer.Select); + var dragBox = new DragBox(select); dragBox.DragEnd += () => maskSelection.UpdateVisibility(); InternalChildren = new[] { dragBox, maskSelection, - maskContainer, + selectionBlueprints = new SelectionBlueprintContainer { RelativeSizeAxes = Axes.Both }, dragBox.CreateProxy() }; @@ -54,7 +53,7 @@ namespace osu.Game.Screens.Edit.Screens.Compose.Layers protected override bool OnClick(ClickEvent e) { - maskContainer.DeselectAll(); + deselectAll(); return true; } @@ -68,7 +67,12 @@ namespace osu.Game.Screens.Edit.Screens.Compose.Layers if (mask == null) return; - maskContainer.Add(mask); + mask.Selected += onMaskSelected; + mask.Deselected += onMaskDeselected; + mask.SelectionRequested += onSelectionRequested; + mask.DragRequested += onDragRequested; + + selectionBlueprints.Add(mask); } /// @@ -77,12 +81,76 @@ namespace osu.Game.Screens.Edit.Screens.Compose.Layers /// The for which to remove the mask. public void RemoveMaskFor(DrawableHitObject hitObject) { - var maskToRemove = maskContainer.Single(m => m.HitObject == hitObject); + var maskToRemove = selectionBlueprints.Single(m => m.HitObject == hitObject); if (maskToRemove == null) return; maskToRemove.Deselect(); - maskContainer.Remove(maskToRemove); + + maskToRemove.Selected -= onMaskSelected; + maskToRemove.Deselected -= onMaskDeselected; + maskToRemove.SelectionRequested -= onSelectionRequested; + maskToRemove.DragRequested -= onDragRequested; + + selectionBlueprints.Remove(maskToRemove); + } + + /// + /// Select all masks in a given rectangle selection area. + /// + /// The rectangle to perform a selection on in screen-space coordinates. + private void select(RectangleF rect) + { + foreach (var mask in aliveMasks.ToList()) + { + if (mask.IsPresent && rect.Contains(mask.SelectionPoint)) + mask.Select(); + else + mask.Deselect(); + } + } + + /// + /// Deselects all selected s. + /// + private void deselectAll() => aliveMasks.ToList().ForEach(m => m.Deselect()); + + private void onMaskSelected(SelectionMask mask) + { + maskSelection.HandleSelected(mask); + selectionBlueprints.ChangeChildDepth(mask, 1); + } + + private void onMaskDeselected(SelectionMask mask) + { + maskSelection.HandleDeselected(mask); + selectionBlueprints.ChangeChildDepth(mask, 0); + } + + private void onSelectionRequested(SelectionMask mask, InputState state) => maskSelection.HandleSelectionRequested(mask, state); + + private void onDragRequested(SelectionMask mask, Vector2 delta, InputState state) => maskSelection.HandleDrag(mask, delta, state); + + private class SelectionBlueprintContainer : Container + { + protected override int Compare(Drawable x, Drawable y) + { + if (!(x is SelectionMask xMask) || !(y is SelectionMask yMask)) + return base.Compare(x, y); + return Compare(xMask, yMask); + } + + public int Compare(SelectionMask x, SelectionMask y) + { + // dpeth is used to denote selected status (we always want selected masks to handle input first). + int d = x.Depth.CompareTo(y.Depth); + if (d != 0) + return d; + + // Put earlier hitobjects towards the end of the list, so they handle input first + int i = y.HitObject.HitObject.StartTime.CompareTo(x.HitObject.HitObject.StartTime); + return i == 0 ? CompareReverseChildID(x, y) : i; + } } } } diff --git a/osu.Game/Screens/Edit/Screens/Compose/Layers/MaskContainer.cs b/osu.Game/Screens/Edit/Screens/Compose/Layers/MaskContainer.cs deleted file mode 100644 index 42a7757721..0000000000 --- a/osu.Game/Screens/Edit/Screens/Compose/Layers/MaskContainer.cs +++ /dev/null @@ -1,128 +0,0 @@ -// Copyright (c) 2007-2018 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 osu.Framework.Graphics; -using osu.Framework.Graphics.Containers; -using osu.Framework.Input.States; -using osu.Game.Rulesets.Edit; -using OpenTK; -using RectangleF = osu.Framework.Graphics.Primitives.RectangleF; - -namespace osu.Game.Screens.Edit.Screens.Compose.Layers -{ - public class MaskContainer : Container - { - /// - /// Invoked when any is selected. - /// - public event Action MaskSelected; - - /// - /// Invoked when any is deselected. - /// - public event Action MaskDeselected; - - /// - /// Invoked when any requests selection. - /// - public event Action MaskSelectionRequested; - - /// - /// Invoked when any requests drag. - /// - public event Action MaskDragRequested; - - private IEnumerable aliveMasks => AliveInternalChildren.Cast(); - - public MaskContainer() - { - RelativeSizeAxes = Axes.Both; - } - - public override void Add(SelectionMask drawable) - { - if (drawable == null) throw new ArgumentNullException(nameof(drawable)); - - base.Add(drawable); - - drawable.Selected += onMaskSelected; - drawable.Deselected += onMaskDeselected; - drawable.SelectionRequested += onSelectionRequested; - drawable.DragRequested += onDragRequested; - } - - public override bool Remove(SelectionMask drawable) - { - if (drawable == null) throw new ArgumentNullException(nameof(drawable)); - - var result = base.Remove(drawable); - - if (result) - { - drawable.Selected -= onMaskSelected; - drawable.Deselected -= onMaskDeselected; - drawable.SelectionRequested -= onSelectionRequested; - drawable.DragRequested -= onDragRequested; - } - - return result; - } - - /// - /// Select all masks in a given rectangle selection area. - /// - /// The rectangle to perform a selection on in screen-space coordinates. - public void Select(RectangleF rect) - { - foreach (var mask in aliveMasks.ToList()) - { - if (mask.IsPresent && rect.Contains(mask.SelectionPoint)) - mask.Select(); - else - mask.Deselect(); - } - } - - /// - /// Deselects all selected s. - /// - public void DeselectAll() => aliveMasks.ToList().ForEach(m => m.Deselect()); - - private void onMaskSelected(SelectionMask mask) - { - MaskSelected?.Invoke(mask); - ChangeChildDepth(mask, 1); - } - - private void onMaskDeselected(SelectionMask mask) - { - MaskDeselected?.Invoke(mask); - ChangeChildDepth(mask, 0); - } - - private void onSelectionRequested(SelectionMask mask, InputState state) => MaskSelectionRequested?.Invoke(mask, state); - private void onDragRequested(SelectionMask mask, Vector2 delta, InputState state) => MaskDragRequested?.Invoke(mask, delta, state); - - protected override int Compare(Drawable x, Drawable y) - { - if (!(x is SelectionMask xMask) || !(y is SelectionMask yMask)) - return base.Compare(x, y); - return Compare(xMask, yMask); - } - - public int Compare(SelectionMask x, SelectionMask y) - { - // dpeth is used to denote selected status (we always want selected masks to handle input first). - int d = x.Depth.CompareTo(y.Depth); - if (d != 0) - return d; - - // Put earlier hitobjects towards the end of the list, so they handle input first - int i = y.HitObject.HitObject.StartTime.CompareTo(x.HitObject.HitObject.StartTime); - return i == 0 ? CompareReverseChildID(x, y) : i; - } - } -} From ad2836a61e7fcbe5ea0dad92089b504d78b3bcf0 Mon Sep 17 00:00:00 2001 From: smoogipoo Date: Tue, 6 Nov 2018 17:52:47 +0900 Subject: [PATCH 401/417] MaskSelection -> SelectionBox --- .../Visual/TestCaseHitObjectComposer.cs | 2 +- osu.Game/Rulesets/Edit/HitObjectComposer.cs | 4 ++-- .../Compose/Layers/BlueprintContainer.cs | 18 +++++++++--------- .../Edit/Screens/Compose/Layers/DragBox.cs | 2 +- .../{MaskSelection.cs => SelectionBox.cs} | 6 +++--- 5 files changed, 16 insertions(+), 16 deletions(-) rename osu.Game/Screens/Edit/Screens/Compose/Layers/{MaskSelection.cs => SelectionBox.cs} (97%) diff --git a/osu.Game.Tests/Visual/TestCaseHitObjectComposer.cs b/osu.Game.Tests/Visual/TestCaseHitObjectComposer.cs index aa657c9309..c51ede719a 100644 --- a/osu.Game.Tests/Visual/TestCaseHitObjectComposer.cs +++ b/osu.Game.Tests/Visual/TestCaseHitObjectComposer.cs @@ -28,7 +28,7 @@ namespace osu.Game.Tests.Visual { public override IReadOnlyList RequiredTypes => new[] { - typeof(MaskSelection), + typeof(SelectionBox), typeof(DragBox), typeof(HitObjectComposer), typeof(OsuHitObjectComposer), diff --git a/osu.Game/Rulesets/Edit/HitObjectComposer.cs b/osu.Game/Rulesets/Edit/HitObjectComposer.cs index a84b6a30a7..82c8e26706 100644 --- a/osu.Game/Rulesets/Edit/HitObjectComposer.cs +++ b/osu.Game/Rulesets/Edit/HitObjectComposer.cs @@ -165,10 +165,10 @@ namespace osu.Game.Rulesets.Edit public virtual SelectionMask CreateMaskFor(DrawableHitObject hitObject) => null; /// - /// Creates a which outlines s + /// Creates a which outlines s /// and handles hitobject pattern adjustments. /// - public virtual MaskSelection CreateMaskSelection() => new MaskSelection(); + public virtual SelectionBox CreateMaskSelection() => new SelectionBox(); /// /// Creates a which provides a layer above or below the . diff --git a/osu.Game/Screens/Edit/Screens/Compose/Layers/BlueprintContainer.cs b/osu.Game/Screens/Edit/Screens/Compose/Layers/BlueprintContainer.cs index 6392ffaca1..9a17dc8007 100644 --- a/osu.Game/Screens/Edit/Screens/Compose/Layers/BlueprintContainer.cs +++ b/osu.Game/Screens/Edit/Screens/Compose/Layers/BlueprintContainer.cs @@ -18,7 +18,7 @@ namespace osu.Game.Screens.Edit.Screens.Compose.Layers public class BlueprintContainer : CompositeDrawable { private SelectionBlueprintContainer selectionBlueprints; - private MaskSelection maskSelection; + private SelectionBox selectionBox; private IEnumerable aliveMasks => selectionBlueprints.Children.Where(c => c.IsAlive); @@ -33,16 +33,16 @@ namespace osu.Game.Screens.Edit.Screens.Compose.Layers [BackgroundDependencyLoader] private void load() { - maskSelection = composer.CreateMaskSelection(); - maskSelection.DeselectAll = deselectAll; + selectionBox = composer.CreateMaskSelection(); + selectionBox.DeselectAll = deselectAll; var dragBox = new DragBox(select); - dragBox.DragEnd += () => maskSelection.UpdateVisibility(); + dragBox.DragEnd += () => selectionBox.UpdateVisibility(); InternalChildren = new[] { dragBox, - maskSelection, + selectionBox, selectionBlueprints = new SelectionBlueprintContainer { RelativeSizeAxes = Axes.Both }, dragBox.CreateProxy() }; @@ -117,19 +117,19 @@ namespace osu.Game.Screens.Edit.Screens.Compose.Layers private void onMaskSelected(SelectionMask mask) { - maskSelection.HandleSelected(mask); + selectionBox.HandleSelected(mask); selectionBlueprints.ChangeChildDepth(mask, 1); } private void onMaskDeselected(SelectionMask mask) { - maskSelection.HandleDeselected(mask); + selectionBox.HandleDeselected(mask); selectionBlueprints.ChangeChildDepth(mask, 0); } - private void onSelectionRequested(SelectionMask mask, InputState state) => maskSelection.HandleSelectionRequested(mask, state); + private void onSelectionRequested(SelectionMask mask, InputState state) => selectionBox.HandleSelectionRequested(mask, state); - private void onDragRequested(SelectionMask mask, Vector2 delta, InputState state) => maskSelection.HandleDrag(mask, delta, state); + private void onDragRequested(SelectionMask mask, Vector2 delta, InputState state) => selectionBox.HandleDrag(mask, delta, state); private class SelectionBlueprintContainer : Container { diff --git a/osu.Game/Screens/Edit/Screens/Compose/Layers/DragBox.cs b/osu.Game/Screens/Edit/Screens/Compose/Layers/DragBox.cs index 13a3bdc379..a97ffc3fcc 100644 --- a/osu.Game/Screens/Edit/Screens/Compose/Layers/DragBox.cs +++ b/osu.Game/Screens/Edit/Screens/Compose/Layers/DragBox.cs @@ -46,7 +46,7 @@ namespace osu.Game.Screens.Edit.Screens.Compose.Layers { Masking = true, BorderColour = Color4.White, - BorderThickness = MaskSelection.BORDER_RADIUS, + BorderThickness = SelectionBox.BORDER_RADIUS, Child = new Box { RelativeSizeAxes = Axes.Both, diff --git a/osu.Game/Screens/Edit/Screens/Compose/Layers/MaskSelection.cs b/osu.Game/Screens/Edit/Screens/Compose/Layers/SelectionBox.cs similarity index 97% rename from osu.Game/Screens/Edit/Screens/Compose/Layers/MaskSelection.cs rename to osu.Game/Screens/Edit/Screens/Compose/Layers/SelectionBox.cs index 17b34bfb49..267892f45d 100644 --- a/osu.Game/Screens/Edit/Screens/Compose/Layers/MaskSelection.cs +++ b/osu.Game/Screens/Edit/Screens/Compose/Layers/SelectionBox.cs @@ -21,7 +21,7 @@ namespace osu.Game.Screens.Edit.Screens.Compose.Layers /// /// A box which surrounds s and provides interactive handles, context menus etc. /// - public class MaskSelection : CompositeDrawable + public class SelectionBox : CompositeDrawable { public const float BORDER_RADIUS = 2; @@ -32,7 +32,7 @@ namespace osu.Game.Screens.Edit.Screens.Compose.Layers [Resolved] private IPlacementHandler placementHandler { get; set; } - public MaskSelection() + public SelectionBox() { selectedMasks = new List(); @@ -147,7 +147,7 @@ namespace osu.Game.Screens.Edit.Screens.Compose.Layers #endregion /// - /// Updates whether this is visible. + /// Updates whether this is visible. /// internal void UpdateVisibility() { From f2a5f28ea2562f8e3c08fb02c22a391cae439f5a Mon Sep 17 00:00:00 2001 From: smoogipoo Date: Tue, 6 Nov 2018 17:56:04 +0900 Subject: [PATCH 402/417] SelectionMask -> SelectionBlueprint --- .../Edit/ManiaHitObjectComposer.cs | 6 +-- ...nMask.cs => HoldNoteSelectionBlueprint.cs} | 12 ++--- ...ctionMask.cs => NoteSelectionBlueprint.cs} | 4 +- .../TestCaseHitCircleSelectionMask.cs | 2 +- .../TestCaseSliderSelectionMask.cs | 6 +-- .../TestCaseSpinnerSelectionMask.cs | 4 +- ...Mask.cs => HitCircleSelectionBlueprint.cs} | 4 +- ...k.cs => SliderCircleSelectionBlueprint.cs} | 4 +- ...ionMask.cs => SliderSelectionBlueprint.cs} | 12 ++--- ...onMask.cs => SpinnerSelectionBlueprint.cs} | 4 +- .../Edit/OsuHitObjectComposer.cs | 8 +-- .../Visual/TestCaseHitObjectComposer.cs | 2 +- osu.Game/Rulesets/Edit/HitObjectComposer.cs | 10 ++-- ...SelectionMask.cs => SelectionBlueprint.cs} | 30 +++++------ .../Compose/Layers/BlueprintContainer.cs | 50 +++++++++---------- .../Screens/Compose/Layers/SelectionBox.cs | 32 ++++++------ .../Visual/HitObjectSelectionMaskTestCase.cs | 14 +++--- 17 files changed, 102 insertions(+), 102 deletions(-) rename osu.Game.Rulesets.Mania/Edit/Masks/{HoldNoteSelectionMask.cs => HoldNoteSelectionBlueprint.cs} (86%) rename osu.Game.Rulesets.Mania/Edit/Masks/{NoteSelectionMask.cs => NoteSelectionBlueprint.cs} (88%) rename osu.Game.Rulesets.Osu/Edit/Masks/HitCircleMasks/{HitCircleSelectionMask.cs => HitCircleSelectionBlueprint.cs} (79%) rename osu.Game.Rulesets.Osu/Edit/Masks/SliderMasks/{SliderCircleSelectionMask.cs => SliderCircleSelectionBlueprint.cs} (79%) rename osu.Game.Rulesets.Osu/Edit/Masks/SliderMasks/{SliderSelectionMask.cs => SliderSelectionBlueprint.cs} (59%) rename osu.Game.Rulesets.Osu/Edit/Masks/SpinnerMasks/{SpinnerSelectionMask.cs => SpinnerSelectionBlueprint.cs} (84%) rename osu.Game/Rulesets/Edit/{SelectionMask.cs => SelectionBlueprint.cs} (78%) diff --git a/osu.Game.Rulesets.Mania/Edit/ManiaHitObjectComposer.cs b/osu.Game.Rulesets.Mania/Edit/ManiaHitObjectComposer.cs index fcacde769b..76969ab2bf 100644 --- a/osu.Game.Rulesets.Mania/Edit/ManiaHitObjectComposer.cs +++ b/osu.Game.Rulesets.Mania/Edit/ManiaHitObjectComposer.cs @@ -38,14 +38,14 @@ namespace osu.Game.Rulesets.Mania.Edit protected override IReadOnlyList CompositionTools => Array.Empty(); - public override SelectionMask CreateMaskFor(DrawableHitObject hitObject) + public override SelectionBlueprint CreateMaskFor(DrawableHitObject hitObject) { switch (hitObject) { case DrawableNote note: - return new NoteSelectionMask(note); + return new NoteSelectionBlueprint(note); case DrawableHoldNote holdNote: - return new HoldNoteSelectionMask(holdNote); + return new HoldNoteSelectionBlueprint(holdNote); } return base.CreateMaskFor(hitObject); diff --git a/osu.Game.Rulesets.Mania/Edit/Masks/HoldNoteSelectionMask.cs b/osu.Game.Rulesets.Mania/Edit/Masks/HoldNoteSelectionBlueprint.cs similarity index 86% rename from osu.Game.Rulesets.Mania/Edit/Masks/HoldNoteSelectionMask.cs rename to osu.Game.Rulesets.Mania/Edit/Masks/HoldNoteSelectionBlueprint.cs index a2c01d7a0e..14f045a549 100644 --- a/osu.Game.Rulesets.Mania/Edit/Masks/HoldNoteSelectionMask.cs +++ b/osu.Game.Rulesets.Mania/Edit/Masks/HoldNoteSelectionBlueprint.cs @@ -15,7 +15,7 @@ using OpenTK.Graphics; namespace osu.Game.Rulesets.Mania.Edit.Masks { - public class HoldNoteSelectionMask : SelectionMask + public class HoldNoteSelectionBlueprint : SelectionBlueprint { public new DrawableHoldNote HitObject => (DrawableHoldNote)base.HitObject; @@ -23,13 +23,13 @@ namespace osu.Game.Rulesets.Mania.Edit.Masks private readonly BodyPiece body; - public HoldNoteSelectionMask(DrawableHoldNote hold) + public HoldNoteSelectionBlueprint(DrawableHoldNote hold) : base(hold) { InternalChildren = new Drawable[] { - new HoldNoteNoteSelectionMask(hold.Head), - new HoldNoteNoteSelectionMask(hold.Tail), + new HoldNoteNoteSelectionBlueprint(hold.Head), + new HoldNoteNoteSelectionBlueprint(hold.Tail), body = new BodyPiece { AccentColour = Color4.Transparent @@ -59,9 +59,9 @@ namespace osu.Game.Rulesets.Mania.Edit.Masks Y -= HitObject.Tail.DrawHeight; } - private class HoldNoteNoteSelectionMask : NoteSelectionMask + private class HoldNoteNoteSelectionBlueprint : NoteSelectionBlueprint { - public HoldNoteNoteSelectionMask(DrawableNote note) + public HoldNoteNoteSelectionBlueprint(DrawableNote note) : base(note) { Select(); diff --git a/osu.Game.Rulesets.Mania/Edit/Masks/NoteSelectionMask.cs b/osu.Game.Rulesets.Mania/Edit/Masks/NoteSelectionBlueprint.cs similarity index 88% rename from osu.Game.Rulesets.Mania/Edit/Masks/NoteSelectionMask.cs rename to osu.Game.Rulesets.Mania/Edit/Masks/NoteSelectionBlueprint.cs index 18f042a483..4be0da12e1 100644 --- a/osu.Game.Rulesets.Mania/Edit/Masks/NoteSelectionMask.cs +++ b/osu.Game.Rulesets.Mania/Edit/Masks/NoteSelectionBlueprint.cs @@ -9,9 +9,9 @@ using osu.Game.Rulesets.Mania.Objects.Drawables.Pieces; namespace osu.Game.Rulesets.Mania.Edit.Masks { - public class NoteSelectionMask : SelectionMask + public class NoteSelectionBlueprint : SelectionBlueprint { - public NoteSelectionMask(DrawableNote note) + public NoteSelectionBlueprint(DrawableNote note) : base(note) { Scale = note.Scale; diff --git a/osu.Game.Rulesets.Osu.Tests/TestCaseHitCircleSelectionMask.cs b/osu.Game.Rulesets.Osu.Tests/TestCaseHitCircleSelectionMask.cs index e3d61623bf..330315a953 100644 --- a/osu.Game.Rulesets.Osu.Tests/TestCaseHitCircleSelectionMask.cs +++ b/osu.Game.Rulesets.Osu.Tests/TestCaseHitCircleSelectionMask.cs @@ -24,6 +24,6 @@ namespace osu.Game.Rulesets.Osu.Tests Add(drawableObject = new DrawableHitCircle(hitCircle)); } - protected override SelectionMask CreateMask() => new HitCircleSelectionMask(drawableObject); + protected override SelectionBlueprint CreateMask() => new HitCircleSelectionBlueprint(drawableObject); } } diff --git a/osu.Game.Rulesets.Osu.Tests/TestCaseSliderSelectionMask.cs b/osu.Game.Rulesets.Osu.Tests/TestCaseSliderSelectionMask.cs index 87e0e1a7ec..0641ff7582 100644 --- a/osu.Game.Rulesets.Osu.Tests/TestCaseSliderSelectionMask.cs +++ b/osu.Game.Rulesets.Osu.Tests/TestCaseSliderSelectionMask.cs @@ -20,8 +20,8 @@ namespace osu.Game.Rulesets.Osu.Tests { public override IReadOnlyList RequiredTypes => new[] { - typeof(SliderSelectionMask), - typeof(SliderCircleSelectionMask), + typeof(SliderSelectionBlueprint), + typeof(SliderCircleSelectionBlueprint), typeof(SliderBodyPiece), typeof(SliderCircle), typeof(PathControlPointVisualiser), @@ -50,6 +50,6 @@ namespace osu.Game.Rulesets.Osu.Tests Add(drawableObject = new DrawableSlider(slider)); } - protected override SelectionMask CreateMask() => new SliderSelectionMask(drawableObject); + protected override SelectionBlueprint CreateMask() => new SliderSelectionBlueprint(drawableObject); } } diff --git a/osu.Game.Rulesets.Osu.Tests/TestCaseSpinnerSelectionMask.cs b/osu.Game.Rulesets.Osu.Tests/TestCaseSpinnerSelectionMask.cs index b436ff0e9f..9b0be3cc9c 100644 --- a/osu.Game.Rulesets.Osu.Tests/TestCaseSpinnerSelectionMask.cs +++ b/osu.Game.Rulesets.Osu.Tests/TestCaseSpinnerSelectionMask.cs @@ -21,7 +21,7 @@ namespace osu.Game.Rulesets.Osu.Tests { public override IReadOnlyList RequiredTypes => new[] { - typeof(SpinnerSelectionMask), + typeof(SpinnerSelectionBlueprint), typeof(SpinnerPiece) }; @@ -45,6 +45,6 @@ namespace osu.Game.Rulesets.Osu.Tests }); } - protected override SelectionMask CreateMask() => new SpinnerSelectionMask(drawableSpinner) { Size = new Vector2(0.5f) }; + protected override SelectionBlueprint CreateMask() => new SpinnerSelectionBlueprint(drawableSpinner) { Size = new Vector2(0.5f) }; } } diff --git a/osu.Game.Rulesets.Osu/Edit/Masks/HitCircleMasks/HitCircleSelectionMask.cs b/osu.Game.Rulesets.Osu/Edit/Masks/HitCircleMasks/HitCircleSelectionBlueprint.cs similarity index 79% rename from osu.Game.Rulesets.Osu/Edit/Masks/HitCircleMasks/HitCircleSelectionMask.cs rename to osu.Game.Rulesets.Osu/Edit/Masks/HitCircleMasks/HitCircleSelectionBlueprint.cs index da46da92a5..14eb97327c 100644 --- a/osu.Game.Rulesets.Osu/Edit/Masks/HitCircleMasks/HitCircleSelectionMask.cs +++ b/osu.Game.Rulesets.Osu/Edit/Masks/HitCircleMasks/HitCircleSelectionBlueprint.cs @@ -8,9 +8,9 @@ using osu.Game.Rulesets.Osu.Objects.Drawables; namespace osu.Game.Rulesets.Osu.Edit.Masks.HitCircleMasks { - public class HitCircleSelectionMask : SelectionMask + public class HitCircleSelectionBlueprint : SelectionBlueprint { - public HitCircleSelectionMask(DrawableHitCircle hitCircle) + public HitCircleSelectionBlueprint(DrawableHitCircle hitCircle) : base(hitCircle) { InternalChild = new HitCirclePiece((HitCircle)hitCircle.HitObject); diff --git a/osu.Game.Rulesets.Osu/Edit/Masks/SliderMasks/SliderCircleSelectionMask.cs b/osu.Game.Rulesets.Osu/Edit/Masks/SliderMasks/SliderCircleSelectionBlueprint.cs similarity index 79% rename from osu.Game.Rulesets.Osu/Edit/Masks/SliderMasks/SliderCircleSelectionMask.cs rename to osu.Game.Rulesets.Osu/Edit/Masks/SliderMasks/SliderCircleSelectionBlueprint.cs index a1b3fd545c..ab37079d42 100644 --- a/osu.Game.Rulesets.Osu/Edit/Masks/SliderMasks/SliderCircleSelectionMask.cs +++ b/osu.Game.Rulesets.Osu/Edit/Masks/SliderMasks/SliderCircleSelectionBlueprint.cs @@ -8,9 +8,9 @@ using osu.Game.Rulesets.Osu.Objects.Drawables; namespace osu.Game.Rulesets.Osu.Edit.Masks.SliderMasks { - public class SliderCircleSelectionMask : SelectionMask + public class SliderCircleSelectionBlueprint : SelectionBlueprint { - public SliderCircleSelectionMask(DrawableOsuHitObject hitObject, Slider slider, SliderPosition position) + public SliderCircleSelectionBlueprint(DrawableOsuHitObject hitObject, Slider slider, SliderPosition position) : base(hitObject) { InternalChild = new SliderCirclePiece(slider, position); diff --git a/osu.Game.Rulesets.Osu/Edit/Masks/SliderMasks/SliderSelectionMask.cs b/osu.Game.Rulesets.Osu/Edit/Masks/SliderMasks/SliderSelectionBlueprint.cs similarity index 59% rename from osu.Game.Rulesets.Osu/Edit/Masks/SliderMasks/SliderSelectionMask.cs rename to osu.Game.Rulesets.Osu/Edit/Masks/SliderMasks/SliderSelectionBlueprint.cs index b79b0ba1fb..adb8591550 100644 --- a/osu.Game.Rulesets.Osu/Edit/Masks/SliderMasks/SliderSelectionMask.cs +++ b/osu.Game.Rulesets.Osu/Edit/Masks/SliderMasks/SliderSelectionBlueprint.cs @@ -10,11 +10,11 @@ using OpenTK; namespace osu.Game.Rulesets.Osu.Edit.Masks.SliderMasks { - public class SliderSelectionMask : SelectionMask + public class SliderSelectionBlueprint : SelectionBlueprint { - private readonly SliderCircleSelectionMask headMask; + private readonly SliderCircleSelectionBlueprint headBlueprint; - public SliderSelectionMask(DrawableSlider slider) + public SliderSelectionBlueprint(DrawableSlider slider) : base(slider) { var sliderObject = (Slider)slider.HitObject; @@ -22,12 +22,12 @@ namespace osu.Game.Rulesets.Osu.Edit.Masks.SliderMasks InternalChildren = new Drawable[] { new SliderBodyPiece(sliderObject), - headMask = new SliderCircleSelectionMask(slider.HeadCircle, sliderObject, SliderPosition.Start), - new SliderCircleSelectionMask(slider.TailCircle, sliderObject, SliderPosition.End), + headBlueprint = new SliderCircleSelectionBlueprint(slider.HeadCircle, sliderObject, SliderPosition.Start), + new SliderCircleSelectionBlueprint(slider.TailCircle, sliderObject, SliderPosition.End), new PathControlPointVisualiser(sliderObject), }; } - public override Vector2 SelectionPoint => headMask.SelectionPoint; + public override Vector2 SelectionPoint => headBlueprint.SelectionPoint; } } diff --git a/osu.Game.Rulesets.Osu/Edit/Masks/SpinnerMasks/SpinnerSelectionMask.cs b/osu.Game.Rulesets.Osu/Edit/Masks/SpinnerMasks/SpinnerSelectionBlueprint.cs similarity index 84% rename from osu.Game.Rulesets.Osu/Edit/Masks/SpinnerMasks/SpinnerSelectionMask.cs rename to osu.Game.Rulesets.Osu/Edit/Masks/SpinnerMasks/SpinnerSelectionBlueprint.cs index 0e47bd2a8b..b3c550b1c1 100644 --- a/osu.Game.Rulesets.Osu/Edit/Masks/SpinnerMasks/SpinnerSelectionMask.cs +++ b/osu.Game.Rulesets.Osu/Edit/Masks/SpinnerMasks/SpinnerSelectionBlueprint.cs @@ -9,11 +9,11 @@ using OpenTK; namespace osu.Game.Rulesets.Osu.Edit.Masks.SpinnerMasks { - public class SpinnerSelectionMask : SelectionMask + public class SpinnerSelectionBlueprint : SelectionBlueprint { private readonly SpinnerPiece piece; - public SpinnerSelectionMask(DrawableSpinner spinner) + public SpinnerSelectionBlueprint(DrawableSpinner spinner) : base(spinner) { InternalChild = piece = new SpinnerPiece((Spinner)spinner.HitObject); diff --git a/osu.Game.Rulesets.Osu/Edit/OsuHitObjectComposer.cs b/osu.Game.Rulesets.Osu/Edit/OsuHitObjectComposer.cs index 005ccec151..1ed3578ab4 100644 --- a/osu.Game.Rulesets.Osu/Edit/OsuHitObjectComposer.cs +++ b/osu.Game.Rulesets.Osu/Edit/OsuHitObjectComposer.cs @@ -37,16 +37,16 @@ namespace osu.Game.Rulesets.Osu.Edit protected override Container CreateLayerContainer() => new PlayfieldAdjustmentContainer { RelativeSizeAxes = Axes.Both }; - public override SelectionMask CreateMaskFor(DrawableHitObject hitObject) + public override SelectionBlueprint CreateMaskFor(DrawableHitObject hitObject) { switch (hitObject) { case DrawableHitCircle circle: - return new HitCircleSelectionMask(circle); + return new HitCircleSelectionBlueprint(circle); case DrawableSlider slider: - return new SliderSelectionMask(slider); + return new SliderSelectionBlueprint(slider); case DrawableSpinner spinner: - return new SpinnerSelectionMask(spinner); + return new SpinnerSelectionBlueprint(spinner); } return base.CreateMaskFor(hitObject); diff --git a/osu.Game.Tests/Visual/TestCaseHitObjectComposer.cs b/osu.Game.Tests/Visual/TestCaseHitObjectComposer.cs index c51ede719a..ff82034648 100644 --- a/osu.Game.Tests/Visual/TestCaseHitObjectComposer.cs +++ b/osu.Game.Tests/Visual/TestCaseHitObjectComposer.cs @@ -35,7 +35,7 @@ namespace osu.Game.Tests.Visual typeof(BlueprintContainer), typeof(NotNullAttribute), typeof(HitCirclePiece), - typeof(HitCircleSelectionMask), + typeof(HitCircleSelectionBlueprint), typeof(HitCirclePlacementMask), }; diff --git a/osu.Game/Rulesets/Edit/HitObjectComposer.cs b/osu.Game/Rulesets/Edit/HitObjectComposer.cs index 82c8e26706..0608afdeca 100644 --- a/osu.Game/Rulesets/Edit/HitObjectComposer.cs +++ b/osu.Game/Rulesets/Edit/HitObjectComposer.cs @@ -148,27 +148,27 @@ namespace osu.Game.Rulesets.Edit /// The to add. public void Add(HitObject hitObject) { - blueprintContainer.AddMaskFor(rulesetContainer.Add(hitObject)); + blueprintContainer.AddBlueprintFor(rulesetContainer.Add(hitObject)); placementContainer.Refresh(); } - public void Remove(HitObject hitObject) => blueprintContainer.RemoveMaskFor(rulesetContainer.Remove(hitObject)); + public void Remove(HitObject hitObject) => blueprintContainer.RemoveBlueprintFor(rulesetContainer.Remove(hitObject)); internal abstract EditRulesetContainer CreateRulesetContainer(); protected abstract IReadOnlyList CompositionTools { get; } /// - /// Creates a for a specific . + /// Creates a for a specific . /// /// The to create the overlay for. - public virtual SelectionMask CreateMaskFor(DrawableHitObject hitObject) => null; + public virtual SelectionBlueprint CreateMaskFor(DrawableHitObject hitObject) => null; /// /// Creates a which outlines s /// and handles hitobject pattern adjustments. /// - public virtual SelectionBox CreateMaskSelection() => new SelectionBox(); + public virtual SelectionBox CreateSelectionBox() => new SelectionBox(); /// /// Creates a which provides a layer above or below the . diff --git a/osu.Game/Rulesets/Edit/SelectionMask.cs b/osu.Game/Rulesets/Edit/SelectionBlueprint.cs similarity index 78% rename from osu.Game/Rulesets/Edit/SelectionMask.cs rename to osu.Game/Rulesets/Edit/SelectionBlueprint.cs index 3b78d5aaf6..dc879b3a16 100644 --- a/osu.Game/Rulesets/Edit/SelectionMask.cs +++ b/osu.Game/Rulesets/Edit/SelectionBlueprint.cs @@ -17,31 +17,31 @@ namespace osu.Game.Rulesets.Edit /// /// A mask placed above a adding editing functionality. /// - public class SelectionMask : CompositeDrawable, IStateful + public class SelectionBlueprint : CompositeDrawable, IStateful { /// - /// Invoked when this has been selected. + /// Invoked when this has been selected. /// - public event Action Selected; + public event Action Selected; /// - /// Invoked when this has been deselected. + /// Invoked when this has been deselected. /// - public event Action Deselected; + public event Action Deselected; /// - /// Invoked when this has requested selection. + /// Invoked when this has requested selection. /// Will fire even if already selected. Does not actually perform selection. /// - public event Action SelectionRequested; + public event Action SelectionRequested; /// - /// Invoked when this has requested drag. + /// Invoked when this has requested drag. /// - public event Action DragRequested; + public event Action DragRequested; /// - /// The which this applies to. + /// The which this applies to. /// public readonly DrawableHitObject HitObject; @@ -49,7 +49,7 @@ namespace osu.Game.Rulesets.Edit public override bool HandlePositionalInput => ShouldBeAlive; public override bool RemoveWhenNotAlive => false; - public SelectionMask(DrawableHitObject hitObject) + public SelectionBlueprint(DrawableHitObject hitObject) { HitObject = hitObject; @@ -86,12 +86,12 @@ namespace osu.Game.Rulesets.Edit } /// - /// Selects this , causing it to become visible. + /// Selects this , causing it to become visible. /// public void Select() => State = SelectionState.Selected; /// - /// Deselects this , causing it to become invisible. + /// Deselects this , causing it to become invisible. /// public void Deselect() => State = SelectionState.NotSelected; @@ -135,12 +135,12 @@ namespace osu.Game.Rulesets.Edit } /// - /// The screen-space point that causes this to be selected. + /// The screen-space point that causes this to be selected. /// public virtual Vector2 SelectionPoint => HitObject.ScreenSpaceDrawQuad.Centre; /// - /// The screen-space quad that outlines this for selections. + /// The screen-space quad that outlines this for selections. /// public virtual Quad SelectionQuad => HitObject.ScreenSpaceDrawQuad; } diff --git a/osu.Game/Screens/Edit/Screens/Compose/Layers/BlueprintContainer.cs b/osu.Game/Screens/Edit/Screens/Compose/Layers/BlueprintContainer.cs index 9a17dc8007..3473e66c2b 100644 --- a/osu.Game/Screens/Edit/Screens/Compose/Layers/BlueprintContainer.cs +++ b/osu.Game/Screens/Edit/Screens/Compose/Layers/BlueprintContainer.cs @@ -20,7 +20,7 @@ namespace osu.Game.Screens.Edit.Screens.Compose.Layers private SelectionBlueprintContainer selectionBlueprints; private SelectionBox selectionBox; - private IEnumerable aliveMasks => selectionBlueprints.Children.Where(c => c.IsAlive); + private IEnumerable selections => selectionBlueprints.Children.Where(c => c.IsAlive); [Resolved] private HitObjectComposer composer { get; set; } @@ -33,7 +33,7 @@ namespace osu.Game.Screens.Edit.Screens.Compose.Layers [BackgroundDependencyLoader] private void load() { - selectionBox = composer.CreateMaskSelection(); + selectionBox = composer.CreateSelectionBox(); selectionBox.DeselectAll = deselectAll; var dragBox = new DragBox(select); @@ -48,7 +48,7 @@ namespace osu.Game.Screens.Edit.Screens.Compose.Layers }; foreach (var obj in composer.HitObjects) - AddMaskFor(obj); + AddBlueprintFor(obj); } protected override bool OnClick(ClickEvent e) @@ -61,14 +61,14 @@ namespace osu.Game.Screens.Edit.Screens.Compose.Layers /// Adds a mask for a which adds movement support. /// /// The to create a mask for. - public void AddMaskFor(DrawableHitObject hitObject) + public void AddBlueprintFor(DrawableHitObject hitObject) { var mask = composer.CreateMaskFor(hitObject); if (mask == null) return; - mask.Selected += onMaskSelected; - mask.Deselected += onMaskDeselected; + mask.Selected += onBlueprintSelected; + mask.Deselected += onBlueprintDeselected; mask.SelectionRequested += onSelectionRequested; mask.DragRequested += onDragRequested; @@ -79,7 +79,7 @@ namespace osu.Game.Screens.Edit.Screens.Compose.Layers /// Removes a mask for a . /// /// The for which to remove the mask. - public void RemoveMaskFor(DrawableHitObject hitObject) + public void RemoveBlueprintFor(DrawableHitObject hitObject) { var maskToRemove = selectionBlueprints.Single(m => m.HitObject == hitObject); if (maskToRemove == null) @@ -87,8 +87,8 @@ namespace osu.Game.Screens.Edit.Screens.Compose.Layers maskToRemove.Deselect(); - maskToRemove.Selected -= onMaskSelected; - maskToRemove.Deselected -= onMaskDeselected; + maskToRemove.Selected -= onBlueprintSelected; + maskToRemove.Deselected -= onBlueprintDeselected; maskToRemove.SelectionRequested -= onSelectionRequested; maskToRemove.DragRequested -= onDragRequested; @@ -101,7 +101,7 @@ namespace osu.Game.Screens.Edit.Screens.Compose.Layers /// The rectangle to perform a selection on in screen-space coordinates. private void select(RectangleF rect) { - foreach (var mask in aliveMasks.ToList()) + foreach (var mask in selections.ToList()) { if (mask.IsPresent && rect.Contains(mask.SelectionPoint)) mask.Select(); @@ -111,38 +111,38 @@ namespace osu.Game.Screens.Edit.Screens.Compose.Layers } /// - /// Deselects all selected s. + /// Deselects all selected s. /// - private void deselectAll() => aliveMasks.ToList().ForEach(m => m.Deselect()); + private void deselectAll() => selections.ToList().ForEach(m => m.Deselect()); - private void onMaskSelected(SelectionMask mask) + private void onBlueprintSelected(SelectionBlueprint blueprint) { - selectionBox.HandleSelected(mask); - selectionBlueprints.ChangeChildDepth(mask, 1); + selectionBox.HandleSelected(blueprint); + selectionBlueprints.ChangeChildDepth(blueprint, 1); } - private void onMaskDeselected(SelectionMask mask) + private void onBlueprintDeselected(SelectionBlueprint blueprint) { - selectionBox.HandleDeselected(mask); - selectionBlueprints.ChangeChildDepth(mask, 0); + selectionBox.HandleDeselected(blueprint); + selectionBlueprints.ChangeChildDepth(blueprint, 0); } - private void onSelectionRequested(SelectionMask mask, InputState state) => selectionBox.HandleSelectionRequested(mask, state); + private void onSelectionRequested(SelectionBlueprint blueprint, InputState state) => selectionBox.HandleSelectionRequested(blueprint, state); - private void onDragRequested(SelectionMask mask, Vector2 delta, InputState state) => selectionBox.HandleDrag(mask, delta, state); + private void onDragRequested(SelectionBlueprint blueprint, Vector2 delta, InputState state) => selectionBox.HandleDrag(blueprint, delta, state); - private class SelectionBlueprintContainer : Container + private class SelectionBlueprintContainer : Container { protected override int Compare(Drawable x, Drawable y) { - if (!(x is SelectionMask xMask) || !(y is SelectionMask yMask)) + if (!(x is SelectionBlueprint xBlueprint) || !(y is SelectionBlueprint yBlueprint)) return base.Compare(x, y); - return Compare(xMask, yMask); + return Compare(xBlueprint, yBlueprint); } - public int Compare(SelectionMask x, SelectionMask y) + public int Compare(SelectionBlueprint x, SelectionBlueprint y) { - // dpeth is used to denote selected status (we always want selected masks to handle input first). + // dpeth is used to denote selected status (we always want selected blueprints to handle input first). int d = x.Depth.CompareTo(y.Depth); if (d != 0) return d; diff --git a/osu.Game/Screens/Edit/Screens/Compose/Layers/SelectionBox.cs b/osu.Game/Screens/Edit/Screens/Compose/Layers/SelectionBox.cs index 267892f45d..6aef47d690 100644 --- a/osu.Game/Screens/Edit/Screens/Compose/Layers/SelectionBox.cs +++ b/osu.Game/Screens/Edit/Screens/Compose/Layers/SelectionBox.cs @@ -19,13 +19,13 @@ using OpenTK.Input; namespace osu.Game.Screens.Edit.Screens.Compose.Layers { /// - /// A box which surrounds s and provides interactive handles, context menus etc. + /// A box which surrounds s and provides interactive handles, context menus etc. /// public class SelectionBox : CompositeDrawable { public const float BORDER_RADIUS = 2; - private readonly List selectedMasks; + private readonly List selectedMasks; private Drawable outline; @@ -34,7 +34,7 @@ namespace osu.Game.Screens.Edit.Screens.Compose.Layers public SelectionBox() { - selectedMasks = new List(); + selectedMasks = new List(); RelativeSizeAxes = Axes.Both; AlwaysPresent = true; @@ -60,7 +60,7 @@ namespace osu.Game.Screens.Edit.Screens.Compose.Layers #region User Input Handling - public void HandleDrag(SelectionMask m, Vector2 delta, InputState state) + public void HandleDrag(SelectionBlueprint m, Vector2 delta, InputState state) { // Todo: Various forms of snapping @@ -103,16 +103,16 @@ namespace osu.Game.Screens.Edit.Screens.Compose.Layers /// /// Handle a mask becoming selected. /// - /// The mask. - public void HandleSelected(SelectionMask mask) => selectedMasks.Add(mask); + /// The mask. + public void HandleSelected(SelectionBlueprint blueprint) => selectedMasks.Add(blueprint); /// /// Handle a mask becoming deselected. /// - /// The mask. - public void HandleDeselected(SelectionMask mask) + /// The mask. + public void HandleDeselected(SelectionBlueprint blueprint) { - selectedMasks.Remove(mask); + selectedMasks.Remove(blueprint); // We don't want to update visibility if > 0, since we may be deselecting masks during drag-selection if (selectedMasks.Count == 0) @@ -122,23 +122,23 @@ namespace osu.Game.Screens.Edit.Screens.Compose.Layers /// /// Handle a mask requesting selection. /// - /// The mask. - public void HandleSelectionRequested(SelectionMask mask, InputState state) + /// The mask. + public void HandleSelectionRequested(SelectionBlueprint blueprint, InputState state) { if (state.Keyboard.ControlPressed) { - if (mask.IsSelected) - mask.Deselect(); + if (blueprint.IsSelected) + blueprint.Deselect(); else - mask.Select(); + blueprint.Select(); } else { - if (mask.IsSelected) + if (blueprint.IsSelected) return; DeselectAll?.Invoke(); - mask.Select(); + blueprint.Select(); } UpdateVisibility(); diff --git a/osu.Game/Tests/Visual/HitObjectSelectionMaskTestCase.cs b/osu.Game/Tests/Visual/HitObjectSelectionMaskTestCase.cs index 3ba6841280..707ebaa96b 100644 --- a/osu.Game/Tests/Visual/HitObjectSelectionMaskTestCase.cs +++ b/osu.Game/Tests/Visual/HitObjectSelectionMaskTestCase.cs @@ -12,7 +12,7 @@ namespace osu.Game.Tests.Visual { public abstract class HitObjectSelectionMaskTestCase : OsuTestCase { - private SelectionMask mask; + private SelectionBlueprint blueprint; protected override Container Content => content ?? base.Content; private readonly Container content; @@ -29,19 +29,19 @@ namespace osu.Game.Tests.Visual [BackgroundDependencyLoader] private void load() { - base.Content.Add(mask = CreateMask()); - mask.SelectionRequested += (_, __) => mask.Select(); + base.Content.Add(blueprint = CreateMask()); + blueprint.SelectionRequested += (_, __) => blueprint.Select(); - AddStep("Select", () => mask.Select()); - AddStep("Deselect", () => mask.Deselect()); + AddStep("Select", () => blueprint.Select()); + AddStep("Deselect", () => blueprint.Deselect()); } protected override bool OnClick(ClickEvent e) { - mask.Deselect(); + blueprint.Deselect(); return true; } - protected abstract SelectionMask CreateMask(); + protected abstract SelectionBlueprint CreateMask(); } } From 90c813618a84851627c432a0f62a6c208edcb712 Mon Sep 17 00:00:00 2001 From: smoogipoo Date: Tue, 6 Nov 2018 18:02:55 +0900 Subject: [PATCH 403/417] Merge PlacementContainer into BlueprintContainer --- osu.Game/Rulesets/Edit/HitObjectComposer.cs | 17 +-- .../Compose/Layers/BlueprintContainer.cs | 106 ++++++++++++------ .../Compose/Layers/PlacementContainer.cs | 50 --------- 3 files changed, 75 insertions(+), 98 deletions(-) delete mode 100644 osu.Game/Screens/Edit/Screens/Compose/Layers/PlacementContainer.cs diff --git a/osu.Game/Rulesets/Edit/HitObjectComposer.cs b/osu.Game/Rulesets/Edit/HitObjectComposer.cs index 0608afdeca..7072e31e16 100644 --- a/osu.Game/Rulesets/Edit/HitObjectComposer.cs +++ b/osu.Game/Rulesets/Edit/HitObjectComposer.cs @@ -36,7 +36,6 @@ namespace osu.Game.Rulesets.Edit private EditRulesetContainer rulesetContainer; private BlueprintContainer blueprintContainer; - private PlacementContainer placementContainer; internal HitObjectComposer(Ruleset ruleset) { @@ -65,11 +64,7 @@ namespace osu.Game.Rulesets.Edit layerBelowRuleset.Child = new BorderLayer { RelativeSizeAxes = Axes.Both }; var layerAboveRuleset = CreateLayerContainer(); - layerAboveRuleset.Children = new Drawable[] - { - blueprintContainer = new BlueprintContainer(), - placementContainer = new PlacementContainer(), - }; + layerAboveRuleset.Child = new BlueprintContainer(); layerContainers.Add(layerBelowRuleset); layerContainers.Add(layerAboveRuleset); @@ -112,8 +107,8 @@ namespace osu.Game.Rulesets.Edit }; toolboxCollection.Items = - CompositionTools.Select(t => new RadioButton(t.Name, () => placementContainer.CurrentTool = t)) - .Prepend(new RadioButton("Select", () => placementContainer.CurrentTool = null)) + CompositionTools.Select(t => new RadioButton(t.Name, () => blueprintContainer.CurrentTool = t)) + .Prepend(new RadioButton("Select", () => blueprintContainer.CurrentTool = null)) .ToList(); toolboxCollection.Items[0].Select(); @@ -146,11 +141,7 @@ namespace osu.Game.Rulesets.Edit /// Adds a to the and visualises it. /// /// The to add. - public void Add(HitObject hitObject) - { - blueprintContainer.AddBlueprintFor(rulesetContainer.Add(hitObject)); - placementContainer.Refresh(); - } + public void Add(HitObject hitObject) => blueprintContainer.AddBlueprintFor(rulesetContainer.Add(hitObject)); public void Remove(HitObject hitObject) => blueprintContainer.RemoveBlueprintFor(rulesetContainer.Remove(hitObject)); diff --git a/osu.Game/Screens/Edit/Screens/Compose/Layers/BlueprintContainer.cs b/osu.Game/Screens/Edit/Screens/Compose/Layers/BlueprintContainer.cs index 3473e66c2b..5c7d840f3d 100644 --- a/osu.Game/Screens/Edit/Screens/Compose/Layers/BlueprintContainer.cs +++ b/osu.Game/Screens/Edit/Screens/Compose/Layers/BlueprintContainer.cs @@ -10,6 +10,7 @@ using osu.Framework.Graphics.Primitives; using osu.Framework.Input.Events; using osu.Framework.Input.States; using osu.Game.Rulesets.Edit; +using osu.Game.Rulesets.Edit.Tools; using osu.Game.Rulesets.Objects.Drawables; using OpenTK; @@ -18,6 +19,7 @@ namespace osu.Game.Screens.Edit.Screens.Compose.Layers public class BlueprintContainer : CompositeDrawable { private SelectionBlueprintContainer selectionBlueprints; + private Container placementBlueprintContainer; private SelectionBox selectionBox; private IEnumerable selections => selectionBlueprints.Children.Where(c => c.IsAlive); @@ -44,6 +46,7 @@ namespace osu.Game.Screens.Edit.Screens.Compose.Layers dragBox, selectionBox, selectionBlueprints = new SelectionBlueprintContainer { RelativeSizeAxes = Axes.Both }, + placementBlueprintContainer = new Container { RelativeSizeAxes = Axes.Both }, dragBox.CreateProxy() }; @@ -51,6 +54,64 @@ namespace osu.Game.Screens.Edit.Screens.Compose.Layers AddBlueprintFor(obj); } + private HitObjectCompositionTool currentTool; + + /// + /// The current placement tool. + /// + public HitObjectCompositionTool CurrentTool + { + get => currentTool; + set + { + if (currentTool == value) + return; + currentTool = value; + + refreshTool(); + } + } + + /// + /// Adds a blueprint for a which adds movement support. + /// + /// The to create a blueprint for. + public void AddBlueprintFor(DrawableHitObject hitObject) + { + refreshTool(); + + var blueprint = composer.CreateMaskFor(hitObject); + if (blueprint == null) + return; + + blueprint.Selected += onBlueprintSelected; + blueprint.Deselected += onBlueprintDeselected; + blueprint.SelectionRequested += onSelectionRequested; + blueprint.DragRequested += onDragRequested; + + selectionBlueprints.Add(blueprint); + } + + /// + /// Removes a blueprint for a . + /// + /// The for which to remove the blueprint. + public void RemoveBlueprintFor(DrawableHitObject hitObject) + { + var blueprint = selectionBlueprints.Single(m => m.HitObject == hitObject); + if (blueprint == null) + return; + + blueprint.Deselect(); + + blueprint.Selected -= onBlueprintSelected; + blueprint.Deselected -= onBlueprintDeselected; + blueprint.SelectionRequested -= onSelectionRequested; + blueprint.DragRequested -= onDragRequested; + + selectionBlueprints.Remove(blueprint); + } + protected override bool OnClick(ClickEvent e) { deselectAll(); @@ -58,42 +119,17 @@ namespace osu.Game.Screens.Edit.Screens.Compose.Layers } /// - /// Adds a mask for a which adds movement support. + /// Refreshes the current placement tool. /// - /// The to create a mask for. - public void AddBlueprintFor(DrawableHitObject hitObject) + private void refreshTool() { - var mask = composer.CreateMaskFor(hitObject); - if (mask == null) - return; + placementBlueprintContainer.Clear(); - mask.Selected += onBlueprintSelected; - mask.Deselected += onBlueprintDeselected; - mask.SelectionRequested += onSelectionRequested; - mask.DragRequested += onDragRequested; - - selectionBlueprints.Add(mask); + var blueprint = CurrentTool?.CreatePlacementMask(); + if (blueprint != null) + placementBlueprintContainer.Child = blueprint; } - /// - /// Removes a mask for a . - /// - /// The for which to remove the mask. - public void RemoveBlueprintFor(DrawableHitObject hitObject) - { - var maskToRemove = selectionBlueprints.Single(m => m.HitObject == hitObject); - if (maskToRemove == null) - return; - - maskToRemove.Deselect(); - - maskToRemove.Selected -= onBlueprintSelected; - maskToRemove.Deselected -= onBlueprintDeselected; - maskToRemove.SelectionRequested -= onSelectionRequested; - maskToRemove.DragRequested -= onDragRequested; - - selectionBlueprints.Remove(maskToRemove); - } /// /// Select all masks in a given rectangle selection area. @@ -101,12 +137,12 @@ namespace osu.Game.Screens.Edit.Screens.Compose.Layers /// The rectangle to perform a selection on in screen-space coordinates. private void select(RectangleF rect) { - foreach (var mask in selections.ToList()) + foreach (var blueprint in selections.ToList()) { - if (mask.IsPresent && rect.Contains(mask.SelectionPoint)) - mask.Select(); + if (blueprint.IsPresent && rect.Contains(blueprint.SelectionPoint)) + blueprint.Select(); else - mask.Deselect(); + blueprint.Deselect(); } } diff --git a/osu.Game/Screens/Edit/Screens/Compose/Layers/PlacementContainer.cs b/osu.Game/Screens/Edit/Screens/Compose/Layers/PlacementContainer.cs deleted file mode 100644 index ea167a5c6b..0000000000 --- a/osu.Game/Screens/Edit/Screens/Compose/Layers/PlacementContainer.cs +++ /dev/null @@ -1,50 +0,0 @@ -// Copyright (c) 2007-2018 ppy Pty Ltd . -// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE - -using osu.Framework.Graphics; -using osu.Framework.Graphics.Containers; -using osu.Game.Rulesets.Edit.Tools; -using Container = System.ComponentModel.Container; - -namespace osu.Game.Screens.Edit.Screens.Compose.Layers -{ - public class PlacementContainer : CompositeDrawable - { - private readonly Container maskContainer; - - public PlacementContainer() - { - RelativeSizeAxes = Axes.Both; - } - - private HitObjectCompositionTool currentTool; - - /// - /// The current placement tool. - /// - public HitObjectCompositionTool CurrentTool - { - get => currentTool; - set - { - if (currentTool == value) - return; - currentTool = value; - - Refresh(); - } - } - - /// - /// Refreshes the current placement tool. - /// - public void Refresh() - { - ClearInternal(); - - var mask = CurrentTool?.CreatePlacementMask(); - if (mask != null) - InternalChild = mask; - } - } -} From 11be820efe67fd36e62cbbee76d7eb9441b1c8cf Mon Sep 17 00:00:00 2001 From: smoogipoo Date: Tue, 6 Nov 2018 18:03:21 +0900 Subject: [PATCH 404/417] CreateMaskFor -> CreateBlueprintFor --- osu.Game.Rulesets.Mania/Edit/ManiaHitObjectComposer.cs | 4 ++-- osu.Game.Rulesets.Osu/Edit/OsuHitObjectComposer.cs | 4 ++-- osu.Game/Rulesets/Edit/HitObjectComposer.cs | 2 +- .../Screens/Edit/Screens/Compose/Layers/BlueprintContainer.cs | 2 +- 4 files changed, 6 insertions(+), 6 deletions(-) diff --git a/osu.Game.Rulesets.Mania/Edit/ManiaHitObjectComposer.cs b/osu.Game.Rulesets.Mania/Edit/ManiaHitObjectComposer.cs index 76969ab2bf..7420a3c64c 100644 --- a/osu.Game.Rulesets.Mania/Edit/ManiaHitObjectComposer.cs +++ b/osu.Game.Rulesets.Mania/Edit/ManiaHitObjectComposer.cs @@ -38,7 +38,7 @@ namespace osu.Game.Rulesets.Mania.Edit protected override IReadOnlyList CompositionTools => Array.Empty(); - public override SelectionBlueprint CreateMaskFor(DrawableHitObject hitObject) + public override SelectionBlueprint CreateBlueprintFor(DrawableHitObject hitObject) { switch (hitObject) { @@ -48,7 +48,7 @@ namespace osu.Game.Rulesets.Mania.Edit return new HoldNoteSelectionBlueprint(holdNote); } - return base.CreateMaskFor(hitObject); + return base.CreateBlueprintFor(hitObject); } } } diff --git a/osu.Game.Rulesets.Osu/Edit/OsuHitObjectComposer.cs b/osu.Game.Rulesets.Osu/Edit/OsuHitObjectComposer.cs index 1ed3578ab4..1d806aba90 100644 --- a/osu.Game.Rulesets.Osu/Edit/OsuHitObjectComposer.cs +++ b/osu.Game.Rulesets.Osu/Edit/OsuHitObjectComposer.cs @@ -37,7 +37,7 @@ namespace osu.Game.Rulesets.Osu.Edit protected override Container CreateLayerContainer() => new PlayfieldAdjustmentContainer { RelativeSizeAxes = Axes.Both }; - public override SelectionBlueprint CreateMaskFor(DrawableHitObject hitObject) + public override SelectionBlueprint CreateBlueprintFor(DrawableHitObject hitObject) { switch (hitObject) { @@ -49,7 +49,7 @@ namespace osu.Game.Rulesets.Osu.Edit return new SpinnerSelectionBlueprint(spinner); } - return base.CreateMaskFor(hitObject); + return base.CreateBlueprintFor(hitObject); } } } diff --git a/osu.Game/Rulesets/Edit/HitObjectComposer.cs b/osu.Game/Rulesets/Edit/HitObjectComposer.cs index 7072e31e16..f1b1948b5e 100644 --- a/osu.Game/Rulesets/Edit/HitObjectComposer.cs +++ b/osu.Game/Rulesets/Edit/HitObjectComposer.cs @@ -153,7 +153,7 @@ namespace osu.Game.Rulesets.Edit /// Creates a for a specific . /// /// The to create the overlay for. - public virtual SelectionBlueprint CreateMaskFor(DrawableHitObject hitObject) => null; + public virtual SelectionBlueprint CreateBlueprintFor(DrawableHitObject hitObject) => null; /// /// Creates a which outlines s diff --git a/osu.Game/Screens/Edit/Screens/Compose/Layers/BlueprintContainer.cs b/osu.Game/Screens/Edit/Screens/Compose/Layers/BlueprintContainer.cs index 5c7d840f3d..730dedb53f 100644 --- a/osu.Game/Screens/Edit/Screens/Compose/Layers/BlueprintContainer.cs +++ b/osu.Game/Screens/Edit/Screens/Compose/Layers/BlueprintContainer.cs @@ -80,7 +80,7 @@ namespace osu.Game.Screens.Edit.Screens.Compose.Layers { refreshTool(); - var blueprint = composer.CreateMaskFor(hitObject); + var blueprint = composer.CreateBlueprintFor(hitObject); if (blueprint == null) return; From bd775af274224e708e9de31db080d128c8dcd829 Mon Sep 17 00:00:00 2001 From: smoogipoo Date: Tue, 6 Nov 2018 18:04:03 +0900 Subject: [PATCH 405/417] PlacementMask -> PlacementBlueprint --- .../TestCaseHitCirclePlacementMask.cs | 2 +- .../TestCaseSliderPlacementMask.cs | 2 +- .../TestCaseSpinnerPlacementMask.cs | 2 +- osu.Game.Rulesets.Osu/Edit/HitCircleCompositionTool.cs | 2 +- ...PlacementMask.cs => HitCirclePlacementBlueprint.cs} | 4 ++-- ...derPlacementMask.cs => SliderPlacementBlueprint.cs} | 4 ++-- ...erPlacementMask.cs => SpinnerPlacementBlueprint.cs} | 4 ++-- osu.Game.Rulesets.Osu/Edit/SliderCompositionTool.cs | 2 +- osu.Game.Rulesets.Osu/Edit/SpinnerCompositionTool.cs | 2 +- osu.Game.Tests/Visual/TestCaseHitObjectComposer.cs | 2 +- .../Edit/{PlacementMask.cs => PlacementBlueprint.cs} | 6 +++--- .../Rulesets/Edit/Tools/HitObjectCompositionTool.cs | 2 +- .../Edit/Screens/Compose/Layers/BlueprintContainer.cs | 4 ++-- .../Tests/Visual/HitObjectPlacementMaskTestCase.cs | 10 +++++----- 14 files changed, 24 insertions(+), 24 deletions(-) rename osu.Game.Rulesets.Osu/Edit/Masks/HitCircleMasks/{HitCirclePlacementMask.cs => HitCirclePlacementBlueprint.cs} (91%) rename osu.Game.Rulesets.Osu/Edit/Masks/SliderMasks/{SliderPlacementMask.cs => SliderPlacementBlueprint.cs} (98%) rename osu.Game.Rulesets.Osu/Edit/Masks/SpinnerMasks/{SpinnerPlacementMask.cs => SpinnerPlacementBlueprint.cs} (91%) rename osu.Game/Rulesets/Edit/{PlacementMask.cs => PlacementBlueprint.cs} (90%) diff --git a/osu.Game.Rulesets.Osu.Tests/TestCaseHitCirclePlacementMask.cs b/osu.Game.Rulesets.Osu.Tests/TestCaseHitCirclePlacementMask.cs index be0b94c4c8..8e41a28440 100644 --- a/osu.Game.Rulesets.Osu.Tests/TestCaseHitCirclePlacementMask.cs +++ b/osu.Game.Rulesets.Osu.Tests/TestCaseHitCirclePlacementMask.cs @@ -14,6 +14,6 @@ namespace osu.Game.Rulesets.Osu.Tests public class TestCaseHitCirclePlacementMask : HitObjectPlacementMaskTestCase { protected override DrawableHitObject CreateHitObject(HitObject hitObject) => new DrawableHitCircle((HitCircle)hitObject); - protected override PlacementMask CreateMask() => new HitCirclePlacementMask(); + protected override PlacementBlueprint CreateMask() => new HitCirclePlacementBlueprint(); } } diff --git a/osu.Game.Rulesets.Osu.Tests/TestCaseSliderPlacementMask.cs b/osu.Game.Rulesets.Osu.Tests/TestCaseSliderPlacementMask.cs index 889ea0c311..5dd7a99aad 100644 --- a/osu.Game.Rulesets.Osu.Tests/TestCaseSliderPlacementMask.cs +++ b/osu.Game.Rulesets.Osu.Tests/TestCaseSliderPlacementMask.cs @@ -14,6 +14,6 @@ namespace osu.Game.Rulesets.Osu.Tests public class TestCaseSliderPlacementMask : HitObjectPlacementMaskTestCase { protected override DrawableHitObject CreateHitObject(HitObject hitObject) => new DrawableSlider((Slider)hitObject); - protected override PlacementMask CreateMask() => new SliderPlacementMask(); + protected override PlacementBlueprint CreateMask() => new SliderPlacementBlueprint(); } } diff --git a/osu.Game.Rulesets.Osu.Tests/TestCaseSpinnerPlacementMask.cs b/osu.Game.Rulesets.Osu.Tests/TestCaseSpinnerPlacementMask.cs index c2c7942c57..1ca203e474 100644 --- a/osu.Game.Rulesets.Osu.Tests/TestCaseSpinnerPlacementMask.cs +++ b/osu.Game.Rulesets.Osu.Tests/TestCaseSpinnerPlacementMask.cs @@ -15,6 +15,6 @@ namespace osu.Game.Rulesets.Osu.Tests { protected override DrawableHitObject CreateHitObject(HitObject hitObject) => new DrawableSpinner((Spinner)hitObject); - protected override PlacementMask CreateMask() => new SpinnerPlacementMask(); + protected override PlacementBlueprint CreateMask() => new SpinnerPlacementBlueprint(); } } diff --git a/osu.Game.Rulesets.Osu/Edit/HitCircleCompositionTool.cs b/osu.Game.Rulesets.Osu/Edit/HitCircleCompositionTool.cs index 767c7db5da..d7a4c7a6b7 100644 --- a/osu.Game.Rulesets.Osu/Edit/HitCircleCompositionTool.cs +++ b/osu.Game.Rulesets.Osu/Edit/HitCircleCompositionTool.cs @@ -15,6 +15,6 @@ namespace osu.Game.Rulesets.Osu.Edit { } - public override PlacementMask CreatePlacementMask() => new HitCirclePlacementMask(); + public override PlacementBlueprint CreatePlacementMask() => new HitCirclePlacementBlueprint(); } } diff --git a/osu.Game.Rulesets.Osu/Edit/Masks/HitCircleMasks/HitCirclePlacementMask.cs b/osu.Game.Rulesets.Osu/Edit/Masks/HitCircleMasks/HitCirclePlacementBlueprint.cs similarity index 91% rename from osu.Game.Rulesets.Osu/Edit/Masks/HitCircleMasks/HitCirclePlacementMask.cs rename to osu.Game.Rulesets.Osu/Edit/Masks/HitCircleMasks/HitCirclePlacementBlueprint.cs index 0d0acbed7d..ec32b7d74d 100644 --- a/osu.Game.Rulesets.Osu/Edit/Masks/HitCircleMasks/HitCirclePlacementMask.cs +++ b/osu.Game.Rulesets.Osu/Edit/Masks/HitCircleMasks/HitCirclePlacementBlueprint.cs @@ -8,11 +8,11 @@ using osu.Game.Rulesets.Osu.Objects; namespace osu.Game.Rulesets.Osu.Edit.Masks.HitCircleMasks { - public class HitCirclePlacementMask : PlacementMask + public class HitCirclePlacementBlueprint : PlacementBlueprint { public new HitCircle HitObject => (HitCircle)base.HitObject; - public HitCirclePlacementMask() + public HitCirclePlacementBlueprint() : base(new HitCircle()) { InternalChild = new HitCirclePiece(HitObject); diff --git a/osu.Game.Rulesets.Osu/Edit/Masks/SliderMasks/SliderPlacementMask.cs b/osu.Game.Rulesets.Osu/Edit/Masks/SliderMasks/SliderPlacementBlueprint.cs similarity index 98% rename from osu.Game.Rulesets.Osu/Edit/Masks/SliderMasks/SliderPlacementMask.cs rename to osu.Game.Rulesets.Osu/Edit/Masks/SliderMasks/SliderPlacementBlueprint.cs index 12e768d58e..bf2acc2f3c 100644 --- a/osu.Game.Rulesets.Osu/Edit/Masks/SliderMasks/SliderPlacementMask.cs +++ b/osu.Game.Rulesets.Osu/Edit/Masks/SliderMasks/SliderPlacementBlueprint.cs @@ -18,7 +18,7 @@ using OpenTK.Input; namespace osu.Game.Rulesets.Osu.Edit.Masks.SliderMasks { - public class SliderPlacementMask : PlacementMask + public class SliderPlacementBlueprint : PlacementBlueprint { public new Objects.Slider HitObject => (Objects.Slider)base.HitObject; @@ -27,7 +27,7 @@ namespace osu.Game.Rulesets.Osu.Edit.Masks.SliderMasks private PlacementState state; - public SliderPlacementMask() + public SliderPlacementBlueprint() : base(new Objects.Slider()) { RelativeSizeAxes = Axes.Both; diff --git a/osu.Game.Rulesets.Osu/Edit/Masks/SpinnerMasks/SpinnerPlacementMask.cs b/osu.Game.Rulesets.Osu/Edit/Masks/SpinnerMasks/SpinnerPlacementBlueprint.cs similarity index 91% rename from osu.Game.Rulesets.Osu/Edit/Masks/SpinnerMasks/SpinnerPlacementMask.cs rename to osu.Game.Rulesets.Osu/Edit/Masks/SpinnerMasks/SpinnerPlacementBlueprint.cs index cd5d6cff04..ca7a2f7b01 100644 --- a/osu.Game.Rulesets.Osu/Edit/Masks/SpinnerMasks/SpinnerPlacementMask.cs +++ b/osu.Game.Rulesets.Osu/Edit/Masks/SpinnerMasks/SpinnerPlacementBlueprint.cs @@ -10,7 +10,7 @@ using osu.Game.Rulesets.Osu.UI; namespace osu.Game.Rulesets.Osu.Edit.Masks.SpinnerMasks { - public class SpinnerPlacementMask : PlacementMask + public class SpinnerPlacementBlueprint : PlacementBlueprint { public new Spinner HitObject => (Spinner)base.HitObject; @@ -18,7 +18,7 @@ namespace osu.Game.Rulesets.Osu.Edit.Masks.SpinnerMasks private bool isPlacingEnd; - public SpinnerPlacementMask() + public SpinnerPlacementBlueprint() : base(new Spinner { Position = OsuPlayfield.BASE_SIZE / 2 }) { InternalChild = piece = new SpinnerPiece(HitObject) { Alpha = 0.5f }; diff --git a/osu.Game.Rulesets.Osu/Edit/SliderCompositionTool.cs b/osu.Game.Rulesets.Osu/Edit/SliderCompositionTool.cs index fd0430ce4c..050c538329 100644 --- a/osu.Game.Rulesets.Osu/Edit/SliderCompositionTool.cs +++ b/osu.Game.Rulesets.Osu/Edit/SliderCompositionTool.cs @@ -15,6 +15,6 @@ namespace osu.Game.Rulesets.Osu.Edit { } - public override PlacementMask CreatePlacementMask() => new SliderPlacementMask(); + public override PlacementBlueprint CreatePlacementMask() => new SliderPlacementBlueprint(); } } diff --git a/osu.Game.Rulesets.Osu/Edit/SpinnerCompositionTool.cs b/osu.Game.Rulesets.Osu/Edit/SpinnerCompositionTool.cs index a1419fe281..4401496327 100644 --- a/osu.Game.Rulesets.Osu/Edit/SpinnerCompositionTool.cs +++ b/osu.Game.Rulesets.Osu/Edit/SpinnerCompositionTool.cs @@ -15,6 +15,6 @@ namespace osu.Game.Rulesets.Osu.Edit { } - public override PlacementMask CreatePlacementMask() => new SpinnerPlacementMask(); + public override PlacementBlueprint CreatePlacementMask() => new SpinnerPlacementBlueprint(); } } diff --git a/osu.Game.Tests/Visual/TestCaseHitObjectComposer.cs b/osu.Game.Tests/Visual/TestCaseHitObjectComposer.cs index ff82034648..0e337acd2f 100644 --- a/osu.Game.Tests/Visual/TestCaseHitObjectComposer.cs +++ b/osu.Game.Tests/Visual/TestCaseHitObjectComposer.cs @@ -36,7 +36,7 @@ namespace osu.Game.Tests.Visual typeof(NotNullAttribute), typeof(HitCirclePiece), typeof(HitCircleSelectionBlueprint), - typeof(HitCirclePlacementMask), + typeof(HitCirclePlacementBlueprint), }; private HitObjectComposer composer; diff --git a/osu.Game/Rulesets/Edit/PlacementMask.cs b/osu.Game/Rulesets/Edit/PlacementBlueprint.cs similarity index 90% rename from osu.Game/Rulesets/Edit/PlacementMask.cs rename to osu.Game/Rulesets/Edit/PlacementBlueprint.cs index 97c6a74c92..7e5a592a0d 100644 --- a/osu.Game/Rulesets/Edit/PlacementMask.cs +++ b/osu.Game/Rulesets/Edit/PlacementBlueprint.cs @@ -18,7 +18,7 @@ namespace osu.Game.Rulesets.Edit /// /// A mask which governs the creation of a new to actualisation. /// - public abstract class PlacementMask : CompositeDrawable, IRequireHighFrequencyMousePosition + public abstract class PlacementBlueprint : CompositeDrawable, IRequireHighFrequencyMousePosition { /// /// The that is being placed. @@ -32,7 +32,7 @@ namespace osu.Game.Rulesets.Edit [Resolved] private IPlacementHandler placementHandler { get; set; } - protected PlacementMask(HitObject hitObject) + protected PlacementBlueprint(HitObject hitObject) { HitObject = hitObject; @@ -62,7 +62,7 @@ namespace osu.Game.Rulesets.Edit /// /// Signals that the placement of has finished. - /// This will destroy this , and add the to the . + /// This will destroy this , and add the to the . /// protected void EndPlacement() { diff --git a/osu.Game/Rulesets/Edit/Tools/HitObjectCompositionTool.cs b/osu.Game/Rulesets/Edit/Tools/HitObjectCompositionTool.cs index c5d64e3d4d..1a20f165c0 100644 --- a/osu.Game/Rulesets/Edit/Tools/HitObjectCompositionTool.cs +++ b/osu.Game/Rulesets/Edit/Tools/HitObjectCompositionTool.cs @@ -12,6 +12,6 @@ namespace osu.Game.Rulesets.Edit.Tools Name = name; } - public abstract PlacementMask CreatePlacementMask(); + public abstract PlacementBlueprint CreatePlacementMask(); } } diff --git a/osu.Game/Screens/Edit/Screens/Compose/Layers/BlueprintContainer.cs b/osu.Game/Screens/Edit/Screens/Compose/Layers/BlueprintContainer.cs index 730dedb53f..f781da0c60 100644 --- a/osu.Game/Screens/Edit/Screens/Compose/Layers/BlueprintContainer.cs +++ b/osu.Game/Screens/Edit/Screens/Compose/Layers/BlueprintContainer.cs @@ -19,7 +19,7 @@ namespace osu.Game.Screens.Edit.Screens.Compose.Layers public class BlueprintContainer : CompositeDrawable { private SelectionBlueprintContainer selectionBlueprints; - private Container placementBlueprintContainer; + private Container placementBlueprintContainer; private SelectionBox selectionBox; private IEnumerable selections => selectionBlueprints.Children.Where(c => c.IsAlive); @@ -46,7 +46,7 @@ namespace osu.Game.Screens.Edit.Screens.Compose.Layers dragBox, selectionBox, selectionBlueprints = new SelectionBlueprintContainer { RelativeSizeAxes = Axes.Both }, - placementBlueprintContainer = new Container { RelativeSizeAxes = Axes.Both }, + placementBlueprintContainer = new Container { RelativeSizeAxes = Axes.Both }, dragBox.CreateProxy() }; diff --git a/osu.Game/Tests/Visual/HitObjectPlacementMaskTestCase.cs b/osu.Game/Tests/Visual/HitObjectPlacementMaskTestCase.cs index adf74b9a7d..e33d92da88 100644 --- a/osu.Game/Tests/Visual/HitObjectPlacementMaskTestCase.cs +++ b/osu.Game/Tests/Visual/HitObjectPlacementMaskTestCase.cs @@ -16,7 +16,7 @@ namespace osu.Game.Tests.Visual public abstract class HitObjectPlacementMaskTestCase : OsuTestCase, IPlacementHandler { private readonly Container hitObjectContainer; - private PlacementMask currentMask; + private PlacementBlueprint currentBlueprint; protected HitObjectPlacementMaskTestCase() { @@ -32,7 +32,7 @@ namespace osu.Game.Tests.Visual [BackgroundDependencyLoader] private void load() { - Add(currentMask = CreateMask()); + Add(currentBlueprint = CreateMask()); } protected override IReadOnlyDependencyContainer CreateChildDependencies(IReadOnlyDependencyContainer parent) @@ -51,8 +51,8 @@ namespace osu.Game.Tests.Visual { hitObjectContainer.Add(CreateHitObject(hitObject)); - Remove(currentMask); - Add(currentMask = CreateMask()); + Remove(currentBlueprint); + Add(currentBlueprint = CreateMask()); } public void Delete(HitObject hitObject) @@ -60,6 +60,6 @@ namespace osu.Game.Tests.Visual } protected abstract DrawableHitObject CreateHitObject(HitObject hitObject); - protected abstract PlacementMask CreateMask(); + protected abstract PlacementBlueprint CreateMask(); } } From b3fa7c111b631ee21952ba9a1e00c6a95be0247b Mon Sep 17 00:00:00 2001 From: smoogipoo Date: Tue, 6 Nov 2018 18:06:13 +0900 Subject: [PATCH 406/417] Rename testcases --- ...lacementMask.cs => TestCaseHitCirclePlacementBlueprint.cs} | 2 +- ...electionMask.cs => TestCaseHitCircleSelectionBlueprint.cs} | 4 ++-- ...erPlacementMask.cs => TestCaseSliderPlacementBlueprint.cs} | 2 +- ...erSelectionMask.cs => TestCaseSliderSelectionBlueprint.cs} | 4 ++-- ...rPlacementMask.cs => TestCaseSpinnerPlacementBlueprint.cs} | 2 +- ...rSelectionMask.cs => TestCaseSpinnerSelectionBlueprint.cs} | 4 ++-- ...PlacementMaskTestCase.cs => PlacementBlueprintTestCase.cs} | 4 ++-- ...SelectionMaskTestCase.cs => SelectionBlueprintTestCase.cs} | 4 ++-- 8 files changed, 13 insertions(+), 13 deletions(-) rename osu.Game.Rulesets.Osu.Tests/{TestCaseHitCirclePlacementMask.cs => TestCaseHitCirclePlacementBlueprint.cs} (89%) rename osu.Game.Rulesets.Osu.Tests/{TestCaseHitCircleSelectionMask.cs => TestCaseHitCircleSelectionBlueprint.cs} (87%) rename osu.Game.Rulesets.Osu.Tests/{TestCaseSliderPlacementMask.cs => TestCaseSliderPlacementBlueprint.cs} (89%) rename osu.Game.Rulesets.Osu.Tests/{TestCaseSliderSelectionMask.cs => TestCaseSliderSelectionBlueprint.cs} (92%) rename osu.Game.Rulesets.Osu.Tests/{TestCaseSpinnerPlacementMask.cs => TestCaseSpinnerPlacementBlueprint.cs} (89%) rename osu.Game.Rulesets.Osu.Tests/{TestCaseSpinnerSelectionMask.cs => TestCaseSpinnerSelectionBlueprint.cs} (92%) rename osu.Game/Tests/Visual/{HitObjectPlacementMaskTestCase.cs => PlacementBlueprintTestCase.cs} (93%) rename osu.Game/Tests/Visual/{HitObjectSelectionMaskTestCase.cs => SelectionBlueprintTestCase.cs} (91%) diff --git a/osu.Game.Rulesets.Osu.Tests/TestCaseHitCirclePlacementMask.cs b/osu.Game.Rulesets.Osu.Tests/TestCaseHitCirclePlacementBlueprint.cs similarity index 89% rename from osu.Game.Rulesets.Osu.Tests/TestCaseHitCirclePlacementMask.cs rename to osu.Game.Rulesets.Osu.Tests/TestCaseHitCirclePlacementBlueprint.cs index 8e41a28440..3aaccb3c45 100644 --- a/osu.Game.Rulesets.Osu.Tests/TestCaseHitCirclePlacementMask.cs +++ b/osu.Game.Rulesets.Osu.Tests/TestCaseHitCirclePlacementBlueprint.cs @@ -11,7 +11,7 @@ using osu.Game.Tests.Visual; namespace osu.Game.Rulesets.Osu.Tests { - public class TestCaseHitCirclePlacementMask : HitObjectPlacementMaskTestCase + public class TestCaseHitCirclePlacementBlueprint : PlacementBlueprintTestCase { protected override DrawableHitObject CreateHitObject(HitObject hitObject) => new DrawableHitCircle((HitCircle)hitObject); protected override PlacementBlueprint CreateMask() => new HitCirclePlacementBlueprint(); diff --git a/osu.Game.Rulesets.Osu.Tests/TestCaseHitCircleSelectionMask.cs b/osu.Game.Rulesets.Osu.Tests/TestCaseHitCircleSelectionBlueprint.cs similarity index 87% rename from osu.Game.Rulesets.Osu.Tests/TestCaseHitCircleSelectionMask.cs rename to osu.Game.Rulesets.Osu.Tests/TestCaseHitCircleSelectionBlueprint.cs index 330315a953..843b6e83f2 100644 --- a/osu.Game.Rulesets.Osu.Tests/TestCaseHitCircleSelectionMask.cs +++ b/osu.Game.Rulesets.Osu.Tests/TestCaseHitCircleSelectionBlueprint.cs @@ -12,11 +12,11 @@ using OpenTK; namespace osu.Game.Rulesets.Osu.Tests { - public class TestCaseHitCircleSelectionMask : HitObjectSelectionMaskTestCase + public class TestCaseHitCircleSelectionBlueprint : SelectionBlueprintTestCase { private readonly DrawableHitCircle drawableObject; - public TestCaseHitCircleSelectionMask() + public TestCaseHitCircleSelectionBlueprint() { var hitCircle = new HitCircle { Position = new Vector2(256, 192) }; hitCircle.ApplyDefaults(new ControlPointInfo(), new BeatmapDifficulty { CircleSize = 2 }); diff --git a/osu.Game.Rulesets.Osu.Tests/TestCaseSliderPlacementMask.cs b/osu.Game.Rulesets.Osu.Tests/TestCaseSliderPlacementBlueprint.cs similarity index 89% rename from osu.Game.Rulesets.Osu.Tests/TestCaseSliderPlacementMask.cs rename to osu.Game.Rulesets.Osu.Tests/TestCaseSliderPlacementBlueprint.cs index 5dd7a99aad..43f2718c9a 100644 --- a/osu.Game.Rulesets.Osu.Tests/TestCaseSliderPlacementMask.cs +++ b/osu.Game.Rulesets.Osu.Tests/TestCaseSliderPlacementBlueprint.cs @@ -11,7 +11,7 @@ using osu.Game.Tests.Visual; namespace osu.Game.Rulesets.Osu.Tests { - public class TestCaseSliderPlacementMask : HitObjectPlacementMaskTestCase + public class TestCaseSliderPlacementBlueprint : PlacementBlueprintTestCase { protected override DrawableHitObject CreateHitObject(HitObject hitObject) => new DrawableSlider((Slider)hitObject); protected override PlacementBlueprint CreateMask() => new SliderPlacementBlueprint(); diff --git a/osu.Game.Rulesets.Osu.Tests/TestCaseSliderSelectionMask.cs b/osu.Game.Rulesets.Osu.Tests/TestCaseSliderSelectionBlueprint.cs similarity index 92% rename from osu.Game.Rulesets.Osu.Tests/TestCaseSliderSelectionMask.cs rename to osu.Game.Rulesets.Osu.Tests/TestCaseSliderSelectionBlueprint.cs index 0641ff7582..43c11b4441 100644 --- a/osu.Game.Rulesets.Osu.Tests/TestCaseSliderSelectionMask.cs +++ b/osu.Game.Rulesets.Osu.Tests/TestCaseSliderSelectionBlueprint.cs @@ -16,7 +16,7 @@ using OpenTK; namespace osu.Game.Rulesets.Osu.Tests { - public class TestCaseSliderSelectionMask : HitObjectSelectionMaskTestCase + public class TestCaseSliderSelectionBlueprint : SelectionBlueprintTestCase { public override IReadOnlyList RequiredTypes => new[] { @@ -30,7 +30,7 @@ namespace osu.Game.Rulesets.Osu.Tests private readonly DrawableSlider drawableObject; - public TestCaseSliderSelectionMask() + public TestCaseSliderSelectionBlueprint() { var slider = new Slider { diff --git a/osu.Game.Rulesets.Osu.Tests/TestCaseSpinnerPlacementMask.cs b/osu.Game.Rulesets.Osu.Tests/TestCaseSpinnerPlacementBlueprint.cs similarity index 89% rename from osu.Game.Rulesets.Osu.Tests/TestCaseSpinnerPlacementMask.cs rename to osu.Game.Rulesets.Osu.Tests/TestCaseSpinnerPlacementBlueprint.cs index 1ca203e474..4b1dc62452 100644 --- a/osu.Game.Rulesets.Osu.Tests/TestCaseSpinnerPlacementMask.cs +++ b/osu.Game.Rulesets.Osu.Tests/TestCaseSpinnerPlacementBlueprint.cs @@ -11,7 +11,7 @@ using osu.Game.Tests.Visual; namespace osu.Game.Rulesets.Osu.Tests { - public class TestCaseSpinnerPlacementMask : HitObjectPlacementMaskTestCase + public class TestCaseSpinnerPlacementBlueprint : PlacementBlueprintTestCase { protected override DrawableHitObject CreateHitObject(HitObject hitObject) => new DrawableSpinner((Spinner)hitObject); diff --git a/osu.Game.Rulesets.Osu.Tests/TestCaseSpinnerSelectionMask.cs b/osu.Game.Rulesets.Osu.Tests/TestCaseSpinnerSelectionBlueprint.cs similarity index 92% rename from osu.Game.Rulesets.Osu.Tests/TestCaseSpinnerSelectionMask.cs rename to osu.Game.Rulesets.Osu.Tests/TestCaseSpinnerSelectionBlueprint.cs index 9b0be3cc9c..f94939b585 100644 --- a/osu.Game.Rulesets.Osu.Tests/TestCaseSpinnerSelectionMask.cs +++ b/osu.Game.Rulesets.Osu.Tests/TestCaseSpinnerSelectionBlueprint.cs @@ -17,7 +17,7 @@ using OpenTK; namespace osu.Game.Rulesets.Osu.Tests { - public class TestCaseSpinnerSelectionMask : HitObjectSelectionMaskTestCase + public class TestCaseSpinnerSelectionBlueprint : SelectionBlueprintTestCase { public override IReadOnlyList RequiredTypes => new[] { @@ -27,7 +27,7 @@ namespace osu.Game.Rulesets.Osu.Tests private readonly DrawableSpinner drawableSpinner; - public TestCaseSpinnerSelectionMask() + public TestCaseSpinnerSelectionBlueprint() { var spinner = new Spinner { diff --git a/osu.Game/Tests/Visual/HitObjectPlacementMaskTestCase.cs b/osu.Game/Tests/Visual/PlacementBlueprintTestCase.cs similarity index 93% rename from osu.Game/Tests/Visual/HitObjectPlacementMaskTestCase.cs rename to osu.Game/Tests/Visual/PlacementBlueprintTestCase.cs index e33d92da88..6cc8408998 100644 --- a/osu.Game/Tests/Visual/HitObjectPlacementMaskTestCase.cs +++ b/osu.Game/Tests/Visual/PlacementBlueprintTestCase.cs @@ -13,12 +13,12 @@ using osu.Game.Screens.Edit.Screens.Compose; namespace osu.Game.Tests.Visual { [Cached(Type = typeof(IPlacementHandler))] - public abstract class HitObjectPlacementMaskTestCase : OsuTestCase, IPlacementHandler + public abstract class PlacementBlueprintTestCase : OsuTestCase, IPlacementHandler { private readonly Container hitObjectContainer; private PlacementBlueprint currentBlueprint; - protected HitObjectPlacementMaskTestCase() + protected PlacementBlueprintTestCase() { Beatmap.Value.BeatmapInfo.BaseDifficulty.CircleSize = 2; diff --git a/osu.Game/Tests/Visual/HitObjectSelectionMaskTestCase.cs b/osu.Game/Tests/Visual/SelectionBlueprintTestCase.cs similarity index 91% rename from osu.Game/Tests/Visual/HitObjectSelectionMaskTestCase.cs rename to osu.Game/Tests/Visual/SelectionBlueprintTestCase.cs index 707ebaa96b..1879b0c37f 100644 --- a/osu.Game/Tests/Visual/HitObjectSelectionMaskTestCase.cs +++ b/osu.Game/Tests/Visual/SelectionBlueprintTestCase.cs @@ -10,14 +10,14 @@ using osu.Game.Rulesets.Edit; namespace osu.Game.Tests.Visual { - public abstract class HitObjectSelectionMaskTestCase : OsuTestCase + public abstract class SelectionBlueprintTestCase : OsuTestCase { private SelectionBlueprint blueprint; protected override Container Content => content ?? base.Content; private readonly Container content; - protected HitObjectSelectionMaskTestCase() + protected SelectionBlueprintTestCase() { base.Content.Add(content = new Container { From 85f96ad62fcf559d9b2f669bf3ee29329c3c2f8c Mon Sep 17 00:00:00 2001 From: smoogipoo Date: Tue, 6 Nov 2018 18:06:34 +0900 Subject: [PATCH 407/417] Fix a few missed renames --- .../Edit/HitCircleCompositionTool.cs | 2 +- .../Edit/SliderCompositionTool.cs | 2 +- .../Edit/SpinnerCompositionTool.cs | 2 +- osu.Game/Rulesets/Edit/PlacementBlueprint.cs | 2 +- osu.Game/Rulesets/Edit/SelectionBlueprint.cs | 2 +- .../Edit/Tools/HitObjectCompositionTool.cs | 2 +- .../Compose/Layers/BlueprintContainer.cs | 2 +- .../Screens/Compose/Layers/SelectionBox.cs | 42 +++++++++---------- 8 files changed, 28 insertions(+), 28 deletions(-) diff --git a/osu.Game.Rulesets.Osu/Edit/HitCircleCompositionTool.cs b/osu.Game.Rulesets.Osu/Edit/HitCircleCompositionTool.cs index d7a4c7a6b7..1a48a0b6a9 100644 --- a/osu.Game.Rulesets.Osu/Edit/HitCircleCompositionTool.cs +++ b/osu.Game.Rulesets.Osu/Edit/HitCircleCompositionTool.cs @@ -15,6 +15,6 @@ namespace osu.Game.Rulesets.Osu.Edit { } - public override PlacementBlueprint CreatePlacementMask() => new HitCirclePlacementBlueprint(); + public override PlacementBlueprint CreatePlacementBlueprint() => new HitCirclePlacementBlueprint(); } } diff --git a/osu.Game.Rulesets.Osu/Edit/SliderCompositionTool.cs b/osu.Game.Rulesets.Osu/Edit/SliderCompositionTool.cs index 050c538329..0cf98ea9d7 100644 --- a/osu.Game.Rulesets.Osu/Edit/SliderCompositionTool.cs +++ b/osu.Game.Rulesets.Osu/Edit/SliderCompositionTool.cs @@ -15,6 +15,6 @@ namespace osu.Game.Rulesets.Osu.Edit { } - public override PlacementBlueprint CreatePlacementMask() => new SliderPlacementBlueprint(); + public override PlacementBlueprint CreatePlacementBlueprint() => new SliderPlacementBlueprint(); } } diff --git a/osu.Game.Rulesets.Osu/Edit/SpinnerCompositionTool.cs b/osu.Game.Rulesets.Osu/Edit/SpinnerCompositionTool.cs index 4401496327..b3677c7612 100644 --- a/osu.Game.Rulesets.Osu/Edit/SpinnerCompositionTool.cs +++ b/osu.Game.Rulesets.Osu/Edit/SpinnerCompositionTool.cs @@ -15,6 +15,6 @@ namespace osu.Game.Rulesets.Osu.Edit { } - public override PlacementBlueprint CreatePlacementMask() => new SpinnerPlacementBlueprint(); + public override PlacementBlueprint CreatePlacementBlueprint() => new SpinnerPlacementBlueprint(); } } diff --git a/osu.Game/Rulesets/Edit/PlacementBlueprint.cs b/osu.Game/Rulesets/Edit/PlacementBlueprint.cs index 7e5a592a0d..fe27d37640 100644 --- a/osu.Game/Rulesets/Edit/PlacementBlueprint.cs +++ b/osu.Game/Rulesets/Edit/PlacementBlueprint.cs @@ -16,7 +16,7 @@ using OpenTK; namespace osu.Game.Rulesets.Edit { /// - /// A mask which governs the creation of a new to actualisation. + /// A blueprint which governs the creation of a new to actualisation. /// public abstract class PlacementBlueprint : CompositeDrawable, IRequireHighFrequencyMousePosition { diff --git a/osu.Game/Rulesets/Edit/SelectionBlueprint.cs b/osu.Game/Rulesets/Edit/SelectionBlueprint.cs index dc879b3a16..6e0d136e1f 100644 --- a/osu.Game/Rulesets/Edit/SelectionBlueprint.cs +++ b/osu.Game/Rulesets/Edit/SelectionBlueprint.cs @@ -15,7 +15,7 @@ using OpenTK; namespace osu.Game.Rulesets.Edit { /// - /// A mask placed above a adding editing functionality. + /// A blueprint placed above a adding editing functionality. /// public class SelectionBlueprint : CompositeDrawable, IStateful { diff --git a/osu.Game/Rulesets/Edit/Tools/HitObjectCompositionTool.cs b/osu.Game/Rulesets/Edit/Tools/HitObjectCompositionTool.cs index 1a20f165c0..1cb3c4c451 100644 --- a/osu.Game/Rulesets/Edit/Tools/HitObjectCompositionTool.cs +++ b/osu.Game/Rulesets/Edit/Tools/HitObjectCompositionTool.cs @@ -12,6 +12,6 @@ namespace osu.Game.Rulesets.Edit.Tools Name = name; } - public abstract PlacementBlueprint CreatePlacementMask(); + public abstract PlacementBlueprint CreatePlacementBlueprint(); } } diff --git a/osu.Game/Screens/Edit/Screens/Compose/Layers/BlueprintContainer.cs b/osu.Game/Screens/Edit/Screens/Compose/Layers/BlueprintContainer.cs index f781da0c60..2d99851b71 100644 --- a/osu.Game/Screens/Edit/Screens/Compose/Layers/BlueprintContainer.cs +++ b/osu.Game/Screens/Edit/Screens/Compose/Layers/BlueprintContainer.cs @@ -125,7 +125,7 @@ namespace osu.Game.Screens.Edit.Screens.Compose.Layers { placementBlueprintContainer.Clear(); - var blueprint = CurrentTool?.CreatePlacementMask(); + var blueprint = CurrentTool?.CreatePlacementBlueprint(); if (blueprint != null) placementBlueprintContainer.Child = blueprint; } diff --git a/osu.Game/Screens/Edit/Screens/Compose/Layers/SelectionBox.cs b/osu.Game/Screens/Edit/Screens/Compose/Layers/SelectionBox.cs index 6aef47d690..59a7f3094c 100644 --- a/osu.Game/Screens/Edit/Screens/Compose/Layers/SelectionBox.cs +++ b/osu.Game/Screens/Edit/Screens/Compose/Layers/SelectionBox.cs @@ -25,7 +25,7 @@ namespace osu.Game.Screens.Edit.Screens.Compose.Layers { public const float BORDER_RADIUS = 2; - private readonly List selectedMasks; + private readonly List selectedBlueprints; private Drawable outline; @@ -34,7 +34,7 @@ namespace osu.Game.Screens.Edit.Screens.Compose.Layers public SelectionBox() { - selectedMasks = new List(); + selectedBlueprints = new List(); RelativeSizeAxes = Axes.Both; AlwaysPresent = true; @@ -64,9 +64,9 @@ namespace osu.Game.Screens.Edit.Screens.Compose.Layers { // Todo: Various forms of snapping - foreach (var mask in selectedMasks) + foreach (var blueprint in selectedBlueprints) { - switch (mask.HitObject.HitObject) + switch (blueprint.HitObject.HitObject) { case IHasEditablePosition editablePosition: editablePosition.OffsetPosition(delta); @@ -83,7 +83,7 @@ namespace osu.Game.Screens.Edit.Screens.Compose.Layers switch (e.Key) { case Key.Delete: - foreach (var h in selectedMasks.ToList()) + foreach (var h in selectedBlueprints.ToList()) placementHandler.Delete(h.HitObject.HitObject); return true; } @@ -96,33 +96,33 @@ namespace osu.Game.Screens.Edit.Screens.Compose.Layers #region Selection Handling /// - /// Bind an action to deselect all selected masks. + /// Bind an action to deselect all selected blueprints. /// public Action DeselectAll { private get; set; } /// - /// Handle a mask becoming selected. + /// Handle a blueprint becoming selected. /// - /// The mask. - public void HandleSelected(SelectionBlueprint blueprint) => selectedMasks.Add(blueprint); + /// The blueprint. + public void HandleSelected(SelectionBlueprint blueprint) => selectedBlueprints.Add(blueprint); /// - /// Handle a mask becoming deselected. + /// Handle a blueprint becoming deselected. /// - /// The mask. + /// The blueprint. public void HandleDeselected(SelectionBlueprint blueprint) { - selectedMasks.Remove(blueprint); + selectedBlueprints.Remove(blueprint); - // We don't want to update visibility if > 0, since we may be deselecting masks during drag-selection - if (selectedMasks.Count == 0) + // We don't want to update visibility if > 0, since we may be deselecting blueprints during drag-selection + if (selectedBlueprints.Count == 0) UpdateVisibility(); } /// - /// Handle a mask requesting selection. + /// Handle a blueprint requesting selection. /// - /// The mask. + /// The blueprint. public void HandleSelectionRequested(SelectionBlueprint blueprint, InputState state) { if (state.Keyboard.ControlPressed) @@ -151,7 +151,7 @@ namespace osu.Game.Screens.Edit.Screens.Compose.Layers /// internal void UpdateVisibility() { - if (selectedMasks.Count > 0) + if (selectedBlueprints.Count > 0) Show(); else Hide(); @@ -161,7 +161,7 @@ namespace osu.Game.Screens.Edit.Screens.Compose.Layers { base.Update(); - if (selectedMasks.Count == 0) + if (selectedBlueprints.Count == 0) return; // Move the rectangle to cover the hitobjects @@ -170,10 +170,10 @@ namespace osu.Game.Screens.Edit.Screens.Compose.Layers bool hasSelection = false; - foreach (var mask in selectedMasks) + foreach (var blueprint in selectedBlueprints) { - topLeft = Vector2.ComponentMin(topLeft, ToLocalSpace(mask.SelectionQuad.TopLeft)); - bottomRight = Vector2.ComponentMax(bottomRight, ToLocalSpace(mask.SelectionQuad.BottomRight)); + topLeft = Vector2.ComponentMin(topLeft, ToLocalSpace(blueprint.SelectionQuad.TopLeft)); + bottomRight = Vector2.ComponentMax(bottomRight, ToLocalSpace(blueprint.SelectionQuad.BottomRight)); } topLeft -= new Vector2(5); From 27d82052f4db02109233f7699fe4065400718706 Mon Sep 17 00:00:00 2001 From: smoogipoo Date: Tue, 6 Nov 2018 18:10:46 +0900 Subject: [PATCH 408/417] BorderLayer -> EditorPlayfieldBorder --- osu.Game/Rulesets/Edit/HitObjectComposer.cs | 2 +- .../Screens/Compose/Layers/BorderLayer.cs | 38 ------------------- .../Compose/Layers/EditorPlayfieldBorder.cs | 32 ++++++++++++++++ 3 files changed, 33 insertions(+), 39 deletions(-) delete mode 100644 osu.Game/Screens/Edit/Screens/Compose/Layers/BorderLayer.cs create mode 100644 osu.Game/Screens/Edit/Screens/Compose/Layers/EditorPlayfieldBorder.cs diff --git a/osu.Game/Rulesets/Edit/HitObjectComposer.cs b/osu.Game/Rulesets/Edit/HitObjectComposer.cs index f1b1948b5e..64f2648ca1 100644 --- a/osu.Game/Rulesets/Edit/HitObjectComposer.cs +++ b/osu.Game/Rulesets/Edit/HitObjectComposer.cs @@ -61,7 +61,7 @@ namespace osu.Game.Rulesets.Edit } var layerBelowRuleset = CreateLayerContainer(); - layerBelowRuleset.Child = new BorderLayer { RelativeSizeAxes = Axes.Both }; + layerBelowRuleset.Child = new EditorPlayfieldBorder { RelativeSizeAxes = Axes.Both }; var layerAboveRuleset = CreateLayerContainer(); layerAboveRuleset.Child = new BlueprintContainer(); diff --git a/osu.Game/Screens/Edit/Screens/Compose/Layers/BorderLayer.cs b/osu.Game/Screens/Edit/Screens/Compose/Layers/BorderLayer.cs deleted file mode 100644 index c46f9a1b7f..0000000000 --- a/osu.Game/Screens/Edit/Screens/Compose/Layers/BorderLayer.cs +++ /dev/null @@ -1,38 +0,0 @@ -// Copyright (c) 2007-2018 ppy Pty Ltd . -// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE - -using osu.Framework.Graphics; -using osu.Framework.Graphics.Containers; -using osu.Framework.Graphics.Shapes; -using OpenTK.Graphics; - -namespace osu.Game.Screens.Edit.Screens.Compose.Layers -{ - public class BorderLayer : Container - { - protected override Container Content => content; - private readonly Container content; - - public BorderLayer() - { - InternalChildren = new Drawable[] - { - new Container - { - Name = "Border", - RelativeSizeAxes = Axes.Both, - Masking = true, - BorderColour = Color4.White, - BorderThickness = 2, - Child = new Box - { - RelativeSizeAxes = Axes.Both, - Alpha = 0, - AlwaysPresent = true - } - }, - content = new Container { RelativeSizeAxes = Axes.Both } - }; - } - } -} diff --git a/osu.Game/Screens/Edit/Screens/Compose/Layers/EditorPlayfieldBorder.cs b/osu.Game/Screens/Edit/Screens/Compose/Layers/EditorPlayfieldBorder.cs new file mode 100644 index 0000000000..22cdfa9328 --- /dev/null +++ b/osu.Game/Screens/Edit/Screens/Compose/Layers/EditorPlayfieldBorder.cs @@ -0,0 +1,32 @@ +// Copyright (c) 2007-2018 ppy Pty Ltd . +// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE + +using osu.Framework.Graphics; +using osu.Framework.Graphics.Containers; +using osu.Framework.Graphics.Shapes; +using OpenTK.Graphics; + +namespace osu.Game.Screens.Edit.Screens.Compose.Layers +{ + /// + /// Provides a border around the playfield. + /// + public class EditorPlayfieldBorder : CompositeDrawable + { + public EditorPlayfieldBorder() + { + RelativeSizeAxes = Axes.Both; + + Masking = true; + BorderColour = Color4.White; + BorderThickness = 2; + + InternalChild = new Box + { + RelativeSizeAxes = Axes.Both, + Alpha = 0, + AlwaysPresent = true + }; + } + } +} From ac25718c5a112ba7cf77dcdb2ac59f280f36071f Mon Sep 17 00:00:00 2001 From: smoogipoo Date: Tue, 6 Nov 2018 18:14:46 +0900 Subject: [PATCH 409/417] Renamespace compose-mode components --- osu.Game.Tests/Visual/TestCaseBeatDivisorControl.cs | 1 + osu.Game.Tests/Visual/TestCaseEditorComposeRadioButtons.cs | 2 +- osu.Game.Tests/Visual/TestCaseEditorComposeTimeline.cs | 2 +- osu.Game.Tests/Visual/TestCaseHitObjectComposer.cs | 2 +- osu.Game.Tests/Visual/TestCaseZoomableScrollContainer.cs | 2 +- osu.Game/Rulesets/Edit/HitObjectComposer.cs | 4 ++-- .../RadioButtons/DrawableRadioButton.cs | 6 +++--- .../Compose => Components}/RadioButtons/RadioButton.cs | 2 +- .../RadioButtons/RadioButtonCollection.cs | 4 ++-- .../Screens/Compose/{ => Components}/BeatDivisorControl.cs | 2 +- .../Compose/{Layers => Components}/BlueprintContainer.cs | 2 +- .../Edit/Screens/Compose/{Layers => Components}/DragBox.cs | 2 +- .../Compose/{Layers => Components}/EditorPlayfieldBorder.cs | 2 +- .../Screens/Compose/{Layers => Components}/SelectionBox.cs | 2 +- .../Compose/{ => Components}/Timeline/CentreMarker.cs | 2 +- .../Screens/Compose/{ => Components}/Timeline/Timeline.cs | 2 +- .../Compose/{ => Components}/Timeline/TimelineArea.cs | 4 ++-- .../Compose/{ => Components}/Timeline/TimelineButton.cs | 6 +++--- .../{ => Components}/Timeline/ZoomableScrollContainer.cs | 2 +- osu.Game/Screens/Edit/Screens/Compose/Compose.cs | 3 ++- 20 files changed, 28 insertions(+), 26 deletions(-) rename osu.Game/Screens/Edit/{Screens/Compose => Components}/RadioButtons/DrawableRadioButton.cs (98%) rename osu.Game/Screens/Edit/{Screens/Compose => Components}/RadioButtons/RadioButton.cs (95%) rename osu.Game/Screens/Edit/{Screens/Compose => Components}/RadioButtons/RadioButtonCollection.cs (96%) rename osu.Game/Screens/Edit/Screens/Compose/{ => Components}/BeatDivisorControl.cs (99%) rename osu.Game/Screens/Edit/Screens/Compose/{Layers => Components}/BlueprintContainer.cs (99%) rename osu.Game/Screens/Edit/Screens/Compose/{Layers => Components}/DragBox.cs (97%) rename osu.Game/Screens/Edit/Screens/Compose/{Layers => Components}/EditorPlayfieldBorder.cs (93%) rename osu.Game/Screens/Edit/Screens/Compose/{Layers => Components}/SelectionBox.cs (98%) rename osu.Game/Screens/Edit/Screens/Compose/{ => Components}/Timeline/CentreMarker.cs (95%) rename osu.Game/Screens/Edit/Screens/Compose/{ => Components}/Timeline/Timeline.cs (98%) rename osu.Game/Screens/Edit/Screens/Compose/{ => Components}/Timeline/TimelineArea.cs (98%) rename osu.Game/Screens/Edit/Screens/Compose/{ => Components}/Timeline/TimelineButton.cs (95%) rename osu.Game/Screens/Edit/Screens/Compose/{ => Components}/Timeline/ZoomableScrollContainer.cs (98%) diff --git a/osu.Game.Tests/Visual/TestCaseBeatDivisorControl.cs b/osu.Game.Tests/Visual/TestCaseBeatDivisorControl.cs index 1effa14e76..9709721686 100644 --- a/osu.Game.Tests/Visual/TestCaseBeatDivisorControl.cs +++ b/osu.Game.Tests/Visual/TestCaseBeatDivisorControl.cs @@ -6,6 +6,7 @@ using System.Collections.Generic; using osu.Framework.Allocation; using osu.Framework.Graphics; using osu.Game.Screens.Edit.Screens.Compose; +using osu.Game.Screens.Edit.Screens.Compose.Components; using OpenTK; namespace osu.Game.Tests.Visual diff --git a/osu.Game.Tests/Visual/TestCaseEditorComposeRadioButtons.cs b/osu.Game.Tests/Visual/TestCaseEditorComposeRadioButtons.cs index 09f390ab74..9df36b0bc1 100644 --- a/osu.Game.Tests/Visual/TestCaseEditorComposeRadioButtons.cs +++ b/osu.Game.Tests/Visual/TestCaseEditorComposeRadioButtons.cs @@ -5,7 +5,7 @@ using System; using System.Collections.Generic; using NUnit.Framework; using osu.Framework.Graphics; -using osu.Game.Screens.Edit.Screens.Compose.RadioButtons; +using osu.Game.Screens.Edit.Components.RadioButtons; namespace osu.Game.Tests.Visual { diff --git a/osu.Game.Tests/Visual/TestCaseEditorComposeTimeline.cs b/osu.Game.Tests/Visual/TestCaseEditorComposeTimeline.cs index 9ad8bf7b92..ef5341ed44 100644 --- a/osu.Game.Tests/Visual/TestCaseEditorComposeTimeline.cs +++ b/osu.Game.Tests/Visual/TestCaseEditorComposeTimeline.cs @@ -13,7 +13,7 @@ using osu.Framework.Graphics.Shapes; using osu.Framework.Graphics.UserInterface; using osu.Framework.Timing; using osu.Game.Beatmaps; -using osu.Game.Screens.Edit.Screens.Compose.Timeline; +using osu.Game.Screens.Edit.Screens.Compose.Components.Timeline; using OpenTK.Graphics; namespace osu.Game.Tests.Visual diff --git a/osu.Game.Tests/Visual/TestCaseHitObjectComposer.cs b/osu.Game.Tests/Visual/TestCaseHitObjectComposer.cs index 0e337acd2f..6525a7a634 100644 --- a/osu.Game.Tests/Visual/TestCaseHitObjectComposer.cs +++ b/osu.Game.Tests/Visual/TestCaseHitObjectComposer.cs @@ -17,7 +17,7 @@ using osu.Game.Rulesets.Osu.Edit.Masks.HitCircleMasks; using osu.Game.Rulesets.Osu.Edit.Masks.HitCircleMasks.Components; using osu.Game.Rulesets.Osu.Objects; using osu.Game.Screens.Edit.Screens.Compose; -using osu.Game.Screens.Edit.Screens.Compose.Layers; +using osu.Game.Screens.Edit.Screens.Compose.Components; using osu.Game.Tests.Beatmaps; namespace osu.Game.Tests.Visual diff --git a/osu.Game.Tests/Visual/TestCaseZoomableScrollContainer.cs b/osu.Game.Tests/Visual/TestCaseZoomableScrollContainer.cs index 8bd1b79a84..0f1ad197ac 100644 --- a/osu.Game.Tests/Visual/TestCaseZoomableScrollContainer.cs +++ b/osu.Game.Tests/Visual/TestCaseZoomableScrollContainer.cs @@ -10,7 +10,7 @@ using osu.Framework.Graphics.Shapes; using osu.Framework.MathUtils; using osu.Game.Graphics; using osu.Game.Graphics.Cursor; -using osu.Game.Screens.Edit.Screens.Compose.Timeline; +using osu.Game.Screens.Edit.Screens.Compose.Components.Timeline; using OpenTK; using OpenTK.Graphics; diff --git a/osu.Game/Rulesets/Edit/HitObjectComposer.cs b/osu.Game/Rulesets/Edit/HitObjectComposer.cs index 64f2648ca1..b515e9a257 100644 --- a/osu.Game/Rulesets/Edit/HitObjectComposer.cs +++ b/osu.Game/Rulesets/Edit/HitObjectComposer.cs @@ -16,8 +16,8 @@ using osu.Game.Rulesets.Edit.Tools; using osu.Game.Rulesets.Objects; using osu.Game.Rulesets.Objects.Drawables; using osu.Game.Rulesets.UI; -using osu.Game.Screens.Edit.Screens.Compose.Layers; -using osu.Game.Screens.Edit.Screens.Compose.RadioButtons; +using osu.Game.Screens.Edit.Components.RadioButtons; +using osu.Game.Screens.Edit.Screens.Compose.Components; namespace osu.Game.Rulesets.Edit { diff --git a/osu.Game/Screens/Edit/Screens/Compose/RadioButtons/DrawableRadioButton.cs b/osu.Game/Screens/Edit/Components/RadioButtons/DrawableRadioButton.cs similarity index 98% rename from osu.Game/Screens/Edit/Screens/Compose/RadioButtons/DrawableRadioButton.cs rename to osu.Game/Screens/Edit/Components/RadioButtons/DrawableRadioButton.cs index 2c7e2043fc..22f8417735 100644 --- a/osu.Game/Screens/Edit/Screens/Compose/RadioButtons/DrawableRadioButton.cs +++ b/osu.Game/Screens/Edit/Components/RadioButtons/DrawableRadioButton.cs @@ -2,8 +2,6 @@ // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE using System; -using OpenTK; -using OpenTK.Graphics; using osu.Framework.Allocation; using osu.Framework.Extensions.Color4Extensions; using osu.Framework.Graphics; @@ -14,8 +12,10 @@ using osu.Framework.Input.Events; using osu.Game.Graphics; using osu.Game.Graphics.Sprites; using osu.Game.Graphics.UserInterface; +using OpenTK; +using OpenTK.Graphics; -namespace osu.Game.Screens.Edit.Screens.Compose.RadioButtons +namespace osu.Game.Screens.Edit.Components.RadioButtons { public class DrawableRadioButton : TriangleButton { diff --git a/osu.Game/Screens/Edit/Screens/Compose/RadioButtons/RadioButton.cs b/osu.Game/Screens/Edit/Components/RadioButtons/RadioButton.cs similarity index 95% rename from osu.Game/Screens/Edit/Screens/Compose/RadioButtons/RadioButton.cs rename to osu.Game/Screens/Edit/Components/RadioButtons/RadioButton.cs index 09fe34bedc..c671fa71c2 100644 --- a/osu.Game/Screens/Edit/Screens/Compose/RadioButtons/RadioButton.cs +++ b/osu.Game/Screens/Edit/Components/RadioButtons/RadioButton.cs @@ -4,7 +4,7 @@ using System; using osu.Framework.Configuration; -namespace osu.Game.Screens.Edit.Screens.Compose.RadioButtons +namespace osu.Game.Screens.Edit.Components.RadioButtons { public class RadioButton { diff --git a/osu.Game/Screens/Edit/Screens/Compose/RadioButtons/RadioButtonCollection.cs b/osu.Game/Screens/Edit/Components/RadioButtons/RadioButtonCollection.cs similarity index 96% rename from osu.Game/Screens/Edit/Screens/Compose/RadioButtons/RadioButtonCollection.cs rename to osu.Game/Screens/Edit/Components/RadioButtons/RadioButtonCollection.cs index 7ba16b3d3e..9bb2e11430 100644 --- a/osu.Game/Screens/Edit/Screens/Compose/RadioButtons/RadioButtonCollection.cs +++ b/osu.Game/Screens/Edit/Components/RadioButtons/RadioButtonCollection.cs @@ -2,12 +2,12 @@ // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE using System.Collections.Generic; -using OpenTK; using osu.Framework.Extensions.IEnumerableExtensions; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; +using OpenTK; -namespace osu.Game.Screens.Edit.Screens.Compose.RadioButtons +namespace osu.Game.Screens.Edit.Components.RadioButtons { public class RadioButtonCollection : CompositeDrawable { diff --git a/osu.Game/Screens/Edit/Screens/Compose/BeatDivisorControl.cs b/osu.Game/Screens/Edit/Screens/Compose/Components/BeatDivisorControl.cs similarity index 99% rename from osu.Game/Screens/Edit/Screens/Compose/BeatDivisorControl.cs rename to osu.Game/Screens/Edit/Screens/Compose/Components/BeatDivisorControl.cs index e46be9f7c1..b64bbaf215 100644 --- a/osu.Game/Screens/Edit/Screens/Compose/BeatDivisorControl.cs +++ b/osu.Game/Screens/Edit/Screens/Compose/Components/BeatDivisorControl.cs @@ -19,7 +19,7 @@ using OpenTK; using OpenTK.Graphics; using OpenTK.Input; -namespace osu.Game.Screens.Edit.Screens.Compose +namespace osu.Game.Screens.Edit.Screens.Compose.Components { public class BeatDivisorControl : CompositeDrawable { diff --git a/osu.Game/Screens/Edit/Screens/Compose/Layers/BlueprintContainer.cs b/osu.Game/Screens/Edit/Screens/Compose/Components/BlueprintContainer.cs similarity index 99% rename from osu.Game/Screens/Edit/Screens/Compose/Layers/BlueprintContainer.cs rename to osu.Game/Screens/Edit/Screens/Compose/Components/BlueprintContainer.cs index 2d99851b71..079d755318 100644 --- a/osu.Game/Screens/Edit/Screens/Compose/Layers/BlueprintContainer.cs +++ b/osu.Game/Screens/Edit/Screens/Compose/Components/BlueprintContainer.cs @@ -14,7 +14,7 @@ using osu.Game.Rulesets.Edit.Tools; using osu.Game.Rulesets.Objects.Drawables; using OpenTK; -namespace osu.Game.Screens.Edit.Screens.Compose.Layers +namespace osu.Game.Screens.Edit.Screens.Compose.Components { public class BlueprintContainer : CompositeDrawable { diff --git a/osu.Game/Screens/Edit/Screens/Compose/Layers/DragBox.cs b/osu.Game/Screens/Edit/Screens/Compose/Components/DragBox.cs similarity index 97% rename from osu.Game/Screens/Edit/Screens/Compose/Layers/DragBox.cs rename to osu.Game/Screens/Edit/Screens/Compose/Components/DragBox.cs index a97ffc3fcc..d13030d7bb 100644 --- a/osu.Game/Screens/Edit/Screens/Compose/Layers/DragBox.cs +++ b/osu.Game/Screens/Edit/Screens/Compose/Components/DragBox.cs @@ -10,7 +10,7 @@ using osu.Framework.Graphics.Shapes; using osu.Framework.Input.Events; using OpenTK.Graphics; -namespace osu.Game.Screens.Edit.Screens.Compose.Layers +namespace osu.Game.Screens.Edit.Screens.Compose.Components { /// /// A box that displays the drag selection and provides selection events for users to handle. diff --git a/osu.Game/Screens/Edit/Screens/Compose/Layers/EditorPlayfieldBorder.cs b/osu.Game/Screens/Edit/Screens/Compose/Components/EditorPlayfieldBorder.cs similarity index 93% rename from osu.Game/Screens/Edit/Screens/Compose/Layers/EditorPlayfieldBorder.cs rename to osu.Game/Screens/Edit/Screens/Compose/Components/EditorPlayfieldBorder.cs index 22cdfa9328..f1fb3633e2 100644 --- a/osu.Game/Screens/Edit/Screens/Compose/Layers/EditorPlayfieldBorder.cs +++ b/osu.Game/Screens/Edit/Screens/Compose/Components/EditorPlayfieldBorder.cs @@ -6,7 +6,7 @@ using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Shapes; using OpenTK.Graphics; -namespace osu.Game.Screens.Edit.Screens.Compose.Layers +namespace osu.Game.Screens.Edit.Screens.Compose.Components { /// /// Provides a border around the playfield. diff --git a/osu.Game/Screens/Edit/Screens/Compose/Layers/SelectionBox.cs b/osu.Game/Screens/Edit/Screens/Compose/Components/SelectionBox.cs similarity index 98% rename from osu.Game/Screens/Edit/Screens/Compose/Layers/SelectionBox.cs rename to osu.Game/Screens/Edit/Screens/Compose/Components/SelectionBox.cs index 59a7f3094c..95906546db 100644 --- a/osu.Game/Screens/Edit/Screens/Compose/Layers/SelectionBox.cs +++ b/osu.Game/Screens/Edit/Screens/Compose/Components/SelectionBox.cs @@ -16,7 +16,7 @@ using osu.Game.Rulesets.Edit.Types; using OpenTK; using OpenTK.Input; -namespace osu.Game.Screens.Edit.Screens.Compose.Layers +namespace osu.Game.Screens.Edit.Screens.Compose.Components { /// /// A box which surrounds s and provides interactive handles, context menus etc. diff --git a/osu.Game/Screens/Edit/Screens/Compose/Timeline/CentreMarker.cs b/osu.Game/Screens/Edit/Screens/Compose/Components/Timeline/CentreMarker.cs similarity index 95% rename from osu.Game/Screens/Edit/Screens/Compose/Timeline/CentreMarker.cs rename to osu.Game/Screens/Edit/Screens/Compose/Components/Timeline/CentreMarker.cs index 8e932f307d..c1ba10d5d3 100644 --- a/osu.Game/Screens/Edit/Screens/Compose/Timeline/CentreMarker.cs +++ b/osu.Game/Screens/Edit/Screens/Compose/Components/Timeline/CentreMarker.cs @@ -8,7 +8,7 @@ using osu.Framework.Graphics.Shapes; using osu.Game.Graphics; using OpenTK; -namespace osu.Game.Screens.Edit.Screens.Compose.Timeline +namespace osu.Game.Screens.Edit.Screens.Compose.Components.Timeline { public class CentreMarker : CompositeDrawable { diff --git a/osu.Game/Screens/Edit/Screens/Compose/Timeline/Timeline.cs b/osu.Game/Screens/Edit/Screens/Compose/Components/Timeline/Timeline.cs similarity index 98% rename from osu.Game/Screens/Edit/Screens/Compose/Timeline/Timeline.cs rename to osu.Game/Screens/Edit/Screens/Compose/Components/Timeline/Timeline.cs index da95564975..b27fa5d0c5 100644 --- a/osu.Game/Screens/Edit/Screens/Compose/Timeline/Timeline.cs +++ b/osu.Game/Screens/Edit/Screens/Compose/Components/Timeline/Timeline.cs @@ -12,7 +12,7 @@ using osu.Framework.Timing; using osu.Game.Beatmaps; using osu.Game.Graphics; -namespace osu.Game.Screens.Edit.Screens.Compose.Timeline +namespace osu.Game.Screens.Edit.Screens.Compose.Components.Timeline { public class Timeline : ZoomableScrollContainer { diff --git a/osu.Game/Screens/Edit/Screens/Compose/Timeline/TimelineArea.cs b/osu.Game/Screens/Edit/Screens/Compose/Components/Timeline/TimelineArea.cs similarity index 98% rename from osu.Game/Screens/Edit/Screens/Compose/Timeline/TimelineArea.cs rename to osu.Game/Screens/Edit/Screens/Compose/Components/Timeline/TimelineArea.cs index ecf760be8e..51a713bc91 100644 --- a/osu.Game/Screens/Edit/Screens/Compose/Timeline/TimelineArea.cs +++ b/osu.Game/Screens/Edit/Screens/Compose/Components/Timeline/TimelineArea.cs @@ -1,14 +1,14 @@ // Copyright (c) 2007-2018 ppy Pty Ltd . // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE -using OpenTK; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Shapes; using osu.Game.Graphics; using osu.Game.Graphics.UserInterface; +using OpenTK; -namespace osu.Game.Screens.Edit.Screens.Compose.Timeline +namespace osu.Game.Screens.Edit.Screens.Compose.Components.Timeline { public class TimelineArea : CompositeDrawable { diff --git a/osu.Game/Screens/Edit/Screens/Compose/Timeline/TimelineButton.cs b/osu.Game/Screens/Edit/Screens/Compose/Components/Timeline/TimelineButton.cs similarity index 95% rename from osu.Game/Screens/Edit/Screens/Compose/Timeline/TimelineButton.cs rename to osu.Game/Screens/Edit/Screens/Compose/Components/Timeline/TimelineButton.cs index 5928fbaa1b..fbabbd54a0 100644 --- a/osu.Game/Screens/Edit/Screens/Compose/Timeline/TimelineButton.cs +++ b/osu.Game/Screens/Edit/Screens/Compose/Components/Timeline/TimelineButton.cs @@ -2,15 +2,15 @@ // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE using System; -using OpenTK; -using OpenTK.Graphics; using osu.Framework.Configuration; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Game.Graphics; using osu.Game.Graphics.UserInterface; +using OpenTK; +using OpenTK.Graphics; -namespace osu.Game.Screens.Edit.Screens.Compose.Timeline +namespace osu.Game.Screens.Edit.Screens.Compose.Components.Timeline { public class TimelineButton : CompositeDrawable { diff --git a/osu.Game/Screens/Edit/Screens/Compose/Timeline/ZoomableScrollContainer.cs b/osu.Game/Screens/Edit/Screens/Compose/Components/Timeline/ZoomableScrollContainer.cs similarity index 98% rename from osu.Game/Screens/Edit/Screens/Compose/Timeline/ZoomableScrollContainer.cs rename to osu.Game/Screens/Edit/Screens/Compose/Components/Timeline/ZoomableScrollContainer.cs index bbba439ca7..a85bbb0198 100644 --- a/osu.Game/Screens/Edit/Screens/Compose/Timeline/ZoomableScrollContainer.cs +++ b/osu.Game/Screens/Edit/Screens/Compose/Components/Timeline/ZoomableScrollContainer.cs @@ -9,7 +9,7 @@ using osu.Framework.Input.Events; using osu.Framework.MathUtils; using OpenTK; -namespace osu.Game.Screens.Edit.Screens.Compose.Timeline +namespace osu.Game.Screens.Edit.Screens.Compose.Components.Timeline { public class ZoomableScrollContainer : ScrollContainer { diff --git a/osu.Game/Screens/Edit/Screens/Compose/Compose.cs b/osu.Game/Screens/Edit/Screens/Compose/Compose.cs index ae42942d24..1e6e9792f3 100644 --- a/osu.Game/Screens/Edit/Screens/Compose/Compose.cs +++ b/osu.Game/Screens/Edit/Screens/Compose/Compose.cs @@ -11,7 +11,8 @@ using osu.Framework.Graphics.Shapes; using osu.Framework.Logging; using osu.Game.Rulesets.Edit; using osu.Game.Rulesets.Objects; -using osu.Game.Screens.Edit.Screens.Compose.Timeline; +using osu.Game.Screens.Edit.Screens.Compose.Components; +using osu.Game.Screens.Edit.Screens.Compose.Components.Timeline; namespace osu.Game.Screens.Edit.Screens.Compose { From 52f4923c8e71876119b6e62c2779ff1db4d038a7 Mon Sep 17 00:00:00 2001 From: smoogipoo Date: Tue, 6 Nov 2018 18:28:22 +0900 Subject: [PATCH 410/417] Remove intermediate Screens namespace --- osu.Game.Tests/Visual/TestCaseBeatDivisorControl.cs | 4 ++-- osu.Game.Tests/Visual/TestCaseEditorCompose.cs | 2 +- osu.Game.Tests/Visual/TestCaseEditorComposeTimeline.cs | 2 +- osu.Game.Tests/Visual/TestCaseEditorMenuBar.cs | 2 +- osu.Game.Tests/Visual/TestCaseHitObjectComposer.cs | 4 ++-- osu.Game.Tests/Visual/TestCaseLabelledTextBox.cs | 2 +- osu.Game.Tests/Visual/TestCaseZoomableScrollContainer.cs | 2 +- osu.Game/Rulesets/Edit/HitObjectComposer.cs | 2 +- osu.Game/Rulesets/Edit/PlacementBlueprint.cs | 2 +- .../Edit/{Screens/Compose => }/BindableBeatDivisor.cs | 2 +- .../Screens/Edit/{ => Components}/Menus/EditorMenuBar.cs | 7 +++---- .../Edit/{ => Components}/Menus/EditorMenuItem.cs | 2 +- .../Edit/{ => Components}/Menus/EditorMenuItemSpacer.cs | 2 +- .../{ => Components}/Menus/ScreenSelectionTabControl.cs | 5 ++--- .../Compose/Components/BeatDivisorControl.cs | 2 +- .../Compose/Components/BlueprintContainer.cs | 2 +- .../Edit/{Screens => }/Compose/Components/DragBox.cs | 2 +- .../Compose/Components/EditorPlayfieldBorder.cs | 2 +- .../{Screens => }/Compose/Components/SelectionBox.cs | 2 +- .../Compose/Components/Timeline/CentreMarker.cs | 2 +- .../Compose/Components/Timeline/Timeline.cs | 2 +- .../Compose/Components/Timeline/TimelineArea.cs | 2 +- .../Compose/Components/Timeline/TimelineButton.cs | 2 +- .../Components/Timeline/ZoomableScrollContainer.cs | 2 +- osu.Game/Screens/Edit/{Screens => }/Compose/Compose.cs | 8 ++++---- .../Edit/{Screens => }/Compose/IPlacementHandler.cs | 2 +- osu.Game/Screens/Edit/{Screens => }/Design/Design.cs | 2 +- osu.Game/Screens/Edit/Editor.cs | 9 +++------ osu.Game/Screens/Edit/EditorClock.cs | 1 - osu.Game/Screens/Edit/{Screens => }/EditorScreen.cs | 2 +- osu.Game/Screens/Edit/{Screens => }/EditorScreenMode.cs | 2 +- .../Components/LabelledComponents/LabelledTextBox.cs | 4 ++-- osu.Game/Tests/Visual/EditorClockTestCase.cs | 1 - osu.Game/Tests/Visual/EditorTestCase.cs | 1 - osu.Game/Tests/Visual/PlacementBlueprintTestCase.cs | 2 +- 35 files changed, 43 insertions(+), 51 deletions(-) rename osu.Game/Screens/Edit/{Screens/Compose => }/BindableBeatDivisor.cs (96%) rename osu.Game/Screens/Edit/{ => Components}/Menus/EditorMenuBar.cs (98%) rename osu.Game/Screens/Edit/{ => Components}/Menus/EditorMenuItem.cs (92%) rename osu.Game/Screens/Edit/{ => Components}/Menus/EditorMenuItemSpacer.cs (86%) rename osu.Game/Screens/Edit/{ => Components}/Menus/ScreenSelectionTabControl.cs (96%) rename osu.Game/Screens/Edit/{Screens => }/Compose/Components/BeatDivisorControl.cs (99%) rename osu.Game/Screens/Edit/{Screens => }/Compose/Components/BlueprintContainer.cs (99%) rename osu.Game/Screens/Edit/{Screens => }/Compose/Components/DragBox.cs (97%) rename osu.Game/Screens/Edit/{Screens => }/Compose/Components/EditorPlayfieldBorder.cs (93%) rename osu.Game/Screens/Edit/{Screens => }/Compose/Components/SelectionBox.cs (98%) rename osu.Game/Screens/Edit/{Screens => }/Compose/Components/Timeline/CentreMarker.cs (95%) rename osu.Game/Screens/Edit/{Screens => }/Compose/Components/Timeline/Timeline.cs (98%) rename osu.Game/Screens/Edit/{Screens => }/Compose/Components/Timeline/TimelineArea.cs (98%) rename osu.Game/Screens/Edit/{Screens => }/Compose/Components/Timeline/TimelineButton.cs (95%) rename osu.Game/Screens/Edit/{Screens => }/Compose/Components/Timeline/ZoomableScrollContainer.cs (98%) rename osu.Game/Screens/Edit/{Screens => }/Compose/Compose.cs (96%) rename osu.Game/Screens/Edit/{Screens => }/Compose/IPlacementHandler.cs (95%) rename osu.Game/Screens/Edit/{Screens => }/Design/Design.cs (97%) rename osu.Game/Screens/Edit/{Screens => }/EditorScreen.cs (97%) rename osu.Game/Screens/Edit/{Screens => }/EditorScreenMode.cs (91%) rename osu.Game/Screens/Edit/{Screens => }/Setup/Components/LabelledComponents/LabelledTextBox.cs (98%) diff --git a/osu.Game.Tests/Visual/TestCaseBeatDivisorControl.cs b/osu.Game.Tests/Visual/TestCaseBeatDivisorControl.cs index 9709721686..6c607acd11 100644 --- a/osu.Game.Tests/Visual/TestCaseBeatDivisorControl.cs +++ b/osu.Game.Tests/Visual/TestCaseBeatDivisorControl.cs @@ -5,8 +5,8 @@ using System; using System.Collections.Generic; using osu.Framework.Allocation; using osu.Framework.Graphics; -using osu.Game.Screens.Edit.Screens.Compose; -using osu.Game.Screens.Edit.Screens.Compose.Components; +using osu.Game.Screens.Edit; +using osu.Game.Screens.Edit.Compose.Components; using OpenTK; namespace osu.Game.Tests.Visual diff --git a/osu.Game.Tests/Visual/TestCaseEditorCompose.cs b/osu.Game.Tests/Visual/TestCaseEditorCompose.cs index e7bcfbf500..3e35ff3289 100644 --- a/osu.Game.Tests/Visual/TestCaseEditorCompose.cs +++ b/osu.Game.Tests/Visual/TestCaseEditorCompose.cs @@ -6,7 +6,7 @@ using System.Collections.Generic; using NUnit.Framework; using osu.Framework.Allocation; using osu.Game.Rulesets.Osu; -using osu.Game.Screens.Edit.Screens.Compose; +using osu.Game.Screens.Edit.Compose; using osu.Game.Tests.Beatmaps; namespace osu.Game.Tests.Visual diff --git a/osu.Game.Tests/Visual/TestCaseEditorComposeTimeline.cs b/osu.Game.Tests/Visual/TestCaseEditorComposeTimeline.cs index ef5341ed44..d2c1127f4c 100644 --- a/osu.Game.Tests/Visual/TestCaseEditorComposeTimeline.cs +++ b/osu.Game.Tests/Visual/TestCaseEditorComposeTimeline.cs @@ -13,7 +13,7 @@ using osu.Framework.Graphics.Shapes; using osu.Framework.Graphics.UserInterface; using osu.Framework.Timing; using osu.Game.Beatmaps; -using osu.Game.Screens.Edit.Screens.Compose.Components.Timeline; +using osu.Game.Screens.Edit.Compose.Components.Timeline; using OpenTK.Graphics; namespace osu.Game.Tests.Visual diff --git a/osu.Game.Tests/Visual/TestCaseEditorMenuBar.cs b/osu.Game.Tests/Visual/TestCaseEditorMenuBar.cs index cb4438b2ba..eab799011d 100644 --- a/osu.Game.Tests/Visual/TestCaseEditorMenuBar.cs +++ b/osu.Game.Tests/Visual/TestCaseEditorMenuBar.cs @@ -8,7 +8,7 @@ using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.UserInterface; using osu.Game.Graphics.UserInterface; -using osu.Game.Screens.Edit.Menus; +using osu.Game.Screens.Edit.Components.Menus; namespace osu.Game.Tests.Visual { diff --git a/osu.Game.Tests/Visual/TestCaseHitObjectComposer.cs b/osu.Game.Tests/Visual/TestCaseHitObjectComposer.cs index 6525a7a634..ae9a28fcaf 100644 --- a/osu.Game.Tests/Visual/TestCaseHitObjectComposer.cs +++ b/osu.Game.Tests/Visual/TestCaseHitObjectComposer.cs @@ -16,8 +16,8 @@ using osu.Game.Rulesets.Osu.Edit; using osu.Game.Rulesets.Osu.Edit.Masks.HitCircleMasks; using osu.Game.Rulesets.Osu.Edit.Masks.HitCircleMasks.Components; using osu.Game.Rulesets.Osu.Objects; -using osu.Game.Screens.Edit.Screens.Compose; -using osu.Game.Screens.Edit.Screens.Compose.Components; +using osu.Game.Screens.Edit.Compose; +using osu.Game.Screens.Edit.Compose.Components; using osu.Game.Tests.Beatmaps; namespace osu.Game.Tests.Visual diff --git a/osu.Game.Tests/Visual/TestCaseLabelledTextBox.cs b/osu.Game.Tests/Visual/TestCaseLabelledTextBox.cs index d41739bfb5..e1470a860e 100644 --- a/osu.Game.Tests/Visual/TestCaseLabelledTextBox.cs +++ b/osu.Game.Tests/Visual/TestCaseLabelledTextBox.cs @@ -5,9 +5,9 @@ using NUnit.Framework; using osu.Framework.Allocation; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; -using osu.Game.Screens.Edit.Screens.Setup.Components.LabelledComponents; using System; using System.Collections.Generic; +using osu.Game.Screens.Edit.Setup.Components.LabelledComponents; namespace osu.Game.Tests.Visual { diff --git a/osu.Game.Tests/Visual/TestCaseZoomableScrollContainer.cs b/osu.Game.Tests/Visual/TestCaseZoomableScrollContainer.cs index 0f1ad197ac..3bf809ebde 100644 --- a/osu.Game.Tests/Visual/TestCaseZoomableScrollContainer.cs +++ b/osu.Game.Tests/Visual/TestCaseZoomableScrollContainer.cs @@ -10,7 +10,7 @@ using osu.Framework.Graphics.Shapes; using osu.Framework.MathUtils; using osu.Game.Graphics; using osu.Game.Graphics.Cursor; -using osu.Game.Screens.Edit.Screens.Compose.Components.Timeline; +using osu.Game.Screens.Edit.Compose.Components.Timeline; using OpenTK; using OpenTK.Graphics; diff --git a/osu.Game/Rulesets/Edit/HitObjectComposer.cs b/osu.Game/Rulesets/Edit/HitObjectComposer.cs index b515e9a257..485c1921cf 100644 --- a/osu.Game/Rulesets/Edit/HitObjectComposer.cs +++ b/osu.Game/Rulesets/Edit/HitObjectComposer.cs @@ -17,7 +17,7 @@ using osu.Game.Rulesets.Objects; using osu.Game.Rulesets.Objects.Drawables; using osu.Game.Rulesets.UI; using osu.Game.Screens.Edit.Components.RadioButtons; -using osu.Game.Screens.Edit.Screens.Compose.Components; +using osu.Game.Screens.Edit.Compose.Components; namespace osu.Game.Rulesets.Edit { diff --git a/osu.Game/Rulesets/Edit/PlacementBlueprint.cs b/osu.Game/Rulesets/Edit/PlacementBlueprint.cs index fe27d37640..b726b683ea 100644 --- a/osu.Game/Rulesets/Edit/PlacementBlueprint.cs +++ b/osu.Game/Rulesets/Edit/PlacementBlueprint.cs @@ -10,7 +10,7 @@ using osu.Framework.Input.Events; using osu.Framework.Timing; using osu.Game.Beatmaps; using osu.Game.Rulesets.Objects; -using osu.Game.Screens.Edit.Screens.Compose; +using osu.Game.Screens.Edit.Compose; using OpenTK; namespace osu.Game.Rulesets.Edit diff --git a/osu.Game/Screens/Edit/Screens/Compose/BindableBeatDivisor.cs b/osu.Game/Screens/Edit/BindableBeatDivisor.cs similarity index 96% rename from osu.Game/Screens/Edit/Screens/Compose/BindableBeatDivisor.cs rename to osu.Game/Screens/Edit/BindableBeatDivisor.cs index b7dce8c96e..3124482c73 100644 --- a/osu.Game/Screens/Edit/Screens/Compose/BindableBeatDivisor.cs +++ b/osu.Game/Screens/Edit/BindableBeatDivisor.cs @@ -5,7 +5,7 @@ using System; using System.Linq; using osu.Framework.Configuration; -namespace osu.Game.Screens.Edit.Screens.Compose +namespace osu.Game.Screens.Edit { public class BindableBeatDivisor : BindableNumber { diff --git a/osu.Game/Screens/Edit/Menus/EditorMenuBar.cs b/osu.Game/Screens/Edit/Components/Menus/EditorMenuBar.cs similarity index 98% rename from osu.Game/Screens/Edit/Menus/EditorMenuBar.cs rename to osu.Game/Screens/Edit/Components/Menus/EditorMenuBar.cs index af0a7b6694..4b5c13efbd 100644 --- a/osu.Game/Screens/Edit/Menus/EditorMenuBar.cs +++ b/osu.Game/Screens/Edit/Components/Menus/EditorMenuBar.cs @@ -2,19 +2,18 @@ // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE using osu.Framework.Allocation; +using osu.Framework.Configuration; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Shapes; using osu.Framework.Graphics.UserInterface; +using osu.Framework.Input.Events; using osu.Game.Graphics; using osu.Game.Graphics.UserInterface; using OpenTK; using OpenTK.Graphics; -using osu.Framework.Configuration; -using osu.Framework.Input.Events; -using osu.Game.Screens.Edit.Screens; -namespace osu.Game.Screens.Edit.Menus +namespace osu.Game.Screens.Edit.Components.Menus { public class EditorMenuBar : OsuMenu { diff --git a/osu.Game/Screens/Edit/Menus/EditorMenuItem.cs b/osu.Game/Screens/Edit/Components/Menus/EditorMenuItem.cs similarity index 92% rename from osu.Game/Screens/Edit/Menus/EditorMenuItem.cs rename to osu.Game/Screens/Edit/Components/Menus/EditorMenuItem.cs index 0ef1ad8c6b..1c9253cce7 100644 --- a/osu.Game/Screens/Edit/Menus/EditorMenuItem.cs +++ b/osu.Game/Screens/Edit/Components/Menus/EditorMenuItem.cs @@ -4,7 +4,7 @@ using System; using osu.Game.Graphics.UserInterface; -namespace osu.Game.Screens.Edit.Menus +namespace osu.Game.Screens.Edit.Components.Menus { public class EditorMenuItem : OsuMenuItem { diff --git a/osu.Game/Screens/Edit/Menus/EditorMenuItemSpacer.cs b/osu.Game/Screens/Edit/Components/Menus/EditorMenuItemSpacer.cs similarity index 86% rename from osu.Game/Screens/Edit/Menus/EditorMenuItemSpacer.cs rename to osu.Game/Screens/Edit/Components/Menus/EditorMenuItemSpacer.cs index 91b40a2cfb..17ee88241e 100644 --- a/osu.Game/Screens/Edit/Menus/EditorMenuItemSpacer.cs +++ b/osu.Game/Screens/Edit/Components/Menus/EditorMenuItemSpacer.cs @@ -1,7 +1,7 @@ // Copyright (c) 2007-2018 ppy Pty Ltd . // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE -namespace osu.Game.Screens.Edit.Menus +namespace osu.Game.Screens.Edit.Components.Menus { public class EditorMenuItemSpacer : EditorMenuItem { diff --git a/osu.Game/Screens/Edit/Menus/ScreenSelectionTabControl.cs b/osu.Game/Screens/Edit/Components/Menus/ScreenSelectionTabControl.cs similarity index 96% rename from osu.Game/Screens/Edit/Menus/ScreenSelectionTabControl.cs rename to osu.Game/Screens/Edit/Components/Menus/ScreenSelectionTabControl.cs index f58e5b39eb..4ff01c0f90 100644 --- a/osu.Game/Screens/Edit/Menus/ScreenSelectionTabControl.cs +++ b/osu.Game/Screens/Edit/Components/Menus/ScreenSelectionTabControl.cs @@ -1,7 +1,6 @@ // Copyright (c) 2007-2018 ppy Pty Ltd . // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE -using OpenTK.Graphics; using osu.Framework.Allocation; using osu.Framework.Extensions.Color4Extensions; using osu.Framework.Graphics; @@ -9,10 +8,10 @@ using osu.Framework.Graphics.Shapes; using osu.Framework.Graphics.UserInterface; using osu.Game.Graphics; using osu.Game.Graphics.UserInterface; -using osu.Game.Screens.Edit.Screens; using OpenTK; +using OpenTK.Graphics; -namespace osu.Game.Screens.Edit.Menus +namespace osu.Game.Screens.Edit.Components.Menus { public class ScreenSelectionTabControl : OsuTabControl { diff --git a/osu.Game/Screens/Edit/Screens/Compose/Components/BeatDivisorControl.cs b/osu.Game/Screens/Edit/Compose/Components/BeatDivisorControl.cs similarity index 99% rename from osu.Game/Screens/Edit/Screens/Compose/Components/BeatDivisorControl.cs rename to osu.Game/Screens/Edit/Compose/Components/BeatDivisorControl.cs index b64bbaf215..a5a1f590bf 100644 --- a/osu.Game/Screens/Edit/Screens/Compose/Components/BeatDivisorControl.cs +++ b/osu.Game/Screens/Edit/Compose/Components/BeatDivisorControl.cs @@ -19,7 +19,7 @@ using OpenTK; using OpenTK.Graphics; using OpenTK.Input; -namespace osu.Game.Screens.Edit.Screens.Compose.Components +namespace osu.Game.Screens.Edit.Compose.Components { public class BeatDivisorControl : CompositeDrawable { diff --git a/osu.Game/Screens/Edit/Screens/Compose/Components/BlueprintContainer.cs b/osu.Game/Screens/Edit/Compose/Components/BlueprintContainer.cs similarity index 99% rename from osu.Game/Screens/Edit/Screens/Compose/Components/BlueprintContainer.cs rename to osu.Game/Screens/Edit/Compose/Components/BlueprintContainer.cs index 079d755318..45003545a3 100644 --- a/osu.Game/Screens/Edit/Screens/Compose/Components/BlueprintContainer.cs +++ b/osu.Game/Screens/Edit/Compose/Components/BlueprintContainer.cs @@ -14,7 +14,7 @@ using osu.Game.Rulesets.Edit.Tools; using osu.Game.Rulesets.Objects.Drawables; using OpenTK; -namespace osu.Game.Screens.Edit.Screens.Compose.Components +namespace osu.Game.Screens.Edit.Compose.Components { public class BlueprintContainer : CompositeDrawable { diff --git a/osu.Game/Screens/Edit/Screens/Compose/Components/DragBox.cs b/osu.Game/Screens/Edit/Compose/Components/DragBox.cs similarity index 97% rename from osu.Game/Screens/Edit/Screens/Compose/Components/DragBox.cs rename to osu.Game/Screens/Edit/Compose/Components/DragBox.cs index d13030d7bb..1a58f476ac 100644 --- a/osu.Game/Screens/Edit/Screens/Compose/Components/DragBox.cs +++ b/osu.Game/Screens/Edit/Compose/Components/DragBox.cs @@ -10,7 +10,7 @@ using osu.Framework.Graphics.Shapes; using osu.Framework.Input.Events; using OpenTK.Graphics; -namespace osu.Game.Screens.Edit.Screens.Compose.Components +namespace osu.Game.Screens.Edit.Compose.Components { /// /// A box that displays the drag selection and provides selection events for users to handle. diff --git a/osu.Game/Screens/Edit/Screens/Compose/Components/EditorPlayfieldBorder.cs b/osu.Game/Screens/Edit/Compose/Components/EditorPlayfieldBorder.cs similarity index 93% rename from osu.Game/Screens/Edit/Screens/Compose/Components/EditorPlayfieldBorder.cs rename to osu.Game/Screens/Edit/Compose/Components/EditorPlayfieldBorder.cs index f1fb3633e2..4956b7759f 100644 --- a/osu.Game/Screens/Edit/Screens/Compose/Components/EditorPlayfieldBorder.cs +++ b/osu.Game/Screens/Edit/Compose/Components/EditorPlayfieldBorder.cs @@ -6,7 +6,7 @@ using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Shapes; using OpenTK.Graphics; -namespace osu.Game.Screens.Edit.Screens.Compose.Components +namespace osu.Game.Screens.Edit.Compose.Components { /// /// Provides a border around the playfield. diff --git a/osu.Game/Screens/Edit/Screens/Compose/Components/SelectionBox.cs b/osu.Game/Screens/Edit/Compose/Components/SelectionBox.cs similarity index 98% rename from osu.Game/Screens/Edit/Screens/Compose/Components/SelectionBox.cs rename to osu.Game/Screens/Edit/Compose/Components/SelectionBox.cs index 95906546db..e2a70a9ee7 100644 --- a/osu.Game/Screens/Edit/Screens/Compose/Components/SelectionBox.cs +++ b/osu.Game/Screens/Edit/Compose/Components/SelectionBox.cs @@ -16,7 +16,7 @@ using osu.Game.Rulesets.Edit.Types; using OpenTK; using OpenTK.Input; -namespace osu.Game.Screens.Edit.Screens.Compose.Components +namespace osu.Game.Screens.Edit.Compose.Components { /// /// A box which surrounds s and provides interactive handles, context menus etc. diff --git a/osu.Game/Screens/Edit/Screens/Compose/Components/Timeline/CentreMarker.cs b/osu.Game/Screens/Edit/Compose/Components/Timeline/CentreMarker.cs similarity index 95% rename from osu.Game/Screens/Edit/Screens/Compose/Components/Timeline/CentreMarker.cs rename to osu.Game/Screens/Edit/Compose/Components/Timeline/CentreMarker.cs index c1ba10d5d3..b2c6f02058 100644 --- a/osu.Game/Screens/Edit/Screens/Compose/Components/Timeline/CentreMarker.cs +++ b/osu.Game/Screens/Edit/Compose/Components/Timeline/CentreMarker.cs @@ -8,7 +8,7 @@ using osu.Framework.Graphics.Shapes; using osu.Game.Graphics; using OpenTK; -namespace osu.Game.Screens.Edit.Screens.Compose.Components.Timeline +namespace osu.Game.Screens.Edit.Compose.Components.Timeline { public class CentreMarker : CompositeDrawable { diff --git a/osu.Game/Screens/Edit/Screens/Compose/Components/Timeline/Timeline.cs b/osu.Game/Screens/Edit/Compose/Components/Timeline/Timeline.cs similarity index 98% rename from osu.Game/Screens/Edit/Screens/Compose/Components/Timeline/Timeline.cs rename to osu.Game/Screens/Edit/Compose/Components/Timeline/Timeline.cs index b27fa5d0c5..0c626f2c54 100644 --- a/osu.Game/Screens/Edit/Screens/Compose/Components/Timeline/Timeline.cs +++ b/osu.Game/Screens/Edit/Compose/Components/Timeline/Timeline.cs @@ -12,7 +12,7 @@ using osu.Framework.Timing; using osu.Game.Beatmaps; using osu.Game.Graphics; -namespace osu.Game.Screens.Edit.Screens.Compose.Components.Timeline +namespace osu.Game.Screens.Edit.Compose.Components.Timeline { public class Timeline : ZoomableScrollContainer { diff --git a/osu.Game/Screens/Edit/Screens/Compose/Components/Timeline/TimelineArea.cs b/osu.Game/Screens/Edit/Compose/Components/Timeline/TimelineArea.cs similarity index 98% rename from osu.Game/Screens/Edit/Screens/Compose/Components/Timeline/TimelineArea.cs rename to osu.Game/Screens/Edit/Compose/Components/Timeline/TimelineArea.cs index 51a713bc91..5b98140a3b 100644 --- a/osu.Game/Screens/Edit/Screens/Compose/Components/Timeline/TimelineArea.cs +++ b/osu.Game/Screens/Edit/Compose/Components/Timeline/TimelineArea.cs @@ -8,7 +8,7 @@ using osu.Game.Graphics; using osu.Game.Graphics.UserInterface; using OpenTK; -namespace osu.Game.Screens.Edit.Screens.Compose.Components.Timeline +namespace osu.Game.Screens.Edit.Compose.Components.Timeline { public class TimelineArea : CompositeDrawable { diff --git a/osu.Game/Screens/Edit/Screens/Compose/Components/Timeline/TimelineButton.cs b/osu.Game/Screens/Edit/Compose/Components/Timeline/TimelineButton.cs similarity index 95% rename from osu.Game/Screens/Edit/Screens/Compose/Components/Timeline/TimelineButton.cs rename to osu.Game/Screens/Edit/Compose/Components/Timeline/TimelineButton.cs index fbabbd54a0..d481934347 100644 --- a/osu.Game/Screens/Edit/Screens/Compose/Components/Timeline/TimelineButton.cs +++ b/osu.Game/Screens/Edit/Compose/Components/Timeline/TimelineButton.cs @@ -10,7 +10,7 @@ using osu.Game.Graphics.UserInterface; using OpenTK; using OpenTK.Graphics; -namespace osu.Game.Screens.Edit.Screens.Compose.Components.Timeline +namespace osu.Game.Screens.Edit.Compose.Components.Timeline { public class TimelineButton : CompositeDrawable { diff --git a/osu.Game/Screens/Edit/Screens/Compose/Components/Timeline/ZoomableScrollContainer.cs b/osu.Game/Screens/Edit/Compose/Components/Timeline/ZoomableScrollContainer.cs similarity index 98% rename from osu.Game/Screens/Edit/Screens/Compose/Components/Timeline/ZoomableScrollContainer.cs rename to osu.Game/Screens/Edit/Compose/Components/Timeline/ZoomableScrollContainer.cs index a85bbb0198..8d39f61d89 100644 --- a/osu.Game/Screens/Edit/Screens/Compose/Components/Timeline/ZoomableScrollContainer.cs +++ b/osu.Game/Screens/Edit/Compose/Components/Timeline/ZoomableScrollContainer.cs @@ -9,7 +9,7 @@ using osu.Framework.Input.Events; using osu.Framework.MathUtils; using OpenTK; -namespace osu.Game.Screens.Edit.Screens.Compose.Components.Timeline +namespace osu.Game.Screens.Edit.Compose.Components.Timeline { public class ZoomableScrollContainer : ScrollContainer { diff --git a/osu.Game/Screens/Edit/Screens/Compose/Compose.cs b/osu.Game/Screens/Edit/Compose/Compose.cs similarity index 96% rename from osu.Game/Screens/Edit/Screens/Compose/Compose.cs rename to osu.Game/Screens/Edit/Compose/Compose.cs index 1e6e9792f3..f11bd89ec5 100644 --- a/osu.Game/Screens/Edit/Screens/Compose/Compose.cs +++ b/osu.Game/Screens/Edit/Compose/Compose.cs @@ -3,7 +3,6 @@ using JetBrains.Annotations; using osu.Framework.Allocation; -using OpenTK.Graphics; using osu.Framework.Extensions.Color4Extensions; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; @@ -11,10 +10,11 @@ using osu.Framework.Graphics.Shapes; using osu.Framework.Logging; using osu.Game.Rulesets.Edit; using osu.Game.Rulesets.Objects; -using osu.Game.Screens.Edit.Screens.Compose.Components; -using osu.Game.Screens.Edit.Screens.Compose.Components.Timeline; +using osu.Game.Screens.Edit.Compose.Components; +using osu.Game.Screens.Edit.Compose.Components.Timeline; +using OpenTK.Graphics; -namespace osu.Game.Screens.Edit.Screens.Compose +namespace osu.Game.Screens.Edit.Compose { [Cached(Type = typeof(IPlacementHandler))] public class Compose : EditorScreen, IPlacementHandler diff --git a/osu.Game/Screens/Edit/Screens/Compose/IPlacementHandler.cs b/osu.Game/Screens/Edit/Compose/IPlacementHandler.cs similarity index 95% rename from osu.Game/Screens/Edit/Screens/Compose/IPlacementHandler.cs rename to osu.Game/Screens/Edit/Compose/IPlacementHandler.cs index cd213c2885..f93b294536 100644 --- a/osu.Game/Screens/Edit/Screens/Compose/IPlacementHandler.cs +++ b/osu.Game/Screens/Edit/Compose/IPlacementHandler.cs @@ -3,7 +3,7 @@ using osu.Game.Rulesets.Objects; -namespace osu.Game.Screens.Edit.Screens.Compose +namespace osu.Game.Screens.Edit.Compose { public interface IPlacementHandler { diff --git a/osu.Game/Screens/Edit/Screens/Design/Design.cs b/osu.Game/Screens/Edit/Design/Design.cs similarity index 97% rename from osu.Game/Screens/Edit/Screens/Design/Design.cs rename to osu.Game/Screens/Edit/Design/Design.cs index 052a1c1d90..4204286f9a 100644 --- a/osu.Game/Screens/Edit/Screens/Design/Design.cs +++ b/osu.Game/Screens/Edit/Design/Design.cs @@ -7,7 +7,7 @@ using osu.Framework.Graphics.Shapes; using osu.Game.Graphics.Sprites; using OpenTK.Graphics; -namespace osu.Game.Screens.Edit.Screens.Design +namespace osu.Game.Screens.Edit.Design { public class Design : EditorScreen { diff --git a/osu.Game/Screens/Edit/Editor.cs b/osu.Game/Screens/Edit/Editor.cs index 62cf76ef69..19211e82aa 100644 --- a/osu.Game/Screens/Edit/Editor.cs +++ b/osu.Game/Screens/Edit/Editor.cs @@ -8,7 +8,6 @@ using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Shapes; using osu.Game.Graphics; -using osu.Game.Screens.Edit.Menus; using osu.Game.Screens.Edit.Components.Timelines.Summary; using osu.Framework.Allocation; using osu.Framework.Graphics.UserInterface; @@ -16,10 +15,8 @@ using osu.Framework.Input.Events; using osu.Framework.Platform; using osu.Framework.Timing; using osu.Game.Graphics.UserInterface; -using osu.Game.Screens.Edit.Screens; -using osu.Game.Screens.Edit.Screens.Compose; -using osu.Game.Screens.Edit.Screens.Design; using osu.Game.Screens.Edit.Components; +using osu.Game.Screens.Edit.Components.Menus; namespace osu.Game.Screens.Edit { @@ -169,10 +166,10 @@ namespace osu.Game.Screens.Edit switch (mode) { case EditorScreenMode.Compose: - currentScreen = new Compose(); + currentScreen = new Compose.Compose(); break; case EditorScreenMode.Design: - currentScreen = new Design(); + currentScreen = new Design.Design(); break; default: currentScreen = new EditorScreen(); diff --git a/osu.Game/Screens/Edit/EditorClock.cs b/osu.Game/Screens/Edit/EditorClock.cs index 1c40181ec9..5fa29d6005 100644 --- a/osu.Game/Screens/Edit/EditorClock.cs +++ b/osu.Game/Screens/Edit/EditorClock.cs @@ -7,7 +7,6 @@ using osu.Framework.MathUtils; using osu.Framework.Timing; using osu.Game.Beatmaps; using osu.Game.Beatmaps.ControlPoints; -using osu.Game.Screens.Edit.Screens.Compose; using OpenTK; namespace osu.Game.Screens.Edit diff --git a/osu.Game/Screens/Edit/Screens/EditorScreen.cs b/osu.Game/Screens/Edit/EditorScreen.cs similarity index 97% rename from osu.Game/Screens/Edit/Screens/EditorScreen.cs rename to osu.Game/Screens/Edit/EditorScreen.cs index f8402b9a9f..3a8fc3ef80 100644 --- a/osu.Game/Screens/Edit/Screens/EditorScreen.cs +++ b/osu.Game/Screens/Edit/EditorScreen.cs @@ -7,7 +7,7 @@ using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Game.Beatmaps; -namespace osu.Game.Screens.Edit.Screens +namespace osu.Game.Screens.Edit { /// /// TODO: eventually make this inherit Screen and add a local scren stack inside the Editor. diff --git a/osu.Game/Screens/Edit/Screens/EditorScreenMode.cs b/osu.Game/Screens/Edit/EditorScreenMode.cs similarity index 91% rename from osu.Game/Screens/Edit/Screens/EditorScreenMode.cs rename to osu.Game/Screens/Edit/EditorScreenMode.cs index be8363680d..17de6c4125 100644 --- a/osu.Game/Screens/Edit/Screens/EditorScreenMode.cs +++ b/osu.Game/Screens/Edit/EditorScreenMode.cs @@ -3,7 +3,7 @@ using System.ComponentModel; -namespace osu.Game.Screens.Edit.Screens +namespace osu.Game.Screens.Edit { public enum EditorScreenMode { diff --git a/osu.Game/Screens/Edit/Screens/Setup/Components/LabelledComponents/LabelledTextBox.cs b/osu.Game/Screens/Edit/Setup/Components/LabelledComponents/LabelledTextBox.cs similarity index 98% rename from osu.Game/Screens/Edit/Screens/Setup/Components/LabelledComponents/LabelledTextBox.cs rename to osu.Game/Screens/Edit/Setup/Components/LabelledComponents/LabelledTextBox.cs index 94200b7f4e..626c59981c 100644 --- a/osu.Game/Screens/Edit/Screens/Setup/Components/LabelledComponents/LabelledTextBox.cs +++ b/osu.Game/Screens/Edit/Setup/Components/LabelledComponents/LabelledTextBox.cs @@ -2,7 +2,6 @@ // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE using osu.Framework.Allocation; -using OpenTK.Graphics; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Shapes; @@ -10,8 +9,9 @@ using osu.Framework.Graphics.UserInterface; using osu.Game.Graphics; using osu.Game.Graphics.Sprites; using osu.Game.Graphics.UserInterface; +using OpenTK.Graphics; -namespace osu.Game.Screens.Edit.Screens.Setup.Components.LabelledComponents +namespace osu.Game.Screens.Edit.Setup.Components.LabelledComponents { public class LabelledTextBox : CompositeDrawable { diff --git a/osu.Game/Tests/Visual/EditorClockTestCase.cs b/osu.Game/Tests/Visual/EditorClockTestCase.cs index ebede74171..479ed385e2 100644 --- a/osu.Game/Tests/Visual/EditorClockTestCase.cs +++ b/osu.Game/Tests/Visual/EditorClockTestCase.cs @@ -7,7 +7,6 @@ using osu.Framework.Timing; using osu.Game.Beatmaps; using osu.Game.Beatmaps.ControlPoints; using osu.Game.Screens.Edit; -using osu.Game.Screens.Edit.Screens.Compose; namespace osu.Game.Tests.Visual { diff --git a/osu.Game/Tests/Visual/EditorTestCase.cs b/osu.Game/Tests/Visual/EditorTestCase.cs index 2ab121fcc9..2d02509b58 100644 --- a/osu.Game/Tests/Visual/EditorTestCase.cs +++ b/osu.Game/Tests/Visual/EditorTestCase.cs @@ -6,7 +6,6 @@ using System.Collections.Generic; using osu.Framework.Allocation; using osu.Game.Rulesets; using osu.Game.Screens.Edit; -using osu.Game.Screens.Edit.Screens; using osu.Game.Tests.Beatmaps; namespace osu.Game.Tests.Visual diff --git a/osu.Game/Tests/Visual/PlacementBlueprintTestCase.cs b/osu.Game/Tests/Visual/PlacementBlueprintTestCase.cs index 6cc8408998..5c6cb96e44 100644 --- a/osu.Game/Tests/Visual/PlacementBlueprintTestCase.cs +++ b/osu.Game/Tests/Visual/PlacementBlueprintTestCase.cs @@ -8,7 +8,7 @@ using osu.Framework.Timing; using osu.Game.Rulesets.Edit; using osu.Game.Rulesets.Objects; using osu.Game.Rulesets.Objects.Drawables; -using osu.Game.Screens.Edit.Screens.Compose; +using osu.Game.Screens.Edit.Compose; namespace osu.Game.Tests.Visual { From e9e50f41fbb0f9183d3683050dd0c3292cc9572c Mon Sep 17 00:00:00 2001 From: smoogipoo Date: Wed, 7 Nov 2018 13:04:17 +0900 Subject: [PATCH 411/417] Use Name/NameScreen format --- osu.Game.Tests/Visual/TestCaseEditorCompose.cs | 4 ++-- .../Screens/Edit/Compose/{Compose.cs => ComposeScreen.cs} | 2 +- osu.Game/Screens/Edit/Design/{Design.cs => DesignScreen.cs} | 4 ++-- osu.Game/Screens/Edit/Editor.cs | 6 ++++-- 4 files changed, 9 insertions(+), 7 deletions(-) rename osu.Game/Screens/Edit/Compose/{Compose.cs => ComposeScreen.cs} (98%) rename osu.Game/Screens/Edit/Design/{Design.cs => DesignScreen.cs} (95%) diff --git a/osu.Game.Tests/Visual/TestCaseEditorCompose.cs b/osu.Game.Tests/Visual/TestCaseEditorCompose.cs index 3e35ff3289..5c53fdfac4 100644 --- a/osu.Game.Tests/Visual/TestCaseEditorCompose.cs +++ b/osu.Game.Tests/Visual/TestCaseEditorCompose.cs @@ -14,13 +14,13 @@ namespace osu.Game.Tests.Visual [TestFixture] public class TestCaseEditorCompose : EditorClockTestCase { - public override IReadOnlyList RequiredTypes => new[] { typeof(Compose) }; + public override IReadOnlyList RequiredTypes => new[] { typeof(ComposeScreen) }; [BackgroundDependencyLoader] private void load() { Beatmap.Value = new TestWorkingBeatmap(new OsuRuleset().RulesetInfo); - Child = new Compose(); + Child = new ComposeScreen(); } } } diff --git a/osu.Game/Screens/Edit/Compose/Compose.cs b/osu.Game/Screens/Edit/Compose/ComposeScreen.cs similarity index 98% rename from osu.Game/Screens/Edit/Compose/Compose.cs rename to osu.Game/Screens/Edit/Compose/ComposeScreen.cs index f11bd89ec5..30962d5536 100644 --- a/osu.Game/Screens/Edit/Compose/Compose.cs +++ b/osu.Game/Screens/Edit/Compose/ComposeScreen.cs @@ -17,7 +17,7 @@ using OpenTK.Graphics; namespace osu.Game.Screens.Edit.Compose { [Cached(Type = typeof(IPlacementHandler))] - public class Compose : EditorScreen, IPlacementHandler + public class ComposeScreen : EditorScreen, IPlacementHandler { private const float vertical_margins = 10; private const float horizontal_margins = 20; diff --git a/osu.Game/Screens/Edit/Design/Design.cs b/osu.Game/Screens/Edit/Design/DesignScreen.cs similarity index 95% rename from osu.Game/Screens/Edit/Design/Design.cs rename to osu.Game/Screens/Edit/Design/DesignScreen.cs index 4204286f9a..e99e352653 100644 --- a/osu.Game/Screens/Edit/Design/Design.cs +++ b/osu.Game/Screens/Edit/Design/DesignScreen.cs @@ -9,9 +9,9 @@ using OpenTK.Graphics; namespace osu.Game.Screens.Edit.Design { - public class Design : EditorScreen + public class DesignScreen : EditorScreen { - public Design() + public DesignScreen() { Add(new Container { diff --git a/osu.Game/Screens/Edit/Editor.cs b/osu.Game/Screens/Edit/Editor.cs index 19211e82aa..524f049284 100644 --- a/osu.Game/Screens/Edit/Editor.cs +++ b/osu.Game/Screens/Edit/Editor.cs @@ -17,6 +17,8 @@ using osu.Framework.Timing; using osu.Game.Graphics.UserInterface; using osu.Game.Screens.Edit.Components; using osu.Game.Screens.Edit.Components.Menus; +using osu.Game.Screens.Edit.Compose; +using osu.Game.Screens.Edit.Design; namespace osu.Game.Screens.Edit { @@ -166,10 +168,10 @@ namespace osu.Game.Screens.Edit switch (mode) { case EditorScreenMode.Compose: - currentScreen = new Compose.Compose(); + currentScreen = new ComposeScreen(); break; case EditorScreenMode.Design: - currentScreen = new Design.Design(); + currentScreen = new DesignScreen(); break; default: currentScreen = new EditorScreen(); From 4277cb0d59a40d6940ad6a003ec8f2a7df8bd878 Mon Sep 17 00:00:00 2001 From: smoogipoo Date: Wed, 7 Nov 2018 15:04:48 +0900 Subject: [PATCH 412/417] Adjust some missed renames --- .../TestCaseHitCirclePlacementBlueprint.cs | 2 +- .../TestCaseHitCircleSelectionBlueprint.cs | 2 +- .../TestCaseSliderPlacementBlueprint.cs | 2 +- .../TestCaseSliderSelectionBlueprint.cs | 2 +- .../TestCaseSpinnerPlacementBlueprint.cs | 2 +- .../TestCaseSpinnerSelectionBlueprint.cs | 2 +- osu.Game/Tests/Visual/PlacementBlueprintTestCase.cs | 6 +++--- osu.Game/Tests/Visual/SelectionBlueprintTestCase.cs | 4 ++-- 8 files changed, 11 insertions(+), 11 deletions(-) diff --git a/osu.Game.Rulesets.Osu.Tests/TestCaseHitCirclePlacementBlueprint.cs b/osu.Game.Rulesets.Osu.Tests/TestCaseHitCirclePlacementBlueprint.cs index 3aaccb3c45..06ff2cf186 100644 --- a/osu.Game.Rulesets.Osu.Tests/TestCaseHitCirclePlacementBlueprint.cs +++ b/osu.Game.Rulesets.Osu.Tests/TestCaseHitCirclePlacementBlueprint.cs @@ -14,6 +14,6 @@ namespace osu.Game.Rulesets.Osu.Tests public class TestCaseHitCirclePlacementBlueprint : PlacementBlueprintTestCase { protected override DrawableHitObject CreateHitObject(HitObject hitObject) => new DrawableHitCircle((HitCircle)hitObject); - protected override PlacementBlueprint CreateMask() => new HitCirclePlacementBlueprint(); + protected override PlacementBlueprint CreateBlueprint() => new HitCirclePlacementBlueprint(); } } diff --git a/osu.Game.Rulesets.Osu.Tests/TestCaseHitCircleSelectionBlueprint.cs b/osu.Game.Rulesets.Osu.Tests/TestCaseHitCircleSelectionBlueprint.cs index 843b6e83f2..674a7bdc3f 100644 --- a/osu.Game.Rulesets.Osu.Tests/TestCaseHitCircleSelectionBlueprint.cs +++ b/osu.Game.Rulesets.Osu.Tests/TestCaseHitCircleSelectionBlueprint.cs @@ -24,6 +24,6 @@ namespace osu.Game.Rulesets.Osu.Tests Add(drawableObject = new DrawableHitCircle(hitCircle)); } - protected override SelectionBlueprint CreateMask() => new HitCircleSelectionBlueprint(drawableObject); + protected override SelectionBlueprint CreateBlueprint() => new HitCircleSelectionBlueprint(drawableObject); } } diff --git a/osu.Game.Rulesets.Osu.Tests/TestCaseSliderPlacementBlueprint.cs b/osu.Game.Rulesets.Osu.Tests/TestCaseSliderPlacementBlueprint.cs index 43f2718c9a..97decfe114 100644 --- a/osu.Game.Rulesets.Osu.Tests/TestCaseSliderPlacementBlueprint.cs +++ b/osu.Game.Rulesets.Osu.Tests/TestCaseSliderPlacementBlueprint.cs @@ -14,6 +14,6 @@ namespace osu.Game.Rulesets.Osu.Tests public class TestCaseSliderPlacementBlueprint : PlacementBlueprintTestCase { protected override DrawableHitObject CreateHitObject(HitObject hitObject) => new DrawableSlider((Slider)hitObject); - protected override PlacementBlueprint CreateMask() => new SliderPlacementBlueprint(); + protected override PlacementBlueprint CreateBlueprint() => new SliderPlacementBlueprint(); } } diff --git a/osu.Game.Rulesets.Osu.Tests/TestCaseSliderSelectionBlueprint.cs b/osu.Game.Rulesets.Osu.Tests/TestCaseSliderSelectionBlueprint.cs index 43c11b4441..ae16d90601 100644 --- a/osu.Game.Rulesets.Osu.Tests/TestCaseSliderSelectionBlueprint.cs +++ b/osu.Game.Rulesets.Osu.Tests/TestCaseSliderSelectionBlueprint.cs @@ -50,6 +50,6 @@ namespace osu.Game.Rulesets.Osu.Tests Add(drawableObject = new DrawableSlider(slider)); } - protected override SelectionBlueprint CreateMask() => new SliderSelectionBlueprint(drawableObject); + protected override SelectionBlueprint CreateBlueprint() => new SliderSelectionBlueprint(drawableObject); } } diff --git a/osu.Game.Rulesets.Osu.Tests/TestCaseSpinnerPlacementBlueprint.cs b/osu.Game.Rulesets.Osu.Tests/TestCaseSpinnerPlacementBlueprint.cs index 4b1dc62452..2abcb2d161 100644 --- a/osu.Game.Rulesets.Osu.Tests/TestCaseSpinnerPlacementBlueprint.cs +++ b/osu.Game.Rulesets.Osu.Tests/TestCaseSpinnerPlacementBlueprint.cs @@ -15,6 +15,6 @@ namespace osu.Game.Rulesets.Osu.Tests { protected override DrawableHitObject CreateHitObject(HitObject hitObject) => new DrawableSpinner((Spinner)hitObject); - protected override PlacementBlueprint CreateMask() => new SpinnerPlacementBlueprint(); + protected override PlacementBlueprint CreateBlueprint() => new SpinnerPlacementBlueprint(); } } diff --git a/osu.Game.Rulesets.Osu.Tests/TestCaseSpinnerSelectionBlueprint.cs b/osu.Game.Rulesets.Osu.Tests/TestCaseSpinnerSelectionBlueprint.cs index f94939b585..d8a0eb6796 100644 --- a/osu.Game.Rulesets.Osu.Tests/TestCaseSpinnerSelectionBlueprint.cs +++ b/osu.Game.Rulesets.Osu.Tests/TestCaseSpinnerSelectionBlueprint.cs @@ -45,6 +45,6 @@ namespace osu.Game.Rulesets.Osu.Tests }); } - protected override SelectionBlueprint CreateMask() => new SpinnerSelectionBlueprint(drawableSpinner) { Size = new Vector2(0.5f) }; + protected override SelectionBlueprint CreateBlueprint() => new SpinnerSelectionBlueprint(drawableSpinner) { Size = new Vector2(0.5f) }; } } diff --git a/osu.Game/Tests/Visual/PlacementBlueprintTestCase.cs b/osu.Game/Tests/Visual/PlacementBlueprintTestCase.cs index 5c6cb96e44..f893d8456b 100644 --- a/osu.Game/Tests/Visual/PlacementBlueprintTestCase.cs +++ b/osu.Game/Tests/Visual/PlacementBlueprintTestCase.cs @@ -32,7 +32,7 @@ namespace osu.Game.Tests.Visual [BackgroundDependencyLoader] private void load() { - Add(currentBlueprint = CreateMask()); + Add(currentBlueprint = CreateBlueprint()); } protected override IReadOnlyDependencyContainer CreateChildDependencies(IReadOnlyDependencyContainer parent) @@ -52,7 +52,7 @@ namespace osu.Game.Tests.Visual hitObjectContainer.Add(CreateHitObject(hitObject)); Remove(currentBlueprint); - Add(currentBlueprint = CreateMask()); + Add(currentBlueprint = CreateBlueprint()); } public void Delete(HitObject hitObject) @@ -60,6 +60,6 @@ namespace osu.Game.Tests.Visual } protected abstract DrawableHitObject CreateHitObject(HitObject hitObject); - protected abstract PlacementBlueprint CreateMask(); + protected abstract PlacementBlueprint CreateBlueprint(); } } diff --git a/osu.Game/Tests/Visual/SelectionBlueprintTestCase.cs b/osu.Game/Tests/Visual/SelectionBlueprintTestCase.cs index 1879b0c37f..b1df849a67 100644 --- a/osu.Game/Tests/Visual/SelectionBlueprintTestCase.cs +++ b/osu.Game/Tests/Visual/SelectionBlueprintTestCase.cs @@ -29,7 +29,7 @@ namespace osu.Game.Tests.Visual [BackgroundDependencyLoader] private void load() { - base.Content.Add(blueprint = CreateMask()); + base.Content.Add(blueprint = CreateBlueprint()); blueprint.SelectionRequested += (_, __) => blueprint.Select(); AddStep("Select", () => blueprint.Select()); @@ -42,6 +42,6 @@ namespace osu.Game.Tests.Visual return true; } - protected abstract SelectionBlueprint CreateMask(); + protected abstract SelectionBlueprint CreateBlueprint(); } } From cf4dad0fe8fbc5b71b126de29bbe134a51332fbf Mon Sep 17 00:00:00 2001 From: smoogipoo Date: Wed, 7 Nov 2018 15:42:40 +0900 Subject: [PATCH 413/417] Fix hitobjects not updating IsMaskedAway after being judged --- osu.Game/Rulesets/Objects/Drawables/DrawableHitObject.cs | 9 +-------- 1 file changed, 1 insertion(+), 8 deletions(-) diff --git a/osu.Game/Rulesets/Objects/Drawables/DrawableHitObject.cs b/osu.Game/Rulesets/Objects/Drawables/DrawableHitObject.cs index bcf84b375f..e9e9d93ed5 100644 --- a/osu.Game/Rulesets/Objects/Drawables/DrawableHitObject.cs +++ b/osu.Game/Rulesets/Objects/Drawables/DrawableHitObject.cs @@ -7,7 +7,6 @@ using System.Linq; using osu.Framework.Allocation; using osu.Framework.Configuration; using osu.Framework.Extensions.TypeExtensions; -using osu.Framework.Graphics; using osu.Framework.Graphics.Primitives; using osu.Game.Audio; using osu.Game.Graphics; @@ -167,13 +166,7 @@ namespace osu.Game.Rulesets.Objects.Drawables } } - public override bool UpdateSubTreeMasking(Drawable source, RectangleF maskingBounds) - { - if (!AllJudged) - return false; - - return base.UpdateSubTreeMasking(source, maskingBounds); - } + protected override bool ComputeIsMaskedAway(RectangleF maskingBounds) => AllJudged && base.ComputeIsMaskedAway(maskingBounds); protected override void UpdateAfterChildren() { From 2612fd3099b642c2db042c001e856ef62f719688 Mon Sep 17 00:00:00 2001 From: smoogipoo Date: Wed, 7 Nov 2018 16:08:56 +0900 Subject: [PATCH 414/417] Adjust ruleset-specific namespaces --- .../{Masks => Blueprints}/HoldNoteSelectionBlueprint.cs | 2 +- .../Edit/{Masks => Blueprints}/NoteSelectionBlueprint.cs | 2 +- osu.Game.Rulesets.Mania/Edit/ManiaHitObjectComposer.cs | 2 +- .../TestCaseHitCirclePlacementBlueprint.cs | 2 +- .../TestCaseHitCircleSelectionBlueprint.cs | 2 +- .../TestCaseSliderPlacementBlueprint.cs | 2 +- .../TestCaseSliderSelectionBlueprint.cs | 4 ++-- .../TestCaseSpinnerPlacementBlueprint.cs | 2 +- .../TestCaseSpinnerSelectionBlueprint.cs | 4 ++-- .../HitCircles}/Components/HitCirclePiece.cs | 2 +- .../HitCircles}/HitCirclePlacementBlueprint.cs | 4 ++-- .../HitCircles}/HitCircleSelectionBlueprint.cs | 4 ++-- .../Sliders}/Components/PathControlPointPiece.cs | 2 +- .../Sliders}/Components/PathControlPointVisualiser.cs | 2 +- .../Sliders}/Components/SliderBodyPiece.cs | 2 +- .../Sliders}/Components/SliderCirclePiece.cs | 4 ++-- .../Sliders}/SliderCircleSelectionBlueprint.cs | 4 ++-- .../Sliders}/SliderPlacementBlueprint.cs | 4 ++-- .../SliderMasks => Blueprints/Sliders}/SliderPosition.cs | 2 +- .../Sliders}/SliderSelectionBlueprint.cs | 4 ++-- .../Spinners}/Components/SpinnerPiece.cs | 2 +- .../Spinners}/SpinnerPlacementBlueprint.cs | 4 ++-- .../Spinners}/SpinnerSelectionBlueprint.cs | 4 ++-- osu.Game.Rulesets.Osu/Edit/HitCircleCompositionTool.cs | 2 +- osu.Game.Rulesets.Osu/Edit/OsuHitObjectComposer.cs | 6 +++--- osu.Game.Rulesets.Osu/Edit/SliderCompositionTool.cs | 2 +- osu.Game.Rulesets.Osu/Edit/SpinnerCompositionTool.cs | 2 +- osu.Game.Tests/Visual/TestCaseHitObjectComposer.cs | 4 ++-- 28 files changed, 41 insertions(+), 41 deletions(-) rename osu.Game.Rulesets.Mania/Edit/{Masks => Blueprints}/HoldNoteSelectionBlueprint.cs (98%) rename osu.Game.Rulesets.Mania/Edit/{Masks => Blueprints}/NoteSelectionBlueprint.cs (95%) rename osu.Game.Rulesets.Osu/Edit/{Masks/HitCircleMasks => Blueprints/HitCircles}/Components/HitCirclePiece.cs (94%) rename osu.Game.Rulesets.Osu/Edit/{Masks/HitCircleMasks => Blueprints/HitCircles}/HitCirclePlacementBlueprint.cs (90%) rename osu.Game.Rulesets.Osu/Edit/{Masks/HitCircleMasks => Blueprints/HitCircles}/HitCircleSelectionBlueprint.cs (81%) rename osu.Game.Rulesets.Osu/Edit/{Masks/SliderMasks => Blueprints/Sliders}/Components/PathControlPointPiece.cs (98%) rename osu.Game.Rulesets.Osu/Edit/{Masks/SliderMasks => Blueprints/Sliders}/Components/PathControlPointVisualiser.cs (94%) rename osu.Game.Rulesets.Osu/Edit/{Masks/SliderMasks => Blueprints/Sliders}/Components/SliderBodyPiece.cs (95%) rename osu.Game.Rulesets.Osu/Edit/{Masks/SliderMasks => Blueprints/Sliders}/Components/SliderCirclePiece.cs (88%) rename osu.Game.Rulesets.Osu/Edit/{Masks/SliderMasks => Blueprints/Sliders}/SliderCircleSelectionBlueprint.cs (87%) rename osu.Game.Rulesets.Osu/Edit/{Masks/SliderMasks => Blueprints/Sliders}/SliderPlacementBlueprint.cs (97%) rename osu.Game.Rulesets.Osu/Edit/{Masks/SliderMasks => Blueprints/Sliders}/SliderPosition.cs (80%) rename osu.Game.Rulesets.Osu/Edit/{Masks/SliderMasks => Blueprints/Sliders}/SliderSelectionBlueprint.cs (90%) rename osu.Game.Rulesets.Osu/Edit/{Masks/SpinnerMasks => Blueprints/Spinners}/Components/SpinnerPiece.cs (96%) rename osu.Game.Rulesets.Osu/Edit/{Masks/SpinnerMasks => Blueprints/Spinners}/SpinnerPlacementBlueprint.cs (90%) rename osu.Game.Rulesets.Osu/Edit/{Masks/SpinnerMasks => Blueprints/Spinners}/SpinnerSelectionBlueprint.cs (85%) diff --git a/osu.Game.Rulesets.Mania/Edit/Masks/HoldNoteSelectionBlueprint.cs b/osu.Game.Rulesets.Mania/Edit/Blueprints/HoldNoteSelectionBlueprint.cs similarity index 98% rename from osu.Game.Rulesets.Mania/Edit/Masks/HoldNoteSelectionBlueprint.cs rename to osu.Game.Rulesets.Mania/Edit/Blueprints/HoldNoteSelectionBlueprint.cs index 14f045a549..0ede2a7b9d 100644 --- a/osu.Game.Rulesets.Mania/Edit/Masks/HoldNoteSelectionBlueprint.cs +++ b/osu.Game.Rulesets.Mania/Edit/Blueprints/HoldNoteSelectionBlueprint.cs @@ -13,7 +13,7 @@ using osu.Game.Rulesets.UI.Scrolling; using OpenTK; using OpenTK.Graphics; -namespace osu.Game.Rulesets.Mania.Edit.Masks +namespace osu.Game.Rulesets.Mania.Edit.Blueprints { public class HoldNoteSelectionBlueprint : SelectionBlueprint { diff --git a/osu.Game.Rulesets.Mania/Edit/Masks/NoteSelectionBlueprint.cs b/osu.Game.Rulesets.Mania/Edit/Blueprints/NoteSelectionBlueprint.cs similarity index 95% rename from osu.Game.Rulesets.Mania/Edit/Masks/NoteSelectionBlueprint.cs rename to osu.Game.Rulesets.Mania/Edit/Blueprints/NoteSelectionBlueprint.cs index 4be0da12e1..19726a368d 100644 --- a/osu.Game.Rulesets.Mania/Edit/Masks/NoteSelectionBlueprint.cs +++ b/osu.Game.Rulesets.Mania/Edit/Blueprints/NoteSelectionBlueprint.cs @@ -7,7 +7,7 @@ using osu.Game.Rulesets.Edit; using osu.Game.Rulesets.Mania.Objects.Drawables; using osu.Game.Rulesets.Mania.Objects.Drawables.Pieces; -namespace osu.Game.Rulesets.Mania.Edit.Masks +namespace osu.Game.Rulesets.Mania.Edit.Blueprints { public class NoteSelectionBlueprint : SelectionBlueprint { diff --git a/osu.Game.Rulesets.Mania/Edit/ManiaHitObjectComposer.cs b/osu.Game.Rulesets.Mania/Edit/ManiaHitObjectComposer.cs index 7420a3c64c..06d67821a9 100644 --- a/osu.Game.Rulesets.Mania/Edit/ManiaHitObjectComposer.cs +++ b/osu.Game.Rulesets.Mania/Edit/ManiaHitObjectComposer.cs @@ -11,7 +11,7 @@ using osu.Game.Rulesets.Objects.Drawables; using System.Collections.Generic; using osu.Framework.Allocation; using osu.Game.Rulesets.Mania.Configuration; -using osu.Game.Rulesets.Mania.Edit.Masks; +using osu.Game.Rulesets.Mania.Edit.Blueprints; using osu.Game.Rulesets.Mania.UI; using osu.Game.Rulesets.UI; diff --git a/osu.Game.Rulesets.Osu.Tests/TestCaseHitCirclePlacementBlueprint.cs b/osu.Game.Rulesets.Osu.Tests/TestCaseHitCirclePlacementBlueprint.cs index 06ff2cf186..313438a337 100644 --- a/osu.Game.Rulesets.Osu.Tests/TestCaseHitCirclePlacementBlueprint.cs +++ b/osu.Game.Rulesets.Osu.Tests/TestCaseHitCirclePlacementBlueprint.cs @@ -4,7 +4,7 @@ using osu.Game.Rulesets.Edit; using osu.Game.Rulesets.Objects; using osu.Game.Rulesets.Objects.Drawables; -using osu.Game.Rulesets.Osu.Edit.Masks.HitCircleMasks; +using osu.Game.Rulesets.Osu.Edit.Blueprints.HitCircles; using osu.Game.Rulesets.Osu.Objects; using osu.Game.Rulesets.Osu.Objects.Drawables; using osu.Game.Tests.Visual; diff --git a/osu.Game.Rulesets.Osu.Tests/TestCaseHitCircleSelectionBlueprint.cs b/osu.Game.Rulesets.Osu.Tests/TestCaseHitCircleSelectionBlueprint.cs index 674a7bdc3f..9662e0018f 100644 --- a/osu.Game.Rulesets.Osu.Tests/TestCaseHitCircleSelectionBlueprint.cs +++ b/osu.Game.Rulesets.Osu.Tests/TestCaseHitCircleSelectionBlueprint.cs @@ -4,7 +4,7 @@ using osu.Game.Beatmaps; using osu.Game.Beatmaps.ControlPoints; using osu.Game.Rulesets.Edit; -using osu.Game.Rulesets.Osu.Edit.Masks.HitCircleMasks; +using osu.Game.Rulesets.Osu.Edit.Blueprints.HitCircles; using osu.Game.Rulesets.Osu.Objects; using osu.Game.Rulesets.Osu.Objects.Drawables; using osu.Game.Tests.Visual; diff --git a/osu.Game.Rulesets.Osu.Tests/TestCaseSliderPlacementBlueprint.cs b/osu.Game.Rulesets.Osu.Tests/TestCaseSliderPlacementBlueprint.cs index 97decfe114..1f693ad9f4 100644 --- a/osu.Game.Rulesets.Osu.Tests/TestCaseSliderPlacementBlueprint.cs +++ b/osu.Game.Rulesets.Osu.Tests/TestCaseSliderPlacementBlueprint.cs @@ -4,7 +4,7 @@ using osu.Game.Rulesets.Edit; using osu.Game.Rulesets.Objects; using osu.Game.Rulesets.Objects.Drawables; -using osu.Game.Rulesets.Osu.Edit.Masks.SliderMasks; +using osu.Game.Rulesets.Osu.Edit.Blueprints.Sliders; using osu.Game.Rulesets.Osu.Objects; using osu.Game.Rulesets.Osu.Objects.Drawables; using osu.Game.Tests.Visual; diff --git a/osu.Game.Rulesets.Osu.Tests/TestCaseSliderSelectionBlueprint.cs b/osu.Game.Rulesets.Osu.Tests/TestCaseSliderSelectionBlueprint.cs index ae16d90601..78e3d76313 100644 --- a/osu.Game.Rulesets.Osu.Tests/TestCaseSliderSelectionBlueprint.cs +++ b/osu.Game.Rulesets.Osu.Tests/TestCaseSliderSelectionBlueprint.cs @@ -7,8 +7,8 @@ using osu.Game.Beatmaps; using osu.Game.Beatmaps.ControlPoints; using osu.Game.Rulesets.Edit; using osu.Game.Rulesets.Objects.Types; -using osu.Game.Rulesets.Osu.Edit.Masks.SliderMasks; -using osu.Game.Rulesets.Osu.Edit.Masks.SliderMasks.Components; +using osu.Game.Rulesets.Osu.Edit.Blueprints.Sliders; +using osu.Game.Rulesets.Osu.Edit.Blueprints.Sliders.Components; using osu.Game.Rulesets.Osu.Objects; using osu.Game.Rulesets.Osu.Objects.Drawables; using osu.Game.Tests.Visual; diff --git a/osu.Game.Rulesets.Osu.Tests/TestCaseSpinnerPlacementBlueprint.cs b/osu.Game.Rulesets.Osu.Tests/TestCaseSpinnerPlacementBlueprint.cs index 2abcb2d161..9a90be2582 100644 --- a/osu.Game.Rulesets.Osu.Tests/TestCaseSpinnerPlacementBlueprint.cs +++ b/osu.Game.Rulesets.Osu.Tests/TestCaseSpinnerPlacementBlueprint.cs @@ -4,7 +4,7 @@ using osu.Game.Rulesets.Edit; using osu.Game.Rulesets.Objects; using osu.Game.Rulesets.Objects.Drawables; -using osu.Game.Rulesets.Osu.Edit.Masks.SpinnerMasks; +using osu.Game.Rulesets.Osu.Edit.Blueprints.Spinners; using osu.Game.Rulesets.Osu.Objects; using osu.Game.Rulesets.Osu.Objects.Drawables; using osu.Game.Tests.Visual; diff --git a/osu.Game.Rulesets.Osu.Tests/TestCaseSpinnerSelectionBlueprint.cs b/osu.Game.Rulesets.Osu.Tests/TestCaseSpinnerSelectionBlueprint.cs index d8a0eb6796..a0cfd4487e 100644 --- a/osu.Game.Rulesets.Osu.Tests/TestCaseSpinnerSelectionBlueprint.cs +++ b/osu.Game.Rulesets.Osu.Tests/TestCaseSpinnerSelectionBlueprint.cs @@ -8,8 +8,8 @@ using osu.Framework.Graphics.Containers; using osu.Game.Beatmaps; using osu.Game.Beatmaps.ControlPoints; using osu.Game.Rulesets.Edit; -using osu.Game.Rulesets.Osu.Edit.Masks.SpinnerMasks; -using osu.Game.Rulesets.Osu.Edit.Masks.SpinnerMasks.Components; +using osu.Game.Rulesets.Osu.Edit.Blueprints.Spinners; +using osu.Game.Rulesets.Osu.Edit.Blueprints.Spinners.Components; using osu.Game.Rulesets.Osu.Objects; using osu.Game.Rulesets.Osu.Objects.Drawables; using osu.Game.Tests.Visual; diff --git a/osu.Game.Rulesets.Osu/Edit/Masks/HitCircleMasks/Components/HitCirclePiece.cs b/osu.Game.Rulesets.Osu/Edit/Blueprints/HitCircles/Components/HitCirclePiece.cs similarity index 94% rename from osu.Game.Rulesets.Osu/Edit/Masks/HitCircleMasks/Components/HitCirclePiece.cs rename to osu.Game.Rulesets.Osu/Edit/Blueprints/HitCircles/Components/HitCirclePiece.cs index c11ae096a7..9c33435285 100644 --- a/osu.Game.Rulesets.Osu/Edit/Masks/HitCircleMasks/Components/HitCirclePiece.cs +++ b/osu.Game.Rulesets.Osu/Edit/Blueprints/HitCircles/Components/HitCirclePiece.cs @@ -9,7 +9,7 @@ using osu.Game.Rulesets.Osu.Objects; using osu.Game.Rulesets.Osu.Objects.Drawables.Pieces; using OpenTK; -namespace osu.Game.Rulesets.Osu.Edit.Masks.HitCircleMasks.Components +namespace osu.Game.Rulesets.Osu.Edit.Blueprints.HitCircles.Components { public class HitCirclePiece : CompositeDrawable { diff --git a/osu.Game.Rulesets.Osu/Edit/Masks/HitCircleMasks/HitCirclePlacementBlueprint.cs b/osu.Game.Rulesets.Osu/Edit/Blueprints/HitCircles/HitCirclePlacementBlueprint.cs similarity index 90% rename from osu.Game.Rulesets.Osu/Edit/Masks/HitCircleMasks/HitCirclePlacementBlueprint.cs rename to osu.Game.Rulesets.Osu/Edit/Blueprints/HitCircles/HitCirclePlacementBlueprint.cs index ec32b7d74d..eddd399a4a 100644 --- a/osu.Game.Rulesets.Osu/Edit/Masks/HitCircleMasks/HitCirclePlacementBlueprint.cs +++ b/osu.Game.Rulesets.Osu/Edit/Blueprints/HitCircles/HitCirclePlacementBlueprint.cs @@ -3,10 +3,10 @@ using osu.Framework.Input.Events; using osu.Game.Rulesets.Edit; -using osu.Game.Rulesets.Osu.Edit.Masks.HitCircleMasks.Components; +using osu.Game.Rulesets.Osu.Edit.Blueprints.HitCircles.Components; using osu.Game.Rulesets.Osu.Objects; -namespace osu.Game.Rulesets.Osu.Edit.Masks.HitCircleMasks +namespace osu.Game.Rulesets.Osu.Edit.Blueprints.HitCircles { public class HitCirclePlacementBlueprint : PlacementBlueprint { diff --git a/osu.Game.Rulesets.Osu/Edit/Masks/HitCircleMasks/HitCircleSelectionBlueprint.cs b/osu.Game.Rulesets.Osu/Edit/Blueprints/HitCircles/HitCircleSelectionBlueprint.cs similarity index 81% rename from osu.Game.Rulesets.Osu/Edit/Masks/HitCircleMasks/HitCircleSelectionBlueprint.cs rename to osu.Game.Rulesets.Osu/Edit/Blueprints/HitCircles/HitCircleSelectionBlueprint.cs index 14eb97327c..9c4b804d77 100644 --- a/osu.Game.Rulesets.Osu/Edit/Masks/HitCircleMasks/HitCircleSelectionBlueprint.cs +++ b/osu.Game.Rulesets.Osu/Edit/Blueprints/HitCircles/HitCircleSelectionBlueprint.cs @@ -2,11 +2,11 @@ // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE using osu.Game.Rulesets.Edit; -using osu.Game.Rulesets.Osu.Edit.Masks.HitCircleMasks.Components; +using osu.Game.Rulesets.Osu.Edit.Blueprints.HitCircles.Components; using osu.Game.Rulesets.Osu.Objects; using osu.Game.Rulesets.Osu.Objects.Drawables; -namespace osu.Game.Rulesets.Osu.Edit.Masks.HitCircleMasks +namespace osu.Game.Rulesets.Osu.Edit.Blueprints.HitCircles { public class HitCircleSelectionBlueprint : SelectionBlueprint { diff --git a/osu.Game.Rulesets.Osu/Edit/Masks/SliderMasks/Components/PathControlPointPiece.cs b/osu.Game.Rulesets.Osu/Edit/Blueprints/Sliders/Components/PathControlPointPiece.cs similarity index 98% rename from osu.Game.Rulesets.Osu/Edit/Masks/SliderMasks/Components/PathControlPointPiece.cs rename to osu.Game.Rulesets.Osu/Edit/Blueprints/Sliders/Components/PathControlPointPiece.cs index 70156578b4..175e9d79f4 100644 --- a/osu.Game.Rulesets.Osu/Edit/Masks/SliderMasks/Components/PathControlPointPiece.cs +++ b/osu.Game.Rulesets.Osu/Edit/Blueprints/Sliders/Components/PathControlPointPiece.cs @@ -12,7 +12,7 @@ using osu.Game.Graphics; using osu.Game.Rulesets.Osu.Objects; using OpenTK; -namespace osu.Game.Rulesets.Osu.Edit.Masks.SliderMasks.Components +namespace osu.Game.Rulesets.Osu.Edit.Blueprints.Sliders.Components { public class PathControlPointPiece : CompositeDrawable { diff --git a/osu.Game.Rulesets.Osu/Edit/Masks/SliderMasks/Components/PathControlPointVisualiser.cs b/osu.Game.Rulesets.Osu/Edit/Blueprints/Sliders/Components/PathControlPointVisualiser.cs similarity index 94% rename from osu.Game.Rulesets.Osu/Edit/Masks/SliderMasks/Components/PathControlPointVisualiser.cs rename to osu.Game.Rulesets.Osu/Edit/Blueprints/Sliders/Components/PathControlPointVisualiser.cs index 1d25f8cd39..db8e879126 100644 --- a/osu.Game.Rulesets.Osu/Edit/Masks/SliderMasks/Components/PathControlPointVisualiser.cs +++ b/osu.Game.Rulesets.Osu/Edit/Blueprints/Sliders/Components/PathControlPointVisualiser.cs @@ -5,7 +5,7 @@ using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Game.Rulesets.Osu.Objects; -namespace osu.Game.Rulesets.Osu.Edit.Masks.SliderMasks.Components +namespace osu.Game.Rulesets.Osu.Edit.Blueprints.Sliders.Components { public class PathControlPointVisualiser : CompositeDrawable { diff --git a/osu.Game.Rulesets.Osu/Edit/Masks/SliderMasks/Components/SliderBodyPiece.cs b/osu.Game.Rulesets.Osu/Edit/Blueprints/Sliders/Components/SliderBodyPiece.cs similarity index 95% rename from osu.Game.Rulesets.Osu/Edit/Masks/SliderMasks/Components/SliderBodyPiece.cs rename to osu.Game.Rulesets.Osu/Edit/Blueprints/Sliders/Components/SliderBodyPiece.cs index 006c256d53..6fc7d39e6c 100644 --- a/osu.Game.Rulesets.Osu/Edit/Masks/SliderMasks/Components/SliderBodyPiece.cs +++ b/osu.Game.Rulesets.Osu/Edit/Blueprints/Sliders/Components/SliderBodyPiece.cs @@ -10,7 +10,7 @@ using osu.Game.Rulesets.Osu.Objects.Drawables.Pieces; using OpenTK; using OpenTK.Graphics; -namespace osu.Game.Rulesets.Osu.Edit.Masks.SliderMasks.Components +namespace osu.Game.Rulesets.Osu.Edit.Blueprints.Sliders.Components { public class SliderBodyPiece : CompositeDrawable { diff --git a/osu.Game.Rulesets.Osu/Edit/Masks/SliderMasks/Components/SliderCirclePiece.cs b/osu.Game.Rulesets.Osu/Edit/Blueprints/Sliders/Components/SliderCirclePiece.cs similarity index 88% rename from osu.Game.Rulesets.Osu/Edit/Masks/SliderMasks/Components/SliderCirclePiece.cs rename to osu.Game.Rulesets.Osu/Edit/Blueprints/Sliders/Components/SliderCirclePiece.cs index 7864429d93..a91739737f 100644 --- a/osu.Game.Rulesets.Osu/Edit/Masks/SliderMasks/Components/SliderCirclePiece.cs +++ b/osu.Game.Rulesets.Osu/Edit/Blueprints/Sliders/Components/SliderCirclePiece.cs @@ -1,10 +1,10 @@ // Copyright (c) 2007-2018 ppy Pty Ltd . // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE -using osu.Game.Rulesets.Osu.Edit.Masks.HitCircleMasks.Components; +using osu.Game.Rulesets.Osu.Edit.Blueprints.HitCircles.Components; using osu.Game.Rulesets.Osu.Objects; -namespace osu.Game.Rulesets.Osu.Edit.Masks.SliderMasks.Components +namespace osu.Game.Rulesets.Osu.Edit.Blueprints.Sliders.Components { public class SliderCirclePiece : HitCirclePiece { diff --git a/osu.Game.Rulesets.Osu/Edit/Masks/SliderMasks/SliderCircleSelectionBlueprint.cs b/osu.Game.Rulesets.Osu/Edit/Blueprints/Sliders/SliderCircleSelectionBlueprint.cs similarity index 87% rename from osu.Game.Rulesets.Osu/Edit/Masks/SliderMasks/SliderCircleSelectionBlueprint.cs rename to osu.Game.Rulesets.Osu/Edit/Blueprints/Sliders/SliderCircleSelectionBlueprint.cs index ab37079d42..99ebfecd93 100644 --- a/osu.Game.Rulesets.Osu/Edit/Masks/SliderMasks/SliderCircleSelectionBlueprint.cs +++ b/osu.Game.Rulesets.Osu/Edit/Blueprints/Sliders/SliderCircleSelectionBlueprint.cs @@ -2,11 +2,11 @@ // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE using osu.Game.Rulesets.Edit; -using osu.Game.Rulesets.Osu.Edit.Masks.SliderMasks.Components; +using osu.Game.Rulesets.Osu.Edit.Blueprints.Sliders.Components; using osu.Game.Rulesets.Osu.Objects; using osu.Game.Rulesets.Osu.Objects.Drawables; -namespace osu.Game.Rulesets.Osu.Edit.Masks.SliderMasks +namespace osu.Game.Rulesets.Osu.Edit.Blueprints.Sliders { public class SliderCircleSelectionBlueprint : SelectionBlueprint { diff --git a/osu.Game.Rulesets.Osu/Edit/Masks/SliderMasks/SliderPlacementBlueprint.cs b/osu.Game.Rulesets.Osu/Edit/Blueprints/Sliders/SliderPlacementBlueprint.cs similarity index 97% rename from osu.Game.Rulesets.Osu/Edit/Masks/SliderMasks/SliderPlacementBlueprint.cs rename to osu.Game.Rulesets.Osu/Edit/Blueprints/Sliders/SliderPlacementBlueprint.cs index bf2acc2f3c..add9cb69f3 100644 --- a/osu.Game.Rulesets.Osu/Edit/Masks/SliderMasks/SliderPlacementBlueprint.cs +++ b/osu.Game.Rulesets.Osu/Edit/Blueprints/Sliders/SliderPlacementBlueprint.cs @@ -12,11 +12,11 @@ using osu.Framework.MathUtils; using osu.Game.Graphics; using osu.Game.Rulesets.Edit; using osu.Game.Rulesets.Objects.Types; -using osu.Game.Rulesets.Osu.Edit.Masks.SliderMasks.Components; +using osu.Game.Rulesets.Osu.Edit.Blueprints.Sliders.Components; using OpenTK; using OpenTK.Input; -namespace osu.Game.Rulesets.Osu.Edit.Masks.SliderMasks +namespace osu.Game.Rulesets.Osu.Edit.Blueprints.Sliders { public class SliderPlacementBlueprint : PlacementBlueprint { diff --git a/osu.Game.Rulesets.Osu/Edit/Masks/SliderMasks/SliderPosition.cs b/osu.Game.Rulesets.Osu/Edit/Blueprints/Sliders/SliderPosition.cs similarity index 80% rename from osu.Game.Rulesets.Osu/Edit/Masks/SliderMasks/SliderPosition.cs rename to osu.Game.Rulesets.Osu/Edit/Blueprints/Sliders/SliderPosition.cs index 01c1871131..a117a7056e 100644 --- a/osu.Game.Rulesets.Osu/Edit/Masks/SliderMasks/SliderPosition.cs +++ b/osu.Game.Rulesets.Osu/Edit/Blueprints/Sliders/SliderPosition.cs @@ -1,7 +1,7 @@ // Copyright (c) 2007-2018 ppy Pty Ltd . // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE -namespace osu.Game.Rulesets.Osu.Edit.Masks.SliderMasks +namespace osu.Game.Rulesets.Osu.Edit.Blueprints.Sliders { public enum SliderPosition { diff --git a/osu.Game.Rulesets.Osu/Edit/Masks/SliderMasks/SliderSelectionBlueprint.cs b/osu.Game.Rulesets.Osu/Edit/Blueprints/Sliders/SliderSelectionBlueprint.cs similarity index 90% rename from osu.Game.Rulesets.Osu/Edit/Masks/SliderMasks/SliderSelectionBlueprint.cs rename to osu.Game.Rulesets.Osu/Edit/Blueprints/Sliders/SliderSelectionBlueprint.cs index adb8591550..430ddbdc38 100644 --- a/osu.Game.Rulesets.Osu/Edit/Masks/SliderMasks/SliderSelectionBlueprint.cs +++ b/osu.Game.Rulesets.Osu/Edit/Blueprints/Sliders/SliderSelectionBlueprint.cs @@ -3,12 +3,12 @@ using osu.Framework.Graphics; using osu.Game.Rulesets.Edit; -using osu.Game.Rulesets.Osu.Edit.Masks.SliderMasks.Components; +using osu.Game.Rulesets.Osu.Edit.Blueprints.Sliders.Components; using osu.Game.Rulesets.Osu.Objects; using osu.Game.Rulesets.Osu.Objects.Drawables; using OpenTK; -namespace osu.Game.Rulesets.Osu.Edit.Masks.SliderMasks +namespace osu.Game.Rulesets.Osu.Edit.Blueprints.Sliders { public class SliderSelectionBlueprint : SelectionBlueprint { diff --git a/osu.Game.Rulesets.Osu/Edit/Masks/SpinnerMasks/Components/SpinnerPiece.cs b/osu.Game.Rulesets.Osu/Edit/Blueprints/Spinners/Components/SpinnerPiece.cs similarity index 96% rename from osu.Game.Rulesets.Osu/Edit/Masks/SpinnerMasks/Components/SpinnerPiece.cs rename to osu.Game.Rulesets.Osu/Edit/Blueprints/Spinners/Components/SpinnerPiece.cs index 0d9609facf..bd63a3e607 100644 --- a/osu.Game.Rulesets.Osu/Edit/Masks/SpinnerMasks/Components/SpinnerPiece.cs +++ b/osu.Game.Rulesets.Osu/Edit/Blueprints/Spinners/Components/SpinnerPiece.cs @@ -10,7 +10,7 @@ using osu.Game.Rulesets.Osu.Objects; using osu.Game.Rulesets.Osu.Objects.Drawables.Pieces; using OpenTK; -namespace osu.Game.Rulesets.Osu.Edit.Masks.SpinnerMasks.Components +namespace osu.Game.Rulesets.Osu.Edit.Blueprints.Spinners.Components { public class SpinnerPiece : CompositeDrawable { diff --git a/osu.Game.Rulesets.Osu/Edit/Masks/SpinnerMasks/SpinnerPlacementBlueprint.cs b/osu.Game.Rulesets.Osu/Edit/Blueprints/Spinners/SpinnerPlacementBlueprint.cs similarity index 90% rename from osu.Game.Rulesets.Osu/Edit/Masks/SpinnerMasks/SpinnerPlacementBlueprint.cs rename to osu.Game.Rulesets.Osu/Edit/Blueprints/Spinners/SpinnerPlacementBlueprint.cs index ca7a2f7b01..c97adde427 100644 --- a/osu.Game.Rulesets.Osu/Edit/Masks/SpinnerMasks/SpinnerPlacementBlueprint.cs +++ b/osu.Game.Rulesets.Osu/Edit/Blueprints/Spinners/SpinnerPlacementBlueprint.cs @@ -4,11 +4,11 @@ using osu.Framework.Graphics; using osu.Framework.Input.Events; using osu.Game.Rulesets.Edit; -using osu.Game.Rulesets.Osu.Edit.Masks.SpinnerMasks.Components; +using osu.Game.Rulesets.Osu.Edit.Blueprints.Spinners.Components; using osu.Game.Rulesets.Osu.Objects; using osu.Game.Rulesets.Osu.UI; -namespace osu.Game.Rulesets.Osu.Edit.Masks.SpinnerMasks +namespace osu.Game.Rulesets.Osu.Edit.Blueprints.Spinners { public class SpinnerPlacementBlueprint : PlacementBlueprint { diff --git a/osu.Game.Rulesets.Osu/Edit/Masks/SpinnerMasks/SpinnerSelectionBlueprint.cs b/osu.Game.Rulesets.Osu/Edit/Blueprints/Spinners/SpinnerSelectionBlueprint.cs similarity index 85% rename from osu.Game.Rulesets.Osu/Edit/Masks/SpinnerMasks/SpinnerSelectionBlueprint.cs rename to osu.Game.Rulesets.Osu/Edit/Blueprints/Spinners/SpinnerSelectionBlueprint.cs index b3c550b1c1..869c4c2c79 100644 --- a/osu.Game.Rulesets.Osu/Edit/Masks/SpinnerMasks/SpinnerSelectionBlueprint.cs +++ b/osu.Game.Rulesets.Osu/Edit/Blueprints/Spinners/SpinnerSelectionBlueprint.cs @@ -2,12 +2,12 @@ // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE using osu.Game.Rulesets.Edit; -using osu.Game.Rulesets.Osu.Edit.Masks.SpinnerMasks.Components; +using osu.Game.Rulesets.Osu.Edit.Blueprints.Spinners.Components; using osu.Game.Rulesets.Osu.Objects; using osu.Game.Rulesets.Osu.Objects.Drawables; using OpenTK; -namespace osu.Game.Rulesets.Osu.Edit.Masks.SpinnerMasks +namespace osu.Game.Rulesets.Osu.Edit.Blueprints.Spinners { public class SpinnerSelectionBlueprint : SelectionBlueprint { diff --git a/osu.Game.Rulesets.Osu/Edit/HitCircleCompositionTool.cs b/osu.Game.Rulesets.Osu/Edit/HitCircleCompositionTool.cs index 1a48a0b6a9..ddab70d53a 100644 --- a/osu.Game.Rulesets.Osu/Edit/HitCircleCompositionTool.cs +++ b/osu.Game.Rulesets.Osu/Edit/HitCircleCompositionTool.cs @@ -3,7 +3,7 @@ using osu.Game.Rulesets.Edit; using osu.Game.Rulesets.Edit.Tools; -using osu.Game.Rulesets.Osu.Edit.Masks.HitCircleMasks; +using osu.Game.Rulesets.Osu.Edit.Blueprints.HitCircles; using osu.Game.Rulesets.Osu.Objects; namespace osu.Game.Rulesets.Osu.Edit diff --git a/osu.Game.Rulesets.Osu/Edit/OsuHitObjectComposer.cs b/osu.Game.Rulesets.Osu/Edit/OsuHitObjectComposer.cs index 1d806aba90..a706e1d4be 100644 --- a/osu.Game.Rulesets.Osu/Edit/OsuHitObjectComposer.cs +++ b/osu.Game.Rulesets.Osu/Edit/OsuHitObjectComposer.cs @@ -8,9 +8,9 @@ using osu.Game.Beatmaps; using osu.Game.Rulesets.Edit; using osu.Game.Rulesets.Edit.Tools; using osu.Game.Rulesets.Objects.Drawables; -using osu.Game.Rulesets.Osu.Edit.Masks.HitCircleMasks; -using osu.Game.Rulesets.Osu.Edit.Masks.SliderMasks; -using osu.Game.Rulesets.Osu.Edit.Masks.SpinnerMasks; +using osu.Game.Rulesets.Osu.Edit.Blueprints.HitCircles; +using osu.Game.Rulesets.Osu.Edit.Blueprints.Sliders; +using osu.Game.Rulesets.Osu.Edit.Blueprints.Spinners; using osu.Game.Rulesets.Osu.Objects; using osu.Game.Rulesets.Osu.Objects.Drawables; using osu.Game.Rulesets.Osu.UI; diff --git a/osu.Game.Rulesets.Osu/Edit/SliderCompositionTool.cs b/osu.Game.Rulesets.Osu/Edit/SliderCompositionTool.cs index 0cf98ea9d7..6d4f67c597 100644 --- a/osu.Game.Rulesets.Osu/Edit/SliderCompositionTool.cs +++ b/osu.Game.Rulesets.Osu/Edit/SliderCompositionTool.cs @@ -3,7 +3,7 @@ using osu.Game.Rulesets.Edit; using osu.Game.Rulesets.Edit.Tools; -using osu.Game.Rulesets.Osu.Edit.Masks.SliderMasks; +using osu.Game.Rulesets.Osu.Edit.Blueprints.Sliders; using osu.Game.Rulesets.Osu.Objects; namespace osu.Game.Rulesets.Osu.Edit diff --git a/osu.Game.Rulesets.Osu/Edit/SpinnerCompositionTool.cs b/osu.Game.Rulesets.Osu/Edit/SpinnerCompositionTool.cs index b3677c7612..5c19a1bac0 100644 --- a/osu.Game.Rulesets.Osu/Edit/SpinnerCompositionTool.cs +++ b/osu.Game.Rulesets.Osu/Edit/SpinnerCompositionTool.cs @@ -3,7 +3,7 @@ using osu.Game.Rulesets.Edit; using osu.Game.Rulesets.Edit.Tools; -using osu.Game.Rulesets.Osu.Edit.Masks.SpinnerMasks; +using osu.Game.Rulesets.Osu.Edit.Blueprints.Spinners; using osu.Game.Rulesets.Osu.Objects; namespace osu.Game.Rulesets.Osu.Edit diff --git a/osu.Game.Tests/Visual/TestCaseHitObjectComposer.cs b/osu.Game.Tests/Visual/TestCaseHitObjectComposer.cs index ae9a28fcaf..2629b29c6c 100644 --- a/osu.Game.Tests/Visual/TestCaseHitObjectComposer.cs +++ b/osu.Game.Tests/Visual/TestCaseHitObjectComposer.cs @@ -13,8 +13,8 @@ using osu.Game.Rulesets.Edit; using osu.Game.Rulesets.Objects; using osu.Game.Rulesets.Osu; using osu.Game.Rulesets.Osu.Edit; -using osu.Game.Rulesets.Osu.Edit.Masks.HitCircleMasks; -using osu.Game.Rulesets.Osu.Edit.Masks.HitCircleMasks.Components; +using osu.Game.Rulesets.Osu.Edit.Blueprints.HitCircles; +using osu.Game.Rulesets.Osu.Edit.Blueprints.HitCircles.Components; using osu.Game.Rulesets.Osu.Objects; using osu.Game.Screens.Edit.Compose; using osu.Game.Screens.Edit.Compose.Components; From 5d51719572815210626eb87357eda6d82c2ccd80 Mon Sep 17 00:00:00 2001 From: smoogipoo Date: Wed, 7 Nov 2018 16:21:32 +0900 Subject: [PATCH 415/417] Make selection blueprints handle position adjustments --- .../Blueprints/HoldNoteSelectionBlueprint.cs | 3 +-- .../Blueprints/ManiaSelectionBlueprint.cs | 21 ++++++++++++++++++ .../Edit/Blueprints/NoteSelectionBlueprint.cs | 3 +-- .../HitCircles/HitCircleSelectionBlueprint.cs | 3 +-- .../Edit/Blueprints/OsuSelectionBlueprint.cs | 22 +++++++++++++++++++ .../Sliders/SliderCircleSelectionBlueprint.cs | 10 +++++++-- .../Sliders/SliderSelectionBlueprint.cs | 3 +-- .../Spinners/SpinnerSelectionBlueprint.cs | 9 ++++++-- osu.Game/Rulesets/Edit/SelectionBlueprint.cs | 10 +++++---- .../Compose/Components/BlueprintContainer.cs | 3 +-- .../Edit/Compose/Components/SelectionBox.cs | 12 ++-------- 11 files changed, 71 insertions(+), 28 deletions(-) create mode 100644 osu.Game.Rulesets.Mania/Edit/Blueprints/ManiaSelectionBlueprint.cs create mode 100644 osu.Game.Rulesets.Osu/Edit/Blueprints/OsuSelectionBlueprint.cs diff --git a/osu.Game.Rulesets.Mania/Edit/Blueprints/HoldNoteSelectionBlueprint.cs b/osu.Game.Rulesets.Mania/Edit/Blueprints/HoldNoteSelectionBlueprint.cs index 0ede2a7b9d..3da2538497 100644 --- a/osu.Game.Rulesets.Mania/Edit/Blueprints/HoldNoteSelectionBlueprint.cs +++ b/osu.Game.Rulesets.Mania/Edit/Blueprints/HoldNoteSelectionBlueprint.cs @@ -5,7 +5,6 @@ using osu.Framework.Allocation; using osu.Framework.Configuration; using osu.Framework.Graphics; using osu.Game.Graphics; -using osu.Game.Rulesets.Edit; using osu.Game.Rulesets.Mania.Objects.Drawables; using osu.Game.Rulesets.Mania.Objects.Drawables.Pieces; using osu.Game.Rulesets.Mania.UI; @@ -15,7 +14,7 @@ using OpenTK.Graphics; namespace osu.Game.Rulesets.Mania.Edit.Blueprints { - public class HoldNoteSelectionBlueprint : SelectionBlueprint + public class HoldNoteSelectionBlueprint : ManiaSelectionBlueprint { public new DrawableHoldNote HitObject => (DrawableHoldNote)base.HitObject; diff --git a/osu.Game.Rulesets.Mania/Edit/Blueprints/ManiaSelectionBlueprint.cs b/osu.Game.Rulesets.Mania/Edit/Blueprints/ManiaSelectionBlueprint.cs new file mode 100644 index 0000000000..474b8c662e --- /dev/null +++ b/osu.Game.Rulesets.Mania/Edit/Blueprints/ManiaSelectionBlueprint.cs @@ -0,0 +1,21 @@ +// Copyright (c) 2007-2018 ppy Pty Ltd . +// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE + +using osu.Framework.Input.Events; +using osu.Game.Rulesets.Edit; +using osu.Game.Rulesets.Objects.Drawables; + +namespace osu.Game.Rulesets.Mania.Edit.Blueprints +{ + public class ManiaSelectionBlueprint : SelectionBlueprint + { + public ManiaSelectionBlueprint(DrawableHitObject hitObject) + : base(hitObject) + { + } + + public override void AdjustPosition(DragEvent dragEvent) + { + } + } +} diff --git a/osu.Game.Rulesets.Mania/Edit/Blueprints/NoteSelectionBlueprint.cs b/osu.Game.Rulesets.Mania/Edit/Blueprints/NoteSelectionBlueprint.cs index 19726a368d..7c0337dc4e 100644 --- a/osu.Game.Rulesets.Mania/Edit/Blueprints/NoteSelectionBlueprint.cs +++ b/osu.Game.Rulesets.Mania/Edit/Blueprints/NoteSelectionBlueprint.cs @@ -3,13 +3,12 @@ using osu.Framework.Allocation; using osu.Game.Graphics; -using osu.Game.Rulesets.Edit; using osu.Game.Rulesets.Mania.Objects.Drawables; using osu.Game.Rulesets.Mania.Objects.Drawables.Pieces; namespace osu.Game.Rulesets.Mania.Edit.Blueprints { - public class NoteSelectionBlueprint : SelectionBlueprint + public class NoteSelectionBlueprint : ManiaSelectionBlueprint { public NoteSelectionBlueprint(DrawableNote note) : base(note) diff --git a/osu.Game.Rulesets.Osu/Edit/Blueprints/HitCircles/HitCircleSelectionBlueprint.cs b/osu.Game.Rulesets.Osu/Edit/Blueprints/HitCircles/HitCircleSelectionBlueprint.cs index 9c4b804d77..a59dac1834 100644 --- a/osu.Game.Rulesets.Osu/Edit/Blueprints/HitCircles/HitCircleSelectionBlueprint.cs +++ b/osu.Game.Rulesets.Osu/Edit/Blueprints/HitCircles/HitCircleSelectionBlueprint.cs @@ -1,14 +1,13 @@ // Copyright (c) 2007-2018 ppy Pty Ltd . // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE -using osu.Game.Rulesets.Edit; using osu.Game.Rulesets.Osu.Edit.Blueprints.HitCircles.Components; using osu.Game.Rulesets.Osu.Objects; using osu.Game.Rulesets.Osu.Objects.Drawables; namespace osu.Game.Rulesets.Osu.Edit.Blueprints.HitCircles { - public class HitCircleSelectionBlueprint : SelectionBlueprint + public class HitCircleSelectionBlueprint : OsuSelectionBlueprint { public HitCircleSelectionBlueprint(DrawableHitCircle hitCircle) : base(hitCircle) diff --git a/osu.Game.Rulesets.Osu/Edit/Blueprints/OsuSelectionBlueprint.cs b/osu.Game.Rulesets.Osu/Edit/Blueprints/OsuSelectionBlueprint.cs new file mode 100644 index 0000000000..8431d5d5d0 --- /dev/null +++ b/osu.Game.Rulesets.Osu/Edit/Blueprints/OsuSelectionBlueprint.cs @@ -0,0 +1,22 @@ +// Copyright (c) 2007-2018 ppy Pty Ltd . +// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE + +using osu.Framework.Input.Events; +using osu.Game.Rulesets.Edit; +using osu.Game.Rulesets.Objects.Drawables; +using osu.Game.Rulesets.Osu.Objects; + +namespace osu.Game.Rulesets.Osu.Edit.Blueprints +{ + public class OsuSelectionBlueprint : SelectionBlueprint + { + protected OsuHitObject OsuObject => (OsuHitObject)HitObject.HitObject; + + public OsuSelectionBlueprint(DrawableHitObject hitObject) + : base(hitObject) + { + } + + public override void AdjustPosition(DragEvent dragEvent) => OsuObject.Position += dragEvent.Delta; + } +} diff --git a/osu.Game.Rulesets.Osu/Edit/Blueprints/Sliders/SliderCircleSelectionBlueprint.cs b/osu.Game.Rulesets.Osu/Edit/Blueprints/Sliders/SliderCircleSelectionBlueprint.cs index 99ebfecd93..4bac9d3556 100644 --- a/osu.Game.Rulesets.Osu/Edit/Blueprints/Sliders/SliderCircleSelectionBlueprint.cs +++ b/osu.Game.Rulesets.Osu/Edit/Blueprints/Sliders/SliderCircleSelectionBlueprint.cs @@ -1,18 +1,22 @@ // Copyright (c) 2007-2018 ppy Pty Ltd . // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE -using osu.Game.Rulesets.Edit; +using osu.Framework.Input.Events; using osu.Game.Rulesets.Osu.Edit.Blueprints.Sliders.Components; using osu.Game.Rulesets.Osu.Objects; using osu.Game.Rulesets.Osu.Objects.Drawables; namespace osu.Game.Rulesets.Osu.Edit.Blueprints.Sliders { - public class SliderCircleSelectionBlueprint : SelectionBlueprint + public class SliderCircleSelectionBlueprint : OsuSelectionBlueprint { + private readonly Slider slider; + public SliderCircleSelectionBlueprint(DrawableOsuHitObject hitObject, Slider slider, SliderPosition position) : base(hitObject) { + this.slider = slider; + InternalChild = new SliderCirclePiece(slider, position); Select(); @@ -20,5 +24,7 @@ namespace osu.Game.Rulesets.Osu.Edit.Blueprints.Sliders // Todo: This is temporary, since the slider circle masks don't do anything special yet. In the future they will handle input. public override bool HandlePositionalInput => false; + + public override void AdjustPosition(DragEvent dragEvent) => slider.Position += dragEvent.Delta; } } diff --git a/osu.Game.Rulesets.Osu/Edit/Blueprints/Sliders/SliderSelectionBlueprint.cs b/osu.Game.Rulesets.Osu/Edit/Blueprints/Sliders/SliderSelectionBlueprint.cs index 430ddbdc38..4810d76bf8 100644 --- a/osu.Game.Rulesets.Osu/Edit/Blueprints/Sliders/SliderSelectionBlueprint.cs +++ b/osu.Game.Rulesets.Osu/Edit/Blueprints/Sliders/SliderSelectionBlueprint.cs @@ -2,7 +2,6 @@ // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE using osu.Framework.Graphics; -using osu.Game.Rulesets.Edit; using osu.Game.Rulesets.Osu.Edit.Blueprints.Sliders.Components; using osu.Game.Rulesets.Osu.Objects; using osu.Game.Rulesets.Osu.Objects.Drawables; @@ -10,7 +9,7 @@ using OpenTK; namespace osu.Game.Rulesets.Osu.Edit.Blueprints.Sliders { - public class SliderSelectionBlueprint : SelectionBlueprint + public class SliderSelectionBlueprint : OsuSelectionBlueprint { private readonly SliderCircleSelectionBlueprint headBlueprint; diff --git a/osu.Game.Rulesets.Osu/Edit/Blueprints/Spinners/SpinnerSelectionBlueprint.cs b/osu.Game.Rulesets.Osu/Edit/Blueprints/Spinners/SpinnerSelectionBlueprint.cs index 869c4c2c79..9e9cc87c5e 100644 --- a/osu.Game.Rulesets.Osu/Edit/Blueprints/Spinners/SpinnerSelectionBlueprint.cs +++ b/osu.Game.Rulesets.Osu/Edit/Blueprints/Spinners/SpinnerSelectionBlueprint.cs @@ -1,7 +1,7 @@ // Copyright (c) 2007-2018 ppy Pty Ltd . // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE -using osu.Game.Rulesets.Edit; +using osu.Framework.Input.Events; using osu.Game.Rulesets.Osu.Edit.Blueprints.Spinners.Components; using osu.Game.Rulesets.Osu.Objects; using osu.Game.Rulesets.Osu.Objects.Drawables; @@ -9,7 +9,7 @@ using OpenTK; namespace osu.Game.Rulesets.Osu.Edit.Blueprints.Spinners { - public class SpinnerSelectionBlueprint : SelectionBlueprint + public class SpinnerSelectionBlueprint : OsuSelectionBlueprint { private readonly SpinnerPiece piece; @@ -20,5 +20,10 @@ namespace osu.Game.Rulesets.Osu.Edit.Blueprints.Spinners } public override bool ReceivePositionalInputAt(Vector2 screenSpacePos) => piece.ReceivePositionalInputAt(screenSpacePos); + + public override void AdjustPosition(DragEvent dragEvent) + { + // Spinners don't support position adjustments + } } } diff --git a/osu.Game/Rulesets/Edit/SelectionBlueprint.cs b/osu.Game/Rulesets/Edit/SelectionBlueprint.cs index 6e0d136e1f..db35d47b2b 100644 --- a/osu.Game/Rulesets/Edit/SelectionBlueprint.cs +++ b/osu.Game/Rulesets/Edit/SelectionBlueprint.cs @@ -17,7 +17,7 @@ namespace osu.Game.Rulesets.Edit /// /// A blueprint placed above a adding editing functionality. /// - public class SelectionBlueprint : CompositeDrawable, IStateful + public abstract class SelectionBlueprint : CompositeDrawable, IStateful { /// /// Invoked when this has been selected. @@ -38,7 +38,7 @@ namespace osu.Game.Rulesets.Edit /// /// Invoked when this has requested drag. /// - public event Action DragRequested; + public event Action DragRequested; /// /// The which this applies to. @@ -49,7 +49,7 @@ namespace osu.Game.Rulesets.Edit public override bool HandlePositionalInput => ShouldBeAlive; public override bool RemoveWhenNotAlive => false; - public SelectionBlueprint(DrawableHitObject hitObject) + protected SelectionBlueprint(DrawableHitObject hitObject) { HitObject = hitObject; @@ -130,10 +130,12 @@ namespace osu.Game.Rulesets.Edit protected override bool OnDrag(DragEvent e) { - DragRequested?.Invoke(this, e.Delta, e.CurrentState); + DragRequested?.Invoke(e); return true; } + public abstract void AdjustPosition(DragEvent dragEvent); + /// /// The screen-space point that causes this to be selected. /// diff --git a/osu.Game/Screens/Edit/Compose/Components/BlueprintContainer.cs b/osu.Game/Screens/Edit/Compose/Components/BlueprintContainer.cs index 45003545a3..acbfd1f1d6 100644 --- a/osu.Game/Screens/Edit/Compose/Components/BlueprintContainer.cs +++ b/osu.Game/Screens/Edit/Compose/Components/BlueprintContainer.cs @@ -12,7 +12,6 @@ using osu.Framework.Input.States; using osu.Game.Rulesets.Edit; using osu.Game.Rulesets.Edit.Tools; using osu.Game.Rulesets.Objects.Drawables; -using OpenTK; namespace osu.Game.Screens.Edit.Compose.Components { @@ -165,7 +164,7 @@ namespace osu.Game.Screens.Edit.Compose.Components private void onSelectionRequested(SelectionBlueprint blueprint, InputState state) => selectionBox.HandleSelectionRequested(blueprint, state); - private void onDragRequested(SelectionBlueprint blueprint, Vector2 delta, InputState state) => selectionBox.HandleDrag(blueprint, delta, state); + private void onDragRequested(DragEvent dragEvent) => selectionBox.HandleDrag(dragEvent); private class SelectionBlueprintContainer : Container { diff --git a/osu.Game/Screens/Edit/Compose/Components/SelectionBox.cs b/osu.Game/Screens/Edit/Compose/Components/SelectionBox.cs index e2a70a9ee7..8732672723 100644 --- a/osu.Game/Screens/Edit/Compose/Components/SelectionBox.cs +++ b/osu.Game/Screens/Edit/Compose/Components/SelectionBox.cs @@ -12,7 +12,6 @@ using osu.Framework.Input.Events; using osu.Framework.Input.States; using osu.Game.Graphics; using osu.Game.Rulesets.Edit; -using osu.Game.Rulesets.Edit.Types; using OpenTK; using OpenTK.Input; @@ -60,19 +59,12 @@ namespace osu.Game.Screens.Edit.Compose.Components #region User Input Handling - public void HandleDrag(SelectionBlueprint m, Vector2 delta, InputState state) + public void HandleDrag(DragEvent dragEvent) { // Todo: Various forms of snapping foreach (var blueprint in selectedBlueprints) - { - switch (blueprint.HitObject.HitObject) - { - case IHasEditablePosition editablePosition: - editablePosition.OffsetPosition(delta); - break; - } - } + blueprint.AdjustPosition(dragEvent); } protected override bool OnKeyDown(KeyDownEvent e) From c6350c6efd20334056406fa2c5c5facb245a7c6b Mon Sep 17 00:00:00 2001 From: smoogipoo Date: Wed, 7 Nov 2018 16:21:52 +0900 Subject: [PATCH 416/417] Remove IHasEditablePosition --- osu.Game.Rulesets.Osu/Objects/OsuHitObject.cs | 5 +---- osu.Game.Rulesets.Osu/Objects/Slider.cs | 4 ++-- osu.Game.Rulesets.Osu/Objects/SliderCircle.cs | 10 ---------- osu.Game.Rulesets.Osu/Objects/SliderTailCircle.cs | 5 ----- osu.Game.Rulesets.Osu/Objects/Spinner.cs | 6 ------ .../Rulesets/Edit/Types/IHasEditablePosition.cs | 13 ------------- 6 files changed, 3 insertions(+), 40 deletions(-) delete mode 100644 osu.Game/Rulesets/Edit/Types/IHasEditablePosition.cs diff --git a/osu.Game.Rulesets.Osu/Objects/OsuHitObject.cs b/osu.Game.Rulesets.Osu/Objects/OsuHitObject.cs index 67396c7ae4..61d199a7dc 100644 --- a/osu.Game.Rulesets.Osu/Objects/OsuHitObject.cs +++ b/osu.Game.Rulesets.Osu/Objects/OsuHitObject.cs @@ -7,11 +7,10 @@ using osu.Game.Rulesets.Objects; using OpenTK; using osu.Game.Rulesets.Objects.Types; using osu.Game.Beatmaps.ControlPoints; -using osu.Game.Rulesets.Edit.Types; namespace osu.Game.Rulesets.Osu.Objects { - public abstract class OsuHitObject : HitObject, IHasComboInformation, IHasEditablePosition + public abstract class OsuHitObject : HitObject, IHasComboInformation, IHasPosition { public const double OBJECT_RADIUS = 64; @@ -100,8 +99,6 @@ namespace osu.Game.Rulesets.Osu.Objects Scale = (1.0f - 0.7f * (difficulty.CircleSize - 5) / 5) / 2; } - public virtual void OffsetPosition(Vector2 offset) => Position += offset; - protected override HitWindows CreateHitWindows() => new OsuHitWindows(); } } diff --git a/osu.Game.Rulesets.Osu/Objects/Slider.cs b/osu.Game.Rulesets.Osu/Objects/Slider.cs index 3680c38945..cff742ca29 100644 --- a/osu.Game.Rulesets.Osu/Objects/Slider.cs +++ b/osu.Game.Rulesets.Osu/Objects/Slider.cs @@ -166,7 +166,7 @@ namespace osu.Game.Rulesets.Osu.Objects private void createSliderEnds() { - HeadCircle = new SliderCircle(this) + HeadCircle = new SliderCircle { StartTime = StartTime, Position = Position, @@ -176,7 +176,7 @@ namespace osu.Game.Rulesets.Osu.Objects ComboIndex = ComboIndex, }; - TailCircle = new SliderTailCircle(this) + TailCircle = new SliderTailCircle { StartTime = EndTime, Position = EndPosition, diff --git a/osu.Game.Rulesets.Osu/Objects/SliderCircle.cs b/osu.Game.Rulesets.Osu/Objects/SliderCircle.cs index 1bdd16c9df..deda951378 100644 --- a/osu.Game.Rulesets.Osu/Objects/SliderCircle.cs +++ b/osu.Game.Rulesets.Osu/Objects/SliderCircle.cs @@ -1,19 +1,9 @@ // Copyright (c) 2007-2018 ppy Pty Ltd . // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE -using OpenTK; - namespace osu.Game.Rulesets.Osu.Objects { public class SliderCircle : HitCircle { - private readonly Slider slider; - - public SliderCircle(Slider slider) - { - this.slider = slider; - } - - public override void OffsetPosition(Vector2 offset) => slider.OffsetPosition(offset); } } diff --git a/osu.Game.Rulesets.Osu/Objects/SliderTailCircle.cs b/osu.Game.Rulesets.Osu/Objects/SliderTailCircle.cs index 23616ea005..b567bd8423 100644 --- a/osu.Game.Rulesets.Osu/Objects/SliderTailCircle.cs +++ b/osu.Game.Rulesets.Osu/Objects/SliderTailCircle.cs @@ -8,11 +8,6 @@ namespace osu.Game.Rulesets.Osu.Objects { public class SliderTailCircle : SliderCircle { - public SliderTailCircle(Slider slider) - : base(slider) - { - } - public override Judgement CreateJudgement() => new OsuSliderTailJudgement(); } } diff --git a/osu.Game.Rulesets.Osu/Objects/Spinner.cs b/osu.Game.Rulesets.Osu/Objects/Spinner.cs index 1270685ab5..1c60fd4831 100644 --- a/osu.Game.Rulesets.Osu/Objects/Spinner.cs +++ b/osu.Game.Rulesets.Osu/Objects/Spinner.cs @@ -7,7 +7,6 @@ using osu.Game.Rulesets.Objects.Types; using osu.Game.Beatmaps.ControlPoints; using osu.Game.Rulesets.Judgements; using osu.Game.Rulesets.Osu.Judgements; -using OpenTK; namespace osu.Game.Rulesets.Osu.Objects { @@ -32,10 +31,5 @@ namespace osu.Game.Rulesets.Osu.Objects } public override Judgement CreateJudgement() => new OsuJudgement(); - - public override void OffsetPosition(Vector2 offset) - { - // for now we don't want to allow spinners to be moved around. - } } } diff --git a/osu.Game/Rulesets/Edit/Types/IHasEditablePosition.cs b/osu.Game/Rulesets/Edit/Types/IHasEditablePosition.cs deleted file mode 100644 index 7107b6c763..0000000000 --- a/osu.Game/Rulesets/Edit/Types/IHasEditablePosition.cs +++ /dev/null @@ -1,13 +0,0 @@ -// Copyright (c) 2007-2018 ppy Pty Ltd . -// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE - -using osu.Game.Rulesets.Objects.Types; -using OpenTK; - -namespace osu.Game.Rulesets.Edit.Types -{ - public interface IHasEditablePosition : IHasPosition - { - void OffsetPosition(Vector2 offset); - } -} From 4783df1d4ba8ea8335f1f65934d685a71fe464d5 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Fri, 9 Nov 2018 11:36:06 +0900 Subject: [PATCH 417/417] Fix compose mode not working --- osu.Game/Rulesets/Edit/HitObjectComposer.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu.Game/Rulesets/Edit/HitObjectComposer.cs b/osu.Game/Rulesets/Edit/HitObjectComposer.cs index 485c1921cf..932cfe5789 100644 --- a/osu.Game/Rulesets/Edit/HitObjectComposer.cs +++ b/osu.Game/Rulesets/Edit/HitObjectComposer.cs @@ -64,7 +64,7 @@ namespace osu.Game.Rulesets.Edit layerBelowRuleset.Child = new EditorPlayfieldBorder { RelativeSizeAxes = Axes.Both }; var layerAboveRuleset = CreateLayerContainer(); - layerAboveRuleset.Child = new BlueprintContainer(); + layerAboveRuleset.Child = blueprintContainer = new BlueprintContainer(); layerContainers.Add(layerBelowRuleset); layerContainers.Add(layerAboveRuleset);