Update() static public méthode

Recalculate the 'final' values.
static public Update ( ) : void
Résultat void
Exemple #1
0
    static int Update(IntPtr L)
    {
        try
        {
            int count = LuaDLL.lua_gettop(L);

            if (count == 0)
            {
                NGUIText.Update();
                return(0);
            }
            else if (count == 1 && TypeChecker.CheckTypes(L, 1, typeof(bool)))
            {
                bool arg0 = LuaDLL.lua_toboolean(L, 1);
                NGUIText.Update(arg0);
                return(0);
            }
            else
            {
                return(LuaDLL.luaL_throw(L, "invalid arguments to method: NGUIText.Update"));
            }
        }
        catch (Exception e)
        {
            return(LuaDLL.toluaL_exception(L, e));
        }
    }
Exemple #2
0
 static public int Update_s(IntPtr l)
 {
     try {
         int argc = LuaDLL.lua_gettop(l);
         if (argc == 0)
         {
             NGUIText.Update();
             pushValue(l, true);
             return(1);
         }
         else if (argc == 1)
         {
             System.Boolean a1;
             checkType(l, 1, out a1);
             NGUIText.Update(a1);
             pushValue(l, true);
             return(1);
         }
         pushValue(l, false);
         LuaDLL.lua_pushstring(l, "No matched override function to call");
         return(2);
     }
     catch (Exception e) {
         return(error(l, e));
     }
 }
Exemple #3
0
    private static int Update(IntPtr L)
    {
        int result;

        try
        {
            int num = LuaDLL.lua_gettop(L);
            if (num == 0)
            {
                NGUIText.Update();
                result = 0;
            }
            else if (num == 1 && TypeChecker.CheckTypes(L, 1, typeof(bool)))
            {
                bool request = LuaDLL.lua_toboolean(L, 1);
                NGUIText.Update(request);
                result = 0;
            }
            else
            {
                result = LuaDLL.luaL_throw(L, "invalid arguments to method: NGUIText.Update");
            }
        }
        catch (Exception e)
        {
            result = LuaDLL.toluaL_exception(L, e, null);
        }
        return(result);
    }
Exemple #4
0
        public static Vector2 CalcTextPrintSize(string text, Font ft, int fs, FontStyle style, bool b, int regionX, int regionY)
        {
            Font      oldFt       = NGUIText.dynamicFont;
            int       oldFs       = NGUIText.fontSize;
            FontStyle oldStyle    = NGUIText.fontStyle;
            bool      oldEncoding = NGUIText.encoding;
            int       oldRegionX  = NGUIText.regionWidth;
            int       oldRegionY  = NGUIText.regionHeight;

            NGUIText.dynamicFont  = ft;
            NGUIText.fontSize     = fs;
            NGUIText.fontStyle    = style;
            NGUIText.encoding     = b;
            NGUIText.rectWidth    = regionX;
            NGUIText.rectHeight   = regionY;
            NGUIText.regionWidth  = regionX;
            NGUIText.regionHeight = regionY;
            NGUIText.Update(false);
            NGUIText.WrapText(text, out text, true);
            Vector2 ret = NGUIText.CalculatePrintedSize(text);

            NGUIText.dynamicFont  = oldFt;
            NGUIText.fontSize     = oldFs;
            NGUIText.fontStyle    = oldStyle;
            NGUIText.encoding     = oldEncoding;
            NGUIText.regionWidth  = oldRegionX;
            NGUIText.regionHeight = oldRegionY;
            return(ret);
        }
Exemple #5
0
        public void SetResultInfo(ISFSObject data, MahjongPlayer player, List <int> handCards, List <int> huList)
        {
            #region data

            int       type;
            long      totalGold;
            ISFSArray Groups;
            GameTools.TryGetValueWitheKey(data, out type, RequestKey.KeyType);
            GameTools.TryGetValueWitheKey(data, out _huNum, RequestKey.KeyHuNum);
            GameTools.TryGetValueWitheKey(data, out _gangNum, RequestKey.KeyGangNum);
            GameTools.TryGetValueWitheKey(data, out _fanName, RequestKey.KeyHuName);
            GameTools.TryGetValueWitheKey(data, out _totalNum, RequestKey.KeyGold);
            GameTools.TryGetValueWitheKey(data, out totalGold, RequestKey.KeyTotalGold);
            GameTools.TryGetValueWitheKey(data, out Groups, RequestKey.KeyGroups);
            var groups = GameTools.GetGroupData(Groups);
            YxDebug.Log("手牌总长度是:" + handCards.Count);
            _isWiner = type > 0;
            if (type == 2) //目前自摸情况下,会把胡的那张牌从手牌中带回来,这里删掉。目前只有一个胡牌,所以这么删,待扩展
            {
                handCards.Remove(huList[0]);
            }
            YxDebug.Log("手牌实际长度是:" + handCards.Count);

            #endregion

            #region UI

            LabelUserName.text = player.UserInfo.name;
            ZhuangSprite.SetActive(player.IsZhuang);
            LabelFanName.text = _fanName;
            YxTools.TrySetComponentValue(LabelHuScore, YxUtiles.GetShowNumber(_huNum).ToString());
            YxTools.TrySetComponentValue(LabelGangNum, YxUtiles.GetShowNumber(_gangNum).ToString());
            YxTools.TrySetComponentValue(LabelTotalScore, YxUtiles.GetShowNumber(_totalNum).ToString());
            HeadTexture.mainTexture = player.CurrentInfoPanel.UserIcon.mainTexture;
            player.UserInfo.Gold    = totalGold;
            player.CurrentInfoPanel.SetGold((int)totalGold);
            HuLogo.SetActive(IsWiner);

            #endregion

            _resultCards.Init(groups, handCards, huList, _isWiner);
            LabelFanName.ProcessText();
            NGUIText.Update();
        }
    static int Update(IntPtr L)
    {
        int count = LuaDLL.lua_gettop(L);

        if (count == 0)
        {
            NGUIText.Update();
            return(0);
        }
        else if (count == 1)
        {
            bool arg0 = LuaScriptMgr.GetBoolean(L, 1);
            NGUIText.Update(arg0);
            return(0);
        }
        else
        {
            LuaDLL.luaL_error(L, "invalid arguments to method: NGUIText.Update");
        }

        return(0);
    }
