mirror of
https://github.com/osukey/osukey.git
synced 2025-08-05 07:33:55 +09:00
Extra mods -> user mods
This commit is contained in:
@ -57,7 +57,7 @@ namespace osu.Game.Online.Multiplayer
|
||||
/// <param name="beatmapAvailability">The new beatmap availability state of the user.</param>
|
||||
Task UserBeatmapAvailabilityChanged(int userId, BeatmapAvailability beatmapAvailability);
|
||||
|
||||
Task UserExtraModsChanged(int userId, IEnumerable<APIMod> mods);
|
||||
Task UserModsChanged(int userId, IEnumerable<APIMod> mods);
|
||||
|
||||
/// <summary>
|
||||
/// Signals that a match is to be started. This will *only* be sent to clients which are to begin loading at this point.
|
||||
|
@ -49,7 +49,7 @@ namespace osu.Game.Online.Multiplayer
|
||||
/// <param name="newBeatmapAvailability">The proposed new beatmap availability state.</param>
|
||||
Task ChangeBeatmapAvailability(BeatmapAvailability newBeatmapAvailability);
|
||||
|
||||
Task ChangeExtraMods(IEnumerable<APIMod> newMods);
|
||||
Task ChangeUserMods(IEnumerable<APIMod> newMods);
|
||||
|
||||
/// <summary>
|
||||
/// As the host of a room, start the match.
|
||||
|
@ -4,6 +4,7 @@
|
||||
#nullable enable
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
@ -84,6 +85,7 @@ namespace osu.Game.Online.Multiplayer
|
||||
connection.On(nameof(IMultiplayerClient.LoadRequested), ((IMultiplayerClient)this).LoadRequested);
|
||||
connection.On(nameof(IMultiplayerClient.MatchStarted), ((IMultiplayerClient)this).MatchStarted);
|
||||
connection.On(nameof(IMultiplayerClient.ResultsReady), ((IMultiplayerClient)this).ResultsReady);
|
||||
connection.On<int, IEnumerable<APIMod>>(nameof(IMultiplayerClient.UserModsChanged), ((IMultiplayerClient)this).UserModsChanged);
|
||||
|
||||
connection.Closed += async ex =>
|
||||
{
|
||||
@ -182,6 +184,14 @@ namespace osu.Game.Online.Multiplayer
|
||||
return connection.InvokeAsync(nameof(IMultiplayerServer.ChangeBeatmapAvailability), newBeatmapAvailability);
|
||||
}
|
||||
|
||||
public override Task ChangeUserMods(IEnumerable<APIMod> newMods)
|
||||
{
|
||||
if (!isConnected.Value)
|
||||
return Task.CompletedTask;
|
||||
|
||||
return connection.InvokeAsync(nameof(IMultiplayerServer.ChangeUserMods), newMods);
|
||||
}
|
||||
|
||||
public override Task StartMatch()
|
||||
{
|
||||
if (!isConnected.Value)
|
||||
|
@ -27,7 +27,7 @@ namespace osu.Game.Online.Multiplayer
|
||||
public BeatmapAvailability BeatmapAvailability { get; set; } = BeatmapAvailability.LocallyAvailable();
|
||||
|
||||
[NotNull]
|
||||
public IEnumerable<APIMod> ExtraMods { get; set; } = Enumerable.Empty<APIMod>();
|
||||
public IEnumerable<APIMod> UserMods { get; set; } = Enumerable.Empty<APIMod>();
|
||||
|
||||
public User? User { get; set; }
|
||||
|
||||
|
@ -232,9 +232,9 @@ namespace osu.Game.Online.Multiplayer
|
||||
|
||||
public abstract Task ChangeBeatmapAvailability(BeatmapAvailability newBeatmapAvailability);
|
||||
|
||||
public Task ChangeExtraMods(IEnumerable<Mod> newMods) => ChangeExtraMods(newMods.Select(m => new APIMod(m)).ToList());
|
||||
public Task ChangeUserMods(IEnumerable<Mod> newMods) => ChangeUserMods(newMods.Select(m => new APIMod(m)).ToList());
|
||||
|
||||
public abstract Task ChangeExtraMods(IEnumerable<APIMod> newMods);
|
||||
public abstract Task ChangeUserMods(IEnumerable<APIMod> newMods);
|
||||
|
||||
public abstract Task StartMatch();
|
||||
|
||||
@ -384,7 +384,7 @@ namespace osu.Game.Online.Multiplayer
|
||||
return Task.CompletedTask;
|
||||
}
|
||||
|
||||
public Task UserExtraModsChanged(int userId, IEnumerable<APIMod> mods)
|
||||
public Task UserModsChanged(int userId, IEnumerable<APIMod> mods)
|
||||
{
|
||||
if (Room == null)
|
||||
return Task.CompletedTask;
|
||||
@ -397,7 +397,7 @@ namespace osu.Game.Online.Multiplayer
|
||||
if (user == null)
|
||||
return;
|
||||
|
||||
user.ExtraMods = mods;
|
||||
user.UserMods = mods;
|
||||
|
||||
RoomUpdated?.Invoke();
|
||||
}, false);
|
||||
|
Reference in New Issue
Block a user