ping on map feature complete

This commit is contained in:
Michele 2021-02-09 17:13:52 +00:00
parent 17cce56866
commit bce97de302
19 changed files with 1002 additions and 233 deletions

View file

@ -51,7 +51,7 @@ namespace Sledgemapper.Api.Hubs
await Clients.Group(sessionName).NewRoom(room);
}
public async Task NewLine(string sessionName, Line line)
public async Task NewLine(string sessionName, Line line)
{
await Clients.Group(sessionName).NewLine(line);
}
@ -86,6 +86,15 @@ namespace Sledgemapper.Api.Hubs
await Clients.Group(sessionName).DeleteOverlay(tile);
}
public async Task Ping(string sessionName, Tile location)
{
var userId = int.Parse(Context.User.Identity.Name);
var user = _datacontext.Users.First(u => u.Id == userId);
var player = new Player { UserId = userId, Initials = user.Initials, Position = new Tile { X = 0, Y = 0 }, Color = UserColors[userId] };
await Clients.Group(sessionName).Ping(new Ping{X=location.X, Y=location.Y, Player=player});
}
public async Task<Sledgemapper.Shared.Entities.Session> JoinSession(string sessionName)
{
var session = _dbContext.Sessions.FirstOrDefault(s => s.SessionName == sessionName);