mirror of
https://github.com/osukey/osukey.git
synced 2025-06-05 12:57:39 +09:00
Fix crash when switching rooms quickly
This commit is contained in:
parent
0bc5452801
commit
1bcd673a55
@ -16,54 +16,54 @@ namespace osu.Game.Online.Multiplayer
|
|||||||
{
|
{
|
||||||
[Cached]
|
[Cached]
|
||||||
[JsonProperty("id")]
|
[JsonProperty("id")]
|
||||||
public Bindable<int?> RoomID { get; private set; } = new Bindable<int?>();
|
public readonly Bindable<int?> RoomID = new Bindable<int?>();
|
||||||
|
|
||||||
[Cached]
|
[Cached]
|
||||||
[JsonProperty("name")]
|
[JsonProperty("name")]
|
||||||
public Bindable<string> Name { get; private set; } = new Bindable<string>();
|
public readonly Bindable<string> Name = new Bindable<string>();
|
||||||
|
|
||||||
[Cached]
|
[Cached]
|
||||||
[JsonProperty("host")]
|
[JsonProperty("host")]
|
||||||
public Bindable<User> Host { get; private set; } = new Bindable<User>();
|
public readonly Bindable<User> Host = new Bindable<User>();
|
||||||
|
|
||||||
[Cached]
|
[Cached]
|
||||||
[JsonProperty("playlist")]
|
[JsonProperty("playlist")]
|
||||||
public BindableList<PlaylistItem> Playlist { get; private set; } = new BindableList<PlaylistItem>();
|
public readonly BindableList<PlaylistItem> Playlist = new BindableList<PlaylistItem>();
|
||||||
|
|
||||||
[Cached]
|
[Cached]
|
||||||
[JsonProperty("channel_id")]
|
[JsonProperty("channel_id")]
|
||||||
public Bindable<int> ChannelId { get; private set; } = new Bindable<int>();
|
public readonly Bindable<int> ChannelId = new Bindable<int>();
|
||||||
|
|
||||||
[Cached]
|
[Cached]
|
||||||
[JsonIgnore]
|
[JsonIgnore]
|
||||||
public Bindable<TimeSpan> Duration { get; private set; } = new Bindable<TimeSpan>(TimeSpan.FromMinutes(30));
|
public readonly Bindable<TimeSpan> Duration = new Bindable<TimeSpan>(TimeSpan.FromMinutes(30));
|
||||||
|
|
||||||
[Cached]
|
[Cached]
|
||||||
[JsonIgnore]
|
[JsonIgnore]
|
||||||
public Bindable<int?> MaxAttempts { get; private set; } = new Bindable<int?>();
|
public readonly Bindable<int?> MaxAttempts = new Bindable<int?>();
|
||||||
|
|
||||||
[Cached]
|
[Cached]
|
||||||
[JsonIgnore]
|
[JsonIgnore]
|
||||||
public Bindable<RoomStatus> Status { get; private set; } = new Bindable<RoomStatus>(new RoomStatusOpen());
|
public readonly Bindable<RoomStatus> Status = new Bindable<RoomStatus>(new RoomStatusOpen());
|
||||||
|
|
||||||
[Cached]
|
[Cached]
|
||||||
[JsonIgnore]
|
[JsonIgnore]
|
||||||
public Bindable<RoomAvailability> Availability { get; private set; } = new Bindable<RoomAvailability>();
|
public readonly Bindable<RoomAvailability> Availability = new Bindable<RoomAvailability>();
|
||||||
|
|
||||||
[Cached]
|
[Cached]
|
||||||
[JsonIgnore]
|
[JsonIgnore]
|
||||||
public Bindable<GameType> Type { get; private set; } = new Bindable<GameType>(new GameTypeTimeshift());
|
public readonly Bindable<GameType> Type = new Bindable<GameType>(new GameTypeTimeshift());
|
||||||
|
|
||||||
[Cached]
|
[Cached]
|
||||||
[JsonIgnore]
|
[JsonIgnore]
|
||||||
public Bindable<int?> MaxParticipants { get; private set; } = new Bindable<int?>();
|
public readonly Bindable<int?> MaxParticipants = new Bindable<int?>();
|
||||||
|
|
||||||
[Cached]
|
[Cached]
|
||||||
[JsonProperty("recent_participants")]
|
[JsonProperty("recent_participants")]
|
||||||
public BindableList<User> RecentParticipants { get; private set; } = new BindableList<User>();
|
public readonly BindableList<User> RecentParticipants = new BindableList<User>();
|
||||||
|
|
||||||
[Cached]
|
[Cached]
|
||||||
public Bindable<int> ParticipantCount { get; private set; } = new Bindable<int>();
|
public readonly Bindable<int> ParticipantCount = new Bindable<int>();
|
||||||
|
|
||||||
// todo: TEMPORARY
|
// todo: TEMPORARY
|
||||||
[JsonProperty("participant_count")]
|
[JsonProperty("participant_count")]
|
||||||
@ -83,7 +83,7 @@ namespace osu.Game.Online.Multiplayer
|
|||||||
// Only supports retrieval for now
|
// Only supports retrieval for now
|
||||||
[Cached]
|
[Cached]
|
||||||
[JsonProperty("ends_at")]
|
[JsonProperty("ends_at")]
|
||||||
public Bindable<DateTimeOffset> EndDate { get; private set; } = new Bindable<DateTimeOffset>();
|
public readonly Bindable<DateTimeOffset> EndDate = new Bindable<DateTimeOffset>();
|
||||||
|
|
||||||
// Todo: Find a better way to do this (https://github.com/ppy/osu-framework/issues/1930)
|
// Todo: Find a better way to do this (https://github.com/ppy/osu-framework/issues/1930)
|
||||||
[JsonProperty("max_attempts", DefaultValueHandling = DefaultValueHandling.Ignore)]
|
[JsonProperty("max_attempts", DefaultValueHandling = DefaultValueHandling.Ignore)]
|
||||||
@ -97,7 +97,7 @@ namespace osu.Game.Online.Multiplayer
|
|||||||
/// The position of this <see cref="Room"/> in the list. This is not read from or written to the API.
|
/// The position of this <see cref="Room"/> in the list. This is not read from or written to the API.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[JsonIgnore]
|
[JsonIgnore]
|
||||||
public Bindable<int> Position { get; private set; } = new Bindable<int>(-1);
|
public readonly Bindable<int> Position = new Bindable<int>(-1);
|
||||||
|
|
||||||
public void CopyFrom(Room other)
|
public void CopyFrom(Room other)
|
||||||
{
|
{
|
||||||
@ -130,7 +130,7 @@ namespace osu.Game.Online.Multiplayer
|
|||||||
RecentParticipants.AddRange(other.RecentParticipants);
|
RecentParticipants.AddRange(other.RecentParticipants);
|
||||||
}
|
}
|
||||||
|
|
||||||
Position = other.Position;
|
Position.Value = other.Position.Value;
|
||||||
}
|
}
|
||||||
|
|
||||||
public bool ShouldSerializeRoomID() => false;
|
public bool ShouldSerializeRoomID() => false;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user