Ejemplo n.º 1
0
 static int Drag(IntPtr L)
 {
     try
     {
         ToLua.CheckArgsCount(L, 2);
         ScrollViewLoopItem obj = (ScrollViewLoopItem)ToLua.CheckObject(L, 1, typeof(ScrollViewLoopItem));
         float arg0             = (float)LuaDLL.luaL_checknumber(L, 2);
         obj.Drag(arg0);
         return(0);
     }
     catch (Exception e)
     {
         return(LuaDLL.toluaL_exception(L, e));
     }
 }
Ejemplo n.º 2
0
    public void Init(Action onFinish = null, Action onBegin = null)
    {
        kRect           = GetComponent <RectTransform>();
        Width           = kRect.rect.width;
        height          = kRect.rect.height;
        kFinishCallback = onFinish;
        kBeginCallback  = onBegin;
        if (kRect.childCount < 5)
        {
            StartValue = StartValue + AddValue;
        }
        else
        {
            VMax = StartValue + (kRect.childCount - 1) * AddValue + AddValue * 0.95f;
        }
        for (int i = 0; i < kRect.childCount; i++)
        {
            Transform          tran = kRect.GetChild(i);
            ScrollViewLoopItem item = tran.GetComponent <ScrollViewLoopItem>();
            if (item == null)
            {
                item = tran.gameObject.AddComponent <ScrollViewLoopItem>();
            }
            if (item != null)
            {
                Items.Add(item);
                item.Init(this);
                item.Drag(StartValue + i * AddValue);
            }
        }

        if (kRect.childCount < 5)
        {
            enabled = false;
        }
        currentIndex = 1;
    }