mirror of
https://github.com/osukey/osukey.git
synced 2025-08-05 07:33:55 +09:00
Implement auto countdown timers
Change to using TimeSpan
This commit is contained in:
@ -239,7 +239,9 @@ namespace osu.Game.Online.Multiplayer
|
||||
/// <param name="password">The new password, if any.</param>
|
||||
/// <param name="matchType">The type of the match, if any.</param>
|
||||
/// <param name="queueMode">The new queue mode, if any.</param>
|
||||
public Task ChangeSettings(Optional<string> name = default, Optional<string> password = default, Optional<MatchType> matchType = default, Optional<QueueMode> queueMode = default)
|
||||
/// <param name="autoStartDuration">The new auto-start countdown duration, if any.</param>
|
||||
public Task ChangeSettings(Optional<string> name = default, Optional<string> password = default, Optional<MatchType> matchType = default, Optional<QueueMode> queueMode = default,
|
||||
Optional<TimeSpan> autoStartDuration = default)
|
||||
{
|
||||
if (Room == null)
|
||||
throw new InvalidOperationException("Must be joined to a match to change settings.");
|
||||
@ -250,6 +252,7 @@ namespace osu.Game.Online.Multiplayer
|
||||
Password = password.GetOr(Room.Settings.Password),
|
||||
MatchType = matchType.GetOr(Room.Settings.MatchType),
|
||||
QueueMode = queueMode.GetOr(Room.Settings.QueueMode),
|
||||
AutoStartDuration = autoStartDuration.GetOr(Room.Settings.AutoStartDuration),
|
||||
});
|
||||
}
|
||||
|
||||
|
@ -28,6 +28,9 @@ namespace osu.Game.Online.Multiplayer
|
||||
[Key(4)]
|
||||
public QueueMode QueueMode { get; set; } = QueueMode.HostOnly;
|
||||
|
||||
[Key(5)]
|
||||
public TimeSpan AutoStartDuration { get; set; }
|
||||
|
||||
public bool Equals(MultiplayerRoomSettings? other)
|
||||
{
|
||||
if (ReferenceEquals(this, other)) return true;
|
||||
@ -37,13 +40,15 @@ namespace osu.Game.Online.Multiplayer
|
||||
&& Name.Equals(other.Name, StringComparison.Ordinal)
|
||||
&& PlaylistItemId == other.PlaylistItemId
|
||||
&& MatchType == other.MatchType
|
||||
&& QueueMode == other.QueueMode;
|
||||
&& QueueMode == other.QueueMode
|
||||
&& AutoStartDuration == other.AutoStartDuration;
|
||||
}
|
||||
|
||||
public override string ToString() => $"Name:{Name}"
|
||||
+ $" Password:{(string.IsNullOrEmpty(Password) ? "no" : "yes")}"
|
||||
+ $" Type:{MatchType}"
|
||||
+ $" Item:{PlaylistItemId}"
|
||||
+ $" Queue:{QueueMode}";
|
||||
+ $" Queue:{QueueMode}"
|
||||
+ $" Start:{AutoStartDuration}";
|
||||
}
|
||||
}
|
||||
|
@ -92,6 +92,16 @@ namespace osu.Game.Online.Rooms
|
||||
set => QueueMode.Value = value;
|
||||
}
|
||||
|
||||
[Cached]
|
||||
public readonly Bindable<TimeSpan> AutoStartDuration = new Bindable<TimeSpan>();
|
||||
|
||||
[JsonProperty("start_duration")]
|
||||
private ushort autoStartDuration
|
||||
{
|
||||
get => (ushort)AutoStartDuration.Value.TotalSeconds;
|
||||
set => AutoStartDuration.Value = TimeSpan.FromSeconds(value);
|
||||
}
|
||||
|
||||
[Cached]
|
||||
public readonly Bindable<int?> MaxParticipants = new Bindable<int?>();
|
||||
|
||||
@ -172,6 +182,7 @@ namespace osu.Game.Online.Rooms
|
||||
EndDate.Value = other.EndDate.Value;
|
||||
UserScore.Value = other.UserScore.Value;
|
||||
QueueMode.Value = other.QueueMode.Value;
|
||||
AutoStartDuration.Value = other.AutoStartDuration.Value;
|
||||
DifficultyRange.Value = other.DifficultyRange.Value;
|
||||
PlaylistItemStats.Value = other.PlaylistItemStats.Value;
|
||||
CurrentPlaylistItem.Value = other.CurrentPlaylistItem.Value;
|
||||
|
Reference in New Issue
Block a user