Exemple #1
0
 public virtual void Init(LoopScrollRect loopScroll)
 {
     _root = new GameObject("________").transform;
     _root.SetParent(loopScroll.transform, false);
     _pool    = new Queue <GameObject>(poolSize);
     _actives = new HashSet <GameObject>();
 }
Exemple #2
0
        /// <summary>
        ///  创建垂直ScroolBar
        /// </summary>
        /// <param name="target"></param>
        /// <param name="loopScrollRect"></param>
        /// <returns></returns>
        private static GameObject CreateVerticalDefaultScrollBar(Transform target, LoopScrollRect loopScrollRect)
        {
            DrivenRectTransformTracker m_Tracker;
            GameObject prefab = Resources.Load <GameObject>("LoopScrollRect/Scrollbar Vertical");
            GameObject go     = GameObject.Instantiate(prefab);

            go.name = prefab.name;
            go.transform.SetParent(target, false);
            go.transform.rotation   = Quaternion.identity;
            go.transform.localScale = Vector3.one;

            RectTransform rectrans = go.transform as RectTransform;

            rectrans.anchorMin        = new Vector2(1, 0);
            rectrans.anchorMax        = new Vector2(1, 1);
            rectrans.pivot            = Vector2.one;
            rectrans.anchoredPosition = Vector2.zero;
            rectrans.sizeDelta        = new Vector2(20, -17);

            m_Tracker.Add(go, rectrans, DrivenTransformProperties.Anchors | DrivenTransformProperties.SizeDelta | DrivenTransformProperties.AnchoredPosition);


            Scrollbar verticalScrollBar = go.GetComponent <Scrollbar>();

            verticalScrollBar.GetComponent <Image>().color = new Color(127, 127, 127, 255) / 255f;
            loopScrollRect.verticalScrollbar = verticalScrollBar;
            //     loopScrollRect.verticalScrollbarVisibility = LoopScrollRect.ScrollbarVisibility.Permanent;
            verticalScrollBar.size = 0.6f;
            return(go);
        }
        public virtual void OnDrag(PointerEventData eventData)
        {
            if (eventData.button != PointerEventData.InputButton.Left)
            {
                return;
            }
            if (!this.IsActive())
            {
                return;
            }
            Vector2 a;

            if (!RectTransformUtility.ScreenPointToLocalPointInRectangle(this.viewRect, eventData.position, eventData.pressEventCamera, out a))
            {
                return;
            }
            this.UpdateBounds(true);
            Vector2 b      = a - this.m_PointerStartLocalCursor;
            Vector2 vector = this.m_ContentStartPosition + b;
            Vector2 b2     = this.CalculateOffset(vector - this.m_Content.anchoredPosition);

            vector += b2;
            if (this.m_MovementType == LoopScrollRect.MovementType.Elastic)
            {
                if (b2.x != 0f)
                {
                    vector.x -= LoopScrollRect.RubberDelta(b2.x, this.m_ViewBounds.size.x);
                }
                if (b2.y != 0f)
                {
                    vector.y -= LoopScrollRect.RubberDelta(b2.y, this.m_ViewBounds.size.y);
                }
            }
            this.SetContentAnchoredPosition(vector);
        }
    static int get_verticalNormalizedPosition(IntPtr L)
    {
        object o = null;

        try
        {
            o = ToLua.ToObject(L, 1);
            UnityEngine.UI.LoopScrollRect obj = (UnityEngine.UI.LoopScrollRect)o;
            float ret = obj.verticalNormalizedPosition;
            LuaDLL.lua_pushnumber(L, ret);
            return(1);
        }
        catch (Exception e)
        {
            return(LuaDLL.toluaL_exception(L, e, o == null ? "attempt to index verticalNormalizedPosition on a nil value" : e.Message));
        }
    }
    static int set_verticalScrollbarVisibility(IntPtr L)
    {
        object o = null;

        try
        {
            o = ToLua.ToObject(L, 1);
            UnityEngine.UI.LoopScrollRect obj = (UnityEngine.UI.LoopScrollRect)o;
            UnityEngine.UI.LoopScrollRect.ScrollbarVisibility arg0 = (UnityEngine.UI.LoopScrollRect.ScrollbarVisibility)ToLua.CheckObject(L, 2, typeof(UnityEngine.UI.LoopScrollRect.ScrollbarVisibility));
            obj.verticalScrollbarVisibility = arg0;
            return(0);
        }
        catch (Exception e)
        {
            return(LuaDLL.toluaL_exception(L, e, o == null ? "attempt to index verticalScrollbarVisibility on a nil value" : e.Message));
        }
    }