Exemple #7
0
    public void UpdateNGUIText()
    {
        Font trueTypeFont = this.trueTypeFont;
        bool flag         = trueTypeFont != null;

        NGUIText.fontSize       = mPrintedSize;
        NGUIText.fontStyle      = mFontStyle;
        NGUIText.rectWidth      = mWidth;
        NGUIText.rectHeight     = mHeight;
        NGUIText.regionWidth    = Mathf.RoundToInt((float)mWidth * (mDrawRegion.z - mDrawRegion.x));
        NGUIText.regionHeight   = Mathf.RoundToInt((float)mHeight * (mDrawRegion.w - mDrawRegion.y));
        NGUIText.gradient       = (mApplyGradient && (mFont == null || !mFont.packedFontShader));
        NGUIText.gradientTop    = mGradientTop;
        NGUIText.gradientBottom = mGradientBottom;
        NGUIText.encoding       = mEncoding;
        NGUIText.premultiply    = mPremultiply;
        NGUIText.symbolStyle    = mSymbols;
        NGUIText.maxLines       = mMaxLineCount;
        NGUIText.spacingX       = (float)mSpacingX;
        NGUIText.spacingY       = (float)mSpacingY;
        NGUIText.fontScale      = ((!flag) ? ((float)mFontSize / (float)mFont.defaultSize * mScale) : mScale);
        if (mFont != null)
        {
            NGUIText.bitmapFont = mFont;
            while (true)
            {
                UIFont replacement = NGUIText.bitmapFont.replacement;
                if (replacement == null)
                {
                    break;
                }
                NGUIText.bitmapFont = replacement;
            }
            if (NGUIText.bitmapFont.isDynamic)
            {
                NGUIText.dynamicFont = NGUIText.bitmapFont.dynamicFont;
                NGUIText.bitmapFont  = null;
            }
            else
            {
                NGUIText.dynamicFont = null;
            }
        }
        else
        {
            NGUIText.dynamicFont = trueTypeFont;
            NGUIText.bitmapFont  = null;
        }
        if (flag && keepCrisp)
        {
            UIRoot root = base.root;
            if (root != null)
            {
                NGUIText.pixelDensity = ((!(root != null)) ? 1f : root.pixelSizeAdjustment);
            }
        }
        else
        {
            NGUIText.pixelDensity = 1f;
        }
        if (mDensity != NGUIText.pixelDensity)
        {
            ProcessText(legacyMode: false, full: false);
            NGUIText.rectWidth    = mWidth;
            NGUIText.rectHeight   = mHeight;
            NGUIText.regionWidth  = Mathf.RoundToInt((float)mWidth * (mDrawRegion.z - mDrawRegion.x));
            NGUIText.regionHeight = Mathf.RoundToInt((float)mHeight * (mDrawRegion.w - mDrawRegion.y));
        }
        if (alignment == NGUIText.Alignment.Automatic)
        {
            switch (base.pivot)
            {
            case Pivot.TopLeft:
            case Pivot.Left:
            case Pivot.BottomLeft:
                NGUIText.alignment = NGUIText.Alignment.Left;
                break;

            case Pivot.TopRight:
            case Pivot.Right:
            case Pivot.BottomRight:
                NGUIText.alignment = NGUIText.Alignment.Right;
                break;

            default:
                NGUIText.alignment = NGUIText.Alignment.Center;
                break;
            }
        }
        else
        {
            NGUIText.alignment = alignment;
        }
        NGUIText.Update();
    }
Exemple #8
0
    private void ProcessText(bool legacyMode, bool full)
    {
        if (!this.isValid)
        {
            return;
        }
        this.mChanged          = true;
        this.shouldBeProcessed = false;
        float num  = this.mDrawRegion.z - this.mDrawRegion.x;
        float num2 = this.mDrawRegion.w - this.mDrawRegion.y;

        NGUIText.rectWidth    = ((!legacyMode) ? base.width : ((this.mMaxLineWidth == 0) ? 1000000 : this.mMaxLineWidth));
        NGUIText.rectHeight   = ((!legacyMode) ? base.height : ((this.mMaxLineHeight == 0) ? 1000000 : this.mMaxLineHeight));
        NGUIText.regionWidth  = ((num == 1f) ? NGUIText.rectWidth : Mathf.RoundToInt((float)NGUIText.rectWidth * num));
        NGUIText.regionHeight = ((num2 == 1f) ? NGUIText.rectHeight : Mathf.RoundToInt((float)NGUIText.rectHeight * num2));
        this.mFinalFontSize   = Mathf.Abs((!legacyMode) ? this.defaultFontSize : Mathf.RoundToInt(base.cachedTransform.localScale.x));
        this.mScale           = 1f;
        if (NGUIText.regionWidth < 1 || NGUIText.regionHeight < 0)
        {
            this.mProcessedText = string.Empty;
            return;
        }
        bool flag = this.trueTypeFont != null;

        if (flag && this.keepCrisp)
        {
            UIRoot root = base.root;
            if (root != null)
            {
                this.mDensity = ((!(root != null)) ? 1f : root.pixelSizeAdjustment);
            }
        }
        else
        {
            this.mDensity = 1f;
        }
        if (full)
        {
            this.UpdateNGUIText();
        }
        if (this.mOverflow == UILabel.Overflow.ResizeFreely)
        {
            NGUIText.rectWidth   = 1000000;
            NGUIText.regionWidth = 1000000;
        }
        if (this.mOverflow == UILabel.Overflow.ResizeFreely || this.mOverflow == UILabel.Overflow.ResizeHeight)
        {
            NGUIText.rectHeight   = 1000000;
            NGUIText.regionHeight = 1000000;
        }
        if (this.mFinalFontSize > 0)
        {
            bool keepCrisp = this.keepCrisp;
            for (int i = this.mFinalFontSize; i > 0; i--)
            {
                if (keepCrisp)
                {
                    this.mFinalFontSize = i;
                    NGUIText.fontSize   = this.mFinalFontSize;
                }
                else
                {
                    this.mScale        = (float)i / (float)this.mFinalFontSize;
                    NGUIText.fontScale = ((!flag) ? ((float)this.mFontSize / (float)this.mFont.defaultSize * this.mScale) : this.mScale);
                }
                NGUIText.Update(false);
                bool flag2 = NGUIText.WrapText(this.mText, out this.mProcessedText, true, false);
                if (this.mOverflow != UILabel.Overflow.ShrinkContent || flag2)
                {
                    if (this.mOverflow == UILabel.Overflow.ResizeFreely)
                    {
                        this.mCalculatedSize = NGUIText.CalculatePrintedSize(this.mProcessedText);
                        this.mWidth          = Mathf.Max(this.minWidth, Mathf.CeilToInt(this.mCalculatedSize.x));
                        if (num != 1f)
                        {
                            this.mWidth = Mathf.CeilToInt((float)this.mWidth / num);
                        }
                        this.mHeight = Mathf.Max(this.minHeight, Mathf.CeilToInt(this.mCalculatedSize.y));
                        if (num2 != 1f)
                        {
                            this.mHeight = Mathf.CeilToInt((float)this.mHeight / num2);
                        }
                        if ((this.mWidth & 1) == 1)
                        {
                            this.mWidth++;
                        }
                        if ((this.mHeight & 1) == 1)
                        {
                            this.mHeight++;
                        }
                    }
                    else if (this.mOverflow == UILabel.Overflow.ResizeHeight)
                    {
                        this.mCalculatedSize = NGUIText.CalculatePrintedSize(this.mProcessedText);
                        this.mHeight         = Mathf.Max(this.minHeight, Mathf.CeilToInt(this.mCalculatedSize.y));
                        if (num2 != 1f)
                        {
                            this.mHeight = Mathf.CeilToInt((float)this.mHeight / num2);
                        }
                        if ((this.mHeight & 1) == 1)
                        {
                            this.mHeight++;
                        }
                    }
                    else
                    {
                        this.mCalculatedSize = NGUIText.CalculatePrintedSize(this.mProcessedText);
                    }
                    if (legacyMode)
                    {
                        base.width  = Mathf.RoundToInt(this.mCalculatedSize.x);
                        base.height = Mathf.RoundToInt(this.mCalculatedSize.y);
                        base.cachedTransform.localScale = Vector3.one;
                    }
                    break;
                }
                if (--i <= 1)
                {
                    break;
                }
            }
        }
        else
        {
            base.cachedTransform.localScale = Vector3.one;
            this.mProcessedText             = string.Empty;
            this.mScale = 1f;
        }
        if (full)
        {
            NGUIText.bitmapFont  = null;
            NGUIText.dynamicFont = null;
        }
    }
