From 85e2f699bf31afedb9ac82cc2a389005a805ea4c Mon Sep 17 00:00:00 2001 From: Michele Scandura Date: Fri, 24 Sep 2021 10:21:44 +0100 Subject: [PATCH] general fixes --- .../Handlers/NewCampaignCommandHandler.cs | 4 ++-- Sledgemapper.Api/Sledgemapper.Api.csproj | 18 +++++++++--------- Sledgemapper/CommunicationManager.cs | 11 ++++++++++- Sledgemapper/Sledgemapper.cs | 1 + Sledgemapper/Sledgemapper.csproj | 2 +- Sledgemapper/UI/MainWidget.Custom.cs | 7 ++++++- 6 files changed, 29 insertions(+), 14 deletions(-) diff --git a/Sledgemapper.Api/Handlers/NewCampaignCommandHandler.cs b/Sledgemapper.Api/Handlers/NewCampaignCommandHandler.cs index 0c61334..f6b505e 100644 --- a/Sledgemapper.Api/Handlers/NewCampaignCommandHandler.cs +++ b/Sledgemapper.Api/Handlers/NewCampaignCommandHandler.cs @@ -23,7 +23,7 @@ namespace Sledgemapper.Api.Handlers { try { - var user = await _dbcontext.Users.FindAsync(notification.UserId, cancellationToken); + var user = await _dbcontext.Users.FindAsync(new object[] { notification.UserId }, cancellationToken); _dbcontext.Attach(user); var campaign = new Core.Entities.Campaign { @@ -39,7 +39,7 @@ namespace Sledgemapper.Api.Handlers } catch (Exception ex) { - + } return false; diff --git a/Sledgemapper.Api/Sledgemapper.Api.csproj b/Sledgemapper.Api/Sledgemapper.Api.csproj index 30d003d..a5dbc63 100644 --- a/Sledgemapper.Api/Sledgemapper.Api.csproj +++ b/Sledgemapper.Api/Sledgemapper.Api.csproj @@ -9,19 +9,19 @@ - - - - - + + + + + runtime; build; native; contentfiles; analyzers; buildtransitive all - + - - - + + + diff --git a/Sledgemapper/CommunicationManager.cs b/Sledgemapper/CommunicationManager.cs index 52bdd5d..c584097 100644 --- a/Sledgemapper/CommunicationManager.cs +++ b/Sledgemapper/CommunicationManager.cs @@ -301,7 +301,16 @@ namespace Sledgemapper Program.helper.SaveUnencryptedTokenCache(JsonSerializer.SerializeToUtf8Bytes(_authenticateResponse)); - + await Connection.StopAsync(); + + State.Instance.CampaignId=Guid.Empty; + State.Instance.CampaignName = string.Empty; + State.Instance.SessionId = Guid.Empty; + State.Instance.MapId = Guid.Empty; + State.Instance.MapName = string.Empty; + SessionData.SessionId = Guid.Empty; + SessionData.SessionName = string.Empty; + SessionData.Players.Clear(); return _authenticateResponse; } diff --git a/Sledgemapper/Sledgemapper.cs b/Sledgemapper/Sledgemapper.cs index fe3864d..00d7cf8 100644 --- a/Sledgemapper/Sledgemapper.cs +++ b/Sledgemapper/Sledgemapper.cs @@ -57,6 +57,7 @@ namespace Sledgemapper MyraEnvironment.Game = this; + _sessionData = new Session(); IsFixedTimeStep = true; TargetElapsedTime = TimeSpan.FromSeconds(1d / 30d); diff --git a/Sledgemapper/Sledgemapper.csproj b/Sledgemapper/Sledgemapper.csproj index 7cbb026..4789d7e 100644 --- a/Sledgemapper/Sledgemapper.csproj +++ b/Sledgemapper/Sledgemapper.csproj @@ -58,7 +58,7 @@ - + runtime; build; native; contentfiles; analyzers; buildtransitive all diff --git a/Sledgemapper/UI/MainWidget.Custom.cs b/Sledgemapper/UI/MainWidget.Custom.cs index f8379c6..1bb9990 100644 --- a/Sledgemapper/UI/MainWidget.Custom.cs +++ b/Sledgemapper/UI/MainWidget.Custom.cs @@ -229,7 +229,12 @@ namespace Sledgemapper.UI //MenuConnectJoin.Enabled = true; MenuCampaignOpen.Enabled = true; MenuCampaingNew.Enabled = true; - + MenuMapNew.Enabled = false; + MenuMapOpen.Enabled = false; + lblCampaign.Text = "n/a"; + lblMap.Text = "n/a"; + CommunicationManager.SessionData.MapEntityAdded -= OnMapEntityAdded; + CommunicationManager.SessionData.MapEntityDeleted -= OnMapEntityDeleted; lblUsername.Text = $"{obj.Initials}"; }