diff --git a/Assets/Scripts/UI/InGame/WebViewController.cs b/Assets/Scripts/UI/InGame/WebViewController.cs index 9211244bff89053fb2640707140f1ce9215d2bc1..c1cb33f3a370b56697153bf31e8e6efc9374f15a 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