diff --git a/Assets/ManagedResources/~Lua/View/ScrollCycleView.lua b/Assets/ManagedResources/~Lua/View/ScrollCycleView.lua index b80dc02eac..1a66e386aa 100644 --- a/Assets/ManagedResources/~Lua/View/ScrollCycleView.lua +++ b/Assets/ManagedResources/~Lua/View/ScrollCycleView.lua @@ -262,16 +262,7 @@ function ScrollCycleView:OnDestroy() end --界面打开时调用(用于子类重写) -function ScrollCycleView:OnOpen(itemGO, scrollBar, scrollSizeDeltaV2, dragType, fixedCount, spacingV2,maxOffSet) - if not maxOffSet then - if not self.elastic then - self.maxOffSet = 0 - else - self.maxOffSet = 500 - end - else - self.maxOffSet = maxOffSet - end +function ScrollCycleView:OnOpen(itemGO, scrollBar, scrollSizeDeltaV2, dragType, fixedCount, spacingV2) self.gameObject:SetActive(true) self.item = itemGO --关联的预设 self.scrollBar = scrollBar --关联scrollBar组件 @@ -315,7 +306,16 @@ function ScrollCycleView:OnOpen(itemGO, scrollBar, scrollSizeDeltaV2, dragType, self.dragGOTran.anchoredPosition = Vector2.New(0, 0) end -function this:SetData(dataList, updateFunc, noTop, noAnim) +function this:SetData(dataList, updateFunc, noTop, noAnim,maxOffSet) + if not maxOffSet then + if not self.elastic then + self.maxOffSet = 0 + else + self.maxOffSet = 500 + end + else + self.maxOffSet = maxOffSet + end self.dataList = dataList --传入的数据列表 self.updateFunc = updateFunc --刷新回调,返回数据列表的索引和对应预设 self.dataCount = #dataList