mirror of
https://github.com/osukey/osukey.git
synced 2025-08-04 23:24:04 +09:00
Add auto-skip setting
Default to auto skip
This commit is contained in:
@ -265,8 +265,9 @@ namespace osu.Game.Online.Multiplayer
|
||||
/// <param name="matchType">The type of the match, if any.</param>
|
||||
/// <param name="queueMode">The new queue mode, if any.</param>
|
||||
/// <param name="autoStartDuration">The new auto-start countdown duration, if any.</param>
|
||||
/// <param name="autoSkip">The new auto-skip setting.</param>
|
||||
public Task ChangeSettings(Optional<string> name = default, Optional<string> password = default, Optional<MatchType> matchType = default, Optional<QueueMode> queueMode = default,
|
||||
Optional<TimeSpan> autoStartDuration = default)
|
||||
Optional<TimeSpan> autoStartDuration = default, Optional<bool> autoSkip = default)
|
||||
{
|
||||
if (Room == null)
|
||||
throw new InvalidOperationException("Must be joined to a match to change settings.");
|
||||
@ -278,6 +279,7 @@ namespace osu.Game.Online.Multiplayer
|
||||
MatchType = matchType.GetOr(Room.Settings.MatchType),
|
||||
QueueMode = queueMode.GetOr(Room.Settings.QueueMode),
|
||||
AutoStartDuration = autoStartDuration.GetOr(Room.Settings.AutoStartDuration),
|
||||
AutoSkip = autoSkip.GetOr(Room.Settings.AutoSkip)
|
||||
});
|
||||
}
|
||||
|
||||
@ -739,6 +741,7 @@ namespace osu.Game.Online.Multiplayer
|
||||
APIRoom.QueueMode.Value = Room.Settings.QueueMode;
|
||||
APIRoom.AutoStartDuration.Value = Room.Settings.AutoStartDuration;
|
||||
APIRoom.CurrentPlaylistItem.Value = APIRoom.Playlist.Single(item => item.ID == settings.PlaylistItemId);
|
||||
APIRoom.AutoSkip.Value = Room.Settings.AutoSkip;
|
||||
|
||||
RoomUpdated?.Invoke();
|
||||
}
|
||||
|
@ -29,6 +29,9 @@ namespace osu.Game.Online.Multiplayer
|
||||
[Key(5)]
|
||||
public TimeSpan AutoStartDuration { get; set; }
|
||||
|
||||
[Key(6)]
|
||||
public bool AutoSkip { get; set; }
|
||||
|
||||
[IgnoreMember]
|
||||
public bool AutoStartEnabled => AutoStartDuration != TimeSpan.Zero;
|
||||
|
||||
@ -42,7 +45,8 @@ namespace osu.Game.Online.Multiplayer
|
||||
&& PlaylistItemId == other.PlaylistItemId
|
||||
&& MatchType == other.MatchType
|
||||
&& QueueMode == other.QueueMode
|
||||
&& AutoStartDuration == other.AutoStartDuration;
|
||||
&& AutoStartDuration == other.AutoStartDuration
|
||||
&& AutoSkip == other.AutoSkip;
|
||||
}
|
||||
|
||||
public override string ToString() => $"Name:{Name}"
|
||||
@ -50,6 +54,7 @@ namespace osu.Game.Online.Multiplayer
|
||||
+ $" Type:{MatchType}"
|
||||
+ $" Item:{PlaylistItemId}"
|
||||
+ $" Queue:{QueueMode}"
|
||||
+ $" Start:{AutoStartDuration}";
|
||||
+ $" Start:{AutoStartDuration}"
|
||||
+ $" AutoSkip:{AutoSkip}";
|
||||
}
|
||||
}
|
||||
|
@ -159,6 +159,10 @@ namespace osu.Game.Online.Rooms
|
||||
set => MaxAttempts.Value = value;
|
||||
}
|
||||
|
||||
[Cached]
|
||||
[JsonProperty("auto_skip")]
|
||||
public readonly Bindable<bool> AutoSkip = new Bindable<bool>(true);
|
||||
|
||||
public Room()
|
||||
{
|
||||
Password.BindValueChanged(p => HasPassword.Value = !string.IsNullOrEmpty(p.NewValue));
|
||||
@ -195,6 +199,7 @@ namespace osu.Game.Online.Rooms
|
||||
DifficultyRange.Value = other.DifficultyRange.Value;
|
||||
PlaylistItemStats.Value = other.PlaylistItemStats.Value;
|
||||
CurrentPlaylistItem.Value = other.CurrentPlaylistItem.Value;
|
||||
AutoSkip.Value = other.AutoSkip.Value;
|
||||
|
||||
if (EndDate.Value != null && DateTimeOffset.Now >= EndDate.Value)
|
||||
Status.Value = new RoomStatusEnded();
|
||||
|
Reference in New Issue
Block a user