|
@ -12,7 +12,7 @@ using CustomUI.BeatSaber; |
|
|
|
|
|
|
|
|
namespace BSIPA_ModList.UI.ViewControllers |
|
|
namespace BSIPA_ModList.UI.ViewControllers |
|
|
{ |
|
|
{ |
|
|
[RequireComponent(/*typeof(ScrollRect),*/ typeof(RectTransform))] |
|
|
|
|
|
|
|
|
[RequireComponent(typeof(RectTransform), typeof(ScrollRect))] |
|
|
public class MarkdownView : MonoBehaviour |
|
|
public class MarkdownView : MonoBehaviour |
|
|
{ |
|
|
{ |
|
|
private class TagTypeComponent : MonoBehaviour |
|
|
private class TagTypeComponent : MonoBehaviour |
|
@ -34,8 +34,10 @@ namespace BSIPA_ModList.UI.ViewControllers |
|
|
|
|
|
|
|
|
public RectTransform rectTransform => GetComponent<RectTransform>(); |
|
|
public RectTransform rectTransform => GetComponent<RectTransform>(); |
|
|
|
|
|
|
|
|
//private ScrollRect view;
|
|
|
|
|
|
|
|
|
private ScrollRect view; |
|
|
private RectTransform content; |
|
|
private RectTransform content; |
|
|
|
|
|
private RectTransform viewport; |
|
|
|
|
|
private Scrollbar scrollbar; |
|
|
|
|
|
|
|
|
private CommonMarkSettings settings; |
|
|
private CommonMarkSettings settings; |
|
|
public MarkdownView() |
|
|
public MarkdownView() |
|
@ -70,9 +72,31 @@ namespace BSIPA_ModList.UI.ViewControllers |
|
|
protected void Awake() |
|
|
protected void Awake() |
|
|
{ |
|
|
{ |
|
|
rectTransform.sizeDelta = new Vector2(100f, 100f); |
|
|
rectTransform.sizeDelta = new Vector2(100f, 100f); |
|
|
|
|
|
view = GetComponent<ScrollRect>(); |
|
|
|
|
|
view.verticalScrollbarVisibility = ScrollRect.ScrollbarVisibility.AutoHide; |
|
|
|
|
|
view.vertical = true; |
|
|
|
|
|
view.horizontal = false; |
|
|
|
|
|
view.scrollSensitivity = 0f; |
|
|
|
|
|
view.movementType = ScrollRect.MovementType.Clamped; |
|
|
|
|
|
|
|
|
|
|
|
scrollbar = new GameObject("Scrollbar", typeof(RectTransform)).AddComponent<Scrollbar>(); |
|
|
|
|
|
scrollbar.transform.SetParent(transform); |
|
|
|
|
|
scrollbar.direction = Scrollbar.Direction.TopToBottom; |
|
|
|
|
|
scrollbar.interactable = true; |
|
|
|
|
|
view.verticalScrollbar = scrollbar; |
|
|
|
|
|
|
|
|
|
|
|
var vpgo = new GameObject("Viewport"); |
|
|
|
|
|
viewport = vpgo.AddComponent<RectTransform>(); |
|
|
|
|
|
viewport.SetParent(transform); |
|
|
|
|
|
viewport.localPosition = Vector2.zero; |
|
|
|
|
|
viewport.anchorMin = Vector2.zero; |
|
|
|
|
|
viewport.anchorMax = Vector2.one; |
|
|
|
|
|
vpgo.AddComponent<Mask>(); |
|
|
|
|
|
|
|
|
|
|
|
view.viewport = viewport; |
|
|
|
|
|
|
|
|
content = new GameObject("Content Wrapper").AddComponent<RectTransform>(); |
|
|
content = new GameObject("Content Wrapper").AddComponent<RectTransform>(); |
|
|
content.SetParent(transform); |
|
|
|
|
|
|
|
|
content.SetParent(viewport); |
|
|
content.localPosition = Vector2.zero; |
|
|
content.localPosition = Vector2.zero; |
|
|
content.anchorMin = Vector2.zero; |
|
|
content.anchorMin = Vector2.zero; |
|
|
content.anchorMax = Vector2.one; |
|
|
content.anchorMax = Vector2.one; |
|
@ -84,12 +108,7 @@ namespace BSIPA_ModList.UI.ViewControllers |
|
|
contentLayout.preferredHeight = 0f; |
|
|
contentLayout.preferredHeight = 0f; |
|
|
content.gameObject.AddComponent<TagTypeComponent>(); |
|
|
content.gameObject.AddComponent<TagTypeComponent>(); |
|
|
|
|
|
|
|
|
/*view = GetComponent<ScrollRect>(); |
|
|
|
|
|
view.content = content; |
|
|
view.content = content; |
|
|
view.vertical = true; |
|
|
|
|
|
view.horizontal = false; |
|
|
|
|
|
view.verticalScrollbarVisibility = ScrollRect.ScrollbarVisibility.AutoHide; |
|
|
|
|
|
view.horizontalScrollbarVisibility = ScrollRect.ScrollbarVisibility.AutoHide;*/ |
|
|
|
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
private static Sprite whitePixel; |
|
|
private static Sprite whitePixel; |
|
|