~ruther/NosSmooth

24320e72747755f86f7eeab56b3885abe3e0a1b2 — Rutherther 3 years ago 9768d2b 2022.6
feat(core): add map changed control cancel reason
M Core/NosSmooth.Core/Commands/Control/ControlCancelReason.cs => Core/NosSmooth.Core/Commands/Control/ControlCancelReason.cs +5 -0
@@ 22,6 22,11 @@ public enum ControlCancelReason
    UserAction,

    /// <summary>
    /// The map has been changed.
    /// </summary>
    MapChanged,

    /// <summary>
    /// There was another task that cancelled this one.
    /// </summary>
    AnotherTask

M Core/NosSmooth.Core/Commands/Control/ControlCommandPacketResponders.cs => Core/NosSmooth.Core/Commands/Control/ControlCommandPacketResponders.cs +1 -4
@@ 28,12 28,9 @@ public class ControlCommandPacketResponders : IPacketResponder<CMapPacket>
    public ControlCommandPacketResponders(ControlCommands controlCommands)
    {
        _controlCommands = controlCommands;

    }

    /// <inheritdoc />
    public Task<Result> Respond(PacketEventArgs<CMapPacket> packet, CancellationToken ct = default)
    {
        return _controlCommands.CancelAsync(ControlCommandsFilter.MapChangeCancellable);
    }
        => _controlCommands.CancelAsync(ControlCommandsFilter.MapChangeCancellable, ct: ct);
}
\ No newline at end of file

M Core/NosSmooth.Core/Commands/Control/ControlCommands.cs => Core/NosSmooth.Core/Commands/Control/ControlCommands.cs +1 -1
@@ 277,7 277,7 @@ public class ControlCommands
        var cancelReason = filter switch
        {
            ControlCommandsFilter.UserCancellable => ControlCancelReason.UserAction,
            ControlCommandsFilter.MapChangeCancellable => ControlCancelReason.UserAction,
            ControlCommandsFilter.MapChangeCancellable => ControlCancelReason.MapChanged,
            _ => ControlCancelReason.AnotherTask
        };


Do not follow this link