Exemple #9
0
    public void UpdateNGUIText()
    {
        Font trueTypeFont = this.trueTypeFont;
        bool flag         = trueTypeFont != null;

        NGUIText.fontSize       = this.mFinalFontSize;
        NGUIText.fontStyle      = this.mFontStyle;
        NGUIText.rectWidth      = this.mWidth;
        NGUIText.rectHeight     = this.mHeight;
        NGUIText.regionWidth    = Mathf.RoundToInt((float)this.mWidth * (this.mDrawRegion.z - this.mDrawRegion.x));
        NGUIText.regionHeight   = Mathf.RoundToInt((float)this.mHeight * (this.mDrawRegion.w - this.mDrawRegion.y));
        NGUIText.gradient       = (this.mApplyGradient && (this.mFont == null || !this.mFont.packedFontShader));
        NGUIText.gradientTop    = this.mGradientTop;
        NGUIText.gradientBottom = this.mGradientBottom;
        NGUIText.encoding       = this.mEncoding;
        NGUIText.premultiply    = this.mPremultiply;
        NGUIText.symbolStyle    = this.mSymbols;
        NGUIText.maxLines       = this.mMaxLineCount;
        NGUIText.spacingX       = this.effectiveSpacingX;
        NGUIText.spacingY       = this.effectiveSpacingY;
        NGUIText.fontScale      = ((!flag) ? ((float)this.mFontSize / (float)this.mFont.defaultSize * this.mScale) : this.mScale);
        if (this.mFont != null)
        {
            NGUIText.bitmapFont = this.mFont;
            for (;;)
            {
                UIFont replacement = NGUIText.bitmapFont.replacement;
                if (replacement == null)
                {
                    break;
                }
                NGUIText.bitmapFont = replacement;
            }
            if (NGUIText.bitmapFont.isDynamic)
            {
                NGUIText.dynamicFont = NGUIText.bitmapFont.dynamicFont;
                NGUIText.bitmapFont  = null;
            }
            else
            {
                NGUIText.dynamicFont = null;
            }
        }
        else
        {
            NGUIText.dynamicFont = trueTypeFont;
            NGUIText.bitmapFont  = null;
        }
        if (flag && this.keepCrisp)
        {
            UIRoot root = base.root;
            if (root != null)
            {
                NGUIText.pixelDensity = ((!(root != null)) ? 1f : root.pixelSizeAdjustment);
            }
        }
        else
        {
            NGUIText.pixelDensity = 1f;
        }
        if (this.mDensity != NGUIText.pixelDensity)
        {
            this.ProcessText(false, false);
            NGUIText.rectWidth    = this.mWidth;
            NGUIText.rectHeight   = this.mHeight;
            NGUIText.regionWidth  = Mathf.RoundToInt((float)this.mWidth * (this.mDrawRegion.z - this.mDrawRegion.x));
            NGUIText.regionHeight = Mathf.RoundToInt((float)this.mHeight * (this.mDrawRegion.w - this.mDrawRegion.y));
        }
        if (this.alignment == NGUIText.Alignment.Automatic)
        {
            UIWidget.Pivot pivot = base.pivot;
            if (pivot == UIWidget.Pivot.Left || pivot == UIWidget.Pivot.TopLeft || pivot == UIWidget.Pivot.BottomLeft)
            {
                NGUIText.alignment = NGUIText.Alignment.Left;
            }
            else if (pivot == UIWidget.Pivot.Right || pivot == UIWidget.Pivot.TopRight || pivot == UIWidget.Pivot.BottomRight)
            {
                NGUIText.alignment = NGUIText.Alignment.Right;
            }
            else
            {
                NGUIText.alignment = NGUIText.Alignment.Center;
            }
        }
        else
        {
            NGUIText.alignment = this.alignment;
        }
        NGUIText.Update();
    }
