【优化】scrollview setData不是回到顶部时不再播放动画
parent
ef3c269876
commit
e8ea367a6e
|
@ -81,10 +81,8 @@ function this.RefreshRankInfo(isTop)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
-- 重置排行列表
|
-- 重置排行列表
|
||||||
this.ScrollView:SetData(rankList, rankAdapterFunc)
|
this.ScrollView:SetData(rankList, rankAdapterFunc, not isTop)
|
||||||
if isTop then -- 判断是否滚动到最上面
|
|
||||||
this.ScrollView:SetIndex(1)
|
|
||||||
end
|
|
||||||
-- 我的排名
|
-- 我的排名
|
||||||
--this.RankNodeAdapter(this.myRankItem, myRankInfo)
|
--this.RankNodeAdapter(this.myRankItem, myRankInfo)
|
||||||
local rankStr = myRankInfo.personInfo.rank
|
local rankStr = myRankInfo.personInfo.rank
|
||||||
|
|
|
@ -140,14 +140,11 @@ function this.OnShowMailListData(_allMail, isTop)
|
||||||
this.mialNum.text=Language[11147]..maildataCount
|
this.mialNum.text=Language[11147]..maildataCount
|
||||||
this.ScrollView:SetData(allMail, function (index, go)
|
this.ScrollView:SetData(allMail, function (index, go)
|
||||||
this.SingleMialDataShow(go, allMail[index])
|
this.SingleMialDataShow(go, allMail[index])
|
||||||
end)
|
end, not isTop)
|
||||||
-- if isPlayAnim then
|
-- if isPlayAnim then
|
||||||
-- SecTorPlayAnimByScroll(this.ScrollView)
|
-- SecTorPlayAnimByScroll(this.ScrollView)
|
||||||
-- isPlayAnim = false
|
-- isPlayAnim = false
|
||||||
-- end
|
-- end
|
||||||
if isTop then
|
|
||||||
this.ScrollView:SetIndex(1)
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
function this.SingleMialDataShow(_go,_mailData)
|
function this.SingleMialDataShow(_go,_mailData)
|
||||||
local mailImage = Util.GetGameObject(_go.transform, "mailImage")
|
local mailImage = Util.GetGameObject(_go.transform, "mailImage")
|
||||||
|
|
|
@ -56,14 +56,11 @@ function this.OnShowPanelData(isTop)
|
||||||
this.RewardTabsSort(AllData)
|
this.RewardTabsSort(AllData)
|
||||||
this.ScrollView:SetData(AllData, function (index, go)
|
this.ScrollView:SetData(AllData, function (index, go)
|
||||||
this.SingleDataShow(go, AllData[index])
|
this.SingleDataShow(go, AllData[index])
|
||||||
end)
|
end, not isTop)
|
||||||
-- if isPlayAnim then
|
-- if isPlayAnim then
|
||||||
-- SecTorPlayAnimByScroll(this.ScrollView)
|
-- SecTorPlayAnimByScroll(this.ScrollView)
|
||||||
-- isPlayAnim = false
|
-- isPlayAnim = false
|
||||||
-- end
|
-- end
|
||||||
if isTop then
|
|
||||||
this.ScrollView:SetIndex(1)
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
|
||||||
function this.SingleDataShow(go,rewardData)
|
function this.SingleDataShow(go,rewardData)
|
||||||
|
|
|
@ -118,15 +118,12 @@ function this.OnShowData(isTop)
|
||||||
local AllData = TaskManager.GetTypeTaskList(TaskTypeDef.Achievement)
|
local AllData = TaskManager.GetTypeTaskList(TaskTypeDef.Achievement)
|
||||||
this.ScrollView:SetData(curDailyMissionData, function (index, go)
|
this.ScrollView:SetData(curDailyMissionData, function (index, go)
|
||||||
this.SingleMissionDatasDataShow(go,curDailyMissionData[index])
|
this.SingleMissionDatasDataShow(go,curDailyMissionData[index])
|
||||||
end)
|
end, not isTop)
|
||||||
this.SetDailyMissionBox(curDailyMissionBoxData)
|
this.SetDailyMissionBox(curDailyMissionBoxData)
|
||||||
-- if isPlayAnim then
|
-- if isPlayAnim then
|
||||||
-- SecTorPlayAnimByScroll(this.ScrollView)
|
-- SecTorPlayAnimByScroll(this.ScrollView)
|
||||||
-- isPlayAnim = false
|
-- isPlayAnim = false
|
||||||
-- end
|
-- end
|
||||||
if isTop then
|
|
||||||
this.ScrollView:SetIndex(1)
|
|
||||||
end
|
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -88,10 +88,7 @@ function WeekMonthGiftPackPage:RefreshGiftData(isTop)
|
||||||
local callBack = function(index, item)
|
local callBack = function(index, item)
|
||||||
self:RefreshShowData(item, shopData[index].data)
|
self:RefreshShowData(item, shopData[index].data)
|
||||||
end
|
end
|
||||||
self.scrollView:SetData(shopData, callBack)
|
self.scrollView:SetData(shopData, callBack, not isTop)
|
||||||
if isTop then
|
|
||||||
self.scrollView:SetIndex(1)
|
|
||||||
end
|
|
||||||
if isPlayAnim then
|
if isPlayAnim then
|
||||||
SecTorPlayAnimByScroll(self.scrollView)
|
SecTorPlayAnimByScroll(self.scrollView)
|
||||||
isPlayAnim = false
|
isPlayAnim = false
|
||||||
|
|
|
@ -160,7 +160,7 @@ function this.SetWarPowerInfo()
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
this.SetHeadsInfo(warPowerData[index],root,index,warPowerData[index].userName,warPowerData[index].level)
|
this.SetHeadsInfo(warPowerData[index],root,index,warPowerData[index].userName,warPowerData[index].level)
|
||||||
end)
|
end, not this.istop)
|
||||||
this.CheckIsTop()
|
this.CheckIsTop()
|
||||||
end
|
end
|
||||||
--显示每条数据
|
--显示每条数据
|
||||||
|
@ -193,7 +193,7 @@ function this.SetArenaInfo()
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
this.SetHeadsInfo(arenaData[index].personInfo,root,index,arenaData[index].personInfo.name,arenaData[index].personInfo.level)
|
this.SetHeadsInfo(arenaData[index].personInfo,root,index,arenaData[index].personInfo.name,arenaData[index].personInfo.level)
|
||||||
end)
|
end, not this.istop)
|
||||||
this.CheckIsTop()
|
this.CheckIsTop()
|
||||||
end
|
end
|
||||||
--显示每条数据
|
--显示每条数据
|
||||||
|
@ -236,7 +236,7 @@ function this.SetTrialInfo()
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
this.SetHeadsInfo(trialData[index],root,index,trialData[index].userName,trialData[index].level)
|
this.SetHeadsInfo(trialData[index],root,index,trialData[index].userName,trialData[index].level)
|
||||||
end)
|
end, not this.istop)
|
||||||
this.CheckIsTop()
|
this.CheckIsTop()
|
||||||
end
|
end
|
||||||
--显示每条数据
|
--显示每条数据
|
||||||
|
@ -265,7 +265,7 @@ function this.SetMonsterInfo()
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
this.SetHeadsInfo(monsterData[index],root,index,monsterData[index].userName,monsterData[index].level)
|
this.SetHeadsInfo(monsterData[index],root,index,monsterData[index].userName,monsterData[index].level)
|
||||||
end)
|
end, not this.istop)
|
||||||
this.CheckIsTop()
|
this.CheckIsTop()
|
||||||
end
|
end
|
||||||
--显示每条数据
|
--显示每条数据
|
||||||
|
@ -297,7 +297,7 @@ function this.SetAdventureInfo()
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
this.SetHeadsInfo(adventureData[index],root,index,adventureData[index].name,adventureData[index].level)
|
this.SetHeadsInfo(adventureData[index],root,index,adventureData[index].name,adventureData[index].level)
|
||||||
end)
|
end, not this.istop)
|
||||||
this.CheckIsTop()
|
this.CheckIsTop()
|
||||||
end
|
end
|
||||||
--显示每条数据
|
--显示每条数据
|
||||||
|
@ -333,7 +333,7 @@ function this.SetCustomsPassInfo()
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
this.SetHeadsInfo(data[index],root,index,data[index].userName,data[index].level)
|
this.SetHeadsInfo(data[index],root,index,data[index].userName,data[index].level)
|
||||||
end)
|
end, not this.istop)
|
||||||
this.CheckIsTop()
|
this.CheckIsTop()
|
||||||
end
|
end
|
||||||
--显示每条数据
|
--显示每条数据
|
||||||
|
@ -487,8 +487,9 @@ end
|
||||||
--检查是否显示第一页 当切换页签时切换到第一页 当请求下一页时不跳转第一页
|
--检查是否显示第一页 当切换页签时切换到第一页 当请求下一页时不跳转第一页
|
||||||
function this.CheckIsTop()
|
function this.CheckIsTop()
|
||||||
if this.istop then
|
if this.istop then
|
||||||
this.scrollView:SetIndex(1)
|
-- this.scrollView:SetIndex(1)
|
||||||
this.istop =false
|
this.istop =false
|
||||||
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
--检查Tab是否解锁
|
--检查Tab是否解锁
|
||||||
|
|
|
@ -4,7 +4,7 @@ local this = ScrollCycleView
|
||||||
local reverse = table.reverse
|
local reverse = table.reverse
|
||||||
|
|
||||||
local function playGoAnim(self, go)
|
local function playGoAnim(self, go)
|
||||||
if self.isPlayAnim then
|
if self.isTop and self.isPlayAnim then
|
||||||
go.transform.localScale = Vector3.zero
|
go.transform.localScale = Vector3.zero
|
||||||
go.transform:DOScale(Vector3.one*1, 0.2)
|
go.transform:DOScale(Vector3.one*1, 0.2)
|
||||||
end
|
end
|
||||||
|
@ -274,6 +274,7 @@ function this:SetData(dataList, updateFunc, noTop, noAnim)
|
||||||
self.updateFunc = updateFunc --刷新回调,返回数据列表的索引和对应预设
|
self.updateFunc = updateFunc --刷新回调,返回数据列表的索引和对应预设
|
||||||
self.dataCount = #dataList
|
self.dataCount = #dataList
|
||||||
self.isPlayAnim = not noAnim
|
self.isPlayAnim = not noAnim
|
||||||
|
self.isTop = not noTop
|
||||||
|
|
||||||
if self.dragType == 1 then
|
if self.dragType == 1 then
|
||||||
self.itemDis = self.itemHeight * math.ceil(self.dataCount / self.fixedCount) + self.spacing.y - self.rectTransform.sizeDelta.y
|
self.itemDis = self.itemHeight * math.ceil(self.dataCount / self.fixedCount) + self.spacing.y - self.rectTransform.sizeDelta.y
|
||||||
|
@ -291,11 +292,11 @@ function this:SetData(dataList, updateFunc, noTop, noAnim)
|
||||||
end
|
end
|
||||||
|
|
||||||
-- 判断是否回到顶部,否则保持不动
|
-- 判断是否回到顶部,否则保持不动
|
||||||
if noTop then
|
if self.isTop then
|
||||||
|
self:SetShow(1)
|
||||||
|
else
|
||||||
local showIndex = self:CalShowIndex()
|
local showIndex = self:CalShowIndex()
|
||||||
self:SetShow(showIndex)
|
self:SetShow(showIndex)
|
||||||
else
|
|
||||||
self:SetShow(1)
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -331,10 +332,13 @@ function this:SetShow(showIndex)
|
||||||
-- 隐藏所有物体,并处理物体在数据结构中的位置
|
-- 隐藏所有物体,并处理物体在数据结构中的位置
|
||||||
for j=1, self.fixedCount do
|
for j=1, self.fixedCount do
|
||||||
for i=1, self.itemCount do
|
for i=1, self.itemCount do
|
||||||
local item = self.cellItemList[j][i]
|
-- 回到最上面的时候
|
||||||
if item.go then
|
if self.isTop then
|
||||||
item.isActive = false
|
local item = self.cellItemList[j][i]
|
||||||
item.go:SetActive(false)
|
if item.go then
|
||||||
|
item.isActive = false
|
||||||
|
item.go:SetActive(false)
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
move(self.cellItemList[j], oldLine - self.dataLine)
|
move(self.cellItemList[j], oldLine - self.dataLine)
|
||||||
|
|
|
@ -390,10 +390,7 @@ function this:RefreshItemList(isTop)
|
||||||
-- if isPlayShow then
|
-- if isPlayShow then
|
||||||
-- shopItem.gameObject:SetActive(false)
|
-- shopItem.gameObject:SetActive(false)
|
||||||
-- end
|
-- end
|
||||||
end)
|
end, not isTop)
|
||||||
if isTop then
|
|
||||||
self.RechargeScrollView:SetIndex(1)
|
|
||||||
end
|
|
||||||
-- if isPlayShow then
|
-- if isPlayShow then
|
||||||
-- SecTorPlayAnimByScroll(self.RechargeScrollView,0.03)
|
-- SecTorPlayAnimByScroll(self.RechargeScrollView,0.03)
|
||||||
-- isPlayShow = false
|
-- isPlayShow = false
|
||||||
|
@ -409,10 +406,7 @@ function this:RefreshItemList(isTop)
|
||||||
if isPlayShow then
|
if isPlayShow then
|
||||||
shopItem.gameObject:SetActive(true)
|
shopItem.gameObject:SetActive(true)
|
||||||
end
|
end
|
||||||
end)
|
end, not isTop)
|
||||||
if isTop then
|
|
||||||
self.ScrollView:SetIndex(1)
|
|
||||||
end
|
|
||||||
-- if isPlayShow then
|
-- if isPlayShow then
|
||||||
-- -- SecTorPlayAnimByScroll(self.ScrollView, 0.03)
|
-- -- SecTorPlayAnimByScroll(self.ScrollView, 0.03)
|
||||||
-- isPlayShow = false
|
-- isPlayShow = false
|
||||||
|
|
Loading…
Reference in New Issue