Exemplo n.º 1
0
        public void AddCell(int addCount, bool needMoveDown, bool isShowAnimation)
        {
            if (this.maxCount <= 0 || this.nTotalCount < this.maxCount)
            {
                this.nTotalCount           += addCount;
                this.transContent.sizeDelta = new Vector2(this.transContent.sizeDelta.x, (float)this.nTotalCount * this.cellHeight);
                this.ResetCellPosition(addCount);
            }
            else
            {
                if (this.IsAtBottom())
                {
                    this.ResetCellPosition(addCount * 2);
                    this.RemoveFirstData();
                }
                if (needMoveDown)
                {
                    float y = Mathf.Max((float)(this.nTotalCount - 1) * this.cellHeight - this.viewHeight, 0f);
                    this.transContent.anchoredPosition = new Vector2(this.transContent.anchoredPosition.x, y);
                }
            }
            float y2 = Mathf.Max((float)this.nTotalCount * this.cellHeight - this.viewHeight, 0f);

            if (needMoveDown)
            {
                if (isShowAnimation)
                {
                    if (!this.transContent.GetComponent <TweenPosition>())
                    {
                        this.transContent.gameObject.AddComponent <TweenPosition>();
                    }
                    Vector3 to = new Vector3(this.transContent.localPosition.x, y2, this.transContent.localPosition.z);
                    TweenUtil.SetTweenPositionInfo(this.transContent.gameObject, this.transContent.localPosition, to, this.moveTime, 0f);
                    TweenUtil.PlayTween(this.transContent.gameObject, true, null, true);
                }
                else
                {
                    this.transContent.anchoredPosition = new Vector2(this.transContent.anchoredPosition.x, y2);
                }
            }
            this.UpdateCell();
        }
    private static int PlayTween(IntPtr L)
    {
        int result;

        try
        {
            ToLua.CheckArgsCount(L, 4);
            GameObject  go        = (GameObject)ToLua.CheckUnityObject(L, 1, typeof(GameObject));
            bool        isForward = LuaDLL.luaL_checkboolean(L, 2);
            LuaFunction luafunc   = ToLua.CheckLuaFunction(L, 3);
            bool        isRestart = LuaDLL.luaL_checkboolean(L, 4);
            TweenUtil.PlayTween(go, isForward, luafunc, isRestart);
            result = 0;
        }
        catch (Exception e)
        {
            result = LuaDLL.toluaL_exception(L, e, null);
        }
        return(result);
    }