Exemple #6
0
        //回收时解除消息绑定,及两者间关联
        public virtual void ReturnObject(LoopScrollRect scrollRect, Transform trans)
        {
            var insID = scrollRect.GetInstanceID();

            try
            {
                ScrollElementDict[insID][trans].UnRegisterEvent();
                ScrollElementDict[insID][trans].Dispose();
                ScrollElementDict[insID][trans] = null;
                ScrollElementDict[insID].Remove(trans);
            }
            catch (System.Exception)
            {
                throw new System.Exception($"{scrollRect.name}不存在于事件列表: {trans.name}");
            }
            SpawnManager.Instance.DespawnObject(trans);
        }
Exemple #7
0
    static int set_elasticity(IntPtr L)
    {
        object o = null;

        try
        {
            o = ToLua.ToObject(L, 1);
            UnityEngine.UI.LoopScrollRect obj = (UnityEngine.UI.LoopScrollRect)o;
            float arg0 = (float)LuaDLL.luaL_checknumber(L, 2);
            obj.elasticity = arg0;
            return(0);
        }
        catch (Exception e)
        {
            return(LuaDLL.toluaL_exception(L, e, o, "attempt to index elasticity on a nil value"));
        }
    }
Exemple #8
0
    static int set_content(IntPtr L)
    {
        object o = null;

        try
        {
            o = ToLua.ToObject(L, 1);
            UnityEngine.UI.LoopScrollRect obj  = (UnityEngine.UI.LoopScrollRect)o;
            UnityEngine.RectTransform     arg0 = (UnityEngine.RectTransform)ToLua.CheckObject(L, 2, typeof(UnityEngine.RectTransform));
            obj.content = arg0;
            return(0);
        }
        catch (Exception e)
        {
            return(LuaDLL.toluaL_exception(L, e, o, "attempt to index content on a nil value"));
        }
    }
Exemple #9
0
    static int set_CellPrefabName(IntPtr L)
    {
        object o = null;

        try
        {
            o = ToLua.ToObject(L, 1);
            UnityEngine.UI.LoopScrollRect obj = (UnityEngine.UI.LoopScrollRect)o;
            string arg0 = ToLua.CheckString(L, 2);
            obj.CellPrefabName = arg0;
            return(0);
        }
        catch (Exception e)
        {
            return(LuaDLL.toluaL_exception(L, e, o, "attempt to index CellPrefabName on a nil value"));
        }
    }
