From fee42b9d6fadf27a5bb6c758538fa0fb07493d57 Mon Sep 17 00:00:00 2001 From: baletiballo <75846481+baletiballo@users.noreply.github.com> Date: Wed, 18 Dec 2024 17:40:40 +0100 Subject: [PATCH] Update WebViewController.cs --- Assets/Scripts/UI/InGame/WebViewController.cs | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/Assets/Scripts/UI/InGame/WebViewController.cs b/Assets/Scripts/UI/InGame/WebViewController.cs index 9211244b..c1cb33f3 100644 --- a/Assets/Scripts/UI/InGame/WebViewController.cs +++ b/Assets/Scripts/UI/InGame/WebViewController.cs @@ -95,15 +95,20 @@ private async void SetScrollContent(Scroll scroll) var slotId = match.Groups[2].Value; var assignment = SwitchScrollUI.activeScrollData.Assignments[slotId]; /** label of the assigned fact, or the slot label if nothing assigned */ - var label = assignment.IsSet ? assignment.fact.GetLabel(StageStatic.stage.factState) : scroll.requiredFacts.Find(fact => fact.@ref.uri == slotId).label; - return $"<mi dropzone='copy' data-slot-id='{slotId}' {(assignment.IsSet ? $"data-fact-id='{assignment.fact.Id}'" : "")} {extraAttributes}>{label}</mi>"; + var label = assignment.IsSet ? assignment.fact.GetLabel(StageStatic.stage.factState) + : scroll.requiredFacts.Find(fact => fact.@ref.uri == slotId).label; + /** id of the assigned fact. If nothing is assigned don't add the attribute */ + var fact_id = assignment.IsSet ? $"data-fact-id='{assignment.fact.Id}'" + : ""; + return $"<mi dropzone='copy' data-slot-id='{slotId}' {fact_id} {extraAttributes}>{label}</mi>"; }); // replace solution templates description = Regex.Replace(description, "<scroll-solution([^>]*)>([^<]*)</scroll-solution>", match => { var extraAttributes = match.Groups[1].Value; var solutionId = match.Groups[2].Value; - return $"<mi data-solution-id='{solutionId}' {extraAttributes}>{scroll.acquiredFacts.Find(fact => fact.@ref.uri == solutionId).label}</mi>"; + var label = scroll.acquiredFacts.Find(fact => fact.@ref.uri == solutionId).label; + return $"<mi data-solution-id='{solutionId}' {extraAttributes}>{label}</mi>"; }); } else -- GitLab