关于NGUI3.4.9的BBCODE

摘自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;
    }



  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 5
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 5
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

地狱为王

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值