diff --git a/osu-framework b/osu-framework index 4a58484532..28c4acbb81 160000 --- a/osu-framework +++ b/osu-framework @@ -1 +1 @@ -Subproject commit 4a5848453240326ba08b09a33a2467af8c174b6a +Subproject commit 28c4acbb818d7be0ff66c600daacde9d91a99c6e diff --git a/osu.Desktop.VisualTests/Benchmark.cs b/osu.Desktop.VisualTests/Benchmark.cs index 506788e93c..9584dc52a4 100644 --- a/osu.Desktop.VisualTests/Benchmark.cs +++ b/osu.Desktop.VisualTests/Benchmark.cs @@ -9,7 +9,7 @@ using System.Threading.Tasks; using osu.Framework; using osu.Framework.Allocation; using osu.Framework.Desktop.Platform; -using osu.Framework.GameModes.Testing; +using osu.Framework.Screens.Testing; using osu.Game; using osu.Game.Modes; using osu.Game.Modes.Catch; diff --git a/osu.Desktop.VisualTests/Tests/TestCaseChatDisplay.cs b/osu.Desktop.VisualTests/Tests/TestCaseChatDisplay.cs index 54f3957014..d977e9cede 100644 --- a/osu.Desktop.VisualTests/Tests/TestCaseChatDisplay.cs +++ b/osu.Desktop.VisualTests/Tests/TestCaseChatDisplay.cs @@ -5,7 +5,7 @@ using System.Collections.Generic; using System.Diagnostics; using System.Linq; using osu.Framework; -using osu.Framework.GameModes.Testing; +using osu.Framework.Screens.Testing; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Sprites; diff --git a/osu.Desktop.VisualTests/Tests/TestCaseGamefield.cs b/osu.Desktop.VisualTests/Tests/TestCaseGamefield.cs index cf0b6cd7ce..70abd6d8c4 100644 --- a/osu.Desktop.VisualTests/Tests/TestCaseGamefield.cs +++ b/osu.Desktop.VisualTests/Tests/TestCaseGamefield.cs @@ -2,7 +2,7 @@ // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE using System.Collections.Generic; -using osu.Framework.GameModes.Testing; +using osu.Framework.Screens.Testing; using osu.Framework.Graphics; using osu.Framework.MathUtils; using osu.Framework.Timing; diff --git a/osu.Desktop.VisualTests/Tests/TestCaseHitObjects.cs b/osu.Desktop.VisualTests/Tests/TestCaseHitObjects.cs index f82ea1c98c..7a46ea5ded 100644 --- a/osu.Desktop.VisualTests/Tests/TestCaseHitObjects.cs +++ b/osu.Desktop.VisualTests/Tests/TestCaseHitObjects.cs @@ -3,7 +3,7 @@ using System.Collections.Generic; using osu.Framework; -using osu.Framework.GameModes.Testing; +using osu.Framework.Screens.Testing; using osu.Framework.Graphics; using osu.Framework.Timing; using OpenTK; diff --git a/osu.Desktop.VisualTests/Tests/TestCaseKeyCounter.cs b/osu.Desktop.VisualTests/Tests/TestCaseKeyCounter.cs index c5ecdfa936..c33a4001de 100644 --- a/osu.Desktop.VisualTests/Tests/TestCaseKeyCounter.cs +++ b/osu.Desktop.VisualTests/Tests/TestCaseKeyCounter.cs @@ -1,7 +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.GameModes.Testing; +using osu.Framework.Screens.Testing; using osu.Framework.Graphics; using osu.Game.Graphics.UserInterface; using OpenTK.Input; diff --git a/osu.Desktop.VisualTests/Tests/TestCaseMenuButtonSystem.cs b/osu.Desktop.VisualTests/Tests/TestCaseMenuButtonSystem.cs index 511f8568db..069cf39164 100644 --- a/osu.Desktop.VisualTests/Tests/TestCaseMenuButtonSystem.cs +++ b/osu.Desktop.VisualTests/Tests/TestCaseMenuButtonSystem.cs @@ -1,7 +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.GameModes.Testing; +using osu.Framework.Screens.Testing; using osu.Framework.Graphics.Colour; using osu.Framework.Graphics.Sprites; using osu.Game.Screens.Menu; diff --git a/osu.Desktop.VisualTests/Tests/TestCaseMusicController.cs b/osu.Desktop.VisualTests/Tests/TestCaseMusicController.cs index 67bea2454f..1a811a8588 100644 --- a/osu.Desktop.VisualTests/Tests/TestCaseMusicController.cs +++ b/osu.Desktop.VisualTests/Tests/TestCaseMusicController.cs @@ -1,7 +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.GameModes.Testing; +using osu.Framework.Screens.Testing; using osu.Framework.Graphics; using osu.Framework.Timing; using osu.Game.Overlays; diff --git a/osu.Desktop.VisualTests/Tests/TestCaseNotificationManager.cs b/osu.Desktop.VisualTests/Tests/TestCaseNotificationManager.cs index 0b84eeaa30..e3457939f2 100644 --- a/osu.Desktop.VisualTests/Tests/TestCaseNotificationManager.cs +++ b/osu.Desktop.VisualTests/Tests/TestCaseNotificationManager.cs @@ -3,7 +3,7 @@ using System.Collections.Generic; using osu.Framework.Graphics; -using osu.Framework.GameModes.Testing; +using osu.Framework.Screens.Testing; using osu.Framework.MathUtils; using osu.Framework.Timing; using osu.Game.Overlays; diff --git a/osu.Desktop.VisualTests/Tests/TestCaseOptions.cs b/osu.Desktop.VisualTests/Tests/TestCaseOptions.cs index 1fed512fc5..92a10cc649 100644 --- a/osu.Desktop.VisualTests/Tests/TestCaseOptions.cs +++ b/osu.Desktop.VisualTests/Tests/TestCaseOptions.cs @@ -1,7 +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.GameModes.Testing; +using osu.Framework.Screens.Testing; using osu.Framework.Graphics; using osu.Game.Graphics.UserInterface; using OpenTK.Input; diff --git a/osu.Desktop.VisualTests/Tests/TestCasePauseOverlay.cs b/osu.Desktop.VisualTests/Tests/TestCasePauseOverlay.cs index 81825681f9..9d94189885 100644 --- a/osu.Desktop.VisualTests/Tests/TestCasePauseOverlay.cs +++ b/osu.Desktop.VisualTests/Tests/TestCasePauseOverlay.cs @@ -9,7 +9,7 @@ using osu.Game.Overlays.Pause; using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Sprites; using osu.Framework.Graphics.Colour; -using osu.Framework.GameModes.Testing; +using osu.Framework.Screens.Testing; using osu.Framework.Graphics.UserInterface; namespace osu.Desktop.VisualTests.Tests diff --git a/osu.Desktop.VisualTests/Tests/TestCasePlaySongSelect.cs b/osu.Desktop.VisualTests/Tests/TestCasePlaySongSelect.cs index 47fac4d339..274eeb9440 100644 --- a/osu.Desktop.VisualTests/Tests/TestCasePlaySongSelect.cs +++ b/osu.Desktop.VisualTests/Tests/TestCasePlaySongSelect.cs @@ -3,7 +3,7 @@ using System.Collections.Generic; using osu.Desktop.VisualTests.Platform; -using osu.Framework.GameModes.Testing; +using osu.Framework.Screens.Testing; using osu.Game.Database; using osu.Game.Modes; using osu.Game.Screens.Select; diff --git a/osu.Desktop.VisualTests/Tests/TestCasePlayer.cs b/osu.Desktop.VisualTests/Tests/TestCasePlayer.cs index c6baa0a4f0..2f8c37f1bb 100644 --- a/osu.Desktop.VisualTests/Tests/TestCasePlayer.cs +++ b/osu.Desktop.VisualTests/Tests/TestCasePlayer.cs @@ -3,7 +3,7 @@ using System.Collections.Generic; using osu.Framework.Allocation; -using osu.Framework.GameModes.Testing; +using osu.Framework.Screens.Testing; using osu.Framework.MathUtils; using osu.Framework.Timing; using osu.Game.Beatmaps; @@ -71,7 +71,7 @@ namespace osu.Desktop.VisualTests.Tests Add(new Box { RelativeSizeAxes = Framework.Graphics.Axes.Both, - Colour = Color4.Gray, + Colour = Color4.Black, }); Add(new Player diff --git a/osu.Desktop.VisualTests/Tests/TestCaseScoreCounter.cs b/osu.Desktop.VisualTests/Tests/TestCaseScoreCounter.cs index 891e888d76..d4ac16b86f 100644 --- a/osu.Desktop.VisualTests/Tests/TestCaseScoreCounter.cs +++ b/osu.Desktop.VisualTests/Tests/TestCaseScoreCounter.cs @@ -2,7 +2,7 @@ // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE using System; -using osu.Framework.GameModes.Testing; +using osu.Framework.Screens.Testing; using osu.Framework.Graphics; using osu.Framework.Graphics.Sprites; using osu.Framework.MathUtils; diff --git a/osu.Desktop.VisualTests/Tests/TestCaseTextAwesome.cs b/osu.Desktop.VisualTests/Tests/TestCaseTextAwesome.cs index 301cf3dd8f..7502c623fe 100644 --- a/osu.Desktop.VisualTests/Tests/TestCaseTextAwesome.cs +++ b/osu.Desktop.VisualTests/Tests/TestCaseTextAwesome.cs @@ -2,7 +2,7 @@ // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE using System; -using osu.Framework.GameModes.Testing; +using osu.Framework.Screens.Testing; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Framework.MathUtils; diff --git a/osu.Desktop.VisualTests/Tests/TestCaseTwoLayerButton.cs b/osu.Desktop.VisualTests/Tests/TestCaseTwoLayerButton.cs index 2fbc9c811d..33ae728fd7 100644 --- a/osu.Desktop.VisualTests/Tests/TestCaseTwoLayerButton.cs +++ b/osu.Desktop.VisualTests/Tests/TestCaseTwoLayerButton.cs @@ -1,7 +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.GameModes.Testing; +using osu.Framework.Screens.Testing; using osu.Framework.Graphics.Colour; using osu.Framework.Graphics.Sprites; using osu.Game.Graphics.UserInterface; diff --git a/osu.Desktop.VisualTests/VisualTestGame.cs b/osu.Desktop.VisualTests/VisualTestGame.cs index 51fcffce57..81b00d4ab2 100644 --- a/osu.Desktop.VisualTests/VisualTestGame.cs +++ b/osu.Desktop.VisualTests/VisualTestGame.cs @@ -2,7 +2,7 @@ // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE using osu.Framework; -using osu.Framework.GameModes.Testing; +using osu.Framework.Screens.Testing; using osu.Framework.Graphics.Cursor; using osu.Game.Database; using osu.Game; @@ -21,7 +21,7 @@ namespace osu.Desktop.VisualTests { base.LoadComplete(); - (new BackgroundModeDefault() { Depth = 10 }).Preload(this, AddInternal); + (new BackgroundScreenDefault() { Depth = 10 }).Preload(this, AddInternal); // Have to construct this here, rather than in the constructor, because // we depend on some dependencies to be loaded within OsuGameBase.load(). diff --git a/osu.Desktop/OsuGameDesktop.cs b/osu.Desktop/OsuGameDesktop.cs index 167d4644b7..3111d72662 100644 --- a/osu.Desktop/OsuGameDesktop.cs +++ b/osu.Desktop/OsuGameDesktop.cs @@ -14,22 +14,32 @@ using osu.Game.Database; using osu.Desktop.Overlays; using System.Reflection; using System.Drawing; +using osu.Game.Screens.Menu; namespace osu.Desktop { class OsuGameDesktop : OsuGame { + private VersionManager versionManager; + + public override bool IsDeployedBuild => versionManager.IsDeployedBuild; + public OsuGameDesktop(string[] args = null) : base(args) { - + versionManager = new VersionManager { Depth = int.MinValue }; } protected override void LoadComplete() { base.LoadComplete(); - (new VersionManager()).Preload(this, Add); + versionManager.Preload(this); + ModeChanged += m => + { + if (!versionManager.IsAlive && m is Intro) + Add(versionManager); + }; } public override void SetHost(BasicGameHost host) diff --git a/osu.Desktop/Overlays/VersionManager.cs b/osu.Desktop/Overlays/VersionManager.cs index 1b72e85289..f33cd6eac2 100644 --- a/osu.Desktop/Overlays/VersionManager.cs +++ b/osu.Desktop/Overlays/VersionManager.cs @@ -24,6 +24,10 @@ namespace osu.Desktop.Overlays private UpdateManager updateManager; private NotificationManager notification; + AssemblyName assembly = Assembly.GetEntryAssembly().GetName(); + + public bool IsDeployedBuild => assembly.Version.Major > 0; + protected override bool HideOnEscape => false; public override bool HandleInput => false; @@ -41,14 +45,13 @@ namespace osu.Desktop.Overlays bool isDebug = false; Debug.Assert(isDebug = true); - var asm = Assembly.GetEntryAssembly().GetName(); string version; - if (asm.Version.Major == 0) + if (!IsDeployedBuild) { version = @"local " + (isDebug ? @"debug" : @"release"); } else - version = $@"{asm.Version.Major}.{asm.Version.Minor}.{asm.Version.Build}"; + version = $@"{assembly.Version.Major}.{assembly.Version.Minor}.{assembly.Version.Build}"; Children = new Drawable[] { diff --git a/osu.Game.Modes.Osu/Objects/Drawables/DrawableSliderTick.cs b/osu.Game.Modes.Osu/Objects/Drawables/DrawableSliderTick.cs index 7380871583..47ffe513c1 100644 --- a/osu.Game.Modes.Osu/Objects/Drawables/DrawableSliderTick.cs +++ b/osu.Game.Modes.Osu/Objects/Drawables/DrawableSliderTick.cs @@ -53,7 +53,7 @@ namespace osu.Game.Modes.Osu.Objects.Drawables }; } - private AudioSample sample; + private SampleChannel sample; [BackgroundDependencyLoader] private void load(AudioManager audio) diff --git a/osu.Game.Modes.Osu/Objects/Slider.cs b/osu.Game.Modes.Osu/Objects/Slider.cs index c3d8190240..819e227606 100644 --- a/osu.Game.Modes.Osu/Objects/Slider.cs +++ b/osu.Game.Modes.Osu/Objects/Slider.cs @@ -57,10 +57,10 @@ namespace osu.Game.Modes.Osu.Objects ControlPoint overridePoint; ControlPoint timingPoint = beatmap.TimingPointAt(StartTime, out overridePoint); var velocityAdjustment = overridePoint?.VelocityAdjustment ?? 1; - var baseVelocity = 100 * baseDifficulty.SliderMultiplier; + var baseVelocity = 100 * baseDifficulty.SliderMultiplier / velocityAdjustment; - Velocity = baseVelocity / (timingPoint.BeatLength * velocityAdjustment); - TickDistance = baseVelocity / (baseDifficulty.SliderTickRate * velocityAdjustment); + Velocity = baseVelocity / timingPoint.BeatLength; + TickDistance = baseVelocity / baseDifficulty.SliderTickRate; } public int RepeatCount = 1; diff --git a/osu.Game.Modes.Osu/UI/OsuScoreOverlay.cs b/osu.Game.Modes.Osu/UI/OsuScoreOverlay.cs index eb5aaa97c9..c7791ab8b4 100644 --- a/osu.Game.Modes.Osu/UI/OsuScoreOverlay.cs +++ b/osu.Game.Modes.Osu/UI/OsuScoreOverlay.cs @@ -13,7 +13,7 @@ namespace osu.Game.Modes.Osu.UI { public class OsuScoreOverlay : ScoreOverlay { - protected override ScoreCounter CreateScoreCounter() => new ScoreCounter() + protected override ScoreCounter CreateScoreCounter() => new ScoreCounter(6) { Anchor = Anchor.TopCentre, Origin = Anchor.TopCentre, diff --git a/osu.Game/Beatmaps/Beatmap.cs b/osu.Game/Beatmaps/Beatmap.cs index af55caf3b7..a55e9fa80d 100644 --- a/osu.Game/Beatmaps/Beatmap.cs +++ b/osu.Game/Beatmaps/Beatmap.cs @@ -40,7 +40,10 @@ namespace osu.Game.Beatmaps ControlPoint timingPoint = null; foreach (var controlPoint in ControlPoints) { - if (controlPoint.Time <= time) + // Some beatmaps have the first timingPoint (accidentally) start after the first HitObject(s). + // This null check makes it so that the first ControlPoint that makes a timing change is used as + // the timingPoint for those HitObject(s). + if (controlPoint.Time <= time || timingPoint == null) { if (controlPoint.TimingChange) { @@ -49,19 +52,10 @@ namespace osu.Game.Beatmaps } else overridePoint = controlPoint; } - // Some beatmaps have the first timingPoint (accidentally) start after the first HitObject(s). - // This branch makes it so that the first ControlPoint that makes a timing change is used as the timingPoint for the HitObject(s). - else if (timingPoint == null && controlPoint.TimingChange) - { - timingPoint = controlPoint; - } - else - { - break; - } + else break; } - return timingPoint; + return timingPoint ?? ControlPoint.Default; } } } diff --git a/osu.Game/Beatmaps/Timing/ControlPoint.cs b/osu.Game/Beatmaps/Timing/ControlPoint.cs index 27cc7244fb..88e2c2d0f4 100644 --- a/osu.Game/Beatmaps/Timing/ControlPoint.cs +++ b/osu.Game/Beatmaps/Timing/ControlPoint.cs @@ -1,20 +1,21 @@ // 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.Beatmaps.Timing { public class ControlPoint { + public static ControlPoint Default = new ControlPoint + { + BeatLength = 500, + TimingChange = true, + }; + public double Time; public double BeatLength; public double VelocityAdjustment; public bool TimingChange; + } internal enum TimeSignatures diff --git a/osu.Game/Beatmaps/WorkingBeatmap.cs b/osu.Game/Beatmaps/WorkingBeatmap.cs index 62223ec879..676bf2821b 100644 --- a/osu.Game/Beatmaps/WorkingBeatmap.cs +++ b/osu.Game/Beatmaps/WorkingBeatmap.cs @@ -83,9 +83,9 @@ namespace osu.Game.Beatmaps } private ArchiveReader trackReader; - private AudioTrack track; + private Track track; private object trackLock = new object(); - public AudioTrack Track + public Track Track { get { @@ -99,7 +99,7 @@ namespace osu.Game.Beatmaps trackReader = getReader(); var trackData = trackReader?.GetStream(BeatmapInfo.Metadata.AudioFile); if (trackData != null) - track = new AudioTrackBass(trackData); + track = new TrackBass(trackData); } catch { } diff --git a/osu.Game/Graphics/UserInterface/OsuCheckbox.cs b/osu.Game/Graphics/UserInterface/OsuCheckbox.cs index 206b0dc09d..b05d005a1b 100644 --- a/osu.Game/Graphics/UserInterface/OsuCheckbox.cs +++ b/osu.Game/Graphics/UserInterface/OsuCheckbox.cs @@ -71,8 +71,8 @@ namespace osu.Game.Graphics.UserInterface private Nub nub; private SpriteText labelSpriteText; - private AudioSample sampleChecked; - private AudioSample sampleUnchecked; + private SampleChannel sampleChecked; + private SampleChannel sampleUnchecked; public OsuCheckbox() { diff --git a/osu.Game/Graphics/UserInterface/OsuSliderBar.cs b/osu.Game/Graphics/UserInterface/OsuSliderBar.cs index 229d510688..63c8749f00 100644 --- a/osu.Game/Graphics/UserInterface/OsuSliderBar.cs +++ b/osu.Game/Graphics/UserInterface/OsuSliderBar.cs @@ -16,7 +16,7 @@ namespace osu.Game.Graphics.UserInterface { public class OsuSliderBar : SliderBar where U : struct { - private AudioSample sample; + private SampleChannel sample; private double lastSampleTime; private Nub nub; diff --git a/osu.Game/Graphics/UserInterface/PercentageCounter.cs b/osu.Game/Graphics/UserInterface/PercentageCounter.cs index 399082a9bd..6b48dff26e 100644 --- a/osu.Game/Graphics/UserInterface/PercentageCounter.cs +++ b/osu.Game/Graphics/UserInterface/PercentageCounter.cs @@ -20,8 +20,7 @@ namespace osu.Game.Graphics.UserInterface { protected override Type TransformType => typeof(TransformAccuracy); - protected override double RollingDuration => 150; - protected override bool IsRollingProportional => true; + protected override double RollingDuration => 750; private float epsilon => 1e-10f; @@ -32,6 +31,7 @@ namespace osu.Game.Graphics.UserInterface public PercentageCounter() { + DisplayedCountSpriteText.FixedWidth = true; Count = 1.0f; } diff --git a/osu.Game/Graphics/UserInterface/RollingCounter.cs b/osu.Game/Graphics/UserInterface/RollingCounter.cs index e0a5d8ed2d..3d7a4ad8d7 100644 --- a/osu.Game/Graphics/UserInterface/RollingCounter.cs +++ b/osu.Game/Graphics/UserInterface/RollingCounter.cs @@ -38,7 +38,7 @@ namespace osu.Game.Graphics.UserInterface /// /// Easing for the counter rollover animation. /// - protected virtual EasingTypes RollingEasing => EasingTypes.Out; + protected virtual EasingTypes RollingEasing => EasingTypes.OutQuint; private T displayedCount; @@ -117,10 +117,6 @@ namespace osu.Game.Graphics.UserInterface AutoSizeAxes = Axes.Both; DisplayedCount = Count; - - DisplayedCountSpriteText.Text = FormatCount(count); - DisplayedCountSpriteText.Anchor = Anchor; - DisplayedCountSpriteText.Origin = Origin; } protected override void LoadComplete() @@ -128,6 +124,10 @@ namespace osu.Game.Graphics.UserInterface base.LoadComplete(); Flush(false, TransformType); + + DisplayedCountSpriteText.Text = FormatCount(count); + DisplayedCountSpriteText.Anchor = Anchor; + DisplayedCountSpriteText.Origin = Origin; } /// diff --git a/osu.Game/Graphics/UserInterface/TwoLayerButton.cs b/osu.Game/Graphics/UserInterface/TwoLayerButton.cs index 54277bd7ff..294d8533e4 100644 --- a/osu.Game/Graphics/UserInterface/TwoLayerButton.cs +++ b/osu.Game/Graphics/UserInterface/TwoLayerButton.cs @@ -28,7 +28,7 @@ namespace osu.Game.Graphics.UserInterface public static readonly Vector2 SIZE_EXTENDED = new Vector2(140, 50); public static readonly Vector2 SIZE_RETRACTED = new Vector2(100, 50); - public AudioSample ActivationSound; + public SampleChannel ActivationSound; private SpriteText text; public Color4 HoverColour; diff --git a/osu.Game/Modes/Objects/Drawables/DrawableHitObject.cs b/osu.Game/Modes/Objects/Drawables/DrawableHitObject.cs index 94369d51aa..173176d8b4 100644 --- a/osu.Game/Modes/Objects/Drawables/DrawableHitObject.cs +++ b/osu.Game/Modes/Objects/Drawables/DrawableHitObject.cs @@ -54,7 +54,7 @@ namespace osu.Game.Modes.Objects.Drawables } } - AudioSample sample; + SampleChannel sample; [BackgroundDependencyLoader] private void load(AudioManager audio) diff --git a/osu.Game/Online/Chat/Drawables/ChannelDisplay.cs b/osu.Game/Online/Chat/Drawables/ChannelDisplay.cs index 08630a25aa..cc60706831 100644 --- a/osu.Game/Online/Chat/Drawables/ChannelDisplay.cs +++ b/osu.Game/Online/Chat/Drawables/ChannelDisplay.cs @@ -38,6 +38,7 @@ namespace osu.Game.Online.Chat.Drawables }, new ScrollContainer { + RelativeSizeAxes = Axes.Both, Children = new Drawable[] { flow = new FlowContainer diff --git a/osu.Game/OsuGame.cs b/osu.Game/OsuGame.cs index 2cce0aa0ce..1a0f08ffb8 100644 --- a/osu.Game/OsuGame.cs +++ b/osu.Game/OsuGame.cs @@ -3,7 +3,7 @@ using System; using osu.Framework.Configuration; -using osu.Framework.GameModes; +using osu.Framework.Screens; using osu.Game.Configuration; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; @@ -31,6 +31,8 @@ namespace osu.Game { public class OsuGame : OsuGameBase { + public virtual bool IsDeployedBuild => false; + public Toolbar Toolbar; private ChatOverlay chat; @@ -39,10 +41,18 @@ namespace osu.Game private NotificationManager notificationManager; - private MainMenu mainMenu => modeStack?.ChildGameMode as MainMenu; - private Intro intro => modeStack as Intro; + private Intro intro + { + get + { + Screen s = screenStack; + while (s != null && !(s is Intro)) + s = s.ChildScreen; + return s as Intro; + } + } - private OsuGameMode modeStack; + private OsuScreen screenStack; private VolumeControl volume; @@ -106,11 +116,11 @@ namespace osu.Game } }); - (modeStack = new Intro()).Preload(this, d => + (screenStack = new Loader()).Preload(this, d => { - modeStack.ModePushed += modeAdded; - modeStack.Exited += modeRemoved; - mainContent.Add(modeStack); + screenStack.ModePushed += screenAdded; + screenStack.Exited += screenRemoved; + mainContent.Add(screenStack); }); //overlay elements @@ -148,7 +158,7 @@ namespace osu.Game (Toolbar = new Toolbar { Depth = -3, - OnHome = delegate { mainMenu?.MakeCurrent(); }, + OnHome = delegate { intro?.ChildScreen?.MakeCurrent(); }, OnPlayModeChange = delegate (PlayMode m) { PlayMode.Value = m; }, }).Preload(this, t => { @@ -206,20 +216,16 @@ namespace osu.Game return base.OnKeyDown(state, args); } - public Action ModeChanged; + public event Action ModeChanged; private Container mainContent; private Container overlayContent; - private void modeChanged(GameMode newMode) + private void modeChanged(Screen newScreen) { - // - Ability to change window size - // - Ability to adjust music playback - // - Frame limiter changes - //central game mode change logic. - if ((newMode as OsuGameMode)?.ShowOverlays != true) + if ((newScreen as OsuScreen)?.ShowOverlays != true) { Toolbar.State = Visibility.Hidden; musicController.State = Visibility.Hidden; @@ -230,22 +236,24 @@ namespace osu.Game Toolbar.State = Visibility.Visible; } - Cursor.FadeIn(100); + if (newScreen is MainMenu) + Cursor.FadeIn(100); - ModeChanged?.Invoke(newMode); + ModeChanged?.Invoke(newScreen); - if (newMode == null) - Host.Exit(); + if (newScreen == null) + Exit(); } protected override bool OnExiting() { - if (!intro.DidLoadMenu || intro.ChildGameMode != null) + if (screenStack.ChildScreen == null) return false; + + if (intro == null) return true; + + if (!intro.DidLoadMenu || intro.ChildScreen != null) { - Scheduler.Add(delegate - { - intro.MakeCurrent(); - }); + Scheduler.Add(intro.MakeCurrent); return true; } @@ -256,21 +264,21 @@ namespace osu.Game { base.UpdateAfterChildren(); - if (modeStack.ChildGameMode != null) - modeStack.ChildGameMode.Padding = new MarginPadding { Top = Toolbar.Position.Y + Toolbar.DrawHeight }; + if (intro?.ChildScreen != null) + intro.ChildScreen.Padding = new MarginPadding { Top = Toolbar.Position.Y + Toolbar.DrawHeight }; } - private void modeAdded(GameMode newMode) + private void screenAdded(Screen newScreen) { - newMode.ModePushed += modeAdded; - newMode.Exited += modeRemoved; + newScreen.ModePushed += screenAdded; + newScreen.Exited += screenRemoved; - modeChanged(newMode); + modeChanged(newScreen); } - private void modeRemoved(GameMode newMode) + private void screenRemoved(Screen newScreen) { - modeChanged(newMode); + modeChanged(newScreen); } } } diff --git a/osu.Game/Overlays/NotificationManager.cs b/osu.Game/Overlays/NotificationManager.cs index cb2025c576..5e37ede783 100644 --- a/osu.Game/Overlays/NotificationManager.cs +++ b/osu.Game/Overlays/NotificationManager.cs @@ -38,8 +38,9 @@ namespace osu.Game.Overlays Colour = Color4.Black, Alpha = 0.6f, }, - scrollContainer = new ScrollContainer() + scrollContainer = new ScrollContainer { + RelativeSizeAxes = Axes.Both, Margin = new MarginPadding { Top = Toolbar.Toolbar.HEIGHT }, Children = new[] { diff --git a/osu.Game/Overlays/Pause/PauseButton.cs b/osu.Game/Overlays/Pause/PauseButton.cs index 1a1ba4f527..08ded6fbd1 100644 --- a/osu.Game/Overlays/Pause/PauseButton.cs +++ b/osu.Game/Overlays/Pause/PauseButton.cs @@ -55,7 +55,7 @@ namespace osu.Game.Overlays.Pause } } - public AudioSample SampleClick, SampleHover; + public SampleChannel SampleClick, SampleHover; private Container backgroundContainer, colourContainer, glowContainer; private Box leftGlow, centerGlow, rightGlow; diff --git a/osu.Game/Overlays/Toolbar/ToolbarButton.cs b/osu.Game/Overlays/Toolbar/ToolbarButton.cs index 1b8e68151c..8b8010821d 100644 --- a/osu.Game/Overlays/Toolbar/ToolbarButton.cs +++ b/osu.Game/Overlays/Toolbar/ToolbarButton.cs @@ -66,7 +66,7 @@ namespace osu.Game.Overlays.Toolbar private SpriteText tooltip1; private SpriteText tooltip2; protected FlowContainer Flow; - private AudioSample sampleClick; + private SampleChannel sampleClick; public ToolbarButton() { diff --git a/osu.Game/Screens/BackgroundMode.cs b/osu.Game/Screens/BackgroundScreen.cs similarity index 74% rename from osu.Game/Screens/BackgroundMode.cs rename to osu.Game/Screens/BackgroundScreen.cs index 45931b7e18..0bce73b92f 100644 --- a/osu.Game/Screens/BackgroundMode.cs +++ b/osu.Game/Screens/BackgroundScreen.cs @@ -5,7 +5,7 @@ using System; using System.Threading; using osu.Framework; using osu.Framework.Allocation; -using osu.Framework.GameModes; +using osu.Framework.Screens; using osu.Framework.Graphics; using osu.Framework.Graphics.Transformations; using osu.Framework.Input; @@ -13,9 +13,9 @@ using OpenTK; namespace osu.Game.Screens { - public abstract class BackgroundMode : GameMode, IEquatable + public abstract class BackgroundScreen : Screen, IEquatable { - public virtual bool Equals(BackgroundMode other) + public virtual bool Equals(BackgroundScreen other) { return other?.GetType() == GetType(); } @@ -37,21 +37,21 @@ namespace osu.Game.Screens this.game = game; } - public override bool Push(GameMode mode) + public override bool Push(Screen screen) { // When trying to push a non-loaded GameMode, load it asynchronously and re-invoke Push // once it's done. - if (mode.LoadState == LoadState.NotLoaded) + if (screen.LoadState == LoadState.NotLoaded) { - mode.Preload(game, d => Push((BackgroundMode)d)); + screen.Preload(game, d => Push((BackgroundScreen)d)); return true; } // Make sure the in-progress loading is complete before pushing the GameMode. - while (mode.LoadState < LoadState.Loaded) + while (screen.LoadState < LoadState.Loaded) Thread.Sleep(1); - base.Push(mode); + base.Push(screen); return true; } @@ -62,7 +62,7 @@ namespace osu.Game.Screens Content.Scale = new Vector2(1 + (x_movement_amount / DrawSize.X) * 2); } - protected override void OnEntering(GameMode last) + protected override void OnEntering(Screen last) { Content.FadeOut(); Content.MoveToX(x_movement_amount); @@ -73,13 +73,13 @@ namespace osu.Game.Screens base.OnEntering(last); } - protected override void OnSuspending(GameMode next) + protected override void OnSuspending(Screen next) { Content.MoveToX(-x_movement_amount, transition_length, EasingTypes.InOutQuart); base.OnSuspending(next); } - protected override bool OnExiting(GameMode next) + protected override bool OnExiting(Screen next) { Content.FadeOut(transition_length, EasingTypes.OutExpo); Content.MoveToX(x_movement_amount, transition_length, EasingTypes.OutExpo); @@ -87,7 +87,7 @@ namespace osu.Game.Screens return base.OnExiting(next); } - protected override void OnResuming(GameMode last) + protected override void OnResuming(Screen last) { Content.MoveToX(0, transition_length, EasingTypes.OutExpo); base.OnResuming(last); diff --git a/osu.Game/Screens/Backgrounds/BackgroundModeBeatmap.cs b/osu.Game/Screens/Backgrounds/BackgroundScreenBeatmap.cs similarity index 89% rename from osu.Game/Screens/Backgrounds/BackgroundModeBeatmap.cs rename to osu.Game/Screens/Backgrounds/BackgroundScreenBeatmap.cs index e7b0ba1566..a003fa2d57 100644 --- a/osu.Game/Screens/Backgrounds/BackgroundModeBeatmap.cs +++ b/osu.Game/Screens/Backgrounds/BackgroundScreenBeatmap.cs @@ -9,7 +9,7 @@ using osu.Game.Graphics.Backgrounds; namespace osu.Game.Screens.Backgrounds { - public class BackgroundModeBeatmap : BackgroundMode + public class BackgroundScreenBeatmap : BackgroundScreen { private Background background; @@ -55,7 +55,7 @@ namespace osu.Game.Screens.Backgrounds } } - public BackgroundModeBeatmap(WorkingBeatmap beatmap) + public BackgroundScreenBeatmap(WorkingBeatmap beatmap) { Beatmap = beatmap; } @@ -66,9 +66,9 @@ namespace osu.Game.Screens.Backgrounds blurTarget = sigma; } - public override bool Equals(BackgroundMode other) + public override bool Equals(BackgroundScreen other) { - return base.Equals(other) && beatmap == ((BackgroundModeBeatmap)other).Beatmap; + return base.Equals(other) && beatmap == ((BackgroundScreenBeatmap)other).Beatmap; } class BeatmapBackground : Background diff --git a/osu.Game/Screens/Backgrounds/BackgroundModeCustom.cs b/osu.Game/Screens/Backgrounds/BackgroundScreenCustom.cs similarity index 67% rename from osu.Game/Screens/Backgrounds/BackgroundModeCustom.cs rename to osu.Game/Screens/Backgrounds/BackgroundScreenCustom.cs index 14c6a520ea..9ec8628c5f 100644 --- a/osu.Game/Screens/Backgrounds/BackgroundModeCustom.cs +++ b/osu.Game/Screens/Backgrounds/BackgroundScreenCustom.cs @@ -5,19 +5,19 @@ using osu.Game.Graphics.Backgrounds; namespace osu.Game.Screens.Backgrounds { - public class BackgroundModeCustom : BackgroundMode + public class BackgroundScreenCustom : BackgroundScreen { private readonly string textureName; - public BackgroundModeCustom(string textureName) + public BackgroundScreenCustom(string textureName) { this.textureName = textureName; Add(new Background(textureName)); } - public override bool Equals(BackgroundMode other) + public override bool Equals(BackgroundScreen other) { - return base.Equals(other) && textureName == ((BackgroundModeCustom)other).textureName; + return base.Equals(other) && textureName == ((BackgroundScreenCustom)other).textureName; } } } \ No newline at end of file diff --git a/osu.Game/Screens/Backgrounds/BackgroundModeDefault.cs b/osu.Game/Screens/Backgrounds/BackgroundScreenDefault.cs similarity index 85% rename from osu.Game/Screens/Backgrounds/BackgroundModeDefault.cs rename to osu.Game/Screens/Backgrounds/BackgroundScreenDefault.cs index 765afb905f..6807085061 100644 --- a/osu.Game/Screens/Backgrounds/BackgroundModeDefault.cs +++ b/osu.Game/Screens/Backgrounds/BackgroundScreenDefault.cs @@ -7,7 +7,7 @@ using osu.Game.Graphics.Backgrounds; namespace osu.Game.Screens.Backgrounds { - public class BackgroundModeDefault : BackgroundMode + public class BackgroundScreenDefault : BackgroundScreen { [BackgroundDependencyLoader] private void load(BaseGame game) diff --git a/osu.Game/Screens/Backgrounds/BackgroundModeEmpty.cs b/osu.Game/Screens/Backgrounds/BackgroundScreenEmpty.cs similarity index 75% rename from osu.Game/Screens/Backgrounds/BackgroundModeEmpty.cs rename to osu.Game/Screens/Backgrounds/BackgroundScreenEmpty.cs index 7bc7c2226c..15aa8d10fe 100644 --- a/osu.Game/Screens/Backgrounds/BackgroundModeEmpty.cs +++ b/osu.Game/Screens/Backgrounds/BackgroundScreenEmpty.cs @@ -3,7 +3,7 @@ namespace osu.Game.Screens.Backgrounds { - public class BackgroundModeEmpty : BackgroundMode + public class BackgroundScreenEmpty : BackgroundScreen { } diff --git a/osu.Game/Screens/Charts/ChartInfo.cs b/osu.Game/Screens/Charts/ChartInfo.cs index 036f0fb441..f85d3acb69 100644 --- a/osu.Game/Screens/Charts/ChartInfo.cs +++ b/osu.Game/Screens/Charts/ChartInfo.cs @@ -3,7 +3,7 @@ namespace osu.Game.Screens.Charts { - class ChartInfo : GameModeWhiteBox + class ChartInfo : ScreenWhiteBox { } } diff --git a/osu.Game/Screens/Charts/ChartListing.cs b/osu.Game/Screens/Charts/ChartListing.cs index 20972550ec..b570b63c06 100644 --- a/osu.Game/Screens/Charts/ChartListing.cs +++ b/osu.Game/Screens/Charts/ChartListing.cs @@ -6,7 +6,7 @@ using System.Collections.Generic; namespace osu.Game.Screens.Charts { - class ChartListing : GameModeWhiteBox + class ChartListing : ScreenWhiteBox { protected override IEnumerable PossibleChildren => new[] { typeof(ChartInfo) diff --git a/osu.Game/Screens/Direct/OnlineListing.cs b/osu.Game/Screens/Direct/OnlineListing.cs index f7358a1a69..28de1c58d9 100644 --- a/osu.Game/Screens/Direct/OnlineListing.cs +++ b/osu.Game/Screens/Direct/OnlineListing.cs @@ -3,7 +3,7 @@ namespace osu.Game.Screens.Direct { - class OnlineListing : GameModeWhiteBox + class OnlineListing : ScreenWhiteBox { } } diff --git a/osu.Game/Screens/Edit/Editor.cs b/osu.Game/Screens/Edit/Editor.cs index 7050a50bee..284a7f6f94 100644 --- a/osu.Game/Screens/Edit/Editor.cs +++ b/osu.Game/Screens/Edit/Editor.cs @@ -1,23 +1,23 @@ // Copyright (c) 2007-2017 ppy Pty Ltd . // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE -using osu.Framework.GameModes; +using osu.Framework.Screens; using osu.Game.Screens.Backgrounds; using OpenTK.Graphics; namespace osu.Game.Screens.Edit { - class Editor : GameModeWhiteBox + class Editor : ScreenWhiteBox { - protected override BackgroundMode CreateBackground() => new BackgroundModeCustom(@"Backgrounds/bg4"); + protected override BackgroundScreen CreateBackground() => new BackgroundScreenCustom(@"Backgrounds/bg4"); - protected override void OnEntering(GameMode last) + protected override void OnEntering(Screen last) { base.OnEntering(last); Background.Schedule(() => Background.FadeColour(Color4.DarkGray, 500)); } - protected override bool OnExiting(GameMode next) + protected override bool OnExiting(Screen next) { Background.Schedule(() => Background.FadeColour(Color4.White, 500)); return base.OnExiting(next); diff --git a/osu.Game/Screens/GameModeWhiteBox.cs b/osu.Game/Screens/GameScreenWhiteBox.cs similarity index 89% rename from osu.Game/Screens/GameModeWhiteBox.cs rename to osu.Game/Screens/GameScreenWhiteBox.cs index dce33eefb0..360dec504c 100644 --- a/osu.Game/Screens/GameModeWhiteBox.cs +++ b/osu.Game/Screens/GameScreenWhiteBox.cs @@ -3,7 +3,7 @@ using System; using System.Collections.Generic; -using osu.Framework.GameModes; +using osu.Framework.Screens; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Sprites; @@ -17,7 +17,7 @@ using OpenTK.Graphics; namespace osu.Game.Screens { - public class GameModeWhiteBox : OsuGameMode + public class ScreenWhiteBox : OsuScreen { private BackButton popButton; @@ -29,9 +29,9 @@ namespace osu.Game.Screens private Container textContainer; private Box box; - protected override BackgroundMode CreateBackground() => new BackgroundModeCustom(@"Backgrounds/bg2"); + protected override BackgroundScreen CreateBackground() => new BackgroundScreenCustom(@"Backgrounds/bg2"); - protected override void OnEntering(GameMode last) + protected override void OnEntering(Screen last) { base.OnEntering(last); @@ -54,7 +54,7 @@ namespace osu.Game.Screens Content.FadeIn(transition_time, EasingTypes.OutExpo); } - protected override bool OnExiting(GameMode next) + protected override bool OnExiting(Screen next) { textContainer.MoveTo(new Vector2((DrawSize.X / 16), 0), transition_time, EasingTypes.OutExpo); Content.FadeOut(transition_time, EasingTypes.OutExpo); @@ -62,7 +62,7 @@ namespace osu.Game.Screens return base.OnExiting(next); } - protected override void OnSuspending(GameMode next) + protected override void OnSuspending(Screen next) { base.OnSuspending(next); @@ -70,7 +70,7 @@ namespace osu.Game.Screens Content.FadeOut(transition_time, EasingTypes.OutExpo); } - protected override void OnResuming(GameMode last) + protected override void OnResuming(Screen last) { base.OnResuming(last); @@ -78,7 +78,7 @@ namespace osu.Game.Screens Content.FadeIn(transition_time, EasingTypes.OutExpo); } - public GameModeWhiteBox() + public ScreenWhiteBox() { Children = new Drawable[] { @@ -148,7 +148,7 @@ namespace osu.Game.Screens BackgroundColour = getColourFor(t), Action = delegate { - Push(Activator.CreateInstance(t) as GameMode); + Push(Activator.CreateInstance(t) as Screen); } }); } diff --git a/osu.Game/Screens/Loader.cs b/osu.Game/Screens/Loader.cs new file mode 100644 index 0000000000..33094b7098 --- /dev/null +++ b/osu.Game/Screens/Loader.cs @@ -0,0 +1,28 @@ +// 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.Screens; +using osu.Game.Screens.Menu; + +namespace osu.Game.Screens +{ + class Loader : OsuScreen + { + internal override bool ShowOverlays => false; + + public Loader() + { + ValidForResume = false; + } + + [BackgroundDependencyLoader] + private void load(OsuGame game) + { + if (game.IsDeployedBuild) + new Disclaimer().Preload(game, d => Push((Screen)d)); + else + new Intro().Preload(game, d => Push((Screen)d)); + } + } +} diff --git a/osu.Game/Screens/Menu/Button.cs b/osu.Game/Screens/Menu/Button.cs index 14d957733a..0c4c6fc1e8 100644 --- a/osu.Game/Screens/Menu/Button.cs +++ b/osu.Game/Screens/Menu/Button.cs @@ -37,7 +37,7 @@ namespace osu.Game.Screens.Menu private readonly float extraWidth; private Key triggerKey; private string text; - private AudioSample sampleClick; + private SampleChannel sampleClick; public override bool Contains(Vector2 screenSpacePos) { diff --git a/osu.Game/Screens/Menu/ButtonSystem.cs b/osu.Game/Screens/Menu/ButtonSystem.cs index 9a84a79333..8464ca92ef 100644 --- a/osu.Game/Screens/Menu/ButtonSystem.cs +++ b/osu.Game/Screens/Menu/ButtonSystem.cs @@ -32,7 +32,7 @@ namespace osu.Game.Screens.Menu public Action OnChart; public Action OnTest; - private AudioSample sampleOsuClick; + private SampleChannel sampleOsuClick; private Toolbar toolbar; @@ -218,6 +218,7 @@ namespace osu.Game.Screens.Menu switch (state) { + case MenuState.Exit: case MenuState.Initial: toolbar?.Hide(); @@ -233,6 +234,12 @@ namespace osu.Game.Screens.Menu foreach (Button b in buttonsPlay) b.State = ButtonState.Contracted; + + if (state == MenuState.Exit) + { + osuLogo.RotateTo(20, EXIT_DELAY * 1.5f); + osuLogo.FadeOut(EXIT_DELAY); + } break; case MenuState.TopLevel: buttonArea.Flush(true); @@ -276,21 +283,6 @@ namespace osu.Game.Screens.Menu foreach (Button b in buttonsPlay) b.State = ButtonState.Contracted; break; - case MenuState.Exit: - buttonArea.FadeOut(200); - - foreach (Button b in buttonsTopLevel) - b.State = ButtonState.Contracted; - - foreach (Button b in buttonsPlay) - b.State = ButtonState.Contracted; - - osuLogo.Delay(150); - - osuLogo.ScaleTo(1f, EXIT_DELAY * 1.5f); - osuLogo.RotateTo(20, EXIT_DELAY * 1.5f); - osuLogo.FadeOut(EXIT_DELAY); - break; } backButton.State = state == MenuState.Play ? ButtonState.Expanded : ButtonState.Contracted; diff --git a/osu.Game/Screens/Menu/Disclaimer.cs b/osu.Game/Screens/Menu/Disclaimer.cs new file mode 100644 index 0000000000..c5c00d5037 --- /dev/null +++ b/osu.Game/Screens/Menu/Disclaimer.cs @@ -0,0 +1,119 @@ +// 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; +using osu.Framework.Graphics.Primitives; +using osu.Framework.Screens; +using osu.Game.Graphics; +using osu.Game.Graphics.Sprites; +using OpenTK; +using OpenTK.Graphics; + +namespace osu.Game.Screens.Menu +{ + class Disclaimer : OsuScreen + { + private Intro intro; + private TextAwesome icon; + private Color4 iconColour; + + internal override bool ShowOverlays => false; + + public Disclaimer() + { + ValidForResume = false; + + Children = new Drawable[] + { + new FlowContainer + { + AutoSizeAxes = Axes.Both, + Anchor = Anchor.Centre, + Origin = Anchor.Centre, + Direction = FlowDirections.Vertical, + Spacing = new Vector2(0, 2), + Children = new Drawable[] + { + icon = new TextAwesome + { + Anchor = Anchor.TopCentre, + Origin = Anchor.TopCentre, + Icon = FontAwesome.fa_warning, + TextSize = 30, + }, + new OsuSpriteText + { + Anchor = Anchor.TopCentre, + Origin = Anchor.TopCentre, + TextSize = 30, + Text = "This is a development build", + Margin = new MarginPadding + { + Bottom = 20 + }, + }, + new OsuSpriteText + { + Anchor = Anchor.TopCentre, + Origin = Anchor.TopCentre, + Text = "Don't expect shit to work perfectly as this is very much a work in progress." + }, + new OsuSpriteText + { + Anchor = Anchor.TopCentre, + Origin = Anchor.TopCentre, + Text = "Don't report bugs because we are aware. Don't complain about missing features because we are adding them." + }, + new OsuSpriteText + { + Anchor = Anchor.TopCentre, + Origin = Anchor.TopCentre, + Text = "Sit back and enjoy. Visit discord.gg/ppy if you want to help out!", + Margin = new MarginPadding { Bottom = 20 }, + }, + new OsuSpriteText + { + Anchor = Anchor.TopCentre, + Origin = Anchor.TopCentre, + TextSize = 12, + Text = "oh and yes, you will get seizures.", + }, + } + } + }; + } + + [BackgroundDependencyLoader] + private void load(OsuGame game, OsuColour colours) + { + (intro = new Intro()).Preload(game); + + iconColour = colours.Yellow; + } + + protected override void OnEntering(Screen last) + { + base.OnEntering(last); + + Content.FadeInFromZero(500); + + icon.Delay(1500); + icon.FadeColour(iconColour, 200); + + Delay(6000, true); + + Content.FadeOut(250); + + Delay(250); + + Schedule(() => Push(intro)); + } + } +} diff --git a/osu.Game/Screens/Menu/Intro.cs b/osu.Game/Screens/Menu/Intro.cs index cb3cfe0208..c69dfff7db 100644 --- a/osu.Game/Screens/Menu/Intro.cs +++ b/osu.Game/Screens/Menu/Intro.cs @@ -5,7 +5,7 @@ using osu.Framework.Allocation; using osu.Framework.Audio; using osu.Framework.Audio.Sample; using osu.Framework.Audio.Track; -using osu.Framework.GameModes; +using osu.Framework.Screens; using osu.Framework.Graphics; using osu.Framework.Graphics.Transformations; using osu.Game.Graphics.Containers; @@ -14,7 +14,7 @@ using OpenTK.Graphics; namespace osu.Game.Screens.Menu { - class Intro : OsuGameMode + public class Intro : OsuScreen { private OsuLogo logo; @@ -24,13 +24,13 @@ namespace osu.Game.Screens.Menu internal bool DidLoadMenu; MainMenu mainMenu; - private AudioSample welcome; - private AudioSample seeya; - private AudioTrack bgm; + private SampleChannel welcome; + private SampleChannel seeya; + private Track bgm; - internal override bool ShowOverlays => (ParentGameMode as OsuGameMode)?.ShowOverlays ?? false; + internal override bool ShowOverlays => false; - protected override BackgroundMode CreateBackground() => new BackgroundModeEmpty(); + protected override BackgroundScreen CreateBackground() => new BackgroundScreenEmpty(); public Intro() { @@ -65,7 +65,7 @@ namespace osu.Game.Screens.Menu bgm.Looping = true; } - protected override void OnEntering(GameMode last) + protected override void OnEntering(Screen last) { base.OnEntering(last); @@ -77,8 +77,7 @@ namespace osu.Game.Screens.Menu { bgm.Start(); - mainMenu = new MainMenu(); - mainMenu.Preload(Game); + (mainMenu = new MainMenu()).Preload(Game); Scheduler.AddDelayed(delegate { @@ -95,24 +94,27 @@ namespace osu.Game.Screens.Menu logo.FadeIn(20000, EasingTypes.OutQuint); } - protected override void OnSuspending(GameMode next) + protected override void OnSuspending(Screen next) { Content.FadeOut(300); base.OnSuspending(next); } - protected override bool OnExiting(GameMode next) + protected override bool OnExiting(Screen next) { //cancel exiting if we haven't loaded the menu yet. return !DidLoadMenu; } - protected override void OnResuming(GameMode last) + protected override void OnResuming(Screen last) { + if (!(last is MainMenu)) + Content.FadeIn(300); + //we also handle the exit transition. seeya.Play(); - double fadeOutTime = (last.LifetimeEnd - Time.Current) + 100; + double fadeOutTime = 2000; Scheduler.AddDelayed(Exit, fadeOutTime); diff --git a/osu.Game/Screens/Menu/MainMenu.cs b/osu.Game/Screens/Menu/MainMenu.cs index f672a3998b..29fc44d673 100644 --- a/osu.Game/Screens/Menu/MainMenu.cs +++ b/osu.Game/Screens/Menu/MainMenu.cs @@ -2,8 +2,8 @@ // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE using osu.Framework.Allocation; -using osu.Framework.GameModes; -using osu.Framework.GameModes.Testing; +using osu.Framework.Screens; +using osu.Framework.Screens.Testing; using osu.Framework.Graphics; using osu.Framework.Graphics.Transformations; using osu.Game.Graphics.Containers; @@ -16,20 +16,20 @@ using osu.Game.Screens.Select; namespace osu.Game.Screens.Menu { - public class MainMenu : OsuGameMode + public class MainMenu : OsuScreen { private ButtonSystem buttons; public override string Name => @"Main Menu"; internal override bool ShowOverlays => buttons.State != MenuState.Initial; - private BackgroundMode background; + private BackgroundScreen background; - protected override BackgroundMode CreateBackground() => background; + protected override BackgroundScreen CreateBackground() => background; public MainMenu() { - background = new BackgroundModeDefault(); + background = new BackgroundScreenDefault(); Children = new Drawable[] { @@ -62,13 +62,13 @@ namespace osu.Game.Screens.Menu } - protected override void OnEntering(GameMode last) + protected override void OnEntering(Screen last) { base.OnEntering(last); buttons.FadeInFromZero(500); } - protected override void OnSuspending(GameMode next) + protected override void OnSuspending(Screen next) { base.OnSuspending(next); @@ -80,7 +80,7 @@ namespace osu.Game.Screens.Menu Content.MoveTo(new Vector2(-800, 0), length, EasingTypes.InSine); } - protected override void OnResuming(GameMode last) + protected override void OnResuming(Screen last) { base.OnResuming(last); @@ -92,10 +92,10 @@ namespace osu.Game.Screens.Menu Content.MoveTo(new Vector2(0, 0), length, EasingTypes.OutQuint); } - protected override bool OnExiting(GameMode next) + protected override bool OnExiting(Screen next) { buttons.State = MenuState.Exit; - Content.FadeOut(ButtonSystem.EXIT_DELAY); + Content.FadeOut(3000); return base.OnExiting(next); } } diff --git a/osu.Game/Screens/Menu/OsuLogo.cs b/osu.Game/Screens/Menu/OsuLogo.cs index 3a1a37fdcc..2035ec17ce 100644 --- a/osu.Game/Screens/Menu/OsuLogo.cs +++ b/osu.Game/Screens/Menu/OsuLogo.cs @@ -33,7 +33,7 @@ namespace osu.Game.Screens.Menu private Container logoBounceContainer; private Container logoHoverContainer; - private AudioSample sampleClick; + private SampleChannel sampleClick; private Container colourAndTriangles; diff --git a/osu.Game/Screens/Multiplayer/Lobby.cs b/osu.Game/Screens/Multiplayer/Lobby.cs index c3b4938232..c6d59000d3 100644 --- a/osu.Game/Screens/Multiplayer/Lobby.cs +++ b/osu.Game/Screens/Multiplayer/Lobby.cs @@ -6,7 +6,7 @@ using System.Collections.Generic; namespace osu.Game.Screens.Multiplayer { - class Lobby : GameModeWhiteBox + class Lobby : ScreenWhiteBox { protected override IEnumerable PossibleChildren => new[] { typeof(MatchCreate), diff --git a/osu.Game/Screens/Multiplayer/Match.cs b/osu.Game/Screens/Multiplayer/Match.cs index 10de1655f3..e4edcb5d7d 100644 --- a/osu.Game/Screens/Multiplayer/Match.cs +++ b/osu.Game/Screens/Multiplayer/Match.cs @@ -3,7 +3,7 @@ using System; using System.Collections.Generic; -using osu.Framework.GameModes; +using osu.Framework.Screens; using osu.Game.Screens.Backgrounds; using osu.Game.Screens.Play; using OpenTK.Graphics; @@ -11,23 +11,23 @@ using osu.Game.Screens.Select; namespace osu.Game.Screens.Multiplayer { - class Match : GameModeWhiteBox + class Match : ScreenWhiteBox { protected override IEnumerable PossibleChildren => new[] { typeof(MatchSongSelect), typeof(Player), }; - protected override BackgroundMode CreateBackground() => new BackgroundModeCustom(@"Backgrounds/bg4"); + protected override BackgroundScreen CreateBackground() => new BackgroundScreenCustom(@"Backgrounds/bg4"); - protected override void OnEntering(GameMode last) + protected override void OnEntering(Screen last) { base.OnEntering(last); Background.Schedule(() => Background.FadeColour(Color4.DarkGray, 500)); } - protected override bool OnExiting(GameMode next) + protected override bool OnExiting(Screen next) { Background.Schedule(() => Background.FadeColour(Color4.White, 500)); return base.OnExiting(next); diff --git a/osu.Game/Screens/Multiplayer/MatchCreate.cs b/osu.Game/Screens/Multiplayer/MatchCreate.cs index b0c0456635..57dc0bcf4b 100644 --- a/osu.Game/Screens/Multiplayer/MatchCreate.cs +++ b/osu.Game/Screens/Multiplayer/MatchCreate.cs @@ -6,7 +6,7 @@ using System.Collections.Generic; namespace osu.Game.Screens.Multiplayer { - class MatchCreate : GameModeWhiteBox + class MatchCreate : ScreenWhiteBox { protected override IEnumerable PossibleChildren => new[] { typeof(Match) diff --git a/osu.Game/Screens/OsuGameMode.cs b/osu.Game/Screens/OsuGameScreen.cs similarity index 81% rename from osu.Game/Screens/OsuGameMode.cs rename to osu.Game/Screens/OsuGameScreen.cs index 3134640a60..7aa3d5a5d0 100644 --- a/osu.Game/Screens/OsuGameMode.cs +++ b/osu.Game/Screens/OsuGameScreen.cs @@ -4,21 +4,21 @@ using System; using osu.Framework.Allocation; using osu.Framework.Configuration; -using osu.Framework.GameModes; +using osu.Framework.Screens; using osu.Game.Beatmaps; using osu.Game.Graphics.Containers; namespace osu.Game.Screens { - public abstract class OsuGameMode : GameMode + public abstract class OsuScreen : Screen { - internal BackgroundMode Background { get; private set; } + internal BackgroundScreen Background { get; private set; } /// /// Override to create a BackgroundMode for the current GameMode. /// Note that the instance created may not be the used instance if it matches the BackgroundMode equality clause. /// - protected virtual BackgroundMode CreateBackground() => null; + protected virtual BackgroundScreen CreateBackground() => null; internal virtual bool ShowOverlays => true; @@ -73,15 +73,15 @@ namespace osu.Game.Screens beatmap = game?.Beatmap; } - public override bool Push(GameMode mode) + public override bool Push(Screen screen) { - OsuGameMode nextOsu = mode as OsuGameMode; + OsuScreen nextOsu = screen as OsuScreen; if (nextOsu != null) { nextOsu.beatmap = beatmap; } - return base.Push(mode); + return base.Push(screen); } protected virtual void OnBeatmapChanged(WorkingBeatmap beatmap) @@ -89,11 +89,11 @@ namespace osu.Game.Screens } - protected override void OnEntering(GameMode last) + protected override void OnEntering(Screen last) { - OsuGameMode lastOsu = last as OsuGameMode; + OsuScreen lastOsu = last as OsuScreen; - BackgroundMode bg = CreateBackground(); + BackgroundScreen bg = CreateBackground(); if (lastOsu?.Background != null) { @@ -120,9 +120,9 @@ namespace osu.Game.Screens base.OnEntering(last); } - protected override bool OnExiting(GameMode next) + protected override bool OnExiting(Screen next) { - OsuGameMode nextOsu = next as OsuGameMode; + OsuScreen nextOsu = next as OsuScreen; if (Background != null && !Background.Equals(nextOsu?.Background)) { diff --git a/osu.Game/Screens/Play/FailDialog.cs b/osu.Game/Screens/Play/FailDialog.cs index a275a87626..622dd0a44a 100644 --- a/osu.Game/Screens/Play/FailDialog.cs +++ b/osu.Game/Screens/Play/FailDialog.cs @@ -1,7 +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.GameModes; +using osu.Framework.Screens; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Sprites; @@ -14,9 +14,9 @@ using OpenTK.Graphics; namespace osu.Game.Screens.Play { - class FailDialog : OsuGameMode + class FailDialog : OsuScreen { - protected override BackgroundMode CreateBackground() => new BackgroundModeBeatmap(Beatmap); + protected override BackgroundScreen CreateBackground() => new BackgroundScreenBeatmap(Beatmap); private static readonly Vector2 background_blur = new Vector2(20); @@ -31,13 +31,13 @@ namespace osu.Game.Screens.Play }); } - protected override void OnEntering(GameMode last) + protected override void OnEntering(Screen last) { base.OnEntering(last); - Background.Schedule(() => (Background as BackgroundModeBeatmap)?.BlurTo(background_blur, 1000)); + Background.Schedule(() => (Background as BackgroundScreenBeatmap)?.BlurTo(background_blur, 1000)); } - protected override bool OnExiting(GameMode next) + protected override bool OnExiting(Screen next) { Background.Schedule(() => Background.FadeColour(Color4.White, 500)); return base.OnExiting(next); diff --git a/osu.Game/Screens/Play/ModSelect.cs b/osu.Game/Screens/Play/ModSelect.cs index 917fc1ad23..9d3db0221d 100644 --- a/osu.Game/Screens/Play/ModSelect.cs +++ b/osu.Game/Screens/Play/ModSelect.cs @@ -1,23 +1,23 @@ // Copyright (c) 2007-2017 ppy Pty Ltd . // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE -using osu.Framework.GameModes; +using osu.Framework.Screens; using osu.Game.Screens.Backgrounds; using OpenTK.Graphics; namespace osu.Game.Screens.Play { - class ModSelect : GameModeWhiteBox + class ModSelect : ScreenWhiteBox { - protected override BackgroundMode CreateBackground() => new BackgroundModeCustom(@"Backgrounds/bg4"); + protected override BackgroundScreen CreateBackground() => new BackgroundScreenCustom(@"Backgrounds/bg4"); - protected override void OnEntering(GameMode last) + protected override void OnEntering(Screen last) { base.OnEntering(last); Background.Schedule(() => Background.FadeColour(Color4.DarkGray, 500)); } - protected override bool OnExiting(GameMode next) + protected override bool OnExiting(Screen next) { Background.Schedule(() => Background.FadeColour(Color4.White, 500)); return base.OnExiting(next); diff --git a/osu.Game/Screens/Play/Player.cs b/osu.Game/Screens/Play/Player.cs index 650568f60b..23341ec0d4 100644 --- a/osu.Game/Screens/Play/Player.cs +++ b/osu.Game/Screens/Play/Player.cs @@ -12,7 +12,7 @@ using osu.Game.Modes; using osu.Game.Modes.Objects.Drawables; using osu.Game.Screens.Backgrounds; using OpenTK; -using osu.Framework.GameModes; +using osu.Framework.Screens; using osu.Game.Modes.UI; using osu.Game.Screens.Ranking; using osu.Game.Configuration; @@ -27,11 +27,11 @@ using osu.Framework.Logging; namespace osu.Game.Screens.Play { - public class Player : OsuGameMode + public class Player : OsuScreen { public bool Autoplay; - protected override BackgroundMode CreateBackground() => new BackgroundModeBeatmap(Beatmap); + protected override BackgroundScreen CreateBackground() => new BackgroundScreenBeatmap(Beatmap); internal override bool ShowOverlays => false; @@ -89,7 +89,7 @@ namespace osu.Game.Screens.Play return; } - AudioTrack track = Beatmap.Track; + Track track = Beatmap.Track; if (track != null) { @@ -281,18 +281,18 @@ namespace osu.Game.Screens.Play }); } - protected override void OnEntering(GameMode last) + protected override void OnEntering(Screen last) { base.OnEntering(last); - (Background as BackgroundModeBeatmap)?.BlurTo(Vector2.Zero, 1000); + (Background as BackgroundScreenBeatmap)?.BlurTo(Vector2.Zero, 1000); Background?.FadeTo((100f - dimLevel) / 100, 1000); Content.Alpha = 0; dimLevel.ValueChanged += dimChanged; } - protected override bool OnExiting(GameMode next) + protected override bool OnExiting(Screen next) { if (pauseOverlay == null) return false; diff --git a/osu.Game/Screens/Ranking/Results.cs b/osu.Game/Screens/Ranking/Results.cs index 5e61f381e9..119bc49e1a 100644 --- a/osu.Game/Screens/Ranking/Results.cs +++ b/osu.Game/Screens/Ranking/Results.cs @@ -1,7 +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.GameModes; +using osu.Framework.Screens; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Sprites; @@ -14,21 +14,21 @@ using OpenTK.Graphics; namespace osu.Game.Screens.Ranking { - class Results : OsuGameMode + class Results : OsuScreen { - protected override BackgroundMode CreateBackground() => new BackgroundModeBeatmap(Beatmap); + protected override BackgroundScreen CreateBackground() => new BackgroundScreenBeatmap(Beatmap); private static readonly Vector2 background_blur = new Vector2(20); ScoreDisplay scoreDisplay; - protected override void OnEntering(GameMode last) + protected override void OnEntering(Screen last) { base.OnEntering(last); - Background.Schedule(() => (Background as BackgroundModeBeatmap)?.BlurTo(background_blur, 1000)); + Background.Schedule(() => (Background as BackgroundScreenBeatmap)?.BlurTo(background_blur, 1000)); } - protected override bool OnExiting(GameMode next) + protected override bool OnExiting(Screen next) { Background.Schedule(() => Background.FadeColour(Color4.White, 500)); return base.OnExiting(next); diff --git a/osu.Game/Screens/Select/EditSongSelect.cs b/osu.Game/Screens/Select/EditSongSelect.cs index 35c212bece..5eaaf1be64 100644 --- a/osu.Game/Screens/Select/EditSongSelect.cs +++ b/osu.Game/Screens/Select/EditSongSelect.cs @@ -8,12 +8,12 @@ using osu.Game.Screens.Edit; namespace osu.Game.Screens.Select { - class EditSongSelect : GameModeWhiteBox + class EditSongSelect : ScreenWhiteBox { protected override IEnumerable PossibleChildren => new[] { typeof(Editor) }; - protected override BackgroundMode CreateBackground() => new BackgroundModeCustom(@"Backgrounds/bg4"); + protected override BackgroundScreen CreateBackground() => new BackgroundScreenCustom(@"Backgrounds/bg4"); } } diff --git a/osu.Game/Screens/Select/MatchSongSelect.cs b/osu.Game/Screens/Select/MatchSongSelect.cs index de250197e7..4c9e7c9d37 100644 --- a/osu.Game/Screens/Select/MatchSongSelect.cs +++ b/osu.Game/Screens/Select/MatchSongSelect.cs @@ -5,8 +5,8 @@ using osu.Game.Screens.Backgrounds; namespace osu.Game.Screens.Select { - class MatchSongSelect : GameModeWhiteBox + class MatchSongSelect : ScreenWhiteBox { - protected override BackgroundMode CreateBackground() => new BackgroundModeCustom(@"Backgrounds/bg4"); + protected override BackgroundScreen CreateBackground() => new BackgroundScreenCustom(@"Backgrounds/bg4"); } } diff --git a/osu.Game/Screens/Select/PlaySongSelect.cs b/osu.Game/Screens/Select/PlaySongSelect.cs index e206c5d5fa..706a71b2b6 100644 --- a/osu.Game/Screens/Select/PlaySongSelect.cs +++ b/osu.Game/Screens/Select/PlaySongSelect.cs @@ -9,7 +9,7 @@ using osu.Framework.Allocation; using osu.Framework.Audio; using osu.Framework.Audio.Track; using osu.Framework.Configuration; -using osu.Framework.GameModes; +using osu.Framework.Screens; using osu.Framework.Graphics; using osu.Framework.Graphics.Primitives; using osu.Game.Beatmaps; @@ -32,11 +32,11 @@ using osu.Framework.Threading; namespace osu.Game.Screens.Select { - public class PlaySongSelect : OsuGameMode + public class PlaySongSelect : OsuScreen { private Bindable playMode; private BeatmapDatabase database; - protected override BackgroundMode CreateBackground() => new BackgroundModeBeatmap(Beatmap); + protected override BackgroundScreen CreateBackground() => new BackgroundScreenBeatmap(Beatmap); private CarouselContainer carousel; private TrackManager trackManager; @@ -47,8 +47,8 @@ namespace osu.Game.Screens.Select private static readonly Vector2 background_blur = new Vector2(20); private CancellationTokenSource initialAddSetsTask; - private AudioSample sampleChangeDifficulty; - private AudioSample sampleChangeBeatmap; + private SampleChannel sampleChangeDifficulty; + private SampleChannel sampleChangeBeatmap; private List beatmapGroups; @@ -203,7 +203,7 @@ namespace osu.Game.Screens.Select Schedule(() => addBeatmapSet(s, Game, true)); } - protected override void OnEntering(GameMode last) + protected override void OnEntering(Screen last) { base.OnEntering(last); ensurePlayingSelected(); @@ -218,7 +218,7 @@ namespace osu.Game.Screens.Select filter.Activate(); } - protected override void OnResuming(GameMode last) + protected override void OnResuming(Screen last) { player = null; @@ -233,7 +233,7 @@ namespace osu.Game.Screens.Select filter.Activate(); } - protected override void OnSuspending(GameMode next) + protected override void OnSuspending(Screen next) { Content.ScaleTo(1.1f, 250, EasingTypes.InSine); @@ -243,7 +243,7 @@ namespace osu.Game.Screens.Select base.OnSuspending(next); } - protected override bool OnExiting(GameMode next) + protected override bool OnExiting(Screen next) { beatmapInfoWedge.MoveToX(-100, 800, EasingTypes.InQuint); beatmapInfoWedge.RotateTo(10, 800, EasingTypes.InQuint); @@ -271,7 +271,7 @@ namespace osu.Game.Screens.Select private void changeBackground(WorkingBeatmap beatmap) { - var backgroundModeBeatmap = Background as BackgroundModeBeatmap; + var backgroundModeBeatmap = Background as BackgroundScreenBeatmap; if (backgroundModeBeatmap != null) { backgroundModeBeatmap.Beatmap = beatmap; @@ -317,7 +317,7 @@ namespace osu.Game.Screens.Select private void ensurePlayingSelected(bool preview = false) { - AudioTrack track = Beatmap?.Track; + Track track = Beatmap?.Track; if (track != null) { diff --git a/osu.Game/osu.Game.csproj b/osu.Game/osu.Game.csproj index ed49590dbd..632e35037b 100644 --- a/osu.Game/osu.Game.csproj +++ b/osu.Game/osu.Game.csproj @@ -123,15 +123,17 @@ - - - - - + + + + + - + + + @@ -146,7 +148,7 @@ - +