Exemple #10
0
    /// <summary>
    /// Process the raw text, called when something changes.
    /// </summary>

    void ProcessText(bool legacyMode)
    {
        if (!isValid)
        {
            return;
        }

        mChanged   = true;
        hasChanged = false;

        float pxSize      = pixelSize;
        int   fontSize    = this.fontSize;
        float invFontSize = 1f / fontSize;

        NGUIText.rectWidth  = legacyMode ? (mMaxLineWidth != 0 ? mMaxLineWidth  : 1000000) : width;
        NGUIText.rectHeight = legacyMode ? (mMaxLineHeight != 0 ? mMaxLineHeight : 1000000) : height;

        mScale       = 1f;
        mPrintedSize = Mathf.Abs(legacyMode ? Mathf.RoundToInt(cachedTransform.localScale.x) : fontSize);

        if (NGUIText.rectWidth < 1 || NGUIText.rectHeight < 0)
        {
            mProcessedText = "";
            return;
        }

        UpdateNGUIText(fontSize, mWidth, mHeight);

        if (mOverflow == Overflow.ResizeFreely)
        {
            NGUIText.rectWidth = 1000000;
        }
        if (mOverflow == Overflow.ResizeFreely || mOverflow == Overflow.ResizeHeight)
        {
            NGUIText.rectHeight = 1000000;
        }

        if (mPrintedSize > 0)
        {
            for (;;)
            {
                mScale = mPrintedSize * invFontSize;

                NGUIText.pixelSize = pxSize * mScale;
                NGUIText.Update(false);

                // Wrap the text
                bool fits = NGUIText.WrapText(mText, out mProcessedText);

                // Remember the final printed size
                if (!string.IsNullOrEmpty(mProcessedText))
                {
                    mCalculatedSize = NGUIText.CalculatePrintedSize(mProcessedText);
                }
                else
                {
                    mCalculatedSize = Vector2.zero;
                }

                if (mOverflow == Overflow.ResizeFreely)
                {
                    mWidth  = Mathf.RoundToInt(mCalculatedSize.x);
                    mHeight = Mathf.RoundToInt(mCalculatedSize.y);
                    if ((mWidth & 1) == 1)
                    {
                        ++mWidth;
                    }
                    if ((mHeight & 1) == 1)
                    {
                        ++mHeight;
                    }
                }
                else if (mOverflow == Overflow.ResizeHeight)
                {
                    mHeight = Mathf.RoundToInt(mCalculatedSize.y);
                }
                else if (mOverflow == Overflow.ShrinkContent && !fits)
                {
                    if (--mPrintedSize > 1)
                    {
                        continue;
                    }
                }

                // Upgrade to the new system
                if (legacyMode)
                {
                    width  = Mathf.RoundToInt(mCalculatedSize.x);
                    height = Mathf.RoundToInt(mCalculatedSize.y);
                    cachedTransform.localScale = Vector3.one;
                }
                break;
            }
        }
        else
        {
            cachedTransform.localScale = Vector3.one;
            mProcessedText             = "";
            mScale = 1f;
        }
    }
Exemple #11
0
    /// <summary>
    /// Process the raw text, called when something changes.
    /// </summary>

    void ProcessText(bool legacyMode, bool full)
    {
        if (!isValid)
        {
            return;
        }

        mChanged          = true;
        shouldBeProcessed = false;

        NGUIText.rectWidth  = legacyMode ? (mMaxLineWidth != 0 ? mMaxLineWidth  : 1000000) : width;
        NGUIText.rectHeight = legacyMode ? (mMaxLineHeight != 0 ? mMaxLineHeight : 1000000) : height;

        mPrintedSize = Mathf.Abs(legacyMode ? Mathf.RoundToInt(cachedTransform.localScale.x) : defaultFontSize);
        mScale       = 1f;

        if (NGUIText.rectWidth < 1 || NGUIText.rectHeight < 0)
        {
            mProcessedText = "";
            return;
        }

#if DYNAMIC_FONT
        bool isDynamic = (trueTypeFont != null);

        if (isDynamic && keepCrisp)
        {
            UIRoot rt = root;
            if (rt != null)
            {
                mDensity = (rt != null) ? rt.pixelSizeAdjustment : 1f;
            }
        }
        else
        {
            mDensity = 1f;
        }
#endif
        if (full)
        {
            UpdateNGUIText();
        }

        if (mOverflow == Overflow.ResizeFreely)
        {
            NGUIText.rectWidth = 1000000;
        }
        if (mOverflow == Overflow.ResizeFreely || mOverflow == Overflow.ResizeHeight)
        {
            NGUIText.rectHeight = 1000000;
        }

        if (mPrintedSize > 0)
        {
#if DYNAMIC_FONT
            bool adjustSize = keepCrisp;
#endif
            for (int ps = mPrintedSize; ps > 0; --ps)
            {
#if DYNAMIC_FONT
                // Adjust either the size, or the scale
                if (adjustSize)
                {
                    mPrintedSize      = ps;
                    NGUIText.fontSize = mPrintedSize;
                }
                else
#endif
                {
                    mScale = (float)ps / mPrintedSize;
#if DYNAMIC_FONT
                    NGUIText.fontScale = isDynamic ? mScale : ((float)mFontSize / mFont.defaultSize) * mScale;
#else
                    NGUIText.fontScale = ((float)mFontSize / mFont.defaultSize) * mScale;
#endif
                }

                NGUIText.Update(false);

                // Wrap the text
                bool fits = NGUIText.WrapText(mText, out mProcessedText, true);

                if (mOverflow == Overflow.ShrinkContent && !fits)
                {
                    if (--ps > 1)
                    {
                        continue;
                    }
                    else
                    {
                        break;
                    }
                }
                else if (mOverflow == Overflow.ResizeFreely)
                {
                    mCalculatedSize = NGUIText.CalculatePrintedSize(mProcessedText);

                    mWidth  = Mathf.Max(minWidth, Mathf.RoundToInt(mCalculatedSize.x));
                    mHeight = Mathf.Max(minHeight, Mathf.RoundToInt(mCalculatedSize.y));

                    if ((mWidth & 1) == 1)
                    {
                        ++mWidth;
                    }
                    if ((mHeight & 1) == 1)
                    {
                        ++mHeight;
                    }
                }
                else if (mOverflow == Overflow.ResizeHeight)
                {
                    mCalculatedSize = NGUIText.CalculatePrintedSize(mProcessedText);
                    mHeight         = Mathf.Max(minHeight, Mathf.RoundToInt(mCalculatedSize.y));
                    if ((mHeight & 1) == 1)
                    {
                        ++mHeight;
                    }
                }
                else
                {
                    mCalculatedSize = NGUIText.CalculatePrintedSize(mProcessedText);
                }

                // Upgrade to the new system
                if (legacyMode)
                {
                    width  = Mathf.RoundToInt(mCalculatedSize.x);
                    height = Mathf.RoundToInt(mCalculatedSize.y);
                    cachedTransform.localScale = Vector3.one;
                }
                break;
            }
        }
        else
        {
            cachedTransform.localScale = Vector3.one;
            mProcessedText             = "";
            mScale = 1f;
        }
    }