Exemple #10
0
        public override void GetPaths()
        {
            base.GetPaths();

            this.ListView = this.GetComponent <LoopScrollRect>();
            if (this.ListView != null)
            {
                var rViewModelProps = new List <BindableMember <PropertyInfo> >(
                    DataBindingTypeResolve.GetListViewModelProperties(this.gameObject));
                this.ModelPaths = DataBindingTypeResolve.GetAllViewModelPaths(rViewModelProps).ToArray();

                if (string.IsNullOrEmpty(this.ViewModelPath))
                {
                    this.ViewModelPath = this.ModelPaths.Length > 0 ? this.ModelPaths[0] : "";
                }
            }
        }
    static int get_movementType(IntPtr L)
    {
        object o = null;

        try
        {
            o = ToLua.ToObject(L, 1);
            UnityEngine.UI.LoopScrollRect obj = (UnityEngine.UI.LoopScrollRect)o;
            UnityEngine.UI.LoopScrollRect.MovementType ret = obj.movementType;
            ToLua.Push(L, ret);
            return(1);
        }
        catch (Exception e)
        {
            return(LuaDLL.toluaL_exception(L, e, o == null ? "attempt to index movementType on a nil value" : e.Message));
        }
    }
    static int get_CellPrefabName(IntPtr L)
    {
        object o = null;

        try
        {
            o = ToLua.ToObject(L, 1);
            UnityEngine.UI.LoopScrollRect obj = (UnityEngine.UI.LoopScrollRect)o;
            string ret = obj.CellPrefabName;
            LuaDLL.lua_pushstring(L, ret);
            return(1);
        }
        catch (Exception e)
        {
            return(LuaDLL.toluaL_exception(L, e, o == null ? "attempt to index CellPrefabName on a nil value" : e.Message));
        }
    }
    static int get_mCellPerfabGo(IntPtr L)
    {
        object o = null;

        try
        {
            o = ToLua.ToObject(L, 1);
            UnityEngine.UI.LoopScrollRect obj = (UnityEngine.UI.LoopScrollRect)o;
            UnityEngine.GameObject        ret = obj.mCellPerfabGo;
            ToLua.Push(L, ret);
            return(1);
        }
        catch (Exception e)
        {
            return(LuaDLL.toluaL_exception(L, e, o == null ? "attempt to index mCellPerfabGo on a nil value" : e.Message));
        }
    }
    static int set_verticalNormalizedPosition(IntPtr L)
    {
        object o = null;

        try
        {
            o = ToLua.ToObject(L, 1);
            UnityEngine.UI.LoopScrollRect obj = (UnityEngine.UI.LoopScrollRect)o;
            float arg0 = (float)LuaDLL.luaL_checknumber(L, 2);
            obj.verticalNormalizedPosition = arg0;
            return(0);
        }
        catch (Exception e)
        {
            return(LuaDLL.toluaL_exception(L, e, o == null ? "attempt to index verticalNormalizedPosition on a nil value" : e.Message));
        }
    }
    static int set_velocity(IntPtr L)
    {
        object o = null;

        try
        {
            o = ToLua.ToObject(L, 1);
            UnityEngine.UI.LoopScrollRect obj  = (UnityEngine.UI.LoopScrollRect)o;
            UnityEngine.Vector2           arg0 = ToLua.ToVector2(L, 2);
            obj.velocity = arg0;
            return(0);
        }
        catch (Exception e)
        {
            return(LuaDLL.toluaL_exception(L, e, o == null ? "attempt to index velocity on a nil value" : e.Message));
        }
    }
    static int set_onValueChanged(IntPtr L)
    {
        object o = null;

        try
        {
            o = ToLua.ToObject(L, 1);
            UnityEngine.UI.LoopScrollRect obj = (UnityEngine.UI.LoopScrollRect)o;
            UnityEngine.UI.LoopScrollRect.ScrollRectEvent arg0 = (UnityEngine.UI.LoopScrollRect.ScrollRectEvent)ToLua.CheckObject(L, 2, typeof(UnityEngine.UI.LoopScrollRect.ScrollRectEvent));
            obj.onValueChanged = arg0;
            return(0);
        }
        catch (Exception e)
        {
            return(LuaDLL.toluaL_exception(L, e, o == null ? "attempt to index onValueChanged on a nil value" : e.Message));
        }
    }
    static int set_horizontalScrollbarSpacing(IntPtr L)
    {
        object o = null;

        try
        {
            o = ToLua.ToObject(L, 1);
            UnityEngine.UI.LoopScrollRect obj = (UnityEngine.UI.LoopScrollRect)o;
            float arg0 = (float)LuaDLL.luaL_checknumber(L, 2);
            obj.horizontalScrollbarSpacing = arg0;
            return(0);
        }
        catch (Exception e)
        {
            return(LuaDLL.toluaL_exception(L, e, o == null ? "attempt to index horizontalScrollbarSpacing on a nil value" : e.Message));
        }
    }
    static int get_flexibleHeight(IntPtr L)
    {
        object o = null;

        try
        {
            o = ToLua.ToObject(L, 1);
            UnityEngine.UI.LoopScrollRect obj = (UnityEngine.UI.LoopScrollRect)o;
            float ret = obj.flexibleHeight;
            LuaDLL.lua_pushnumber(L, ret);
            return(1);
        }
        catch (Exception e)
        {
            return(LuaDLL.toluaL_exception(L, e, o == null ? "attempt to index flexibleHeight on a nil value" : e.Message));
        }
    }
    static int get_layoutPriority(IntPtr L)
    {
        object o = null;

        try
        {
            o = ToLua.ToObject(L, 1);
            UnityEngine.UI.LoopScrollRect obj = (UnityEngine.UI.LoopScrollRect)o;
            int ret = obj.layoutPriority;
            LuaDLL.lua_pushinteger(L, ret);
            return(1);
        }
        catch (Exception e)
        {
            return(LuaDLL.toluaL_exception(L, e, o == null ? "attempt to index layoutPriority on a nil value" : e.Message));
        }
    }
    static int get_inertia(IntPtr L)
    {
        object o = null;

        try
        {
            o = ToLua.ToObject(L, 1);
            UnityEngine.UI.LoopScrollRect obj = (UnityEngine.UI.LoopScrollRect)o;
            bool ret = obj.inertia;
            LuaDLL.lua_pushboolean(L, ret);
            return(1);
        }
        catch (Exception e)
        {
            return(LuaDLL.toluaL_exception(L, e, o == null ? "attempt to index inertia on a nil value" : e.Message));
        }
    }
