private void LoadWordText()
        {
            CCSprite sprite = new CCSprite();
            CCTexture2D texture = new CCTexture2D();

            switch (Platform.QuestionLanguage)
            {
                case Lib.Core.Language.Chinese:
                    texture.initWithString(m_Word.ChineseName, "ChineseContent", 20,Color.White,Color.Transparent);
                    break;
                case Lib.Core.Language.Enlish:
                default:
                    texture.initWithString(m_Word.EnglishName, "EnglishContent", 20, Color.White, Color.Transparent);
                    break;
            }
            sprite.initWithTexture(texture);
            sprite.Color = new ccColor3B(Color.White);
            sprite.position = new CCPoint((m_Size.width / 2) - (sprite.contentSize.width / 2) - m_StillWhile, (sprite.contentSize.height / 2));
            addChild(sprite);
        }
        /// <summary>
        /// changes the string to render
        /// @warning Changing the string is as expensive as creating a new CCLabelTTF. To obtain better performance use CCLabelAtlas
        /// </summary>
        public void setString(string label)
        {
            m_pString = label;

            CCTexture2D texture;

            if (CCSize.CCSizeEqualToSize(m_tDimensions, new CCSize(0, 0)))
            {
                texture = new CCTexture2D();
                texture.initWithString(label, m_pFontName.ToString(), m_fFontSize);
            }
            else
            {
                texture = new CCTexture2D();
                texture.initWithString(label, m_tDimensions, m_eAlignment, m_pFontName.ToString(), m_fFontSize);
            }
            this.Texture = texture;

            CCRect rect = new CCRect(0, 0, 0, 0);

            rect.size = m_pobTexture.getContentSize();
            this.setTextureRect(rect);
        }
Beispiel #3
0
        public void setString(string label)
        {
            CCTexture2D cCTexture2D;

            this.m_pString = label;
            if (!CCSize.CCSizeEqualToSize(this.m_tDimensions, new CCSize(0f, 0f)))
            {
                cCTexture2D = new CCTexture2D();
                cCTexture2D.initWithString(label, this.m_tDimensions, this.m_eAlignment, this.m_pFontName.ToString(), this.m_fFontSize, this.m_fgColor, this.m_bgColor);
            }
            else
            {
                cCTexture2D = new CCTexture2D();
                cCTexture2D.initWithString(label, this.m_pFontName.ToString(), this.m_fFontSize, this.m_fgColor, this.m_bgColor);
            }
            this.Texture = cCTexture2D;
            CCRect cCRect = new CCRect(0f, 0f, 0f, 0f)
            {
                size = this.m_pobTexture.getContentSize()
            };

            base.setTextureRect(cCRect);
        }
        /// <summary>
        /// changes the string to render
        /// @warning Changing the string is as expensive as creating a new CCLabelTTF. To obtain better performance use CCLabelAtlas
        /// </summary>
        public void setString(string label)
        {
            m_pString = label;

            CCTexture2D texture;
            if (CCSize.CCSizeEqualToSize(m_tDimensions, new CCSize(0, 0)))
            {
                texture = new CCTexture2D();
                texture.initWithString(label, m_pFontName.ToString(), m_fFontSize);
            }
            else
            {
                texture = new CCTexture2D();
                texture.initWithString(label, m_tDimensions, m_eAlignment, m_pFontName.ToString(), m_fFontSize);
            }
            this.Texture = texture;

            CCRect rect = new CCRect(0, 0, 0, 0);
            rect.size = m_pobTexture.getContentSize();
            this.setTextureRect(rect);
        }