Exemple #12
0
    private void ProcessText(bool legacyMode, bool full)
    {
        if (!isValid)
        {
            return;
        }
        mChanged            = true;
        shouldBeProcessed   = false;
        NGUIText.rectWidth  = ((!legacyMode) ? base.width : ((mMaxLineWidth != 0) ? mMaxLineWidth : 1000000));
        NGUIText.rectHeight = ((!legacyMode) ? base.height : ((mMaxLineHeight != 0) ? mMaxLineHeight : 1000000));
        mPrintedSize        = Mathf.Abs(legacyMode ? Mathf.RoundToInt(base.cachedTransform.localScale.x) : defaultFontSize);
        mScale = 1f;
        if (NGUIText.rectWidth < 1 || NGUIText.rectHeight < 0)
        {
            mProcessedText = "";
            return;
        }
        bool flag = trueTypeFont != null;

        if (flag && keepCrisp)
        {
            UIRoot uIRoot = base.root;
            if (uIRoot != null)
            {
                mDensity = ((uIRoot != null) ? uIRoot.pixelSizeAdjustment : 1f);
            }
        }
        else
        {
            mDensity = 1f;
        }
        if (full)
        {
            UpdateNGUIText();
        }
        if (mOverflow == Overflow.ResizeFreely)
        {
            NGUIText.rectWidth = 1000000;
        }
        if (mOverflow == Overflow.ResizeFreely || mOverflow == Overflow.ResizeHeight)
        {
            NGUIText.rectHeight = 1000000;
        }
        if (mPrintedSize > 0)
        {
            bool flag2 = keepCrisp;
            int  num   = mPrintedSize;
            while (num > 0)
            {
                if (flag2)
                {
                    mPrintedSize      = num;
                    NGUIText.fontSize = mPrintedSize;
                }
                else
                {
                    mScale             = (float)num / (float)mPrintedSize;
                    NGUIText.fontScale = (flag ? mScale : ((float)mFontSize / (float)mFont.defaultSize * mScale));
                }
                NGUIText.Update(request: false);
                bool flag3 = NGUIText.WrapText(mText, out mProcessedText, keepCharCount: true);
                if (mOverflow == Overflow.ShrinkContent && !flag3)
                {
                    if (--num <= 1)
                    {
                        break;
                    }
                    num--;
                    continue;
                }
                if (mOverflow == Overflow.ResizeFreely)
                {
                    mCalculatedSize = NGUIText.CalculatePrintedSize(mProcessedText);
                    mWidth          = Mathf.Max(minWidth, Mathf.RoundToInt(mCalculatedSize.x));
                    mHeight         = Mathf.Max(minHeight, Mathf.RoundToInt(mCalculatedSize.y));
                    if ((mWidth & 1) == 1)
                    {
                        mWidth++;
                    }
                    if ((mHeight & 1) == 1)
                    {
                        mHeight++;
                    }
                }
                else if (mOverflow == Overflow.ResizeHeight)
                {
                    mCalculatedSize = NGUIText.CalculatePrintedSize(mProcessedText);
                    mHeight         = Mathf.Max(minHeight, Mathf.RoundToInt(mCalculatedSize.y));
                    if ((mHeight & 1) == 1)
                    {
                        mHeight++;
                    }
                }
                else
                {
                    mCalculatedSize = NGUIText.CalculatePrintedSize(mProcessedText);
                }
                if (legacyMode)
                {
                    base.width  = Mathf.RoundToInt(mCalculatedSize.x);
                    base.height = Mathf.RoundToInt(mCalculatedSize.y);
                    base.cachedTransform.localScale = Vector3.one;
                }
                break;
            }
        }
        else
        {
            base.cachedTransform.localScale = Vector3.one;
            mProcessedText = "";
            mScale         = 1f;
        }
    }
Exemple #13
0
    public void UpdateNGUIText()
    {
        Font font = trueTypeFont;
        bool flag = font != null;

        NGUIText.fontSize       = mPrintedSize;
        NGUIText.fontStyle      = mFontStyle;
        NGUIText.rectWidth      = mWidth;
        NGUIText.rectHeight     = mHeight;
        NGUIText.gradient       = mApplyGradient && (mFont == null || !mFont.packedFontShader);
        NGUIText.gradientTop    = mGradientTop;
        NGUIText.gradientBottom = mGradientBottom;
        NGUIText.encoding       = mEncoding;
        NGUIText.premultiply    = mPremultiply;
        NGUIText.symbolStyle    = mSymbols;
        NGUIText.maxLines       = mMaxLineCount;
        NGUIText.spacingX       = mSpacingX;
        NGUIText.spacingY       = mSpacingY;
        NGUIText.fontScale      = (flag ? mScale : ((float)mFontSize / (float)mFont.defaultSize * mScale));
        if (mFont != null)
        {
            NGUIText.bitmapFont = mFont;
            while (true)
            {
                bool   flag2       = true;
                UIFont replacement = NGUIText.bitmapFont.replacement;
                if (replacement == null)
                {
                    break;
                }
                NGUIText.bitmapFont = replacement;
            }
            if (NGUIText.bitmapFont.isDynamic)
            {
                NGUIText.dynamicFont = NGUIText.bitmapFont.dynamicFont;
                NGUIText.bitmapFont  = null;
            }
            else
            {
                NGUIText.dynamicFont = null;
            }
        }
        else
        {
            NGUIText.dynamicFont = font;
            NGUIText.bitmapFont  = null;
        }
        if (flag && keepCrisp)
        {
            UIRoot uIRoot = base.root;
            if (uIRoot != null)
            {
                NGUIText.pixelDensity = ((uIRoot != null) ? uIRoot.pixelSizeAdjustment : 1f);
            }
        }
        else
        {
            NGUIText.pixelDensity = 1f;
        }
        if (mDensity != NGUIText.pixelDensity)
        {
            ProcessText(legacyMode: false, full: false);
            NGUIText.rectWidth  = mWidth;
            NGUIText.rectHeight = mHeight;
        }
        if (alignment == NGUIText.Alignment.Automatic)
        {
            Pivot pivot = base.pivot;
            if (pivot == Pivot.Left || pivot == Pivot.TopLeft || pivot == Pivot.BottomLeft)
            {
                NGUIText.alignment = NGUIText.Alignment.Left;
            }
            else if (pivot == Pivot.Right || pivot == Pivot.TopRight || pivot == Pivot.BottomRight)
            {
                NGUIText.alignment = NGUIText.Alignment.Right;
            }
            else
            {
                NGUIText.alignment = NGUIText.Alignment.Center;
            }
        }
        else
        {
            NGUIText.alignment = alignment;
        }
        NGUIText.Update();
    }