Exemple #21
0
    static int set_mCellPerfabGo(IntPtr L)
    {
        object o = null;

        try
        {
            o = ToLua.ToObject(L, 1);
            UnityEngine.UI.LoopScrollRect obj  = (UnityEngine.UI.LoopScrollRect)o;
            UnityEngine.GameObject        arg0 = (UnityEngine.GameObject)ToLua.CheckObject(L, 2, typeof(UnityEngine.GameObject));
            obj.mCellPerfabGo = arg0;
            return(0);
        }
        catch (Exception e)
        {
            return(LuaDLL.toluaL_exception(L, e, o, "attempt to index mCellPerfabGo on a nil value"));
        }
    }
    static int get_viewport(IntPtr L)
    {
        object o = null;

        try
        {
            o = ToLua.ToObject(L, 1);
            UnityEngine.UI.LoopScrollRect obj = (UnityEngine.UI.LoopScrollRect)o;
            UnityEngine.RectTransform     ret = obj.viewport;
            ToLua.Push(L, ret);
            return(1);
        }
        catch (Exception e)
        {
            return(LuaDLL.toluaL_exception(L, e, o == null ? "attempt to index viewport on a nil value" : e.Message));
        }
    }
Exemple #23
0
    static int set_TotalCount(IntPtr L)
    {
        object o = null;

        try
        {
            o = ToLua.ToObject(L, 1);
            UnityEngine.UI.LoopScrollRect obj = (UnityEngine.UI.LoopScrollRect)o;
            int arg0 = (int)LuaDLL.luaL_checknumber(L, 2);
            obj.TotalCount = arg0;
            return(0);
        }
        catch (Exception e)
        {
            return(LuaDLL.toluaL_exception(L, e, o, "attempt to index TotalCount on a nil value"));
        }
    }
    static int get_verticalScrollbarVisibility(IntPtr L)
    {
        object o = null;

        try
        {
            o = ToLua.ToObject(L, 1);
            UnityEngine.UI.LoopScrollRect obj = (UnityEngine.UI.LoopScrollRect)o;
            UnityEngine.UI.LoopScrollRect.ScrollbarVisibility ret = obj.verticalScrollbarVisibility;
            ToLua.Push(L, ret);
            return(1);
        }
        catch (Exception e)
        {
            return(LuaDLL.toluaL_exception(L, e, o == null ? "attempt to index verticalScrollbarVisibility on a nil value" : e.Message));
        }
    }
