Exemple #1
0
 public override void Draw(float deltaTime, string linkText, object userData)
 {
     if (!offsetApplied)
     {
         compiled.Offset(Rect.X, Rect.Y);
         offsetApplied = true;
     }
     compiled.Draw(deltaTime, userData);
 }
 public override void Draw(float deltaTime)
 {
     if (!offsetApplied)
     {
         compiled.Offset(Rect.X, Rect.Y);
         offsetApplied = true;
     }
     compiled.Draw(deltaTime);
 }
Exemple #3
0
    /*
     * internal void onLinkClicked(GameObject senderGo)
     * {
     * var nguiLinkText = senderGo.GetComponent<NGUILinkText>();
     * if (nguiLinkText != null)
     * {
     *    //Debug.Log("xxx " + nguiLinkText.linkText);
     * }
     * }*/

    void IUpdate()
    {
        if (changed && compiler != null)
        {
            // link hover color.
            HtEngine.LinkHoverColor = HtColor.RGBA(
                (byte)(LinkHoverColor.r * 255),
                (byte)(LinkHoverColor.g * 255),
                (byte)(LinkHoverColor.b * 255),
                (byte)(LinkHoverColor.a * 255)
                );
            // link pressed factor.
            HtEngine.LinkPressedFactor = LinkPressedFactor;

            //设置字体列表
            NGUIFont.FontList = fonts;

            NGUIImage.imgs = imgs;

            //设置填充图集
            NGUIDevice.Fillatlas = Fillatlas;

            UIWidget cmWidget = gameObject.GetComponent <UIWidget>();

            // we have new html text, so compile it
            compiler.Compile(html, cmWidget != null ? cmWidget.width : Screen.width);

            //根据本控件的对齐方式,进行偏移修正
            {
                switch (cmWidget.pivot)
                {
                case UIWidget.Pivot.Center:
                    compiler.Offset(-cmWidget.width / 2, -cmWidget.height / 2);
                    break;

                case UIWidget.Pivot.Top:
                    compiler.Offset(-cmWidget.width / 2, 0);
                    break;

                case UIWidget.Pivot.Left:
                    compiler.Offset(0, -cmWidget.height / 2);
                    break;

                case UIWidget.Pivot.TopRight:
                    compiler.Offset(-cmWidget.width, 0);
                    break;

                case UIWidget.Pivot.Right:
                    compiler.Offset(-cmWidget.width, -cmWidget.height / 2);
                    break;

                case UIWidget.Pivot.BottomLeft:
                    compiler.Offset(0, -cmWidget.height);
                    break;

                case UIWidget.Pivot.Bottom:
                    compiler.Offset(-cmWidget.width / 2, -cmWidget.height);
                    break;

                case UIWidget.Pivot.BottomRight:
                    compiler.Offset(-cmWidget.width, -cmWidget.height);
                    break;
                }
            }



            // destroy old widgets.
            foreach (Transform childTr in transform)
            {
                Destroy(childTr.gameObject);
            }

            // generate the widgets.
            compiler.Draw(Time.deltaTime, transform);

            // release changed flag
            changed = false;

            if (autoScroll != AutoScrollType.MANUAL)
            {
                StartCoroutine(updateAutoScroll());
            }
        }
    }