Exemplo n.º 1
0
        private void SetVisualValue(float value)
        {
            var val = value;

            m_Layer = CalcVisualValue(ref val);
            if (m_PrevLayer)
            {
                m_PrevLayer.color = m_Layer > 0 ? GetColorForLayer(m_Layer - 1) : Color.clear;
            }
            if (m_CurrLayer)
            {
                m_CurrLayer.color = m_Layer < totalLayer?GetColorForLayer(m_Layer) : GetColorForLayer(totalLayer - 1);
            }
            m_OriginValue = val;

            if (lbLayer)
            {
                if (value > minValue)
                {
                    lbLayer.SetFormatArgs(Mathf.Min(m_Layer + 1, totalLayer));
                }
                else
                {
                    lbLayer.SetFormatArgs(0);
                }
            }
        }
Exemplo n.º 2
0
        protected virtual void UpdateVisuals()
        {
            var visualValue = CalcVisualValue(m_CurrValue);

            SetVisualImage(m_CurrBar, visualValue);

            if (m_Thumb)
            {
                var anchoredPos = Vector2.zero;
                var sizeDelta   = rectTransform.sizeDelta;
                if (axis == 0)
                {
                    if (reverseValue)
                    {
                        anchoredPos = new Vector2(-visualValue * sizeDelta.x, 0f);
                    }
                    else
                    {
                        anchoredPos = new Vector2(visualValue * sizeDelta.x, 0f);
                    }
                }
                else
                {
                    if (reverseValue)
                    {
                        anchoredPos = new Vector2(0f, -visualValue * sizeDelta.y);
                    }
                    else
                    {
                        anchoredPos = new Vector2(0f, visualValue * sizeDelta.y);
                    }
                }
                m_Thumb.anchoredPosition = anchoredPos;
            }

            if (m_PrevBar)
            {
                m_PrevBar.color = m_Layer > 0 ? GetColorForLayer(m_Layer - 1) : Color.clear;
            }
            if (m_CurrBar)
            {
                m_CurrBar.color = m_Layer < maxLayer?GetColorForLayer(m_Layer) : GetColorForLayer(maxLayer - 1);
            }

            if (m_LayerLabel)
            {
                if (m_CurrValue > minValue)
                {
                    m_LayerLabel.SetFormatArgs(Mathf.Min(m_Layer + 1, maxLayer));
                }
                else
                {
                    m_LayerLabel.SetFormatArgs(0);
                }
            }
        }
Exemplo n.º 3
0
    static int SetFormatArgs(IntPtr L)
    {
        int count = LuaDLL.lua_gettop(L);

        ZFrame.UGUI.UILabel obj   = (ZFrame.UGUI.UILabel)L.ChkUnityObjectSelf(1, "ZFrame.UGUI.UILabel");
        object[]            objs0 = L.ToParamsObject(2, count - 1);
        obj.SetFormatArgs(objs0);
        return(0);
    }