broken build, removing some session shit
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
Michele Scandura 2021-09-17 13:15:32 +01:00
parent f12132009f
commit 6a75126068
6 changed files with 79 additions and 79 deletions

View File

@ -47,8 +47,8 @@ public class Map:Session
public List<Player> Players { get; set; }
public ConcurrentDictionary<Guid, Ping> Pings { get; set; }
public List<string> Colors { get; set; }
public string SessionName { get; set; }
public Guid SessionId { get; set; }
//public string SessionName { get; set; }
//public Guid SessionId { get; set; }
public ConcurrentDictionary<string, Line> Lines { get; set; }
public ConcurrentDictionary<string, Room> Rooms { get; set; }

View File

@ -107,9 +107,9 @@ namespace Sledgemapper
Connection.On("RefreshPlayers", () =>
{
if (!string.IsNullOrWhiteSpace(SessionData.SessionName))
if (!string.IsNullOrWhiteSpace(State.Instance.MapName))
{
Connection?.SendAsync("UpdatePosition", SessionData.SessionName, State.Instance.MapId, SessionData.Players.First(p => p.UserId == new Guid(_authenticateResponse.Id)));
Connection?.SendAsync("UpdatePosition", State.Instance.MapName, State.Instance.MapId, SessionData.Players.First(p => p.UserId == new Guid(_authenticateResponse.Id)));
}
});
@ -198,22 +198,22 @@ namespace Sledgemapper
switch (entity)
{
case Tile tile:
Queue.Enqueue(async () => await Execute(async () => await Api.NewTile(tile, SessionData.SessionName).ConfigureAwait(false)));
Queue.Enqueue(async () => await Execute(async () => await Api.NewTile(tile, State.Instance.MapId).ConfigureAwait(false)));
break;
case Overlay overlay:
Queue.Enqueue(async () => await Execute(async () => await Api.NewOverlay(overlay,State.Instance.CampaignId, State.Instance.MapId).ConfigureAwait(false)));
break;
case Wall wall:
Queue.Enqueue(async () => await Execute(async () => await Api.NewWall(wall, SessionData.SessionName).ConfigureAwait(false)));
Queue.Enqueue(async () => await Execute(async () => await Api.NewWall(wall, State.Instance.MapId).ConfigureAwait(false)));
break;
case Note note:
Queue.Enqueue(async () => await Execute(async () => await Api.NewNote(note, SessionData.SessionName).ConfigureAwait(false)));
Queue.Enqueue(async () => await Execute(async () => await Api.NewNote(note, State.Instance.MapId).ConfigureAwait(false)));
break;
case Room room:
Queue.Enqueue(async () => await Execute(async () => await Api.NewRoom(room, SessionData.SessionName).ConfigureAwait(false)));
Queue.Enqueue(async () => await Execute(async () => await Api.NewRoom(room, State.Instance.MapId).ConfigureAwait(false)));
break;
case Line line:
Queue.Enqueue(async () => await Execute(async () => await Api.NewLine(line, SessionData.SessionName).ConfigureAwait(false)));
Queue.Enqueue(async () => await Execute(async () => await Api.NewLine(line, State.Instance.MapId).ConfigureAwait(false)));
break;
}
break;
@ -222,16 +222,16 @@ namespace Sledgemapper
switch (entity)
{
case Tile tile:
Queue.Enqueue(async () => await Execute(async () => await Api.DeleteTile(tile, SessionData.SessionName).ConfigureAwait(false)));
Queue.Enqueue(async () => await Execute(async () => await Api.DeleteTile(tile, State.Instance.MapId).ConfigureAwait(false)));
break;
case Overlay overlay:
Queue.Enqueue(async () => await Execute(async () => await Api.DeleteOverlay(overlay, SessionData.SessionName).ConfigureAwait(false)));
Queue.Enqueue(async () => await Execute(async () => await Api.DeleteOverlay(overlay, State.Instance.MapId).ConfigureAwait(false)));
break;
case Wall wall:
Queue.Enqueue(async () => await Execute(async () => await Api.DeleteWall(wall, SessionData.SessionName).ConfigureAwait(false)));
Queue.Enqueue(async () => await Execute(async () => await Api.DeleteWall(wall, State.Instance.MapId).ConfigureAwait(false)));
break;
case Note note:
Queue.Enqueue(async () => await Execute(async () => await Api.DeleteNote(note, SessionData.SessionName).ConfigureAwait(false)));
Queue.Enqueue(async () => await Execute(async () => await Api.DeleteNote(note, State.Instance.MapId).ConfigureAwait(false)));
break;
}
break;

