mirror of
https://github.com/ppy/osu.git
synced 2025-01-28 18:12:56 +08:00
Remove beatmap bindable from PlaylistItem
This commit is contained in:
parent
94a974e1c9
commit
bdc3b76df0
@ -86,9 +86,8 @@ namespace osu.Game.Tests.Online
|
|||||||
Realm.Write(r => r.RemoveAll<BeatmapSetInfo>());
|
Realm.Write(r => r.RemoveAll<BeatmapSetInfo>());
|
||||||
Realm.Write(r => r.RemoveAll<BeatmapInfo>());
|
Realm.Write(r => r.RemoveAll<BeatmapInfo>());
|
||||||
|
|
||||||
selectedItem.Value = new PlaylistItem
|
selectedItem.Value = new PlaylistItem(testBeatmapInfo)
|
||||||
{
|
{
|
||||||
Beatmap = { Value = testBeatmapInfo },
|
|
||||||
RulesetID = testBeatmapInfo.Ruleset.OnlineID,
|
RulesetID = testBeatmapInfo.Ruleset.OnlineID,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -3,6 +3,7 @@
|
|||||||
|
|
||||||
using System;
|
using System;
|
||||||
using NUnit.Framework;
|
using NUnit.Framework;
|
||||||
|
using osu.Game.Online.API.Requests.Responses;
|
||||||
using osu.Game.Online.Rooms;
|
using osu.Game.Online.Rooms;
|
||||||
|
|
||||||
namespace osu.Game.Tests.OnlinePlay
|
namespace osu.Game.Tests.OnlinePlay
|
||||||
@ -29,9 +30,9 @@ namespace osu.Game.Tests.OnlinePlay
|
|||||||
{
|
{
|
||||||
var items = new[]
|
var items = new[]
|
||||||
{
|
{
|
||||||
new PlaylistItem { ID = 1, BeatmapID = 1001, PlaylistOrder = 1 },
|
new PlaylistItem(new APIBeatmap { OnlineID = 1001 }) { ID = 1, PlaylistOrder = 1 },
|
||||||
new PlaylistItem { ID = 2, BeatmapID = 1002, PlaylistOrder = 2 },
|
new PlaylistItem(new APIBeatmap { OnlineID = 1002 }) { ID = 2, PlaylistOrder = 2 },
|
||||||
new PlaylistItem { ID = 3, BeatmapID = 1003, PlaylistOrder = 3 },
|
new PlaylistItem(new APIBeatmap { OnlineID = 1003 }) { ID = 3, PlaylistOrder = 3 },
|
||||||
};
|
};
|
||||||
|
|
||||||
Assert.Multiple(() =>
|
Assert.Multiple(() =>
|
||||||
@ -47,9 +48,9 @@ namespace osu.Game.Tests.OnlinePlay
|
|||||||
{
|
{
|
||||||
var items = new[]
|
var items = new[]
|
||||||
{
|
{
|
||||||
new PlaylistItem { ID = 2, BeatmapID = 1002, PlaylistOrder = 2 },
|
new PlaylistItem(new APIBeatmap { OnlineID = 1002 }) { ID = 2, PlaylistOrder = 2 },
|
||||||
new PlaylistItem { ID = 1, BeatmapID = 1001, PlaylistOrder = 1 },
|
new PlaylistItem(new APIBeatmap { OnlineID = 1001 }) { ID = 1, PlaylistOrder = 1 },
|
||||||
new PlaylistItem { ID = 3, BeatmapID = 1003, PlaylistOrder = 3 },
|
new PlaylistItem(new APIBeatmap { OnlineID = 1003 }) { ID = 3, PlaylistOrder = 3 },
|
||||||
};
|
};
|
||||||
|
|
||||||
Assert.Multiple(() =>
|
Assert.Multiple(() =>
|
||||||
@ -65,9 +66,9 @@ namespace osu.Game.Tests.OnlinePlay
|
|||||||
{
|
{
|
||||||
var items = new[]
|
var items = new[]
|
||||||
{
|
{
|
||||||
new PlaylistItem { ID = 1, BeatmapID = 1001, Expired = true, PlayedAt = new DateTimeOffset(2021, 12, 21, 7, 55, 0, TimeSpan.Zero) },
|
new PlaylistItem(new APIBeatmap { OnlineID = 1001 }) { ID = 1, Expired = true, PlayedAt = new DateTimeOffset(2021, 12, 21, 7, 55, 0, TimeSpan.Zero) },
|
||||||
new PlaylistItem { ID = 2, BeatmapID = 1002, Expired = true, PlayedAt = new DateTimeOffset(2021, 12, 21, 7, 53, 0, TimeSpan.Zero) },
|
new PlaylistItem(new APIBeatmap { OnlineID = 1002 }) { ID = 2, Expired = true, PlayedAt = new DateTimeOffset(2021, 12, 21, 7, 53, 0, TimeSpan.Zero) },
|
||||||
new PlaylistItem { ID = 3, BeatmapID = 1003, PlaylistOrder = 3 },
|
new PlaylistItem(new APIBeatmap { OnlineID = 1003 }) { ID = 3, PlaylistOrder = 3 },
|
||||||
};
|
};
|
||||||
|
|
||||||
Assert.Multiple(() =>
|
Assert.Multiple(() =>
|
||||||
@ -83,9 +84,9 @@ namespace osu.Game.Tests.OnlinePlay
|
|||||||
{
|
{
|
||||||
var items = new[]
|
var items = new[]
|
||||||
{
|
{
|
||||||
new PlaylistItem { ID = 1, BeatmapID = 1001, Expired = true, PlayedAt = new DateTimeOffset(2021, 12, 21, 7, 55, 0, TimeSpan.Zero) },
|
new PlaylistItem(new APIBeatmap { OnlineID = 1001 }) { ID = 1, Expired = true, PlayedAt = new DateTimeOffset(2021, 12, 21, 7, 55, 0, TimeSpan.Zero) },
|
||||||
new PlaylistItem { ID = 2, BeatmapID = 1002, Expired = true, PlayedAt = new DateTimeOffset(2021, 12, 21, 7, 53, 0, TimeSpan.Zero) },
|
new PlaylistItem(new APIBeatmap { OnlineID = 1002 }) { ID = 2, Expired = true, PlayedAt = new DateTimeOffset(2021, 12, 21, 7, 53, 0, TimeSpan.Zero) },
|
||||||
new PlaylistItem { ID = 3, BeatmapID = 1002, Expired = true, PlayedAt = new DateTimeOffset(2021, 12, 21, 7, 57, 0, TimeSpan.Zero) },
|
new PlaylistItem(new APIBeatmap { OnlineID = 1002 }) { ID = 3, Expired = true, PlayedAt = new DateTimeOffset(2021, 12, 21, 7, 57, 0, TimeSpan.Zero) },
|
||||||
};
|
};
|
||||||
|
|
||||||
Assert.Multiple(() =>
|
Assert.Multiple(() =>
|
||||||
|
@ -71,9 +71,8 @@ namespace osu.Game.Tests.Visual.Multiplayer
|
|||||||
QueueMode = { Value = Mode },
|
QueueMode = { Value = Mode },
|
||||||
Playlist =
|
Playlist =
|
||||||
{
|
{
|
||||||
new PlaylistItem
|
new PlaylistItem(InitialBeatmap)
|
||||||
{
|
{
|
||||||
Beatmap = { Value = InitialBeatmap },
|
|
||||||
RulesetID = new OsuRuleset().RulesetInfo.OnlineID
|
RulesetID = new OsuRuleset().RulesetInfo.OnlineID
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -53,19 +53,13 @@ namespace osu.Game.Tests.Visual.Multiplayer
|
|||||||
Type = { Value = MatchType.HeadToHead },
|
Type = { Value = MatchType.HeadToHead },
|
||||||
Playlist =
|
Playlist =
|
||||||
{
|
{
|
||||||
new PlaylistItem
|
new PlaylistItem(new TestBeatmap(new OsuRuleset().RulesetInfo)
|
||||||
{
|
{
|
||||||
Beatmap =
|
BeatmapInfo =
|
||||||
{
|
{
|
||||||
Value = new TestBeatmap(new OsuRuleset().RulesetInfo)
|
StarRating = 2.5
|
||||||
{
|
|
||||||
BeatmapInfo =
|
|
||||||
{
|
|
||||||
StarRating = 2.5
|
|
||||||
}
|
|
||||||
}.BeatmapInfo,
|
|
||||||
}
|
}
|
||||||
}
|
}.BeatmapInfo)
|
||||||
}
|
}
|
||||||
}),
|
}),
|
||||||
createLoungeRoom(new Room
|
createLoungeRoom(new Room
|
||||||
@ -76,26 +70,20 @@ namespace osu.Game.Tests.Visual.Multiplayer
|
|||||||
Type = { Value = MatchType.HeadToHead },
|
Type = { Value = MatchType.HeadToHead },
|
||||||
Playlist =
|
Playlist =
|
||||||
{
|
{
|
||||||
new PlaylistItem
|
new PlaylistItem(new TestBeatmap(new OsuRuleset().RulesetInfo)
|
||||||
{
|
{
|
||||||
Beatmap =
|
BeatmapInfo =
|
||||||
{
|
{
|
||||||
Value = new TestBeatmap(new OsuRuleset().RulesetInfo)
|
StarRating = 2.5,
|
||||||
|
Metadata =
|
||||||
{
|
{
|
||||||
BeatmapInfo =
|
Artist = "very very very very very very very very very long artist",
|
||||||
{
|
ArtistUnicode = "very very very very very very very very very long artist",
|
||||||
StarRating = 2.5,
|
Title = "very very very very very very very very very very very long title",
|
||||||
Metadata =
|
TitleUnicode = "very very very very very very very very very very very long title",
|
||||||
{
|
}
|
||||||
Artist = "very very very very very very very very very long artist",
|
|
||||||
ArtistUnicode = "very very very very very very very very very long artist",
|
|
||||||
Title = "very very very very very very very very very very very long title",
|
|
||||||
TitleUnicode = "very very very very very very very very very very very long title",
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}.BeatmapInfo,
|
|
||||||
}
|
}
|
||||||
}
|
}.BeatmapInfo)
|
||||||
}
|
}
|
||||||
}),
|
}),
|
||||||
createLoungeRoom(new Room
|
createLoungeRoom(new Room
|
||||||
@ -105,32 +93,20 @@ namespace osu.Game.Tests.Visual.Multiplayer
|
|||||||
EndDate = { Value = DateTimeOffset.Now.AddDays(1) },
|
EndDate = { Value = DateTimeOffset.Now.AddDays(1) },
|
||||||
Playlist =
|
Playlist =
|
||||||
{
|
{
|
||||||
new PlaylistItem
|
new PlaylistItem(new TestBeatmap(new OsuRuleset().RulesetInfo)
|
||||||
{
|
{
|
||||||
Beatmap =
|
BeatmapInfo =
|
||||||
{
|
{
|
||||||
Value = new TestBeatmap(new OsuRuleset().RulesetInfo)
|
StarRating = 2.5
|
||||||
{
|
|
||||||
BeatmapInfo =
|
|
||||||
{
|
|
||||||
StarRating = 2.5
|
|
||||||
}
|
|
||||||
}.BeatmapInfo,
|
|
||||||
}
|
}
|
||||||
},
|
}.BeatmapInfo),
|
||||||
new PlaylistItem
|
new PlaylistItem(new TestBeatmap(new OsuRuleset().RulesetInfo)
|
||||||
{
|
{
|
||||||
Beatmap =
|
BeatmapInfo =
|
||||||
{
|
{
|
||||||
Value = new TestBeatmap(new OsuRuleset().RulesetInfo)
|
StarRating = 4.5
|
||||||
{
|
|
||||||
BeatmapInfo =
|
|
||||||
{
|
|
||||||
StarRating = 4.5
|
|
||||||
}
|
|
||||||
}.BeatmapInfo,
|
|
||||||
}
|
}
|
||||||
}
|
}.BeatmapInfo)
|
||||||
}
|
}
|
||||||
}),
|
}),
|
||||||
createLoungeRoom(new Room
|
createLoungeRoom(new Room
|
||||||
|
@ -209,10 +209,9 @@ namespace osu.Game.Tests.Visual.Multiplayer
|
|||||||
Size = new Vector2(500, 300),
|
Size = new Vector2(500, 300),
|
||||||
Items =
|
Items =
|
||||||
{
|
{
|
||||||
new PlaylistItem
|
new PlaylistItem(new TestBeatmap(new OsuRuleset().RulesetInfo).BeatmapInfo)
|
||||||
{
|
{
|
||||||
ID = 0,
|
ID = 0,
|
||||||
Beatmap = { Value = new TestBeatmap(new OsuRuleset().RulesetInfo).BeatmapInfo },
|
|
||||||
RulesetID = new OsuRuleset().RulesetInfo.OnlineID,
|
RulesetID = new OsuRuleset().RulesetInfo.OnlineID,
|
||||||
Expired = true,
|
Expired = true,
|
||||||
RequiredMods = new[]
|
RequiredMods = new[]
|
||||||
@ -222,10 +221,9 @@ namespace osu.Game.Tests.Visual.Multiplayer
|
|||||||
new APIMod(new OsuModAutoplay())
|
new APIMod(new OsuModAutoplay())
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
new PlaylistItem
|
new PlaylistItem(new TestBeatmap(new OsuRuleset().RulesetInfo).BeatmapInfo)
|
||||||
{
|
{
|
||||||
ID = 1,
|
ID = 1,
|
||||||
Beatmap = { Value = new TestBeatmap(new OsuRuleset().RulesetInfo).BeatmapInfo },
|
|
||||||
RulesetID = new OsuRuleset().RulesetInfo.OnlineID,
|
RulesetID = new OsuRuleset().RulesetInfo.OnlineID,
|
||||||
RequiredMods = new[]
|
RequiredMods = new[]
|
||||||
{
|
{
|
||||||
@ -293,25 +291,21 @@ namespace osu.Game.Tests.Visual.Multiplayer
|
|||||||
|
|
||||||
for (int i = 0; i < 20; i++)
|
for (int i = 0; i < 20; i++)
|
||||||
{
|
{
|
||||||
playlist.Items.Add(new PlaylistItem
|
playlist.Items.Add(new PlaylistItem(i % 2 == 1
|
||||||
|
? new TestBeatmap(new OsuRuleset().RulesetInfo).BeatmapInfo
|
||||||
|
: new BeatmapInfo
|
||||||
|
{
|
||||||
|
Metadata = new BeatmapMetadata
|
||||||
|
{
|
||||||
|
Artist = "Artist",
|
||||||
|
Author = new RealmUser { Username = "Creator name here" },
|
||||||
|
Title = "Long title used to check background colour",
|
||||||
|
},
|
||||||
|
BeatmapSet = new BeatmapSetInfo()
|
||||||
|
})
|
||||||
{
|
{
|
||||||
ID = i,
|
ID = i,
|
||||||
OwnerID = 2,
|
OwnerID = 2,
|
||||||
Beatmap =
|
|
||||||
{
|
|
||||||
Value = i % 2 == 1
|
|
||||||
? new TestBeatmap(new OsuRuleset().RulesetInfo).BeatmapInfo
|
|
||||||
: new BeatmapInfo
|
|
||||||
{
|
|
||||||
Metadata = new BeatmapMetadata
|
|
||||||
{
|
|
||||||
Artist = "Artist",
|
|
||||||
Author = new RealmUser { Username = "Creator name here" },
|
|
||||||
Title = "Long title used to check background colour",
|
|
||||||
},
|
|
||||||
BeatmapSet = new BeatmapSetInfo()
|
|
||||||
}
|
|
||||||
},
|
|
||||||
RulesetID = new OsuRuleset().RulesetInfo.OnlineID,
|
RulesetID = new OsuRuleset().RulesetInfo.OnlineID,
|
||||||
RequiredMods = new[]
|
RequiredMods = new[]
|
||||||
{
|
{
|
||||||
@ -341,11 +335,10 @@ namespace osu.Game.Tests.Visual.Multiplayer
|
|||||||
|
|
||||||
foreach (var b in beatmaps())
|
foreach (var b in beatmaps())
|
||||||
{
|
{
|
||||||
playlist.Items.Add(new PlaylistItem
|
playlist.Items.Add(new PlaylistItem(b)
|
||||||
{
|
{
|
||||||
ID = index++,
|
ID = index++,
|
||||||
OwnerID = 2,
|
OwnerID = 2,
|
||||||
Beatmap = { Value = b },
|
|
||||||
RulesetID = new OsuRuleset().RulesetInfo.OnlineID,
|
RulesetID = new OsuRuleset().RulesetInfo.OnlineID,
|
||||||
RequiredMods = new[]
|
RequiredMods = new[]
|
||||||
{
|
{
|
||||||
|
@ -57,12 +57,12 @@ namespace osu.Game.Tests.Visual.Multiplayer
|
|||||||
RunGameplay();
|
RunGameplay();
|
||||||
|
|
||||||
IBeatmapInfo firstBeatmap = null;
|
IBeatmapInfo firstBeatmap = null;
|
||||||
AddStep("get first playlist item beatmap", () => firstBeatmap = Client.APIRoom?.Playlist[0].Beatmap.Value);
|
AddStep("get first playlist item beatmap", () => firstBeatmap = Client.APIRoom?.Playlist[0].Beatmap);
|
||||||
|
|
||||||
selectNewItem(() => OtherBeatmap);
|
selectNewItem(() => OtherBeatmap);
|
||||||
|
|
||||||
AddAssert("first playlist item hasn't changed", () => Client.APIRoom?.Playlist[0].Beatmap.Value == firstBeatmap);
|
AddAssert("first playlist item hasn't changed", () => Client.APIRoom?.Playlist[0].Beatmap == firstBeatmap);
|
||||||
AddAssert("second playlist item changed", () => Client.APIRoom?.Playlist[1].Beatmap.Value != firstBeatmap);
|
AddAssert("second playlist item changed", () => Client.APIRoom?.Playlist[1].Beatmap != firstBeatmap);
|
||||||
}
|
}
|
||||||
|
|
||||||
[Test]
|
[Test]
|
||||||
@ -104,7 +104,7 @@ namespace osu.Game.Tests.Visual.Multiplayer
|
|||||||
AddStep("select other beatmap", () => ((Screens.Select.SongSelect)CurrentSubScreen).FinaliseSelection(otherBeatmap = beatmap()));
|
AddStep("select other beatmap", () => ((Screens.Select.SongSelect)CurrentSubScreen).FinaliseSelection(otherBeatmap = beatmap()));
|
||||||
|
|
||||||
AddUntilStep("wait for return to match", () => CurrentSubScreen is MultiplayerMatchSubScreen);
|
AddUntilStep("wait for return to match", () => CurrentSubScreen is MultiplayerMatchSubScreen);
|
||||||
AddUntilStep("selected item is new beatmap", () => (CurrentSubScreen as MultiplayerMatchSubScreen)?.SelectedItem.Value?.BeatmapID == otherBeatmap.OnlineID);
|
AddUntilStep("selected item is new beatmap", () => (CurrentSubScreen as MultiplayerMatchSubScreen)?.SelectedItem.Value?.Beatmap.OnlineID == otherBeatmap.OnlineID);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void addItem(Func<BeatmapInfo> beatmap)
|
private void addItem(Func<BeatmapInfo> beatmap)
|
||||||
|
@ -32,10 +32,9 @@ namespace osu.Game.Tests.Visual.Multiplayer
|
|||||||
|
|
||||||
private void createNewItem()
|
private void createNewItem()
|
||||||
{
|
{
|
||||||
SelectedRoom.Value.Playlist.Add(new PlaylistItem
|
SelectedRoom.Value.Playlist.Add(new PlaylistItem(new TestBeatmap(new OsuRuleset().RulesetInfo).BeatmapInfo)
|
||||||
{
|
{
|
||||||
ID = SelectedRoom.Value.Playlist.Count,
|
ID = SelectedRoom.Value.Playlist.Count,
|
||||||
Beatmap = { Value = new TestBeatmap(new OsuRuleset().RulesetInfo).BeatmapInfo },
|
|
||||||
RulesetID = new OsuRuleset().RulesetInfo.OnlineID,
|
RulesetID = new OsuRuleset().RulesetInfo.OnlineID,
|
||||||
RequiredMods = new[]
|
RequiredMods = new[]
|
||||||
{
|
{
|
||||||
|
@ -93,9 +93,8 @@ namespace osu.Game.Tests.Visual.Multiplayer
|
|||||||
Name = { Value = "Test Room" },
|
Name = { Value = "Test Room" },
|
||||||
Playlist =
|
Playlist =
|
||||||
{
|
{
|
||||||
new PlaylistItem
|
new PlaylistItem(beatmaps.GetWorkingBeatmap(importedSet.Beatmaps.First(b => b.Ruleset.OnlineID == 0)).BeatmapInfo)
|
||||||
{
|
{
|
||||||
Beatmap = { Value = beatmaps.GetWorkingBeatmap(importedSet.Beatmaps.First(b => b.Ruleset.OnlineID == 0)).BeatmapInfo },
|
|
||||||
RulesetID = new OsuRuleset().RulesetInfo.OnlineID
|
RulesetID = new OsuRuleset().RulesetInfo.OnlineID
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -229,9 +228,8 @@ namespace osu.Game.Tests.Visual.Multiplayer
|
|||||||
Name = { Value = "Test Room" },
|
Name = { Value = "Test Room" },
|
||||||
Playlist =
|
Playlist =
|
||||||
{
|
{
|
||||||
new PlaylistItem
|
new PlaylistItem(beatmaps.GetWorkingBeatmap(importedSet.Beatmaps.First(b => b.Ruleset.OnlineID == 0)).BeatmapInfo)
|
||||||
{
|
{
|
||||||
Beatmap = { Value = beatmaps.GetWorkingBeatmap(importedSet.Beatmaps.First(b => b.Ruleset.OnlineID == 0)).BeatmapInfo },
|
|
||||||
RulesetID = new OsuRuleset().RulesetInfo.OnlineID
|
RulesetID = new OsuRuleset().RulesetInfo.OnlineID
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -251,9 +249,8 @@ namespace osu.Game.Tests.Visual.Multiplayer
|
|||||||
Name = { Value = "Test Room" },
|
Name = { Value = "Test Room" },
|
||||||
Playlist =
|
Playlist =
|
||||||
{
|
{
|
||||||
new PlaylistItem
|
new PlaylistItem(beatmaps.GetWorkingBeatmap(importedSet.Beatmaps.First(b => b.Ruleset.OnlineID == 0)).BeatmapInfo)
|
||||||
{
|
{
|
||||||
Beatmap = { Value = beatmaps.GetWorkingBeatmap(importedSet.Beatmaps.First(b => b.Ruleset.OnlineID == 0)).BeatmapInfo },
|
|
||||||
RulesetID = new OsuRuleset().RulesetInfo.OnlineID
|
RulesetID = new OsuRuleset().RulesetInfo.OnlineID
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -281,9 +278,8 @@ namespace osu.Game.Tests.Visual.Multiplayer
|
|||||||
Name = { Value = "Test Room" },
|
Name = { Value = "Test Room" },
|
||||||
Playlist =
|
Playlist =
|
||||||
{
|
{
|
||||||
new PlaylistItem
|
new PlaylistItem(beatmaps.GetWorkingBeatmap(importedSet.Beatmaps.First(b => b.Ruleset.OnlineID == 0)).BeatmapInfo)
|
||||||
{
|
{
|
||||||
Beatmap = { Value = beatmaps.GetWorkingBeatmap(importedSet.Beatmaps.First(b => b.Ruleset.OnlineID == 0)).BeatmapInfo },
|
|
||||||
RulesetID = new OsuRuleset().RulesetInfo.OnlineID
|
RulesetID = new OsuRuleset().RulesetInfo.OnlineID
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -312,9 +308,8 @@ namespace osu.Game.Tests.Visual.Multiplayer
|
|||||||
Password = { Value = "password" },
|
Password = { Value = "password" },
|
||||||
Playlist =
|
Playlist =
|
||||||
{
|
{
|
||||||
new PlaylistItem
|
new PlaylistItem(beatmaps.GetWorkingBeatmap(importedSet.Beatmaps.First(b => b.Ruleset.OnlineID == 0)).BeatmapInfo)
|
||||||
{
|
{
|
||||||
Beatmap = { Value = beatmaps.GetWorkingBeatmap(importedSet.Beatmaps.First(b => b.Ruleset.OnlineID == 0)).BeatmapInfo },
|
|
||||||
RulesetID = new OsuRuleset().RulesetInfo.OnlineID
|
RulesetID = new OsuRuleset().RulesetInfo.OnlineID
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -334,9 +329,8 @@ namespace osu.Game.Tests.Visual.Multiplayer
|
|||||||
Password = { Value = "password" },
|
Password = { Value = "password" },
|
||||||
Playlist =
|
Playlist =
|
||||||
{
|
{
|
||||||
new PlaylistItem
|
new PlaylistItem(beatmaps.GetWorkingBeatmap(importedSet.Beatmaps.First(b => b.Ruleset.OnlineID == 0)).BeatmapInfo)
|
||||||
{
|
{
|
||||||
Beatmap = { Value = beatmaps.GetWorkingBeatmap(importedSet.Beatmaps.First(b => b.Ruleset.OnlineID == 0)).BeatmapInfo },
|
|
||||||
RulesetID = new OsuRuleset().RulesetInfo.OnlineID
|
RulesetID = new OsuRuleset().RulesetInfo.OnlineID
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -367,9 +361,8 @@ namespace osu.Game.Tests.Visual.Multiplayer
|
|||||||
Password = { Value = "password" },
|
Password = { Value = "password" },
|
||||||
Playlist =
|
Playlist =
|
||||||
{
|
{
|
||||||
new PlaylistItem
|
new PlaylistItem(beatmaps.GetWorkingBeatmap(importedSet.Beatmaps.First(b => b.Ruleset.OnlineID == 0)).BeatmapInfo)
|
||||||
{
|
{
|
||||||
Beatmap = { Value = beatmaps.GetWorkingBeatmap(importedSet.Beatmaps.First(b => b.Ruleset.OnlineID == 0)).BeatmapInfo },
|
|
||||||
RulesetID = new OsuRuleset().RulesetInfo.OnlineID
|
RulesetID = new OsuRuleset().RulesetInfo.OnlineID
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -387,9 +380,8 @@ namespace osu.Game.Tests.Visual.Multiplayer
|
|||||||
Name = { Value = "Test Room" },
|
Name = { Value = "Test Room" },
|
||||||
Playlist =
|
Playlist =
|
||||||
{
|
{
|
||||||
new PlaylistItem
|
new PlaylistItem(beatmaps.GetWorkingBeatmap(importedSet.Beatmaps.First(b => b.Ruleset.OnlineID == 0)).BeatmapInfo)
|
||||||
{
|
{
|
||||||
Beatmap = { Value = beatmaps.GetWorkingBeatmap(importedSet.Beatmaps.First(b => b.Ruleset.OnlineID == 0)).BeatmapInfo },
|
|
||||||
RulesetID = new OsuRuleset().RulesetInfo.OnlineID
|
RulesetID = new OsuRuleset().RulesetInfo.OnlineID
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -409,9 +401,8 @@ namespace osu.Game.Tests.Visual.Multiplayer
|
|||||||
Name = { Value = "Test Room" },
|
Name = { Value = "Test Room" },
|
||||||
Playlist =
|
Playlist =
|
||||||
{
|
{
|
||||||
new PlaylistItem
|
new PlaylistItem(beatmaps.GetWorkingBeatmap(importedSet.Beatmaps.First(b => b.Ruleset.OnlineID == 0)).BeatmapInfo)
|
||||||
{
|
{
|
||||||
Beatmap = { Value = beatmaps.GetWorkingBeatmap(importedSet.Beatmaps.First(b => b.Ruleset.OnlineID == 0)).BeatmapInfo },
|
|
||||||
RulesetID = new OsuRuleset().RulesetInfo.OnlineID
|
RulesetID = new OsuRuleset().RulesetInfo.OnlineID
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -448,9 +439,8 @@ namespace osu.Game.Tests.Visual.Multiplayer
|
|||||||
Name = { Value = "Test Room" },
|
Name = { Value = "Test Room" },
|
||||||
Playlist =
|
Playlist =
|
||||||
{
|
{
|
||||||
new PlaylistItem
|
new PlaylistItem(beatmaps.GetWorkingBeatmap(importedSet.Beatmaps.First(b => b.Ruleset.OnlineID == 0)).BeatmapInfo)
|
||||||
{
|
{
|
||||||
Beatmap = { Value = beatmaps.GetWorkingBeatmap(importedSet.Beatmaps.First(b => b.Ruleset.OnlineID == 0)).BeatmapInfo },
|
|
||||||
RulesetID = new OsuRuleset().RulesetInfo.OnlineID
|
RulesetID = new OsuRuleset().RulesetInfo.OnlineID
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -487,9 +477,8 @@ namespace osu.Game.Tests.Visual.Multiplayer
|
|||||||
Name = { Value = "Test Room" },
|
Name = { Value = "Test Room" },
|
||||||
Playlist =
|
Playlist =
|
||||||
{
|
{
|
||||||
new PlaylistItem
|
new PlaylistItem(beatmaps.GetWorkingBeatmap(importedSet.Beatmaps.First(b => b.Ruleset.OnlineID == 0)).BeatmapInfo)
|
||||||
{
|
{
|
||||||
Beatmap = { Value = beatmaps.GetWorkingBeatmap(importedSet.Beatmaps.First(b => b.Ruleset.OnlineID == 0)).BeatmapInfo },
|
|
||||||
RulesetID = new OsuRuleset().RulesetInfo.OnlineID
|
RulesetID = new OsuRuleset().RulesetInfo.OnlineID
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -526,9 +515,8 @@ namespace osu.Game.Tests.Visual.Multiplayer
|
|||||||
Name = { Value = "Test Room" },
|
Name = { Value = "Test Room" },
|
||||||
Playlist =
|
Playlist =
|
||||||
{
|
{
|
||||||
new PlaylistItem
|
new PlaylistItem(beatmaps.GetWorkingBeatmap(importedSet.Beatmaps.First(b => b.Ruleset.OnlineID == 0)).BeatmapInfo)
|
||||||
{
|
{
|
||||||
Beatmap = { Value = beatmaps.GetWorkingBeatmap(importedSet.Beatmaps.First(b => b.Ruleset.OnlineID == 0)).BeatmapInfo },
|
|
||||||
RulesetID = new OsuRuleset().RulesetInfo.OnlineID
|
RulesetID = new OsuRuleset().RulesetInfo.OnlineID
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -560,9 +548,8 @@ namespace osu.Game.Tests.Visual.Multiplayer
|
|||||||
Name = { Value = "Test Room" },
|
Name = { Value = "Test Room" },
|
||||||
Playlist =
|
Playlist =
|
||||||
{
|
{
|
||||||
new PlaylistItem
|
new PlaylistItem(beatmaps.GetWorkingBeatmap(importedSet.Beatmaps.First(b => b.Ruleset.OnlineID == 0)).BeatmapInfo)
|
||||||
{
|
{
|
||||||
Beatmap = { Value = beatmaps.GetWorkingBeatmap(importedSet.Beatmaps.First(b => b.Ruleset.OnlineID == 0)).BeatmapInfo },
|
|
||||||
RulesetID = new OsuRuleset().RulesetInfo.OnlineID
|
RulesetID = new OsuRuleset().RulesetInfo.OnlineID
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -600,9 +587,8 @@ namespace osu.Game.Tests.Visual.Multiplayer
|
|||||||
Name = { Value = "Test Room" },
|
Name = { Value = "Test Room" },
|
||||||
Playlist =
|
Playlist =
|
||||||
{
|
{
|
||||||
new PlaylistItem
|
new PlaylistItem(beatmaps.GetWorkingBeatmap(importedSet.Beatmaps.First(b => b.Ruleset.OnlineID == 0)).BeatmapInfo)
|
||||||
{
|
{
|
||||||
Beatmap = { Value = beatmaps.GetWorkingBeatmap(importedSet.Beatmaps.First(b => b.Ruleset.OnlineID == 0)).BeatmapInfo },
|
|
||||||
RulesetID = new OsuRuleset().RulesetInfo.OnlineID
|
RulesetID = new OsuRuleset().RulesetInfo.OnlineID
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -620,9 +606,8 @@ namespace osu.Game.Tests.Visual.Multiplayer
|
|||||||
Name = { Value = "Test Room" },
|
Name = { Value = "Test Room" },
|
||||||
Playlist =
|
Playlist =
|
||||||
{
|
{
|
||||||
new PlaylistItem
|
new PlaylistItem(beatmaps.GetWorkingBeatmap(importedSet.Beatmaps.First(b => b.Ruleset.OnlineID == 0)).BeatmapInfo)
|
||||||
{
|
{
|
||||||
Beatmap = { Value = beatmaps.GetWorkingBeatmap(importedSet.Beatmaps.First(b => b.Ruleset.OnlineID == 0)).BeatmapInfo },
|
|
||||||
RulesetID = new OsuRuleset().RulesetInfo.OnlineID,
|
RulesetID = new OsuRuleset().RulesetInfo.OnlineID,
|
||||||
AllowedMods = new[] { new APIMod(new OsuModHidden()) }
|
AllowedMods = new[] { new APIMod(new OsuModHidden()) }
|
||||||
}
|
}
|
||||||
@ -660,10 +645,9 @@ namespace osu.Game.Tests.Visual.Multiplayer
|
|||||||
Name = { Value = "Test Room" },
|
Name = { Value = "Test Room" },
|
||||||
Playlist =
|
Playlist =
|
||||||
{
|
{
|
||||||
new PlaylistItem
|
new PlaylistItem(beatmaps.GetWorkingBeatmap(importedSet.Beatmaps.First(b => b.Ruleset.OnlineID == 0)).BeatmapInfo)
|
||||||
{
|
{
|
||||||
Beatmap = { Value = beatmaps.GetWorkingBeatmap(importedSet.Beatmaps.First(b => b.Ruleset.OnlineID == 0)).BeatmapInfo },
|
RulesetID = new OsuRuleset().RulesetInfo.OnlineID,
|
||||||
RulesetID = new OsuRuleset().RulesetInfo.OnlineID
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
@ -691,10 +675,9 @@ namespace osu.Game.Tests.Visual.Multiplayer
|
|||||||
QueueMode = { Value = QueueMode.AllPlayers },
|
QueueMode = { Value = QueueMode.AllPlayers },
|
||||||
Playlist =
|
Playlist =
|
||||||
{
|
{
|
||||||
new PlaylistItem
|
new PlaylistItem(beatmaps.GetWorkingBeatmap(importedSet.Beatmaps.First(b => b.Ruleset.OnlineID == 0)).BeatmapInfo)
|
||||||
{
|
{
|
||||||
Beatmap = { Value = beatmaps.GetWorkingBeatmap(importedSet.Beatmaps.First(b => b.Ruleset.OnlineID == 0)).BeatmapInfo },
|
RulesetID = new OsuRuleset().RulesetInfo.OnlineID,
|
||||||
RulesetID = new OsuRuleset().RulesetInfo.OnlineID
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}, API.LocalUser.Value);
|
}, API.LocalUser.Value);
|
||||||
@ -708,11 +691,10 @@ namespace osu.Game.Tests.Visual.Multiplayer
|
|||||||
AddStep("change server-side settings", () =>
|
AddStep("change server-side settings", () =>
|
||||||
{
|
{
|
||||||
roomManager.ServerSideRooms[0].Name.Value = "New name";
|
roomManager.ServerSideRooms[0].Name.Value = "New name";
|
||||||
roomManager.ServerSideRooms[0].Playlist.Add(new PlaylistItem
|
roomManager.ServerSideRooms[0].Playlist.Add(new PlaylistItem(beatmaps.GetWorkingBeatmap(importedSet.Beatmaps.First(b => b.Ruleset.OnlineID == 0)).BeatmapInfo)
|
||||||
{
|
{
|
||||||
ID = 2,
|
ID = 2,
|
||||||
Beatmap = { Value = beatmaps.GetWorkingBeatmap(importedSet.Beatmaps.First(b => b.Ruleset.OnlineID == 0)).BeatmapInfo },
|
RulesetID = new OsuRuleset().RulesetInfo.OnlineID,
|
||||||
RulesetID = new OsuRuleset().RulesetInfo.OnlineID
|
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -737,10 +719,9 @@ namespace osu.Game.Tests.Visual.Multiplayer
|
|||||||
QueueMode = { Value = QueueMode.AllPlayers },
|
QueueMode = { Value = QueueMode.AllPlayers },
|
||||||
Playlist =
|
Playlist =
|
||||||
{
|
{
|
||||||
new PlaylistItem
|
new PlaylistItem(beatmaps.GetWorkingBeatmap(importedSet.Beatmaps.First(b => b.Ruleset.OnlineID == 0)).BeatmapInfo)
|
||||||
{
|
{
|
||||||
Beatmap = { Value = beatmaps.GetWorkingBeatmap(importedSet.Beatmaps.First(b => b.Ruleset.OnlineID == 0)).BeatmapInfo },
|
RulesetID = new OsuRuleset().RulesetInfo.OnlineID,
|
||||||
RulesetID = new OsuRuleset().RulesetInfo.OnlineID
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
@ -773,10 +754,9 @@ namespace osu.Game.Tests.Visual.Multiplayer
|
|||||||
QueueMode = { Value = QueueMode.AllPlayers },
|
QueueMode = { Value = QueueMode.AllPlayers },
|
||||||
Playlist =
|
Playlist =
|
||||||
{
|
{
|
||||||
new PlaylistItem
|
new PlaylistItem(beatmaps.GetWorkingBeatmap(importedSet.Beatmaps.First(b => b.Ruleset.OnlineID == 0)).BeatmapInfo)
|
||||||
{
|
{
|
||||||
Beatmap = { Value = beatmaps.GetWorkingBeatmap(importedSet.Beatmaps.First(b => b.Ruleset.OnlineID == 0)).BeatmapInfo },
|
RulesetID = new OsuRuleset().RulesetInfo.OnlineID,
|
||||||
RulesetID = new OsuRuleset().RulesetInfo.OnlineID
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
@ -812,10 +792,9 @@ namespace osu.Game.Tests.Visual.Multiplayer
|
|||||||
QueueMode = { Value = QueueMode.AllPlayers },
|
QueueMode = { Value = QueueMode.AllPlayers },
|
||||||
Playlist =
|
Playlist =
|
||||||
{
|
{
|
||||||
new PlaylistItem
|
new PlaylistItem(beatmaps.GetWorkingBeatmap(importedSet.Beatmaps.First(b => b.Ruleset.OnlineID == 0)).BeatmapInfo)
|
||||||
{
|
{
|
||||||
Beatmap = { Value = beatmaps.GetWorkingBeatmap(importedSet.Beatmaps.First(b => b.Ruleset.OnlineID == 0)).BeatmapInfo },
|
RulesetID = new OsuRuleset().RulesetInfo.OnlineID,
|
||||||
RulesetID = new OsuRuleset().RulesetInfo.OnlineID
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
@ -823,10 +802,11 @@ namespace osu.Game.Tests.Visual.Multiplayer
|
|||||||
enterGameplay();
|
enterGameplay();
|
||||||
|
|
||||||
AddStep("join other user", () => client.AddUser(new APIUser { Id = 1234 }));
|
AddStep("join other user", () => client.AddUser(new APIUser { Id = 1234 }));
|
||||||
AddStep("add item as other user", () => client.AddUserPlaylistItem(1234, new MultiplayerPlaylistItem(new PlaylistItem
|
AddStep("add item as other user", () => client.AddUserPlaylistItem(1234, new MultiplayerPlaylistItem(
|
||||||
{
|
new PlaylistItem(beatmaps.GetWorkingBeatmap(importedSet.Beatmaps.First(b => b.Ruleset.OnlineID == 0)).BeatmapInfo)
|
||||||
BeatmapID = beatmaps.GetWorkingBeatmap(importedSet.Beatmaps.First(b => b.Ruleset.OnlineID == 0)).BeatmapInfo.OnlineID
|
{
|
||||||
})));
|
RulesetID = new OsuRuleset().RulesetInfo.OnlineID,
|
||||||
|
})));
|
||||||
|
|
||||||
AddUntilStep("item arrived in playlist", () => client.Room?.Playlist.Count == 2);
|
AddUntilStep("item arrived in playlist", () => client.Room?.Playlist.Count == 2);
|
||||||
|
|
||||||
@ -843,10 +823,9 @@ namespace osu.Game.Tests.Visual.Multiplayer
|
|||||||
QueueMode = { Value = QueueMode.AllPlayers },
|
QueueMode = { Value = QueueMode.AllPlayers },
|
||||||
Playlist =
|
Playlist =
|
||||||
{
|
{
|
||||||
new PlaylistItem
|
new PlaylistItem(beatmaps.GetWorkingBeatmap(importedSet.Beatmaps.First(b => b.Ruleset.OnlineID == 0)).BeatmapInfo)
|
||||||
{
|
{
|
||||||
Beatmap = { Value = beatmaps.GetWorkingBeatmap(importedSet.Beatmaps.First(b => b.Ruleset.OnlineID == 0)).BeatmapInfo },
|
RulesetID = new OsuRuleset().RulesetInfo.OnlineID,
|
||||||
RulesetID = new OsuRuleset().RulesetInfo.OnlineID
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
@ -854,10 +833,11 @@ namespace osu.Game.Tests.Visual.Multiplayer
|
|||||||
enterGameplay();
|
enterGameplay();
|
||||||
|
|
||||||
AddStep("join other user", () => client.AddUser(new APIUser { Id = 1234 }));
|
AddStep("join other user", () => client.AddUser(new APIUser { Id = 1234 }));
|
||||||
AddStep("add item as other user", () => client.AddUserPlaylistItem(1234, new MultiplayerPlaylistItem(new PlaylistItem
|
AddStep("add item as other user", () => client.AddUserPlaylistItem(1234, new MultiplayerPlaylistItem(
|
||||||
{
|
new PlaylistItem(beatmaps.GetWorkingBeatmap(importedSet.Beatmaps.First(b => b.Ruleset.OnlineID == 0)).BeatmapInfo)
|
||||||
BeatmapID = beatmaps.GetWorkingBeatmap(importedSet.Beatmaps.First(b => b.Ruleset.OnlineID == 0)).BeatmapInfo.OnlineID
|
{
|
||||||
})));
|
RulesetID = new OsuRuleset().RulesetInfo.OnlineID,
|
||||||
|
})));
|
||||||
|
|
||||||
AddUntilStep("item arrived in playlist", () => client.Room?.Playlist.Count == 2);
|
AddUntilStep("item arrived in playlist", () => client.Room?.Playlist.Count == 2);
|
||||||
|
|
||||||
@ -876,9 +856,8 @@ namespace osu.Game.Tests.Visual.Multiplayer
|
|||||||
Name = { Value = "Test Room" },
|
Name = { Value = "Test Room" },
|
||||||
Playlist =
|
Playlist =
|
||||||
{
|
{
|
||||||
new PlaylistItem
|
new PlaylistItem(beatmaps.GetWorkingBeatmap(importedSet.Beatmaps.First(b => b.Ruleset.OnlineID == 0)).BeatmapInfo)
|
||||||
{
|
{
|
||||||
Beatmap = { Value = beatmaps.GetWorkingBeatmap(importedSet.Beatmaps.First(b => b.Ruleset.OnlineID == 0)).BeatmapInfo },
|
|
||||||
RulesetID = new OsuRuleset().RulesetInfo.OnlineID
|
RulesetID = new OsuRuleset().RulesetInfo.OnlineID
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -73,9 +73,8 @@ namespace osu.Game.Tests.Visual.Multiplayer
|
|||||||
{
|
{
|
||||||
AddStep("add playlist item", () =>
|
AddStep("add playlist item", () =>
|
||||||
{
|
{
|
||||||
SelectedRoom.Value.Playlist.Add(new PlaylistItem
|
SelectedRoom.Value.Playlist.Add(new PlaylistItem(new TestBeatmap(new OsuRuleset().RulesetInfo).BeatmapInfo)
|
||||||
{
|
{
|
||||||
Beatmap = { Value = new TestBeatmap(new OsuRuleset().RulesetInfo).BeatmapInfo },
|
|
||||||
RulesetID = new OsuRuleset().RulesetInfo.OnlineID
|
RulesetID = new OsuRuleset().RulesetInfo.OnlineID
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
@ -90,9 +89,8 @@ namespace osu.Game.Tests.Visual.Multiplayer
|
|||||||
{
|
{
|
||||||
AddStep("add playlist item", () =>
|
AddStep("add playlist item", () =>
|
||||||
{
|
{
|
||||||
SelectedRoom.Value.Playlist.Add(new PlaylistItem
|
SelectedRoom.Value.Playlist.Add(new PlaylistItem(new TestBeatmap(new TaikoRuleset().RulesetInfo).BeatmapInfo)
|
||||||
{
|
{
|
||||||
Beatmap = { Value = new TestBeatmap(new TaikoRuleset().RulesetInfo).BeatmapInfo },
|
|
||||||
RulesetID = new TaikoRuleset().RulesetInfo.OnlineID,
|
RulesetID = new TaikoRuleset().RulesetInfo.OnlineID,
|
||||||
AllowedMods = new[] { new APIMod(new TaikoModSwap()) }
|
AllowedMods = new[] { new APIMod(new TaikoModSwap()) }
|
||||||
});
|
});
|
||||||
@ -113,9 +111,8 @@ namespace osu.Game.Tests.Visual.Multiplayer
|
|||||||
|
|
||||||
AddStep("set playlist", () =>
|
AddStep("set playlist", () =>
|
||||||
{
|
{
|
||||||
SelectedRoom.Value.Playlist.Add(new PlaylistItem
|
SelectedRoom.Value.Playlist.Add(new PlaylistItem(new TestBeatmap(new OsuRuleset().RulesetInfo).BeatmapInfo)
|
||||||
{
|
{
|
||||||
Beatmap = { Value = new TestBeatmap(new OsuRuleset().RulesetInfo).BeatmapInfo },
|
|
||||||
RulesetID = new OsuRuleset().RulesetInfo.OnlineID
|
RulesetID = new OsuRuleset().RulesetInfo.OnlineID
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
@ -128,9 +125,8 @@ namespace osu.Game.Tests.Visual.Multiplayer
|
|||||||
{
|
{
|
||||||
AddStep("set playlist", () =>
|
AddStep("set playlist", () =>
|
||||||
{
|
{
|
||||||
SelectedRoom.Value.Playlist.Add(new PlaylistItem
|
SelectedRoom.Value.Playlist.Add(new PlaylistItem(beatmaps.GetWorkingBeatmap(importedSet.Beatmaps.First()).BeatmapInfo)
|
||||||
{
|
{
|
||||||
Beatmap = { Value = beatmaps.GetWorkingBeatmap(importedSet.Beatmaps.First()).BeatmapInfo },
|
|
||||||
RulesetID = new OsuRuleset().RulesetInfo.OnlineID
|
RulesetID = new OsuRuleset().RulesetInfo.OnlineID
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
@ -159,9 +155,8 @@ namespace osu.Game.Tests.Visual.Multiplayer
|
|||||||
{
|
{
|
||||||
AddStep("add playlist item with allowed mod", () =>
|
AddStep("add playlist item with allowed mod", () =>
|
||||||
{
|
{
|
||||||
SelectedRoom.Value.Playlist.Add(new PlaylistItem
|
SelectedRoom.Value.Playlist.Add(new PlaylistItem(new TestBeatmap(new OsuRuleset().RulesetInfo).BeatmapInfo)
|
||||||
{
|
{
|
||||||
Beatmap = { Value = new TestBeatmap(new OsuRuleset().RulesetInfo).BeatmapInfo },
|
|
||||||
RulesetID = new OsuRuleset().RulesetInfo.OnlineID,
|
RulesetID = new OsuRuleset().RulesetInfo.OnlineID,
|
||||||
AllowedMods = new[] { new APIMod(new OsuModDoubleTime()) }
|
AllowedMods = new[] { new APIMod(new OsuModDoubleTime()) }
|
||||||
});
|
});
|
||||||
|
@ -28,9 +28,8 @@ namespace osu.Game.Tests.Visual.Multiplayer
|
|||||||
|
|
||||||
AddStep("initialise gameplay", () =>
|
AddStep("initialise gameplay", () =>
|
||||||
{
|
{
|
||||||
Stack.Push(player = new MultiplayerPlayer(Client.APIRoom, new PlaylistItem
|
Stack.Push(player = new MultiplayerPlayer(Client.APIRoom, new PlaylistItem(Beatmap.Value.BeatmapInfo)
|
||||||
{
|
{
|
||||||
Beatmap = { Value = Beatmap.Value.BeatmapInfo },
|
|
||||||
RulesetID = Beatmap.Value.BeatmapInfo.Ruleset.OnlineID,
|
RulesetID = Beatmap.Value.BeatmapInfo.Ruleset.OnlineID,
|
||||||
}, Client.Room?.Users.ToArray()));
|
}, Client.Room?.Users.ToArray()));
|
||||||
});
|
});
|
||||||
|
@ -143,14 +143,12 @@ namespace osu.Game.Tests.Visual.Multiplayer
|
|||||||
Name = { Value = "test name" },
|
Name = { Value = "test name" },
|
||||||
Playlist =
|
Playlist =
|
||||||
{
|
{
|
||||||
new PlaylistItem
|
new PlaylistItem(new TestBeatmap(Ruleset.Value).BeatmapInfo)
|
||||||
{
|
{
|
||||||
Beatmap = { Value = new TestBeatmap(Ruleset.Value).BeatmapInfo },
|
RulesetID = Ruleset.Value.OnlineID
|
||||||
RulesetID = Ruleset.Value.OnlineID,
|
|
||||||
},
|
},
|
||||||
new PlaylistItem
|
new PlaylistItem(new TestBeatmap(Ruleset.Value).BeatmapInfo)
|
||||||
{
|
{
|
||||||
Beatmap = { Value = new TestBeatmap(Ruleset.Value).BeatmapInfo },
|
|
||||||
RulesetID = Ruleset.Value.OnlineID,
|
RulesetID = Ruleset.Value.OnlineID,
|
||||||
Expired = true
|
Expired = true
|
||||||
}
|
}
|
||||||
@ -167,10 +165,8 @@ namespace osu.Game.Tests.Visual.Multiplayer
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// Adds a step to create a new playlist item.
|
/// Adds a step to create a new playlist item.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
private void addItemStep(bool expired = false) => AddStep("add item", () => Client.AddPlaylistItem(new MultiplayerPlaylistItem(new PlaylistItem
|
private void addItemStep(bool expired = false) => AddStep("add item", () => Client.AddPlaylistItem(new MultiplayerPlaylistItem(new PlaylistItem(importedBeatmap)
|
||||||
{
|
{
|
||||||
Beatmap = { Value = importedBeatmap },
|
|
||||||
BeatmapID = importedBeatmap.OnlineID,
|
|
||||||
Expired = expired,
|
Expired = expired,
|
||||||
PlayedAt = DateTimeOffset.Now
|
PlayedAt = DateTimeOffset.Now
|
||||||
})));
|
})));
|
||||||
|
@ -120,11 +120,7 @@ namespace osu.Game.Tests.Visual.Multiplayer
|
|||||||
|
|
||||||
AddStep("add playlist item", () =>
|
AddStep("add playlist item", () =>
|
||||||
{
|
{
|
||||||
MultiplayerPlaylistItem item = new MultiplayerPlaylistItem(new PlaylistItem
|
MultiplayerPlaylistItem item = new MultiplayerPlaylistItem(new PlaylistItem(importedBeatmap));
|
||||||
{
|
|
||||||
Beatmap = { Value = importedBeatmap },
|
|
||||||
BeatmapID = importedBeatmap.OnlineID,
|
|
||||||
});
|
|
||||||
|
|
||||||
Client.AddUserPlaylistItem(userId(), item);
|
Client.AddUserPlaylistItem(userId(), item);
|
||||||
|
|
||||||
|
@ -54,9 +54,8 @@ namespace osu.Game.Tests.Visual.Multiplayer
|
|||||||
|
|
||||||
importedSet = beatmaps.GetAllUsableBeatmapSets().First();
|
importedSet = beatmaps.GetAllUsableBeatmapSets().First();
|
||||||
Beatmap.Value = beatmaps.GetWorkingBeatmap(importedSet.Beatmaps.First());
|
Beatmap.Value = beatmaps.GetWorkingBeatmap(importedSet.Beatmaps.First());
|
||||||
selectedItem.Value = new PlaylistItem
|
selectedItem.Value = new PlaylistItem(Beatmap.Value.BeatmapInfo)
|
||||||
{
|
{
|
||||||
Beatmap = { Value = Beatmap.Value.BeatmapInfo },
|
|
||||||
RulesetID = Beatmap.Value.BeatmapInfo.Ruleset.OnlineID
|
RulesetID = Beatmap.Value.BeatmapInfo.Ruleset.OnlineID
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -22,12 +22,7 @@ namespace osu.Game.Tests.Visual.Multiplayer
|
|||||||
var beatmapInfo = CreateBeatmap(rulesetInfo).BeatmapInfo;
|
var beatmapInfo = CreateBeatmap(rulesetInfo).BeatmapInfo;
|
||||||
var score = TestResources.CreateTestScoreInfo(beatmapInfo);
|
var score = TestResources.CreateTestScoreInfo(beatmapInfo);
|
||||||
|
|
||||||
PlaylistItem playlistItem = new PlaylistItem
|
Stack.Push(screen = new MultiplayerResultsScreen(score, 1, new PlaylistItem(beatmapInfo)));
|
||||||
{
|
|
||||||
BeatmapID = beatmapInfo.OnlineID,
|
|
||||||
};
|
|
||||||
|
|
||||||
Stack.Push(screen = new MultiplayerResultsScreen(score, 1, playlistItem));
|
|
||||||
});
|
});
|
||||||
|
|
||||||
AddUntilStep("wait for loaded", () => screen.IsLoaded);
|
AddUntilStep("wait for loaded", () => screen.IsLoaded);
|
||||||
|
@ -55,9 +55,8 @@ namespace osu.Game.Tests.Visual.Multiplayer
|
|||||||
|
|
||||||
importedSet = beatmaps.GetAllUsableBeatmapSets().First();
|
importedSet = beatmaps.GetAllUsableBeatmapSets().First();
|
||||||
Beatmap.Value = beatmaps.GetWorkingBeatmap(importedSet.Beatmaps.First());
|
Beatmap.Value = beatmaps.GetWorkingBeatmap(importedSet.Beatmaps.First());
|
||||||
selectedItem.Value = new PlaylistItem
|
selectedItem.Value = new PlaylistItem(Beatmap.Value.BeatmapInfo)
|
||||||
{
|
{
|
||||||
Beatmap = { Value = Beatmap.Value.BeatmapInfo },
|
|
||||||
RulesetID = Beatmap.Value.BeatmapInfo.Ruleset.OnlineID,
|
RulesetID = Beatmap.Value.BeatmapInfo.Ruleset.OnlineID,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -26,18 +26,13 @@ namespace osu.Game.Tests.Visual.Multiplayer
|
|||||||
var beatmapInfo = CreateBeatmap(rulesetInfo).BeatmapInfo;
|
var beatmapInfo = CreateBeatmap(rulesetInfo).BeatmapInfo;
|
||||||
var score = TestResources.CreateTestScoreInfo(beatmapInfo);
|
var score = TestResources.CreateTestScoreInfo(beatmapInfo);
|
||||||
|
|
||||||
PlaylistItem playlistItem = new PlaylistItem
|
|
||||||
{
|
|
||||||
BeatmapID = beatmapInfo.OnlineID,
|
|
||||||
};
|
|
||||||
|
|
||||||
SortedDictionary<int, BindableInt> teamScores = new SortedDictionary<int, BindableInt>
|
SortedDictionary<int, BindableInt> teamScores = new SortedDictionary<int, BindableInt>
|
||||||
{
|
{
|
||||||
{ 0, new BindableInt(team1Score) },
|
{ 0, new BindableInt(team1Score) },
|
||||||
{ 1, new BindableInt(team2Score) }
|
{ 1, new BindableInt(team2Score) }
|
||||||
};
|
};
|
||||||
|
|
||||||
Stack.Push(screen = new MultiplayerTeamResultsScreen(score, 1, playlistItem, teamScores));
|
Stack.Push(screen = new MultiplayerTeamResultsScreen(score, 1, new PlaylistItem(beatmapInfo), teamScores));
|
||||||
});
|
});
|
||||||
|
|
||||||
AddUntilStep("wait for loaded", () => screen.IsLoaded);
|
AddUntilStep("wait for loaded", () => screen.IsLoaded);
|
||||||
|
@ -107,16 +107,6 @@ namespace osu.Game.Tests.Visual.Multiplayer
|
|||||||
AddAssert("item 0 is selected", () => playlist.SelectedItem.Value == playlist.Items[0]);
|
AddAssert("item 0 is selected", () => playlist.SelectedItem.Value == playlist.Items[0]);
|
||||||
}
|
}
|
||||||
|
|
||||||
[Test]
|
|
||||||
public void TestChangeBeatmapAndRemove()
|
|
||||||
{
|
|
||||||
createPlaylist();
|
|
||||||
|
|
||||||
AddStep("change beatmap of first item", () => playlist.Items[0].BeatmapID = 30);
|
|
||||||
moveToDeleteButton(0);
|
|
||||||
AddStep("click delete button", () => InputManager.Click(MouseButton.Left));
|
|
||||||
}
|
|
||||||
|
|
||||||
private void moveToItem(int index, Vector2? offset = null)
|
private void moveToItem(int index, Vector2? offset = null)
|
||||||
=> AddStep($"move mouse to item {index}", () => InputManager.MoveMouseTo(playlist.ChildrenOfType<DifficultyIcon>().ElementAt(index), offset));
|
=> AddStep($"move mouse to item {index}", () => InputManager.MoveMouseTo(playlist.ChildrenOfType<DifficultyIcon>().ElementAt(index), offset));
|
||||||
|
|
||||||
@ -139,25 +129,21 @@ namespace osu.Game.Tests.Visual.Multiplayer
|
|||||||
|
|
||||||
for (int i = 0; i < 20; i++)
|
for (int i = 0; i < 20; i++)
|
||||||
{
|
{
|
||||||
playlist.Items.Add(new PlaylistItem
|
playlist.Items.Add(new PlaylistItem(i % 2 == 1
|
||||||
|
? new TestBeatmap(new OsuRuleset().RulesetInfo).BeatmapInfo
|
||||||
|
: new BeatmapInfo
|
||||||
|
{
|
||||||
|
Metadata = new BeatmapMetadata
|
||||||
|
{
|
||||||
|
Artist = "Artist",
|
||||||
|
Author = new RealmUser { Username = "Creator name here" },
|
||||||
|
Title = "Long title used to check background colour",
|
||||||
|
},
|
||||||
|
BeatmapSet = new BeatmapSetInfo()
|
||||||
|
})
|
||||||
{
|
{
|
||||||
ID = i,
|
ID = i,
|
||||||
OwnerID = 2,
|
OwnerID = 2,
|
||||||
Beatmap =
|
|
||||||
{
|
|
||||||
Value = i % 2 == 1
|
|
||||||
? new TestBeatmap(new OsuRuleset().RulesetInfo).BeatmapInfo
|
|
||||||
: new BeatmapInfo
|
|
||||||
{
|
|
||||||
Metadata = new BeatmapMetadata
|
|
||||||
{
|
|
||||||
Artist = "Artist",
|
|
||||||
Author = new RealmUser { Username = "Creator name here" },
|
|
||||||
Title = "Long title used to check background colour",
|
|
||||||
},
|
|
||||||
BeatmapSet = new BeatmapSetInfo()
|
|
||||||
}
|
|
||||||
},
|
|
||||||
RulesetID = new OsuRuleset().RulesetInfo.OnlineID,
|
RulesetID = new OsuRuleset().RulesetInfo.OnlineID,
|
||||||
RequiredMods = new[]
|
RequiredMods = new[]
|
||||||
{
|
{
|
||||||
|
@ -31,8 +31,8 @@ namespace osu.Game.Tests.Visual.Multiplayer
|
|||||||
{
|
{
|
||||||
SelectedRoom.Value.Playlist.AddRange(new[]
|
SelectedRoom.Value.Playlist.AddRange(new[]
|
||||||
{
|
{
|
||||||
new PlaylistItem { Beatmap = { Value = new BeatmapInfo { StarRating = min } } },
|
new PlaylistItem(new BeatmapInfo { StarRating = min }),
|
||||||
new PlaylistItem { Beatmap = { Value = new BeatmapInfo { StarRating = max } } },
|
new PlaylistItem(new BeatmapInfo { StarRating = max }),
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@ -67,9 +67,8 @@ namespace osu.Game.Tests.Visual.Multiplayer
|
|||||||
Type = { Value = MatchType.TeamVersus },
|
Type = { Value = MatchType.TeamVersus },
|
||||||
Playlist =
|
Playlist =
|
||||||
{
|
{
|
||||||
new PlaylistItem
|
new PlaylistItem(beatmaps.GetWorkingBeatmap(importedSet.Beatmaps.First(b => b.Ruleset.OnlineID == 0)).BeatmapInfo)
|
||||||
{
|
{
|
||||||
Beatmap = { Value = beatmaps.GetWorkingBeatmap(importedSet.Beatmaps.First(b => b.Ruleset.OnlineID == 0)).BeatmapInfo },
|
|
||||||
RulesetID = new OsuRuleset().RulesetInfo.OnlineID
|
RulesetID = new OsuRuleset().RulesetInfo.OnlineID
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -88,9 +87,8 @@ namespace osu.Game.Tests.Visual.Multiplayer
|
|||||||
Type = { Value = MatchType.TeamVersus },
|
Type = { Value = MatchType.TeamVersus },
|
||||||
Playlist =
|
Playlist =
|
||||||
{
|
{
|
||||||
new PlaylistItem
|
new PlaylistItem(beatmaps.GetWorkingBeatmap(importedSet.Beatmaps.First(b => b.Ruleset.OnlineID == 0)).BeatmapInfo)
|
||||||
{
|
{
|
||||||
Beatmap = { Value = beatmaps.GetWorkingBeatmap(importedSet.Beatmaps.First(b => b.Ruleset.OnlineID == 0)).BeatmapInfo },
|
|
||||||
RulesetID = new OsuRuleset().RulesetInfo.OnlineID
|
RulesetID = new OsuRuleset().RulesetInfo.OnlineID
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -126,10 +124,9 @@ namespace osu.Game.Tests.Visual.Multiplayer
|
|||||||
Type = { Value = MatchType.HeadToHead },
|
Type = { Value = MatchType.HeadToHead },
|
||||||
Playlist =
|
Playlist =
|
||||||
{
|
{
|
||||||
new PlaylistItem
|
new PlaylistItem(beatmaps.GetWorkingBeatmap(importedSet.Beatmaps.First(b => b.Ruleset.OnlineID == 0)).BeatmapInfo)
|
||||||
{
|
{
|
||||||
Beatmap = { Value = beatmaps.GetWorkingBeatmap(importedSet.Beatmaps.First(b => b.Ruleset.OnlineID == 0)).BeatmapInfo },
|
RulesetID = new OsuRuleset().RulesetInfo.OnlineID,
|
||||||
RulesetID = new OsuRuleset().RulesetInfo.OnlineID
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
@ -152,10 +149,9 @@ namespace osu.Game.Tests.Visual.Multiplayer
|
|||||||
Name = { Value = "Test Room" },
|
Name = { Value = "Test Room" },
|
||||||
Playlist =
|
Playlist =
|
||||||
{
|
{
|
||||||
new PlaylistItem
|
new PlaylistItem(beatmaps.GetWorkingBeatmap(importedSet.Beatmaps.First(b => b.Ruleset.OnlineID == 0)).BeatmapInfo)
|
||||||
{
|
{
|
||||||
Beatmap = { Value = beatmaps.GetWorkingBeatmap(importedSet.Beatmaps.First(b => b.Ruleset.OnlineID == 0)).BeatmapInfo },
|
RulesetID = new OsuRuleset().RulesetInfo.OnlineID,
|
||||||
RulesetID = new OsuRuleset().RulesetInfo.OnlineID
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
@ -49,7 +49,7 @@ namespace osu.Game.Tests.Visual.Playlists
|
|||||||
AddStep("set name", () => SelectedRoom.Value.Name.Value = "Room name");
|
AddStep("set name", () => SelectedRoom.Value.Name.Value = "Room name");
|
||||||
AddAssert("button disabled", () => !settings.ApplyButton.Enabled.Value);
|
AddAssert("button disabled", () => !settings.ApplyButton.Enabled.Value);
|
||||||
|
|
||||||
AddStep("set beatmap", () => SelectedRoom.Value.Playlist.Add(new PlaylistItem { Beatmap = { Value = CreateBeatmap(Ruleset.Value).BeatmapInfo } }));
|
AddStep("set beatmap", () => SelectedRoom.Value.Playlist.Add(new PlaylistItem(CreateBeatmap(Ruleset.Value).BeatmapInfo)));
|
||||||
AddAssert("button enabled", () => settings.ApplyButton.Enabled.Value);
|
AddAssert("button enabled", () => settings.ApplyButton.Enabled.Value);
|
||||||
|
|
||||||
AddStep("clear name", () => SelectedRoom.Value.Name.Value = "");
|
AddStep("clear name", () => SelectedRoom.Value.Name.Value = "");
|
||||||
@ -68,7 +68,7 @@ namespace osu.Game.Tests.Visual.Playlists
|
|||||||
{
|
{
|
||||||
settings.NameField.Current.Value = expected_name;
|
settings.NameField.Current.Value = expected_name;
|
||||||
settings.DurationField.Current.Value = expectedDuration;
|
settings.DurationField.Current.Value = expectedDuration;
|
||||||
SelectedRoom.Value.Playlist.Add(new PlaylistItem { Beatmap = { Value = CreateBeatmap(Ruleset.Value).BeatmapInfo } });
|
SelectedRoom.Value.Playlist.Add(new PlaylistItem(CreateBeatmap(Ruleset.Value).BeatmapInfo));
|
||||||
|
|
||||||
RoomManager.CreateRequested = r =>
|
RoomManager.CreateRequested = r =>
|
||||||
{
|
{
|
||||||
@ -94,7 +94,7 @@ namespace osu.Game.Tests.Visual.Playlists
|
|||||||
var beatmap = CreateBeatmap(Ruleset.Value).BeatmapInfo;
|
var beatmap = CreateBeatmap(Ruleset.Value).BeatmapInfo;
|
||||||
|
|
||||||
SelectedRoom.Value.Name.Value = "Test Room";
|
SelectedRoom.Value.Name.Value = "Test Room";
|
||||||
SelectedRoom.Value.Playlist.Add(new PlaylistItem { Beatmap = { Value = beatmap } });
|
SelectedRoom.Value.Playlist.Add(new PlaylistItem(beatmap));
|
||||||
|
|
||||||
errorMessage = $"{not_found_prefix} {beatmap.OnlineID}";
|
errorMessage = $"{not_found_prefix} {beatmap.OnlineID}";
|
||||||
|
|
||||||
@ -121,7 +121,7 @@ namespace osu.Game.Tests.Visual.Playlists
|
|||||||
AddStep("setup", () =>
|
AddStep("setup", () =>
|
||||||
{
|
{
|
||||||
SelectedRoom.Value.Name.Value = "Test Room";
|
SelectedRoom.Value.Name.Value = "Test Room";
|
||||||
SelectedRoom.Value.Playlist.Add(new PlaylistItem { Beatmap = { Value = CreateBeatmap(Ruleset.Value).BeatmapInfo } });
|
SelectedRoom.Value.Playlist.Add(new PlaylistItem(CreateBeatmap(Ruleset.Value).BeatmapInfo));
|
||||||
|
|
||||||
RoomManager.CreateRequested = _ => failText;
|
RoomManager.CreateRequested = _ => failText;
|
||||||
});
|
});
|
||||||
|
@ -165,9 +165,8 @@ namespace osu.Game.Tests.Visual.Playlists
|
|||||||
{
|
{
|
||||||
AddStep("load results", () =>
|
AddStep("load results", () =>
|
||||||
{
|
{
|
||||||
LoadScreen(resultsScreen = new TestResultsScreen(getScore?.Invoke(), 1, new PlaylistItem
|
LoadScreen(resultsScreen = new TestResultsScreen(getScore?.Invoke(), 1, new PlaylistItem(new TestBeatmap(new OsuRuleset().RulesetInfo).BeatmapInfo)
|
||||||
{
|
{
|
||||||
Beatmap = { Value = new TestBeatmap(new OsuRuleset().RulesetInfo).BeatmapInfo },
|
|
||||||
RulesetID = new OsuRuleset().RulesetInfo.OnlineID
|
RulesetID = new OsuRuleset().RulesetInfo.OnlineID
|
||||||
}));
|
}));
|
||||||
});
|
});
|
||||||
|
@ -64,9 +64,8 @@ namespace osu.Game.Tests.Visual.Playlists
|
|||||||
room.Host.Value = API.LocalUser.Value;
|
room.Host.Value = API.LocalUser.Value;
|
||||||
room.RecentParticipants.Add(room.Host.Value);
|
room.RecentParticipants.Add(room.Host.Value);
|
||||||
room.EndDate.Value = DateTimeOffset.Now.AddMinutes(5);
|
room.EndDate.Value = DateTimeOffset.Now.AddMinutes(5);
|
||||||
room.Playlist.Add(new PlaylistItem
|
room.Playlist.Add(new PlaylistItem(importedBeatmap.Beatmaps.First())
|
||||||
{
|
{
|
||||||
Beatmap = { Value = importedBeatmap.Beatmaps.First() },
|
|
||||||
RulesetID = new OsuRuleset().RulesetInfo.OnlineID
|
RulesetID = new OsuRuleset().RulesetInfo.OnlineID
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
@ -89,9 +88,8 @@ namespace osu.Game.Tests.Visual.Playlists
|
|||||||
room.Host.Value = API.LocalUser.Value;
|
room.Host.Value = API.LocalUser.Value;
|
||||||
room.RecentParticipants.Add(room.Host.Value);
|
room.RecentParticipants.Add(room.Host.Value);
|
||||||
room.EndDate.Value = DateTimeOffset.Now.AddMinutes(5);
|
room.EndDate.Value = DateTimeOffset.Now.AddMinutes(5);
|
||||||
room.Playlist.Add(new PlaylistItem
|
room.Playlist.Add(new PlaylistItem(importedBeatmap.Beatmaps.First())
|
||||||
{
|
{
|
||||||
Beatmap = { Value = importedBeatmap.Beatmaps.First() },
|
|
||||||
RulesetID = new OsuRuleset().RulesetInfo.OnlineID
|
RulesetID = new OsuRuleset().RulesetInfo.OnlineID
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
@ -106,9 +104,8 @@ namespace osu.Game.Tests.Visual.Playlists
|
|||||||
{
|
{
|
||||||
room.Name.Value = "my awesome room";
|
room.Name.Value = "my awesome room";
|
||||||
room.Host.Value = API.LocalUser.Value;
|
room.Host.Value = API.LocalUser.Value;
|
||||||
room.Playlist.Add(new PlaylistItem
|
room.Playlist.Add(new PlaylistItem(importedBeatmap.Beatmaps.First())
|
||||||
{
|
{
|
||||||
Beatmap = { Value = importedBeatmap.Beatmaps.First() },
|
|
||||||
RulesetID = new OsuRuleset().RulesetInfo.OnlineID
|
RulesetID = new OsuRuleset().RulesetInfo.OnlineID
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
@ -158,21 +155,17 @@ namespace osu.Game.Tests.Visual.Playlists
|
|||||||
{
|
{
|
||||||
room.Name.Value = "my awesome room";
|
room.Name.Value = "my awesome room";
|
||||||
room.Host.Value = API.LocalUser.Value;
|
room.Host.Value = API.LocalUser.Value;
|
||||||
room.Playlist.Add(new PlaylistItem
|
room.Playlist.Add(new PlaylistItem(new BeatmapInfo
|
||||||
{
|
{
|
||||||
Beatmap =
|
MD5Hash = realHash,
|
||||||
|
OnlineID = realOnlineId,
|
||||||
|
Metadata = new BeatmapMetadata(),
|
||||||
|
BeatmapSet = new BeatmapSetInfo
|
||||||
{
|
{
|
||||||
Value = new BeatmapInfo
|
OnlineID = realOnlineSetId,
|
||||||
{
|
}
|
||||||
MD5Hash = realHash,
|
})
|
||||||
OnlineID = realOnlineId,
|
{
|
||||||
Metadata = new BeatmapMetadata(),
|
|
||||||
BeatmapSet = new BeatmapSetInfo
|
|
||||||
{
|
|
||||||
OnlineID = realOnlineSetId,
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
RulesetID = new OsuRuleset().RulesetInfo.OnlineID
|
RulesetID = new OsuRuleset().RulesetInfo.OnlineID
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
@ -727,10 +727,9 @@ namespace osu.Game.Online.Multiplayer
|
|||||||
RoomUpdated?.Invoke();
|
RoomUpdated?.Invoke();
|
||||||
}
|
}
|
||||||
|
|
||||||
private PlaylistItem createPlaylistItem(MultiplayerPlaylistItem item) => new PlaylistItem
|
private PlaylistItem createPlaylistItem(MultiplayerPlaylistItem item) => new PlaylistItem(new APIBeatmap { OnlineID = item.BeatmapID })
|
||||||
{
|
{
|
||||||
ID = item.ID,
|
ID = item.ID,
|
||||||
BeatmapID = item.BeatmapID,
|
|
||||||
OwnerID = item.OwnerID,
|
OwnerID = item.OwnerID,
|
||||||
RulesetID = item.RulesetID,
|
RulesetID = item.RulesetID,
|
||||||
Expired = item.Expired,
|
Expired = item.Expired,
|
||||||
@ -740,14 +739,6 @@ namespace osu.Game.Online.Multiplayer
|
|||||||
AllowedMods = item.AllowedMods.ToArray()
|
AllowedMods = item.AllowedMods.ToArray()
|
||||||
};
|
};
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Retrieves a <see cref="APIBeatmap"/> from an online source.
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="beatmapId">The beatmap ID.</param>
|
|
||||||
/// <param name="cancellationToken">A token to cancel the request.</param>
|
|
||||||
/// <returns>The <see cref="APIBeatmap"/> retrieval task.</returns>
|
|
||||||
public abstract Task<APIBeatmap> GetAPIBeatmap(int beatmapId, CancellationToken cancellationToken = default);
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// For the provided user ID, update whether the user is included in <see cref="CurrentMatchPlayingUserIds"/>.
|
/// For the provided user ID, update whether the user is included in <see cref="CurrentMatchPlayingUserIds"/>.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
@ -9,9 +9,7 @@ using System.Threading.Tasks;
|
|||||||
using Microsoft.AspNetCore.SignalR.Client;
|
using Microsoft.AspNetCore.SignalR.Client;
|
||||||
using osu.Framework.Allocation;
|
using osu.Framework.Allocation;
|
||||||
using osu.Framework.Bindables;
|
using osu.Framework.Bindables;
|
||||||
using osu.Game.Database;
|
|
||||||
using osu.Game.Online.API;
|
using osu.Game.Online.API;
|
||||||
using osu.Game.Online.API.Requests.Responses;
|
|
||||||
using osu.Game.Online.Rooms;
|
using osu.Game.Online.Rooms;
|
||||||
|
|
||||||
namespace osu.Game.Online.Multiplayer
|
namespace osu.Game.Online.Multiplayer
|
||||||
@ -29,9 +27,6 @@ namespace osu.Game.Online.Multiplayer
|
|||||||
|
|
||||||
private HubConnection? connection => connector?.CurrentConnection;
|
private HubConnection? connection => connector?.CurrentConnection;
|
||||||
|
|
||||||
[Resolved]
|
|
||||||
private BeatmapLookupCache beatmapLookupCache { get; set; } = null!;
|
|
||||||
|
|
||||||
public OnlineMultiplayerClient(EndpointConfiguration endpoints)
|
public OnlineMultiplayerClient(EndpointConfiguration endpoints)
|
||||||
{
|
{
|
||||||
endpoint = endpoints.MultiplayerEndpointUrl;
|
endpoint = endpoints.MultiplayerEndpointUrl;
|
||||||
@ -186,11 +181,6 @@ namespace osu.Game.Online.Multiplayer
|
|||||||
return connection.InvokeAsync(nameof(IMultiplayerServer.RemovePlaylistItem), playlistItemId);
|
return connection.InvokeAsync(nameof(IMultiplayerServer.RemovePlaylistItem), playlistItemId);
|
||||||
}
|
}
|
||||||
|
|
||||||
public override Task<APIBeatmap> GetAPIBeatmap(int beatmapId, CancellationToken cancellationToken = default)
|
|
||||||
{
|
|
||||||
return beatmapLookupCache.GetBeatmapAsync(beatmapId, cancellationToken);
|
|
||||||
}
|
|
||||||
|
|
||||||
protected override void Dispose(bool isDisposing)
|
protected override void Dispose(bool isDisposing)
|
||||||
{
|
{
|
||||||
base.Dispose(isDisposing);
|
base.Dispose(isDisposing);
|
||||||
|
@ -63,8 +63,8 @@ namespace osu.Game.Online.Rooms
|
|||||||
{
|
{
|
||||||
ID = item.ID;
|
ID = item.ID;
|
||||||
OwnerID = item.OwnerID;
|
OwnerID = item.OwnerID;
|
||||||
BeatmapID = item.BeatmapID;
|
BeatmapID = item.Beatmap.OnlineID;
|
||||||
BeatmapChecksum = item.Beatmap.Value?.MD5Hash ?? string.Empty;
|
BeatmapChecksum = item.Beatmap.MD5Hash;
|
||||||
RulesetID = item.RulesetID;
|
RulesetID = item.RulesetID;
|
||||||
RequiredMods = item.RequiredMods.ToArray();
|
RequiredMods = item.RequiredMods.ToArray();
|
||||||
AllowedMods = item.AllowedMods.ToArray();
|
AllowedMods = item.AllowedMods.ToArray();
|
||||||
|
@ -64,11 +64,11 @@ namespace osu.Game.Online.Rooms
|
|||||||
|
|
||||||
downloadTracker?.RemoveAndDisposeImmediately();
|
downloadTracker?.RemoveAndDisposeImmediately();
|
||||||
|
|
||||||
beatmapLookupCache.GetBeatmapAsync(item.NewValue.Beatmap.Value.OnlineID).ContinueWith(task => Schedule(() =>
|
beatmapLookupCache.GetBeatmapAsync(item.NewValue.Beatmap.OnlineID).ContinueWith(task => Schedule(() =>
|
||||||
{
|
{
|
||||||
var beatmap = task.GetResultSafely();
|
var beatmap = task.GetResultSafely();
|
||||||
|
|
||||||
if (SelectedItem.Value?.Beatmap.Value.OnlineID == beatmap.OnlineID)
|
if (SelectedItem.Value?.Beatmap.OnlineID == beatmap.OnlineID)
|
||||||
beginTracking(beatmap);
|
beginTracking(beatmap);
|
||||||
}), TaskContinuationOptions.OnlyOnRanToCompletion);
|
}), TaskContinuationOptions.OnlyOnRanToCompletion);
|
||||||
}, true);
|
}, true);
|
||||||
@ -96,7 +96,7 @@ namespace osu.Game.Online.Rooms
|
|||||||
|
|
||||||
// handles changes to hash that didn't occur from the import process (ie. a user editing the beatmap in the editor, somehow).
|
// handles changes to hash that didn't occur from the import process (ie. a user editing the beatmap in the editor, somehow).
|
||||||
realmSubscription?.Dispose();
|
realmSubscription?.Dispose();
|
||||||
realmSubscription = realm.RegisterForNotifications(r => QueryBeatmapForOnlinePlay(r, SelectedItem.Value.Beatmap.Value), (items, changes, ___) =>
|
realmSubscription = realm.RegisterForNotifications(r => QueryBeatmapForOnlinePlay(r, SelectedItem.Value.Beatmap), (items, changes, ___) =>
|
||||||
{
|
{
|
||||||
if (changes == null)
|
if (changes == null)
|
||||||
return;
|
return;
|
||||||
|
@ -41,6 +41,6 @@ namespace osu.Game.Online.Rooms
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static string GetTotalDuration(this BindableList<PlaylistItem> playlist) =>
|
public static string GetTotalDuration(this BindableList<PlaylistItem> playlist) =>
|
||||||
playlist.Select(p => p.Beatmap.Value.Length).Sum().Milliseconds().Humanize(minUnit: TimeUnit.Second, maxUnit: TimeUnit.Hour, precision: 2);
|
playlist.Select(p => p.Beatmap.Length).Sum().Milliseconds().Humanize(minUnit: TimeUnit.Second, maxUnit: TimeUnit.Hour, precision: 2);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,6 +1,8 @@
|
|||||||
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
|
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
|
||||||
// See the LICENCE file in the repository root for full licence text.
|
// See the LICENCE file in the repository root for full licence text.
|
||||||
|
|
||||||
|
#nullable enable
|
||||||
|
|
||||||
using System;
|
using System;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using JetBrains.Annotations;
|
using JetBrains.Annotations;
|
||||||
@ -12,6 +14,7 @@ using osu.Game.Online.API.Requests.Responses;
|
|||||||
|
|
||||||
namespace osu.Game.Online.Rooms
|
namespace osu.Game.Online.Rooms
|
||||||
{
|
{
|
||||||
|
[JsonObject(MemberSerialization.OptIn)]
|
||||||
public class PlaylistItem : IEquatable<PlaylistItem>
|
public class PlaylistItem : IEquatable<PlaylistItem>
|
||||||
{
|
{
|
||||||
[JsonProperty("id")]
|
[JsonProperty("id")]
|
||||||
@ -20,9 +23,6 @@ namespace osu.Game.Online.Rooms
|
|||||||
[JsonProperty("owner_id")]
|
[JsonProperty("owner_id")]
|
||||||
public int OwnerID { get; set; }
|
public int OwnerID { get; set; }
|
||||||
|
|
||||||
[JsonProperty("beatmap_id")]
|
|
||||||
public int BeatmapID { get; set; }
|
|
||||||
|
|
||||||
[JsonProperty("ruleset_id")]
|
[JsonProperty("ruleset_id")]
|
||||||
public int RulesetID { get; set; }
|
public int RulesetID { get; set; }
|
||||||
|
|
||||||
@ -38,35 +38,50 @@ namespace osu.Game.Online.Rooms
|
|||||||
[JsonProperty("played_at")]
|
[JsonProperty("played_at")]
|
||||||
public DateTimeOffset? PlayedAt { get; set; }
|
public DateTimeOffset? PlayedAt { get; set; }
|
||||||
|
|
||||||
[JsonIgnore]
|
|
||||||
public IBindable<bool> Valid => valid;
|
|
||||||
|
|
||||||
private readonly Bindable<bool> valid = new BindableBool(true);
|
|
||||||
|
|
||||||
[JsonIgnore]
|
|
||||||
public readonly Bindable<IBeatmapInfo> Beatmap = new Bindable<IBeatmapInfo>();
|
|
||||||
|
|
||||||
[JsonProperty("beatmap")]
|
|
||||||
private APIBeatmap apiBeatmap { get; set; }
|
|
||||||
|
|
||||||
[JsonProperty("allowed_mods")]
|
[JsonProperty("allowed_mods")]
|
||||||
public APIMod[] AllowedMods { get; set; } = Array.Empty<APIMod>();
|
public APIMod[] AllowedMods { get; set; } = Array.Empty<APIMod>();
|
||||||
|
|
||||||
[JsonProperty("required_mods")]
|
[JsonProperty("required_mods")]
|
||||||
public APIMod[] RequiredMods { get; set; } = Array.Empty<APIMod>();
|
public APIMod[] RequiredMods { get; set; } = Array.Empty<APIMod>();
|
||||||
|
|
||||||
public PlaylistItem()
|
/// <summary>
|
||||||
|
/// Used for deserialising from the API.
|
||||||
|
/// </summary>
|
||||||
|
[JsonProperty("beatmap")]
|
||||||
|
private APIBeatmap apiBeatmap
|
||||||
{
|
{
|
||||||
Beatmap.BindValueChanged(beatmap => BeatmapID = beatmap.NewValue?.OnlineID ?? -1);
|
// This getter is required/used internally by JSON.NET during deserialisation to do default-value comparisons. It is never used during serialisation (see: ShouldSerializeapiBeatmap()).
|
||||||
|
// It will always return a null value on deserialisation, which JSON.NET will handle gracefully.
|
||||||
|
get => (APIBeatmap)Beatmap;
|
||||||
|
set => Beatmap = value;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Used for serialising to the API.
|
||||||
|
/// </summary>
|
||||||
|
[JsonProperty("beatmap_id")]
|
||||||
|
private int onlineBeatmapId => Beatmap.OnlineID;
|
||||||
|
|
||||||
|
[JsonIgnore]
|
||||||
|
public IBeatmapInfo Beatmap { get; set; } = null!;
|
||||||
|
|
||||||
|
[JsonIgnore]
|
||||||
|
public IBindable<bool> Valid => valid;
|
||||||
|
|
||||||
|
private readonly Bindable<bool> valid = new BindableBool(true);
|
||||||
|
|
||||||
|
[JsonConstructor]
|
||||||
|
private PlaylistItem()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
public PlaylistItem(IBeatmapInfo beatmap)
|
||||||
|
{
|
||||||
|
Beatmap = beatmap;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void MarkInvalid() => valid.Value = false;
|
public void MarkInvalid() => valid.Value = false;
|
||||||
|
|
||||||
public void MapObjects()
|
|
||||||
{
|
|
||||||
Beatmap.Value ??= apiBeatmap;
|
|
||||||
}
|
|
||||||
|
|
||||||
#region Newtonsoft.Json implicit ShouldSerialize() methods
|
#region Newtonsoft.Json implicit ShouldSerialize() methods
|
||||||
|
|
||||||
// The properties in this region are used implicitly by Newtonsoft.Json to not serialise certain fields in some cases.
|
// The properties in this region are used implicitly by Newtonsoft.Json to not serialise certain fields in some cases.
|
||||||
@ -82,9 +97,22 @@ namespace osu.Game.Online.Rooms
|
|||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
public bool Equals(PlaylistItem other)
|
public PlaylistItem With(IBeatmapInfo beatmap) => new PlaylistItem(beatmap)
|
||||||
|
{
|
||||||
|
ID = ID,
|
||||||
|
OwnerID = OwnerID,
|
||||||
|
RulesetID = RulesetID,
|
||||||
|
Expired = Expired,
|
||||||
|
PlaylistOrder = PlaylistOrder,
|
||||||
|
PlayedAt = PlayedAt,
|
||||||
|
AllowedMods = AllowedMods,
|
||||||
|
RequiredMods = RequiredMods,
|
||||||
|
valid = { Value = Valid.Value },
|
||||||
|
};
|
||||||
|
|
||||||
|
public bool Equals(PlaylistItem? other)
|
||||||
=> ID == other?.ID
|
=> ID == other?.ID
|
||||||
&& BeatmapID == other.BeatmapID
|
&& Beatmap.OnlineID == other.Beatmap.OnlineID
|
||||||
&& RulesetID == other.RulesetID
|
&& RulesetID == other.RulesetID
|
||||||
&& Expired == other.Expired
|
&& Expired == other.Expired
|
||||||
&& AllowedMods.SequenceEqual(other.AllowedMods)
|
&& AllowedMods.SequenceEqual(other.AllowedMods)
|
||||||
|
@ -68,14 +68,14 @@ namespace osu.Game.Screens.OnlinePlay.Components
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
var metadataInfo = beatmap.Value.Metadata;
|
var metadataInfo = beatmap.Metadata;
|
||||||
|
|
||||||
string artistUnicode = string.IsNullOrEmpty(metadataInfo.ArtistUnicode) ? metadataInfo.Artist : metadataInfo.ArtistUnicode;
|
string artistUnicode = string.IsNullOrEmpty(metadataInfo.ArtistUnicode) ? metadataInfo.Artist : metadataInfo.ArtistUnicode;
|
||||||
string titleUnicode = string.IsNullOrEmpty(metadataInfo.TitleUnicode) ? metadataInfo.Title : metadataInfo.TitleUnicode;
|
string titleUnicode = string.IsNullOrEmpty(metadataInfo.TitleUnicode) ? metadataInfo.Title : metadataInfo.TitleUnicode;
|
||||||
|
|
||||||
var title = new RomanisableString($"{artistUnicode} - {titleUnicode}".Trim(), $"{metadataInfo.Artist} - {metadataInfo.Title}".Trim());
|
var title = new RomanisableString($"{artistUnicode} - {titleUnicode}".Trim(), $"{metadataInfo.Artist} - {metadataInfo.Title}".Trim());
|
||||||
|
|
||||||
textFlow.AddLink(title, LinkAction.OpenBeatmap, beatmap.Value.OnlineID.ToString(), "Open beatmap");
|
textFlow.AddLink(title, LinkAction.OpenBeatmap, beatmap.OnlineID.ToString(), "Open beatmap");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -67,7 +67,7 @@ namespace osu.Game.Screens.OnlinePlay.Components
|
|||||||
var mods = item.RequiredMods.Select(m => m.ToMod(ruleset)).ToArray();
|
var mods = item.RequiredMods.Select(m => m.ToMod(ruleset)).ToArray();
|
||||||
|
|
||||||
drawableRuleset.FadeIn(transition_duration);
|
drawableRuleset.FadeIn(transition_duration);
|
||||||
drawableRuleset.Child = new DifficultyIcon(item.Beatmap.Value, ruleset.RulesetInfo, mods) { Size = new Vector2(height) };
|
drawableRuleset.Child = new DifficultyIcon(item.Beatmap, ruleset.RulesetInfo, mods) { Size = new Vector2(height) };
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
drawableRuleset.FadeOut(transition_duration);
|
drawableRuleset.FadeOut(transition_duration);
|
||||||
|
@ -60,7 +60,7 @@ namespace osu.Game.Screens.OnlinePlay.Components
|
|||||||
{
|
{
|
||||||
Schedule(() =>
|
Schedule(() =>
|
||||||
{
|
{
|
||||||
var beatmap = playlistItem?.Beatmap.Value;
|
var beatmap = playlistItem?.Beatmap;
|
||||||
|
|
||||||
string? lastCover = (background?.Beatmap?.BeatmapSet as IBeatmapSetOnlineInfo)?.Covers.Cover;
|
string? lastCover = (background?.Beatmap?.BeatmapSet as IBeatmapSetOnlineInfo)?.Covers.Cover;
|
||||||
string? newCover = (beatmap?.BeatmapSet as IBeatmapSetOnlineInfo)?.Covers.Cover;
|
string? newCover = (beatmap?.BeatmapSet as IBeatmapSetOnlineInfo)?.Covers.Cover;
|
||||||
|
@ -30,7 +30,7 @@ namespace osu.Game.Screens.OnlinePlay.Components
|
|||||||
|
|
||||||
private void updateBeatmap()
|
private void updateBeatmap()
|
||||||
{
|
{
|
||||||
sprite.Beatmap.Value = Playlist.GetCurrentItem()?.Beatmap.Value;
|
sprite.Beatmap.Value = Playlist.GetCurrentItem()?.Beatmap;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected virtual UpdateableBeatmapBackgroundSprite CreateBackgroundSprite() => new UpdateableBeatmapBackgroundSprite(BeatmapSetCoverType) { RelativeSizeAxes = Axes.Both };
|
protected virtual UpdateableBeatmapBackgroundSprite CreateBackgroundSprite() => new UpdateableBeatmapBackgroundSprite(BeatmapSetCoverType) { RelativeSizeAxes = Axes.Both };
|
||||||
|
@ -17,7 +17,7 @@ namespace osu.Game.Screens.OnlinePlay.Components
|
|||||||
|
|
||||||
public PlaylistItemBackground(PlaylistItem? playlistItem)
|
public PlaylistItemBackground(PlaylistItem? playlistItem)
|
||||||
{
|
{
|
||||||
Beatmap = playlistItem?.Beatmap.Value;
|
Beatmap = playlistItem?.Beatmap;
|
||||||
}
|
}
|
||||||
|
|
||||||
[BackgroundDependencyLoader]
|
[BackgroundDependencyLoader]
|
||||||
|
@ -112,9 +112,6 @@ namespace osu.Game.Screens.OnlinePlay.Components
|
|||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
foreach (var pi in room.Playlist)
|
|
||||||
pi.MapObjects();
|
|
||||||
|
|
||||||
var existing = rooms.FirstOrDefault(e => e.RoomID.Value == room.RoomID.Value);
|
var existing = rooms.FirstOrDefault(e => e.RoomID.Value == room.RoomID.Value);
|
||||||
if (existing == null)
|
if (existing == null)
|
||||||
rooms.Add(room);
|
rooms.Add(room);
|
||||||
|
@ -80,7 +80,7 @@ namespace osu.Game.Screens.OnlinePlay.Components
|
|||||||
|
|
||||||
private void updateRange(object sender, NotifyCollectionChangedEventArgs e)
|
private void updateRange(object sender, NotifyCollectionChangedEventArgs e)
|
||||||
{
|
{
|
||||||
var orderedDifficulties = Playlist.Where(p => p.Beatmap.Value != null).Select(p => p.Beatmap.Value).OrderBy(b => b.StarRating).ToArray();
|
var orderedDifficulties = Playlist.Select(p => p.Beatmap).OrderBy(b => b.StarRating).ToArray();
|
||||||
|
|
||||||
StarDifficulty minDifficulty = new StarDifficulty(orderedDifficulties.Length > 0 ? orderedDifficulties[0].StarRating : 0, 0);
|
StarDifficulty minDifficulty = new StarDifficulty(orderedDifficulties.Length > 0 ? orderedDifficulties[0].StarRating : 0, 0);
|
||||||
StarDifficulty maxDifficulty = new StarDifficulty(orderedDifficulties.Length > 0 ? orderedDifficulties[^1].StarRating : 0, 0);
|
StarDifficulty maxDifficulty = new StarDifficulty(orderedDifficulties.Length > 0 ? orderedDifficulties[^1].StarRating : 0, 0);
|
||||||
|
@ -161,7 +161,7 @@ namespace osu.Game.Screens.OnlinePlay
|
|||||||
Schedule(() => ownerAvatar.User = foundUser);
|
Schedule(() => ownerAvatar.User = foundUser);
|
||||||
}
|
}
|
||||||
|
|
||||||
beatmap = await beatmapLookupCache.GetBeatmapAsync(Item.Beatmap.Value.OnlineID).ConfigureAwait(false);
|
beatmap = await beatmapLookupCache.GetBeatmapAsync(Item.Beatmap.OnlineID).ConfigureAwait(false);
|
||||||
|
|
||||||
Scheduler.AddOnce(refresh);
|
Scheduler.AddOnce(refresh);
|
||||||
}
|
}
|
||||||
|
@ -409,7 +409,7 @@ namespace osu.Game.Screens.OnlinePlay.Lounge.Components
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
var cancellationSource = beatmapLookupCancellation = new CancellationTokenSource();
|
var cancellationSource = beatmapLookupCancellation = new CancellationTokenSource();
|
||||||
beatmapLookupCache.GetBeatmapAsync(beatmap.Value.OnlineID, cancellationSource.Token)
|
beatmapLookupCache.GetBeatmapAsync(beatmap.OnlineID, cancellationSource.Token)
|
||||||
.ContinueWith(task => Schedule(() =>
|
.ContinueWith(task => Schedule(() =>
|
||||||
{
|
{
|
||||||
if (cancellationSource.IsCancellationRequested)
|
if (cancellationSource.IsCancellationRequested)
|
||||||
|
@ -62,7 +62,7 @@ namespace osu.Game.Screens.OnlinePlay.Match
|
|||||||
if (editButton != null)
|
if (editButton != null)
|
||||||
host.BindValueChanged(h => editButton.Alpha = h.NewValue?.Equals(api.LocalUser.Value) == true ? 1 : 0, true);
|
host.BindValueChanged(h => editButton.Alpha = h.NewValue?.Equals(api.LocalUser.Value) == true ? 1 : 0, true);
|
||||||
|
|
||||||
SelectedItem.BindValueChanged(item => background.Beatmap.Value = item.NewValue?.Beatmap.Value, true);
|
SelectedItem.BindValueChanged(item => background.Beatmap.Value = item.NewValue?.Beatmap, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override Drawable CreateBackground() => background = new BackgroundSprite();
|
protected override Drawable CreateBackground() => background = new BackgroundSprite();
|
||||||
|
@ -376,7 +376,7 @@ namespace osu.Game.Screens.OnlinePlay.Match
|
|||||||
|
|
||||||
private void updateWorkingBeatmap()
|
private void updateWorkingBeatmap()
|
||||||
{
|
{
|
||||||
var beatmap = SelectedItem.Value?.Beatmap.Value;
|
var beatmap = SelectedItem.Value?.Beatmap;
|
||||||
|
|
||||||
// Retrieve the corresponding local beatmap, since we can't directly use the playlist's beatmap info
|
// Retrieve the corresponding local beatmap, since we can't directly use the playlist's beatmap info
|
||||||
var localBeatmap = beatmap == null ? null : beatmapManager.QueryBeatmap(b => b.OnlineID == beatmap.OnlineID);
|
var localBeatmap = beatmap == null ? null : beatmapManager.QueryBeatmap(b => b.OnlineID == beatmap.OnlineID);
|
||||||
|
@ -67,8 +67,8 @@ namespace osu.Game.Screens.OnlinePlay.Multiplayer
|
|||||||
var multiplayerItem = new MultiplayerPlaylistItem
|
var multiplayerItem = new MultiplayerPlaylistItem
|
||||||
{
|
{
|
||||||
ID = itemToEdit ?? 0,
|
ID = itemToEdit ?? 0,
|
||||||
BeatmapID = item.BeatmapID,
|
BeatmapID = item.Beatmap.OnlineID,
|
||||||
BeatmapChecksum = item.Beatmap.Value.MD5Hash,
|
BeatmapChecksum = item.Beatmap.MD5Hash,
|
||||||
RulesetID = item.RulesetID,
|
RulesetID = item.RulesetID,
|
||||||
RequiredMods = item.RequiredMods.ToArray(),
|
RequiredMods = item.RequiredMods.ToArray(),
|
||||||
AllowedMods = item.AllowedMods.ToArray()
|
AllowedMods = item.AllowedMods.ToArray()
|
||||||
|
@ -5,7 +5,6 @@ using System;
|
|||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Diagnostics;
|
using System.Diagnostics;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Threading.Tasks;
|
|
||||||
using JetBrains.Annotations;
|
using JetBrains.Annotations;
|
||||||
using osu.Framework.Allocation;
|
using osu.Framework.Allocation;
|
||||||
using osu.Framework.Bindables;
|
using osu.Framework.Bindables;
|
||||||
@ -398,38 +397,7 @@ namespace osu.Game.Screens.OnlinePlay.Multiplayer
|
|||||||
private void updateCurrentItem()
|
private void updateCurrentItem()
|
||||||
{
|
{
|
||||||
Debug.Assert(client.Room != null);
|
Debug.Assert(client.Room != null);
|
||||||
|
SelectedItem.Value = Room.Playlist.SingleOrDefault(i => i.ID == client.Room.Settings.PlaylistItemId);
|
||||||
var expectedSelectedItem = Room.Playlist.SingleOrDefault(i => i.ID == client.Room.Settings.PlaylistItemId);
|
|
||||||
|
|
||||||
if (expectedSelectedItem == null)
|
|
||||||
return;
|
|
||||||
|
|
||||||
// There's no reason to renew the selected item if its content hasn't changed.
|
|
||||||
if (SelectedItem.Value?.Equals(expectedSelectedItem) == true && expectedSelectedItem.Beatmap.Value != null)
|
|
||||||
return;
|
|
||||||
|
|
||||||
// Clear the selected item while the lookup is performed, so components like the ready button can enter their disabled states.
|
|
||||||
SelectedItem.Value = null;
|
|
||||||
|
|
||||||
if (expectedSelectedItem.Beatmap.Value == null)
|
|
||||||
{
|
|
||||||
Task.Run(async () =>
|
|
||||||
{
|
|
||||||
var beatmap = await client.GetAPIBeatmap(expectedSelectedItem.BeatmapID).ConfigureAwait(false);
|
|
||||||
|
|
||||||
Schedule(() =>
|
|
||||||
{
|
|
||||||
expectedSelectedItem.Beatmap.Value = beatmap;
|
|
||||||
|
|
||||||
if (Room.Playlist.SingleOrDefault(i => i.ID == client.Room?.Settings.PlaylistItemId)?.Equals(expectedSelectedItem) == true)
|
|
||||||
applyCurrentItem();
|
|
||||||
});
|
|
||||||
});
|
|
||||||
}
|
|
||||||
else
|
|
||||||
applyCurrentItem();
|
|
||||||
|
|
||||||
void applyCurrentItem() => SelectedItem.Value = expectedSelectedItem;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void handleRoomLost() => Schedule(() =>
|
private void handleRoomLost() => Schedule(() =>
|
||||||
|
@ -113,12 +113,8 @@ namespace osu.Game.Screens.OnlinePlay
|
|||||||
{
|
{
|
||||||
itemSelected = true;
|
itemSelected = true;
|
||||||
|
|
||||||
var item = new PlaylistItem
|
var item = new PlaylistItem(Beatmap.Value.BeatmapInfo)
|
||||||
{
|
{
|
||||||
Beatmap =
|
|
||||||
{
|
|
||||||
Value = Beatmap.Value.BeatmapInfo
|
|
||||||
},
|
|
||||||
RulesetID = Ruleset.Value.OnlineID,
|
RulesetID = Ruleset.Value.OnlineID,
|
||||||
RequiredMods = Mods.Value.Select(m => new APIMod(m)).ToArray(),
|
RequiredMods = Mods.Value.Select(m => new APIMod(m)).ToArray(),
|
||||||
AllowedMods = FreeMods.Value.Select(m => new APIMod(m)).ToArray()
|
AllowedMods = FreeMods.Value.Select(m => new APIMod(m)).ToArray()
|
||||||
|
@ -34,7 +34,7 @@ namespace osu.Game.Screens.OnlinePlay.Playlists
|
|||||||
private void load(IBindable<RulesetInfo> ruleset)
|
private void load(IBindable<RulesetInfo> ruleset)
|
||||||
{
|
{
|
||||||
// Sanity checks to ensure that PlaylistsPlayer matches the settings for the current PlaylistItem
|
// Sanity checks to ensure that PlaylistsPlayer matches the settings for the current PlaylistItem
|
||||||
if (!Beatmap.Value.BeatmapInfo.MatchesOnlineID(PlaylistItem.Beatmap.Value))
|
if (!Beatmap.Value.BeatmapInfo.MatchesOnlineID(PlaylistItem.Beatmap))
|
||||||
throw new InvalidOperationException("Current Beatmap does not match PlaylistItem's Beatmap");
|
throw new InvalidOperationException("Current Beatmap does not match PlaylistItem's Beatmap");
|
||||||
|
|
||||||
if (ruleset.Value.OnlineID != PlaylistItem.RulesetID)
|
if (ruleset.Value.OnlineID != PlaylistItem.RulesetID)
|
||||||
|
@ -392,7 +392,7 @@ namespace osu.Game.Screens.OnlinePlay.Playlists
|
|||||||
|
|
||||||
foreach (var item in Playlist)
|
foreach (var item in Playlist)
|
||||||
{
|
{
|
||||||
if (invalidBeatmapIDs.Contains(item.BeatmapID))
|
if (invalidBeatmapIDs.Contains(item.Beatmap.OnlineID))
|
||||||
item.MarkInvalid();
|
item.MarkInvalid();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -41,10 +41,9 @@ namespace osu.Game.Screens.OnlinePlay.Playlists
|
|||||||
|
|
||||||
private void createNewItem()
|
private void createNewItem()
|
||||||
{
|
{
|
||||||
PlaylistItem item = new PlaylistItem
|
PlaylistItem item = new PlaylistItem(Beatmap.Value.BeatmapInfo)
|
||||||
{
|
{
|
||||||
ID = Playlist.Count == 0 ? 0 : Playlist.Max(p => p.ID) + 1,
|
ID = Playlist.Count == 0 ? 0 : Playlist.Max(p => p.ID) + 1,
|
||||||
Beatmap = { Value = Beatmap.Value.BeatmapInfo },
|
|
||||||
RulesetID = Ruleset.Value.OnlineID,
|
RulesetID = Ruleset.Value.OnlineID,
|
||||||
RequiredMods = Mods.Value.Select(m => new APIMod(m)).ToArray(),
|
RequiredMods = Mods.Value.Select(m => new APIMod(m)).ToArray(),
|
||||||
AllowedMods = FreeMods.Value.Select(m => new APIMod(m)).ToArray()
|
AllowedMods = FreeMods.Value.Select(m => new APIMod(m)).ToArray()
|
||||||
|
@ -46,9 +46,8 @@ namespace osu.Game.Tests.Visual.Multiplayer
|
|||||||
Name = { Value = "test name" },
|
Name = { Value = "test name" },
|
||||||
Playlist =
|
Playlist =
|
||||||
{
|
{
|
||||||
new PlaylistItem
|
new PlaylistItem(new TestBeatmap(Ruleset.Value).BeatmapInfo)
|
||||||
{
|
{
|
||||||
Beatmap = { Value = new TestBeatmap(Ruleset.Value).BeatmapInfo },
|
|
||||||
RulesetID = Ruleset.Value.OnlineID
|
RulesetID = Ruleset.Value.OnlineID
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -7,14 +7,11 @@ using System;
|
|||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Diagnostics;
|
using System.Diagnostics;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Threading;
|
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
using osu.Framework.Allocation;
|
using osu.Framework.Allocation;
|
||||||
using osu.Framework.Bindables;
|
using osu.Framework.Bindables;
|
||||||
using osu.Framework.Extensions;
|
using osu.Framework.Extensions;
|
||||||
using osu.Game.Beatmaps;
|
|
||||||
using osu.Game.Online.API;
|
using osu.Game.Online.API;
|
||||||
using osu.Game.Online.API.Requests.Responses;
|
|
||||||
using osu.Game.Online.Multiplayer;
|
using osu.Game.Online.Multiplayer;
|
||||||
using osu.Game.Online.Multiplayer.MatchTypes.TeamVersus;
|
using osu.Game.Online.Multiplayer.MatchTypes.TeamVersus;
|
||||||
using osu.Game.Online.Rooms;
|
using osu.Game.Online.Rooms;
|
||||||
@ -39,9 +36,6 @@ namespace osu.Game.Tests.Visual.Multiplayer
|
|||||||
[Resolved]
|
[Resolved]
|
||||||
private IAPIProvider api { get; set; } = null!;
|
private IAPIProvider api { get; set; } = null!;
|
||||||
|
|
||||||
[Resolved]
|
|
||||||
private BeatmapManager beatmaps { get; set; } = null!;
|
|
||||||
|
|
||||||
private readonly TestMultiplayerRoomManager roomManager;
|
private readonly TestMultiplayerRoomManager roomManager;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@ -407,23 +401,6 @@ namespace osu.Game.Tests.Visual.Multiplayer
|
|||||||
|
|
||||||
public override Task RemovePlaylistItem(long playlistItemId) => RemoveUserPlaylistItem(api.LocalUser.Value.OnlineID, playlistItemId);
|
public override Task RemovePlaylistItem(long playlistItemId) => RemoveUserPlaylistItem(api.LocalUser.Value.OnlineID, playlistItemId);
|
||||||
|
|
||||||
public override Task<APIBeatmap> GetAPIBeatmap(int beatmapId, CancellationToken cancellationToken = default)
|
|
||||||
{
|
|
||||||
IBeatmapInfo? beatmap = roomManager.ServerSideRooms.SelectMany(r => r.Playlist)
|
|
||||||
.FirstOrDefault(p => p.BeatmapID == beatmapId)?.Beatmap.Value
|
|
||||||
?? beatmaps.QueryBeatmap(b => b.OnlineID == beatmapId);
|
|
||||||
|
|
||||||
if (beatmap == null)
|
|
||||||
throw new InvalidOperationException("Beatmap not found.");
|
|
||||||
|
|
||||||
return Task.FromResult(new APIBeatmap
|
|
||||||
{
|
|
||||||
BeatmapSet = new APIBeatmapSet { OnlineID = beatmap.BeatmapSet?.OnlineID ?? -1 },
|
|
||||||
OnlineID = beatmapId,
|
|
||||||
Checksum = beatmap.MD5Hash
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
private async Task changeMatchType(MatchType type)
|
private async Task changeMatchType(MatchType type)
|
||||||
{
|
{
|
||||||
Debug.Assert(Room != null);
|
Debug.Assert(Room != null);
|
||||||
|
@ -43,16 +43,9 @@ namespace osu.Game.Tests.Visual.OnlinePlay
|
|||||||
|
|
||||||
if (ruleset != null)
|
if (ruleset != null)
|
||||||
{
|
{
|
||||||
room.Playlist.Add(new PlaylistItem
|
room.Playlist.Add(new PlaylistItem(new BeatmapInfo { Metadata = new BeatmapMetadata() })
|
||||||
{
|
{
|
||||||
RulesetID = ruleset.OnlineID,
|
RulesetID = ruleset.OnlineID,
|
||||||
Beatmap =
|
|
||||||
{
|
|
||||||
Value = new BeatmapInfo
|
|
||||||
{
|
|
||||||
Metadata = new BeatmapMetadata()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user