示例#1
0
 void Reverse(int p, int q)
 {
     for (; p < q; p++, q--)
     {
         ScrollViewLoopItem temp = Items[q];
         Items[q] = Items[p];
         Items[p] = temp;
     }
 }
示例#2
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));
     }
 }
示例#3
0
 static int Init(IntPtr L)
 {
     try
     {
         ToLua.CheckArgsCount(L, 2);
         ScrollViewLoopItem obj  = (ScrollViewLoopItem)ToLua.CheckObject(L, 1, typeof(ScrollViewLoopItem));
         ScrollViewLoop     arg0 = (ScrollViewLoop)ToLua.CheckUnityObject(L, 2, typeof(ScrollViewLoop));
         obj.Init(arg0);
         return(0);
     }
     catch (Exception e)
     {
         return(LuaDLL.toluaL_exception(L, e));
     }
 }
示例#4
0
 public void InitAllChild()
 {
     for (int i = transform.childCount - 1; i >= 0; i--)
     {
         Transform tran = transform.GetChild(i);
         tran.FindChild("imgSkill").gameObject.SetActive(false);
         tran.localPosition = Vector3.zero;
         ScrollViewLoopItem item = tran.GetComponent <ScrollViewLoopItem>();
         if (item)
         {
             item.Init(this);
             item.v = 0;
         }
     }
     Items.Clear();
     currentIndex = 0;
 }
示例#5
0
    static int get_rect(IntPtr L)
    {
        object o = null;

        try
        {
            o = ToLua.ToObject(L, 1);
            ScrollViewLoopItem        obj = (ScrollViewLoopItem)o;
            UnityEngine.RectTransform ret = obj.rect;
            ToLua.Push(L, ret);
            return(1);
        }
        catch (Exception e)
        {
            return(LuaDLL.toluaL_exception(L, e, o == null ? "attempt to index rect on a nil value" : e.Message));
        }
    }
示例#6
0
    static int set_v(IntPtr L)
    {
        object o = null;

        try
        {
            o = ToLua.ToObject(L, 1);
            ScrollViewLoopItem obj = (ScrollViewLoopItem)o;
            float arg0             = (float)LuaDLL.luaL_checknumber(L, 2);
            obj.v = arg0;
            return(0);
        }
        catch (Exception e)
        {
            return(LuaDLL.toluaL_exception(L, e, o == null ? "attempt to index v on a nil value" : e.Message));
        }
    }
示例#7
0
    static int set_rect(IntPtr L)
    {
        object o = null;

        try
        {
            o = ToLua.ToObject(L, 1);
            ScrollViewLoopItem        obj  = (ScrollViewLoopItem)o;
            UnityEngine.RectTransform arg0 = (UnityEngine.RectTransform)ToLua.CheckUnityObject(L, 2, typeof(UnityEngine.RectTransform));
            obj.rect = arg0;
            return(0);
        }
        catch (Exception e)
        {
            return(LuaDLL.toluaL_exception(L, e, o == null ? "attempt to index rect on a nil value" : e.Message));
        }
    }
示例#8
0
    static int get_v(IntPtr L)
    {
        object o = null;

        try
        {
            o = ToLua.ToObject(L, 1);
            ScrollViewLoopItem obj = (ScrollViewLoopItem)o;
            float ret = obj.v;
            LuaDLL.lua_pushnumber(L, ret);
            return(1);
        }
        catch (Exception e)
        {
            return(LuaDLL.toluaL_exception(L, e, o == null ? "attempt to index v on a nil value" : e.Message));
        }
    }
示例#9
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;
    }