文字弹窗支持换行

This commit is contained in:
shenjianxing 2024-12-18 09:48:53 +08:00
parent a08d48cb96
commit 4a060ea867

View File

@ -3,6 +3,7 @@ using UnityEngine.UI;
using QFramework; using QFramework;
using System.Collections.Generic; using System.Collections.Generic;
using TMPro; using TMPro;
using System.Text.RegularExpressions;
namespace QFramework.Example namespace QFramework.Example
{ {
@ -25,7 +26,7 @@ namespace QFramework.Example
protected override void OnOpen(IUIData uiData = null) protected override void OnOpen(IUIData uiData = null)
{ {
mData = uiData as UITextTipData ?? new UITextTipData(); mData = uiData as UITextTipData ?? new UITextTipData();
Des.text = mData.text; Des.text = Regex.Replace(mData.text, @"\\n", "\n");
BtnContent.RemoveAllChildren(); BtnContent.RemoveAllChildren();
foreach (var item in mData.btns) foreach (var item in mData.btns)
{ {