mirror of
https://github.com/ppy/osu.git
synced 2024-12-15 09:02:55 +08:00
Merge branch 'master' into slider-timeline-velcotiy-adjust-v2
This commit is contained in:
commit
59bd13c154
@ -52,7 +52,7 @@
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<PackageReference Include="ppy.osu.Game.Resources" Version="2021.918.0" />
|
||||
<PackageReference Include="ppy.osu.Framework.Android" Version="2021.927.0" />
|
||||
<PackageReference Include="ppy.osu.Framework.Android" Version="2021.929.0" />
|
||||
</ItemGroup>
|
||||
<ItemGroup Label="Transitive Dependencies">
|
||||
<!-- Realm needs to be directly referenced in all Xamarin projects, as it will not pull in its transitive dependencies otherwise. -->
|
||||
|
@ -74,7 +74,10 @@ namespace osu.Desktop
|
||||
|
||||
// we want to allow multiple instances to be started when in debug.
|
||||
if (!DebugUtils.IsDebugBuild)
|
||||
{
|
||||
Logger.Log(@"osu! does not support multiple running instances.", LoggingTarget.Runtime, LogLevel.Error);
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
if (tournamentClient)
|
||||
|
@ -582,7 +582,6 @@ namespace osu.Game.Tests.Beatmaps.IO
|
||||
|
||||
[Test]
|
||||
[NonParallelizable]
|
||||
[Ignore("Binding IPC on Appveyor isn't working (port in use). Need to figure out why")]
|
||||
public void TestImportOverIPC()
|
||||
{
|
||||
using (HeadlessGameHost host = new CleanRunHeadlessGameHost($"{nameof(ImportBeatmapTest)}-host", true))
|
||||
|
@ -3,10 +3,12 @@
|
||||
|
||||
using System.Linq;
|
||||
using NUnit.Framework;
|
||||
using osu.Framework.Bindables;
|
||||
using osu.Framework.Graphics;
|
||||
using osu.Framework.Graphics.Containers;
|
||||
using osu.Framework.Screens;
|
||||
using osu.Framework.Testing;
|
||||
using osu.Game.Configuration;
|
||||
using osu.Game.Graphics.Containers;
|
||||
using osu.Game.Graphics.Cursor;
|
||||
using osu.Game.Rulesets;
|
||||
@ -39,6 +41,45 @@ namespace osu.Game.Tests.Visual.Gameplay
|
||||
confirmClockRunning(true);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void TestPauseWithLargeOffset()
|
||||
{
|
||||
double lastTime;
|
||||
bool alwaysGoingForward = true;
|
||||
|
||||
AddStep("force large offset", () =>
|
||||
{
|
||||
var offset = (BindableDouble)LocalConfig.GetBindable<double>(OsuSetting.AudioOffset);
|
||||
|
||||
// use a large negative offset to avoid triggering a fail from forwards seeking.
|
||||
offset.MinValue = -5000;
|
||||
offset.Value = -5000;
|
||||
});
|
||||
|
||||
AddStep("add time forward check hook", () =>
|
||||
{
|
||||
lastTime = double.MinValue;
|
||||
alwaysGoingForward = true;
|
||||
|
||||
Player.OnUpdate += _ =>
|
||||
{
|
||||
double currentTime = Player.GameplayClockContainer.CurrentTime;
|
||||
alwaysGoingForward &= currentTime >= lastTime;
|
||||
lastTime = currentTime;
|
||||
};
|
||||
});
|
||||
|
||||
AddStep("move cursor outside", () => InputManager.MoveMouseTo(Player.ScreenSpaceDrawQuad.TopLeft - new Vector2(10)));
|
||||
|
||||
pauseAndConfirm();
|
||||
|
||||
resumeAndConfirm();
|
||||
|
||||
AddAssert("time didn't go backwards", () => alwaysGoingForward);
|
||||
|
||||
AddStep("reset offset", () => LocalConfig.SetValue(OsuSetting.AudioOffset, 0.0));
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void TestPauseResume()
|
||||
{
|
||||
|
@ -43,11 +43,12 @@ namespace osu.Game.Tests.Visual.Multiplayer
|
||||
Spacing = new Vector2(10),
|
||||
Children = new Drawable[]
|
||||
{
|
||||
createDrawableRoom(new Room
|
||||
createLoungeRoom(new Room
|
||||
{
|
||||
Name = { Value = "Flyte's Trash Playlist" },
|
||||
Name = { Value = "Multiplayer room" },
|
||||
Status = { Value = new RoomStatusOpen() },
|
||||
EndDate = { Value = DateTimeOffset.Now.AddDays(1) },
|
||||
Type = { Value = MatchType.HeadToHead },
|
||||
Playlist =
|
||||
{
|
||||
new PlaylistItem
|
||||
@ -65,9 +66,9 @@ namespace osu.Game.Tests.Visual.Multiplayer
|
||||
}
|
||||
}
|
||||
}),
|
||||
createDrawableRoom(new Room
|
||||
createLoungeRoom(new Room
|
||||
{
|
||||
Name = { Value = "Room 2" },
|
||||
Name = { Value = "Playlist room with multiple beatmaps" },
|
||||
Status = { Value = new RoomStatusPlaying() },
|
||||
EndDate = { Value = DateTimeOffset.Now.AddDays(1) },
|
||||
Playlist =
|
||||
@ -100,15 +101,15 @@ namespace osu.Game.Tests.Visual.Multiplayer
|
||||
}
|
||||
}
|
||||
}),
|
||||
createDrawableRoom(new Room
|
||||
createLoungeRoom(new Room
|
||||
{
|
||||
Name = { Value = "Room 3" },
|
||||
Name = { Value = "Finished room" },
|
||||
Status = { Value = new RoomStatusEnded() },
|
||||
EndDate = { Value = DateTimeOffset.Now },
|
||||
}),
|
||||
createDrawableRoom(new Room
|
||||
createLoungeRoom(new Room
|
||||
{
|
||||
Name = { Value = "Room 4 (spotlight)" },
|
||||
Name = { Value = "Spotlight room" },
|
||||
Status = { Value = new RoomStatusOpen() },
|
||||
Category = { Value = RoomCategory.Spotlight },
|
||||
}),
|
||||
@ -123,14 +124,14 @@ namespace osu.Game.Tests.Visual.Multiplayer
|
||||
DrawableRoom drawableRoom = null;
|
||||
Room room = null;
|
||||
|
||||
AddStep("create room", () => Child = drawableRoom = createDrawableRoom(room = new Room
|
||||
AddStep("create room", () => Child = drawableRoom = createLoungeRoom(room = new Room
|
||||
{
|
||||
Name = { Value = "Room with password" },
|
||||
Status = { Value = new RoomStatusOpen() },
|
||||
Type = { Value = MatchType.HeadToHead },
|
||||
}));
|
||||
|
||||
AddUntilStep("wait for panel load", () => drawableRoom.ChildrenOfType<RecentParticipantsList>().Any());
|
||||
AddUntilStep("wait for panel load", () => drawableRoom.ChildrenOfType<DrawableRoomParticipantsList>().Any());
|
||||
|
||||
AddAssert("password icon hidden", () => Precision.AlmostEquals(0, drawableRoom.ChildrenOfType<DrawableRoom.PasswordProtectedIcon>().Single().Alpha));
|
||||
|
||||
@ -141,7 +142,7 @@ namespace osu.Game.Tests.Visual.Multiplayer
|
||||
AddAssert("password icon hidden", () => Precision.AlmostEquals(0, drawableRoom.ChildrenOfType<DrawableRoom.PasswordProtectedIcon>().Single().Alpha));
|
||||
}
|
||||
|
||||
private DrawableRoom createDrawableRoom(Room room)
|
||||
private DrawableRoom createLoungeRoom(Room room)
|
||||
{
|
||||
room.Host.Value ??= new User { Username = "peppy", Id = 2 };
|
||||
|
||||
|
@ -13,16 +13,27 @@ using osu.Game.Users.Drawables;
|
||||
|
||||
namespace osu.Game.Tests.Visual.Multiplayer
|
||||
{
|
||||
public class TestSceneRecentParticipantsList : OnlinePlayTestScene
|
||||
public class TestSceneDrawableRoomParticipantsList : OnlinePlayTestScene
|
||||
{
|
||||
private RecentParticipantsList list;
|
||||
private DrawableRoomParticipantsList list;
|
||||
|
||||
[SetUp]
|
||||
public new void Setup() => Schedule(() =>
|
||||
{
|
||||
SelectedRoom.Value = new Room { Name = { Value = "test room" } };
|
||||
SelectedRoom.Value = new Room
|
||||
{
|
||||
Name = { Value = "test room" },
|
||||
Host =
|
||||
{
|
||||
Value = new User
|
||||
{
|
||||
Id = 2,
|
||||
Username = "peppy",
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
Child = list = new RecentParticipantsList
|
||||
Child = list = new DrawableRoomParticipantsList
|
||||
{
|
||||
Anchor = Anchor.Centre,
|
||||
Origin = Anchor.Centre,
|
||||
@ -40,19 +51,19 @@ namespace osu.Game.Tests.Visual.Multiplayer
|
||||
});
|
||||
|
||||
AddStep("set 8 circles", () => list.NumberOfCircles = 8);
|
||||
AddAssert("0 hidden users", () => list.ChildrenOfType<RecentParticipantsList.HiddenUserCount>().Single().Count == 0);
|
||||
AddAssert("0 hidden users", () => list.ChildrenOfType<DrawableRoomParticipantsList.HiddenUserCount>().Single().Count == 0);
|
||||
|
||||
AddStep("add one more user", () => addUser(9));
|
||||
AddAssert("2 hidden users", () => list.ChildrenOfType<RecentParticipantsList.HiddenUserCount>().Single().Count == 2);
|
||||
AddAssert("2 hidden users", () => list.ChildrenOfType<DrawableRoomParticipantsList.HiddenUserCount>().Single().Count == 2);
|
||||
|
||||
AddStep("remove first user", () => removeUserAt(0));
|
||||
AddAssert("0 hidden users", () => list.ChildrenOfType<RecentParticipantsList.HiddenUserCount>().Single().Count == 0);
|
||||
AddAssert("0 hidden users", () => list.ChildrenOfType<DrawableRoomParticipantsList.HiddenUserCount>().Single().Count == 0);
|
||||
|
||||
AddStep("add one more user", () => addUser(9));
|
||||
AddAssert("2 hidden users", () => list.ChildrenOfType<RecentParticipantsList.HiddenUserCount>().Single().Count == 2);
|
||||
AddAssert("2 hidden users", () => list.ChildrenOfType<DrawableRoomParticipantsList.HiddenUserCount>().Single().Count == 2);
|
||||
|
||||
AddStep("remove last user", () => removeUserAt(8));
|
||||
AddAssert("0 hidden users", () => list.ChildrenOfType<RecentParticipantsList.HiddenUserCount>().Single().Count == 0);
|
||||
AddAssert("0 hidden users", () => list.ChildrenOfType<DrawableRoomParticipantsList.HiddenUserCount>().Single().Count == 0);
|
||||
}
|
||||
|
||||
[Test]
|
||||
@ -69,9 +80,9 @@ namespace osu.Game.Tests.Visual.Multiplayer
|
||||
for (int i = 0; i < 8; i++)
|
||||
{
|
||||
AddStep("remove user", () => removeUserAt(0));
|
||||
int remainingUsers = 7 - i;
|
||||
int remainingUsers = 8 - i;
|
||||
|
||||
int displayedUsers = remainingUsers > 3 ? 2 : remainingUsers;
|
||||
int displayedUsers = remainingUsers > 4 ? 3 : remainingUsers;
|
||||
AddAssert($"{displayedUsers} avatars displayed", () => list.ChildrenOfType<UpdateableAvatar>().Count() == displayedUsers);
|
||||
}
|
||||
}
|
||||
@ -86,12 +97,12 @@ namespace osu.Game.Tests.Visual.Multiplayer
|
||||
});
|
||||
|
||||
AddStep("set 3 circles", () => list.NumberOfCircles = 3);
|
||||
AddAssert("2 users displayed", () => list.ChildrenOfType<UpdateableAvatar>().Count() == 2);
|
||||
AddAssert("48 hidden users", () => list.ChildrenOfType<RecentParticipantsList.HiddenUserCount>().Single().Count == 48);
|
||||
AddAssert("3 users displayed", () => list.ChildrenOfType<UpdateableAvatar>().Count() == 3);
|
||||
AddAssert("48 hidden users", () => list.ChildrenOfType<DrawableRoomParticipantsList.HiddenUserCount>().Single().Count == 48);
|
||||
|
||||
AddStep("set 10 circles", () => list.NumberOfCircles = 10);
|
||||
AddAssert("9 users displayed", () => list.ChildrenOfType<UpdateableAvatar>().Count() == 9);
|
||||
AddAssert("41 hidden users", () => list.ChildrenOfType<RecentParticipantsList.HiddenUserCount>().Single().Count == 41);
|
||||
AddAssert("10 users displayed", () => list.ChildrenOfType<UpdateableAvatar>().Count() == 10);
|
||||
AddAssert("41 hidden users", () => list.ChildrenOfType<DrawableRoomParticipantsList.HiddenUserCount>().Single().Count == 41);
|
||||
}
|
||||
|
||||
[Test]
|
||||
@ -104,24 +115,24 @@ namespace osu.Game.Tests.Visual.Multiplayer
|
||||
});
|
||||
|
||||
AddStep("remove from start", () => removeUserAt(0));
|
||||
AddAssert("3 circles displayed", () => list.ChildrenOfType<UpdateableAvatar>().Count() == 3);
|
||||
AddAssert("46 hidden users", () => list.ChildrenOfType<RecentParticipantsList.HiddenUserCount>().Single().Count == 46);
|
||||
AddAssert("4 circles displayed", () => list.ChildrenOfType<UpdateableAvatar>().Count() == 4);
|
||||
AddAssert("46 hidden users", () => list.ChildrenOfType<DrawableRoomParticipantsList.HiddenUserCount>().Single().Count == 46);
|
||||
|
||||
AddStep("remove from end", () => removeUserAt(SelectedRoom.Value.RecentParticipants.Count - 1));
|
||||
AddAssert("3 circles displayed", () => list.ChildrenOfType<UpdateableAvatar>().Count() == 3);
|
||||
AddAssert("45 hidden users", () => list.ChildrenOfType<RecentParticipantsList.HiddenUserCount>().Single().Count == 45);
|
||||
AddAssert("4 circles displayed", () => list.ChildrenOfType<UpdateableAvatar>().Count() == 4);
|
||||
AddAssert("45 hidden users", () => list.ChildrenOfType<DrawableRoomParticipantsList.HiddenUserCount>().Single().Count == 45);
|
||||
|
||||
AddRepeatStep("remove 45 users", () => removeUserAt(0), 45);
|
||||
AddAssert("3 circles displayed", () => list.ChildrenOfType<UpdateableAvatar>().Count() == 3);
|
||||
AddAssert("0 hidden users", () => list.ChildrenOfType<RecentParticipantsList.HiddenUserCount>().Single().Count == 0);
|
||||
AddAssert("hidden users bubble hidden", () => list.ChildrenOfType<RecentParticipantsList.HiddenUserCount>().Single().Alpha < 0.5f);
|
||||
AddAssert("4 circles displayed", () => list.ChildrenOfType<UpdateableAvatar>().Count() == 4);
|
||||
AddAssert("0 hidden users", () => list.ChildrenOfType<DrawableRoomParticipantsList.HiddenUserCount>().Single().Count == 0);
|
||||
AddAssert("hidden users bubble hidden", () => list.ChildrenOfType<DrawableRoomParticipantsList.HiddenUserCount>().Single().Alpha < 0.5f);
|
||||
|
||||
AddStep("remove another user", () => removeUserAt(0));
|
||||
AddAssert("2 circles displayed", () => list.ChildrenOfType<UpdateableAvatar>().Count() == 2);
|
||||
AddAssert("0 hidden users", () => list.ChildrenOfType<RecentParticipantsList.HiddenUserCount>().Single().Count == 0);
|
||||
AddAssert("3 circles displayed", () => list.ChildrenOfType<UpdateableAvatar>().Count() == 3);
|
||||
AddAssert("0 hidden users", () => list.ChildrenOfType<DrawableRoomParticipantsList.HiddenUserCount>().Single().Count == 0);
|
||||
|
||||
AddRepeatStep("remove the remaining two users", () => removeUserAt(0), 2);
|
||||
AddAssert("0 circles displayed", () => !list.ChildrenOfType<UpdateableAvatar>().Any());
|
||||
AddAssert("1 circle displayed", () => list.ChildrenOfType<UpdateableAvatar>().Count() == 1);
|
||||
}
|
||||
|
||||
private void addUser(int id)
|
@ -22,7 +22,7 @@ namespace osu.Game.IO.Serialization
|
||||
ObjectCreationHandling = ObjectCreationHandling.Replace,
|
||||
DefaultValueHandling = DefaultValueHandling.IgnoreAndPopulate,
|
||||
Converters = new List<JsonConverter> { new Vector2Converter() },
|
||||
ContractResolver = new KeyContractResolver()
|
||||
ContractResolver = new SnakeCaseKeyContractResolver()
|
||||
};
|
||||
}
|
||||
}
|
||||
|
@ -6,7 +6,7 @@ using Newtonsoft.Json.Serialization;
|
||||
|
||||
namespace osu.Game.IO.Serialization
|
||||
{
|
||||
public class KeyContractResolver : DefaultContractResolver
|
||||
public class SnakeCaseKeyContractResolver : DefaultContractResolver
|
||||
{
|
||||
protected override string ResolvePropertyName(string propertyName)
|
||||
{
|
@ -22,7 +22,6 @@ using Humanizer;
|
||||
using JetBrains.Annotations;
|
||||
using osu.Framework.Audio;
|
||||
using osu.Framework.Bindables;
|
||||
using osu.Framework.Development;
|
||||
using osu.Framework.Extensions.IEnumerableExtensions;
|
||||
using osu.Framework.Graphics.Sprites;
|
||||
using osu.Framework.Input;
|
||||
@ -210,12 +209,6 @@ namespace osu.Game
|
||||
[BackgroundDependencyLoader]
|
||||
private void load()
|
||||
{
|
||||
if (!Host.IsPrimaryInstance && !DebugUtils.IsDebugBuild)
|
||||
{
|
||||
Logger.Log(@"osu! does not support multiple running instances.", LoggingTarget.Runtime, LogLevel.Error);
|
||||
Environment.Exit(0);
|
||||
}
|
||||
|
||||
if (args?.Length > 0)
|
||||
{
|
||||
var paths = args.Where(a => !a.StartsWith('-')).ToArray();
|
||||
|
@ -14,6 +14,7 @@ using osu.Game.Beatmaps;
|
||||
using osu.Game.Graphics;
|
||||
using osu.Game.Graphics.Containers;
|
||||
using osu.Game.Graphics.Sprites;
|
||||
using osu.Game.Online.Chat;
|
||||
using osu.Game.Online.Rooms;
|
||||
using osu.Game.Overlays;
|
||||
using osu.Game.Screens.OnlinePlay.Components;
|
||||
@ -38,7 +39,7 @@ namespace osu.Game.Screens.OnlinePlay.Lounge.Components
|
||||
private readonly Bindable<RoomCategory> roomCategory = new Bindable<RoomCategory>();
|
||||
private readonly Bindable<bool> hasPassword = new Bindable<bool>();
|
||||
|
||||
private RecentParticipantsList recentParticipantsList;
|
||||
private DrawableRoomParticipantsList drawableRoomParticipantsList;
|
||||
private RoomSpecialCategoryPill specialCategoryPill;
|
||||
private PasswordProtectedIcon passwordIcon;
|
||||
private EndDateInfo endDateInfo;
|
||||
@ -136,7 +137,8 @@ namespace osu.Game.Screens.OnlinePlay.Lounge.Components
|
||||
{
|
||||
new FillFlowContainer
|
||||
{
|
||||
AutoSizeAxes = Axes.Both,
|
||||
RelativeSizeAxes = Axes.X,
|
||||
AutoSizeAxes = Axes.Y,
|
||||
Direction = FillDirection.Vertical,
|
||||
Children = new Drawable[]
|
||||
{
|
||||
@ -166,13 +168,14 @@ namespace osu.Game.Screens.OnlinePlay.Lounge.Components
|
||||
},
|
||||
new FillFlowContainer
|
||||
{
|
||||
AutoSizeAxes = Axes.Both,
|
||||
RelativeSizeAxes = Axes.X,
|
||||
AutoSizeAxes = Axes.Y,
|
||||
Padding = new MarginPadding { Top = 3 },
|
||||
Direction = FillDirection.Vertical,
|
||||
Children = new Drawable[]
|
||||
{
|
||||
new RoomNameText(),
|
||||
new RoomHostText(),
|
||||
new RoomStatusText()
|
||||
}
|
||||
}
|
||||
},
|
||||
@ -217,7 +220,7 @@ namespace osu.Game.Screens.OnlinePlay.Lounge.Components
|
||||
Children = new Drawable[]
|
||||
{
|
||||
ButtonsContainer,
|
||||
recentParticipantsList = new RecentParticipantsList
|
||||
drawableRoomParticipantsList = new DrawableRoomParticipantsList
|
||||
{
|
||||
Anchor = Anchor.CentreRight,
|
||||
Origin = Anchor.CentreRight,
|
||||
@ -280,8 +283,8 @@ namespace osu.Game.Screens.OnlinePlay.Lounge.Components
|
||||
{
|
||||
numberOfAvatars = value;
|
||||
|
||||
if (recentParticipantsList != null)
|
||||
recentParticipantsList.NumberOfCircles = value;
|
||||
if (drawableRoomParticipantsList != null)
|
||||
drawableRoomParticipantsList.NumberOfCircles = value;
|
||||
}
|
||||
}
|
||||
|
||||
@ -304,38 +307,87 @@ namespace osu.Game.Screens.OnlinePlay.Lounge.Components
|
||||
}
|
||||
}
|
||||
|
||||
private class RoomHostText : OnlinePlayComposite
|
||||
private class RoomStatusText : OnlinePlayComposite
|
||||
{
|
||||
private LinkFlowContainer hostText;
|
||||
[Resolved]
|
||||
private OsuColour colours { get; set; }
|
||||
|
||||
public RoomHostText()
|
||||
private SpriteText statusText;
|
||||
private LinkFlowContainer beatmapText;
|
||||
|
||||
public RoomStatusText()
|
||||
{
|
||||
AutoSizeAxes = Axes.Both;
|
||||
RelativeSizeAxes = Axes.X;
|
||||
AutoSizeAxes = Axes.Y;
|
||||
Width = 0.5f;
|
||||
}
|
||||
|
||||
[BackgroundDependencyLoader]
|
||||
private void load()
|
||||
{
|
||||
InternalChild = hostText = new LinkFlowContainer(s => s.Font = OsuFont.GetFont(size: 16))
|
||||
InternalChild = new GridContainer
|
||||
{
|
||||
AutoSizeAxes = Axes.Both
|
||||
RelativeSizeAxes = Axes.X,
|
||||
AutoSizeAxes = Axes.Y,
|
||||
ColumnDimensions = new[]
|
||||
{
|
||||
new Dimension(GridSizeMode.AutoSize),
|
||||
},
|
||||
RowDimensions = new[]
|
||||
{
|
||||
new Dimension(GridSizeMode.AutoSize)
|
||||
},
|
||||
Content = new[]
|
||||
{
|
||||
new Drawable[]
|
||||
{
|
||||
statusText = new OsuSpriteText
|
||||
{
|
||||
Font = OsuFont.Default.With(size: 16),
|
||||
Colour = colours.Lime1
|
||||
},
|
||||
beatmapText = new LinkFlowContainer(s =>
|
||||
{
|
||||
s.Font = OsuFont.Default.With(size: 16);
|
||||
s.Colour = colours.Lime1;
|
||||
})
|
||||
{
|
||||
RelativeSizeAxes = Axes.X,
|
||||
AutoSizeAxes = Axes.Y
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
protected override void LoadComplete()
|
||||
{
|
||||
base.LoadComplete();
|
||||
SelectedItem.BindValueChanged(onSelectedItemChanged, true);
|
||||
}
|
||||
|
||||
Host.BindValueChanged(host =>
|
||||
private void onSelectedItemChanged(ValueChangedEvent<PlaylistItem> item)
|
||||
{
|
||||
beatmapText.Clear();
|
||||
|
||||
if (Type.Value == MatchType.Playlists)
|
||||
{
|
||||
hostText.Clear();
|
||||
statusText.Text = "Ready to play";
|
||||
return;
|
||||
}
|
||||
|
||||
if (host.NewValue != null)
|
||||
{
|
||||
hostText.AddText("hosted by ");
|
||||
hostText.AddUserLink(host.NewValue);
|
||||
}
|
||||
}, true);
|
||||
if (item.NewValue?.Beatmap.Value != null)
|
||||
{
|
||||
statusText.Text = "Currently playing ";
|
||||
beatmapText.AddLink(item.NewValue.Beatmap.Value.ToRomanisableString(),
|
||||
LinkAction.OpenBeatmap,
|
||||
item.NewValue.Beatmap.Value.OnlineBeatmapID.ToString(),
|
||||
creationParameters: s =>
|
||||
{
|
||||
s.Truncate = true;
|
||||
s.RelativeSizeAxes = Axes.X;
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -4,11 +4,13 @@
|
||||
using System.Collections.Specialized;
|
||||
using System.Linq;
|
||||
using osu.Framework.Allocation;
|
||||
using osu.Framework.Bindables;
|
||||
using osu.Framework.Graphics;
|
||||
using osu.Framework.Graphics.Containers;
|
||||
using osu.Framework.Graphics.Shapes;
|
||||
using osu.Framework.Graphics.Sprites;
|
||||
using osu.Game.Graphics;
|
||||
using osu.Game.Graphics.Containers;
|
||||
using osu.Game.Graphics.Sprites;
|
||||
using osu.Game.Overlays;
|
||||
using osu.Game.Users;
|
||||
@ -17,16 +19,18 @@ using osuTK;
|
||||
|
||||
namespace osu.Game.Screens.OnlinePlay.Lounge.Components
|
||||
{
|
||||
public class RecentParticipantsList : OnlinePlayComposite
|
||||
public class DrawableRoomParticipantsList : OnlinePlayComposite
|
||||
{
|
||||
private const float avatar_size = 36;
|
||||
|
||||
private FillFlowContainer<CircularAvatar> avatarFlow;
|
||||
|
||||
private CircularAvatar hostAvatar;
|
||||
private LinkFlowContainer hostText;
|
||||
private HiddenUserCount hiddenUsers;
|
||||
private OsuSpriteText totalCount;
|
||||
|
||||
public RecentParticipantsList()
|
||||
public DrawableRoomParticipantsList()
|
||||
{
|
||||
AutoSizeAxes = Axes.X;
|
||||
Height = 60;
|
||||
@ -51,42 +55,98 @@ namespace osu.Game.Screens.OnlinePlay.Lounge.Components
|
||||
},
|
||||
new FillFlowContainer
|
||||
{
|
||||
Anchor = Anchor.Centre,
|
||||
Origin = Anchor.Centre,
|
||||
AutoSizeAxes = Axes.Both,
|
||||
Direction = FillDirection.Horizontal,
|
||||
Spacing = new Vector2(4),
|
||||
Padding = new MarginPadding { Right = 16 },
|
||||
RelativeSizeAxes = Axes.Y,
|
||||
AutoSizeAxes = Axes.X,
|
||||
Children = new Drawable[]
|
||||
{
|
||||
new SpriteIcon
|
||||
new FillFlowContainer
|
||||
{
|
||||
Anchor = Anchor.CentreLeft,
|
||||
Origin = Anchor.CentreLeft,
|
||||
Size = new Vector2(16),
|
||||
Margin = new MarginPadding { Left = 8 },
|
||||
Icon = FontAwesome.Solid.User,
|
||||
RelativeSizeAxes = Axes.Y,
|
||||
AutoSizeAxes = Axes.X,
|
||||
Spacing = new Vector2(8),
|
||||
Padding = new MarginPadding
|
||||
{
|
||||
Left = 8,
|
||||
Right = 16
|
||||
},
|
||||
Children = new Drawable[]
|
||||
{
|
||||
hostAvatar = new CircularAvatar
|
||||
{
|
||||
Anchor = Anchor.CentreLeft,
|
||||
Origin = Anchor.CentreLeft,
|
||||
},
|
||||
hostText = new LinkFlowContainer
|
||||
{
|
||||
Anchor = Anchor.CentreLeft,
|
||||
Origin = Anchor.CentreLeft,
|
||||
AutoSizeAxes = Axes.Both
|
||||
}
|
||||
}
|
||||
},
|
||||
totalCount = new OsuSpriteText
|
||||
new Container
|
||||
{
|
||||
Font = OsuFont.Default.With(weight: FontWeight.Bold),
|
||||
Anchor = Anchor.CentreLeft,
|
||||
Origin = Anchor.CentreLeft,
|
||||
RelativeSizeAxes = Axes.Y,
|
||||
AutoSizeAxes = Axes.X,
|
||||
Children = new Drawable[]
|
||||
{
|
||||
new Container
|
||||
{
|
||||
RelativeSizeAxes = Axes.Both,
|
||||
Masking = true,
|
||||
CornerRadius = 10,
|
||||
Shear = new Vector2(0.2f, 0),
|
||||
Child = new Box
|
||||
{
|
||||
RelativeSizeAxes = Axes.Both,
|
||||
Colour = colours.Background3,
|
||||
}
|
||||
},
|
||||
new FillFlowContainer
|
||||
{
|
||||
Anchor = Anchor.Centre,
|
||||
Origin = Anchor.Centre,
|
||||
AutoSizeAxes = Axes.Both,
|
||||
Direction = FillDirection.Horizontal,
|
||||
Spacing = new Vector2(4),
|
||||
Padding = new MarginPadding
|
||||
{
|
||||
Left = 8,
|
||||
Right = 16
|
||||
},
|
||||
Children = new Drawable[]
|
||||
{
|
||||
new SpriteIcon
|
||||
{
|
||||
Anchor = Anchor.CentreLeft,
|
||||
Origin = Anchor.CentreLeft,
|
||||
Size = new Vector2(16),
|
||||
Icon = FontAwesome.Solid.User,
|
||||
},
|
||||
totalCount = new OsuSpriteText
|
||||
{
|
||||
Font = OsuFont.Default.With(weight: FontWeight.Bold),
|
||||
Anchor = Anchor.CentreLeft,
|
||||
Origin = Anchor.CentreLeft,
|
||||
},
|
||||
avatarFlow = new FillFlowContainer<CircularAvatar>
|
||||
{
|
||||
Anchor = Anchor.CentreLeft,
|
||||
Origin = Anchor.CentreLeft,
|
||||
AutoSizeAxes = Axes.Both,
|
||||
Direction = FillDirection.Horizontal,
|
||||
Spacing = new Vector2(4),
|
||||
Margin = new MarginPadding { Left = 4 },
|
||||
},
|
||||
hiddenUsers = new HiddenUserCount
|
||||
{
|
||||
Anchor = Anchor.CentreLeft,
|
||||
Origin = Anchor.CentreLeft,
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
avatarFlow = new FillFlowContainer<CircularAvatar>
|
||||
{
|
||||
Anchor = Anchor.CentreLeft,
|
||||
Origin = Anchor.CentreLeft,
|
||||
AutoSizeAxes = Axes.Both,
|
||||
Direction = FillDirection.Horizontal,
|
||||
Spacing = new Vector2(4),
|
||||
Margin = new MarginPadding { Left = 4 },
|
||||
},
|
||||
hiddenUsers = new HiddenUserCount
|
||||
{
|
||||
Anchor = Anchor.CentreLeft,
|
||||
Origin = Anchor.CentreLeft,
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
@ -102,6 +162,8 @@ namespace osu.Game.Screens.OnlinePlay.Lounge.Components
|
||||
updateHiddenUsers();
|
||||
totalCount.Text = ParticipantCount.Value.ToString();
|
||||
}, true);
|
||||
|
||||
Host.BindValueChanged(onHostChanged, true);
|
||||
}
|
||||
|
||||
private int numberOfCircles = 4;
|
||||
@ -194,6 +256,18 @@ namespace osu.Game.Screens.OnlinePlay.Lounge.Components
|
||||
}
|
||||
}
|
||||
|
||||
private void onHostChanged(ValueChangedEvent<User> host)
|
||||
{
|
||||
hostAvatar.User = host.NewValue;
|
||||
hostText.Clear();
|
||||
|
||||
if (host.NewValue != null)
|
||||
{
|
||||
hostText.AddText("hosted by ");
|
||||
hostText.AddUserLink(host.NewValue);
|
||||
}
|
||||
}
|
||||
|
||||
private class CircularAvatar : CompositeDrawable
|
||||
{
|
||||
public User User
|
@ -12,7 +12,7 @@ using osuTK;
|
||||
|
||||
namespace osu.Game.Screens.OnlinePlay.Multiplayer.Match
|
||||
{
|
||||
public class BeatmapSelectionControl : RoomSubScreenComposite
|
||||
public class BeatmapSelectionControl : OnlinePlayComposite
|
||||
{
|
||||
[Resolved]
|
||||
private MultiplayerMatchSubScreen matchSubScreen { get; set; }
|
||||
|
@ -65,8 +65,11 @@ namespace osu.Game.Screens.OnlinePlay
|
||||
[Resolved(typeof(Room))]
|
||||
protected Bindable<TimeSpan?> Duration { get; private set; }
|
||||
|
||||
[Resolved(CanBeNull = true)]
|
||||
private IBindable<PlaylistItem> subScreenSelectedItem { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// The currently selected item in the <see cref="RoomSubScreen"/>, or the first item from <see cref="Playlist"/>
|
||||
/// The currently selected item in the <see cref="RoomSubScreen"/>, or the last item from <see cref="Playlist"/>
|
||||
/// if this <see cref="OnlinePlayComposite"/> is not within a <see cref="RoomSubScreen"/>.
|
||||
/// </summary>
|
||||
protected readonly Bindable<PlaylistItem> SelectedItem = new Bindable<PlaylistItem>();
|
||||
@ -75,12 +78,13 @@ namespace osu.Game.Screens.OnlinePlay
|
||||
{
|
||||
base.LoadComplete();
|
||||
|
||||
subScreenSelectedItem?.BindValueChanged(_ => UpdateSelectedItem());
|
||||
Playlist.BindCollectionChanged((_, __) => UpdateSelectedItem(), true);
|
||||
}
|
||||
|
||||
protected virtual void UpdateSelectedItem()
|
||||
{
|
||||
SelectedItem.Value = Playlist.FirstOrDefault();
|
||||
}
|
||||
=> SelectedItem.Value = RoomID.Value == null || subScreenSelectedItem == null
|
||||
? Playlist.LastOrDefault()
|
||||
: subScreenSelectedItem.Value;
|
||||
}
|
||||
}
|
||||
|
@ -1,38 +0,0 @@
|
||||
// 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.
|
||||
|
||||
using osu.Framework.Allocation;
|
||||
using osu.Framework.Bindables;
|
||||
using osu.Game.Online.Rooms;
|
||||
using osu.Game.Screens.OnlinePlay.Match;
|
||||
|
||||
namespace osu.Game.Screens.OnlinePlay
|
||||
{
|
||||
/// <summary>
|
||||
/// An <see cref="OnlinePlayComposite"/> with additional logic tracking the currently-selected <see cref="PlaylistItem"/> inside a <see cref="RoomSubScreen"/>.
|
||||
/// </summary>
|
||||
public class RoomSubScreenComposite : OnlinePlayComposite
|
||||
{
|
||||
[Resolved]
|
||||
private IBindable<PlaylistItem> subScreenSelectedItem { get; set; }
|
||||
|
||||
protected override void LoadComplete()
|
||||
{
|
||||
base.LoadComplete();
|
||||
|
||||
subScreenSelectedItem.BindValueChanged(_ => UpdateSelectedItem(), true);
|
||||
}
|
||||
|
||||
protected override void UpdateSelectedItem()
|
||||
{
|
||||
if (RoomID.Value == null)
|
||||
{
|
||||
// If the room hasn't been created yet, fall-back to the base logic.
|
||||
base.UpdateSelectedItem();
|
||||
return;
|
||||
}
|
||||
|
||||
SelectedItem.Value = subScreenSelectedItem.Value;
|
||||
}
|
||||
}
|
||||
}
|
@ -158,10 +158,10 @@ namespace osu.Game.Screens.Play
|
||||
{
|
||||
// Lazer's audio timings in general doesn't match stable. This is the result of user testing, albeit limited.
|
||||
// This only seems to be required on windows. We need to eventually figure out why, with a bit of luck.
|
||||
platformOffsetClock = new HardwareCorrectionOffsetClock(source) { Offset = RuntimeInfo.OS == RuntimeInfo.Platform.Windows ? 15 : 0 };
|
||||
platformOffsetClock = new HardwareCorrectionOffsetClock(source, pauseFreqAdjust) { Offset = RuntimeInfo.OS == RuntimeInfo.Platform.Windows ? 15 : 0 };
|
||||
|
||||
// the final usable gameplay clock with user-set offsets applied.
|
||||
userOffsetClock = new HardwareCorrectionOffsetClock(platformOffsetClock);
|
||||
userOffsetClock = new HardwareCorrectionOffsetClock(platformOffsetClock, pauseFreqAdjust);
|
||||
|
||||
return masterGameplayClock = new MasterGameplayClock(userOffsetClock);
|
||||
}
|
||||
@ -216,11 +216,25 @@ namespace osu.Game.Screens.Play
|
||||
{
|
||||
// we always want to apply the same real-time offset, so it should be adjusted by the difference in playback rate (from realtime) to achieve this.
|
||||
// base implementation already adds offset at 1.0 rate, so we only add the difference from that here.
|
||||
public override double CurrentTime => base.CurrentTime + Offset * (Rate - 1);
|
||||
public override double CurrentTime => base.CurrentTime + offsetAdjust;
|
||||
|
||||
public HardwareCorrectionOffsetClock(IClock source, bool processSource = true)
|
||||
: base(source, processSource)
|
||||
private readonly BindableDouble pauseRateAdjust;
|
||||
|
||||
private double offsetAdjust;
|
||||
|
||||
public HardwareCorrectionOffsetClock(IClock source, BindableDouble pauseRateAdjust)
|
||||
: base(source)
|
||||
{
|
||||
this.pauseRateAdjust = pauseRateAdjust;
|
||||
}
|
||||
|
||||
public override void ProcessFrame()
|
||||
{
|
||||
base.ProcessFrame();
|
||||
|
||||
// changing this during the pause transform effect will cause a potentially large offset to be suddenly applied as we approach zero rate.
|
||||
if (pauseRateAdjust.Value == 1)
|
||||
offsetAdjust = Offset * (Rate - 1);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1,6 +1,8 @@
|
||||
// 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.
|
||||
|
||||
using System.Diagnostics;
|
||||
using JetBrains.Annotations;
|
||||
using osu.Framework.Allocation;
|
||||
using osu.Framework.Bindables;
|
||||
using osu.Framework.Graphics;
|
||||
@ -20,6 +22,8 @@ namespace osu.Game.Skinning.Editor
|
||||
public class SkinEditorOverlay : CompositeDrawable, IKeyBindingHandler<GlobalAction>
|
||||
{
|
||||
private readonly ScalingContainer target;
|
||||
|
||||
[CanBeNull]
|
||||
private SkinEditor skinEditor;
|
||||
|
||||
public const float VISIBLE_TARGET_SCALE = 0.8f;
|
||||
@ -63,7 +67,7 @@ namespace osu.Game.Skinning.Editor
|
||||
public override void Hide()
|
||||
{
|
||||
// base call intentionally omitted.
|
||||
skinEditor.Hide();
|
||||
skinEditor?.Hide();
|
||||
}
|
||||
|
||||
public override void Show()
|
||||
@ -71,8 +75,12 @@ namespace osu.Game.Skinning.Editor
|
||||
// base call intentionally omitted.
|
||||
if (skinEditor == null)
|
||||
{
|
||||
LoadComponentAsync(skinEditor = new SkinEditor(target), AddInternal);
|
||||
skinEditor = new SkinEditor(target);
|
||||
skinEditor.State.BindValueChanged(editorVisibilityChanged);
|
||||
|
||||
Debug.Assert(skinEditor != null);
|
||||
|
||||
LoadComponentAsync(skinEditor, AddInternal);
|
||||
}
|
||||
else
|
||||
skinEditor.Show();
|
||||
@ -98,8 +106,13 @@ namespace osu.Game.Skinning.Editor
|
||||
}
|
||||
}
|
||||
|
||||
private void updateMasking() =>
|
||||
private void updateMasking()
|
||||
{
|
||||
if (skinEditor == null)
|
||||
return;
|
||||
|
||||
target.Masking = skinEditor.State.Value == Visibility.Visible;
|
||||
}
|
||||
|
||||
public void OnReleased(KeyBindingReleaseEvent<GlobalAction> e)
|
||||
{
|
||||
|
@ -36,7 +36,7 @@
|
||||
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
|
||||
</PackageReference>
|
||||
<PackageReference Include="Realm" Version="10.5.0" />
|
||||
<PackageReference Include="ppy.osu.Framework" Version="2021.927.0" />
|
||||
<PackageReference Include="ppy.osu.Framework" Version="2021.929.0" />
|
||||
<PackageReference Include="ppy.osu.Game.Resources" Version="2021.918.0" />
|
||||
<PackageReference Include="Sentry" Version="3.9.0" />
|
||||
<PackageReference Include="SharpCompress" Version="0.29.0" />
|
||||
|
@ -70,7 +70,7 @@
|
||||
<Reference Include="System.Net.Http" />
|
||||
</ItemGroup>
|
||||
<ItemGroup Label="Package References">
|
||||
<PackageReference Include="ppy.osu.Framework.iOS" Version="2021.927.0" />
|
||||
<PackageReference Include="ppy.osu.Framework.iOS" Version="2021.929.0" />
|
||||
<PackageReference Include="ppy.osu.Game.Resources" Version="2021.918.0" />
|
||||
</ItemGroup>
|
||||
<!-- See https://github.com/dotnet/runtime/issues/35988 (can be removed after Xamarin uses net5.0 / net6.0) -->
|
||||
@ -93,7 +93,7 @@
|
||||
<PackageReference Include="Microsoft.EntityFrameworkCore.Sqlite" Version="2.2.6" />
|
||||
<PackageReference Include="Microsoft.EntityFrameworkCore.Sqlite.Core" Version="2.2.6" />
|
||||
<PackageReference Include="Newtonsoft.Json" Version="13.0.1" />
|
||||
<PackageReference Include="ppy.osu.Framework" Version="2021.927.0" />
|
||||
<PackageReference Include="ppy.osu.Framework" Version="2021.929.0" />
|
||||
<PackageReference Include="SharpCompress" Version="0.28.3" />
|
||||
<PackageReference Include="NUnit" Version="3.13.2" />
|
||||
<PackageReference Include="SharpRaven" Version="2.4.0" />
|
||||
|
Loading…
Reference in New Issue
Block a user