摘自ReadMe
3.4.9
- NEW: You can now embed hidden content in labels using bbcode: [url=link]Click Here[/url]. Retrieve this content via UILabel.GetUrlAtPosition(UICamera.lastHit.point), then do what you want.
- NEW: Labels can now keep references to UIFonts that use dynamic fonts, for easy replacement/swapping.
- FIX: Work-around for a bug in Unity related to dynamic fonts discarding previously requested characters.
- FIX: UIButtonColor/UIButton will set the normal color in Awake instead of Start to avoid conflicts with tweens.
- FIX: Create UI menu option will now let you create a 3D UI if you have a 2D UI present, and vice versa.
- FIX: Input improvements: IME text selection while typing and proper dialog positioning.
- FIX: Parent widget's visibility checks should no longer cause children to be culled.
- FIX: Scaled bitmap fonts should now be correctly affected by the gradient setting.
- FIX: Removed UIAnchor usage from the Scroll View example.
- FIX: UIRoot should be executed before everything else.
- FIX: UIToggle.startsChecked is now be public.
新版本说支持BBCODE,试了一下,发现不行,搜了一下找到两个链接:
http://www.tasharen.com/forum/index.php?topic=6706 按照该用法还是不行。
http://www.tasharen.com/forum/index.php?topic=7965.0 斑竹的回答令人蛋碎。
最后自己改了一下UILabel解决了。
public string GetUrlAtCharacterIndex(int characterIndex)
{
if (characterIndex != -1 && characterIndex < mText.Length)
{
int linkStart = mText.LastIndexOf("[url=", characterIndex, characterIndex);
if (linkStart == -1)
{
linkStart += 6;
int linkEnd = mText.IndexOf("]", linkStart);
if (linkEnd != -1)
{
int closingStatement = mText.IndexOf("[/url]", linkEnd);
if (closingStatement == -1 || closingStatement >= characterIndex)
return mText.Substring(linkStart, linkEnd - linkStart);
}
}
}
return null;
}