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 SetTweenPositionInfo(IntPtr L) { int result; try { ToLua.CheckArgsCount(L, 5); GameObject go = (GameObject)ToLua.CheckUnityObject(L, 1, typeof(GameObject)); Vector3 from = ToLua.ToVector3(L, 2); Vector3 to = ToLua.ToVector3(L, 3); float duration = (float)LuaDLL.luaL_checknumber(L, 4); float delay = (float)LuaDLL.luaL_checknumber(L, 5); TweenUtil.SetTweenPositionInfo(go, from, to, duration, delay); result = 0; } catch (Exception e) { result = LuaDLL.toluaL_exception(L, e, null); } return(result); }