View File

@ -16,31 +16,31 @@ namespace Sledgemapper
Task<Guid> NewSession(Guid campaignid, string sessionName);
[Post("/session/{sessionName}/snapshot")]
Task SaveSnapshot([Body] Session session, string sessionName);
Task SaveSnapshot([Body] Session session, Guid sessionName);
[Post("/session/{sessionName}/tile")]
Task NewTile([Body] Tile tile, string sessionName);
Task NewTile([Body] Tile tile, Guid sessionName);
[Post("/map/{campaignId}/{mapId}/overlay")]
Task NewOverlay([Body] Overlay overlay, Guid campaignId, Guid mapId);
[Post("/session/{sessionName}/note")]
Task NewNote([Body] Note note, string sessionName);
Task NewNote([Body] Note note, Guid sessionName);
[Post("/session/{sessionName}/wall")]
Task NewWall([Body] Wall overlay, string sessionName);
Task NewWall([Body] Wall overlay, Guid sessionName);
[Delete("/session/{sessionName}/wall")]
Task DeleteWall([Body] Wall wall, string sessionName);
Task DeleteWall([Body] Wall wall, Guid sessionName);
[Delete("/session/{sessionName}/tile")]
Task DeleteTile([Body] Tile tile, string sessionName);
Task DeleteTile([Body] Tile tile, Guid sessionName);
[Delete("/session/{sessionName}/overlay")]
Task DeleteOverlay([Body] Overlay overlay, string sessionName);
Task DeleteOverlay([Body] Overlay overlay, Guid sessionName);
[Delete("/session/{sessionName}/note")]
Task DeleteNote([Body] Note overlay, string sessionName);
Task DeleteNote([Body] Note overlay, Guid sessionName);
public class AuthResult
@ -59,10 +59,10 @@ namespace Sledgemapper
Task<AuthenticateResponse> Authenticate([Body] AuthenticateModel registerModel);
[Post("/session/{sessionName}/room")]
Task NewRoom(Room room, string sessionName);
Task NewRoom(Room room, Guid sessionName);
[Post("/session/{sessionName}/line")]
Task NewLine(Line line, string sessionName);
Task NewLine(Line line, Guid sessionName);
[Post("/campaign/{campaignName}")]
Task NewCampaign(string campaignName);

View File

