public Task StartSinglePlayerGameAsync(string gameName, string playerName) { var command = new StartSinglePlayerGameCommand { PlayerName = playerName }; return(_client.SendJsonAsync(HttpMethod.Post, $"/api/game/{gameName}/start", command)); }
public static async Task StartSinglePlayerGame( [HttpTrigger(AuthorizationLevel.Anonymous, "POST", Route = "game/{gameName}/start")] StartSinglePlayerGameCommand command, [DurableClient] IDurableEntityClient client, [SignalR(HubName = "ponies")] IAsyncCollector <SignalRGroupAction> signalRGroupActions, string gameName) { await signalRGroupActions.AddAsync(new SignalRGroupAction { UserId = command.PlayerName, GroupName = gameName, Action = GroupAction.Add }); var entityId = new EntityId(nameof(GameSession), gameName); await client.SignalEntityAsync <IGameSession>(entityId, proxy => proxy.StartSinglePlayer(command.PlayerName)); }