Browse Source

Some description text now shows up, additional elements hidden below screen for some reason

pull/11/head
Anairkoen Schno 5 years ago
parent
commit
756bd2cc9a
2 changed files with 12 additions and 4 deletions
  1. +8
    -2
      BSIPA-ModList/UI/ViewControllers/MarkdownView.cs
  2. +4
    -2
      BSIPA-ModList/UI/ViewControllers/ModInfoViewController.cs

+ 8
- 2
BSIPA-ModList/UI/ViewControllers/MarkdownView.cs View File

@ -70,12 +70,16 @@ namespace BSIPA_ModList.UI.ViewControllers
{
content = new GameObject("Content Wrapper").AddComponent<RectTransform>();
content.SetParent(transform);
content.localPosition = Vector2.zero;
content.anchorMin = Vector2.zero;
content.anchorMax = Vector2.one;
var contentLayout = content.gameObject.AddComponent<LayoutElement>();
var contentFitter = content.gameObject.AddComponent<ContentSizeFitter>();
contentFitter.horizontalFit = ContentSizeFitter.FitMode.PreferredSize;
contentFitter.verticalFit = ContentSizeFitter.FitMode.Unconstrained;
contentLayout.preferredWidth = 100f; // to be adjusted
content.sizeDelta = new Vector2(100f,100f);
content.gameObject.AddComponent<TagTypeComponent>();
/*view = GetComponent<ScrollRect>();
view.content = content;
@ -102,7 +106,7 @@ namespace BSIPA_ModList.UI.ViewControllers
{
var block = node.Block;
void BlockNode(string name, float spacing, bool isVertical)
void BlockNode(string name, float spacing, bool isVertical, bool isDoc = false)
{
var type = isVertical ? typeof(VerticalLayoutGroup) : typeof(HorizontalLayoutGroup);
if (node.IsOpening)
@ -113,6 +117,8 @@ namespace BSIPA_ModList.UI.ViewControllers
var go = new GameObject(name, typeof(RectTransform), type);
var vlayout = go.GetComponent<RectTransform>();
vlayout.SetParent(layout.Peek());
//if (isDoc)
vlayout.anchoredPosition = Vector2.zero;
go.AddComponent<TagTypeComponent>().Tag = block.Tag;
layout.Push(vlayout);
@ -141,7 +147,7 @@ namespace BSIPA_ModList.UI.ViewControllers
switch (block.Tag)
{
case BlockTag.Document:
BlockNode("DocumentRoot", 10f, true);
BlockNode("DocumentRoot", .2f, true, true);
break;
case BlockTag.SetextHeading:
BlockNode("Heading1", .1f, false);


+ 4
- 2
BSIPA-ModList/UI/ViewControllers/ModInfoViewController.cs View File

@ -191,14 +191,16 @@ namespace BSIPA_ModList.UI
descText.overflowMode = TextOverflowModes.ScrollRect;*/
var mdv = new GameObject("MarkDown Desc").AddComponent<MarkdownView>();
mdv.rectTransform.anchoredPosition = new Vector2(-4.5f, 12f);
mdv.rectTransform.SetParent(rectTransform);
mdv.rectTransform.anchorMin = new Vector2(.22f, 0f);
mdv.rectTransform.anchorMax = new Vector2(1f, .25f);
mdv.rectTransform.anchoredPosition = Vector2.zero;
mdv.Markdown = controller.Description;
icon = new GameObject("Mod Info View Icon", typeof(RectTransform)).AddComponent<Image>();
icon.gameObject.SetActive(false);
icon.rectTransform.SetParent(rectTransform, false);
icon.rectTransform.anchorMin = new Vector2(0.5f, 0.44f);
icon.rectTransform.anchorMin = new Vector2(0.5f, 0.44f);
icon.rectTransform.anchorMax = new Vector2(0.5f, 0.5f);
icon.rectTransform.sizeDelta = new Vector2(60f, 10f);
icon.rectTransform.anchoredPosition = new Vector2(-27.8f, 27.3f);


Loading…
Cancel
Save