Exemple #25
0
    static int set_movementType(IntPtr L)
    {
        object o = null;

        try
        {
            o = ToLua.ToObject(L, 1);
            UnityEngine.UI.LoopScrollRect obj = (UnityEngine.UI.LoopScrollRect)o;
            UnityEngine.UI.LoopScrollRect.MovementType arg0 = (UnityEngine.UI.LoopScrollRect.MovementType)ToLua.CheckObject(L, 2, typeof(UnityEngine.UI.LoopScrollRect.MovementType));
            obj.movementType = arg0;
            return(0);
        }
        catch (Exception e)
        {
            return(LuaDLL.toluaL_exception(L, e, o, "attempt to index movementType on a nil value"));
        }
    }
    static int get_horizontalScrollbarSpacing(IntPtr L)
    {
        object o = null;

        try
        {
            o = ToLua.ToObject(L, 1);
            UnityEngine.UI.LoopScrollRect obj = (UnityEngine.UI.LoopScrollRect)o;
            float ret = obj.horizontalScrollbarSpacing;
            LuaDLL.lua_pushnumber(L, ret);
            return(1);
        }
        catch (Exception e)
        {
            return(LuaDLL.toluaL_exception(L, e, o == null ? "attempt to index horizontalScrollbarSpacing on a nil value" : e.Message));
        }
    }
Exemple #27
0
    static int set_inertia(IntPtr L)
    {
        object o = null;

        try
        {
            o = ToLua.ToObject(L, 1);
            UnityEngine.UI.LoopScrollRect obj = (UnityEngine.UI.LoopScrollRect)o;
            bool arg0 = LuaDLL.luaL_checkboolean(L, 2);
            obj.inertia = arg0;
            return(0);
        }
        catch (Exception e)
        {
            return(LuaDLL.toluaL_exception(L, e, o, "attempt to index inertia on a nil value"));
        }
    }
    static int get_normalizedPosition(IntPtr L)
    {
        object o = null;

        try
        {
            o = ToLua.ToObject(L, 1);
            UnityEngine.UI.LoopScrollRect obj = (UnityEngine.UI.LoopScrollRect)o;
            UnityEngine.Vector2           ret = obj.normalizedPosition;
            ToLua.Push(L, ret);
            return(1);
        }
        catch (Exception e)
        {
            return(LuaDLL.toluaL_exception(L, e, o == null ? "attempt to index normalizedPosition on a nil value" : e.Message));
        }
    }
    static int get_onValueChanged(IntPtr L)
    {
        object o = null;

        try
        {
            o = ToLua.ToObject(L, 1);
            UnityEngine.UI.LoopScrollRect obj = (UnityEngine.UI.LoopScrollRect)o;
            UnityEngine.UI.LoopScrollRect.ScrollRectEvent ret = obj.onValueChanged;
            ToLua.PushObject(L, ret);
            return(1);
        }
        catch (Exception e)
        {
            return(LuaDLL.toluaL_exception(L, e, o == null ? "attempt to index onValueChanged on a nil value" : e.Message));
        }
    }
    static int set_horizontalScrollbar(IntPtr L)
    {
        object o = null;

        try
        {
            o = ToLua.ToObject(L, 1);
            UnityEngine.UI.LoopScrollRect obj  = (UnityEngine.UI.LoopScrollRect)o;
            UnityEngine.UI.Scrollbar      arg0 = (UnityEngine.UI.Scrollbar)ToLua.CheckUnityObject(L, 2, typeof(UnityEngine.UI.Scrollbar));
            obj.horizontalScrollbar = arg0;
            return(0);
        }
        catch (Exception e)
        {
            return(LuaDLL.toluaL_exception(L, e, o == null ? "attempt to index horizontalScrollbar on a nil value" : e.Message));
        }
    }