diff --git a/osu-framework b/osu-framework index 51737ec132..84d61415cc 160000 --- a/osu-framework +++ b/osu-framework @@ -1 +1 @@ -Subproject commit 51737ec1320b4ea9dce4978f24e1d77a28f0a98e +Subproject commit 84d61415ccb79dbc04a83b58e212ab67341a726c diff --git a/osu.Desktop.VisualTests/Tests/TestCaseKeyCounter.cs b/osu.Desktop.VisualTests/Tests/TestCaseKeyCounter.cs index 9ad439bfbe..83ad49fcd2 100644 --- a/osu.Desktop.VisualTests/Tests/TestCaseKeyCounter.cs +++ b/osu.Desktop.VisualTests/Tests/TestCaseKeyCounter.cs @@ -10,7 +10,6 @@ using OpenTK; using OpenTK.Graphics; using osu.Framework.MathUtils; using osu.Framework.Graphics.Sprites; -using osu.Framework.Graphics.Transforms; using osu.Game.Screens.Play; namespace osu.Desktop.VisualTests.Tests diff --git a/osu.Game.Modes.Osu/Objects/Drawables/Connections/FollowPoint.cs b/osu.Game.Modes.Osu/Objects/Drawables/Connections/FollowPoint.cs index 935f3e01fd..efbd5b291a 100644 --- a/osu.Game.Modes.Osu/Objects/Drawables/Connections/FollowPoint.cs +++ b/osu.Game.Modes.Osu/Objects/Drawables/Connections/FollowPoint.cs @@ -7,7 +7,6 @@ using osu.Framework.Extensions.Color4Extensions; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Sprites; -using osu.Framework.Graphics.Transforms; namespace osu.Game.Modes.Osu.Objects.Drawables.Connections { diff --git a/osu.Game.Modes.Osu/Objects/Drawables/DrawableHitCircle.cs b/osu.Game.Modes.Osu/Objects/Drawables/DrawableHitCircle.cs index 3ed3124e14..dcc25a997a 100644 --- a/osu.Game.Modes.Osu/Objects/Drawables/DrawableHitCircle.cs +++ b/osu.Game.Modes.Osu/Objects/Drawables/DrawableHitCircle.cs @@ -3,7 +3,6 @@ using System; using osu.Framework.Graphics; -using osu.Framework.Graphics.Transforms; using osu.Game.Modes.Objects.Drawables; using osu.Game.Modes.Osu.Objects.Drawables.Pieces; using OpenTK; diff --git a/osu.Game.Modes.Osu/Objects/Drawables/DrawableOsuJudgement.cs b/osu.Game.Modes.Osu/Objects/Drawables/DrawableOsuJudgement.cs index 13937e3c39..647c8faef8 100644 --- a/osu.Game.Modes.Osu/Objects/Drawables/DrawableOsuJudgement.cs +++ b/osu.Game.Modes.Osu/Objects/Drawables/DrawableOsuJudgement.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.Graphics.Transforms; +using osu.Framework.Graphics; using osu.Game.Modes.Objects.Drawables; using osu.Game.Modes.Osu.Judgements; using OpenTK; diff --git a/osu.Game.Modes.Osu/Objects/Drawables/DrawableSliderTick.cs b/osu.Game.Modes.Osu/Objects/Drawables/DrawableSliderTick.cs index 1c9f1e617c..be66689054 100644 --- a/osu.Game.Modes.Osu/Objects/Drawables/DrawableSliderTick.cs +++ b/osu.Game.Modes.Osu/Objects/Drawables/DrawableSliderTick.cs @@ -7,7 +7,6 @@ using osu.Framework.Audio; using osu.Framework.Audio.Sample; using osu.Framework.Graphics; using osu.Framework.Graphics.Sprites; -using osu.Framework.Graphics.Transforms; using osu.Game.Beatmaps.Samples; using osu.Game.Modes.Objects.Drawables; using osu.Game.Modes.Osu.Judgements; diff --git a/osu.Game.Modes.Osu/Objects/Drawables/DrawableSpinner.cs b/osu.Game.Modes.Osu/Objects/Drawables/DrawableSpinner.cs index 81bf9f0bf1..d0136f717c 100644 --- a/osu.Game.Modes.Osu/Objects/Drawables/DrawableSpinner.cs +++ b/osu.Game.Modes.Osu/Objects/Drawables/DrawableSpinner.cs @@ -4,7 +4,6 @@ using System; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; -using osu.Framework.Graphics.Transforms; using osu.Framework.MathUtils; using osu.Game.Modes.Objects.Drawables; using osu.Game.Modes.Osu.Objects.Drawables.Pieces; diff --git a/osu.Game.Modes.Osu/Objects/Drawables/Pieces/SliderBall.cs b/osu.Game.Modes.Osu/Objects/Drawables/Pieces/SliderBall.cs index 73a01dfce2..becbebf0c7 100644 --- a/osu.Game.Modes.Osu/Objects/Drawables/Pieces/SliderBall.cs +++ b/osu.Game.Modes.Osu/Objects/Drawables/Pieces/SliderBall.cs @@ -4,7 +4,6 @@ using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Sprites; -using osu.Framework.Graphics.Transforms; using osu.Framework.Input; using OpenTK.Graphics; diff --git a/osu.Game.Modes.Osu/OsuAutoReplay.cs b/osu.Game.Modes.Osu/OsuAutoReplay.cs index b3fece2b84..86985c834a 100644 --- a/osu.Game.Modes.Osu/OsuAutoReplay.cs +++ b/osu.Game.Modes.Osu/OsuAutoReplay.cs @@ -2,7 +2,6 @@ // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE using OpenTK; -using osu.Framework.Graphics.Transforms; using osu.Framework.MathUtils; using osu.Game.Beatmaps; using osu.Game.Modes.Osu.Objects; @@ -10,6 +9,7 @@ using osu.Game.Modes.Osu.Objects.Drawables; using System; using System.Collections.Generic; using System.Diagnostics; +using osu.Framework.Graphics; using osu.Game.Modes.Objects.Types; namespace osu.Game.Modes.Osu diff --git a/osu.Game.Modes.Taiko/Objects/Drawable/Pieces/CirclePiece.cs b/osu.Game.Modes.Taiko/Objects/Drawable/Pieces/CirclePiece.cs index 453ab7a05d..ec98feddae 100644 --- a/osu.Game.Modes.Taiko/Objects/Drawable/Pieces/CirclePiece.cs +++ b/osu.Game.Modes.Taiko/Objects/Drawable/Pieces/CirclePiece.cs @@ -20,6 +20,10 @@ namespace osu.Game.Modes.Taiko.Objects.Drawable.Pieces /// public class CirclePiece : Container { + public const float SYMBOL_SIZE = TaikoHitObject.CIRCLE_RADIUS * 2f * 0.45f; + public const float SYMBOL_BORDER = 8; + public const float SYMBOL_INNER_SIZE = SYMBOL_SIZE - 2 * SYMBOL_BORDER; + private Color4 accentColour; /// /// The colour of the inner circle and outer glows. diff --git a/osu.Game.Modes.Taiko/UI/HitExplosion.cs b/osu.Game.Modes.Taiko/UI/HitExplosion.cs index adc6a77c5d..94938a700d 100644 --- a/osu.Game.Modes.Taiko/UI/HitExplosion.cs +++ b/osu.Game.Modes.Taiko/UI/HitExplosion.cs @@ -7,7 +7,6 @@ using osu.Framework.Allocation; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Sprites; -using osu.Framework.Graphics.Transforms; using osu.Game.Graphics; using osu.Game.Modes.Taiko.Judgements; using osu.Game.Modes.Taiko.Objects; diff --git a/osu.Game.Modes.Taiko/UI/InputDrum.cs b/osu.Game.Modes.Taiko/UI/InputDrum.cs index 2e4c2232fa..a434a66ff9 100644 --- a/osu.Game.Modes.Taiko/UI/InputDrum.cs +++ b/osu.Game.Modes.Taiko/UI/InputDrum.cs @@ -9,7 +9,6 @@ using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Sprites; using osu.Framework.Graphics.Textures; -using osu.Framework.Graphics.Transforms; using osu.Framework.Input; using osu.Game.Graphics; diff --git a/osu.Game.Modes.Taiko/UI/TaikoPlayfield.cs b/osu.Game.Modes.Taiko/UI/TaikoPlayfield.cs index b7fac507d6..9bc75a55f5 100644 --- a/osu.Game.Modes.Taiko/UI/TaikoPlayfield.cs +++ b/osu.Game.Modes.Taiko/UI/TaikoPlayfield.cs @@ -26,6 +26,7 @@ namespace osu.Game.Modes.Taiko.UI /// /// The play field height scale. + /// This also uniformly scales the notes to match the new playfield height. /// public const float PLAYFIELD_SCALE = 0.65f; @@ -173,6 +174,7 @@ namespace osu.Game.Modes.Taiko.UI public override void Add(DrawableHitObject h) { h.Depth = (float)h.HitObject.StartTime; + h.Scale = new Vector2(PLAYFIELD_SCALE); base.Add(h); } diff --git a/osu.Game/Beatmaps/Drawables/BeatmapSetHeader.cs b/osu.Game/Beatmaps/Drawables/BeatmapSetHeader.cs index 2d032f0ea4..f8986b2ecd 100644 --- a/osu.Game/Beatmaps/Drawables/BeatmapSetHeader.cs +++ b/osu.Game/Beatmaps/Drawables/BeatmapSetHeader.cs @@ -33,12 +33,25 @@ namespace osu.Game.Beatmaps.Drawables Children = new Drawable[] { + new DelayedLoadContainer + { + RelativeSizeAxes = Axes.Both, + TimeBeforeLoad = 100, + Children = new[] + { + new PanelBackground(beatmap) + { + RelativeSizeAxes = Axes.Both, + Depth = 1, + } + } + }, new FillFlowContainer { Direction = FillDirection.Vertical, Padding = new MarginPadding { Top = 5, Left = 18, Right = 10, Bottom = 10 }, AutoSizeAxes = Axes.Both, - Children = new[] + Children = new Drawable[] { title = new OsuSpriteText { @@ -71,23 +84,13 @@ namespace osu.Game.Beatmaps.Drawables } [BackgroundDependencyLoader] - private void load(OsuConfigManager config, OsuGameBase game) + private void load(OsuConfigManager config) { this.config = config; preferUnicode = config.GetBindable(OsuConfig.ShowUnicode); preferUnicode.ValueChanged += preferUnicode_changed; preferUnicode_changed(preferUnicode, null); - - new PanelBackground(beatmap) - { - RelativeSizeAxes = Axes.Both, - Depth = 1, - }.LoadAsync(game, b => - { - Add(b); - b.FadeInFromZero(200); - }); } private void preferUnicode_changed(object sender, EventArgs e) diff --git a/osu.Game/Beatmaps/Drawables/Panel.cs b/osu.Game/Beatmaps/Drawables/Panel.cs index 2a5564bc71..f7349d981a 100644 --- a/osu.Game/Beatmaps/Drawables/Panel.cs +++ b/osu.Game/Beatmaps/Drawables/Panel.cs @@ -4,7 +4,6 @@ using osu.Framework; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; -using osu.Framework.Graphics.Transforms; using osu.Framework.Input; using OpenTK; using OpenTK.Graphics; diff --git a/osu.Game/Graphics/Containers/ParallaxContainer.cs b/osu.Game/Graphics/Containers/ParallaxContainer.cs index dc2f01a2bc..a143618807 100644 --- a/osu.Game/Graphics/Containers/ParallaxContainer.cs +++ b/osu.Game/Graphics/Containers/ParallaxContainer.cs @@ -6,7 +6,6 @@ using osu.Framework.Graphics; using osu.Framework.Input; using OpenTK; using osu.Framework.Allocation; -using osu.Framework.Graphics.Transforms; using osu.Game.Configuration; using osu.Framework.Configuration; diff --git a/osu.Game/Graphics/Cursor/GameplayCursor.cs b/osu.Game/Graphics/Cursor/GameplayCursor.cs index ed9d52d0b7..3f94bbaddc 100644 --- a/osu.Game/Graphics/Cursor/GameplayCursor.cs +++ b/osu.Game/Graphics/Cursor/GameplayCursor.cs @@ -10,7 +10,6 @@ using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Cursor; using osu.Framework.Graphics.Sprites; -using osu.Framework.Graphics.Transforms; using osu.Framework.Input; using osu.Game.Configuration; using System; diff --git a/osu.Game/Graphics/Cursor/MenuCursor.cs b/osu.Game/Graphics/Cursor/MenuCursor.cs index 39d0cf181c..67b17fae5c 100644 --- a/osu.Game/Graphics/Cursor/MenuCursor.cs +++ b/osu.Game/Graphics/Cursor/MenuCursor.cs @@ -12,7 +12,6 @@ using osu.Framework.Input; using osu.Game.Configuration; using System; using osu.Framework.Graphics.Textures; -using osu.Framework.Graphics.Transforms; namespace osu.Game.Graphics.Cursor { diff --git a/osu.Game/Graphics/UserInterface/DialogButton.cs b/osu.Game/Graphics/UserInterface/DialogButton.cs index 6015f56d6c..c935d58a4b 100644 --- a/osu.Game/Graphics/UserInterface/DialogButton.cs +++ b/osu.Game/Graphics/UserInterface/DialogButton.cs @@ -4,7 +4,6 @@ using OpenTK; using OpenTK.Graphics; using osu.Framework.Graphics; -using osu.Framework.Graphics.Transforms; using osu.Framework.Graphics.Colour; using osu.Framework.Graphics.Sprites; using osu.Framework.Graphics.Containers; diff --git a/osu.Game/Graphics/UserInterface/Nub.cs b/osu.Game/Graphics/UserInterface/Nub.cs index 71060fbd09..06e3be5c15 100644 --- a/osu.Game/Graphics/UserInterface/Nub.cs +++ b/osu.Game/Graphics/UserInterface/Nub.cs @@ -8,7 +8,6 @@ using osu.Framework.Allocation; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Sprites; -using osu.Framework.Graphics.Transforms; using osu.Framework.Graphics.UserInterface; namespace osu.Game.Graphics.UserInterface diff --git a/osu.Game/Graphics/UserInterface/OsuButton.cs b/osu.Game/Graphics/UserInterface/OsuButton.cs index b2da5d7b4b..bee12133ff 100644 --- a/osu.Game/Graphics/UserInterface/OsuButton.cs +++ b/osu.Game/Graphics/UserInterface/OsuButton.cs @@ -6,7 +6,6 @@ using osu.Framework.Allocation; using osu.Framework.Extensions.Color4Extensions; using osu.Framework.Graphics; using osu.Framework.Graphics.Sprites; -using osu.Framework.Graphics.Transforms; using osu.Framework.Graphics.UserInterface; using osu.Framework.Input; using osu.Game.Graphics.Backgrounds; diff --git a/osu.Game/Graphics/UserInterface/OsuMenu.cs b/osu.Game/Graphics/UserInterface/OsuMenu.cs index 95df3be9bf..c51c5d210e 100644 --- a/osu.Game/Graphics/UserInterface/OsuMenu.cs +++ b/osu.Game/Graphics/UserInterface/OsuMenu.cs @@ -6,7 +6,6 @@ using OpenTK.Graphics; using osu.Framework.Extensions.Color4Extensions; using osu.Framework.Graphics; using osu.Framework.Graphics.Primitives; -using osu.Framework.Graphics.Transforms; using osu.Framework.Graphics.UserInterface; namespace osu.Game.Graphics.UserInterface diff --git a/osu.Game/Graphics/UserInterface/OsuPasswordTextBox.cs b/osu.Game/Graphics/UserInterface/OsuPasswordTextBox.cs index d0072af0eb..904aa14aa7 100644 --- a/osu.Game/Graphics/UserInterface/OsuPasswordTextBox.cs +++ b/osu.Game/Graphics/UserInterface/OsuPasswordTextBox.cs @@ -4,7 +4,6 @@ using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Sprites; -using osu.Framework.Graphics.Transforms; using OpenTK; using OpenTK.Graphics; diff --git a/osu.Game/Graphics/UserInterface/OsuSliderBar.cs b/osu.Game/Graphics/UserInterface/OsuSliderBar.cs index 81a1b5ca1b..b7d46cd409 100644 --- a/osu.Game/Graphics/UserInterface/OsuSliderBar.cs +++ b/osu.Game/Graphics/UserInterface/OsuSliderBar.cs @@ -8,7 +8,6 @@ using osu.Framework.Audio; using osu.Framework.Audio.Sample; using osu.Framework.Graphics; using osu.Framework.Graphics.Sprites; -using osu.Framework.Graphics.Transforms; using osu.Framework.Graphics.UserInterface; using osu.Framework.Input; diff --git a/osu.Game/Graphics/UserInterface/OsuTabControl.cs b/osu.Game/Graphics/UserInterface/OsuTabControl.cs index 3e62780e5c..6d17d79ca1 100644 --- a/osu.Game/Graphics/UserInterface/OsuTabControl.cs +++ b/osu.Game/Graphics/UserInterface/OsuTabControl.cs @@ -11,7 +11,6 @@ using osu.Framework.Extensions.Color4Extensions; using osu.Framework.Graphics; using osu.Framework.Graphics.Primitives; using osu.Framework.Graphics.Sprites; -using osu.Framework.Graphics.Transforms; using osu.Framework.Graphics.UserInterface; using osu.Framework.Input; using osu.Game.Graphics.Sprites; diff --git a/osu.Game/Graphics/UserInterface/OsuTabControlCheckBox.cs b/osu.Game/Graphics/UserInterface/OsuTabControlCheckBox.cs index 7dc1212318..f9d14f3b09 100644 --- a/osu.Game/Graphics/UserInterface/OsuTabControlCheckBox.cs +++ b/osu.Game/Graphics/UserInterface/OsuTabControlCheckBox.cs @@ -9,7 +9,6 @@ using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Primitives; using osu.Framework.Graphics.Sprites; -using osu.Framework.Graphics.Transforms; using osu.Framework.Graphics.UserInterface; using osu.Framework.Input; using osu.Game.Graphics.Sprites; diff --git a/osu.Game/Graphics/UserInterface/StarCounter.cs b/osu.Game/Graphics/UserInterface/StarCounter.cs index c0d55fa608..c046749dad 100644 --- a/osu.Game/Graphics/UserInterface/StarCounter.cs +++ b/osu.Game/Graphics/UserInterface/StarCounter.cs @@ -4,7 +4,6 @@ using OpenTK; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; -using osu.Framework.Graphics.Transforms; using osu.Framework.MathUtils; using System; diff --git a/osu.Game/Graphics/UserInterface/Volume/VolumeMeter.cs b/osu.Game/Graphics/UserInterface/Volume/VolumeMeter.cs index 4d83805b83..fd1d890330 100644 --- a/osu.Game/Graphics/UserInterface/Volume/VolumeMeter.cs +++ b/osu.Game/Graphics/UserInterface/Volume/VolumeMeter.cs @@ -5,7 +5,6 @@ using osu.Framework.Configuration; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Sprites; -using osu.Framework.Graphics.Transforms; using osu.Framework.Input; using osu.Game.Graphics.Sprites; using OpenTK; diff --git a/osu.Game/Modes/Judgements/DrawableJudgement.cs b/osu.Game/Modes/Judgements/DrawableJudgement.cs index 76c73335dd..eabcb5c161 100644 --- a/osu.Game/Modes/Judgements/DrawableJudgement.cs +++ b/osu.Game/Modes/Judgements/DrawableJudgement.cs @@ -7,7 +7,6 @@ using osu.Framework.Extensions; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Sprites; -using osu.Framework.Graphics.Transforms; using osu.Game.Graphics; using osu.Game.Graphics.Sprites; using osu.Game.Modes.Objects.Drawables; diff --git a/osu.Game/Modes/UI/StandardHealthDisplay.cs b/osu.Game/Modes/UI/StandardHealthDisplay.cs index 58b44eabd3..d49e32ea8b 100644 --- a/osu.Game/Modes/UI/StandardHealthDisplay.cs +++ b/osu.Game/Modes/UI/StandardHealthDisplay.cs @@ -8,7 +8,6 @@ using osu.Framework.Extensions.Color4Extensions; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Sprites; -using osu.Framework.Graphics.Transforms; using osu.Game.Graphics; namespace osu.Game.Modes.UI diff --git a/osu.Game/Online/API/APIAccess.cs b/osu.Game/Online/API/APIAccess.cs index f39dec47e1..c4b679fc92 100644 --- a/osu.Game/Online/API/APIAccess.cs +++ b/osu.Game/Online/API/APIAccess.cs @@ -12,6 +12,7 @@ using osu.Framework.Configuration; using osu.Framework.Logging; using osu.Framework.Threading; using osu.Game.Online.API.Requests; +using osu.Game.Users; namespace osu.Game.Online.API { @@ -118,7 +119,7 @@ namespace osu.Game.Online.API //todo: this fails even on network-related issues. we should probably handle those differently. //NotificationManager.ShowMessage("Login failed!"); log.Add(@"Login failed!"); - clearCredentials(); + Password = null; continue; } diff --git a/osu.Game/Online/API/Requests/GetUserRequest.cs b/osu.Game/Online/API/Requests/GetUserRequest.cs index e396c56b53..2fd1ee5efc 100644 --- a/osu.Game/Online/API/Requests/GetUserRequest.cs +++ b/osu.Game/Online/API/Requests/GetUserRequest.cs @@ -1,6 +1,8 @@ // Copyright (c) 2007-2017 ppy Pty Ltd . // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE +using osu.Game.Users; + namespace osu.Game.Online.API.Requests { public class GetUserRequest : APIRequest diff --git a/osu.Game/Online/Chat/Drawables/ChatLine.cs b/osu.Game/Online/Chat/Drawables/ChatLine.cs index 9f78be92d1..bfbcf3d707 100644 --- a/osu.Game/Online/Chat/Drawables/ChatLine.cs +++ b/osu.Game/Online/Chat/Drawables/ChatLine.cs @@ -91,7 +91,7 @@ namespace osu.Game.Online.Chat.Drawables new OsuSpriteText { Font = @"Exo2.0-BoldItalic", - Text = $@"{Message.User.Name}:", + Text = $@"{Message.User.Username}:", Colour = getUsernameColour(Message), TextSize = text_size, Origin = Anchor.TopRight, diff --git a/osu.Game/Online/Chat/Message.cs b/osu.Game/Online/Chat/Message.cs index 3081653c34..b267cf63ac 100644 --- a/osu.Game/Online/Chat/Message.cs +++ b/osu.Game/Online/Chat/Message.cs @@ -3,6 +3,7 @@ using System; using Newtonsoft.Json; +using osu.Game.Users; namespace osu.Game.Online.Chat { diff --git a/osu.Game/Online/User.cs b/osu.Game/Online/User.cs deleted file mode 100644 index 0059f940a5..0000000000 --- a/osu.Game/Online/User.cs +++ /dev/null @@ -1,19 +0,0 @@ -// Copyright (c) 2007-2017 ppy Pty Ltd . -// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE - -using Newtonsoft.Json; - -namespace osu.Game.Online -{ - public class User - { - [JsonProperty(@"username")] - public string Name; - - [JsonProperty(@"id")] - public int Id; - - [JsonProperty(@"colour")] - public string Colour; - } -} diff --git a/osu.Game/OsuGame.cs b/osu.Game/OsuGame.cs index e6abdab729..fdcc250d0f 100644 --- a/osu.Game/OsuGame.cs +++ b/osu.Game/OsuGame.cs @@ -14,7 +14,6 @@ using OpenTK.Input; using osu.Framework.Logging; using osu.Game.Graphics.UserInterface.Volume; using osu.Framework.Allocation; -using osu.Framework.Graphics.Transforms; using osu.Framework.Timing; using osu.Game.Modes; using osu.Game.Overlays.Toolbar; diff --git a/osu.Game/Overlays/ChatOverlay.cs b/osu.Game/Overlays/ChatOverlay.cs index 73ecf20891..0bb3d3dc71 100644 --- a/osu.Game/Overlays/ChatOverlay.cs +++ b/osu.Game/Overlays/ChatOverlay.cs @@ -10,7 +10,6 @@ using osu.Framework.Allocation; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Sprites; -using osu.Framework.Graphics.Transforms; using osu.Framework.Threading; using osu.Game.Graphics.Sprites; using osu.Game.Online.API; diff --git a/osu.Game/Overlays/Dialog/PopupDialog.cs b/osu.Game/Overlays/Dialog/PopupDialog.cs index bbac5ca786..b4127c8af4 100644 --- a/osu.Game/Overlays/Dialog/PopupDialog.cs +++ b/osu.Game/Overlays/Dialog/PopupDialog.cs @@ -8,7 +8,6 @@ using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Primitives; using osu.Framework.Graphics.Sprites; -using osu.Framework.Graphics.Transforms; using osu.Framework.Input; using osu.Game.Graphics; using osu.Game.Graphics.Backgrounds; diff --git a/osu.Game/Overlays/DialogOverlay.cs b/osu.Game/Overlays/DialogOverlay.cs index 1769702c40..9454272728 100644 --- a/osu.Game/Overlays/DialogOverlay.cs +++ b/osu.Game/Overlays/DialogOverlay.cs @@ -5,7 +5,6 @@ using osu.Framework.Extensions.Color4Extensions; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Sprites; -using osu.Framework.Graphics.Transforms; using osu.Game.Overlays.Dialog; using OpenTK.Graphics; diff --git a/osu.Game/Overlays/LoginOverlay.cs b/osu.Game/Overlays/LoginOverlay.cs index fec1c5ec6e..694eba2c41 100644 --- a/osu.Game/Overlays/LoginOverlay.cs +++ b/osu.Game/Overlays/LoginOverlay.cs @@ -6,7 +6,6 @@ using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Primitives; using osu.Framework.Graphics.Sprites; -using osu.Framework.Graphics.Transforms; using osu.Game.Graphics; using osu.Game.Overlays.Options.Sections.General; using OpenTK.Graphics; @@ -67,6 +66,8 @@ namespace osu.Game.Overlays optionsSection.Bounding = true; FadeIn(transition_time, EasingTypes.OutQuint); + + optionsSection.TriggerFocus(); } protected override void PopOut() diff --git a/osu.Game/Overlays/Mods/ModButton.cs b/osu.Game/Overlays/Mods/ModButton.cs index cd045aae41..b787935d57 100644 --- a/osu.Game/Overlays/Mods/ModButton.cs +++ b/osu.Game/Overlays/Mods/ModButton.cs @@ -10,7 +10,6 @@ using osu.Framework.Audio.Sample; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Sprites; -using osu.Framework.Graphics.Transforms; using osu.Framework.Input; using osu.Game.Graphics.Sprites; using osu.Game.Modes.Mods; diff --git a/osu.Game/Overlays/Mods/ModSelectOverlay.cs b/osu.Game/Overlays/Mods/ModSelectOverlay.cs index d4ceb29c23..0272438927 100644 --- a/osu.Game/Overlays/Mods/ModSelectOverlay.cs +++ b/osu.Game/Overlays/Mods/ModSelectOverlay.cs @@ -10,7 +10,6 @@ using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Primitives; using osu.Framework.Graphics.Sprites; -using osu.Framework.Graphics.Transforms; using osu.Game.Graphics; using osu.Game.Graphics.Backgrounds; using osu.Game.Graphics.Sprites; diff --git a/osu.Game/Overlays/MusicController.cs b/osu.Game/Overlays/MusicController.cs index a45dcaacb8..2f8f0ab650 100644 --- a/osu.Game/Overlays/MusicController.cs +++ b/osu.Game/Overlays/MusicController.cs @@ -14,7 +14,6 @@ using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Sprites; using osu.Framework.Graphics.Textures; -using osu.Framework.Graphics.Transforms; using osu.Framework.Input; using osu.Framework.MathUtils; using osu.Game.Beatmaps; @@ -29,7 +28,7 @@ namespace osu.Game.Overlays { public class MusicController : FocusedOverlayContainer { - private MusicControllerBackground backgroundSprite; + private Drawable currentBackground; private DragBar progress; private TextAwesome playButton; private SpriteText title, artist; @@ -44,7 +43,6 @@ namespace osu.Game.Overlays private Bindable preferUnicode; private WorkingBeatmap current; private BeatmapDatabase beatmaps; - private Framework.Game game; private Container dragContainer; @@ -78,10 +76,8 @@ namespace osu.Game.Overlays } [BackgroundDependencyLoader] - private void load(OsuGameBase osuGame, OsuConfigManager config, BeatmapDatabase beatmaps, OsuColour colours) + private void load(OsuGameBase game, OsuConfigManager config, BeatmapDatabase beatmaps, OsuColour colours) { - game = osuGame; - unicodeString = config.GetUnicodeString; Children = new Drawable[] @@ -212,15 +208,15 @@ namespace osu.Game.Overlays }; this.beatmaps = beatmaps; - trackManager = osuGame.Audio.Track; + trackManager = game.Audio.Track; preferUnicode = config.GetBindable(OsuConfig.ShowUnicode); preferUnicode.ValueChanged += preferUnicode_changed; - beatmapSource = osuGame.Beatmap ?? new Bindable(); + beatmapSource = game.Beatmap ?? new Bindable(); playList = beatmaps.GetAllWithChildren(); - backgroundSprite = new MusicControllerBackground(); - dragContainer.Add(backgroundSprite); + currentBackground = new MusicControllerBackground(); + dragContainer.Add(currentBackground); } protected override void LoadComplete() @@ -351,29 +347,29 @@ namespace osu.Game.Overlays } }); - MusicControllerBackground newBackground; - - (newBackground = new MusicControllerBackground(beatmap)).LoadAsync(game, delegate + dragContainer.Add(new AsyncLoadContainer { - - dragContainer.Add(newBackground); - - switch (direction) + RelativeSizeAxes = Axes.Both, + Depth = float.MaxValue, + Children = new[] { new MusicControllerBackground(beatmap) }, + FinishedLoading = d => { - case TransformDirection.Next: - newBackground.Position = new Vector2(400, 0); - newBackground.MoveToX(0, 500, EasingTypes.OutCubic); - backgroundSprite.MoveToX(-400, 500, EasingTypes.OutCubic); - break; - case TransformDirection.Prev: - newBackground.Position = new Vector2(-400, 0); - newBackground.MoveToX(0, 500, EasingTypes.OutCubic); - backgroundSprite.MoveToX(400, 500, EasingTypes.OutCubic); - break; + switch (direction) + { + case TransformDirection.Next: + d.Position = new Vector2(400, 0); + d.MoveToX(0, 500, EasingTypes.OutCubic); + currentBackground.MoveToX(-400, 500, EasingTypes.OutCubic); + break; + case TransformDirection.Prev: + d.Position = new Vector2(-400, 0); + d.MoveToX(0, 500, EasingTypes.OutCubic); + currentBackground.MoveToX(400, 500, EasingTypes.OutCubic); + break; + } + currentBackground.Expire(); + currentBackground = d; } - - backgroundSprite.Expire(); - backgroundSprite = newBackground; }); }; } @@ -422,8 +418,8 @@ namespace osu.Game.Overlays { this.beatmap = beatmap; CacheDrawnFrameBuffer = true; - RelativeSizeAxes = Axes.Both; Depth = float.MaxValue; + RelativeSizeAxes = Axes.Both; Children = new Drawable[] { diff --git a/osu.Game/Overlays/NotificationManager.cs b/osu.Game/Overlays/NotificationManager.cs index 8f455d44e7..264543367c 100644 --- a/osu.Game/Overlays/NotificationManager.cs +++ b/osu.Game/Overlays/NotificationManager.cs @@ -8,7 +8,6 @@ using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Primitives; using osu.Framework.Graphics.Sprites; -using osu.Framework.Graphics.Transforms; using osu.Game.Overlays.Notifications; using OpenTK.Graphics; diff --git a/osu.Game/Overlays/Notifications/NotificationSection.cs b/osu.Game/Overlays/Notifications/NotificationSection.cs index ee74c5e2cb..77fc010e6d 100644 --- a/osu.Game/Overlays/Notifications/NotificationSection.cs +++ b/osu.Game/Overlays/Notifications/NotificationSection.cs @@ -9,7 +9,6 @@ using osu.Framework.Extensions.IEnumerableExtensions; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Primitives; -using osu.Framework.Graphics.Transforms; using osu.Game.Graphics; using osu.Game.Graphics.Sprites; using OpenTK; diff --git a/osu.Game/Overlays/Notifications/ProgressNotification.cs b/osu.Game/Overlays/Notifications/ProgressNotification.cs index 5179e85df1..f689a7c9e7 100644 --- a/osu.Game/Overlays/Notifications/ProgressNotification.cs +++ b/osu.Game/Overlays/Notifications/ProgressNotification.cs @@ -6,7 +6,6 @@ using osu.Framework.Allocation; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Sprites; -using osu.Framework.Graphics.Transforms; using osu.Game.Graphics; using osu.Game.Graphics.Sprites; using OpenTK; diff --git a/osu.Game/Overlays/Options/Sections/General/LoginOptions.cs b/osu.Game/Overlays/Options/Sections/General/LoginOptions.cs index f95d3a026e..a5e38dd284 100644 --- a/osu.Game/Overlays/Options/Sections/General/LoginOptions.cs +++ b/osu.Game/Overlays/Options/Sections/General/LoginOptions.cs @@ -11,12 +11,14 @@ using osu.Game.Graphics.Sprites; using osu.Game.Graphics.UserInterface; using osu.Game.Online.API; using OpenTK; +using osu.Framework.Input; namespace osu.Game.Overlays.Options.Sections.General { public class LoginOptions : OptionsSubsection, IOnlineComponent { private bool bounding = true; + private LoginForm form; protected override string Header => "Account"; @@ -40,12 +42,14 @@ namespace osu.Game.Overlays.Options.Sections.General public void APIStateChanged(APIAccess api, APIState state) { + form = null; + switch (state) { case APIState.Offline: Children = new Drawable[] { - new LoginForm() + form = new LoginForm() }; break; case APIState.Failing: @@ -82,6 +86,14 @@ namespace osu.Game.Overlays.Options.Sections.General }; break; } + + form?.TriggerFocus(); + } + + protected override bool OnFocus(InputState state) + { + form?.TriggerFocus(); + return base.OnFocus(state); } private class LoginForm : FillFlowContainer @@ -144,6 +156,19 @@ namespace osu.Game.Overlays.Options.Sections.General } }; } + + protected override bool OnFocus(InputState state) + { + Schedule(() => + { + if (string.IsNullOrEmpty(username.Text)) + username.TriggerFocus(); + else + password.TriggerFocus(); + }); + + return base.OnFocus(state); + } } } } diff --git a/osu.Game/Overlays/Options/Sidebar.cs b/osu.Game/Overlays/Options/Sidebar.cs index e66c6de742..5d0eac1cc1 100644 --- a/osu.Game/Overlays/Options/Sidebar.cs +++ b/osu.Game/Overlays/Options/Sidebar.cs @@ -6,7 +6,6 @@ using OpenTK.Graphics; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Sprites; -using osu.Framework.Graphics.Transforms; using osu.Framework.Input; using osu.Framework.Threading; using osu.Game.Overlays.Toolbar; diff --git a/osu.Game/Overlays/OptionsOverlay.cs b/osu.Game/Overlays/OptionsOverlay.cs index 53d8cb3593..ee20cea969 100644 --- a/osu.Game/Overlays/OptionsOverlay.cs +++ b/osu.Game/Overlays/OptionsOverlay.cs @@ -8,7 +8,6 @@ using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Primitives; using osu.Framework.Graphics.Sprites; -using osu.Framework.Graphics.Transforms; using osu.Game.Overlays.Options; using System; using osu.Game.Graphics; diff --git a/osu.Game/Overlays/Toolbar/Toolbar.cs b/osu.Game/Overlays/Toolbar/Toolbar.cs index ff1e37aafb..9e7b4f1519 100644 --- a/osu.Game/Overlays/Toolbar/Toolbar.cs +++ b/osu.Game/Overlays/Toolbar/Toolbar.cs @@ -7,7 +7,6 @@ using osu.Framework.Graphics; using osu.Framework.Graphics.Colour; using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Sprites; -using osu.Framework.Graphics.Transforms; using osu.Framework.Input; using osu.Game.Graphics; using osu.Game.Modes; diff --git a/osu.Game/Overlays/Toolbar/ToolbarButton.cs b/osu.Game/Overlays/Toolbar/ToolbarButton.cs index fa1e1abf2a..6be63b1fe8 100644 --- a/osu.Game/Overlays/Toolbar/ToolbarButton.cs +++ b/osu.Game/Overlays/Toolbar/ToolbarButton.cs @@ -10,7 +10,6 @@ using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Primitives; using osu.Framework.Graphics.Sprites; -using osu.Framework.Graphics.Transforms; using osu.Framework.Input; using osu.Game.Graphics; using osu.Game.Graphics.Backgrounds; diff --git a/osu.Game/Overlays/Toolbar/ToolbarModeSelector.cs b/osu.Game/Overlays/Toolbar/ToolbarModeSelector.cs index a6df237f20..be28857de6 100644 --- a/osu.Game/Overlays/Toolbar/ToolbarModeSelector.cs +++ b/osu.Game/Overlays/Toolbar/ToolbarModeSelector.cs @@ -8,7 +8,6 @@ using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Primitives; using osu.Framework.Graphics.Sprites; -using osu.Framework.Graphics.Transforms; using osu.Game.Modes; using OpenTK; using OpenTK.Graphics; diff --git a/osu.Game/Overlays/Toolbar/ToolbarUserButton.cs b/osu.Game/Overlays/Toolbar/ToolbarUserButton.cs index 7e266a2b43..4e59f87bee 100644 --- a/osu.Game/Overlays/Toolbar/ToolbarUserButton.cs +++ b/osu.Game/Overlays/Toolbar/ToolbarUserButton.cs @@ -14,7 +14,7 @@ namespace osu.Game.Overlays.Toolbar { internal class ToolbarUserButton : ToolbarButton, IOnlineComponent { - private readonly Avatar avatar; + private readonly UpdateableAvatar avatar; public ToolbarUserButton() { @@ -24,7 +24,7 @@ namespace osu.Game.Overlays.Toolbar Add(new OpaqueBackground { Depth = 1 }); - Flow.Add(avatar = new Avatar + Flow.Add(avatar = new UpdateableAvatar { Masking = true, Size = new Vector2(32), @@ -52,11 +52,11 @@ namespace osu.Game.Overlays.Toolbar { default: Text = @"Guest"; - avatar.UserId = 1; + avatar.User = new User(); break; case APIState.Online: Text = api.Username; - avatar.UserId = api.LocalUser.Value.Id; + avatar.User = api.LocalUser; break; } } diff --git a/osu.Game/Overlays/WaveOverlayContainer.cs b/osu.Game/Overlays/WaveOverlayContainer.cs index 07b76c188d..7c68b0ad83 100644 --- a/osu.Game/Overlays/WaveOverlayContainer.cs +++ b/osu.Game/Overlays/WaveOverlayContainer.cs @@ -7,7 +7,6 @@ using osu.Framework.Extensions.Color4Extensions; using osu.Framework.Graphics.Containers; using osu.Framework.Graphics; using osu.Framework.Graphics.Sprites; -using osu.Framework.Graphics.Transforms; using System; namespace osu.Game.Overlays diff --git a/osu.Game/Screens/BackgroundScreen.cs b/osu.Game/Screens/BackgroundScreen.cs index dd41294598..317199c6a9 100644 --- a/osu.Game/Screens/BackgroundScreen.cs +++ b/osu.Game/Screens/BackgroundScreen.cs @@ -6,7 +6,6 @@ using System.Threading; using osu.Framework.Allocation; using osu.Framework.Screens; using osu.Framework.Graphics; -using osu.Framework.Graphics.Transforms; using osu.Framework.Input; using OpenTK; diff --git a/osu.Game/Screens/Backgrounds/BackgroundScreenBeatmap.cs b/osu.Game/Screens/Backgrounds/BackgroundScreenBeatmap.cs index 81319553ba..6baccdf9c9 100644 --- a/osu.Game/Screens/Backgrounds/BackgroundScreenBeatmap.cs +++ b/osu.Game/Screens/Backgrounds/BackgroundScreenBeatmap.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.Graphics; using OpenTK; -using osu.Framework.Graphics.Transforms; using osu.Game.Beatmaps; using osu.Game.Graphics.Backgrounds; diff --git a/osu.Game/Screens/GameScreenWhiteBox.cs b/osu.Game/Screens/GameScreenWhiteBox.cs index 60e8edb6e1..bebdbb8c2a 100644 --- a/osu.Game/Screens/GameScreenWhiteBox.cs +++ b/osu.Game/Screens/GameScreenWhiteBox.cs @@ -7,7 +7,6 @@ using osu.Framework.Screens; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Sprites; -using osu.Framework.Graphics.Transforms; using osu.Framework.Graphics.UserInterface; using osu.Game.Graphics.Sprites; using osu.Game.Screens.Backgrounds; diff --git a/osu.Game/Screens/Menu/ButtonSystem.cs b/osu.Game/Screens/Menu/ButtonSystem.cs index ac7e419765..b0d12cb5a1 100644 --- a/osu.Game/Screens/Menu/ButtonSystem.cs +++ b/osu.Game/Screens/Menu/ButtonSystem.cs @@ -9,7 +9,6 @@ using osu.Framework.Allocation; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Sprites; -using osu.Framework.Graphics.Transforms; using osu.Framework.Input; using osu.Game.Graphics; using osu.Game.Overlays.Toolbar; diff --git a/osu.Game/Screens/Menu/Intro.cs b/osu.Game/Screens/Menu/Intro.cs index 8ad169a2b0..890b3f6970 100644 --- a/osu.Game/Screens/Menu/Intro.cs +++ b/osu.Game/Screens/Menu/Intro.cs @@ -7,7 +7,6 @@ using osu.Framework.Audio.Sample; using osu.Framework.Audio.Track; using osu.Framework.Screens; using osu.Framework.Graphics; -using osu.Framework.Graphics.Transforms; using osu.Game.Graphics.Containers; using osu.Game.Screens.Backgrounds; using OpenTK.Graphics; diff --git a/osu.Game/Screens/Menu/MainMenu.cs b/osu.Game/Screens/Menu/MainMenu.cs index 001c4df6d7..5f902ffa63 100644 --- a/osu.Game/Screens/Menu/MainMenu.cs +++ b/osu.Game/Screens/Menu/MainMenu.cs @@ -2,10 +2,8 @@ // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE using osu.Framework.Allocation; -using osu.Framework.Screens; -using osu.Framework.Screens.Testing; using osu.Framework.Graphics; -using osu.Framework.Graphics.Transforms; +using osu.Framework.Screens; using osu.Game.Graphics.Containers; using osu.Game.Screens.Backgrounds; using osu.Game.Screens.Charts; @@ -16,6 +14,7 @@ using OpenTK; using osu.Game.Screens.Select; using osu.Game.Screens.Tournament; using osu.Framework.Input; +using osu.Framework.Screens.Testing; using OpenTK.Input; namespace osu.Game.Screens.Menu diff --git a/osu.Game/Screens/Menu/OsuLogo.cs b/osu.Game/Screens/Menu/OsuLogo.cs index c777fda537..e5fb1db38e 100644 --- a/osu.Game/Screens/Menu/OsuLogo.cs +++ b/osu.Game/Screens/Menu/OsuLogo.cs @@ -9,7 +9,6 @@ using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Sprites; using osu.Framework.Graphics.Textures; -using osu.Framework.Graphics.Transforms; using osu.Framework.Input; using osu.Game.Graphics; using osu.Game.Graphics.Backgrounds; diff --git a/osu.Game/Screens/Play/PauseOverlay.cs b/osu.Game/Screens/Play/PauseOverlay.cs index 1cc6f9cf02..ae6b12e319 100644 --- a/osu.Game/Screens/Play/PauseOverlay.cs +++ b/osu.Game/Screens/Play/PauseOverlay.cs @@ -7,7 +7,6 @@ using osu.Framework.Extensions.Color4Extensions; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Sprites; -using osu.Framework.Graphics.Transforms; using osu.Framework.Input; using osu.Game.Graphics; using osu.Game.Graphics.Sprites; diff --git a/osu.Game/Screens/Play/Player.cs b/osu.Game/Screens/Play/Player.cs index 702f907428..0554c0e77b 100644 --- a/osu.Game/Screens/Play/Player.cs +++ b/osu.Game/Screens/Play/Player.cs @@ -9,7 +9,6 @@ using osu.Framework.Audio.Track; using osu.Framework.Configuration; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; -using osu.Framework.Graphics.Transforms; using osu.Framework.Input; using osu.Framework.Logging; using osu.Framework.Screens; diff --git a/osu.Game/Screens/Play/PlayerLoader.cs b/osu.Game/Screens/Play/PlayerLoader.cs index 7a042b0860..d766777697 100644 --- a/osu.Game/Screens/Play/PlayerLoader.cs +++ b/osu.Game/Screens/Play/PlayerLoader.cs @@ -6,7 +6,6 @@ using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Primitives; using osu.Framework.Graphics.Sprites; -using osu.Framework.Graphics.Transforms; using osu.Framework.Screens; using osu.Game.Beatmaps; using osu.Game.Database; diff --git a/osu.Game/Screens/Ranking/Results.cs b/osu.Game/Screens/Ranking/Results.cs index daf0866d10..37770bea3e 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.Transforms; using osu.Game.Graphics.Sprites; using osu.Game.Modes.Scoring; using osu.Game.Screens.Backgrounds; diff --git a/osu.Game/Screens/Select/BeatmapCarousel.cs b/osu.Game/Screens/Select/BeatmapCarousel.cs index 08c9d1089c..e947d12f22 100644 --- a/osu.Game/Screens/Select/BeatmapCarousel.cs +++ b/osu.Game/Screens/Select/BeatmapCarousel.cs @@ -4,7 +4,6 @@ using OpenTK; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; -using osu.Framework.Graphics.Transforms; using osu.Game.Database; using System; using System.Collections.Generic; diff --git a/osu.Game/Screens/Select/BeatmapInfoWedge.cs b/osu.Game/Screens/Select/BeatmapInfoWedge.cs index d0805c19bd..3cbf743c15 100644 --- a/osu.Game/Screens/Select/BeatmapInfoWedge.cs +++ b/osu.Game/Screens/Select/BeatmapInfoWedge.cs @@ -6,14 +6,12 @@ using System.Collections.Generic; using System.Linq; using OpenTK; using OpenTK.Graphics; -using osu.Framework.Allocation; using osu.Framework.Extensions.Color4Extensions; using osu.Framework.Graphics; using osu.Framework.Graphics.Colour; using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Primitives; using osu.Framework.Graphics.Sprites; -using osu.Framework.Graphics.Transforms; using osu.Framework.MathUtils; using osu.Game.Beatmaps; using osu.Game.Beatmaps.Drawables; @@ -30,9 +28,7 @@ namespace osu.Game.Screens.Select { private static readonly Vector2 wedged_container_shear = new Vector2(0.15f, 0); - private BufferedContainer beatmapInfoContainer; - - private OsuGameBase game; + private Drawable beatmapInfoContainer; public BeatmapInfoWedge() { @@ -49,12 +45,6 @@ namespace osu.Game.Screens.Select }; } - [BackgroundDependencyLoader] - private void load(OsuGameBase game) - { - this.game = game; - } - protected override bool HideOnEscape => false; protected override void PopIn() @@ -113,105 +103,111 @@ namespace osu.Game.Screens.Select labels.AddRange(Ruleset.GetRuleset(beatmap.BeatmapInfo.Mode).GetBeatmapStatistics(beatmap).Select(s => new InfoLabel(s))); } - (beatmapInfoContainer = new BufferedContainer + Add(beatmapInfoContainer = new AsyncLoadContainer { - Depth = newDepth, - PixelSnapping = true, - CacheDrawnFrameBuffer = true, - Shear = -Shear, - RelativeSizeAxes = Axes.Both, - Children = new Drawable[] + FinishedLoading = d => { - // We will create the white-to-black gradient by modulating transparency and having - // a black backdrop. This results in an sRGB-space gradient and not linear space, - // transitioning from white to black more perceptually uniformly. - new Box + FadeIn(250); + + lastContainer?.FadeOut(250); + lastContainer?.Expire(); + }, + Depth = newDepth, + RelativeSizeAxes = Axes.Both, + Children = new[] + { + new BufferedContainer { + PixelSnapping = true, + CacheDrawnFrameBuffer = true, + Shear = -Shear, RelativeSizeAxes = Axes.Both, - Colour = Color4.Black, - }, - // We use a container, such that we can set the colour gradient to go across the - // vertices of the masked container instead of the vertices of the (larger) sprite. - new Container - { - RelativeSizeAxes = Axes.Both, - ColourInfo = ColourInfo.GradientVertical(Color4.White, Color4.White.Opacity(0.3f)), - Children = new [] - { - // Zoomed-in and cropped beatmap background - new BeatmapBackgroundSprite(beatmap) - { - Anchor = Anchor.Centre, - Origin = Anchor.Centre, - FillMode = FillMode.Fill, - }, - }, - }, - // Text for beatmap info - new FillFlowContainer - { - Anchor = Anchor.BottomLeft, - Origin = Anchor.BottomLeft, - Direction = FillDirection.Vertical, - Margin = new MarginPadding { Top = 10, Left = 25, Right = 10, Bottom = 20 }, - AutoSizeAxes = Axes.Both, Children = new Drawable[] { - new OsuSpriteText + // We will create the white-to-black gradient by modulating transparency and having + // a black backdrop. This results in an sRGB-space gradient and not linear space, + // transitioning from white to black more perceptually uniformly. + new Box { - Font = @"Exo2.0-MediumItalic", - Text = metadata.Artist + " -- " + metadata.Title, - TextSize = 28, - Shadow = true, + RelativeSizeAxes = Axes.Both, + Colour = Color4.Black, }, - new OsuSpriteText + // We use a container, such that we can set the colour gradient to go across the + // vertices of the masked container instead of the vertices of the (larger) sprite. + new Container { - Font = @"Exo2.0-MediumItalic", - Text = beatmapInfo.Version, - TextSize = 17, - Shadow = true, + RelativeSizeAxes = Axes.Both, + ColourInfo = ColourInfo.GradientVertical(Color4.White, Color4.White.Opacity(0.3f)), + Children = new[] + { + // Zoomed-in and cropped beatmap background + new BeatmapBackgroundSprite(beatmap) + { + Anchor = Anchor.Centre, + Origin = Anchor.Centre, + FillMode = FillMode.Fill, + }, + }, }, + // Text for beatmap info new FillFlowContainer { - Margin = new MarginPadding { Top = 10 }, - Direction = FillDirection.Horizontal, + Anchor = Anchor.BottomLeft, + Origin = Anchor.BottomLeft, + Direction = FillDirection.Vertical, + Margin = new MarginPadding { Top = 10, Left = 25, Right = 10, Bottom = 20 }, AutoSizeAxes = Axes.Both, - Children = new [] + Children = new Drawable[] { new OsuSpriteText { - Font = @"Exo2.0-Medium", - Text = "mapped by ", - TextSize = 15, + Font = @"Exo2.0-MediumItalic", + Text = metadata.Artist + " -- " + metadata.Title, + TextSize = 28, Shadow = true, }, new OsuSpriteText { - Font = @"Exo2.0-Bold", - Text = metadata.Author, - TextSize = 15, + Font = @"Exo2.0-MediumItalic", + Text = beatmapInfo.Version, + TextSize = 17, Shadow = true, }, + new FillFlowContainer + { + Margin = new MarginPadding { Top = 10 }, + Direction = FillDirection.Horizontal, + AutoSizeAxes = Axes.Both, + Children = new[] + { + new OsuSpriteText + { + Font = @"Exo2.0-Medium", + Text = "mapped by ", + TextSize = 15, + Shadow = true, + }, + new OsuSpriteText + { + Font = @"Exo2.0-Bold", + Text = metadata.Author, + TextSize = 15, + Shadow = true, + }, + } + }, + new FillFlowContainer + { + Margin = new MarginPadding { Top = 20 }, + Spacing = new Vector2(40, 0), + AutoSizeAxes = Axes.Both, + Children = labels + }, } }, - new FillFlowContainer - { - Margin = new MarginPadding { Top = 20 }, - Spacing = new Vector2(40, 0), - AutoSizeAxes = Axes.Both, - Children = labels - }, } - }, + } } - }).LoadAsync(game, delegate (Drawable d) - { - FadeIn(250); - - lastContainer?.FadeOut(250); - lastContainer?.Expire(); - - Add(d); }); } diff --git a/osu.Game/Screens/Select/Footer.cs b/osu.Game/Screens/Select/Footer.cs index c86ea2f30e..6863f209e6 100644 --- a/osu.Game/Screens/Select/Footer.cs +++ b/osu.Game/Screens/Select/Footer.cs @@ -9,7 +9,6 @@ using osu.Framework.Extensions.Color4Extensions; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Sprites; -using osu.Framework.Graphics.Transforms; using osu.Game.Graphics.UserInterface; using osu.Game.Screens.Menu; diff --git a/osu.Game/Screens/Select/FooterButton.cs b/osu.Game/Screens/Select/FooterButton.cs index 45a95ed1eb..58df409ca1 100644 --- a/osu.Game/Screens/Select/FooterButton.cs +++ b/osu.Game/Screens/Select/FooterButton.cs @@ -8,7 +8,6 @@ using OpenTK.Input; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Sprites; -using osu.Framework.Graphics.Transforms; using osu.Framework.Input; using osu.Game.Graphics.Sprites; diff --git a/osu.Game/Screens/Select/Leaderboards/LeaderboardScore.cs b/osu.Game/Screens/Select/Leaderboards/LeaderboardScore.cs index 1df6d2b55c..9a169b1f10 100644 --- a/osu.Game/Screens/Select/Leaderboards/LeaderboardScore.cs +++ b/osu.Game/Screens/Select/Leaderboards/LeaderboardScore.cs @@ -7,7 +7,6 @@ using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Primitives; using osu.Framework.Graphics.Sprites; -using osu.Framework.Graphics.Transforms; using osu.Game.Graphics; using osu.Game.Graphics.Sprites; using osu.Framework.Extensions.Color4Extensions; @@ -142,18 +141,26 @@ namespace osu.Game.Screens.Select.Leaderboards Padding = new MarginPadding(edge_margin), Children = new Drawable[] { - avatar = new Avatar + avatar = new DelayedLoadContainer { + TimeBeforeLoad = 500, + FinishedLoading = d => d.FadeInFromZero(200), Size = new Vector2(HEIGHT - edge_margin * 2, HEIGHT - edge_margin * 2), - CornerRadius = corner_radius, - Masking = true, - EdgeEffect = new EdgeEffect + Children = new Drawable[] { - Type = EdgeEffectType.Shadow, - Radius = 1, - Colour = Color4.Black.Opacity(0.2f), - }, - UserId = Score.User?.Id ?? Score.UserID, + new Avatar(Score.User ?? new User { Id = Score.UserID }) + { + RelativeSizeAxes = Axes.Both, + CornerRadius = corner_radius, + Masking = true, + EdgeEffect = new EdgeEffect + { + Type = EdgeEffectType.Shadow, + Radius = 1, + Colour = Color4.Black.Opacity(0.2f), + }, + }, + } }, new Container { diff --git a/osu.Game/Screens/Select/Options/BeatmapOptionsButton.cs b/osu.Game/Screens/Select/Options/BeatmapOptionsButton.cs index 6d4b37ebc6..965ea12fe2 100644 --- a/osu.Game/Screens/Select/Options/BeatmapOptionsButton.cs +++ b/osu.Game/Screens/Select/Options/BeatmapOptionsButton.cs @@ -9,7 +9,6 @@ using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Primitives; using osu.Framework.Graphics.Sprites; -using osu.Framework.Graphics.Transforms; using osu.Framework.Input; using osu.Game.Graphics; using osu.Game.Graphics.Sprites; diff --git a/osu.Game/Screens/Select/Options/BeatmapOptionsOverlay.cs b/osu.Game/Screens/Select/Options/BeatmapOptionsOverlay.cs index dd6ce2d28f..77001950f6 100644 --- a/osu.Game/Screens/Select/Options/BeatmapOptionsOverlay.cs +++ b/osu.Game/Screens/Select/Options/BeatmapOptionsOverlay.cs @@ -11,7 +11,6 @@ using osu.Framework.Extensions.Color4Extensions; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Sprites; -using osu.Framework.Graphics.Transforms; using osu.Game.Graphics; namespace osu.Game.Screens.Select.Options diff --git a/osu.Game/Screens/Select/SongSelect.cs b/osu.Game/Screens/Select/SongSelect.cs index 49762331c4..6eb26d22cb 100644 --- a/osu.Game/Screens/Select/SongSelect.cs +++ b/osu.Game/Screens/Select/SongSelect.cs @@ -14,7 +14,6 @@ using osu.Framework.Configuration; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Primitives; -using osu.Framework.Graphics.Transforms; using osu.Framework.Input; using osu.Framework.Screens; using osu.Game.Beatmaps; diff --git a/osu.Game/Users/Avatar.cs b/osu.Game/Users/Avatar.cs index a6ce9f1e41..b032187624 100644 --- a/osu.Game/Users/Avatar.cs +++ b/osu.Game/Users/Avatar.cs @@ -1,8 +1,6 @@ // 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.Threading.Tasks; using osu.Framework.Allocation; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; @@ -13,102 +11,31 @@ namespace osu.Game.Users { public class Avatar : Container { - public Drawable Sprite; + private readonly User user; - private long userId; - private OsuGameBase game; - private Texture guestTexture; - - [BackgroundDependencyLoader(permitNulls: true)] - private void load(OsuGameBase game, TextureStore textures) + /// + /// An avatar for specified user. + /// + /// The user. A null value will get a placeholder avatar. + public Avatar(User user = null) { - this.game = game; - guestTexture = textures.Get(@"Online/avatar-guest"); + this.user = user; } - public long UserId + [BackgroundDependencyLoader] + private void load(TextureStore textures) { - get { return userId; } - set + Texture texture = null; + if (user?.Id > 1) texture = textures.Get($@"https://a.ppy.sh/{user.Id}"); + if (texture == null) texture = textures.Get(@"Online/avatar-guest"); + + Add(new Sprite { - if (userId == value) - return; - - userId = value; - invalidateSprite(); - } - } - - private Task loadTask; - - private void invalidateSprite() - { - Sprite?.FadeOut(100); - Sprite?.Expire(); - Sprite = null; - } - - private void updateSprite() - { - if (loadTask != null || Sprite != null) return; - - var newSprite = userId > 1 ? new OnlineSprite($@"https://a.ppy.sh/{userId}", guestTexture) : new Sprite { Texture = guestTexture }; - - newSprite.FillMode = FillMode.Fill; - - loadTask = newSprite.LoadAsync(game, s => - { - Sprite = s; - Add(Sprite); - - Sprite.FadeInFromZero(200); - loadTask = null; + Texture = texture, + FillMode = FillMode.Fit, + Anchor = Anchor.Centre, + Origin = Anchor.Centre }); } - - private double timeVisible; - - private bool shouldUpdate => Sprite != null || timeVisible > 500; - - protected override void Update() - { - base.Update(); - - if (!shouldUpdate) - { - //Special optimisation to not start loading until we are within bounds of our closest ScrollContainer parent. - ScrollContainer scroll = null; - IContainer cursor = this; - while (scroll == null && (cursor = cursor.Parent) != null) - scroll = cursor as ScrollContainer; - - if (scroll?.ScreenSpaceDrawQuad.Intersects(ScreenSpaceDrawQuad) ?? true) - timeVisible += Time.Elapsed; - else - timeVisible = 0; - } - - if (shouldUpdate) - updateSprite(); - } - - public class OnlineSprite : Sprite - { - private readonly string url; - private readonly Texture fallbackTexture; - - public OnlineSprite(string url, Texture fallbackTexture = null) - { - Debug.Assert(url != null); - this.url = url; - this.fallbackTexture = fallbackTexture; - } - - [BackgroundDependencyLoader] - private void load(TextureStore textures) - { - Texture = textures.Get(url) ?? fallbackTexture; - } - } } } diff --git a/osu.Game/Users/UpdateableAvatar.cs b/osu.Game/Users/UpdateableAvatar.cs new file mode 100644 index 0000000000..4fc2298525 --- /dev/null +++ b/osu.Game/Users/UpdateableAvatar.cs @@ -0,0 +1,54 @@ +// Copyright (c) 2007-2017 ppy Pty Ltd . +// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE + +using osu.Framework.Graphics; +using osu.Framework.Graphics.Containers; + +namespace osu.Game.Users +{ + /// + /// An avatar which can update to a new user when needed. + /// + public class UpdateableAvatar : Container + { + private Container displayedAvatar; + + private User user; + + public User User + { + get { return user; } + set + { + if (user?.Id == value?.Id) + return; + + user = value; + + if (IsLoaded) + updateAvatar(); + } + } + + protected override void LoadComplete() + { + base.LoadComplete(); + updateAvatar(); + } + + private void updateAvatar() + { + displayedAvatar?.FadeOut(300); + displayedAvatar?.Expire(); + Add(displayedAvatar = new AsyncLoadContainer + { + RelativeSizeAxes = Axes.Both, + FinishedLoading = d => d.FadeInFromZero(200), + Children = new[] + { + new Avatar(user) { RelativeSizeAxes = Axes.Both } + } + }); + } + } +} \ No newline at end of file diff --git a/osu.Game/Users/User.cs b/osu.Game/Users/User.cs index 2763b3100f..6e1de7e3ac 100644 --- a/osu.Game/Users/User.cs +++ b/osu.Game/Users/User.cs @@ -1,13 +1,23 @@ // Copyright (c) 2007-2017 ppy Pty Ltd . // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE +using Newtonsoft.Json; + namespace osu.Game.Users { public class User { - public int Id; + [JsonProperty(@"id")] + public long Id = 1; + + [JsonProperty(@"username")] public string Username; + public Country Country; + public Team Team; + + [JsonProperty(@"colour")] + public string Colour; } } diff --git a/osu.Game/osu.Game.csproj b/osu.Game/osu.Game.csproj index 32dd814fdc..a5bdf1df69 100644 --- a/osu.Game/osu.Game.csproj +++ b/osu.Game/osu.Game.csproj @@ -247,7 +247,6 @@ - @@ -267,6 +266,7 @@ + @@ -396,4 +396,4 @@ --> - + \ No newline at end of file