~ruther/NosSmooth

ref: 2023.12 NosSmooth/Core/NosSmooth.Game/Contracts/ContractEventResponder.cs -rw-r--r-- 1016 bytes
58d87434 — Rutherther chore: bump versions 2 years ago
                                                                                
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
//
//  ContractEventResponder.cs
//
//  Copyright (c) František Boháček. All rights reserved.
//  Licensed under the MIT license. See LICENSE file in the project root for full license information.

using NosSmooth.Core.Contracts;
using NosSmooth.Game.Events;
using NosSmooth.Game.Events.Core;
using Remora.Results;

namespace NosSmooth.Game.Contracts;

/// <summary>
/// A responder that calls Contractor update.
/// </summary>
public class ContractEventResponder : IEveryGameResponder
{
    private readonly Contractor _contractor;

    /// <summary>
    /// Initializes a new instance of the <see cref="ContractEventResponder"/> class.
    /// </summary>
    /// <param name="contractor">The contractor.</param>
    public ContractEventResponder(Contractor contractor)
    {
        _contractor = contractor;

    }

    /// <inheritdoc />
    public Task<Result> Respond<TEvent>(TEvent gameEvent, CancellationToken ct = default)
        where TEvent : IGameEvent
        => _contractor.Update(gameEvent, ct);
}
Do not follow this link