Exemple #14
0
    /// <summary>
    /// Process the raw text, called when something changes.
    /// </summary>

    void ProcessText(bool legacyMode)
    {
        if (!isValid)
        {
            return;
        }

        mChanged   = true;
        hasChanged = false;

        int   fs      = fontSize;
        float invFS   = 1f / fs;
        float ps      = pixelSize;
        float invSize = 1f / ps;
        float lw      = legacyMode ? (mMaxLineWidth != 0 ? mMaxLineWidth * invSize : 1000000) : width * invSize;
        float lh      = legacyMode ? (mMaxLineHeight != 0 ? mMaxLineHeight * invSize : 1000000) : height * invSize;

        mScale       = 1f;
        mPrintedSize = Mathf.Abs(legacyMode ? Mathf.RoundToInt(cachedTransform.localScale.x) : fs);

        UpdateNGUIText(fs, mWidth, mHeight);

        if (mPrintedSize > 0)
        {
            for (;;)
            {
                mScale = mPrintedSize * invFS;

                bool fits = true;

                NGUIText.lineWidth = (mOverflow == Overflow.ResizeFreely) ? 1000000 : Mathf.RoundToInt(lw / mScale);

                if (mOverflow == Overflow.ResizeFreely || mOverflow == Overflow.ResizeHeight)
                {
                    NGUIText.lineHeight = 1000000;
                }
                else
                {
                    NGUIText.lineHeight = Mathf.RoundToInt(lh / mScale);
                }

                NGUIText.Update(false);

                if (lw > 0f || lh > 0f)
                {
                    fits = NGUIText.WrapText(mText, out mProcessedText);
                }
                else
                {
                    mProcessedText = mText;
                }

                // Remember the final printed size
                if (!string.IsNullOrEmpty(mProcessedText))
                {
                    mCalculatedSize = NGUIText.CalculatePrintedSize(mProcessedText);
                }
                else
                {
                    mCalculatedSize = Vector2.zero;
                }

                if (mOverflow == Overflow.ResizeFreely)
                {
                    mWidth  = Mathf.RoundToInt(mCalculatedSize.x * ps);
                    mHeight = Mathf.RoundToInt(mCalculatedSize.y * ps);
                    if ((mWidth & 1) == 1)
                    {
                        ++mWidth;
                    }
                    if ((mHeight & 1) == 1)
                    {
                        ++mHeight;
                    }
                }
                else if (mOverflow == Overflow.ResizeHeight)
                {
                    mHeight = Mathf.RoundToInt(mCalculatedSize.y * ps);
                }
                else if (mOverflow == Overflow.ShrinkContent && !fits)
                {
                    if (--mPrintedSize > 1)
                    {
                        continue;
                    }
                }

                // Upgrade to the new system
                if (legacyMode)
                {
                    width  = Mathf.RoundToInt(mCalculatedSize.x * ps);
                    height = Mathf.RoundToInt(mCalculatedSize.y * ps);
                    cachedTransform.localScale = Vector3.one;
                }
                break;
            }
        }
        else
        {
            cachedTransform.localScale = Vector3.one;
            mProcessedText             = "";
            mScale = 1f;
        }
    }
Exemple #15
0
 private void ProcessText(bool legacyMode, bool full)
 {
     if (isValid)
     {
         mChanged          = true;
         shouldBeProcessed = false;
         float num  = mDrawRegion.z - mDrawRegion.x;
         float num2 = mDrawRegion.w - mDrawRegion.y;
         NGUIText.rectWidth    = ((!legacyMode) ? base.width : ((mMaxLineWidth == 0) ? 1000000 : mMaxLineWidth));
         NGUIText.rectHeight   = ((!legacyMode) ? base.height : ((mMaxLineHeight == 0) ? 1000000 : mMaxLineHeight));
         NGUIText.regionWidth  = ((num == 1f) ? NGUIText.rectWidth : Mathf.RoundToInt((float)NGUIText.rectWidth * num));
         NGUIText.regionHeight = ((num2 == 1f) ? NGUIText.rectHeight : Mathf.RoundToInt((float)NGUIText.rectHeight * num2));
         int value;
         if (legacyMode)
         {
             Vector3 localScale = base.cachedTransform.localScale;
             value = Mathf.RoundToInt(localScale.x);
         }
         else
         {
             value = defaultFontSize;
         }
         mPrintedSize = Mathf.Abs(value);
         mScale       = 1f;
         if (NGUIText.regionWidth < 1 || NGUIText.regionHeight < 0)
         {
             mProcessedText = string.Empty;
         }
         else
         {
             bool flag = trueTypeFont != null;
             if (flag && this.keepCrisp)
             {
                 UIRoot root = base.root;
                 if (root != null)
                 {
                     mDensity = ((!(root != null)) ? 1f : root.pixelSizeAdjustment);
                 }
             }
             else
             {
                 mDensity = 1f;
             }
             if (full)
             {
                 UpdateNGUIText();
             }
             if (mOverflow == Overflow.ResizeFreely)
             {
                 NGUIText.rectWidth   = 1000000;
                 NGUIText.regionWidth = 1000000;
             }
             if (mOverflow == Overflow.ResizeFreely || mOverflow == Overflow.ResizeHeight)
             {
                 NGUIText.rectHeight   = 1000000;
                 NGUIText.regionHeight = 1000000;
             }
             if (mPrintedSize > 0)
             {
                 bool keepCrisp = this.keepCrisp;
                 int  num3;
                 for (num3 = mPrintedSize; num3 > 0; num3--)
                 {
                     if (keepCrisp)
                     {
                         mPrintedSize      = num3;
                         NGUIText.fontSize = mPrintedSize;
                     }
                     else
                     {
                         mScale             = (float)num3 / (float)mPrintedSize;
                         NGUIText.fontScale = ((!flag) ? ((float)mFontSize / (float)mFont.defaultSize * mScale) : mScale);
                     }
                     NGUIText.Update(request: false);
                     bool flag2 = NGUIText.WrapText(mText, out mProcessedText, keepCharCount: true);
                     if (mOverflow != 0 || flag2)
                     {
                         if (mOverflow == Overflow.ResizeFreely)
                         {
                             mCalculatedSize = NGUIText.CalculatePrintedSize(mProcessedText);
                             mWidth          = Mathf.Max(minWidth, Mathf.RoundToInt(mCalculatedSize.x));
                             if (num != 1f)
                             {
                                 mWidth = Mathf.RoundToInt((float)mWidth / num);
                             }
                             mHeight = Mathf.Max(minHeight, Mathf.RoundToInt(mCalculatedSize.y));
                             if (num2 != 1f)
                             {
                                 mHeight = Mathf.RoundToInt((float)mHeight / num2);
                             }
                             if ((mWidth & 1) == 1)
                             {
                                 mWidth++;
                             }
                             if ((mHeight & 1) == 1)
                             {
                                 mHeight++;
                             }
                         }
                         else if (mOverflow == Overflow.ResizeHeight)
                         {
                             mCalculatedSize = NGUIText.CalculatePrintedSize(mProcessedText);
                             mHeight         = Mathf.Max(minHeight, Mathf.RoundToInt(mCalculatedSize.y));
                             if (num2 != 1f)
                             {
                                 mHeight = Mathf.RoundToInt((float)mHeight / num2);
                             }
                             if ((mHeight & 1) == 1)
                             {
                                 mHeight++;
                             }
                         }
                         else
                         {
                             mCalculatedSize = NGUIText.CalculatePrintedSize(mProcessedText);
                         }
                         if (legacyMode)
                         {
                             base.width  = Mathf.RoundToInt(mCalculatedSize.x);
                             base.height = Mathf.RoundToInt(mCalculatedSize.y);
                             base.cachedTransform.localScale = Vector3.one;
                         }
                         break;
                     }
                     if (--num3 <= 1)
                     {
                         break;
                     }
                 }
             }
             else
             {
                 base.cachedTransform.localScale = Vector3.one;
                 mProcessedText = string.Empty;
                 mScale         = 1f;
             }
             if (full)
             {
                 NGUIText.bitmapFont  = null;
                 NGUIText.dynamicFont = null;
             }
         }
     }
 }
