Пример #1
0
 static int setValue(IntPtr L)
 {
     try
     {
         ToLua.CheckArgsCount(L, 3);
         UITextAgent obj  = (UITextAgent)ToLua.CheckObject(L, 1, typeof(UITextAgent));
         int         arg0 = (int)LuaDLL.luaL_checknumber(L, 2);
         int         arg1 = (int)LuaDLL.luaL_checknumber(L, 3);
         obj.setValue(arg0, arg1);
         return(0);
     }
     catch (Exception e)
     {
         return(LuaDLL.toluaL_exception(L, e));
     }
 }
Пример #2
0
    /// <summary>
    /// 值修改
    /// </summary>
    protected void OnValueChanged()
    {
        int leftTime = mDuration - mPassTime;

        if (leftTime < 0)
        {
            leftTime = 0;
        }
        ShowText(leftTime);

        if (Direct == DirectType.LeftToRight)
        {
            if (uiProgress)
            {
                if (mDuration <= 0)
                {
                    uiProgress.SetValue(1.0f);
                }
                else
                {
                    uiProgress.SetValue(mPassTime / (float)mDuration);
                }
            }

            if (uiSlider)
            {
                if (mDuration <= 0)
                {
                    uiSlider.value = 1.0f;
                }
                else
                {
                    uiSlider.value = mPassTime / (float)mDuration;
                }
            }
        }
        else if (Direct == DirectType.RightToLeft)
        {
            if (uiProgress)
            {
                if (leftTime <= 0)
                {
                    uiProgress.SetValue(0.0f);
                }
                else
                {
                    uiProgress.SetValue(leftTime / (float)mDuration);
                }
            }

            if (uiSlider)
            {
                if (leftTime <= 0)
                {
                    uiSlider.value = 0.0f;
                }
                else
                {
                    uiSlider.value = leftTime / (float)mDuration;
                }
            }
        }

        if (uiTextAgent)
        {
            uiTextAgent.setValue(leftTime, mDuration);
        }

        OnChangeEvent(leftTime);

        if (mPassTime >= mDuration)
        {
            Stop();
            if (mDuration > 0)
            {
                OnTimeEnd();
            }
        }
    }