From 676e4758a3f907c60190154119d7e98f899617e3 Mon Sep 17 00:00:00 2001 From: "Alex 'Braker' R." Date: Tue, 20 Aug 2024 20:13:36 +0200 Subject: [PATCH 1/3] Update current map design to fit mockup --- .../Services/CurrentMapService.cs | 17 ++++--- .../Templates/CurrentMapWidget.mt | 50 +++++++++++-------- 2 files changed, 40 insertions(+), 27 deletions(-) diff --git a/src/Modules/CurrentMapModule/Services/CurrentMapService.cs b/src/Modules/CurrentMapModule/Services/CurrentMapService.cs index 5ce9d636f..3e4ce7032 100644 --- a/src/Modules/CurrentMapModule/Services/CurrentMapService.cs +++ b/src/Modules/CurrentMapModule/Services/CurrentMapService.cs @@ -25,12 +25,12 @@ ICurrentMapSettings settings public async Task ShowWidgetAsync() { var map = await client.Remote.GetCurrentMapInfoAsync(); - await ShowManialinkAsync(map.UId); + await ShowManialinkAsync(map.UId, map.AuthorTime); } public async Task ShowWidgetAsync(MapGbxEventArgs args) { - await ShowManialinkAsync(args.Map.Uid); + await ShowManialinkAsync(args.Map.Uid, args.Map.AuthorTime); } public async Task HideWidgetAsync() @@ -39,7 +39,7 @@ public async Task HideWidgetAsync() logger.LogDebug("Hiding current map widget"); } - private async Task ShowManialinkAsync(string mapUId) + private async Task ShowManialinkAsync(string mapUId, int authorTime) { var dbMap = await mapRepository.GetMapByUidAsync(mapUId); @@ -48,16 +48,19 @@ private async Task ShowManialinkAsync(string mapUId) return; } - var author = dbMap.Author?.NickName; + var authorNickName = dbMap.Author?.NickName ?? "Unknown"; - if (dbMap.Author?.NickName == dbMap.Author?.AccountId) + if (authorNickName == dbMap.Author?.AccountId) { var serverMap = await client.Remote.GetCurrentMapInfoAsync(); - author = serverMap.AuthorNickname.Length > 0 ? serverMap.AuthorNickname : serverMap.Author; + authorNickName = serverMap.AuthorNickname.Length > 0 ? serverMap.AuthorNickname : serverMap.Author; } + logger.LogDebug("Current map {mapName} by {author} ({authorTime}).", dbMap.Name, authorNickName, authorTime); + await manialinkManager.SendPersistentManialinkAsync("CurrentMapModule.CurrentMapWidget", - new { map = dbMap, mapAuthor = author, settings }); + new { map = dbMap, mapAuthor = authorNickName, authorTime, settings }); + logger.LogDebug("Showing current map widget"); } } diff --git a/src/Modules/CurrentMapModule/Templates/CurrentMapWidget.mt b/src/Modules/CurrentMapModule/Templates/CurrentMapWidget.mt index eb3816eb2..4ee877e8f 100644 --- a/src/Modules/CurrentMapModule/Templates/CurrentMapWidget.mt +++ b/src/Modules/CurrentMapModule/Templates/CurrentMapWidget.mt @@ -6,30 +6,40 @@ - - + + + From f669ff6f06cc846b584165c01ee1b963be1f3ed6 Mon Sep 17 00:00:00 2001 From: "Alex 'Braker' R." Date: Tue, 20 Aug 2024 20:21:04 +0200 Subject: [PATCH 2/3] Update next map widget design --- .../Controllers/NextMapEventController.cs | 2 +- .../NextMapModule/Templates/NextMap.mt | 40 +++++++++---------- 2 files changed, 21 insertions(+), 21 deletions(-) diff --git a/src/Modules/NextMapModule/Controllers/NextMapEventController.cs b/src/Modules/NextMapModule/Controllers/NextMapEventController.cs index 924198a57..543449b28 100644 --- a/src/Modules/NextMapModule/Controllers/NextMapEventController.cs +++ b/src/Modules/NextMapModule/Controllers/NextMapEventController.cs @@ -25,7 +25,7 @@ public async Task ShowNextMapOnPodiumStartAsync(object sender, PodiumEventArgs a { var nextMap = await nextMapService.GetNextMapAsync(); await manialinkManager.SendManialinkAsync(Template, - new { mapName = nextMap.Name, author = nextMap.Author?.NickName, settings }); + new { mapName = nextMap.Name, mapAuthor = nextMap.Author?.NickName ?? "Unknown", settings }); } [Subscribe(GbxRemoteEvent.BeginMap)] diff --git a/src/Modules/NextMapModule/Templates/NextMap.mt b/src/Modules/NextMapModule/Templates/NextMap.mt index a601d30e8..4c4f60b76 100644 --- a/src/Modules/NextMapModule/Templates/NextMap.mt +++ b/src/Modules/NextMapModule/Templates/NextMap.mt @@ -6,30 +6,30 @@ - - + + From fe7f07c1a81d4a4a30525f514d251f1eb301bca0 Mon Sep 17 00:00:00 2001 From: "Alex 'Braker' R." Date: Tue, 20 Aug 2024 20:22:13 +0200 Subject: [PATCH 3/3] Center author name in next map widget --- src/Modules/NextMapModule/Templates/NextMap.mt | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/Modules/NextMapModule/Templates/NextMap.mt b/src/Modules/NextMapModule/Templates/NextMap.mt index 4c4f60b76..fe7781b15 100644 --- a/src/Modules/NextMapModule/Templates/NextMap.mt +++ b/src/Modules/NextMapModule/Templates/NextMap.mt @@ -27,7 +27,8 @@ textfont="{{ Font.Thin }}" class="text-primary" textsize="0.35" - pos="2.0 -5.5" + halign="center" + pos="{{ settings.Width/2.0 }} -5.5" size="{{ settings.Width/2.0 }} 5" />