mirror of
https://github.com/osukey/osukey.git
synced 2025-08-05 15:44:04 +09:00
Merge pull request #14284 from LeNitrous/activity-on-multiplayer-screens
Update Discord user status for multiplayer/playlists
This commit is contained in:
@ -139,8 +139,8 @@ namespace osu.Desktop
|
|||||||
{
|
{
|
||||||
switch (activity)
|
switch (activity)
|
||||||
{
|
{
|
||||||
case UserActivity.SoloGame solo:
|
case UserActivity.InGame game:
|
||||||
return solo.Beatmap.ToString();
|
return game.Beatmap.ToString();
|
||||||
|
|
||||||
case UserActivity.Editing edit:
|
case UserActivity.Editing edit:
|
||||||
return edit.Beatmap.ToString();
|
return edit.Beatmap.ToString();
|
||||||
|
@ -15,6 +15,7 @@ using osu.Framework.Screens;
|
|||||||
using osu.Framework.Testing;
|
using osu.Framework.Testing;
|
||||||
using osu.Framework.Utils;
|
using osu.Framework.Utils;
|
||||||
using osu.Game.Beatmaps;
|
using osu.Game.Beatmaps;
|
||||||
|
using osu.Game.Online.Rooms;
|
||||||
using osu.Game.Overlays.Mods;
|
using osu.Game.Overlays.Mods;
|
||||||
using osu.Game.Rulesets;
|
using osu.Game.Rulesets;
|
||||||
using osu.Game.Rulesets.Catch;
|
using osu.Game.Rulesets.Catch;
|
||||||
@ -89,7 +90,7 @@ namespace osu.Game.Tests.Visual.Multiplayer
|
|||||||
SelectedMods.SetDefault();
|
SelectedMods.SetDefault();
|
||||||
});
|
});
|
||||||
|
|
||||||
AddStep("create song select", () => LoadScreen(songSelect = new TestMultiplayerMatchSongSelect()));
|
AddStep("create song select", () => LoadScreen(songSelect = new TestMultiplayerMatchSongSelect(SelectedRoom.Value)));
|
||||||
AddUntilStep("wait for present", () => songSelect.IsCurrentScreen());
|
AddUntilStep("wait for present", () => songSelect.IsCurrentScreen());
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -168,6 +169,11 @@ namespace osu.Game.Tests.Visual.Multiplayer
|
|||||||
public new Bindable<IReadOnlyList<Mod>> FreeMods => base.FreeMods;
|
public new Bindable<IReadOnlyList<Mod>> FreeMods => base.FreeMods;
|
||||||
|
|
||||||
public new BeatmapCarousel Carousel => base.Carousel;
|
public new BeatmapCarousel Carousel => base.Carousel;
|
||||||
|
|
||||||
|
public TestMultiplayerMatchSongSelect(Room room, WorkingBeatmap beatmap = null, RulesetInfo ruleset = null)
|
||||||
|
: base(room, beatmap, ruleset)
|
||||||
|
{
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -93,7 +93,7 @@ namespace osu.Game.Tests.Visual.Multiplayer
|
|||||||
SelectedMods.Value = Array.Empty<Mod>();
|
SelectedMods.Value = Array.Empty<Mod>();
|
||||||
});
|
});
|
||||||
|
|
||||||
AddStep("create song select", () => LoadScreen(songSelect = new TestPlaylistsSongSelect()));
|
AddStep("create song select", () => LoadScreen(songSelect = new TestPlaylistsSongSelect(SelectedRoom.Value)));
|
||||||
AddUntilStep("wait for present", () => songSelect.IsCurrentScreen());
|
AddUntilStep("wait for present", () => songSelect.IsCurrentScreen());
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -183,6 +183,11 @@ namespace osu.Game.Tests.Visual.Multiplayer
|
|||||||
private class TestPlaylistsSongSelect : PlaylistsSongSelect
|
private class TestPlaylistsSongSelect : PlaylistsSongSelect
|
||||||
{
|
{
|
||||||
public new MatchBeatmapDetailArea BeatmapDetails => (MatchBeatmapDetailArea)base.BeatmapDetails;
|
public new MatchBeatmapDetailArea BeatmapDetails => (MatchBeatmapDetailArea)base.BeatmapDetails;
|
||||||
|
|
||||||
|
public TestPlaylistsSongSelect(Room room)
|
||||||
|
: base(room)
|
||||||
|
{
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -49,7 +49,7 @@ namespace osu.Game.Tests.Visual.Online
|
|||||||
[Test]
|
[Test]
|
||||||
public void TestPlayActivity()
|
public void TestPlayActivity()
|
||||||
{
|
{
|
||||||
AddStep("Set activity", () => api.Activity.Value = new UserActivity.SoloGame(new BeatmapInfo(), new RulesetInfo()));
|
AddStep("Set activity", () => api.Activity.Value = new UserActivity.InSoloGame(new BeatmapInfo(), new RulesetInfo()));
|
||||||
|
|
||||||
AddStep("Run command", () => Add(new NowPlayingCommand()));
|
AddStep("Run command", () => Add(new NowPlayingCommand()));
|
||||||
|
|
||||||
|
@ -130,7 +130,7 @@ namespace osu.Game.Tests.Visual.Online
|
|||||||
AddAssert("visit message is not visible", () => !evast.LastVisitMessage.IsPresent);
|
AddAssert("visit message is not visible", () => !evast.LastVisitMessage.IsPresent);
|
||||||
}
|
}
|
||||||
|
|
||||||
private UserActivity soloGameStatusForRuleset(int rulesetId) => new UserActivity.SoloGame(null, rulesetStore.GetRuleset(rulesetId));
|
private UserActivity soloGameStatusForRuleset(int rulesetId) => new UserActivity.InSoloGame(null, rulesetStore.GetRuleset(rulesetId));
|
||||||
|
|
||||||
private class TestUserListPanel : UserListPanel
|
private class TestUserListPanel : UserListPanel
|
||||||
{
|
{
|
||||||
|
@ -41,9 +41,9 @@ namespace osu.Game.Online.Chat
|
|||||||
|
|
||||||
switch (api.Activity.Value)
|
switch (api.Activity.Value)
|
||||||
{
|
{
|
||||||
case UserActivity.SoloGame solo:
|
case UserActivity.InGame game:
|
||||||
verb = "playing";
|
verb = "playing";
|
||||||
beatmap = solo.Beatmap;
|
beatmap = game.Beatmap;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case UserActivity.Editing edit:
|
case UserActivity.Editing edit:
|
||||||
|
@ -224,9 +224,9 @@ namespace osu.Game.Rulesets
|
|||||||
public abstract string ShortName { get; }
|
public abstract string ShortName { get; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// The playing verb to be shown in the <see cref="UserActivity.SoloGame.Status"/>.
|
/// The playing verb to be shown in the <see cref="UserActivity.InGame"/> activities.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public virtual string PlayingVerb => "Playing solo";
|
public virtual string PlayingVerb => "Playing";
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// A list of available variant ids.
|
/// A list of available variant ids.
|
||||||
|
@ -52,7 +52,7 @@ namespace osu.Game.Screens.OnlinePlay.Multiplayer.Match
|
|||||||
Action = () =>
|
Action = () =>
|
||||||
{
|
{
|
||||||
if (matchSubScreen.IsCurrentScreen())
|
if (matchSubScreen.IsCurrentScreen())
|
||||||
matchSubScreen.Push(new MultiplayerMatchSongSelect());
|
matchSubScreen.Push(new MultiplayerMatchSongSelect(matchSubScreen.Room));
|
||||||
},
|
},
|
||||||
Alpha = 0
|
Alpha = 0
|
||||||
}
|
}
|
||||||
|
@ -24,9 +24,11 @@ namespace osu.Game.Screens.OnlinePlay.Multiplayer
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// Construct a new instance of multiplayer song select.
|
/// Construct a new instance of multiplayer song select.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
/// <param name="room">The room.</param>
|
||||||
/// <param name="beatmap">An optional initial beatmap selection to perform.</param>
|
/// <param name="beatmap">An optional initial beatmap selection to perform.</param>
|
||||||
/// <param name="ruleset">An optional initial ruleset selection to perform.</param>
|
/// <param name="ruleset">An optional initial ruleset selection to perform.</param>
|
||||||
public MultiplayerMatchSongSelect(WorkingBeatmap beatmap = null, RulesetInfo ruleset = null)
|
public MultiplayerMatchSongSelect(Room room, WorkingBeatmap beatmap = null, RulesetInfo ruleset = null)
|
||||||
|
: base(room)
|
||||||
{
|
{
|
||||||
if (beatmap != null || ruleset != null)
|
if (beatmap != null || ruleset != null)
|
||||||
{
|
{
|
||||||
|
@ -412,7 +412,7 @@ namespace osu.Game.Screens.OnlinePlay.Multiplayer
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
this.Push(new MultiplayerMatchSongSelect(beatmap, ruleset));
|
this.Push(new MultiplayerMatchSongSelect(Room, beatmap, ruleset));
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override void Dispose(bool isDisposing)
|
protected override void Dispose(bool isDisposing)
|
||||||
|
@ -17,6 +17,7 @@ using osu.Game.Scoring;
|
|||||||
using osu.Game.Screens.Play;
|
using osu.Game.Screens.Play;
|
||||||
using osu.Game.Screens.Play.HUD;
|
using osu.Game.Screens.Play.HUD;
|
||||||
using osu.Game.Screens.Ranking;
|
using osu.Game.Screens.Ranking;
|
||||||
|
using osu.Game.Users;
|
||||||
using osuTK;
|
using osuTK;
|
||||||
|
|
||||||
namespace osu.Game.Screens.OnlinePlay.Multiplayer
|
namespace osu.Game.Screens.OnlinePlay.Multiplayer
|
||||||
@ -28,6 +29,8 @@ namespace osu.Game.Screens.OnlinePlay.Multiplayer
|
|||||||
// Disallow fails in multiplayer for now.
|
// Disallow fails in multiplayer for now.
|
||||||
protected override bool CheckModsAllowFailure() => false;
|
protected override bool CheckModsAllowFailure() => false;
|
||||||
|
|
||||||
|
protected override UserActivity InitialActivity => new UserActivity.InMultiplayerGame(Beatmap.Value.BeatmapInfo, Ruleset.Value);
|
||||||
|
|
||||||
[Resolved]
|
[Resolved]
|
||||||
private MultiplayerClient client { get; set; }
|
private MultiplayerClient client { get; set; }
|
||||||
|
|
||||||
|
@ -17,6 +17,7 @@ using osu.Game.Overlays.Mods;
|
|||||||
using osu.Game.Rulesets;
|
using osu.Game.Rulesets;
|
||||||
using osu.Game.Rulesets.Mods;
|
using osu.Game.Rulesets.Mods;
|
||||||
using osu.Game.Screens.Select;
|
using osu.Game.Screens.Select;
|
||||||
|
using osu.Game.Users;
|
||||||
using osu.Game.Utils;
|
using osu.Game.Utils;
|
||||||
|
|
||||||
namespace osu.Game.Screens.OnlinePlay
|
namespace osu.Game.Screens.OnlinePlay
|
||||||
@ -32,6 +33,8 @@ namespace osu.Game.Screens.OnlinePlay
|
|||||||
[Resolved(typeof(Room), nameof(Room.Playlist))]
|
[Resolved(typeof(Room), nameof(Room.Playlist))]
|
||||||
protected BindableList<PlaylistItem> Playlist { get; private set; }
|
protected BindableList<PlaylistItem> Playlist { get; private set; }
|
||||||
|
|
||||||
|
protected override UserActivity InitialActivity => new UserActivity.InLobby(room);
|
||||||
|
|
||||||
protected readonly Bindable<IReadOnlyList<Mod>> FreeMods = new Bindable<IReadOnlyList<Mod>>(Array.Empty<Mod>());
|
protected readonly Bindable<IReadOnlyList<Mod>> FreeMods = new Bindable<IReadOnlyList<Mod>>(Array.Empty<Mod>());
|
||||||
|
|
||||||
[CanBeNull]
|
[CanBeNull]
|
||||||
@ -39,14 +42,17 @@ namespace osu.Game.Screens.OnlinePlay
|
|||||||
private IBindable<PlaylistItem> selectedItem { get; set; }
|
private IBindable<PlaylistItem> selectedItem { get; set; }
|
||||||
|
|
||||||
private readonly FreeModSelectOverlay freeModSelectOverlay;
|
private readonly FreeModSelectOverlay freeModSelectOverlay;
|
||||||
|
private readonly Room room;
|
||||||
|
|
||||||
private WorkingBeatmap initialBeatmap;
|
private WorkingBeatmap initialBeatmap;
|
||||||
private RulesetInfo initialRuleset;
|
private RulesetInfo initialRuleset;
|
||||||
private IReadOnlyList<Mod> initialMods;
|
private IReadOnlyList<Mod> initialMods;
|
||||||
private bool itemSelected;
|
private bool itemSelected;
|
||||||
|
|
||||||
protected OnlinePlaySongSelect()
|
protected OnlinePlaySongSelect(Room room)
|
||||||
{
|
{
|
||||||
|
this.room = room;
|
||||||
|
|
||||||
Padding = new MarginPadding { Horizontal = HORIZONTAL_OVERFLOW_PADDING };
|
Padding = new MarginPadding { Horizontal = HORIZONTAL_OVERFLOW_PADDING };
|
||||||
|
|
||||||
freeModSelectOverlay = new FreeModSelectOverlay
|
freeModSelectOverlay = new FreeModSelectOverlay
|
||||||
|
@ -13,6 +13,7 @@ using osu.Game.Rulesets;
|
|||||||
using osu.Game.Scoring;
|
using osu.Game.Scoring;
|
||||||
using osu.Game.Screens.Play;
|
using osu.Game.Screens.Play;
|
||||||
using osu.Game.Screens.Ranking;
|
using osu.Game.Screens.Ranking;
|
||||||
|
using osu.Game.Users;
|
||||||
|
|
||||||
namespace osu.Game.Screens.OnlinePlay.Playlists
|
namespace osu.Game.Screens.OnlinePlay.Playlists
|
||||||
{
|
{
|
||||||
@ -20,6 +21,8 @@ namespace osu.Game.Screens.OnlinePlay.Playlists
|
|||||||
{
|
{
|
||||||
public Action Exited;
|
public Action Exited;
|
||||||
|
|
||||||
|
protected override UserActivity InitialActivity => new UserActivity.InPlaylistGame(Beatmap.Value.BeatmapInfo, Ruleset.Value);
|
||||||
|
|
||||||
public PlaylistsPlayer(Room room, PlaylistItem playlistItem, PlayerConfiguration configuration = null)
|
public PlaylistsPlayer(Room room, PlaylistItem playlistItem, PlayerConfiguration configuration = null)
|
||||||
: base(room, playlistItem, configuration)
|
: base(room, playlistItem, configuration)
|
||||||
{
|
{
|
||||||
|
@ -189,7 +189,7 @@ namespace osu.Game.Screens.OnlinePlay.Playlists
|
|||||||
EditPlaylist = () =>
|
EditPlaylist = () =>
|
||||||
{
|
{
|
||||||
if (this.IsCurrentScreen())
|
if (this.IsCurrentScreen())
|
||||||
this.Push(new PlaylistsSongSelect());
|
this.Push(new PlaylistsSongSelect(Room));
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -16,6 +16,11 @@ namespace osu.Game.Screens.OnlinePlay.Playlists
|
|||||||
[Resolved]
|
[Resolved]
|
||||||
private BeatmapManager beatmaps { get; set; }
|
private BeatmapManager beatmaps { get; set; }
|
||||||
|
|
||||||
|
public PlaylistsSongSelect(Room room)
|
||||||
|
: base(room)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
protected override BeatmapDetailArea CreateBeatmapDetailArea() => new MatchBeatmapDetailArea
|
protected override BeatmapDetailArea CreateBeatmapDetailArea() => new MatchBeatmapDetailArea
|
||||||
{
|
{
|
||||||
CreateNewItem = createNewItem
|
CreateNewItem = createNewItem
|
||||||
|
@ -47,7 +47,7 @@ namespace osu.Game.Screens.Play
|
|||||||
|
|
||||||
public override bool AllowBackButton => false; // handled by HoldForMenuButton
|
public override bool AllowBackButton => false; // handled by HoldForMenuButton
|
||||||
|
|
||||||
protected override UserActivity InitialActivity => new UserActivity.SoloGame(Beatmap.Value.BeatmapInfo, Ruleset.Value);
|
protected override UserActivity InitialActivity => new UserActivity.InSoloGame(Beatmap.Value.BeatmapInfo, Ruleset.Value);
|
||||||
|
|
||||||
public override float BackgroundParallaxAmount => 0.1f;
|
public override float BackgroundParallaxAmount => 0.1f;
|
||||||
|
|
||||||
|
@ -25,9 +25,45 @@ namespace osu.Game.Users
|
|||||||
public override string Status => "Choosing a beatmap";
|
public override string Status => "Choosing a beatmap";
|
||||||
}
|
}
|
||||||
|
|
||||||
public class MultiplayerGame : UserActivity
|
public abstract class InGame : UserActivity
|
||||||
{
|
{
|
||||||
public override string Status => "Playing with others";
|
public BeatmapInfo Beatmap { get; }
|
||||||
|
|
||||||
|
public RulesetInfo Ruleset { get; }
|
||||||
|
|
||||||
|
protected InGame(BeatmapInfo info, RulesetInfo ruleset)
|
||||||
|
{
|
||||||
|
Beatmap = info;
|
||||||
|
Ruleset = ruleset;
|
||||||
|
}
|
||||||
|
|
||||||
|
public override string Status => Ruleset.CreateInstance().PlayingVerb;
|
||||||
|
}
|
||||||
|
|
||||||
|
public class InMultiplayerGame : InGame
|
||||||
|
{
|
||||||
|
public InMultiplayerGame(BeatmapInfo beatmap, RulesetInfo ruleset)
|
||||||
|
: base(beatmap, ruleset)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
public override string Status => $@"{base.Status} with others";
|
||||||
|
}
|
||||||
|
|
||||||
|
public class InPlaylistGame : InGame
|
||||||
|
{
|
||||||
|
public InPlaylistGame(BeatmapInfo beatmap, RulesetInfo ruleset)
|
||||||
|
: base(beatmap, ruleset)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public class InSoloGame : InGame
|
||||||
|
{
|
||||||
|
public InSoloGame(BeatmapInfo info, RulesetInfo ruleset)
|
||||||
|
: base(info, ruleset)
|
||||||
|
{
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public class Editing : UserActivity
|
public class Editing : UserActivity
|
||||||
@ -42,21 +78,6 @@ namespace osu.Game.Users
|
|||||||
public override string Status => @"Editing a beatmap";
|
public override string Status => @"Editing a beatmap";
|
||||||
}
|
}
|
||||||
|
|
||||||
public class SoloGame : UserActivity
|
|
||||||
{
|
|
||||||
public BeatmapInfo Beatmap { get; }
|
|
||||||
|
|
||||||
public RulesetInfo Ruleset { get; }
|
|
||||||
|
|
||||||
public SoloGame(BeatmapInfo info, RulesetInfo ruleset)
|
|
||||||
{
|
|
||||||
Beatmap = info;
|
|
||||||
Ruleset = ruleset;
|
|
||||||
}
|
|
||||||
|
|
||||||
public override string Status => Ruleset.CreateInstance().PlayingVerb;
|
|
||||||
}
|
|
||||||
|
|
||||||
public class Spectating : UserActivity
|
public class Spectating : UserActivity
|
||||||
{
|
{
|
||||||
public override string Status => @"Spectating a game";
|
public override string Status => @"Spectating a game";
|
||||||
@ -69,7 +90,7 @@ namespace osu.Game.Users
|
|||||||
|
|
||||||
public class InLobby : UserActivity
|
public class InLobby : UserActivity
|
||||||
{
|
{
|
||||||
public override string Status => @"In a multiplayer lobby";
|
public override string Status => @"In a lobby";
|
||||||
|
|
||||||
public readonly Room Room;
|
public readonly Room Room;
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user