示例#1
0
        public override void SetChatContent(string contentText)
        {
            mChatMsgText.rectTransform.sizeDelta = MaxChatMsgTextWidth;
            mChatMsgText.text = xc.GoodsHelper.ReplaceGoodsColor_whiteBkg(contentText);

            float width = mChatMsgText.GetPreferredWidth(mScaleFactor);

            width = Mathf.Min(width, MaxChatMsgTextWidth.x);

            var size = MaxChatMsgTextWidth;

            size.x = width;
            mChatMsgText.rectTransform.sizeDelta = size;

            // 调整Item大小
            ContentSizeFitByTarget contentFit = mChatMsgText.transform.GetComponent <ContentSizeFitByTarget>();

            if (null != contentFit)
            {
                contentFit.SizeFit(mScaleFactor);
            }

            if (mWineIcon != null)
            {
                mWineIcon.GetComponent <RectTransform>().anchoredPosition3D = new Vector3(size.x + 50, -mChatMsgText.preferredHeight - 25, 0);
            }
        }
示例#2
0
        public override void SetSystemChannelContent(string msg)
        {
            mContentText.rectTransform.sizeDelta = MaxChatMsgTextWidth;
            mContentText.text = xc.GoodsHelper.ReplaceGoodsColor_whiteBkg(msg);

            float width = mContentText.GetPreferredWidth(mScaleFactor);

            width = Mathf.Min(width, MaxChatMsgTextWidth.x);

            var size = MaxChatMsgTextWidth;

            size.x = width;
            mContentText.rectTransform.sizeDelta = size;

            // 调整Item大小
            ContentSizeFitByTarget contentFit = mContentText.transform.GetComponent <ContentSizeFitByTarget>();

            if (null != contentFit)
            {
                contentFit.SizeFit(mScaleFactor);
            }
        }
示例#3
0
        static int _m_GetPreferredWidth(RealStatePtr L)
        {
            ObjectTranslator translator = ObjectTranslatorPool.Instance.Find(L);


            EmojiText __cl_gen_to_be_invoked = (EmojiText)translator.FastGetCSObj(L, 1);


            try {
                {
                    float scaleFactor = (float)LuaAPI.lua_tonumber(L, 2);

                    float __cl_gen_ret = __cl_gen_to_be_invoked.GetPreferredWidth(scaleFactor);
                    LuaAPI.lua_pushnumber(L, __cl_gen_ret);



                    return(1);
                }
            } catch (System.Exception __gen_e) {
                return(LuaAPI.luaL_error(L, "c# exception:" + __gen_e));
            }
        }