diff --git a/osu.Game.Tests/Visual/Online/TestSceneUserProfileHeader.cs b/osu.Game.Tests/Visual/Online/TestSceneUserProfileHeader.cs
index d9230090fc..2285c9b799 100644
--- a/osu.Game.Tests/Visual/Online/TestSceneUserProfileHeader.cs
+++ b/osu.Game.Tests/Visual/Online/TestSceneUserProfileHeader.cs
@@ -39,13 +39,27 @@ namespace osu.Game.Tests.Visual.Online
header = new ProfileHeader();
Add(header);
- AddStep("Show offline dummy", () => header.User.Value = TestSceneUserProfileOverlay.TEST_USER);
+ AddStep("Show test dummy", () => header.User.Value = TestSceneUserProfileOverlay.TEST_USER);
AddStep("Show null dummy", () => header.User.Value = new User
{
Username = "Null"
});
+ AddStep("Show online dummy", () => header.User.Value = new User
+ {
+ Username = "IAmOnline",
+ LastVisit = DateTimeOffset.Now,
+ IsOnline = true,
+ });
+
+ AddStep("Show offline dummy", () => header.User.Value = new User
+ {
+ Username = "IAmOffline",
+ LastVisit = DateTimeOffset.Now,
+ IsOnline = false,
+ });
+
addOnlineStep("Show ppy", new User
{
Username = @"peppy",
diff --git a/osu.Game.Tests/Visual/SongSelect/TestScenePlaySongSelect.cs b/osu.Game.Tests/Visual/SongSelect/TestScenePlaySongSelect.cs
index 738b7f14f3..962e0fb362 100644
--- a/osu.Game.Tests/Visual/SongSelect/TestScenePlaySongSelect.cs
+++ b/osu.Game.Tests/Visual/SongSelect/TestScenePlaySongSelect.cs
@@ -214,37 +214,6 @@ namespace osu.Game.Tests.Visual.SongSelect
AddAssert("start not requested", () => !startRequested);
}
- [Test]
- public void TestAddNewBeatmapWhileSelectingRandom()
- {
- const int test_count = 10;
- int beatmapChangedCount = 0;
- int debounceCount = 0;
- createSongSelect();
- AddStep("Setup counters", () =>
- {
- beatmapChangedCount = 0;
- debounceCount = 0;
- songSelect.Carousel.SelectionChanged += _ => beatmapChangedCount++;
- });
- AddRepeatStep($"Create beatmaps {test_count} times", () =>
- {
- importForRuleset(0);
-
- Scheduler.AddDelayed(() =>
- {
- // Wait for debounce
- songSelect.Carousel.SelectNextRandom();
- ++debounceCount;
- }, 400);
- }, test_count);
-
- AddUntilStep("Debounce limit reached", () => debounceCount == test_count);
-
- // The selected beatmap should have changed an additional 2 times since both initially loading songselect and the first import also triggers selectionChanged
- AddAssert($"Beatmap changed {test_count + 2} times", () => beatmapChangedCount == test_count + 2);
- }
-
[Test]
public void TestHideSetSelectsCorrectBeatmap()
{
diff --git a/osu.Game/Graphics/UserInterface/OsuButton.cs b/osu.Game/Graphics/UserInterface/OsuButton.cs
index 494d4e4262..7a27f825f6 100644
--- a/osu.Game/Graphics/UserInterface/OsuButton.cs
+++ b/osu.Game/Graphics/UserInterface/OsuButton.cs
@@ -17,11 +17,11 @@ namespace osu.Game.Graphics.UserInterface
///
/// A button with added default sound effects.
///
- public abstract class OsuButton : Button
+ public class OsuButton : Button
{
private Box hover;
- protected OsuButton()
+ public OsuButton()
{
Height = 40;
diff --git a/osu.Game/Online/Chat/Message.cs b/osu.Game/Online/Chat/Message.cs
index 62f20daddf..2e41038a59 100644
--- a/osu.Game/Online/Chat/Message.cs
+++ b/osu.Game/Online/Chat/Message.cs
@@ -13,10 +13,6 @@ namespace osu.Game.Online.Chat
[JsonProperty(@"message_id")]
public readonly long? Id;
- //todo: this should be inside sender.
- [JsonProperty(@"sender_id")]
- public long UserId;
-
[JsonProperty(@"channel_id")]
public long ChannelId;
diff --git a/osu.Game/Overlays/Profile/Header/BottomHeaderContainer.cs b/osu.Game/Overlays/Profile/Header/BottomHeaderContainer.cs
index ffbb9ad218..e7f7c2f490 100644
--- a/osu.Game/Overlays/Profile/Header/BottomHeaderContainer.cs
+++ b/osu.Game/Overlays/Profile/Header/BottomHeaderContainer.cs
@@ -87,7 +87,12 @@ namespace osu.Game.Overlays.Profile.Header
addSpacer(topLinkContainer);
- if (user.LastVisit.HasValue)
+ if (user.IsOnline)
+ {
+ topLinkContainer.AddText("Currently online");
+ addSpacer(topLinkContainer);
+ }
+ else if (user.LastVisit.HasValue)
{
topLinkContainer.AddText("Last seen ");
topLinkContainer.AddText(new DrawableDate(user.LastVisit.Value), embolden);
diff --git a/osu.Game/Overlays/Settings/SettingsItem.cs b/osu.Game/Overlays/Settings/SettingsItem.cs
index 4776cd6442..ae840c8c00 100644
--- a/osu.Game/Overlays/Settings/SettingsItem.cs
+++ b/osu.Game/Overlays/Settings/SettingsItem.cs
@@ -63,6 +63,9 @@ namespace osu.Game.Overlays.Settings
set
{
+ if (bindable != null)
+ controlWithCurrent?.Current.UnbindFrom(bindable);
+
bindable = value;
controlWithCurrent?.Current.BindTo(bindable);
diff --git a/osu.Game/Screens/Menu/MainMenu.cs b/osu.Game/Screens/Menu/MainMenu.cs
index 3afe9b9371..c81f6ae8ea 100644
--- a/osu.Game/Screens/Menu/MainMenu.cs
+++ b/osu.Game/Screens/Menu/MainMenu.cs
@@ -28,7 +28,7 @@ namespace osu.Game.Screens.Menu
{
private ButtonSystem buttons;
- public override bool HideOverlaysOnEnter => buttons.State == ButtonSystemState.Initial;
+ public override bool HideOverlaysOnEnter => buttons == null || buttons.State == ButtonSystemState.Initial;
protected override bool AllowBackButton => buttons.State != ButtonSystemState.Initial && host.CanExit;
diff --git a/osu.Game/Screens/Multi/Multiplayer.cs b/osu.Game/Screens/Multi/Multiplayer.cs
index 9e5c11e098..5252b41dfd 100644
--- a/osu.Game/Screens/Multi/Multiplayer.cs
+++ b/osu.Game/Screens/Multi/Multiplayer.cs
@@ -9,6 +9,7 @@ using osu.Framework.Graphics.Containers;
using osu.Framework.Graphics.Shapes;
using osu.Framework.Logging;
using osu.Framework.Screens;
+using osu.Game.Beatmaps;
using osu.Game.Graphics;
using osu.Game.Graphics.Backgrounds;
using osu.Game.Graphics.Containers;
@@ -185,6 +186,28 @@ namespace osu.Game.Screens.Multi
{
this.FadeIn();
waves.Show();
+
+ beginHandlingTrack();
+ }
+
+ public override void OnResuming(IScreen last)
+ {
+ this.FadeIn(250);
+ this.ScaleTo(1, 250, Easing.OutSine);
+
+ base.OnResuming(last);
+
+ beginHandlingTrack();
+ }
+
+ public override void OnSuspending(IScreen next)
+ {
+ this.ScaleTo(1.1f, 250, Easing.InSine);
+ this.FadeOut(250);
+
+ endHandlingTrack();
+
+ roomManager.TimeBetweenPolls = 0;
}
public override bool OnExiting(IScreen next)
@@ -193,12 +216,10 @@ namespace osu.Game.Screens.Multi
this.Delay(WaveContainer.DISAPPEAR_DURATION).FadeOut();
- cancelLooping();
-
if (screenStack.CurrentScreen != null)
loungeSubScreen.MakeCurrent();
- updatePollingRate(isIdle.Value);
+ endHandlingTrack();
base.OnExiting(next);
return false;
@@ -212,23 +233,58 @@ namespace osu.Game.Screens.Multi
logo.Delay(WaveContainer.DISAPPEAR_DURATION / 2).FadeOut();
}
- public override void OnResuming(IScreen last)
+ private void beginHandlingTrack()
{
- this.FadeIn(250);
- this.ScaleTo(1, 250, Easing.OutSine);
-
- base.OnResuming(last);
-
- updatePollingRate(isIdle.Value);
+ Beatmap.BindValueChanged(updateTrack, true);
}
- public override void OnSuspending(IScreen next)
+ private void endHandlingTrack()
{
- this.ScaleTo(1.1f, 250, Easing.InSine);
- this.FadeOut(250);
-
cancelLooping();
- roomManager.TimeBetweenPolls = 0;
+ Beatmap.ValueChanged -= updateTrack;
+ }
+
+ private void screenPushed(IScreen lastScreen, IScreen newScreen) => subScreenChanged(newScreen);
+
+ private void screenExited(IScreen lastScreen, IScreen newScreen)
+ {
+ subScreenChanged(newScreen);
+
+ if (screenStack.CurrentScreen == null && this.IsCurrentScreen())
+ this.Exit();
+ }
+
+ private void subScreenChanged(IScreen newScreen)
+ {
+ updatePollingRate(isIdle.Value);
+ createButton.FadeTo(newScreen is MatchSubScreen ? 0 : 1, 200);
+
+ updateTrack();
+ }
+
+ private void updateTrack(ValueChangedEvent _ = null)
+ {
+ bool isMatch = screenStack.CurrentScreen is MatchSubScreen;
+
+ Beatmap.Disabled = isMatch;
+
+ if (isMatch)
+ {
+ var track = Beatmap.Value?.Track;
+
+ if (track != null)
+ {
+ track.RestartPoint = Beatmap.Value.Metadata.PreviewTime;
+ track.Looping = true;
+
+ if (!track.IsRunning)
+ track.Restart();
+ }
+ }
+ else
+ {
+ cancelLooping();
+ }
}
private void cancelLooping()
@@ -236,49 +292,10 @@ namespace osu.Game.Screens.Multi
var track = Beatmap?.Value?.Track;
if (track != null)
- track.Looping = false;
- }
-
- protected override void Update()
- {
- base.Update();
-
- if (!this.IsCurrentScreen()) return;
-
- if (screenStack.CurrentScreen is MatchSubScreen)
{
- var track = Beatmap.Value.Track;
-
- if (track != null)
- {
- track.Looping = true;
-
- if (!track.IsRunning)
- {
- game.Audio.AddItem(track);
- track.Seek(Beatmap.Value.Metadata.PreviewTime);
- track.Start();
- }
- }
-
- createButton.Hide();
+ track.Looping = false;
+ track.RestartPoint = 0;
}
- else if (screenStack.CurrentScreen is LoungeSubScreen)
- createButton.Show();
- }
-
- private void screenPushed(IScreen lastScreen, IScreen newScreen)
- => updatePollingRate(isIdle.Value);
-
- private void screenExited(IScreen lastScreen, IScreen newScreen)
- {
- if (lastScreen is MatchSubScreen)
- cancelLooping();
-
- updatePollingRate(isIdle.Value);
-
- if (screenStack.CurrentScreen == null && this.IsCurrentScreen())
- this.Exit();
}
protected override void Dispose(bool isDisposing)
diff --git a/osu.Game/Users/User.cs b/osu.Game/Users/User.cs
index c3ecd62e10..df41e194b0 100644
--- a/osu.Game/Users/User.cs
+++ b/osu.Game/Users/User.cs
@@ -78,6 +78,9 @@ namespace osu.Game.Users
[JsonProperty(@"is_active")]
public bool Active;
+ [JsonProperty(@"is_online")]
+ public bool IsOnline;
+
[JsonProperty(@"pm_friends_only")]
public bool PMFriendsOnly;
diff --git a/osu.Game/osu.Game.csproj b/osu.Game/osu.Game.csproj
index 957d365724..9dd8c8572e 100644
--- a/osu.Game/osu.Game.csproj
+++ b/osu.Game/osu.Game.csproj
@@ -15,7 +15,7 @@
-
+
diff --git a/osu.iOS.props b/osu.iOS.props
index 9b146fa490..1482b6ed03 100644
--- a/osu.iOS.props
+++ b/osu.iOS.props
@@ -105,8 +105,8 @@
-
-
+
+