From 722ea0d85235ca747bb19e98d7d00a45d4e909de Mon Sep 17 00:00:00 2001 From: Anairkoen Schno Date: Sat, 11 May 2019 16:26:27 -0500 Subject: [PATCH] Code blocks now behaving, just need to fix the font --- BSIPA-ModList/UI/ViewControllers/MarkdownView.cs | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/BSIPA-ModList/UI/ViewControllers/MarkdownView.cs b/BSIPA-ModList/UI/ViewControllers/MarkdownView.cs index 29ee25c7..092aac8f 100644 --- a/BSIPA-ModList/UI/ViewControllers/MarkdownView.cs +++ b/BSIPA-ModList/UI/ViewControllers/MarkdownView.cs @@ -107,6 +107,7 @@ namespace BSIPA_ModList.UI.ViewControllers { _consolas.material.color = new Color(1f, 1f, 1f, 0f); _consolas.material.globalIlluminationFlags = MaterialGlobalIlluminationFlags.None; + MaterialReferenceManager.AddFontAsset(_consolas); } } return _consolas; @@ -231,7 +232,6 @@ namespace BSIPA_ModList.UI.ViewControllers private const string LinkDefaultColor = "#0061ff"; private const string LinkHoverColor = "#009dff"; - private bool resetContentPosition = false; private IEnumerator UpdateMd() { mdDirty = false; @@ -492,7 +492,7 @@ namespace BSIPA_ModList.UI.ViewControllers break; case InlineTag.Code: EnsureText(); - currentText.text += $"{inl.LiteralContent}"; + currentText.text += $"{inl.LiteralContent}"; break; case InlineTag.Link: EnsureText(); @@ -515,16 +515,15 @@ namespace BSIPA_ModList.UI.ViewControllers var childRt = content.GetChild(0) as RectTransform; childRt.anchoredPosition = new Vector2(0f, childRt.anchoredPosition.y); - if (Consolas != null) + /*if (Consolas != null) { foreach (var link in texts.Select(t => t.textInfo.linkInfo).Aggregate>(Enumerable.Concat).Where(l => l.GetLinkID() == "$$codeBlock")) { //link.textComponent.font = Consolas; var texinfo = link.textComponent.textInfo; - texinfo.characterInfo[link.linkTextfirstCharacterIndex].DebugPrintTo(Logger.md.Debug, 2); for (int i = link.linkTextfirstCharacterIndex; i < link.linkTextfirstCharacterIndex + link.linkTextLength; i++) { - + texinfo.characterInfo[i].DebugPrintTo(Logger.md.Debug, 2); texinfo.characterInfo[i].fontAsset = Consolas; texinfo.characterInfo[i].material = Consolas.material; texinfo.characterInfo[i].isUsingAlternateTypeface = true; @@ -533,9 +532,10 @@ namespace BSIPA_ModList.UI.ViewControllers foreach (var text in texts) { text.SetLayoutDirty(); + text.SetMaterialDirty(); text.SetVerticesDirty(); } - } + }*/ } private class TextLinkDecoder : MonoBehaviour, IPointerClickHandler