public GameStateMachinePlayer(PlanetWarsServerSettings settings, int playerId, ApiPlayerRole role, InternalLogger internalLogger, CancellationToken cancellationToken) { this.settings = settings; totalCommandsTimeoutLeft = settings.TotalCommandsTimeout; this.internalLogger = internalLogger; this.cancellationToken = cancellationToken; PlayerKey = ThreadLocalRandom.Instance.NextLong(); PlayerId = playerId; Role = role; Stats = new ApiPlayerStats { PlayerKey = PlayerKey, Role = role, Status = ApiPlayerStatus.NotJoined }; join = new Operation <JoinArg, GameProtocolResult>(cancellationToken); start = new Operation <StartArg, GameProtocolResult>(cancellationToken); start.TrySetRequestFaulted(); commands = new Operation <CommandsArg, GameProtocolResult>(cancellationToken); commands.TrySetRequestFaulted(); currentTask = join.WaitForResponseAsync(); }
public ApiResponsePoller(PlanetWarsServerSettings pwsSettings, IHostApplicationLifetime applicationLifetime) { this.pwsSettings = pwsSettings; hostShutdownToken = applicationLifetime.ApplicationStopping; }
public CountdownHandler(PlanetWarsServerSettings pwsSettings) { this.pwsSettings = pwsSettings; }