@ -308,7 +308,7 @@ namespace Sledgemapper
{
_state.SelectedTile.X = _state.HoveredTile.X;
_state.SelectedTile.Y = _state.HoveredTile.Y;
_communicationManager.Connection?.SendAsync("UpdatePosition", _sessionData.SessionName, State.Instance.MapId, _state.SelectedTile);
_communicationManager.Connection?.SendAsync("UpdatePosition", State.Instance.MapName, State.Instance.MapId, _state.SelectedTile);
}
}
@ -358,7 +358,7 @@ namespace Sledgemapper
case InsertMode.Tile:
_state.SelectedTile.X = _state.HoveredTile.X;
_state.SelectedTile.Y = _state.HoveredTile.Y;
_communicationManager.Connection?.SendAsync("UpdatePosition", _sessionData.SessionName, _sessionData.SessionId, _state.SelectedTile);
_communicationManager.Connection?.SendAsync("UpdatePosition", State.Instance.MapName, State.Instance.MapId, _state.SelectedTile);
_sessionData.NewTile(_state.SelectedTile, _state.CurrentTileId);
break;
@ -515,28 +515,28 @@ namespace Sledgemapper
if (oldState.IsKeyUp(Keys.Left) && newState.IsKeyDown(Keys.Left))
{
_state.SelectedTile.X--;
_communicationManager.Connection?.SendAsync("UpdatePosition", _sessionData.SessionName, _state.SelectedTile);
_communicationManager.Connection?.SendAsync("UpdatePosition", State.Instance.MapId, _state.SelectedTile);
}
break;
case Keys.Right:
if (oldState.IsKeyUp(Keys.Right) && newState.IsKeyDown(Keys.Right))
{
_state.SelectedTile.X++;
_communicationManager.Connection?.SendAsync("UpdatePosition", _sessionData.SessionName, _state.SelectedTile);
_communicationManager.Connection?.SendAsync("UpdatePosition", State.Instance.MapId, _state.SelectedTile);
}
break;
case Keys.Up:
if (oldState.IsKeyUp(Keys.Up) && newState.IsKeyDown(Keys.Up))
{
_state.SelectedTile.Y--;
_communicationManager.Connection?.SendAsync("UpdatePosition", _sessionData.SessionName, _state.SelectedTile);
_communicationManager.Connection?.SendAsync("UpdatePosition", State.Instance.MapId, _state.SelectedTile);
}
break;
case Keys.Down:
if (oldState.IsKeyUp(Keys.Down) && newState.IsKeyDown(Keys.Down))
{
_state.SelectedTile.Y++;
_communicationManager.Connection?.SendAsync("UpdatePosition", _sessionData.SessionName, _state.SelectedTile);
_communicationManager.Connection?.SendAsync("UpdatePosition", State.Instance.MapId, _state.SelectedTile);
}
break;
}

View File

