Пример #1
0
    protected override void AwakeImpl()
    {
        base.AwakeImpl();

        Transform tr = null;

        if (buttonCaption == null)
        {
            tr = transform.FindChild("Caption");
            if (tr != null)
            {
                buttonCaption = tr.GetComponent <NvUILabel>();
            }
        }

        if (buttonCaption != null)
        {
            buttonCaption.text = m_caption;
        }

        if (buttonBackground == null)
        {
            tr = transform.FindChild("Background");
            if (tr != null)
            {
                buttonBackground = tr.GetComponent <NvUIImagelist>();
            }
        }

        if (buttonBackground != null)
        {
            foreach (ButtonStyle style in m_skin.normalStyle)
            {
                NvUIImage image = buttonBackground.addImage(style.atlas, style.spriteName);
                image.transform.localPosition = style.Offset;

                if (image != null)
                {
                    image.spriteColor = m_skin.normalColor;
                }
            }
        }

        if (buttonCollider != null && buttonBackground != null)
        {
            NvUIImage image = buttonBackground.getImage(0);
            if (image == null)
            {
                Debug.LogWarning("NvUIButton (" + name + "): the button has no properly configured skin, check it!");
            }
            else
            {
                buttonCollider.transform.localScale = image.transform.localScale;
            }
        }
    }
Пример #2
0
    protected override void AwakeImpl()
    {
        base.AwakeImpl();

        m_slider = gameObject.GetComponent <UISlider>();

        if (m_slider != null)
        {
            m_slider.direction     = m_direction;
            m_slider.eventReceiver = gameObject;
            m_slider.functionName  = "OnProgress";
            m_slider.thumb         = null;
            applyValue();
        }

        if (m_lblValue == null)
        {
            m_lblValue = findChild("Value") as NvUILabel;
            if (m_lblValue != null)
            {
                m_lblValue.setVisible(m_showValue);
            }
        }
        else
        {
            m_lblValue.setVisible(m_showValue);
        }

        if (m_background == null)
        {
            m_background = findChild("Background") as NvUIImage;
            if (m_background != null)
            {
                m_background.setVisible(m_showValue);
            }
        }
        else
        {
            m_background.setVisible(m_showValue);
        }

        if (m_foreground == null)
        {
            m_foreground = findChild("Foreground") as NvUIImage;
            if (m_foreground != null)
            {
                m_foreground.setVisible(m_showValue);
            }
        }
        else
        {
            m_foreground.setVisible(m_showValue);
        }
    }
Пример #3
0
    protected override void AwakeImpl()
    {
        base.AwakeImpl();

        Transform tr = null;
        if ( buttonCaption == null )
        {
            tr = transform.FindChild("Caption");
            if ( tr != null )
            {
                buttonCaption = tr.GetComponent<NvUILabel>();
            }
        }

        if ( buttonCaption != null )
        {
            buttonCaption.text = m_caption;
        }

        if ( buttonBackground == null )
        {
            tr = transform.FindChild("Background");
            if ( tr != null )
            {
                buttonBackground = tr.GetComponent<NvUIImagelist>();
            }
        }

        if ( buttonBackground != null )
        {
            foreach ( ButtonStyle style in m_skin.normalStyle )
            {
                NvUIImage image = buttonBackground.addImage( style.atlas, style.spriteName );
                image.transform.localPosition = style.Offset;

                if ( image != null )
                {
                    image.spriteColor = m_skin.normalColor;
                }
            }
        }

        if ( buttonCollider != null && buttonBackground != null )
        {
            NvUIImage image = buttonBackground.getImage(0);
            if ( image == null )
            {
                Debug.LogWarning("NvUIButton (" + name + "): the button has no properly configured skin, check it!");
            }
            else
            {
                buttonCollider.transform.localScale = image.transform.localScale;
            }
        }
    }