2019-02-05 16:14:37 +09:00
|
|
|
// 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.
|
|
|
|
|
2022-06-17 16:37:17 +09:00
|
|
|
#nullable disable
|
|
|
|
|
2019-02-05 16:14:37 +09:00
|
|
|
using System;
|
|
|
|
using osu.Framework.Allocation;
|
2019-02-21 19:04:31 +09:00
|
|
|
using osu.Framework.Bindables;
|
2019-02-05 16:14:37 +09:00
|
|
|
using osu.Framework.Graphics.Containers;
|
2021-11-04 18:02:44 +09:00
|
|
|
using osu.Game.Online.API.Requests.Responses;
|
2021-11-19 14:46:53 +09:00
|
|
|
using osu.Game.Online.Multiplayer;
|
2020-12-25 13:38:11 +09:00
|
|
|
using osu.Game.Online.Rooms;
|
2021-02-16 17:35:44 +09:00
|
|
|
using osu.Game.Screens.OnlinePlay.Match;
|
2019-02-05 16:14:37 +09:00
|
|
|
|
2020-12-25 16:50:00 +01:00
|
|
|
namespace osu.Game.Screens.OnlinePlay
|
2019-02-05 16:14:37 +09:00
|
|
|
{
|
2021-02-18 15:47:33 +09:00
|
|
|
/// <summary>
|
|
|
|
/// A <see cref="CompositeDrawable"/> that exposes bindables for <see cref="Room"/> properties.
|
|
|
|
/// </summary>
|
2020-12-25 17:12:33 +01:00
|
|
|
public partial class OnlinePlayComposite : CompositeDrawable
|
2019-02-05 16:14:37 +09:00
|
|
|
{
|
|
|
|
[Resolved(typeof(Room))]
|
2021-02-16 19:29:40 +09:00
|
|
|
protected Bindable<long?> RoomID { get; private set; }
|
2019-02-05 16:14:37 +09:00
|
|
|
|
2019-04-25 17:36:17 +09:00
|
|
|
[Resolved(typeof(Room), nameof(Room.Name))]
|
|
|
|
protected Bindable<string> RoomName { get; private set; }
|
2019-02-05 16:14:37 +09:00
|
|
|
|
|
|
|
[Resolved(typeof(Room))]
|
2021-11-04 18:02:44 +09:00
|
|
|
protected Bindable<APIUser> Host { get; private set; }
|
2019-02-05 16:14:37 +09:00
|
|
|
|
|
|
|
[Resolved(typeof(Room))]
|
2019-02-05 19:00:01 +09:00
|
|
|
protected Bindable<RoomStatus> Status { get; private set; }
|
2019-02-05 16:14:37 +09:00
|
|
|
|
|
|
|
[Resolved(typeof(Room))]
|
2021-08-03 14:46:31 +09:00
|
|
|
protected Bindable<MatchType> Type { get; private set; }
|
2019-02-05 16:14:37 +09:00
|
|
|
|
2022-02-24 16:20:40 +09:00
|
|
|
/// <summary>
|
|
|
|
/// The currently selected item in the <see cref="RoomSubScreen"/>, or the current item from <see cref="Playlist"/>
|
|
|
|
/// if this <see cref="OnlinePlayComposite"/> is not within a <see cref="RoomSubScreen"/>.
|
|
|
|
/// </summary>
|
2022-02-21 19:02:21 +09:00
|
|
|
[Resolved(typeof(Room))]
|
|
|
|
protected Bindable<PlaylistItem> CurrentPlaylistItem { get; private set; }
|
|
|
|
|
|
|
|
[Resolved(typeof(Room))]
|
|
|
|
protected Bindable<Room.RoomPlaylistItemStats> PlaylistItemStats { get; private set; }
|
|
|
|
|
2019-02-05 16:14:37 +09:00
|
|
|
[Resolved(typeof(Room))]
|
2019-02-05 19:00:01 +09:00
|
|
|
protected BindableList<PlaylistItem> Playlist { get; private set; }
|
2019-02-05 16:14:37 +09:00
|
|
|
|
2022-02-24 16:12:15 +09:00
|
|
|
[Resolved(typeof(Room))]
|
|
|
|
protected Bindable<Room.RoomDifficultyRange> DifficultyRange { get; private set; }
|
|
|
|
|
2021-07-14 16:48:53 +09:00
|
|
|
[Resolved(typeof(Room))]
|
|
|
|
protected Bindable<RoomCategory> Category { get; private set; }
|
|
|
|
|
2019-02-05 16:14:37 +09:00
|
|
|
[Resolved(typeof(Room))]
|
2021-11-04 18:02:44 +09:00
|
|
|
protected BindableList<APIUser> RecentParticipants { get; private set; }
|
2019-02-05 16:14:37 +09:00
|
|
|
|
|
|
|
[Resolved(typeof(Room))]
|
2019-02-05 19:00:01 +09:00
|
|
|
protected Bindable<int> ParticipantCount { get; private set; }
|
2019-02-05 16:14:37 +09:00
|
|
|
|
|
|
|
[Resolved(typeof(Room))]
|
2019-02-05 19:00:01 +09:00
|
|
|
protected Bindable<int?> MaxParticipants { get; private set; }
|
2019-02-05 16:14:37 +09:00
|
|
|
|
2021-02-02 17:57:23 +09:00
|
|
|
[Resolved(typeof(Room))]
|
|
|
|
protected Bindable<int?> MaxAttempts { get; private set; }
|
|
|
|
|
2021-02-16 13:32:14 +09:00
|
|
|
[Resolved(typeof(Room))]
|
|
|
|
public Bindable<PlaylistAggregateScore> UserScore { get; private set; }
|
|
|
|
|
2024-05-31 11:49:56 +02:00
|
|
|
[Resolved(typeof(Room))]
|
|
|
|
protected Bindable<DateTimeOffset?> StartDate { get; private set; }
|
|
|
|
|
2019-02-05 16:14:37 +09:00
|
|
|
[Resolved(typeof(Room))]
|
2020-12-21 16:18:39 +09:00
|
|
|
protected Bindable<DateTimeOffset?> EndDate { get; private set; }
|
2019-02-05 16:14:37 +09:00
|
|
|
|
|
|
|
[Resolved(typeof(Room))]
|
2019-02-05 19:00:01 +09:00
|
|
|
protected Bindable<RoomAvailability> Availability { get; private set; }
|
2019-02-05 16:14:37 +09:00
|
|
|
|
2021-11-19 15:45:45 +09:00
|
|
|
[Resolved(typeof(Room))]
|
2021-07-19 20:02:14 +09:00
|
|
|
public Bindable<string> Password { get; private set; }
|
|
|
|
|
2019-02-05 16:14:37 +09:00
|
|
|
[Resolved(typeof(Room))]
|
2020-12-21 16:18:39 +09:00
|
|
|
protected Bindable<TimeSpan?> Duration { get; private set; }
|
2021-02-16 17:35:44 +09:00
|
|
|
|
2021-11-19 15:45:45 +09:00
|
|
|
[Resolved(typeof(Room))]
|
2021-11-16 14:53:10 +09:00
|
|
|
protected Bindable<QueueMode> QueueMode { get; private set; }
|
2021-11-01 18:52:57 +09:00
|
|
|
|
2022-03-18 22:00:39 +09:00
|
|
|
[Resolved(typeof(Room))]
|
|
|
|
protected Bindable<TimeSpan> AutoStartDuration { get; private set; }
|
|
|
|
|
2022-08-31 19:49:04 +09:00
|
|
|
[Resolved(typeof(Room))]
|
|
|
|
protected Bindable<bool> AutoSkip { get; private set; }
|
|
|
|
|
2021-09-29 20:52:03 +09:00
|
|
|
[Resolved(CanBeNull = true)]
|
|
|
|
private IBindable<PlaylistItem> subScreenSelectedItem { get; set; }
|
|
|
|
|
2021-02-17 21:42:22 +09:00
|
|
|
protected override void LoadComplete()
|
|
|
|
{
|
|
|
|
base.LoadComplete();
|
|
|
|
|
2021-09-29 20:52:03 +09:00
|
|
|
subScreenSelectedItem?.BindValueChanged(_ => UpdateSelectedItem());
|
2022-06-24 21:25:23 +09:00
|
|
|
Playlist.BindCollectionChanged((_, _) => UpdateSelectedItem(), true);
|
2021-02-17 21:42:22 +09:00
|
|
|
}
|
|
|
|
|
2022-02-23 13:37:45 +09:00
|
|
|
protected void UpdateSelectedItem()
|
|
|
|
{
|
2022-02-24 16:20:40 +09:00
|
|
|
// null room ID means this is a room in the process of being created.
|
|
|
|
if (RoomID.Value == null)
|
|
|
|
CurrentPlaylistItem.Value = Playlist.GetCurrentItem();
|
|
|
|
else if (subScreenSelectedItem != null)
|
|
|
|
CurrentPlaylistItem.Value = subScreenSelectedItem.Value;
|
2022-02-23 13:37:45 +09:00
|
|
|
}
|
2019-02-05 16:14:37 +09:00
|
|
|
}
|
|
|
|
}
|