Exemple #16
0
    /// <summary>
    /// Update NGUIText.current with all the properties from this label.
    /// </summary>

    public void UpdateNGUIText(int size, int lineWidth, int lineHeight)
    {
        NGUIText.fontSize       = mPrintedSize;
        NGUIText.fontStyle      = mFontStyle;
        NGUIText.rectWidth      = lineWidth;
        NGUIText.rectHeight     = lineHeight;
        NGUIText.gradient       = mApplyGradient;
        NGUIText.gradientTop    = mGradientTop;
        NGUIText.gradientBottom = mGradientBottom;
        NGUIText.encoding       = mEncoding;
        NGUIText.premultiply    = mPremultiply;
        NGUIText.symbolStyle    = mSymbols;
        NGUIText.maxLines       = mMaxLineCount;
        NGUIText.spacingX       = mSpacingX;
        NGUIText.spacingY       = mSpacingY;
        NGUIText.fontScale      = (bitmapFont != null) ? mScale * bitmapFont.pixelSize : mScale;

        if (mFont != null)
        {
            NGUIText.bitmapFont = mFont;

            for (; ;)
            {
                UIFont fnt = NGUIText.bitmapFont.replacement;
                if (fnt == null)
                {
                    break;
                }
                NGUIText.bitmapFont = fnt;
            }

#if DYNAMIC_FONT
            if (NGUIText.bitmapFont.isDynamic)
            {
                NGUIText.dynamicFont = NGUIText.bitmapFont.dynamicFont;
                NGUIText.bitmapFont  = null;
            }
            else
            {
                NGUIText.dynamicFont = null;
            }
#endif
        }
#if DYNAMIC_FONT
        else
        {
            NGUIText.dynamicFont = mTrueTypeFont;
            NGUIText.bitmapFont  = null;
        }

        if (keepCrisp)
        {
            UIRoot rt = root;
            if (rt != null)
            {
                NGUIText.pixelDensity = (rt != null) ? rt.pixelSizeAdjustment : 1f;
            }
        }
#endif

        Pivot p = pivot;

        if (p == Pivot.Left || p == Pivot.TopLeft || p == Pivot.BottomLeft)
        {
            NGUIText.alignment = TextAlignment.Left;
        }
        else if (p == Pivot.Right || p == Pivot.TopRight || p == Pivot.BottomRight)
        {
            NGUIText.alignment = TextAlignment.Right;
        }
        else
        {
            NGUIText.alignment = TextAlignment.Center;
        }

        NGUIText.Update();
    }
Exemple #17
0
    /// <summary>
    /// Process the raw text, called when something changes.
    /// </summary>

    void ProcessText(bool legacyMode)
    {
        if (!isValid)
        {
            return;
        }

        mChanged   = true;
        hasChanged = false;

        NGUIText.rectWidth  = legacyMode ? (mMaxLineWidth != 0 ? mMaxLineWidth  : 1000000) : width;
        NGUIText.rectHeight = legacyMode ? (mMaxLineHeight != 0 ? mMaxLineHeight : 1000000) : height;

        mPrintedSize = Mathf.Abs(legacyMode ? Mathf.RoundToInt(cachedTransform.localScale.x) : fontSize);
        mScale       = 1f;

        if (NGUIText.rectWidth < 1 || NGUIText.rectHeight < 0)
        {
            mProcessedText = "";
            return;
        }

        UpdateNGUIText(mPrintedSize, mWidth, mHeight);

        if (mOverflow == Overflow.ResizeFreely)
        {
            NGUIText.rectWidth = 1000000;
        }
        if (mOverflow == Overflow.ResizeFreely || mOverflow == Overflow.ResizeHeight)
        {
            NGUIText.rectHeight = 1000000;
        }

        if (mPrintedSize > 0)
        {
#if DYNAMIC_FONT
            bool adjustSize = keepCrisp;
#endif
            for (int ps = mPrintedSize; ps > 0; --ps)
            {
#if DYNAMIC_FONT
                // Adjust either the size, or the scale
                if (adjustSize)
                {
                    mPrintedSize      = ps;
                    NGUIText.fontSize = mPrintedSize;
                }
                else
#endif
                {
                    mScale             = (float)ps / mPrintedSize;
                    NGUIText.fontScale = (bitmapFont != null) ? mScale * bitmapFont.pixelSize : mScale;
                }

                NGUIText.Update(false);

                // Wrap the text
                bool fits = NGUIText.WrapText(mText, out mProcessedText);

                if (mOverflow == Overflow.ShrinkContent && !fits)
                {
                    if (--ps > 1)
                    {
                        continue;
                    }
                    else
                    {
                        break;
                    }
                }
                else if (mOverflow == Overflow.ResizeFreely)
                {
                    mCalculatedSize = NGUIText.CalculatePrintedSize(mProcessedText);
                    mWidth          = Mathf.Max(minWidth, Mathf.RoundToInt(mCalculatedSize.x));
                    mHeight         = Mathf.Max(minHeight, Mathf.RoundToInt(mCalculatedSize.y));

                    if ((mWidth & 1) == 1)
                    {
                        ++mWidth;
                    }
                    if ((mHeight & 1) == 1)
                    {
                        ++mHeight;
                    }
                }
                else if (mOverflow == Overflow.ResizeHeight)
                {
                    mCalculatedSize = NGUIText.CalculatePrintedSize(mProcessedText);
                    mHeight         = Mathf.Max(minHeight, Mathf.RoundToInt(mCalculatedSize.y));
                    if ((mHeight & 1) == 1)
                    {
                        ++mHeight;
                    }
                }
                else
                {
                    mCalculatedSize = NGUIText.CalculatePrintedSize(mProcessedText);
                }

                // Upgrade to the new system
                if (legacyMode)
                {
                    width  = Mathf.RoundToInt(mCalculatedSize.x);
                    height = Mathf.RoundToInt(mCalculatedSize.y);
                    cachedTransform.localScale = Vector3.one;
                }
                break;
            }
        }
        else
        {
            cachedTransform.localScale = Vector3.one;
            mProcessedText             = "";
            mScale = 1f;
        }
    }
