1
0
mirror of https://github.com/ppy/osu.git synced 2025-02-15 21:42:55 +08:00

Add room settings related model and event flow

This commit is contained in:
Dean Herbert 2020-12-08 14:33:38 +09:00
parent 6e5846d91b
commit baf16cfbc3
3 changed files with 33 additions and 0 deletions

View File

@ -27,5 +27,11 @@ namespace osu.Game.Online.RealtimeMultiplayer
/// </summary>
/// <param name="user">The user.</param>
Task UserLeft(MultiplayerRoomUser user);
/// <summary>
/// Signals that the settings for this room have changed.
/// </summary>
/// <param name="newSettings">The updated room settings.</param>
Task SettingsChanged(MultiplayerRoomSettings newSettings);
}
}

View File

@ -15,6 +15,8 @@ namespace osu.Game.Online.RealtimeMultiplayer
public MultiplayerRoomState State { get; set; }
public MultiplayerRoomSettings Settings { get; set; }
private List<MultiplayerRoomUser> users = new List<MultiplayerRoomUser>();
public IReadOnlyList<MultiplayerRoomUser> Users

View File

@ -0,0 +1,25 @@
// 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;
using System.Collections.Generic;
using System.Linq;
using JetBrains.Annotations;
using osu.Game.Online.API;
namespace osu.Game.Online.RealtimeMultiplayer
{
public class MultiplayerRoomSettings : IEquatable<MultiplayerRoomSettings>
{
public int? BeatmapID { get; set; }
public int? RulesetID { get; set; }
[NotNull]
public IEnumerable<APIMod> Mods { get; set; } = Enumerable.Empty<APIMod>();
public bool Equals(MultiplayerRoomSettings other) => BeatmapID == other?.BeatmapID && Mods.SequenceEqual(other?.Mods) && RulesetID == other?.RulesetID;
public override string ToString() => $"Beatmap:{BeatmapID} Mods:{string.Join(',', Mods)} Ruleset:{RulesetID}";
}
}