diff --git a/Assets/Scripts/UI/InGame/ScrollDetails.cs b/Assets/Scripts/UI/InGame/ScrollDetails.cs index 29b9a97e0d5a435f0948c261d5cd7a9fac75ec25..ccf2176e4cdaef6c3b29c6d24d523e711641d801 100644 --- a/Assets/Scripts/UI/InGame/ScrollDetails.cs +++ b/Assets/Scripts/UI/InGame/ScrollDetails.cs @@ -40,14 +40,14 @@ private void OnEnable() { SwitchScrollUI.activeScrollData.OnScrollChanged.AddListener(ShowScroll); SwitchScrollUI.activeScrollData.OnFactAssignmentUpdated.AddListener(OnFactAssignmentUpdated); - SwitchScrollUI.activeScrollData.OnScrollDynamicInfoUpdated.AddListener(UpdateScrollDescription); + SwitchScrollUI.activeScrollData.OnScrollDynamicInfoUpdated.AddListener(DisplayScrollDescription); } private void OnDisable() { SwitchScrollUI.activeScrollData.OnScrollChanged.RemoveListener(ShowScroll); SwitchScrollUI.activeScrollData.OnFactAssignmentUpdated.RemoveListener(OnFactAssignmentUpdated); - SwitchScrollUI.activeScrollData.OnScrollDynamicInfoUpdated.RemoveListener(UpdateScrollDescription); + SwitchScrollUI.activeScrollData.OnScrollDynamicInfoUpdated.RemoveListener(DisplayScrollDescription); } private void OnDestroy() @@ -68,13 +68,7 @@ private void ShowScroll(Scroll newScroll) //Clear all current ScrollFacts originalViewport.GetChild(0).gameObject.DestroyAllChildren(); - var description = newScroll.description; - // if description is a html description, extract the alternative text representation - if (Regex.IsMatch(newScroll.description, ".*<scroll-description.*")) - { - description = Regex.Match(newScroll.description, "<scroll-description [^>]* alt=((?>\\\")|(?>\\'))([^>]*?)\\1[^>]*>").Groups[2].Value; - } - originalScroll.GetChild(0).GetComponent<TextMeshProUGUI>().text = description; + DisplayScrollDescription(newScroll); //ParameterDisplays.ForEach(gameObj => Destroy(gameObj)); ParameterDisplays = new(); @@ -94,13 +88,17 @@ private void ShowScroll(Scroll newScroll) } } - private void UpdateScrollDescription(Scroll rendered) + private void DisplayScrollDescription(Scroll scroll) { - if (SwitchScrollUI.activeScrollData.DynamicScrollDescriptionsActive) - { // Update scroll-description - Transform scroll = gameObject.transform.GetChild(1).transform; - scroll.GetChild(0).GetComponent<TextMeshProUGUI>().text = rendered.description; + var description = scroll.description; + // if description is a html description, extract the alternative text representation + if (Regex.IsMatch(scroll.description, ".*<scroll-description.*")) + { + description = Regex.Match(scroll.description, "<scroll-description [^>]* alt=((?>\\\")|(?>\\'))([^>]*?)\\1[^>]*>").Groups[2].Value; } + + Transform scrollComponent = gameObject.transform.GetChild(1).transform; + scrollComponent.GetChild(0).GetComponent<TextMeshProUGUI>().text = description; } private void OnFactAssignmentUpdated(string slotUri, ActiveScroll.SlotAssignment slotAssignment) diff --git a/Packages/bessw.unity.webview b/Packages/bessw.unity.webview index 923dcaa913260cf737f908310cafcfccf78aef0d..5004257d58f35d6c32eaf5a0a4afd7f42fc7d049 160000 --- a/Packages/bessw.unity.webview +++ b/Packages/bessw.unity.webview @@ -1 +1 @@ -Subproject commit 923dcaa913260cf737f908310cafcfccf78aef0d +Subproject commit 5004257d58f35d6c32eaf5a0a4afd7f42fc7d049