update
This commit is contained in:
@@ -1,9 +1,5 @@
|
|||||||
fileFormatVersion: 2
|
fileFormatVersion: 2
|
||||||
<<<<<<<< HEAD:Release/Samples~/ConfigUIElement.meta
|
|
||||||
guid: 7758a0679c9038144a4b0d007d44618f
|
|
||||||
========
|
|
||||||
guid: 85f1b523843f5884bb9f6b47500bccd0
|
guid: 85f1b523843f5884bb9f6b47500bccd0
|
||||||
>>>>>>>> gitea-Srouce/master:Release/Runtime/UI/TmpText.meta
|
|
||||||
folderAsset: yes
|
folderAsset: yes
|
||||||
DefaultImporter:
|
DefaultImporter:
|
||||||
externalObjects: {}
|
externalObjects: {}
|
||||||
|
|||||||
@@ -238,7 +238,7 @@ namespace Deconstruction.UI.TmpText
|
|||||||
|
|
||||||
// 尝试获取TMP_Text组件
|
// 尝试获取TMP_Text组件
|
||||||
var tmp = child.GetComponent(tmpTextType) as TMP_Text;
|
var tmp = child.GetComponent(tmpTextType) as TMP_Text;
|
||||||
if (tmp != null && tmp.text.MatchRichTextID())
|
if (tmp != null && tmp.text.MatchRichTextLinkID())
|
||||||
{
|
{
|
||||||
result.Add(child.gameObject.AddComponent<TMPHyperlinkReceiver>());
|
result.Add(child.gameObject.AddComponent<TMPHyperlinkReceiver>());
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
using System;
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
using Sirenix.OdinInspector;
|
using Sirenix.OdinInspector;
|
||||||
using TMPro;
|
using TMPro;
|
||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
@@ -28,6 +29,35 @@ namespace Deconstruction.UI.TmpText
|
|||||||
[SerializeField]
|
[SerializeField]
|
||||||
public UnityEvent<string> onClickLink = new UnityEvent<string>();
|
public UnityEvent<string> onClickLink = new UnityEvent<string>();
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 获取所有超链接id
|
||||||
|
/// </summary>
|
||||||
|
public IEnumerable<string> AllLinkID
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
if (_tmpText == null || string.IsNullOrEmpty(_tmpText.text))
|
||||||
|
yield break;
|
||||||
|
foreach (var link in _tmpText.text.MatchesRichTextLinkID())
|
||||||
|
yield return link.id;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 获取所有超链接
|
||||||
|
/// </summary>
|
||||||
|
public IEnumerable<(string id, string block)> AllLinkIDWithContext
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
if (_tmpText == null || string.IsNullOrEmpty(_tmpText.text))
|
||||||
|
yield break;
|
||||||
|
foreach (var link in _tmpText.text.MatchesRichTextLinkID())
|
||||||
|
yield return link;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
private void Awake()
|
private void Awake()
|
||||||
{
|
{
|
||||||
_tmpText = GetComponent<TextMeshProUGUI>();
|
_tmpText = GetComponent<TextMeshProUGUI>();
|
||||||
|
|||||||
Reference in New Issue
Block a user