1
0
mirror of https://github.com/ppy/osu.git synced 2025-01-15 00:02:54 +08:00

apply suggestions

- make `UserActivity.InGame` and derive that to `InSoloGame` and `InMultiplayerGame`
- rename `SoloGame` to `InSoloGame`
- rename `MultiplayerGame` to `InMultiplayerGame`
This commit is contained in:
Nathan Alo 2021-08-16 06:32:33 +08:00
parent 2cc096101e
commit cc3468b4ab
8 changed files with 35 additions and 27 deletions

View File

@ -139,8 +139,8 @@ namespace osu.Desktop
{
switch (activity)
{
case UserActivity.SoloGame solo:
return solo.Beatmap.ToString();
case UserActivity.InGame game:
return game.Beatmap.ToString();
case UserActivity.Editing edit:
return edit.Beatmap.ToString();

View File

@ -49,7 +49,7 @@ namespace osu.Game.Tests.Visual.Online
[Test]
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()));

View File

@ -130,7 +130,7 @@ namespace osu.Game.Tests.Visual.Online
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
{

View File

@ -41,9 +41,9 @@ namespace osu.Game.Online.Chat
switch (api.Activity.Value)
{
case UserActivity.SoloGame solo:
case UserActivity.InGame game:
verb = "playing";
beatmap = solo.Beatmap;
beatmap = game.Beatmap;
break;
case UserActivity.Editing edit:

View File

@ -224,7 +224,7 @@ namespace osu.Game.Rulesets
public abstract string ShortName { get; }
/// <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.InSoloGame.Status"/>.
/// </summary>
public virtual string PlayingVerb => "Playing";

View File

@ -47,7 +47,7 @@ namespace osu.Game.Screens.Play
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;

View File

@ -20,7 +20,7 @@ namespace osu.Game.Screens.Play
protected readonly PlaylistItem PlaylistItem;
protected override UserActivity InitialActivity => new UserActivity.MultiplayerGame(Beatmap.Value.BeatmapInfo, Ruleset.Value);
protected override UserActivity InitialActivity => new UserActivity.InMultiplayerGame(Beatmap.Value.BeatmapInfo, Ruleset.Value);
protected RoomSubmittingPlayer(PlaylistItem playlistItem, PlayerConfiguration configuration = null)
: base(configuration)

View File

@ -25,14 +25,37 @@ namespace osu.Game.Users
public override string Status => "Choosing a beatmap";
}
public class MultiplayerGame : SoloGame
public abstract class InGame : UserActivity
{
public MultiplayerGame(BeatmapInfo beatmap, RulesetInfo ruleset)
public BeatmapInfo Beatmap { get; }
public RulesetInfo Ruleset { get; }
public InGame(BeatmapInfo info, RulesetInfo ruleset)
{
Beatmap = info;
Ruleset = ruleset;
}
}
public class InMultiplayerGame : InGame
{
public InMultiplayerGame(BeatmapInfo beatmap, RulesetInfo ruleset)
: base(beatmap, ruleset)
{
}
public override string Status => $@"{base.Status} with others";
public override string Status => $@"{Ruleset.CreateInstance().PlayingVerb} with others";
}
public class InSoloGame : InGame
{
public InSoloGame(BeatmapInfo info, RulesetInfo ruleset)
: base(info, ruleset)
{
}
public override string Status => Ruleset.CreateInstance().PlayingVerb;
}
public class Editing : UserActivity
@ -47,21 +70,6 @@ namespace osu.Game.Users
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 override string Status => @"Spectating a game";