@ -37,7 +37,7 @@ namespace Sledgemapper.UI
MenuFileSettings.Selected += OneMenuFileSettingsSelected;
//MenuConnectLogin.Selected += OnMenuConnectLoginSelected;
//MenuConnectNew.Selected += OnMenuConnectNewSelected;
MenuConnectJoin.Selected += OnMenuConnectJoinSelected;
//MenuConnectJoin.Selected += OnMenuConnectJoinSelected;
MenuConnectUpload.Selected += OnMenuConnectUploadSelected;
MenuViewCenterOnSelection.Selected += OnMenuViewCenterOnSelectionSelected;
MenuViewShowCellNUmbers.Selected += OnMenuViewShowCellNUmbersSelected;
@ -235,7 +235,7 @@ namespace Sledgemapper.UI
return;
}
await CommunicationManager.Api.SaveSnapshot(CommunicationManager.SessionData, CommunicationManager.SessionData.SessionName);
await CommunicationManager.Api.SaveSnapshot(CommunicationManager.SessionData, State.Instance.MapId);
}
private void OnMenuFileSaveSelected(object sender, EventArgs e)
@ -392,56 +392,56 @@ namespace Sledgemapper.UI
content.ShowInModalWindow(Desktop, "Maps");
}
private async void OnButtonJoinSessionClicked(object sender, EventArgs e)
{
var localContent = ((TextButton)sender).GetParentContentInWindow<SessionWindow>();
//private async void OnButtonJoinSessionClicked(object sender, EventArgs e)
//{
// var localContent = ((TextButton)sender).GetParentContentInWindow<SessionWindow>();
var isValid = localContent.Content.TxtSession.ValidateTextbox();
if (!isValid)
{
return;
}
// var isValid = localContent.Content.TxtSession.ValidateTextbox();
// if (!isValid)
// {
// return;
// }
if (CommunicationManager.Connection.State != HubConnectionState.Connected)
{
lblConnectionStatus.Text = "Connecting";
await CommunicationManager.Connection.StartAsync();
UpdateConnectionState(CommunicationManager.Connection);
}
// if (CommunicationManager.Connection.State != HubConnectionState.Connected)
// {
// lblConnectionStatus.Text = "Connecting";
// await CommunicationManager.Connection.StartAsync();
// UpdateConnectionState(CommunicationManager.Connection);
// }
var successful = false;
try
{
var result = await CommunicationManager.Connection?.InvokeAsync<Session>("JoinSession", localContent.Content.TxtSession.Text);
if (result != null)
{
CommunicationManager.SessionData.Map = result.Map;
CommunicationManager.SessionData.Walls = result.Walls;
CommunicationManager.SessionData.Overlays = result.Overlays;
// var successful = false;
// try
// {
// var result = await CommunicationManager.Connection?.InvokeAsync<Session>("JoinSession", localContent.Content.TxtSession.Text);
// if (result != null)
// {
// CommunicationManager.SessionData.Map = result.Map;
// CommunicationManager.SessionData.Walls = result.Walls;
// CommunicationManager.SessionData.Overlays = result.Overlays;
CommunicationManager.SessionData.MapEntityAdded -= OnMapEntityAdded;
CommunicationManager.SessionData.MapEntityDeleted -= OnMapEntityDeleted;
CommunicationManager.SessionData.MapEntityAdded += OnMapEntityAdded;
CommunicationManager.SessionData.MapEntityDeleted += OnMapEntityDeleted;
CommunicationManager.SessionData.SessionId = result.SessionId;
CommunicationManager.SessionData.SessionName = result.SessionName;
}
successful = result != null;
}
catch (Exception ex)
{
Console.WriteLine(ex.Message);
}
// CommunicationManager.SessionData.MapEntityAdded -= OnMapEntityAdded;
// CommunicationManager.SessionData.MapEntityDeleted -= OnMapEntityDeleted;
// CommunicationManager.SessionData.MapEntityAdded += OnMapEntityAdded;
// CommunicationManager.SessionData.MapEntityDeleted += OnMapEntityDeleted;
// //CommunicationManager.SessionData.SessionId = result.SessionId;
// //CommunicationManager.SessionData.SessionName = result.SessionName;
// }
// successful = result != null;
// }
// catch (Exception ex)
// {
// Console.WriteLine(ex.Message);
// }
if (successful)
{
CommunicationManager.SessionData.SessionName = localContent.Content.TxtSession.Text;
lblMap.Text = CommunicationManager.SessionData.SessionName;
MenuConnectSync.Enabled = true;
MenuConnectUpload.Enabled = true;
localContent.Window.Close();
}
}
// if (successful)
// {
// CommunicationManager.SessionData.SessionName = localContent.Content.TxtSession.Text;
// lblMap.Text = CommunicationManager.SessionData.SessionName;
// MenuConnectSync.Enabled = true;
// MenuConnectUpload.Enabled = true;
// localContent.Window.Close();
// }
//}
private void OnBtnToolbarRoomClicked(object sender, EventArgs e)
{
State.Instance.InsertMode = InsertMode.NewRoom;

View File

@ -46,14 +46,14 @@ namespace Sledgemapper.UI
if (sessionGuid != Guid.Empty)
{
CommunicationManager.SessionData.SessionName = localContent.Content.TxtSession.Text;
//CommunicationManager.SessionData.SessionName = localContent.Content.TxtSession.Text;
State.Instance.SessionId = sessionGuid;
}
successful = true;
var result2 = await CommunicationManager.Connection?.InvokeAsync<Session>("JoinSession", localContent.Content.TxtSession.Text);
CommunicationManager.SessionData.SessionId = result2.SessionId;
CommunicationManager.SessionData.SessionName = localContent.Content.TxtSession.Text;
//CommunicationManager.SessionData.SessionId = result2.SessionId;
//CommunicationManager.SessionData.SessionName = localContent.Content.TxtSession.Text;
}
catch (Exception ex)
{