diff --git a/osu-framework b/osu-framework index b3f409ffb0..943410e228 160000 --- a/osu-framework +++ b/osu-framework @@ -1 +1 @@ -Subproject commit b3f409ffb027f1b16c639c7ce3bb9dc4f215f79b +Subproject commit 943410e228f704252a803cee75532434c6b5be72 diff --git a/osu.Desktop.Deploy/Properties/AssemblyInfo.cs b/osu.Desktop.Deploy/Properties/AssemblyInfo.cs index c71d82df00..e0c1ad1a43 100644 --- a/osu.Desktop.Deploy/Properties/AssemblyInfo.cs +++ b/osu.Desktop.Deploy/Properties/AssemblyInfo.cs @@ -1,5 +1,4 @@ using System.Reflection; -using System.Runtime.CompilerServices; using System.Runtime.InteropServices; // General Information about an assembly is controlled through the following diff --git a/osu.Desktop.VisualTests/Benchmark.cs b/osu.Desktop.VisualTests/Benchmark.cs index 9584dc52a4..8c8cffaf3f 100644 --- a/osu.Desktop.VisualTests/Benchmark.cs +++ b/osu.Desktop.VisualTests/Benchmark.cs @@ -2,20 +2,9 @@ // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -using osu.Framework; using osu.Framework.Allocation; -using osu.Framework.Desktop.Platform; using osu.Framework.Screens.Testing; using osu.Game; -using osu.Game.Modes; -using osu.Game.Modes.Catch; -using osu.Game.Modes.Mania; -using osu.Game.Modes.Osu; -using osu.Game.Modes.Taiko; namespace osu.Desktop.VisualTests { @@ -24,7 +13,7 @@ namespace osu.Desktop.VisualTests private double timePerTest = 200; [BackgroundDependencyLoader] - private void load(BaseGame game) + private void load(Framework.Game game) { Host.MaximumDrawHz = int.MaxValue; Host.MaximumUpdateHz = int.MaxValue; diff --git a/osu.Desktop.VisualTests/Program.cs b/osu.Desktop.VisualTests/Program.cs index b89c6bcf4d..6d51e9162d 100644 --- a/osu.Desktop.VisualTests/Program.cs +++ b/osu.Desktop.VisualTests/Program.cs @@ -3,7 +3,6 @@ using System; using osu.Framework.Desktop; -using osu.Framework.Desktop.Platform; using osu.Framework.Platform; using osu.Game.Modes; using osu.Game.Modes.Catch; @@ -20,7 +19,7 @@ namespace osu.Desktop.VisualTests { bool benchmark = args.Length > 0 && args[0] == @"-benchmark"; - using (BasicGameHost host = Host.GetSuitableHost(@"osu")) + using (GameHost host = Host.GetSuitableHost(@"osu")) { Ruleset.Register(new OsuRuleset()); Ruleset.Register(new TaikoRuleset()); diff --git a/osu.Desktop.VisualTests/Tests/TestCaseChatDisplay.cs b/osu.Desktop.VisualTests/Tests/TestCaseChatDisplay.cs index d977e9cede..9b9e33431f 100644 --- a/osu.Desktop.VisualTests/Tests/TestCaseChatDisplay.cs +++ b/osu.Desktop.VisualTests/Tests/TestCaseChatDisplay.cs @@ -1,22 +1,10 @@ // Copyright (c) 2007-2017 ppy Pty Ltd . // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE -using System.Collections.Generic; -using System.Diagnostics; -using System.Linq; -using osu.Framework; using osu.Framework.Screens.Testing; -using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; -using osu.Framework.Graphics.Sprites; using osu.Framework.Threading; -using osu.Game; -using osu.Game.Online.API; -using osu.Game.Online.API.Requests; -using osu.Game.Online.Chat; -using OpenTK; -using osu.Framework.Allocation; -using osu.Game.Online.Chat.Drawables; +using osu.Game.Overlays; namespace osu.Desktop.VisualTests.Tests { @@ -25,119 +13,16 @@ namespace osu.Desktop.VisualTests.Tests private ScheduledDelegate messageRequest; public override string Name => @"Chat"; - public override string Description => @"Testing API polling"; - - FlowContainer flow; - - private Scheduler scheduler = new Scheduler(); - - private APIAccess api; - - private ChannelDisplay channelDisplay; - - [BackgroundDependencyLoader] - private void load(APIAccess api) - { - this.api = api; - } + public override string Description => @"Testing chat api and overlay"; public override void Reset() { base.Reset(); - if (api.State != APIState.Online) - api.OnStateChange += delegate { initializeChannels(); }; - else - initializeChannels(); - } - - protected override void Update() - { - scheduler.Update(); - base.Update(); - } - - private long? lastMessageId; - - List careChannels; - - private void initializeChannels() - { - careChannels = new List(); - - if (api.State != APIState.Online) - return; - - Add(flow = new FlowContainer + Add(new ChatOverlay() { - RelativeSizeAxes = Axes.Both, - Direction = FlowDirections.Vertical + State = Visibility.Visible }); - - SpriteText loading; - Add(loading = new SpriteText - { - Text = @"Loading available channels...", - Anchor = Anchor.Centre, - Origin = Anchor.Centre, - TextSize = 40, - }); - - messageRequest?.Cancel(); - - ListChannelsRequest req = new ListChannelsRequest(); - req.Success += delegate (List channels) - { - Scheduler.Add(delegate - { - loading.FadeOut(100); - }); - - addChannel(channels.Find(c => c.Name == @"#osu")); - addChannel(channels.Find(c => c.Name == @"#lobby")); - addChannel(channels.Find(c => c.Name == @"#english")); - - messageRequest = scheduler.AddDelayed(() => FetchNewMessages(api), 1000, true); - }; - api.Queue(req); - } - - private void addChannel(Channel channel) - { - flow.Add(channelDisplay = new ChannelDisplay(channel) - { - Size = new Vector2(1, 0.3f) - }); - - careChannels.Add(channel); - } - - GetMessagesRequest fetchReq; - - public void FetchNewMessages(APIAccess api) - { - if (fetchReq != null) return; - - fetchReq = new GetMessagesRequest(careChannels, lastMessageId); - fetchReq.Success += delegate (List messages) - { - foreach (Message m in messages) - { - careChannels.Find(c => c.Id == m.ChannelId).AddNewMessages(m); - } - - lastMessageId = messages.LastOrDefault()?.Id ?? lastMessageId; - - Debug.Write("success!"); - fetchReq = null; - }; - fetchReq.Failure += delegate - { - Debug.Write("failure!"); - fetchReq = null; - }; - - api.Queue(fetchReq); } } } diff --git a/osu.Desktop.VisualTests/Tests/TestCaseGamefield.cs b/osu.Desktop.VisualTests/Tests/TestCaseGamefield.cs index 70abd6d8c4..9259f2ea78 100644 --- a/osu.Desktop.VisualTests/Tests/TestCaseGamefield.cs +++ b/osu.Desktop.VisualTests/Tests/TestCaseGamefield.cs @@ -7,15 +7,11 @@ using osu.Framework.Graphics; using osu.Framework.MathUtils; using osu.Framework.Timing; using osu.Game.Beatmaps; -using osu.Game.Modes.Catch; using osu.Game.Modes.Catch.UI; -using osu.Game.Modes.Mania; using osu.Game.Modes.Mania.UI; using osu.Game.Modes.Objects; -using osu.Game.Modes.Osu; using osu.Game.Modes.Osu.Objects; using osu.Game.Modes.Osu.UI; -using osu.Game.Modes.Taiko; using osu.Game.Modes.Taiko.UI; using OpenTK; diff --git a/osu.Desktop.VisualTests/Tests/TestCaseHitObjects.cs b/osu.Desktop.VisualTests/Tests/TestCaseHitObjects.cs index 7a46ea5ded..f77025cb06 100644 --- a/osu.Desktop.VisualTests/Tests/TestCaseHitObjects.cs +++ b/osu.Desktop.VisualTests/Tests/TestCaseHitObjects.cs @@ -2,21 +2,17 @@ // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE using System.Collections.Generic; -using osu.Framework; using osu.Framework.Screens.Testing; using osu.Framework.Graphics; using osu.Framework.Timing; using OpenTK; -using osu.Framework.Allocation; using osu.Framework.Configuration; -using osu.Game.Modes.Objects; using osu.Game.Modes.Objects.Drawables; using osu.Game.Modes.Osu.Objects; using osu.Game.Modes.Osu.Objects.Drawables; using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Sprites; using osu.Framework.Graphics.UserInterface; -using osu.Game.Modes; using OpenTK.Graphics; namespace osu.Desktop.VisualTests.Tests diff --git a/osu.Desktop.VisualTests/Tests/TestCaseKeyCounter.cs b/osu.Desktop.VisualTests/Tests/TestCaseKeyCounter.cs index c33a4001de..537bfc8dab 100644 --- a/osu.Desktop.VisualTests/Tests/TestCaseKeyCounter.cs +++ b/osu.Desktop.VisualTests/Tests/TestCaseKeyCounter.cs @@ -3,9 +3,7 @@ using osu.Framework.Screens.Testing; using osu.Framework.Graphics; -using osu.Game.Graphics.UserInterface; using OpenTK.Input; -using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.UserInterface; using osu.Framework.Configuration; using OpenTK; diff --git a/osu.Desktop.VisualTests/Tests/TestCaseNotificationManager.cs b/osu.Desktop.VisualTests/Tests/TestCaseNotificationManager.cs index e3457939f2..78174a8f64 100644 --- a/osu.Desktop.VisualTests/Tests/TestCaseNotificationManager.cs +++ b/osu.Desktop.VisualTests/Tests/TestCaseNotificationManager.cs @@ -5,11 +5,9 @@ using System.Collections.Generic; using osu.Framework.Graphics; using osu.Framework.Screens.Testing; using osu.Framework.MathUtils; -using osu.Framework.Timing; using osu.Game.Overlays; using System.Linq; using osu.Game.Overlays.Notifications; -using osu.Game.Screens.Backgrounds; namespace osu.Desktop.VisualTests.Tests { diff --git a/osu.Desktop.VisualTests/Tests/TestCaseOptions.cs b/osu.Desktop.VisualTests/Tests/TestCaseOptions.cs index 92a10cc649..6afd9ba86d 100644 --- a/osu.Desktop.VisualTests/Tests/TestCaseOptions.cs +++ b/osu.Desktop.VisualTests/Tests/TestCaseOptions.cs @@ -2,11 +2,7 @@ // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE using osu.Framework.Screens.Testing; -using osu.Framework.Graphics; -using osu.Game.Graphics.UserInterface; -using OpenTK.Input; using osu.Game.Overlays; -using osu.Framework.Graphics.Containers; namespace osu.Desktop.VisualTests.Tests { diff --git a/osu.Desktop.VisualTests/Tests/TestCasePauseOverlay.cs b/osu.Desktop.VisualTests/Tests/TestCasePauseOverlay.cs index 9d94189885..990b8b3775 100644 --- a/osu.Desktop.VisualTests/Tests/TestCasePauseOverlay.cs +++ b/osu.Desktop.VisualTests/Tests/TestCasePauseOverlay.cs @@ -1,16 +1,9 @@ // Copyright (c) 2007-2017 ppy Pty Ltd . // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE -using System; -using OpenTK.Graphics; using osu.Framework.Logging; -using osu.Framework.Graphics; using osu.Game.Overlays.Pause; -using osu.Framework.Graphics.Containers; -using osu.Framework.Graphics.Sprites; -using osu.Framework.Graphics.Colour; using osu.Framework.Screens.Testing; -using osu.Framework.Graphics.UserInterface; namespace osu.Desktop.VisualTests.Tests { diff --git a/osu.Desktop.VisualTests/Tests/TestCasePlayer.cs b/osu.Desktop.VisualTests/Tests/TestCasePlayer.cs index 2f8c37f1bb..a9b9f796f1 100644 --- a/osu.Desktop.VisualTests/Tests/TestCasePlayer.cs +++ b/osu.Desktop.VisualTests/Tests/TestCasePlayer.cs @@ -4,8 +4,6 @@ using System.Collections.Generic; using osu.Framework.Allocation; using osu.Framework.Screens.Testing; -using osu.Framework.MathUtils; -using osu.Framework.Timing; using osu.Game.Beatmaps; using osu.Game.Beatmaps.Formats; using OpenTK; @@ -60,7 +58,16 @@ namespace osu.Desktop.VisualTests.Tests Beatmap b = new Beatmap { - HitObjects = objects + HitObjects = objects, + BeatmapInfo = new BeatmapInfo + { + Metadata = new BeatmapMetadata + { + Artist = @"Unknown", + Title = @"Sample Beatmap", + Author = @"peppy", + } + } }; decoder.Process(b); @@ -74,10 +81,13 @@ namespace osu.Desktop.VisualTests.Tests Colour = Color4.Black, }); - Add(new Player + Add(new PlayerLoader(new Player { PreferredPlayMode = PlayMode.Osu, Beatmap = beatmap + }) + { + Beatmap = beatmap }); } } diff --git a/osu.Desktop.VisualTests/Tests/TestCaseScoreCounter.cs b/osu.Desktop.VisualTests/Tests/TestCaseScoreCounter.cs index d4ac16b86f..fe270bb82e 100644 --- a/osu.Desktop.VisualTests/Tests/TestCaseScoreCounter.cs +++ b/osu.Desktop.VisualTests/Tests/TestCaseScoreCounter.cs @@ -7,17 +7,11 @@ using osu.Framework.Graphics; using osu.Framework.Graphics.Sprites; using osu.Framework.MathUtils; using osu.Game.Graphics.UserInterface; -using osu.Game.Modes; -using osu.Game.Modes.Catch; using osu.Game.Modes.Catch.UI; -using osu.Game.Modes.Mania; using osu.Game.Modes.Mania.UI; -using osu.Game.Modes.Osu; using osu.Game.Modes.Osu.UI; -using osu.Game.Modes.Taiko; using osu.Game.Modes.Taiko.UI; using osu.Game.Modes.UI; -using osu.Game.Screens.Play; using OpenTK; using OpenTK.Graphics; using osu.Framework.Graphics.Primitives; diff --git a/osu.Desktop.VisualTests/Tests/TestCaseTwoLayerButton.cs b/osu.Desktop.VisualTests/Tests/TestCaseTwoLayerButton.cs index 33ae728fd7..ff65ac619e 100644 --- a/osu.Desktop.VisualTests/Tests/TestCaseTwoLayerButton.cs +++ b/osu.Desktop.VisualTests/Tests/TestCaseTwoLayerButton.cs @@ -2,12 +2,8 @@ // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE using osu.Framework.Screens.Testing; -using osu.Framework.Graphics.Colour; -using osu.Framework.Graphics.Sprites; using osu.Game.Graphics.UserInterface; -using osu.Game.Screens.Menu; using osu.Game.Screens.Play; -using OpenTK.Graphics; namespace osu.Desktop.VisualTests.Tests { diff --git a/osu.Desktop.VisualTests/VisualTestGame.cs b/osu.Desktop.VisualTests/VisualTestGame.cs index 81b00d4ab2..3128824da2 100644 --- a/osu.Desktop.VisualTests/VisualTestGame.cs +++ b/osu.Desktop.VisualTests/VisualTestGame.cs @@ -1,16 +1,8 @@ // Copyright (c) 2007-2017 ppy Pty Ltd . // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE -using osu.Framework; using osu.Framework.Screens.Testing; -using osu.Framework.Graphics.Cursor; -using osu.Game.Database; using osu.Game; -using osu.Framework.Desktop.Platform; -using System.Reflection; -using System.IO; -using System.Collections.Generic; -using osu.Framework.Allocation; using osu.Game.Screens.Backgrounds; namespace osu.Desktop.VisualTests @@ -21,7 +13,7 @@ namespace osu.Desktop.VisualTests { base.LoadComplete(); - (new BackgroundScreenDefault() { Depth = 10 }).Preload(this, AddInternal); + (new BackgroundScreenDefault() { Depth = 10 }).LoadAsync(this, AddInternal); // Have to construct this here, rather than in the constructor, because // we depend on some dependencies to be loaded within OsuGameBase.load(). diff --git a/osu.Desktop/Beatmaps/IO/LegacyFilesystemReader.cs b/osu.Desktop/Beatmaps/IO/LegacyFilesystemReader.cs index 132f14ddb5..b8bfb63a08 100644 --- a/osu.Desktop/Beatmaps/IO/LegacyFilesystemReader.cs +++ b/osu.Desktop/Beatmaps/IO/LegacyFilesystemReader.cs @@ -1,9 +1,7 @@ // Copyright (c) 2007-2017 ppy Pty Ltd . // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE -using System; using System.IO; -using System.Collections.Generic; using System.Linq; using osu.Game.Beatmaps.Formats; using osu.Game.Beatmaps.IO; diff --git a/osu.Desktop/OsuGameDesktop.cs b/osu.Desktop/OsuGameDesktop.cs index 3111d72662..33de58be3c 100644 --- a/osu.Desktop/OsuGameDesktop.cs +++ b/osu.Desktop/OsuGameDesktop.cs @@ -2,15 +2,10 @@ // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE using osu.Game; -using System; -using System.Collections.Generic; using System.Linq; -using System.Text; -using System.Threading.Tasks; using System.Windows.Forms; using osu.Framework.Platform; using osu.Framework.Desktop.Platform; -using osu.Game.Database; using osu.Desktop.Overlays; using System.Reflection; using System.Drawing; @@ -34,7 +29,7 @@ namespace osu.Desktop { base.LoadComplete(); - versionManager.Preload(this); + versionManager.LoadAsync(this); ModeChanged += m => { if (!versionManager.IsAlive && m is Intro) @@ -42,7 +37,7 @@ namespace osu.Desktop }; } - public override void SetHost(BasicGameHost host) + public override void SetHost(GameHost host) { base.SetHost(host); var desktopWindow = host.Window as DesktopGameWindow; diff --git a/osu.Desktop/Overlays/VersionManager.cs b/osu.Desktop/Overlays/VersionManager.cs index a2dc0cb5c3..bdc8bc7e1a 100644 --- a/osu.Desktop/Overlays/VersionManager.cs +++ b/osu.Desktop/Overlays/VersionManager.cs @@ -2,7 +2,6 @@ // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE using System; -using System.ComponentModel; using System.Diagnostics; using osu.Framework.Allocation; using osu.Framework.Graphics; @@ -19,7 +18,6 @@ using osu.Game.Graphics; using OpenTK; using OpenTK.Graphics; using System.Net.Http; -using osu.Framework.Logging; namespace osu.Desktop.Overlays { @@ -103,7 +101,8 @@ namespace osu.Desktop.Overlays } }; - updateChecker(); + if (IsDeployedBuild) + checkForUpdateAsync(); } protected override void LoadComplete() @@ -118,7 +117,7 @@ namespace osu.Desktop.Overlays updateManager?.Dispose(); } - private async void updateChecker(bool useDeltaPatching = true, UpdateProgressNotification notification = null) + private async void checkForUpdateAsync(bool useDeltaPatching = true, UpdateProgressNotification notification = null) { //should we schedule a retry on completion of this check? bool scheduleRetry = true; @@ -164,7 +163,7 @@ namespace osu.Desktop.Overlays { //could fail if deltas are unavailable for full update path (https://github.com/Squirrel/Squirrel.Windows/issues/959) //try again without deltas. - updateChecker(false, notification); + checkForUpdateAsync(false, notification); scheduleRetry = false; } } @@ -179,7 +178,7 @@ namespace osu.Desktop.Overlays if (scheduleRetry) { //check again in 30 minutes. - Scheduler.AddDelayed(() => updateChecker(), 60000 * 30); + Scheduler.AddDelayed(() => checkForUpdateAsync(), 60000 * 30); if (notification != null) notification.State = ProgressNotificationState.Cancelled; } diff --git a/osu.Desktop/Program.cs b/osu.Desktop/Program.cs index f9a4c94b8d..23de1ddbba 100644 --- a/osu.Desktop/Program.cs +++ b/osu.Desktop/Program.cs @@ -3,14 +3,9 @@ using System; using System.IO; -using System.Linq; -using System.Threading; using osu.Desktop.Beatmaps.IO; -using osu.Framework; using osu.Framework.Desktop; using osu.Framework.Desktop.Platform; -using osu.Framework.Platform; -using osu.Game; using osu.Game.IPC; using osu.Game.Modes; using osu.Game.Modes.Catch; @@ -40,7 +35,7 @@ namespace osu.Desktop foreach (var file in args) { Console.WriteLine(@"Importing {0}", file); - if (!importer.Import(Path.GetFullPath(file)).Wait(3000)) + if (!importer.ImportAsync(Path.GetFullPath(file)).Wait(3000)) throw new TimeoutException(@"IPC took too long to send"); } } @@ -51,8 +46,7 @@ namespace osu.Desktop Ruleset.Register(new ManiaRuleset()); Ruleset.Register(new CatchRuleset()); - BaseGame osu = new OsuGameDesktop(args); - host.Add(osu); + host.Add(new OsuGameDesktop(args)); host.Run(); } return 0; diff --git a/osu.Desktop/Properties/AssemblyInfo.cs b/osu.Desktop/Properties/AssemblyInfo.cs index 17329d8ac0..eacfc996d5 100644 --- a/osu.Desktop/Properties/AssemblyInfo.cs +++ b/osu.Desktop/Properties/AssemblyInfo.cs @@ -2,7 +2,6 @@ // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE using System.Reflection; -using System.Runtime.CompilerServices; using System.Runtime.InteropServices; // General Information about an assembly is controlled through the following diff --git a/osu.Game.Modes.Catch/CatchRuleset.cs b/osu.Game.Modes.Catch/CatchRuleset.cs index 48a84617da..fd778d1ce6 100644 --- a/osu.Game.Modes.Catch/CatchRuleset.cs +++ b/osu.Game.Modes.Catch/CatchRuleset.cs @@ -7,7 +7,6 @@ using osu.Game.Modes.Objects; using osu.Game.Modes.Osu.UI; using osu.Game.Modes.UI; using osu.Game.Beatmaps; -using System; namespace osu.Game.Modes.Catch { diff --git a/osu.Game.Modes.Catch/Properties/AssemblyInfo.cs b/osu.Game.Modes.Catch/Properties/AssemblyInfo.cs index 39475be046..07a088e1e9 100644 --- a/osu.Game.Modes.Catch/Properties/AssemblyInfo.cs +++ b/osu.Game.Modes.Catch/Properties/AssemblyInfo.cs @@ -2,7 +2,6 @@ // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE using System.Reflection; -using System.Runtime.CompilerServices; using System.Runtime.InteropServices; // General Information about an assembly is controlled through the following diff --git a/osu.Game.Modes.Mania/ManiaRuleset.cs b/osu.Game.Modes.Mania/ManiaRuleset.cs index 28c298be95..bbf22086c0 100644 --- a/osu.Game.Modes.Mania/ManiaRuleset.cs +++ b/osu.Game.Modes.Mania/ManiaRuleset.cs @@ -7,7 +7,6 @@ using osu.Game.Modes.Objects; using osu.Game.Modes.Osu.UI; using osu.Game.Modes.UI; using osu.Game.Beatmaps; -using System; namespace osu.Game.Modes.Mania { diff --git a/osu.Game.Modes.Mania/Properties/AssemblyInfo.cs b/osu.Game.Modes.Mania/Properties/AssemblyInfo.cs index c7c7296d60..6cfa3c42b3 100644 --- a/osu.Game.Modes.Mania/Properties/AssemblyInfo.cs +++ b/osu.Game.Modes.Mania/Properties/AssemblyInfo.cs @@ -2,7 +2,6 @@ // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE using System.Reflection; -using System.Runtime.CompilerServices; using System.Runtime.InteropServices; // General Information about an assembly is controlled through the following diff --git a/osu.Game.Modes.Osu/Objects/Drawables/DrawableSlider.cs b/osu.Game.Modes.Osu/Objects/Drawables/DrawableSlider.cs index 745c696fee..907ce8da63 100644 --- a/osu.Game.Modes.Osu/Objects/Drawables/DrawableSlider.cs +++ b/osu.Game.Modes.Osu/Objects/Drawables/DrawableSlider.cs @@ -107,7 +107,7 @@ namespace osu.Game.Modes.Osu.Objects.Drawables if (repeat > currentRepeat) { - if (ball.Tracking) + if (repeat < slider.RepeatCount && ball.Tracking) PlaySample(); currentRepeat = repeat; } diff --git a/osu.Game.Modes.Osu/Objects/Drawables/DrawableSpinner.cs b/osu.Game.Modes.Osu/Objects/Drawables/DrawableSpinner.cs index 2f6322a046..ad57341d18 100644 --- a/osu.Game.Modes.Osu/Objects/Drawables/DrawableSpinner.cs +++ b/osu.Game.Modes.Osu/Objects/Drawables/DrawableSpinner.cs @@ -120,12 +120,15 @@ namespace osu.Game.Modes.Osu.Objects.Drawables { base.UpdatePreemptState(); - FadeIn(200); circleContainer.ScaleTo(1, 400, EasingTypes.OutElastic); - background.Delay(TIME_PREEMPT - 100); + background.Delay(TIME_PREEMPT - 500); + + background.ScaleTo(scaleToCircle * 1.2f, 400, EasingTypes.OutQuint); background.FadeIn(200); - background.ScaleTo(1, 200, EasingTypes.OutQuint); + + background.Delay(400); + background.ScaleTo(1, 250, EasingTypes.OutQuint); disc.Delay(TIME_PREEMPT - 50); disc.FadeIn(200); diff --git a/osu.Game.Modes.Osu/Objects/Drawables/Pieces/ApproachCircle.cs b/osu.Game.Modes.Osu/Objects/Drawables/Pieces/ApproachCircle.cs index f1ab062848..b0b1e81fca 100644 --- a/osu.Game.Modes.Osu/Objects/Drawables/Pieces/ApproachCircle.cs +++ b/osu.Game.Modes.Osu/Objects/Drawables/Pieces/ApproachCircle.cs @@ -1,14 +1,11 @@ // Copyright (c) 2007-2017 ppy Pty Ltd . // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE -using System; using osu.Framework.Allocation; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Sprites; using osu.Framework.Graphics.Textures; -using osu.Framework.Input; -using OpenTK; namespace osu.Game.Modes.Osu.Objects.Drawables.Pieces { diff --git a/osu.Game.Modes.Osu/Objects/Drawables/Pieces/NumberPiece.cs b/osu.Game.Modes.Osu/Objects/Drawables/Pieces/NumberPiece.cs index bb18e32475..02116fc157 100644 --- a/osu.Game.Modes.Osu/Objects/Drawables/Pieces/NumberPiece.cs +++ b/osu.Game.Modes.Osu/Objects/Drawables/Pieces/NumberPiece.cs @@ -1,14 +1,11 @@ // Copyright (c) 2007-2017 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.Sprites; -using osu.Framework.Graphics.Textures; using osu.Game.Graphics; using osu.Game.Graphics.Sprites; -using OpenTK; using OpenTK.Graphics; namespace osu.Game.Modes.Osu.Objects.Drawables.Pieces diff --git a/osu.Game.Modes.Osu/Objects/Drawables/Pieces/RingPiece.cs b/osu.Game.Modes.Osu/Objects/Drawables/Pieces/RingPiece.cs index 3a98973b15..3e172cdc09 100644 --- a/osu.Game.Modes.Osu/Objects/Drawables/Pieces/RingPiece.cs +++ b/osu.Game.Modes.Osu/Objects/Drawables/Pieces/RingPiece.cs @@ -1,11 +1,9 @@ // Copyright (c) 2007-2017 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.Sprites; -using osu.Framework.Graphics.Textures; using OpenTK; using OpenTK.Graphics; diff --git a/osu.Game.Modes.Osu/Objects/Drawables/Pieces/SliderBall.cs b/osu.Game.Modes.Osu/Objects/Drawables/Pieces/SliderBall.cs index 88bf49b644..1e81b17b06 100644 --- a/osu.Game.Modes.Osu/Objects/Drawables/Pieces/SliderBall.cs +++ b/osu.Game.Modes.Osu/Objects/Drawables/Pieces/SliderBall.cs @@ -6,7 +6,6 @@ using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Sprites; using osu.Framework.Graphics.Transformations; using osu.Framework.Input; -using OpenTK; using OpenTK.Graphics; namespace osu.Game.Modes.Osu.Objects.Drawables.Pieces diff --git a/osu.Game.Modes.Osu/Objects/Drawables/Pieces/SliderBouncer.cs b/osu.Game.Modes.Osu/Objects/Drawables/Pieces/SliderBouncer.cs index e13f8626a5..1a78e5d85f 100644 --- a/osu.Game.Modes.Osu/Objects/Drawables/Pieces/SliderBouncer.cs +++ b/osu.Game.Modes.Osu/Objects/Drawables/Pieces/SliderBouncer.cs @@ -1,14 +1,8 @@ // Copyright (c) 2007-2017 ppy Pty Ltd . // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; -using osu.Framework.Graphics.Sprites; using osu.Game.Graphics; namespace osu.Game.Modes.Osu.Objects.Drawables.Pieces diff --git a/osu.Game.Modes.Osu/Objects/Drawables/Pieces/SpinnerDisc.cs b/osu.Game.Modes.Osu/Objects/Drawables/Pieces/SpinnerDisc.cs index e982f52b44..405105936d 100644 --- a/osu.Game.Modes.Osu/Objects/Drawables/Pieces/SpinnerDisc.cs +++ b/osu.Game.Modes.Osu/Objects/Drawables/Pieces/SpinnerDisc.cs @@ -10,7 +10,6 @@ using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Sprites; using osu.Framework.Graphics.Transformations; using osu.Framework.Input; -using osu.Framework.Logging; using osu.Game.Graphics; using OpenTK; using OpenTK.Graphics; @@ -173,7 +172,7 @@ namespace osu.Game.Modes.Osu.Objects.Drawables.Pieces private int completeTick; - private bool updateCompleteTick() => completeTick != (completeTick = (int)(RotationAbsolute / 720)); + private bool updateCompleteTick() => completeTick != (completeTick = (int)(RotationAbsolute / 360)); protected override void Update() { diff --git a/osu.Game.Modes.Osu/Objects/Drawables/Pieces/TrianglesPiece.cs b/osu.Game.Modes.Osu/Objects/Drawables/Pieces/TrianglesPiece.cs index 57e00be1cf..33ed93e625 100644 --- a/osu.Game.Modes.Osu/Objects/Drawables/Pieces/TrianglesPiece.cs +++ b/osu.Game.Modes.Osu/Objects/Drawables/Pieces/TrianglesPiece.cs @@ -1,7 +1,6 @@ // Copyright (c) 2007-2017 ppy Pty Ltd . // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE -using System; using osu.Game.Graphics.Backgrounds; namespace osu.Game.Modes.Osu.Objects.Drawables.Pieces diff --git a/osu.Game.Modes.Osu/Objects/HitCircle.cs b/osu.Game.Modes.Osu/Objects/HitCircle.cs index 0eaf5abdff..80f9317d96 100644 --- a/osu.Game.Modes.Osu/Objects/HitCircle.cs +++ b/osu.Game.Modes.Osu/Objects/HitCircle.cs @@ -1,7 +1,6 @@ // Copyright (c) 2007-2017 ppy Pty Ltd . // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE -using System; namespace osu.Game.Modes.Osu.Objects { diff --git a/osu.Game.Modes.Osu/Objects/OsuHitObject.cs b/osu.Game.Modes.Osu/Objects/OsuHitObject.cs index f454ebc470..cbf9a3de9c 100644 --- a/osu.Game.Modes.Osu/Objects/OsuHitObject.cs +++ b/osu.Game.Modes.Osu/Objects/OsuHitObject.cs @@ -2,7 +2,6 @@ // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE using System; -using osu.Game.Beatmaps.Samples; using osu.Game.Modes.Objects; using OpenTK; using osu.Game.Beatmaps; diff --git a/osu.Game.Modes.Osu/Objects/OsuHitObjectParser.cs b/osu.Game.Modes.Osu/Objects/OsuHitObjectParser.cs index b4dc494ad4..e8818db1d5 100644 --- a/osu.Game.Modes.Osu/Objects/OsuHitObjectParser.cs +++ b/osu.Game.Modes.Osu/Objects/OsuHitObjectParser.cs @@ -4,9 +4,6 @@ using System; using System.Collections.Generic; using System.Globalization; -using System.Linq; -using System.Text; -using System.Threading.Tasks; using osu.Game.Beatmaps.Samples; using osu.Game.Modes.Objects; using OpenTK; diff --git a/osu.Game.Modes.Osu/Objects/SliderTick.cs b/osu.Game.Modes.Osu/Objects/SliderTick.cs index 392b1f99ca..d9b8c03c3c 100644 --- a/osu.Game.Modes.Osu/Objects/SliderTick.cs +++ b/osu.Game.Modes.Osu/Objects/SliderTick.cs @@ -1,6 +1,4 @@ -using OpenTK; - -namespace osu.Game.Modes.Osu.Objects +namespace osu.Game.Modes.Osu.Objects { public class SliderTick : OsuHitObject { diff --git a/osu.Game.Modes.Osu/Objects/Spinner.cs b/osu.Game.Modes.Osu/Objects/Spinner.cs index 095705eb1f..8a9b5bbbe3 100644 --- a/osu.Game.Modes.Osu/Objects/Spinner.cs +++ b/osu.Game.Modes.Osu/Objects/Spinner.cs @@ -1,7 +1,6 @@ // Copyright (c) 2007-2017 ppy Pty Ltd . // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE -using osu.Game.Beatmaps; namespace osu.Game.Modes.Osu.Objects { diff --git a/osu.Game.Modes.Osu/OsuScore.cs b/osu.Game.Modes.Osu/OsuScore.cs index 2a3c9a866f..ce651e0809 100644 --- a/osu.Game.Modes.Osu/OsuScore.cs +++ b/osu.Game.Modes.Osu/OsuScore.cs @@ -1,11 +1,6 @@ // Copyright (c) 2007-2017 ppy Pty Ltd . // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; namespace osu.Game.Modes.Osu { diff --git a/osu.Game.Modes.Osu/Properties/AssemblyInfo.cs b/osu.Game.Modes.Osu/Properties/AssemblyInfo.cs index 2991947d85..61e6ae6f7a 100644 --- a/osu.Game.Modes.Osu/Properties/AssemblyInfo.cs +++ b/osu.Game.Modes.Osu/Properties/AssemblyInfo.cs @@ -2,7 +2,6 @@ // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE using System.Reflection; -using System.Runtime.CompilerServices; using System.Runtime.InteropServices; // General Information about an assembly is controlled through the following diff --git a/osu.Game.Modes.Osu/UI/OsuComboCounter.cs b/osu.Game.Modes.Osu/UI/OsuComboCounter.cs index b6770b6f21..5ba5537b59 100644 --- a/osu.Game.Modes.Osu/UI/OsuComboCounter.cs +++ b/osu.Game.Modes.Osu/UI/OsuComboCounter.cs @@ -3,7 +3,6 @@ using osu.Game.Modes.UI; using OpenTK; -using osu.Framework.Graphics.Primitives; namespace osu.Game.Modes.Osu.UI { diff --git a/osu.Game.Modes.Taiko/Properties/AssemblyInfo.cs b/osu.Game.Modes.Taiko/Properties/AssemblyInfo.cs index c4b0fffae7..61eca30b5f 100644 --- a/osu.Game.Modes.Taiko/Properties/AssemblyInfo.cs +++ b/osu.Game.Modes.Taiko/Properties/AssemblyInfo.cs @@ -2,7 +2,6 @@ // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE using System.Reflection; -using System.Runtime.CompilerServices; using System.Runtime.InteropServices; // General Information about an assembly is controlled through the following diff --git a/osu.Game.Modes.Taiko/TaikoRuleset.cs b/osu.Game.Modes.Taiko/TaikoRuleset.cs index 01e1598e20..6141838880 100644 --- a/osu.Game.Modes.Taiko/TaikoRuleset.cs +++ b/osu.Game.Modes.Taiko/TaikoRuleset.cs @@ -1,7 +1,6 @@ // Copyright (c) 2007-2017 ppy Pty Ltd . // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE -using System; using osu.Game.Graphics; using osu.Game.Modes.Objects; using osu.Game.Modes.Osu.UI; diff --git a/osu.Game.Tests/Beatmaps/IO/ImportBeatmapTest.cs b/osu.Game.Tests/Beatmaps/IO/ImportBeatmapTest.cs index 6a162a4ab9..ce702e5679 100644 --- a/osu.Game.Tests/Beatmaps/IO/ImportBeatmapTest.cs +++ b/osu.Game.Tests/Beatmaps/IO/ImportBeatmapTest.cs @@ -3,7 +3,6 @@ using System; using System.Collections.Generic; -using System.IO; using System.Linq; using System.Threading; using NUnit.Framework; @@ -16,7 +15,6 @@ using osu.Game.Modes.Catch; using osu.Game.Modes.Mania; using osu.Game.Modes.Osu; using osu.Game.Modes.Taiko; -using osu.Game.Screens.Play; namespace osu.Game.Tests.Beatmaps.IO { @@ -58,14 +56,14 @@ namespace osu.Game.Tests.Beatmaps.IO var osu = loadOsu(host); var importer = new BeatmapImporter(client); - if (!importer.Import(osz_path).Wait(1000)) + if (!importer.ImportAsync(osz_path).Wait(1000)) Assert.Fail(@"IPC took too long to send"); ensureLoaded(osu, 10000); } } - private OsuGameBase loadOsu(BasicGameHost host) + private OsuGameBase loadOsu(GameHost host) { var osu = new OsuGameBase(); host.Add(osu); diff --git a/osu.Game.Tests/Beatmaps/IO/OszArchiveReaderTest.cs b/osu.Game.Tests/Beatmaps/IO/OszArchiveReaderTest.cs index 3d706a8026..faa83518ba 100644 --- a/osu.Game.Tests/Beatmaps/IO/OszArchiveReaderTest.cs +++ b/osu.Game.Tests/Beatmaps/IO/OszArchiveReaderTest.cs @@ -1,7 +1,6 @@ // Copyright (c) 2007-2017 ppy Pty Ltd . // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE -using System; using System.IO; using NUnit.Framework; using osu.Game.Beatmaps.IO; diff --git a/osu.Game/Beatmaps/Drawables/BeatmapGroup.cs b/osu.Game/Beatmaps/Drawables/BeatmapGroup.cs index 14aff0e7ba..192a383fdf 100644 --- a/osu.Game/Beatmaps/Drawables/BeatmapGroup.cs +++ b/osu.Game/Beatmaps/Drawables/BeatmapGroup.cs @@ -6,7 +6,6 @@ using System.Collections.Generic; using System.Linq; using osu.Framework; using osu.Framework.Graphics; -using osu.Framework.Graphics.Transformations; using osu.Game.Database; namespace osu.Game.Beatmaps.Drawables diff --git a/osu.Game/Beatmaps/Drawables/BeatmapSetHeader.cs b/osu.Game/Beatmaps/Drawables/BeatmapSetHeader.cs index a0a7549caf..8681259272 100644 --- a/osu.Game/Beatmaps/Drawables/BeatmapSetHeader.cs +++ b/osu.Game/Beatmaps/Drawables/BeatmapSetHeader.cs @@ -11,7 +11,6 @@ using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Primitives; using osu.Framework.Graphics.Sprites; using osu.Game.Configuration; -using osu.Game.Graphics; using osu.Game.Graphics.Sprites; using OpenTK; using OpenTK.Graphics; @@ -162,7 +161,7 @@ namespace osu.Game.Beatmaps.Drawables Anchor = Anchor.Centre, Origin = Anchor.Centre, FillMode = FillMode.Fill, - }.Preload(game, (bg) => + }.LoadAsync(game, (bg) => { Add(bg); ForceRedraw(); diff --git a/osu.Game/Beatmaps/Drawables/DifficultyIcon.cs b/osu.Game/Beatmaps/Drawables/DifficultyIcon.cs index d3a5106b0e..e0e390fcb1 100644 --- a/osu.Game/Beatmaps/Drawables/DifficultyIcon.cs +++ b/osu.Game/Beatmaps/Drawables/DifficultyIcon.cs @@ -1,10 +1,8 @@ // Copyright (c) 2007-2017 ppy Pty Ltd . // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE -using System; using osu.Framework.Allocation; using osu.Framework.Graphics; -using osu.Framework.Graphics.Colour; using osu.Framework.Graphics.Containers; using osu.Game.Database; using osu.Game.Graphics; diff --git a/osu.Game/Beatmaps/Drawables/Panel.cs b/osu.Game/Beatmaps/Drawables/Panel.cs index 5899f250b4..2e5f5f248b 100644 --- a/osu.Game/Beatmaps/Drawables/Panel.cs +++ b/osu.Game/Beatmaps/Drawables/Panel.cs @@ -38,6 +38,8 @@ namespace osu.Game.Beatmaps.Drawables CornerRadius = 10, BorderColour = new Color4(221, 255, 255, 255), }); + + Alpha = 0; } public void SetMultiplicativeAlpha(float alpha) diff --git a/osu.Game/Beatmaps/Events/EventType.cs b/osu.Game/Beatmaps/Events/EventType.cs index 23a5cf684c..0d4be693f0 100644 --- a/osu.Game/Beatmaps/Events/EventType.cs +++ b/osu.Game/Beatmaps/Events/EventType.cs @@ -1,7 +1,6 @@ // Copyright (c) 2007-2017 ppy Pty Ltd . // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE -using System; namespace osu.Game.Beatmaps.Events { public enum EventType diff --git a/osu.Game/Beatmaps/Formats/BeatmapDecoder.cs b/osu.Game/Beatmaps/Formats/BeatmapDecoder.cs index 4846cf376d..7f55b3be1b 100644 --- a/osu.Game/Beatmaps/Formats/BeatmapDecoder.cs +++ b/osu.Game/Beatmaps/Formats/BeatmapDecoder.cs @@ -6,7 +6,6 @@ using System.Collections.Generic; using System.IO; using osu.Game.Modes.Objects; using OpenTK.Graphics; -using osu.Game.Graphics; using osu.Game.Beatmaps.Timing; using osu.Game.Database; diff --git a/osu.Game/Beatmaps/Formats/ConstructableBeatmapDecoder.cs b/osu.Game/Beatmaps/Formats/ConstructableBeatmapDecoder.cs index f80c673e89..3e7dbb4d1b 100644 --- a/osu.Game/Beatmaps/Formats/ConstructableBeatmapDecoder.cs +++ b/osu.Game/Beatmaps/Formats/ConstructableBeatmapDecoder.cs @@ -2,11 +2,7 @@ // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE using System; -using System.Collections.Generic; using System.IO; -using System.Linq; -using System.Text; -using System.Threading.Tasks; namespace osu.Game.Beatmaps.Formats { diff --git a/osu.Game/Beatmaps/Formats/OsuLegacyDecoder.cs b/osu.Game/Beatmaps/Formats/OsuLegacyDecoder.cs index c32c3fe2f1..aa2e2fbc75 100644 --- a/osu.Game/Beatmaps/Formats/OsuLegacyDecoder.cs +++ b/osu.Game/Beatmaps/Formats/OsuLegacyDecoder.cs @@ -2,17 +2,14 @@ // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE using System; -using System.Collections.Generic; using System.Globalization; using System.IO; using OpenTK.Graphics; -using osu.Game.Database; using osu.Game.Beatmaps.Events; using osu.Game.Beatmaps.Samples; using osu.Game.Beatmaps.Timing; using osu.Game.Modes; using osu.Game.Modes.Objects; -using osu.Game.Screens.Play; namespace osu.Game.Beatmaps.Formats { diff --git a/osu.Game/Beatmaps/IO/ArchiveReader.cs b/osu.Game/Beatmaps/IO/ArchiveReader.cs index cb5f936939..bbf4de20f5 100644 --- a/osu.Game/Beatmaps/IO/ArchiveReader.cs +++ b/osu.Game/Beatmaps/IO/ArchiveReader.cs @@ -14,13 +14,13 @@ namespace osu.Game.Beatmaps.IO { private class Reader { - public Func Test { get; set; } + public Func Test { get; set; } public Type Type { get; set; } } private static List readers { get; } = new List(); - public static ArchiveReader GetReader(BasicStorage storage, string path) + public static ArchiveReader GetReader(Storage storage, string path) { foreach (var reader in readers) { @@ -30,7 +30,7 @@ namespace osu.Game.Beatmaps.IO throw new IOException(@"Unknown file format"); } - protected static void AddReader(Func test) where T : ArchiveReader + protected static void AddReader(Func test) where T : ArchiveReader { readers.Add(new Reader { Test = test, Type = typeof(T) }); } diff --git a/osu.Game/Beatmaps/IO/OszArchiveReader.cs b/osu.Game/Beatmaps/IO/OszArchiveReader.cs index 273e0c1fb9..8a1d071cfc 100644 --- a/osu.Game/Beatmaps/IO/OszArchiveReader.cs +++ b/osu.Game/Beatmaps/IO/OszArchiveReader.cs @@ -1,10 +1,8 @@ // Copyright (c) 2007-2017 ppy Pty Ltd . // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE -using System; using System.IO; using System.Linq; -using System.Security.Cryptography; using Ionic.Zip; using osu.Game.Beatmaps.Formats; using osu.Game.Database; diff --git a/osu.Game/Beatmaps/Timing/TimingChange.cs b/osu.Game/Beatmaps/Timing/TimingChange.cs index 10a68bb540..74e855e157 100644 --- a/osu.Game/Beatmaps/Timing/TimingChange.cs +++ b/osu.Game/Beatmaps/Timing/TimingChange.cs @@ -5,8 +5,6 @@ namespace osu.Game.Beatmaps.Timing { class TimingChange : ControlPoint { - public double BeatLength; - public TimingChange(double beatLength) { BeatLength = beatLength; diff --git a/osu.Game/Beatmaps/WorkingBeatmap.cs b/osu.Game/Beatmaps/WorkingBeatmap.cs index 28c2c5f0e2..c6bc4eeeb8 100644 --- a/osu.Game/Beatmaps/WorkingBeatmap.cs +++ b/osu.Game/Beatmaps/WorkingBeatmap.cs @@ -113,6 +113,8 @@ namespace osu.Game.Beatmaps public WorkingBeatmap(Beatmap beatmap) { this.beatmap = beatmap; + BeatmapInfo = beatmap.BeatmapInfo; + BeatmapSetInfo = beatmap.BeatmapInfo.BeatmapSet; } public WorkingBeatmap(BeatmapInfo beatmapInfo, BeatmapSetInfo beatmapSetInfo, BeatmapDatabase database, bool withStoryboard = false) diff --git a/osu.Game/Configuration/ConfineMouseMode.cs b/osu.Game/Configuration/ConfineMouseMode.cs index 31a37fda7f..527f26cf6b 100644 --- a/osu.Game/Configuration/ConfineMouseMode.cs +++ b/osu.Game/Configuration/ConfineMouseMode.cs @@ -1,7 +1,6 @@ // Copyright (c) 2007-2017 ppy Pty Ltd . // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE -using System; namespace osu.Game.Configuration { public enum ConfineMouseMode diff --git a/osu.Game/Configuration/OsuConfigManager.cs b/osu.Game/Configuration/OsuConfigManager.cs index 1562571efc..ccf53ed714 100644 --- a/osu.Game/Configuration/OsuConfigManager.cs +++ b/osu.Game/Configuration/OsuConfigManager.cs @@ -189,7 +189,7 @@ namespace osu.Game.Configuration public string GetUnicodeString(string nonunicode, string unicode) => Get(OsuConfig.ShowUnicode) ? unicode ?? nonunicode : nonunicode ?? unicode; - public OsuConfigManager(BasicStorage storage) : base(storage) + public OsuConfigManager(Storage storage) : base(storage) { } } diff --git a/osu.Game/Configuration/ProgressBarType.cs b/osu.Game/Configuration/ProgressBarType.cs index 8c971b7f18..a768b9f129 100644 --- a/osu.Game/Configuration/ProgressBarType.cs +++ b/osu.Game/Configuration/ProgressBarType.cs @@ -1,7 +1,6 @@ // Copyright (c) 2007-2017 ppy Pty Ltd . // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE -using System; using System.ComponentModel; namespace osu.Game.Configuration diff --git a/osu.Game/Configuration/RankingType.cs b/osu.Game/Configuration/RankingType.cs index 852904315e..ff504ba292 100644 --- a/osu.Game/Configuration/RankingType.cs +++ b/osu.Game/Configuration/RankingType.cs @@ -1,11 +1,10 @@ // Copyright (c) 2007-2017 ppy Pty Ltd . // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE -using System; using System.ComponentModel; namespace osu.Game.Configuration -{ +{ public enum RankingType { Local, diff --git a/osu.Game/Configuration/ReleaseStream.cs b/osu.Game/Configuration/ReleaseStream.cs index cbab5d3ff2..b258ab2f37 100644 --- a/osu.Game/Configuration/ReleaseStream.cs +++ b/osu.Game/Configuration/ReleaseStream.cs @@ -1,7 +1,6 @@ // Copyright (c) 2007-2017 ppy Pty Ltd . // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE -using System; namespace osu.Game.Configuration { public enum ReleaseStream diff --git a/osu.Game/Configuration/ScoreMeterType.cs b/osu.Game/Configuration/ScoreMeterType.cs index 596a63b1ef..8926f3ad81 100644 --- a/osu.Game/Configuration/ScoreMeterType.cs +++ b/osu.Game/Configuration/ScoreMeterType.cs @@ -1,7 +1,6 @@ // Copyright (c) 2007-2017 ppy Pty Ltd . // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE -using System; namespace osu.Game.Configuration { public enum ScoreMeterType diff --git a/osu.Game/Configuration/ScreenshotFormat.cs b/osu.Game/Configuration/ScreenshotFormat.cs index c1a45d3479..1a1a3f8920 100644 --- a/osu.Game/Configuration/ScreenshotFormat.cs +++ b/osu.Game/Configuration/ScreenshotFormat.cs @@ -1,7 +1,6 @@ // Copyright (c) 2007-2017 ppy Pty Ltd . // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE -using System; using System.ComponentModel; namespace osu.Game.Configuration diff --git a/osu.Game/Database/BaseDifficulty.cs b/osu.Game/Database/BaseDifficulty.cs index 6baba3dedd..83f6e2fdd5 100644 --- a/osu.Game/Database/BaseDifficulty.cs +++ b/osu.Game/Database/BaseDifficulty.cs @@ -1,7 +1,6 @@ // Copyright (c) 2007-2017 ppy Pty Ltd . // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE -using System; using SQLite.Net.Attributes; namespace osu.Game.Database diff --git a/osu.Game/Database/BeatmapDatabase.cs b/osu.Game/Database/BeatmapDatabase.cs index 9c7e70f8eb..253b83aa38 100644 --- a/osu.Game/Database/BeatmapDatabase.cs +++ b/osu.Game/Database/BeatmapDatabase.cs @@ -2,9 +2,7 @@ // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE using System; -using System.Collections; using System.Collections.Generic; -using System.Diagnostics; using System.IO; using System.Linq; using System.Linq.Expressions; @@ -22,12 +20,12 @@ namespace osu.Game.Database public class BeatmapDatabase { private SQLiteConnection connection { get; set; } - private BasicStorage storage; + private Storage storage; public event Action BeatmapSetAdded; private BeatmapImporter ipc; - public BeatmapDatabase(BasicStorage storage, BasicGameHost importHost = null) + public BeatmapDatabase(Storage storage, GameHost importHost = null) { this.storage = storage; diff --git a/osu.Game/Database/BeatmapInfo.cs b/osu.Game/Database/BeatmapInfo.cs index ec797d518e..dd0fffe855 100644 --- a/osu.Game/Database/BeatmapInfo.cs +++ b/osu.Game/Database/BeatmapInfo.cs @@ -5,7 +5,6 @@ using System; using System.Linq; using osu.Game.Beatmaps.Samples; using osu.Game.Modes; -using osu.Game.Screens.Play; using SQLite.Net.Attributes; using SQLiteNetExtensions.Attributes; using osu.Game.Beatmaps; diff --git a/osu.Game/Database/BeatmapSetInfo.cs b/osu.Game/Database/BeatmapSetInfo.cs index a9c3f03a49..88d35d20a8 100644 --- a/osu.Game/Database/BeatmapSetInfo.cs +++ b/osu.Game/Database/BeatmapSetInfo.cs @@ -1,7 +1,6 @@ // Copyright (c) 2007-2017 ppy Pty Ltd . // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE -using System; using System.Collections.Generic; using SQLite.Net.Attributes; using SQLiteNetExtensions.Attributes; diff --git a/osu.Game/Graphics/Backgrounds/Background.cs b/osu.Game/Graphics/Backgrounds/Background.cs index 5ff63ead2a..c35006f416 100644 --- a/osu.Game/Graphics/Backgrounds/Background.cs +++ b/osu.Game/Graphics/Backgrounds/Background.cs @@ -1,13 +1,11 @@ // Copyright (c) 2007-2017 ppy Pty Ltd . // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE -using System; using osu.Framework.Allocation; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Sprites; using osu.Framework.Graphics.Textures; -using OpenTK; using OpenTK.Graphics; namespace osu.Game.Graphics.Backgrounds diff --git a/osu.Game/Graphics/Containers/ParallaxContainer.cs b/osu.Game/Graphics/Containers/ParallaxContainer.cs index bc54fd8fdc..24f8f3076d 100644 --- a/osu.Game/Graphics/Containers/ParallaxContainer.cs +++ b/osu.Game/Graphics/Containers/ParallaxContainer.cs @@ -5,7 +5,6 @@ using osu.Framework.Graphics.Containers; using osu.Framework.Graphics; using osu.Framework.Input; using OpenTK; -using osu.Framework; using osu.Framework.Allocation; using osu.Framework.Graphics.Transformations; using osu.Game.Configuration; diff --git a/osu.Game/Graphics/OsuColour.cs b/osu.Game/Graphics/OsuColour.cs index 6995a7ab82..5d9745b8a2 100644 --- a/osu.Game/Graphics/OsuColour.cs +++ b/osu.Game/Graphics/OsuColour.cs @@ -2,9 +2,7 @@ // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE using System; -using System.Diagnostics; using OpenTK.Graphics; -using osu.Framework.Graphics.Colour; namespace osu.Game.Graphics { diff --git a/osu.Game/Graphics/TextAwesome.cs b/osu.Game/Graphics/TextAwesome.cs index 07df1e1c94..03769e6f6b 100644 --- a/osu.Game/Graphics/TextAwesome.cs +++ b/osu.Game/Graphics/TextAwesome.cs @@ -2,7 +2,6 @@ // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE using osu.Framework.Graphics.Sprites; -using OpenTK; namespace osu.Game.Graphics { diff --git a/osu.Game/Graphics/UserInterface/BackButton.cs b/osu.Game/Graphics/UserInterface/BackButton.cs index fa66527195..2b4b9cdb04 100644 --- a/osu.Game/Graphics/UserInterface/BackButton.cs +++ b/osu.Game/Graphics/UserInterface/BackButton.cs @@ -4,7 +4,6 @@ using osu.Framework.Allocation; using osu.Framework.Audio; using osu.Framework.Graphics; -using osu.Game.Graphics.Sprites; namespace osu.Game.Graphics.UserInterface { @@ -22,7 +21,7 @@ namespace osu.Game.Graphics.UserInterface private void load(AudioManager audio, OsuColour colours) { ActivationSound = audio.Sample.Get(@"Menu/menuback"); - Colour = colours.Pink; + BackgroundColour = colours.Pink; HoverColour = colours.PinkDark; } } diff --git a/osu.Game/Graphics/UserInterface/FocusedTextBox.cs b/osu.Game/Graphics/UserInterface/FocusedTextBox.cs new file mode 100644 index 0000000000..f657ffe330 --- /dev/null +++ b/osu.Game/Graphics/UserInterface/FocusedTextBox.cs @@ -0,0 +1,49 @@ +using OpenTK.Graphics; +using OpenTK.Input; +using osu.Framework.Input; +using System; +using System.Linq; + +namespace osu.Game.Graphics.UserInterface +{ + public class FocusedTextBox : OsuTextBox + { + protected override Color4 BackgroundUnfocused => new Color4(10, 10, 10, 255); + protected override Color4 BackgroundFocused => new Color4(10, 10, 10, 255); + + public Action Exit; + + private bool focus; + public bool HoldFocus + { + get { return focus; } + set + { + focus = value; + if (!focus) + TriggerFocusLost(); + } + } + + protected override bool OnFocus(InputState state) + { + var result = base.OnFocus(state); + BorderThickness = 0; + return result; + } + + protected override void OnFocusLost(InputState state) + { + if (state.Keyboard.Keys.Any(key => key == Key.Escape)) + { + if (Text.Length > 0) + Text = string.Empty; + else + Exit?.Invoke(); + } + base.OnFocusLost(state); + } + + public override bool RequestingFocus => HoldFocus; + } +} diff --git a/osu.Game/Graphics/UserInterface/LoadingAnimation.cs b/osu.Game/Graphics/UserInterface/LoadingAnimation.cs index 42d23f40f8..61ec859b44 100644 --- a/osu.Game/Graphics/UserInterface/LoadingAnimation.cs +++ b/osu.Game/Graphics/UserInterface/LoadingAnimation.cs @@ -1,7 +1,6 @@ // Copyright (c) 2007-2017 ppy Pty Ltd . // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE -using System; using osu.Framework.Graphics.Sprites; namespace osu.Game.Graphics.UserInterface diff --git a/osu.Game/Graphics/UserInterface/OsuButton.cs b/osu.Game/Graphics/UserInterface/OsuButton.cs index 31f66407ce..4cb827661a 100644 --- a/osu.Game/Graphics/UserInterface/OsuButton.cs +++ b/osu.Game/Graphics/UserInterface/OsuButton.cs @@ -1,7 +1,6 @@ // Copyright (c) 2007-2017 ppy Pty Ltd . // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE -using System; using OpenTK.Graphics; using osu.Framework.Allocation; using osu.Framework.Graphics; @@ -11,7 +10,6 @@ using osu.Framework.Graphics.UserInterface; using osu.Framework.Input; using osu.Game.Graphics.Backgrounds; using osu.Game.Graphics.Sprites; -using osu.Game.Overlays; namespace osu.Game.Graphics.UserInterface { diff --git a/osu.Game/Graphics/UserInterface/OsuCheckbox.cs b/osu.Game/Graphics/UserInterface/OsuCheckbox.cs index b05d005a1b..a2469afb53 100644 --- a/osu.Game/Graphics/UserInterface/OsuCheckbox.cs +++ b/osu.Game/Graphics/UserInterface/OsuCheckbox.cs @@ -2,21 +2,16 @@ // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE using System; -using osu.Framework; using osu.Framework.Allocation; using osu.Framework.Audio; using osu.Framework.Audio.Sample; using osu.Framework.Configuration; using osu.Framework.Graphics; -using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Primitives; using osu.Framework.Graphics.Sprites; -using osu.Framework.Graphics.Transformations; using osu.Framework.Graphics.UserInterface; using osu.Framework.Input; using osu.Game.Graphics.Sprites; -using osu.Game.Overlays; -using OpenTK; using OpenTK.Graphics; namespace osu.Game.Graphics.UserInterface diff --git a/osu.Game/Graphics/UserInterface/OsuDropDownHeader.cs b/osu.Game/Graphics/UserInterface/OsuDropDownHeader.cs index 56b883321a..3fc83afb52 100644 --- a/osu.Game/Graphics/UserInterface/OsuDropDownHeader.cs +++ b/osu.Game/Graphics/UserInterface/OsuDropDownHeader.cs @@ -6,7 +6,6 @@ using osu.Framework.Graphics; using osu.Framework.Graphics.Primitives; using osu.Framework.Graphics.Sprites; using osu.Framework.Graphics.UserInterface; -using osu.Game.Graphics; using osu.Game.Graphics.Sprites; using OpenTK.Graphics; diff --git a/osu.Game/Graphics/UserInterface/OsuDropDownMenu.cs b/osu.Game/Graphics/UserInterface/OsuDropDownMenu.cs index 3cbc1c8674..5bb2414bb3 100644 --- a/osu.Game/Graphics/UserInterface/OsuDropDownMenu.cs +++ b/osu.Game/Graphics/UserInterface/OsuDropDownMenu.cs @@ -1,11 +1,8 @@ // Copyright (c) 2007-2017 ppy Pty Ltd . // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE -using System; using System.Collections.Generic; -using System.ComponentModel; using System.Linq; -using System.Reflection; using osu.Framework.Graphics.Transformations; using osu.Framework.Graphics.UserInterface; using OpenTK; diff --git a/osu.Game/Graphics/UserInterface/OsuDropDownMenuItem.cs b/osu.Game/Graphics/UserInterface/OsuDropDownMenuItem.cs index bbc8bd3e47..c2eb1fbc69 100644 --- a/osu.Game/Graphics/UserInterface/OsuDropDownMenuItem.cs +++ b/osu.Game/Graphics/UserInterface/OsuDropDownMenuItem.cs @@ -6,7 +6,6 @@ using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Primitives; using osu.Framework.Graphics.UserInterface; -using osu.Game.Graphics; using osu.Game.Graphics.Sprites; using OpenTK.Graphics; diff --git a/osu.Game/Graphics/UserInterface/OsuTextBox.cs b/osu.Game/Graphics/UserInterface/OsuTextBox.cs index 0e551380ed..d7bc245027 100644 --- a/osu.Game/Graphics/UserInterface/OsuTextBox.cs +++ b/osu.Game/Graphics/UserInterface/OsuTextBox.cs @@ -8,7 +8,6 @@ using osu.Framework.Graphics.Sprites; using osu.Framework.Graphics.UserInterface; using osu.Framework.Input; using osu.Game.Graphics.Sprites; -using osu.Game.Overlays; using OpenTK.Graphics; namespace osu.Game.Graphics.UserInterface diff --git a/osu.Game/Graphics/UserInterface/PercentageCounter.cs b/osu.Game/Graphics/UserInterface/PercentageCounter.cs index 6b48dff26e..b0ccf63fcb 100644 --- a/osu.Game/Graphics/UserInterface/PercentageCounter.cs +++ b/osu.Game/Graphics/UserInterface/PercentageCounter.cs @@ -1,15 +1,9 @@ // Copyright (c) 2007-2017 ppy Pty Ltd . // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE -using osu.Framework; using osu.Framework.Graphics; using osu.Framework.Graphics.Transformations; -using osu.Framework.Timing; using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; namespace osu.Game.Graphics.UserInterface { diff --git a/osu.Game/Graphics/UserInterface/ScoreCounter.cs b/osu.Game/Graphics/UserInterface/ScoreCounter.cs index e81c8e945b..2cc1521a24 100644 --- a/osu.Game/Graphics/UserInterface/ScoreCounter.cs +++ b/osu.Game/Graphics/UserInterface/ScoreCounter.cs @@ -4,12 +4,7 @@ using osu.Framework.Graphics; using osu.Framework.Graphics.Transformations; using osu.Framework.MathUtils; -using osu.Framework.Timing; using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; namespace osu.Game.Graphics.UserInterface { diff --git a/osu.Game/Graphics/UserInterface/StarCounter.cs b/osu.Game/Graphics/UserInterface/StarCounter.cs index 528f443025..442b3a351f 100644 --- a/osu.Game/Graphics/UserInterface/StarCounter.cs +++ b/osu.Game/Graphics/UserInterface/StarCounter.cs @@ -2,17 +2,12 @@ // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE using OpenTK; -using osu.Framework; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Transformations; using osu.Framework.MathUtils; using System; using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -using osu.Framework.Allocation; namespace osu.Game.Graphics.UserInterface { diff --git a/osu.Game/Graphics/UserInterface/TwoLayerButton.cs b/osu.Game/Graphics/UserInterface/TwoLayerButton.cs index 294d8533e4..cae2431898 100644 --- a/osu.Game/Graphics/UserInterface/TwoLayerButton.cs +++ b/osu.Game/Graphics/UserInterface/TwoLayerButton.cs @@ -35,7 +35,7 @@ namespace osu.Game.Graphics.UserInterface private Container c1; private Container c2; - public Color4 Colour + public Color4 BackgroundColour { set { diff --git a/osu.Game/Graphics/UserInterface/Volume/VolumeControl.cs b/osu.Game/Graphics/UserInterface/Volume/VolumeControl.cs index 5f14e27441..8701cbb718 100644 --- a/osu.Game/Graphics/UserInterface/Volume/VolumeControl.cs +++ b/osu.Game/Graphics/UserInterface/Volume/VolumeControl.cs @@ -2,8 +2,6 @@ // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE using System; -using osu.Framework; -using osu.Framework.Configuration; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Framework.Input; diff --git a/osu.Game/Graphics/UserInterface/Volume/VolumeControlReceptor.cs b/osu.Game/Graphics/UserInterface/Volume/VolumeControlReceptor.cs index 0ba18d7a72..2a04e1c527 100644 --- a/osu.Game/Graphics/UserInterface/Volume/VolumeControlReceptor.cs +++ b/osu.Game/Graphics/UserInterface/Volume/VolumeControlReceptor.cs @@ -6,7 +6,6 @@ using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Framework.Input; using OpenTK.Input; -using OpenTK; namespace osu.Game.Graphics.UserInterface.Volume { diff --git a/osu.Game/Graphics/UserInterface/Volume/VolumeMeter.cs b/osu.Game/Graphics/UserInterface/Volume/VolumeMeter.cs index 1caa2f7949..666bf95be5 100644 --- a/osu.Game/Graphics/UserInterface/Volume/VolumeMeter.cs +++ b/osu.Game/Graphics/UserInterface/Volume/VolumeMeter.cs @@ -1,7 +1,6 @@ // Copyright (c) 2007-2017 ppy Pty Ltd . // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE -using osu.Framework; using osu.Framework.Configuration; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; diff --git a/osu.Game/IPC/BeatmapImporter.cs b/osu.Game/IPC/BeatmapImporter.cs index 5b058d5bd8..b6ce4d1e35 100644 --- a/osu.Game/IPC/BeatmapImporter.cs +++ b/osu.Game/IPC/BeatmapImporter.cs @@ -13,7 +13,7 @@ namespace osu.Game.IPC private IpcChannel channel; private BeatmapDatabase beatmaps; - public BeatmapImporter(BasicGameHost host, BeatmapDatabase beatmaps = null) + public BeatmapImporter(GameHost host, BeatmapDatabase beatmaps = null) { this.beatmaps = beatmaps; @@ -21,13 +21,13 @@ namespace osu.Game.IPC channel.MessageReceived += messageReceived; } - public async Task Import(string path) + public async Task ImportAsync(string path) { if (beatmaps != null) beatmaps.Import(path); else { - await channel.SendMessage(new BeatmapImportMessage { Path = path }); + await channel.SendMessageAsync(new BeatmapImportMessage { Path = path }); } } @@ -35,7 +35,7 @@ namespace osu.Game.IPC { Debug.Assert(beatmaps != null); - Import(msg.Path); + ImportAsync(msg.Path); } } diff --git a/osu.Game/Modes/Objects/Drawables/DrawableHitObject.cs b/osu.Game/Modes/Objects/Drawables/DrawableHitObject.cs index 173176d8b4..ca1967904a 100644 --- a/osu.Game/Modes/Objects/Drawables/DrawableHitObject.cs +++ b/osu.Game/Modes/Objects/Drawables/DrawableHitObject.cs @@ -4,12 +4,10 @@ using System; using System.Collections.Generic; using System.ComponentModel; -using System.Diagnostics; using osu.Framework; using osu.Framework.Allocation; using osu.Framework.Audio; using osu.Framework.Audio.Sample; -using osu.Framework.Graphics.Containers; using osu.Game.Beatmaps.Samples; using OpenTK; using Container = osu.Framework.Graphics.Containers.Container; diff --git a/osu.Game/Modes/Objects/Drawables/IDrawableHitObjectWithProxiedApproach.cs b/osu.Game/Modes/Objects/Drawables/IDrawableHitObjectWithProxiedApproach.cs index 9abd2f8592..33a1f51414 100644 --- a/osu.Game/Modes/Objects/Drawables/IDrawableHitObjectWithProxiedApproach.cs +++ b/osu.Game/Modes/Objects/Drawables/IDrawableHitObjectWithProxiedApproach.cs @@ -1,11 +1,6 @@ // Copyright (c) 2007-2017 ppy Pty Ltd . // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; using osu.Framework.Graphics; namespace osu.Game.Modes.Objects.Drawables diff --git a/osu.Game/Modes/Objects/HitObject.cs b/osu.Game/Modes/Objects/HitObject.cs index cdc5f1655d..eda6bc7e2a 100644 --- a/osu.Game/Modes/Objects/HitObject.cs +++ b/osu.Game/Modes/Objects/HitObject.cs @@ -4,7 +4,6 @@ using osu.Game.Beatmaps; using osu.Game.Beatmaps.Samples; using OpenTK.Graphics; -using osu.Game.Graphics; namespace osu.Game.Modes.Objects { diff --git a/osu.Game/Modes/Objects/HitObjectParser.cs b/osu.Game/Modes/Objects/HitObjectParser.cs index 724e516de1..4020c1c069 100644 --- a/osu.Game/Modes/Objects/HitObjectParser.cs +++ b/osu.Game/Modes/Objects/HitObjectParser.cs @@ -1,11 +1,6 @@ // Copyright (c) 2007-2017 ppy Pty Ltd . // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; namespace osu.Game.Modes.Objects { diff --git a/osu.Game/Modes/Score.cs b/osu.Game/Modes/Score.cs index 3ee157068c..df1b65872f 100644 --- a/osu.Game/Modes/Score.cs +++ b/osu.Game/Modes/Score.cs @@ -1,11 +1,6 @@ // Copyright (c) 2007-2017 ppy Pty Ltd . // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; namespace osu.Game.Modes { diff --git a/osu.Game/Modes/ScoreProcesssor.cs b/osu.Game/Modes/ScoreProcesssor.cs index 36baf36693..eb4514f40d 100644 --- a/osu.Game/Modes/ScoreProcesssor.cs +++ b/osu.Game/Modes/ScoreProcesssor.cs @@ -3,9 +3,6 @@ using System; using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; using osu.Framework.Configuration; using osu.Game.Modes.Objects.Drawables; diff --git a/osu.Game/Online/API/APIAccess.cs b/osu.Game/Online/API/APIAccess.cs index 71671d09fb..a9e0b2163b 100644 --- a/osu.Game/Online/API/APIAccess.cs +++ b/osu.Game/Online/API/APIAccess.cs @@ -196,7 +196,10 @@ namespace osu.Game.Online.API Logger.Log($@"Performing request {req}", LoggingTarget.Network); req.Perform(this); - State = APIState.Online; + //we could still be in initialisation, at which point we don't want to say we're Online yet. + if (LocalUser.Value != null) + State = APIState.Online; + failureCount = 0; return true; } diff --git a/osu.Game/Online/API/IOnlineComponent.cs b/osu.Game/Online/API/IOnlineComponent.cs index 620e46640b..a4d25613b8 100644 --- a/osu.Game/Online/API/IOnlineComponent.cs +++ b/osu.Game/Online/API/IOnlineComponent.cs @@ -1,11 +1,6 @@ // Copyright (c) 2007-2017 ppy Pty Ltd . // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; namespace osu.Game.Online.API { diff --git a/osu.Game/Online/API/OAuth.cs b/osu.Game/Online/API/OAuth.cs index 2445f3101a..0ee7e0e030 100644 --- a/osu.Game/Online/API/OAuth.cs +++ b/osu.Game/Online/API/OAuth.cs @@ -1,7 +1,6 @@ // Copyright (c) 2007-2017 ppy Pty Ltd . // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE -using System; using System.Diagnostics; using osu.Framework.IO.Network; diff --git a/osu.Game/Online/API/SecurePassword.cs b/osu.Game/Online/API/SecurePassword.cs index ed40f7ec18..e3e46ba6dc 100644 --- a/osu.Game/Online/API/SecurePassword.cs +++ b/osu.Game/Online/API/SecurePassword.cs @@ -1,7 +1,6 @@ // Copyright (c) 2007-2017 ppy Pty Ltd . // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE -using System; using System.Diagnostics; using System.Security; using osu.Framework.Extensions; diff --git a/osu.Game/Online/Chat/Channel.cs b/osu.Game/Online/Chat/Channel.cs index e67bfabc2e..d895b93336 100644 --- a/osu.Game/Online/Chat/Channel.cs +++ b/osu.Game/Online/Chat/Channel.cs @@ -3,12 +3,7 @@ using System; using System.Collections.Generic; -using System.Diagnostics; -using System.Linq; using Newtonsoft.Json; -using osu.Framework.Configuration; -using osu.Game.Online.API; -using osu.Game.Online.API.Requests; namespace osu.Game.Online.Chat { @@ -30,16 +25,16 @@ namespace osu.Game.Online.Chat //internal bool Joined; - public const int MAX_HISTORY = 100; + public const int MAX_HISTORY = 300; [JsonConstructor] public Channel() { } - public event Action NewMessagesArrived; + public event Action> NewMessagesArrived; - public void AddNewMessages(params Message[] messages) + public void AddNewMessages(IEnumerable messages) { Messages.AddRange(messages); purgeOldMessages(); diff --git a/osu.Game/Online/Chat/Drawables/ChatLine.cs b/osu.Game/Online/Chat/Drawables/ChatLine.cs index 21c6659e78..c55dcc6620 100644 --- a/osu.Game/Online/Chat/Drawables/ChatLine.cs +++ b/osu.Game/Online/Chat/Drawables/ChatLine.cs @@ -4,7 +4,7 @@ using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Primitives; -using osu.Framework.Graphics.Sprites; +using osu.Game.Graphics; using osu.Game.Graphics.Sprites; using OpenTK; using OpenTK.Graphics; @@ -15,6 +15,50 @@ namespace osu.Game.Online.Chat.Drawables { public readonly Message Message; + private static readonly Color4[] username_colours = { + OsuColour.FromHex("588c7e"), + OsuColour.FromHex("b2a367"), + OsuColour.FromHex("c98f65"), + OsuColour.FromHex("bc5151"), + OsuColour.FromHex("5c8bd6"), + OsuColour.FromHex("7f6ab7"), + OsuColour.FromHex("a368ad"), + OsuColour.FromHex("aa6880"), + + OsuColour.FromHex("6fad9b"), + OsuColour.FromHex("f2e394"), + OsuColour.FromHex("f2ae72"), + OsuColour.FromHex("f98f8a"), + OsuColour.FromHex("7daef4"), + OsuColour.FromHex("a691f2"), + OsuColour.FromHex("c894d3"), + OsuColour.FromHex("d895b0"), + + OsuColour.FromHex("53c4a1"), + OsuColour.FromHex("eace5c"), + OsuColour.FromHex("ea8c47"), + OsuColour.FromHex("fc4f4f"), + OsuColour.FromHex("3d94ea"), + OsuColour.FromHex("7760ea"), + OsuColour.FromHex("af52c6"), + OsuColour.FromHex("e25696"), + + OsuColour.FromHex("677c66"), + OsuColour.FromHex("9b8732"), + OsuColour.FromHex("8c5129"), + OsuColour.FromHex("8c3030"), + OsuColour.FromHex("1f5d91"), + OsuColour.FromHex("4335a5"), + OsuColour.FromHex("812a96"), + OsuColour.FromHex("992861"), + }; + + private Color4 getUsernameColour(Message message) + { + //todo: use User instead of Message when user_id is correctly populated. + return username_colours[message.UserId % username_colours.Length]; + } + const float padding = 200; const float text_size = 20; @@ -25,6 +69,8 @@ namespace osu.Game.Online.Chat.Drawables RelativeSizeAxes = Axes.X; AutoSizeAxes = Axes.Y; + Padding = new MarginPadding { Left = 15, Right = 15 }; + Children = new Drawable[] { new Container @@ -34,13 +80,19 @@ namespace osu.Game.Online.Chat.Drawables { new OsuSpriteText { - Text = Message.Timestamp.LocalDateTime.ToLongTimeString(), - TextSize = text_size, - Colour = Color4.Gray + Anchor = Anchor.CentreLeft, + Origin = Anchor.CentreLeft, + Font = @"Exo2.0-SemiBold", + Text = $@"{Message.Timestamp.LocalDateTime:hh:mm:ss}", + FixedWidth = true, + TextSize = text_size * 0.75f, + Alpha = 0.4f, }, new OsuSpriteText { - Text = Message.User.Name, + Font = @"Exo2.0-BoldItalic", + Text = $@"{Message.User.Name}:", + Colour = getUsernameColour(Message), TextSize = text_size, Origin = Anchor.TopRight, Anchor = Anchor.TopRight, @@ -51,7 +103,7 @@ namespace osu.Game.Online.Chat.Drawables { RelativeSizeAxes = Axes.X, AutoSizeAxes = Axes.Y, - Padding = new MarginPadding { Left = padding + 10 }, + Padding = new MarginPadding { Left = padding + 15 }, Children = new Drawable[] { new OsuSpriteText diff --git a/osu.Game/Online/Chat/Drawables/ChannelDisplay.cs b/osu.Game/Online/Chat/Drawables/DrawableChannel.cs similarity index 55% rename from osu.Game/Online/Chat/Drawables/ChannelDisplay.cs rename to osu.Game/Online/Chat/Drawables/DrawableChannel.cs index cc60706831..84d15967e4 100644 --- a/osu.Game/Online/Chat/Drawables/ChannelDisplay.cs +++ b/osu.Game/Online/Chat/Drawables/DrawableChannel.cs @@ -4,25 +4,23 @@ 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.Sprites; +using osu.Framework.Graphics.Primitives; +using osu.Framework.Threading; using osu.Game.Graphics.Sprites; -using OpenTK; namespace osu.Game.Online.Chat.Drawables { - public class ChannelDisplay : Container + public class DrawableChannel : Container { private readonly Channel channel; private FlowContainer flow; + private ScrollContainer scroll; - public ChannelDisplay(Channel channel) + public DrawableChannel(Channel channel) { this.channel = channel; - newMessages(channel.Messages); - channel.NewMessagesArrived += newMessages; RelativeSizeAxes = Axes.Both; @@ -36,7 +34,7 @@ namespace osu.Game.Online.Chat.Drawables Anchor = Anchor.Centre, Origin = Anchor.Centre }, - new ScrollContainer + scroll = new ScrollContainer { RelativeSizeAxes = Axes.Both, Children = new Drawable[] @@ -46,37 +44,54 @@ namespace osu.Game.Online.Chat.Drawables Direction = FlowDirections.Vertical, RelativeSizeAxes = Axes.X, AutoSizeAxes = Axes.Y, - Spacing = new Vector2(1, 1) + Padding = new MarginPadding { Left = 20, Right = 20 } } } } }; + + channel.NewMessagesArrived += newMessagesArrived; + } + + protected override void LoadComplete() + { + base.LoadComplete(); + + newMessagesArrived(channel.Messages); + scrollToEnd(); } protected override void Dispose(bool isDisposing) { base.Dispose(isDisposing); - channel.NewMessagesArrived -= newMessages; + channel.NewMessagesArrived -= newMessagesArrived; } - [BackgroundDependencyLoader] - private void load() - { - newMessages(channel.Messages); - } - - private void newMessages(IEnumerable newMessages) + private void newMessagesArrived(IEnumerable newMessages) { if (!IsLoaded) return; var displayMessages = newMessages.Skip(Math.Max(0, newMessages.Count() - Channel.MAX_HISTORY)); + if (scroll.IsScrolledToEnd(10) || !flow.Children.Any()) + scrollToEnd(); + //up to last Channel.MAX_HISTORY messages foreach (Message m in displayMessages) - flow.Add(new ChatLine(m)); + { + var d = new ChatLine(m); + flow.Add(d); + } - while (flow.Children.Count() > Channel.MAX_HISTORY) - flow.Remove(flow.Children.First()); + while (flow.Children.Count(c => c.LifetimeEnd == double.MaxValue) > Channel.MAX_HISTORY) + { + var d = flow.Children.First(c => c.LifetimeEnd == double.MaxValue); + if (!scroll.IsScrolledToEnd(10)) + scroll.OffsetScrollPosition(-d.DrawHeight); + d.Expire(); + } } + + private void scrollToEnd() => Scheduler.AddDelayed(() => scroll.ScrollToEnd(), 50); } } \ No newline at end of file diff --git a/osu.Game/Online/Chat/Message.cs b/osu.Game/Online/Chat/Message.cs index d412650176..3081653c34 100644 --- a/osu.Game/Online/Chat/Message.cs +++ b/osu.Game/Online/Chat/Message.cs @@ -11,6 +11,7 @@ namespace osu.Game.Online.Chat [JsonProperty(@"message_id")] public long Id; + //todo: this should be inside sender. [JsonProperty(@"user_id")] public int UserId; diff --git a/osu.Game/OsuGame.cs b/osu.Game/OsuGame.cs index 1a0f08ffb8..55eb3f861e 100644 --- a/osu.Game/OsuGame.cs +++ b/osu.Game/OsuGame.cs @@ -116,7 +116,7 @@ namespace osu.Game } }); - (screenStack = new Loader()).Preload(this, d => + (screenStack = new Loader()).LoadAsync(this, d => { screenStack.ModePushed += screenAdded; screenStack.Exited += screenRemoved; @@ -124,22 +124,22 @@ namespace osu.Game }); //overlay elements - (chat = new ChatOverlay { Depth = 0 }).Preload(this, overlayContent.Add); - (options = new OptionsOverlay { Depth = -1 }).Preload(this, overlayContent.Add); + (chat = new ChatOverlay { Depth = 0 }).LoadAsync(this, overlayContent.Add); + (options = new OptionsOverlay { Depth = -1 }).LoadAsync(this, overlayContent.Add); (musicController = new MusicController() { Depth = -2, Position = new Vector2(0, Toolbar.HEIGHT), Anchor = Anchor.TopRight, Origin = Anchor.TopRight, - }).Preload(this, overlayContent.Add); + }).LoadAsync(this, overlayContent.Add); (notificationManager = new NotificationManager { Depth = -2, Anchor = Anchor.TopRight, Origin = Anchor.TopRight, - }).Preload(this, overlayContent.Add); + }).LoadAsync(this, overlayContent.Add); Logger.NewEntry += entry => { @@ -160,7 +160,7 @@ namespace osu.Game Depth = -3, OnHome = delegate { intro?.ChildScreen?.MakeCurrent(); }, OnPlayModeChange = delegate (PlayMode m) { PlayMode.Value = m; }, - }).Preload(this, t => + }).LoadAsync(this, t => { PlayMode.ValueChanged += delegate { Toolbar.SetGameMode(PlayMode.Value); }; PlayMode.TriggerChange(); diff --git a/osu.Game/OsuGameBase.cs b/osu.Game/OsuGameBase.cs index db546ac088..331c3adeca 100644 --- a/osu.Game/OsuGameBase.cs +++ b/osu.Game/OsuGameBase.cs @@ -1,7 +1,6 @@ // Copyright (c) 2007-2017 ppy Pty Ltd . // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE -using osu.Framework; using osu.Framework.Allocation; using osu.Framework.Configuration; using osu.Framework.Graphics; @@ -20,7 +19,7 @@ using osu.Game.Online.API; namespace osu.Game { - public class OsuGameBase : BaseGame, IOnlineComponent + public class OsuGameBase : Framework.Game, IOnlineComponent { protected OsuConfigManager LocalConfig; @@ -101,7 +100,7 @@ namespace osu.Game }); } - public override void SetHost(BasicGameHost host) + public override void SetHost(GameHost host) { if (LocalConfig == null) LocalConfig = new OsuConfigManager(host.Storage); diff --git a/osu.Game/Overlays/ChatOverlay.cs b/osu.Game/Overlays/ChatOverlay.cs index f99936763f..6b7963ed1b 100644 --- a/osu.Game/Overlays/ChatOverlay.cs +++ b/osu.Game/Overlays/ChatOverlay.cs @@ -6,25 +6,30 @@ using System.Collections.Generic; using System.Diagnostics; using System.Linq; using OpenTK; -using OpenTK.Graphics; using osu.Framework.Allocation; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Sprites; using osu.Framework.Graphics.Transformations; using osu.Framework.Threading; -using osu.Game.Graphics; using osu.Game.Graphics.Sprites; using osu.Game.Online.API; using osu.Game.Online.API.Requests; using osu.Game.Online.Chat; using osu.Game.Online.Chat.Drawables; +using osu.Game.Graphics.UserInterface; +using osu.Framework.Graphics.Primitives; +using osu.Framework.Graphics.UserInterface; +using OpenTK.Graphics; +using osu.Framework.Input; namespace osu.Game.Overlays { - public class ChatOverlay : OverlayContainer, IOnlineComponent + public class ChatOverlay : FocusedOverlayContainer, IOnlineComponent { - private ChannelDisplay channelDisplay; + const float textbox_height = 40; + + private DrawableChannel channelDisplay; private ScheduledDelegate messageRequest; @@ -32,6 +37,8 @@ namespace osu.Game.Overlays protected override Container Content => content; + private FocusedTextBox inputTextBox; + private APIAccess api; public ChatOverlay() @@ -47,15 +54,65 @@ namespace osu.Game.Overlays { Depth = float.MaxValue, RelativeSizeAxes = Axes.Both, - Colour = OsuColour.Gray(0.1f).Opacity(0.4f), + Colour = Color4.Black, + Alpha = 0.9f, }, content = new Container { RelativeSizeAxes = Axes.Both, + Padding = new MarginPadding { Top = 5, Bottom = textbox_height + 5 }, + }, + new Container + { + Anchor = Anchor.BottomLeft, + Origin = Anchor.BottomLeft, + RelativeSizeAxes = Axes.X, + Height = textbox_height, + Padding = new MarginPadding(5), + Children = new Drawable[] + { + inputTextBox = new FocusedTextBox + { + RelativeSizeAxes = Axes.Both, + Height = 1, + PlaceholderText = "type your message", + Exit = () => State = Visibility.Hidden, + OnCommit = postMessage, + HoldFocus = true, + } + } } }); } + protected override bool OnFocus(InputState state) + { + //this is necessary as inputTextBox is masked away and therefore can't get focus :( + inputTextBox.TriggerFocus(); + return false; + } + + private void postMessage(TextBox sender, bool newText) + { + var postText = sender.Text; + + if (!string.IsNullOrEmpty(postText)) + { + //todo: actually send to server + careChannels.FirstOrDefault()?.AddNewMessages(new[] + { + new Message + { + User = api.LocalUser.Value, + Timestamp = DateTimeOffset.Now, + Content = postText + } + }); + } + + sender.Text = string.Empty; + } + [BackgroundDependencyLoader] private void load(APIAccess api) { @@ -69,7 +126,7 @@ namespace osu.Game.Overlays private void addChannel(Channel channel) { - Add(channelDisplay = new ChannelDisplay(channel)); + Add(channelDisplay = new DrawableChannel(channel)); careChannels.Add(channel); } @@ -82,10 +139,11 @@ namespace osu.Game.Overlays fetchReq = new GetMessagesRequest(careChannels, lastMessageId); fetchReq.Success += delegate (List messages) { - foreach (Message m in messages) - { - careChannels.Find(c => c.Id == m.ChannelId).AddNewMessages(m); - } + var ids = messages.Select(m => m.ChannelId).Distinct(); + + //batch messages per channel. + foreach (var id in ids) + careChannels.Find(c => c.Id == id)?.AddNewMessages(messages.Where(m => m.ChannelId == id)); lastMessageId = messages.LastOrDefault()?.Id ?? lastMessageId; @@ -151,6 +209,8 @@ namespace osu.Game.Overlays ListChannelsRequest req = new ListChannelsRequest(); req.Success += delegate (List channels) { + Debug.Assert(careChannels.Count == 0); + Scheduler.Add(delegate { loading.FadeOut(100); diff --git a/osu.Game/Overlays/LoginOverlay.cs b/osu.Game/Overlays/LoginOverlay.cs index 22c61cd372..178cea0a88 100644 --- a/osu.Game/Overlays/LoginOverlay.cs +++ b/osu.Game/Overlays/LoginOverlay.cs @@ -9,7 +9,6 @@ using osu.Framework.Graphics.Sprites; using osu.Framework.Graphics.Transformations; using osu.Game.Graphics; using osu.Game.Overlays.Options.Sections.General; -using OpenTK; using OpenTK.Graphics; namespace osu.Game.Overlays diff --git a/osu.Game/Overlays/MusicController.cs b/osu.Game/Overlays/MusicController.cs index 3b13c7bf88..1f087ac4a6 100644 --- a/osu.Game/Overlays/MusicController.cs +++ b/osu.Game/Overlays/MusicController.cs @@ -6,7 +6,6 @@ using System.Collections.Generic; using System.Threading.Tasks; using OpenTK; using OpenTK.Graphics; -using osu.Framework; using osu.Framework.Allocation; using osu.Framework.Audio; using osu.Framework.Audio.Track; @@ -23,7 +22,6 @@ using osu.Game.Configuration; using osu.Game.Database; using osu.Game.Graphics; using osu.Framework.Graphics.Primitives; -using osu.Framework.Threading; using osu.Game.Graphics.Sprites; namespace osu.Game.Overlays @@ -45,7 +43,7 @@ namespace osu.Game.Overlays private Bindable preferUnicode; private WorkingBeatmap current; private BeatmapDatabase beatmaps; - private BaseGame game; + private Framework.Game game; private Container dragContainer; @@ -322,10 +320,10 @@ namespace osu.Game.Overlays updateDisplay(current, isNext ? TransformDirection.Next : TransformDirection.Prev); } - protected override void PerformLoad(BaseGame game) + protected override void Load(Framework.Game game) { this.game = game; - base.PerformLoad(game); + base.Load(game); } Action pendingBeatmapSwitch; @@ -349,7 +347,7 @@ namespace osu.Game.Overlays MusicControllerBackground newBackground; - (newBackground = new MusicControllerBackground(beatmap)).Preload(game, delegate + (newBackground = new MusicControllerBackground(beatmap)).LoadAsync(game, delegate { dragContainer.Add(newBackground); diff --git a/osu.Game/Overlays/Notifications/ProgressCompletionNotification.cs b/osu.Game/Overlays/Notifications/ProgressCompletionNotification.cs index 61525ed019..492a948143 100644 --- a/osu.Game/Overlays/Notifications/ProgressCompletionNotification.cs +++ b/osu.Game/Overlays/Notifications/ProgressCompletionNotification.cs @@ -4,7 +4,6 @@ using osu.Framework.Allocation; using osu.Game.Graphics; using osu.Framework.Graphics.Colour; -using OpenTK.Graphics; namespace osu.Game.Overlays.Notifications diff --git a/osu.Game/Overlays/Notifications/ProgressNotification.cs b/osu.Game/Overlays/Notifications/ProgressNotification.cs index 28a0d8a0af..47fa2de33f 100644 --- a/osu.Game/Overlays/Notifications/ProgressNotification.cs +++ b/osu.Game/Overlays/Notifications/ProgressNotification.cs @@ -2,7 +2,6 @@ // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE using System; -using System.Diagnostics; using osu.Framework.Allocation; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; diff --git a/osu.Game/Overlays/Options/OptionEnumDropDown.cs b/osu.Game/Overlays/Options/OptionEnumDropDown.cs index 044e704d3a..50d1d36b4c 100644 --- a/osu.Game/Overlays/Options/OptionEnumDropDown.cs +++ b/osu.Game/Overlays/Options/OptionEnumDropDown.cs @@ -2,14 +2,6 @@ // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE using System; -using osu.Framework.Configuration; -using osu.Framework.Graphics; -using osu.Framework.Graphics.Containers; -using osu.Framework.Graphics.Primitives; -using osu.Framework.Graphics.Sprites; -using osu.Framework.Graphics.UserInterface; -using osu.Game.Graphics.Sprites; -using osu.Game.Graphics.UserInterface; using System.Reflection; using System.ComponentModel; using System.Collections.Generic; diff --git a/osu.Game/Overlays/Options/OptionLabel.cs b/osu.Game/Overlays/Options/OptionLabel.cs index 81bed0cb31..bfe59eb035 100644 --- a/osu.Game/Overlays/Options/OptionLabel.cs +++ b/osu.Game/Overlays/Options/OptionLabel.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.Sprites; using osu.Game.Graphics; using osu.Game.Graphics.Sprites; diff --git a/osu.Game/Overlays/Options/OptionSlider.cs b/osu.Game/Overlays/Options/OptionSlider.cs index 32ce420e7e..0e5d9f915c 100644 --- a/osu.Game/Overlays/Options/OptionSlider.cs +++ b/osu.Game/Overlays/Options/OptionSlider.cs @@ -1,7 +1,6 @@ // Copyright (c) 2007-2017 ppy Pty Ltd . // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE -using OpenTK.Graphics; using osu.Framework.Configuration; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; diff --git a/osu.Game/Overlays/Options/OptionsSubsection.cs b/osu.Game/Overlays/Options/OptionsSubsection.cs index 37cb6d01c1..4d8be559a7 100644 --- a/osu.Game/Overlays/Options/OptionsSubsection.cs +++ b/osu.Game/Overlays/Options/OptionsSubsection.cs @@ -5,7 +5,6 @@ using OpenTK; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Primitives; -using osu.Framework.Graphics.Sprites; using osu.Game.Graphics.Sprites; namespace osu.Game.Overlays.Options diff --git a/osu.Game/Overlays/Options/Sections/General/LoginOptions.cs b/osu.Game/Overlays/Options/Sections/General/LoginOptions.cs index aca9b02f48..34f42aac43 100644 --- a/osu.Game/Overlays/Options/Sections/General/LoginOptions.cs +++ b/osu.Game/Overlays/Options/Sections/General/LoginOptions.cs @@ -5,7 +5,6 @@ using osu.Framework.Allocation; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Primitives; -using osu.Framework.Graphics.Sprites; using osu.Framework.Graphics.UserInterface; using osu.Game.Configuration; using osu.Game.Graphics.Sprites; @@ -111,12 +110,14 @@ namespace osu.Game.Overlays.Options.Sections.General { PlaceholderText = "Username", RelativeSizeAxes = Axes.X, - Text = api?.Username ?? string.Empty + Text = api?.Username ?? string.Empty, + TabbableContentContainer = this }, password = new OsuPasswordTextBox { PlaceholderText = "Password", - RelativeSizeAxes = Axes.X + RelativeSizeAxes = Axes.X, + TabbableContentContainer = this }, new OsuCheckbox { diff --git a/osu.Game/Overlays/Options/Sections/General/UpdateOptions.cs b/osu.Game/Overlays/Options/Sections/General/UpdateOptions.cs index 6c7c29d966..c45dc9cbd4 100644 --- a/osu.Game/Overlays/Options/Sections/General/UpdateOptions.cs +++ b/osu.Game/Overlays/Options/Sections/General/UpdateOptions.cs @@ -14,7 +14,7 @@ namespace osu.Game.Overlays.Options.Sections.General protected override string Header => "Updates"; [BackgroundDependencyLoader] - private void load(BasicStorage storage, OsuConfigManager config) + private void load(Storage storage, OsuConfigManager config) { Children = new Drawable[] { diff --git a/osu.Game/Overlays/Options/Sections/Graphics/LayoutOptions.cs b/osu.Game/Overlays/Options/Sections/Graphics/LayoutOptions.cs index 5897cd8fdf..a3dbb9c76f 100644 --- a/osu.Game/Overlays/Options/Sections/Graphics/LayoutOptions.cs +++ b/osu.Game/Overlays/Options/Sections/Graphics/LayoutOptions.cs @@ -18,10 +18,10 @@ namespace osu.Game.Overlays.Options.Sections.Graphics Children = new Drawable[] { new OptionLabel { Text = "Resolution: TODO dropdown" }, - new OsuCheckbox + new OptionEnumDropDown { - LabelText = "Fullscreen mode", - Bindable = config.GetBindable(FrameworkConfig.Fullscreen), + LabelText = "Screen mode", + Bindable = config.GetBindable(FrameworkConfig.WindowMode), }, new OsuCheckbox { diff --git a/osu.Game/Overlays/Options/Sidebar.cs b/osu.Game/Overlays/Options/Sidebar.cs index ffc3d04756..33906a064c 100644 --- a/osu.Game/Overlays/Options/Sidebar.cs +++ b/osu.Game/Overlays/Options/Sidebar.cs @@ -1,7 +1,6 @@ // Copyright (c) 2007-2017 ppy Pty Ltd . // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE -using System; using OpenTK; using OpenTK.Graphics; using osu.Framework.Graphics; @@ -10,7 +9,6 @@ using osu.Framework.Graphics.Sprites; using osu.Framework.Graphics.Transformations; using osu.Framework.Input; using osu.Framework.Threading; -using osu.Game.Graphics; using osu.Game.Overlays.Toolbar; namespace osu.Game.Overlays.Options diff --git a/osu.Game/Overlays/OptionsOverlay.cs b/osu.Game/Overlays/OptionsOverlay.cs index 68786b00e8..ab3d561e00 100644 --- a/osu.Game/Overlays/OptionsOverlay.cs +++ b/osu.Game/Overlays/OptionsOverlay.cs @@ -1,20 +1,14 @@ // Copyright (c) 2007-2017 ppy Pty Ltd . // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE -using System.Diagnostics; using System.Linq; -using OpenTK; using OpenTK.Graphics; -using OpenTK.Input; -using osu.Framework; using osu.Framework.Allocation; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Primitives; using osu.Framework.Graphics.Sprites; using osu.Framework.Graphics.Transformations; -using osu.Framework.Input; -using osu.Game.Configuration; using osu.Game.Overlays.Options; using System; using osu.Game.Graphics; diff --git a/osu.Game/Overlays/Pause/PauseOverlay.cs b/osu.Game/Overlays/Pause/PauseOverlay.cs index a915fe91dd..675b6e6646 100644 --- a/osu.Game/Overlays/Pause/PauseOverlay.cs +++ b/osu.Game/Overlays/Pause/PauseOverlay.cs @@ -12,7 +12,6 @@ using osu.Framework.Graphics; using osu.Framework.Graphics.Sprites; using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Transformations; -using System.Threading.Tasks; using osu.Game.Graphics.Sprites; namespace osu.Game.Overlays.Pause diff --git a/osu.Game/Overlays/Toolbar/ToolbarHomeButton.cs b/osu.Game/Overlays/Toolbar/ToolbarHomeButton.cs index 438aec6e0b..4dca6b7a16 100644 --- a/osu.Game/Overlays/Toolbar/ToolbarHomeButton.cs +++ b/osu.Game/Overlays/Toolbar/ToolbarHomeButton.cs @@ -1,9 +1,7 @@ // Copyright (c) 2007-2017 ppy Pty Ltd . // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE -using osu.Framework.Allocation; using osu.Game.Graphics; -using osu.Game.Screens.Menu; namespace osu.Game.Overlays.Toolbar { diff --git a/osu.Game/Overlays/Toolbar/ToolbarModeSelector.cs b/osu.Game/Overlays/Toolbar/ToolbarModeSelector.cs index d8ad235cec..6ef737c25f 100644 --- a/osu.Game/Overlays/Toolbar/ToolbarModeSelector.cs +++ b/osu.Game/Overlays/Toolbar/ToolbarModeSelector.cs @@ -9,11 +9,9 @@ using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Primitives; using osu.Framework.Graphics.Sprites; using osu.Framework.Graphics.Transformations; -using osu.Game.Graphics.Backgrounds; using osu.Game.Modes; using OpenTK; using OpenTK.Graphics; -using osu.Game.Graphics; namespace osu.Game.Overlays.Toolbar { diff --git a/osu.Game/Overlays/Toolbar/ToolbarOverlayToggleButton.cs b/osu.Game/Overlays/Toolbar/ToolbarOverlayToggleButton.cs index 428cc206b7..c4a9c51349 100644 --- a/osu.Game/Overlays/Toolbar/ToolbarOverlayToggleButton.cs +++ b/osu.Game/Overlays/Toolbar/ToolbarOverlayToggleButton.cs @@ -1,22 +1,9 @@ // Copyright (c) 2007-2017 ppy Pty Ltd . // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE -using System; -using System.Collections.Generic; -using System.Diagnostics; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -using osu.Framework; -using osu.Framework.Allocation; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Sprites; -using osu.Framework.Graphics.Textures; -using osu.Game.Configuration; -using osu.Game.Online.API; -using OpenTK; -using OpenTK.Graphics; using osu.Game.Graphics; namespace osu.Game.Overlays.Toolbar diff --git a/osu.Game/Overlays/Toolbar/ToolbarUserButton.cs b/osu.Game/Overlays/Toolbar/ToolbarUserButton.cs index 921c2d26df..e3f20d26a4 100644 --- a/osu.Game/Overlays/Toolbar/ToolbarUserButton.cs +++ b/osu.Game/Overlays/Toolbar/ToolbarUserButton.cs @@ -102,7 +102,7 @@ namespace osu.Game.Overlays.Toolbar newSprite.FillMode = FillMode.Fit; - newSprite.Preload(game, s => + newSprite.LoadAsync(game, s => { Sprite?.FadeOut(); Sprite?.Expire(); @@ -120,7 +120,6 @@ namespace osu.Game.Overlays.Toolbar public class OnlineSprite : Sprite { private readonly string url; - private readonly int userId; public OnlineSprite(string url) { diff --git a/osu.Game/Properties/AssemblyInfo.cs b/osu.Game/Properties/AssemblyInfo.cs index 76b7899b0e..f6bbc91854 100644 --- a/osu.Game/Properties/AssemblyInfo.cs +++ b/osu.Game/Properties/AssemblyInfo.cs @@ -2,7 +2,6 @@ // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE using System.Reflection; -using System.Runtime.CompilerServices; using System.Runtime.InteropServices; // General Information about an assembly is controlled through the following diff --git a/osu.Game/Screens/BackgroundScreen.cs b/osu.Game/Screens/BackgroundScreen.cs index 0bce73b92f..fb934551e1 100644 --- a/osu.Game/Screens/BackgroundScreen.cs +++ b/osu.Game/Screens/BackgroundScreen.cs @@ -3,7 +3,6 @@ using System; using System.Threading; -using osu.Framework; using osu.Framework.Allocation; using osu.Framework.Screens; using osu.Framework.Graphics; @@ -29,10 +28,10 @@ namespace osu.Game.Screens return false; } - BaseGame game; + Framework.Game game; [BackgroundDependencyLoader] - private void load(BaseGame game) + private void load(Framework.Game game) { this.game = game; } @@ -43,7 +42,7 @@ namespace osu.Game.Screens // once it's done. if (screen.LoadState == LoadState.NotLoaded) { - screen.Preload(game, d => Push((BackgroundScreen)d)); + screen.LoadAsync(game, d => Push((BackgroundScreen)d)); return true; } diff --git a/osu.Game/Screens/Backgrounds/BackgroundScreenBeatmap.cs b/osu.Game/Screens/Backgrounds/BackgroundScreenBeatmap.cs index a003fa2d57..2856d52113 100644 --- a/osu.Game/Screens/Backgrounds/BackgroundScreenBeatmap.cs +++ b/osu.Game/Screens/Backgrounds/BackgroundScreenBeatmap.cs @@ -36,7 +36,7 @@ namespace osu.Game.Screens.Backgrounds else newBackground = new BeatmapBackground(beatmap); - newBackground.Preload(Game, delegate + newBackground.LoadAsync(Game, delegate { float newDepth = 0; if (background != null) @@ -60,9 +60,9 @@ namespace osu.Game.Screens.Backgrounds Beatmap = beatmap; } - public void BlurTo(Vector2 sigma, double duration) + public void BlurTo(Vector2 sigma, double duration, EasingTypes easing = EasingTypes.None) { - background?.BlurTo(sigma, duration, EasingTypes.OutExpo); + background?.BlurTo(sigma, duration, easing); blurTarget = sigma; } diff --git a/osu.Game/Screens/Backgrounds/BackgroundScreenDefault.cs b/osu.Game/Screens/Backgrounds/BackgroundScreenDefault.cs index 6807085061..005efb77a2 100644 --- a/osu.Game/Screens/Backgrounds/BackgroundScreenDefault.cs +++ b/osu.Game/Screens/Backgrounds/BackgroundScreenDefault.cs @@ -1,7 +1,6 @@ // Copyright (c) 2007-2017 ppy Pty Ltd . // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE -using osu.Framework; using osu.Framework.Allocation; using osu.Game.Graphics.Backgrounds; @@ -10,7 +9,7 @@ namespace osu.Game.Screens.Backgrounds public class BackgroundScreenDefault : BackgroundScreen { [BackgroundDependencyLoader] - private void load(BaseGame game) + private void load(Framework.Game game) { Add(new Background(@"Backgrounds/bg1")); } diff --git a/osu.Game/Screens/Loader.cs b/osu.Game/Screens/Loader.cs index 33094b7098..a3c7be8453 100644 --- a/osu.Game/Screens/Loader.cs +++ b/osu.Game/Screens/Loader.cs @@ -20,9 +20,9 @@ namespace osu.Game.Screens private void load(OsuGame game) { if (game.IsDeployedBuild) - new Disclaimer().Preload(game, d => Push((Screen)d)); + new Disclaimer().LoadAsync(game, d => Push((Screen)d)); else - new Intro().Preload(game, d => Push((Screen)d)); + new Intro().LoadAsync(game, d => Push((Screen)d)); } } } diff --git a/osu.Game/Screens/Menu/ButtonSystem.cs b/osu.Game/Screens/Menu/ButtonSystem.cs index a203638478..0118a7fd41 100644 --- a/osu.Game/Screens/Menu/ButtonSystem.cs +++ b/osu.Game/Screens/Menu/ButtonSystem.cs @@ -7,7 +7,6 @@ using System.Linq; using osu.Framework; using osu.Framework.Allocation; using osu.Framework.Audio; -using osu.Framework.Audio.Sample; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Sprites; diff --git a/osu.Game/Screens/Menu/Disclaimer.cs b/osu.Game/Screens/Menu/Disclaimer.cs index c5c00d5037..56074dbdfd 100644 --- a/osu.Game/Screens/Menu/Disclaimer.cs +++ b/osu.Game/Screens/Menu/Disclaimer.cs @@ -1,11 +1,6 @@ // Copyright (c) 2007-2017 ppy Pty Ltd . // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; using osu.Framework.Allocation; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; @@ -93,7 +88,7 @@ namespace osu.Game.Screens.Menu [BackgroundDependencyLoader] private void load(OsuGame game, OsuColour colours) { - (intro = new Intro()).Preload(game); + (intro = new Intro()).LoadAsync(game); iconColour = colours.Yellow; } diff --git a/osu.Game/Screens/Menu/Intro.cs b/osu.Game/Screens/Menu/Intro.cs index c69dfff7db..6d513c1286 100644 --- a/osu.Game/Screens/Menu/Intro.cs +++ b/osu.Game/Screens/Menu/Intro.cs @@ -77,7 +77,7 @@ namespace osu.Game.Screens.Menu { bgm.Start(); - (mainMenu = new MainMenu()).Preload(Game); + (mainMenu = new MainMenu()).LoadAsync(Game); Scheduler.AddDelayed(delegate { diff --git a/osu.Game/Screens/Menu/MainMenu.cs b/osu.Game/Screens/Menu/MainMenu.cs index 1a6310ea4e..c0ccbd044e 100644 --- a/osu.Game/Screens/Menu/MainMenu.cs +++ b/osu.Game/Screens/Menu/MainMenu.cs @@ -56,7 +56,7 @@ namespace osu.Game.Screens.Menu [BackgroundDependencyLoader] private void load(OsuGame game) { - background.Preload(game); + background.LoadAsync(game); buttons.OnSettings = game.ToggleOptions; } diff --git a/osu.Game/Screens/Menu/OsuLogo.cs b/osu.Game/Screens/Menu/OsuLogo.cs index 2035ec17ce..a3b852e7a4 100644 --- a/osu.Game/Screens/Menu/OsuLogo.cs +++ b/osu.Game/Screens/Menu/OsuLogo.cs @@ -2,18 +2,15 @@ // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE using System; -using System.Diagnostics; using osu.Framework.Allocation; using osu.Framework.Audio; using osu.Framework.Audio.Sample; using osu.Framework.Graphics; -using osu.Framework.Graphics.Colour; using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Sprites; using osu.Framework.Graphics.Textures; using osu.Framework.Graphics.Transformations; using osu.Framework.Input; -using osu.Framework.MathUtils; using osu.Game.Graphics; using osu.Game.Graphics.Backgrounds; using OpenTK; diff --git a/osu.Game/Screens/Play/FailDialog.cs b/osu.Game/Screens/Play/FailDialog.cs index 622dd0a44a..018cd72a9d 100644 --- a/osu.Game/Screens/Play/FailDialog.cs +++ b/osu.Game/Screens/Play/FailDialog.cs @@ -3,11 +3,7 @@ using osu.Framework.Screens; using osu.Framework.Graphics; -using osu.Framework.Graphics.Containers; -using osu.Framework.Graphics.Sprites; -using osu.Framework.Graphics.Transformations; using osu.Game.Graphics.Sprites; -using osu.Game.Modes; using osu.Game.Screens.Backgrounds; using OpenTK; using OpenTK.Graphics; diff --git a/osu.Game/Screens/Play/Player.cs b/osu.Game/Screens/Play/Player.cs index 23341ec0d4..b106ea60c6 100644 --- a/osu.Game/Screens/Play/Player.cs +++ b/osu.Game/Screens/Play/Player.cs @@ -20,9 +20,9 @@ using osu.Game.Overlays.Pause; using osu.Framework.Configuration; using System; using System.Linq; -using osu.Game.Beatmaps; using OpenTK.Graphics; using osu.Framework.Graphics.Containers; +using osu.Framework.Graphics.Transformations; using osu.Framework.Logging; namespace osu.Game.Screens.Play @@ -228,7 +228,7 @@ namespace osu.Game.Screens.Play var newPlayer = new Player(); - newPlayer.Preload(Game, delegate + newPlayer.LoadAsync(Game, delegate { newPlayer.RestartCount = RestartCount + 1; ValidForResume = false; @@ -240,21 +240,6 @@ namespace osu.Game.Screens.Play }); } - protected override void LoadComplete() - { - base.LoadComplete(); - - Content.Delay(250); - Content.FadeIn(250); - - Delay(750); - Schedule(() => - { - sourceClock.Start(); - initializeSkipButton(); - }); - } - private void onPass() { Delay(1000); @@ -285,11 +270,33 @@ namespace osu.Game.Screens.Play { base.OnEntering(last); - (Background as BackgroundScreenBeatmap)?.BlurTo(Vector2.Zero, 1000); - Background?.FadeTo((100f - dimLevel) / 100, 1000); + (Background as BackgroundScreenBeatmap)?.BlurTo(Vector2.Zero, 1500, EasingTypes.OutQuint); + Background?.FadeTo((100f - dimLevel) / 100, 1500, EasingTypes.OutQuint); Content.Alpha = 0; dimLevel.ValueChanged += dimChanged; + + Content.ScaleTo(0.7f); + + Content.Delay(250); + Content.FadeIn(250); + + Content.ScaleTo(1, 750, EasingTypes.OutQuint); + + Delay(750); + Schedule(() => + { + sourceClock.Start(); + initializeSkipButton(); + }); + } + + protected override void OnSuspending(Screen next) + { + Content.FadeOut(350); + Content.ScaleTo(0.7f, 750, EasingTypes.InQuint); + + base.OnSuspending(next); } protected override bool OnExiting(Screen next) diff --git a/osu.Game/Screens/Play/PlayerInputManager.cs b/osu.Game/Screens/Play/PlayerInputManager.cs index f3041cb1e2..181cd68da9 100644 --- a/osu.Game/Screens/Play/PlayerInputManager.cs +++ b/osu.Game/Screens/Play/PlayerInputManager.cs @@ -7,14 +7,13 @@ using osu.Framework.Configuration; using osu.Framework.Input; using osu.Framework.Platform; using osu.Game.Configuration; -using System; using System.Linq; namespace osu.Game.Screens.Play { class PlayerInputManager : UserInputManager { - public PlayerInputManager(BasicGameHost host) + public PlayerInputManager(GameHost host) : base(host) { } diff --git a/osu.Game/Screens/Play/PlayerLoader.cs b/osu.Game/Screens/Play/PlayerLoader.cs new file mode 100644 index 0000000000..f14ae65f68 --- /dev/null +++ b/osu.Game/Screens/Play/PlayerLoader.cs @@ -0,0 +1,205 @@ +// Copyright (c) 2007-2017 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.Primitives; +using osu.Framework.Graphics.Sprites; +using osu.Framework.Graphics.Transformations; +using osu.Framework.Screens; +using osu.Game.Beatmaps; +using osu.Game.Graphics; +using osu.Game.Graphics.Sprites; +using osu.Game.Screens.Backgrounds; +using osu.Game.Screens.Menu; +using OpenTK; + +namespace osu.Game.Screens.Play +{ + public class PlayerLoader : OsuScreen + { + private readonly Player player; + private OsuLogo logo; + private BeatmapMetadataDisplay info; + + protected override BackgroundScreen CreateBackground() => new BackgroundScreenBeatmap(Beatmap); + + public PlayerLoader(Player player) + { + ValidForResume = false; + this.player = player; + + Children = new Drawable[] + { + logo = new OsuLogo + { + Scale = new Vector2(0.15f), + Interactive = false, + }, + }; + + } + + [BackgroundDependencyLoader] + private void load() + { + Add(info = new BeatmapMetadataDisplay(Beatmap) + { + Alpha = 0, + Anchor = Anchor.Centre, + Origin = Anchor.Centre, + }); + + player.LoadAsync(Game); + } + + protected override void OnEntering(Screen last) + { + base.OnEntering(last); + + Background.FadeTo(0.4f, 250); + + Content.ScaleTo(0.7f); + Content.ScaleTo(1, 750, EasingTypes.OutQuint); + Content.FadeInFromZero(500); + + Delay(1000, true); + + logo.MoveToOffset(new Vector2(0, -180), 500, EasingTypes.InOutExpo); + Delay(250, true); + + info.FadeIn(500); + + Delay(2000, true); + + Content.ScaleTo(0.7f, 300, EasingTypes.InQuint); + Content.FadeOut(250); + + Delay(250); + + Schedule(() => + { + if (!Push(player)) + Exit(); + }); + } + + protected override bool OnExiting(Screen next) + { + Content.ScaleTo(0.7f, 150, EasingTypes.InQuint); + FadeOut(150); + return base.OnExiting(next); + } + + class BeatmapMetadataDisplay : Container + { + class MetadataLine : Container + { + public MetadataLine(string left, string right) + { + AutoSizeAxes = Axes.Both; + Children = new Drawable[] + { + new OsuSpriteText + { + Anchor = Anchor.TopCentre, + Origin = Anchor.TopRight, + Margin = new MarginPadding { Right = 5 }, + Colour = OsuColour.Gray(0.5f), + Text = left, + }, + new OsuSpriteText + { + Anchor = Anchor.TopCentre, + Origin = Anchor.TopLeft, + Margin = new MarginPadding { Left = 5 }, + Text = string.IsNullOrEmpty(right) ? @"-" : right, + } + }; + } + + } + + public BeatmapMetadataDisplay(WorkingBeatmap beatmap) + { + AutoSizeAxes = Axes.Both; + Children = new Drawable[] + { + new FlowContainer() + { + AutoSizeAxes = Axes.Both, + Origin = Anchor.TopCentre, + Anchor = Anchor.TopCentre, + Direction = FlowDirections.Vertical, + Children = new Drawable[] + { + new OsuSpriteText + { + Text = beatmap.BeatmapInfo.Metadata.Title, + TextSize = 36, + Font = @"Exo2.0-MediumItalic", + Origin = Anchor.TopCentre, + Anchor = Anchor.TopCentre, + }, + new OsuSpriteText + { + Text = beatmap.BeatmapInfo.Metadata.Artist, + TextSize = 26, + Font = @"Exo2.0-MediumItalic", + Origin = Anchor.TopCentre, + Anchor = Anchor.TopCentre, + }, + new Container + { + Size = new Vector2(300, 60), + Margin = new MarginPadding(10), + Origin = Anchor.TopCentre, + Anchor = Anchor.TopCentre, + CornerRadius = 10, + Masking = true, + Children = new[] + { + new Sprite + { + Texture = beatmap.Background, + Origin = Anchor.Centre, + Anchor = Anchor.Centre, + FillMode = FillMode.Fill, + }, + } + }, + new OsuSpriteText + { + Text = beatmap.BeatmapInfo.Version, + TextSize = 26, + Font = @"Exo2.0-MediumItalic", + Origin = Anchor.TopCentre, + Anchor = Anchor.TopCentre, + Margin = new MarginPadding + { + Bottom = 40 + }, + }, + new MetadataLine("Source", beatmap.BeatmapInfo.Metadata.Source) + { + Origin = Anchor.TopCentre, + Anchor = Anchor.TopCentre, + }, + new MetadataLine("Composer", string.Empty) + { + Origin = Anchor.TopCentre, + Anchor = Anchor.TopCentre, + }, + new MetadataLine("Mapper", beatmap.BeatmapInfo.Metadata.Author) + { + Origin = Anchor.TopCentre, + Anchor = Anchor.TopCentre, + }, + }, + } + }; + } + } + } +} diff --git a/osu.Game/Screens/Play/SkipButton.cs b/osu.Game/Screens/Play/SkipButton.cs index 8770a9d9b9..f57bbd4cb0 100644 --- a/osu.Game/Screens/Play/SkipButton.cs +++ b/osu.Game/Screens/Play/SkipButton.cs @@ -4,15 +4,15 @@ using osu.Framework.Allocation; using osu.Framework.Audio; using osu.Framework.Graphics; +using osu.Framework.Input; using osu.Game.Graphics; using osu.Game.Graphics.UserInterface; +using OpenTK.Input; namespace osu.Game.Screens.Play { public class SkipButton : TwoLayerButton { - private readonly double skipDestination; - public SkipButton() { Text = @"Skip"; @@ -25,8 +25,22 @@ namespace osu.Game.Screens.Play private void load(AudioManager audio, OsuColour colours) { ActivationSound = audio.Sample.Get(@"Menu/menuhit"); - Colour = colours.Yellow; + BackgroundColour = colours.Yellow; HoverColour = colours.YellowDark; } + + protected override bool OnKeyDown(InputState state, KeyDownEventArgs args) + { + if (args.Repeat) return false; + + switch (args.Key) + { + case Key.Space: + TriggerClick(); + return true; + } + + return base.OnKeyDown(state, args); + } } } diff --git a/osu.Game/Screens/Ranking/Results.cs b/osu.Game/Screens/Ranking/Results.cs index 119bc49e1a..9f5e1f8e5f 100644 --- a/osu.Game/Screens/Ranking/Results.cs +++ b/osu.Game/Screens/Ranking/Results.cs @@ -4,7 +4,6 @@ using osu.Framework.Screens; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; -using osu.Framework.Graphics.Sprites; using osu.Framework.Graphics.Transformations; using osu.Game.Graphics.Sprites; using osu.Game.Modes; diff --git a/osu.Game/Screens/Select/BeatmapInfoWedge.cs b/osu.Game/Screens/Select/BeatmapInfoWedge.cs index eb93b4ac1a..7856d0b031 100644 --- a/osu.Game/Screens/Select/BeatmapInfoWedge.cs +++ b/osu.Game/Screens/Select/BeatmapInfoWedge.cs @@ -3,7 +3,6 @@ using System; using System.Collections.Generic; -using osu.Framework; using osu.Framework.Allocation; using OpenTK; using OpenTK.Graphics; @@ -19,7 +18,6 @@ using System.Linq; using osu.Framework.Extensions.IEnumerableExtensions; using osu.Framework.MathUtils; using osu.Game.Graphics; -using osu.Game.Beatmaps.Timing; using osu.Game.Graphics.Sprites; using osu.Game.Modes; @@ -179,7 +177,7 @@ namespace osu.Game.Screens.Select } }, } - }).Preload(game, delegate (Drawable d) + }).LoadAsync(game, delegate (Drawable d) { FadeIn(250); diff --git a/osu.Game/Screens/Select/CarouselContainer.cs b/osu.Game/Screens/Select/CarouselContainer.cs index f4d2842638..051570763b 100644 --- a/osu.Game/Screens/Select/CarouselContainer.cs +++ b/osu.Game/Screens/Select/CarouselContainer.cs @@ -2,7 +2,6 @@ // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE using OpenTK; -using osu.Framework.Caching; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Transformations; @@ -10,7 +9,6 @@ using osu.Game.Database; using System; using System.Collections.Generic; using System.Linq; -using osu.Framework.Extensions.IEnumerableExtensions; using osu.Framework.Lists; using osu.Game.Beatmaps.Drawables; using osu.Framework.Timing; diff --git a/osu.Game/Screens/Select/FilterControl.cs b/osu.Game/Screens/Select/FilterControl.cs index b2c13a980e..c0235af75b 100644 --- a/osu.Game/Screens/Select/FilterControl.cs +++ b/osu.Game/Screens/Select/FilterControl.cs @@ -58,18 +58,19 @@ namespace osu.Game.Screens.Select Direction = FlowDirections.Vertical, Children = new Drawable[] { - searchTextBox = new SearchTextBox { RelativeSizeAxes = Axes.X }, + searchTextBox = new SearchTextBox { + RelativeSizeAxes = Axes.X, + OnChange = (TextBox sender, bool newText) => + { + if (newText) + FilterChanged?.Invoke(); + }, + Exit = () => Exit?.Invoke(), + }, new GroupSortTabs() } } }; - - searchTextBox.OnChange += (TextBox sender, bool newText) => - { - if (newText) - FilterChanged?.Invoke(); - }; - searchTextBox.Exit = () => Exit?.Invoke(); } public void Deactivate() diff --git a/osu.Game/Screens/Select/Footer.cs b/osu.Game/Screens/Select/Footer.cs index df926c0778..8cde771b50 100644 --- a/osu.Game/Screens/Select/Footer.cs +++ b/osu.Game/Screens/Select/Footer.cs @@ -32,6 +32,8 @@ namespace osu.Game.Screens.Select private FlowContainer buttons; + public OsuLogo StartButton; + public void AddButton(string text, Color4 colour, Action action) { var button = new FooterButton @@ -76,7 +78,7 @@ namespace osu.Game.Screens.Select Height = 3, Position = new Vector2(0, -3), }, - new OsuLogo() + StartButton = new OsuLogo { Anchor = Anchor.BottomRight, Scale = new Vector2(0.4f), diff --git a/osu.Game/Screens/Select/PlaySongSelect.cs b/osu.Game/Screens/Select/PlaySongSelect.cs index daca9edf48..35a8f6039b 100644 --- a/osu.Game/Screens/Select/PlaySongSelect.cs +++ b/osu.Game/Screens/Select/PlaySongSelect.cs @@ -18,7 +18,6 @@ using osu.Game.Modes; using osu.Game.Screens.Backgrounds; using OpenTK; using osu.Game.Screens.Play; -using osu.Framework; using osu.Framework.Audio.Sample; using osu.Framework.Graphics.Transformations; using osu.Game.Beatmaps.Drawables; @@ -27,7 +26,6 @@ using osu.Game.Graphics; using osu.Framework.Input; using OpenTK.Input; using System.Collections.Generic; -using osu.Framework.Graphics.Containers; using osu.Framework.Threading; namespace osu.Game.Screens.Select @@ -54,46 +52,27 @@ namespace osu.Game.Screens.Select private Footer footer; + OsuScreen player; + private FilterControl filter; - public FilterControl Filter { - get { + public FilterControl Filter + { + get + { return filter; - } - private set { - if (filter != value) { + } + private set + { + if (filter != value) + { filter = value; filterChanged(); } } } - Player player; - - private void start() - { - if (player != null || Beatmap == null) - return; - - //in the future we may want to move this logic to a PlayerLoader gamemode or similar, so we can rely on the SongSelect transition - //and provide a better loading experience (at the moment song select is still accepting input during preload). - player = new Player - { - BeatmapInfo = carousel.SelectedGroup.SelectedPanel.Beatmap, - PreferredPlayMode = playMode.Value - }; - - player.Preload(Game, delegate - { - if (!Push(player)) - { - player = null; - //error occured? - } - }); - } - [BackgroundDependencyLoader(permitNulls: true)] - private void load(BeatmapDatabase beatmaps, AudioManager audio, BaseGame game, + private void load(BeatmapDatabase beatmaps, AudioManager audio, Framework.Game game, OsuGame osuGame, OsuColour colours) { const float carousel_width = 640; @@ -144,10 +123,20 @@ namespace osu.Game.Screens.Select Right = 20, }, }, - footer = new Footer() + footer = new Footer { OnBack = Exit, - OnStart = start, + OnStart = () => + { + if (player != null || Beatmap == null) + return; + + (player = new PlayerLoader(new Player + { + BeatmapInfo = carousel.SelectedGroup.SelectedPanel.Beatmap, + PreferredPlayMode = playMode.Value + })).LoadAsync(Game, l => Push(player)); + } } }; @@ -289,6 +278,7 @@ namespace osu.Game.Screens.Select { backgroundModeBeatmap.Beatmap = beatmap; backgroundModeBeatmap.BlurTo(background_blur, 1000); + backgroundModeBeatmap.FadeTo(1, 250); } if (beatmap != null) @@ -341,7 +331,7 @@ namespace osu.Game.Screens.Select } } - private void addBeatmapSet(BeatmapSetInfo beatmapSet, BaseGame game, bool select = false) + private void addBeatmapSet(BeatmapSetInfo beatmapSet, Framework.Game game, bool select = false) { beatmapSet = database.GetWithChildren(beatmapSet.ID); beatmapSet.Beatmaps.ForEach(b => @@ -359,12 +349,12 @@ namespace osu.Game.Screens.Select var group = new BeatmapGroup(beatmap) { SelectionChanged = selectionChanged, - StartRequested = b => start() + StartRequested = b => footer.StartButton.TriggerClick() }; //for the time being, let's completely load the difficulty panels in the background. //this likely won't scale so well, but allows us to completely async the loading flow. - Task.WhenAll(group.BeatmapPanels.Select(panel => panel.Preload(game))).ContinueWith(task => Schedule(delegate + Task.WhenAll(group.BeatmapPanels.Select(panel => panel.LoadAsync(game))).ContinueWith(task => Schedule(delegate { beatmapGroups.Add(group); @@ -381,7 +371,7 @@ namespace osu.Game.Screens.Select })); } - private void addBeatmapSets(BaseGame game, CancellationToken token) + private void addBeatmapSets(Framework.Game game, CancellationToken token) { foreach (var beatmapSet in database.Query()) { @@ -396,7 +386,7 @@ namespace osu.Game.Screens.Select switch (args.Key) { case Key.Enter: - start(); + footer.StartButton.TriggerClick(); return true; } diff --git a/osu.Game/Screens/Select/SearchTextBox.cs b/osu.Game/Screens/Select/SearchTextBox.cs index 4cd5353712..a640b575be 100644 --- a/osu.Game/Screens/Select/SearchTextBox.cs +++ b/osu.Game/Screens/Select/SearchTextBox.cs @@ -1,9 +1,6 @@ // Copyright (c) 2007-2017 ppy Pty Ltd . // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE -using System; -using System.Linq; -using OpenTK.Graphics; using OpenTK.Input; using osu.Framework.Graphics; using osu.Framework.Graphics.Primitives; @@ -16,26 +13,8 @@ namespace osu.Game.Screens.Select /// /// A textbox which holds focus eagerly. /// - public class SearchTextBox : OsuTextBox + public class SearchTextBox : FocusedTextBox { - protected override Color4 BackgroundUnfocused => new Color4(10, 10, 10, 255); - protected override Color4 BackgroundFocused => new Color4(10, 10, 10, 255); - public Action Exit; - - private bool focus; - public bool HoldFocus - { - get { return focus; } - set - { - focus = value; - if (!focus) - TriggerFocusLost(); - } - } - - public override bool RequestingFocus => HoldFocus; - public SearchTextBox() { Height = 35; @@ -53,25 +32,6 @@ namespace osu.Game.Screens.Select PlaceholderText = "type to search"; } - protected override bool OnFocus(InputState state) - { - var result = base.OnFocus(state); - BorderThickness = 0; - return result; - } - - protected override void OnFocusLost(InputState state) - { - if (state.Keyboard.Keys.Any(key => key == Key.Escape)) - { - if (Text.Length > 0) - Text = string.Empty; - else - Exit?.Invoke(); - } - base.OnFocusLost(state); - } - protected override bool OnKeyDown(InputState state, KeyDownEventArgs args) { if (HandlePendingText(state)) return true; diff --git a/osu.Game/Users/User.cs b/osu.Game/Users/User.cs index c931e9b2c1..5928d6106c 100644 --- a/osu.Game/Users/User.cs +++ b/osu.Game/Users/User.cs @@ -1,11 +1,6 @@ // Copyright (c) 2007-2017 ppy Pty Ltd . // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; namespace osu.Game.Users { diff --git a/osu.Game/osu.Game.csproj b/osu.Game/osu.Game.csproj index 39e2bfcd03..a336f54227 100644 --- a/osu.Game/osu.Game.csproj +++ b/osu.Game/osu.Game.csproj @@ -71,6 +71,7 @@ + @@ -146,6 +147,7 @@ + @@ -190,7 +192,7 @@ - +