Exemple #18
0
    /// <summary>
    /// Update NGUIText.current with all the properties from this label.
    /// </summary>

    public void UpdateNGUIText()
    {
        Font ttf       = trueTypeFont;
        bool isDynamic = (ttf != null);

        NGUIText.fontSize       = mPrintedSize;
        NGUIText.fontStyle      = mFontStyle;
        NGUIText.rectWidth      = mWidth;
        NGUIText.rectHeight     = mHeight;
        NGUIText.gradient       = mApplyGradient && (mFont == null || !mFont.packedFontShader);
        NGUIText.gradientTop    = mGradientTop;
        NGUIText.gradientBottom = mGradientBottom;
        NGUIText.encoding       = mEncoding;
        NGUIText.premultiply    = mPremultiply;
        NGUIText.symbolStyle    = mSymbols;
        NGUIText.maxLines       = mMaxLineCount;
        NGUIText.spacingX       = mSpacingX;
        NGUIText.spacingY       = mSpacingY;
        NGUIText.fontScale      = isDynamic ? mScale : ((float)mFontSize / mFont.defaultSize) * mScale;

        if (mFont != null)
        {
            NGUIText.bitmapFont = mFont;

            for (; ;)
            {
                UIFont fnt = NGUIText.bitmapFont.replacement;
                if (fnt == null)
                {
                    break;
                }
                NGUIText.bitmapFont = fnt;
            }

#if DYNAMIC_FONT
            if (NGUIText.bitmapFont.isDynamic)
            {
                NGUIText.dynamicFont = NGUIText.bitmapFont.dynamicFont;
                NGUIText.bitmapFont  = null;
            }
            else
            {
                NGUIText.dynamicFont = null;
            }
#endif
        }
#if DYNAMIC_FONT
        else
        {
            NGUIText.dynamicFont = ttf;
            NGUIText.bitmapFont  = null;
        }

        if (isDynamic && keepCrisp)
        {
            UIRoot rt = root;
            if (rt != null)
            {
                NGUIText.pixelDensity = (rt != null) ? rt.pixelSizeAdjustment : 1f;
            }
        }
        else
        {
            NGUIText.pixelDensity = 1f;
        }

        if (mDensity != NGUIText.pixelDensity)
        {
            ProcessText(false, false);
            NGUIText.rectWidth  = mWidth;
            NGUIText.rectHeight = mHeight;
        }
#endif

        if (alignment == Alignment.Automatic)
        {
            Pivot p = pivot;

            if (p == Pivot.Left || p == Pivot.TopLeft || p == Pivot.BottomLeft)
            {
                NGUIText.alignment = Alignment.Left;
            }
            else if (p == Pivot.Right || p == Pivot.TopRight || p == Pivot.BottomRight)
            {
                NGUIText.alignment = Alignment.Right;
            }
            else
            {
                NGUIText.alignment = Alignment.Center;
            }
        }
        else
        {
            NGUIText.alignment = alignment;
        }

        NGUIText.Update();
    }
    private void OnReposition()
    {
        for (int i = 0; i < infoContent.transform.childCount; ++i)
        {
            Destroy(infoContent.transform.GetChild(i).gameObject);
        }
        string[,] array = null;
        if (!string.IsNullOrEmpty(product.details))
        {
            JsonData jd = JsonMapper.ToObject(product.details);
            if (jd.IsArray)
            {
                array = new string[jd.Count + 1, 2];
                for (int i = 0; i < jd.Count; ++i)
                {
                    array[i + 1, 0] = (string)jd[i]["key"];
                    array[i + 1, 1] = (string)jd[i]["value"];
                }
            }
        }
        if (array == null)
        {
            array = new string[1, 2];
        }
        array[0, 0] = "";
        array[0, 1] = product.name;

        UILabel label = labelPrefab.transform.Find("Content").gameObject.GetComponent <UILabel>();

        NGUIText.fontSize  = label.fontSize;
        NGUIText.fontStyle = label.fontStyle;
        NGUIText.rectWidth = label.width;
        NGUIText.Update();

        int        yOffset   = 0;
        int        lineSpace = 15;
        UIViewport vp        = scrollCamera.GetComponent <UIViewport>();
        int        height    = (int)(vp.topLeft.localPosition.y - vp.bottomRight.localPosition.y);

        for (int i = 0; i < array.Length / 2; ++i)
        {
            GameObject row          = NGUITools.AddChild(infoContent, labelPrefab);
            UILabel    nameLabel    = row.transform.Find("Name").gameObject.GetComponent <UILabel>();
            UILabel    contentLabel = row.transform.Find("Content").gameObject.GetComponent <UILabel>();
            nameLabel.text    = array[i, 0];
            contentLabel.text = array[i, 1];
            BoxCollider  bc = row.GetComponent <BoxCollider>();
            UIDragCamera dc = row.GetComponent <UIDragCamera>();
            dc.draggableCamera = scrollCamera.GetComponent <UIDraggableCamera>();
            Vector2 rect = NGUIText.CalculatePrintedSize(array[i, 1]);
            if (i == array.Length / 2 - 1 && Math.Abs(yOffset - (int)rect.y - lineSpace) < height)
            {
                contentLabel.height = height - Math.Abs(yOffset);
            }
            else
            {
                contentLabel.height = (int)rect.y;
            }
            bc.center = new Vector3(0, -(contentLabel.height + lineSpace) / 2, 0);
            bc.size   = new Vector3(bc.size.x, contentLabel.height + lineSpace, 0);
            row.transform.localPosition = new Vector3(0, yOffset, 0);
            yOffset -= (int)rect.y + lineSpace;
        }
    }