rectoring
This commit is contained in:
parent
628fab2146
commit
1ae0ee5a8a
16 changed files with 135 additions and 62 deletions
|
@ -17,6 +17,7 @@ namespace Sledgemapper
|
|||
public HubConnection Connection { get; private set; }
|
||||
public Session SessionData;
|
||||
private ChannelsQueue Queue = new ChannelsQueue();
|
||||
private AuthenticateResponse _authenticateResponse;
|
||||
|
||||
public CommunicationManager(Session sessionData)
|
||||
{
|
||||
|
@ -24,12 +25,15 @@ namespace Sledgemapper
|
|||
Connection = new HubConnectionBuilder()
|
||||
.WithAutomaticReconnect()
|
||||
|
||||
.WithUrl("http://localhost:5000/SledgemapperHub")
|
||||
.WithUrl("http://localhost:5000/SledgemapperHub", options =>
|
||||
{
|
||||
options.AccessTokenProvider = () => Task.FromResult(_authenticateResponse.Token);
|
||||
})
|
||||
|
||||
// .WithUrl("http://hub.michelescandura.com:5000/SledgemapperHub")
|
||||
.Build();
|
||||
|
||||
|
||||
|
||||
|
||||
var httpClientHandler = new HttpClientHandler();
|
||||
|
||||
|
@ -58,7 +62,7 @@ namespace Sledgemapper
|
|||
var p = SessionData.Players.FirstOrDefault(m => m.ConnectionId == player.ConnectionId);
|
||||
if (p != null)
|
||||
{
|
||||
p.Position = player.Position;
|
||||
p.Position = player.Position;
|
||||
}
|
||||
});
|
||||
|
||||
|
@ -100,16 +104,28 @@ namespace Sledgemapper
|
|||
var p = SessionData.Players.FirstOrDefault(m => m.ConnectionId == player.ConnectionId);
|
||||
if (p is null)
|
||||
{
|
||||
SessionData.Players.Add(player);
|
||||
SessionData.Players.Add(player);
|
||||
}
|
||||
else
|
||||
{
|
||||
p.Color = player.Color;
|
||||
p.Position = player.Position;
|
||||
p.Color = player.Color;
|
||||
p.Position = player.Position;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
public async Task<bool> Register(RegisterModel registerModel)
|
||||
{
|
||||
var result = await Api.Register(registerModel);
|
||||
return result.IsSuccessStatusCode;
|
||||
}
|
||||
|
||||
public async Task<AuthenticateResponse> Login(AuthenticateModel authenticateModel)
|
||||
{
|
||||
_authenticateResponse = await Api.Authenticate(authenticateModel);
|
||||
return _authenticateResponse;
|
||||
}
|
||||
|
||||
private async Task Execute(Func<Task> call)
|
||||
{
|
||||
await Policy
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue