From e8ea367a6e75fb79269f3c521e4e6a2cfb91bf83 Mon Sep 17 00:00:00 2001 From: JieLing Date: Wed, 30 Dec 2020 16:45:52 +0800 Subject: [PATCH] =?UTF-8?q?=E3=80=90=E4=BC=98=E5=8C=96=E3=80=91scrollview?= =?UTF-8?q?=20setData=E4=B8=8D=E6=98=AF=E5=9B=9E=E5=88=B0=E9=A1=B6?= =?UTF-8?q?=E9=83=A8=E6=97=B6=E4=B8=8D=E5=86=8D=E6=92=AD=E6=94=BE=E5=8A=A8?= =?UTF-8?q?=E7=94=BB?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../~Lua/Modules/Arena/View/RankView.lua | 6 ++---- .../~Lua/Modules/Mail/MailMainPanel.lua | 5 +---- .../Mission/MissionDailyPanel_Achievement.lua | 5 +---- .../Mission/MissionDailyPanel_Daily.lua | 5 +---- .../Operating/WeekMonthGiftPackPage.lua | 5 +---- .../~Lua/Modules/Ranking/RankingListPanel.lua | 15 +++++++------- .../~Lua/View/ScrollCycleView.lua | 20 +++++++++++-------- .../ManagedResources/~Lua/View/ShopView.lua | 10 ++-------- 8 files changed, 28 insertions(+), 43 deletions(-) diff --git a/Assets/ManagedResources/~Lua/Modules/Arena/View/RankView.lua b/Assets/ManagedResources/~Lua/Modules/Arena/View/RankView.lua index 77f46f34e3..2c14952671 100644 --- a/Assets/ManagedResources/~Lua/Modules/Arena/View/RankView.lua +++ b/Assets/ManagedResources/~Lua/Modules/Arena/View/RankView.lua @@ -81,10 +81,8 @@ function this.RefreshRankInfo(isTop) end end -- 重置排行列表 - this.ScrollView:SetData(rankList, rankAdapterFunc) - if isTop then -- 判断是否滚动到最上面 - this.ScrollView:SetIndex(1) - end + this.ScrollView:SetData(rankList, rankAdapterFunc, not isTop) + -- 我的排名 --this.RankNodeAdapter(this.myRankItem, myRankInfo) local rankStr = myRankInfo.personInfo.rank diff --git a/Assets/ManagedResources/~Lua/Modules/Mail/MailMainPanel.lua b/Assets/ManagedResources/~Lua/Modules/Mail/MailMainPanel.lua index 8cbd36655f..70f299475d 100644 --- a/Assets/ManagedResources/~Lua/Modules/Mail/MailMainPanel.lua +++ b/Assets/ManagedResources/~Lua/Modules/Mail/MailMainPanel.lua @@ -140,14 +140,11 @@ function this.OnShowMailListData(_allMail, isTop) this.mialNum.text=Language[11147]..maildataCount this.ScrollView:SetData(allMail, function (index, go) this.SingleMialDataShow(go, allMail[index]) - end) + end, not isTop) -- if isPlayAnim then -- SecTorPlayAnimByScroll(this.ScrollView) -- isPlayAnim = false -- end - if isTop then - this.ScrollView:SetIndex(1) - end end function this.SingleMialDataShow(_go,_mailData) local mailImage = Util.GetGameObject(_go.transform, "mailImage") diff --git a/Assets/ManagedResources/~Lua/Modules/Mission/MissionDailyPanel_Achievement.lua b/Assets/ManagedResources/~Lua/Modules/Mission/MissionDailyPanel_Achievement.lua index 7d0e1c946c..30bc0e408b 100644 --- a/Assets/ManagedResources/~Lua/Modules/Mission/MissionDailyPanel_Achievement.lua +++ b/Assets/ManagedResources/~Lua/Modules/Mission/MissionDailyPanel_Achievement.lua @@ -56,14 +56,11 @@ function this.OnShowPanelData(isTop) this.RewardTabsSort(AllData) this.ScrollView:SetData(AllData, function (index, go) this.SingleDataShow(go, AllData[index]) - end) + end, not isTop) -- if isPlayAnim then -- SecTorPlayAnimByScroll(this.ScrollView) -- isPlayAnim = false -- end - if isTop then - this.ScrollView:SetIndex(1) - end end function this.SingleDataShow(go,rewardData) diff --git a/Assets/ManagedResources/~Lua/Modules/Mission/MissionDailyPanel_Daily.lua b/Assets/ManagedResources/~Lua/Modules/Mission/MissionDailyPanel_Daily.lua index ca0520fc39..8e85f64f7e 100644 --- a/Assets/ManagedResources/~Lua/Modules/Mission/MissionDailyPanel_Daily.lua +++ b/Assets/ManagedResources/~Lua/Modules/Mission/MissionDailyPanel_Daily.lua @@ -118,15 +118,12 @@ function this.OnShowData(isTop) local AllData = TaskManager.GetTypeTaskList(TaskTypeDef.Achievement) this.ScrollView:SetData(curDailyMissionData, function (index, go) this.SingleMissionDatasDataShow(go,curDailyMissionData[index]) - end) + end, not isTop) this.SetDailyMissionBox(curDailyMissionBoxData) -- if isPlayAnim then -- SecTorPlayAnimByScroll(this.ScrollView) -- isPlayAnim = false -- end - if isTop then - this.ScrollView:SetIndex(1) - end end diff --git a/Assets/ManagedResources/~Lua/Modules/Operating/WeekMonthGiftPackPage.lua b/Assets/ManagedResources/~Lua/Modules/Operating/WeekMonthGiftPackPage.lua index 953f5707c8..81ea081d89 100644 --- a/Assets/ManagedResources/~Lua/Modules/Operating/WeekMonthGiftPackPage.lua +++ b/Assets/ManagedResources/~Lua/Modules/Operating/WeekMonthGiftPackPage.lua @@ -88,10 +88,7 @@ function WeekMonthGiftPackPage:RefreshGiftData(isTop) local callBack = function(index, item) self:RefreshShowData(item, shopData[index].data) end - self.scrollView:SetData(shopData, callBack) - if isTop then - self.scrollView:SetIndex(1) - end + self.scrollView:SetData(shopData, callBack, not isTop) if isPlayAnim then SecTorPlayAnimByScroll(self.scrollView) isPlayAnim = false diff --git a/Assets/ManagedResources/~Lua/Modules/Ranking/RankingListPanel.lua b/Assets/ManagedResources/~Lua/Modules/Ranking/RankingListPanel.lua index d123694c56..d5e1cc7a78 100644 --- a/Assets/ManagedResources/~Lua/Modules/Ranking/RankingListPanel.lua +++ b/Assets/ManagedResources/~Lua/Modules/Ranking/RankingListPanel.lua @@ -160,7 +160,7 @@ function this.SetWarPowerInfo() return end this.SetHeadsInfo(warPowerData[index],root,index,warPowerData[index].userName,warPowerData[index].level) - end) + end, not this.istop) this.CheckIsTop() end --显示每条数据 @@ -193,7 +193,7 @@ function this.SetArenaInfo() return end this.SetHeadsInfo(arenaData[index].personInfo,root,index,arenaData[index].personInfo.name,arenaData[index].personInfo.level) - end) + end, not this.istop) this.CheckIsTop() end --显示每条数据 @@ -236,7 +236,7 @@ function this.SetTrialInfo() return end this.SetHeadsInfo(trialData[index],root,index,trialData[index].userName,trialData[index].level) - end) + end, not this.istop) this.CheckIsTop() end --显示每条数据 @@ -265,7 +265,7 @@ function this.SetMonsterInfo() return end this.SetHeadsInfo(monsterData[index],root,index,monsterData[index].userName,monsterData[index].level) - end) + end, not this.istop) this.CheckIsTop() end --显示每条数据 @@ -297,7 +297,7 @@ function this.SetAdventureInfo() return end this.SetHeadsInfo(adventureData[index],root,index,adventureData[index].name,adventureData[index].level) - end) + end, not this.istop) this.CheckIsTop() end --显示每条数据 @@ -333,7 +333,7 @@ function this.SetCustomsPassInfo() return end this.SetHeadsInfo(data[index],root,index,data[index].userName,data[index].level) - end) + end, not this.istop) this.CheckIsTop() end --显示每条数据 @@ -487,8 +487,9 @@ end --检查是否显示第一页 当切换页签时切换到第一页 当请求下一页时不跳转第一页 function this.CheckIsTop() if this.istop then - this.scrollView:SetIndex(1) + -- this.scrollView:SetIndex(1) this.istop =false + end end --检查Tab是否解锁 diff --git a/Assets/ManagedResources/~Lua/View/ScrollCycleView.lua b/Assets/ManagedResources/~Lua/View/ScrollCycleView.lua index 2f65acbba2..cb031886ba 100644 --- a/Assets/ManagedResources/~Lua/View/ScrollCycleView.lua +++ b/Assets/ManagedResources/~Lua/View/ScrollCycleView.lua @@ -4,7 +4,7 @@ local this = ScrollCycleView local reverse = table.reverse local function playGoAnim(self, go) - if self.isPlayAnim then + if self.isTop and self.isPlayAnim then go.transform.localScale = Vector3.zero go.transform:DOScale(Vector3.one*1, 0.2) end @@ -274,6 +274,7 @@ function this:SetData(dataList, updateFunc, noTop, noAnim) self.updateFunc = updateFunc --刷新回调,返回数据列表的索引和对应预设 self.dataCount = #dataList self.isPlayAnim = not noAnim + self.isTop = not noTop if self.dragType == 1 then 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 -- 判断是否回到顶部,否则保持不动 - if noTop then + if self.isTop then + self:SetShow(1) + else local showIndex = self:CalShowIndex() self:SetShow(showIndex) - else - self:SetShow(1) end end @@ -331,10 +332,13 @@ function this:SetShow(showIndex) -- 隐藏所有物体,并处理物体在数据结构中的位置 for j=1, self.fixedCount do for i=1, self.itemCount do - local item = self.cellItemList[j][i] - if item.go then - item.isActive = false - item.go:SetActive(false) + -- 回到最上面的时候 + if self.isTop then + local item = self.cellItemList[j][i] + if item.go then + item.isActive = false + item.go:SetActive(false) + end end end move(self.cellItemList[j], oldLine - self.dataLine) diff --git a/Assets/ManagedResources/~Lua/View/ShopView.lua b/Assets/ManagedResources/~Lua/View/ShopView.lua index c37752147f..4ca0c44608 100644 --- a/Assets/ManagedResources/~Lua/View/ShopView.lua +++ b/Assets/ManagedResources/~Lua/View/ShopView.lua @@ -390,10 +390,7 @@ function this:RefreshItemList(isTop) -- if isPlayShow then -- shopItem.gameObject:SetActive(false) -- end - end) - if isTop then - self.RechargeScrollView:SetIndex(1) - end + end, not isTop) -- if isPlayShow then -- SecTorPlayAnimByScroll(self.RechargeScrollView,0.03) -- isPlayShow = false @@ -409,10 +406,7 @@ function this:RefreshItemList(isTop) if isPlayShow then shopItem.gameObject:SetActive(true) end - end) - if isTop then - self.ScrollView:SetIndex(1) - end + end, not isTop) -- if isPlayShow then -- -- SecTorPlayAnimByScroll(self.ScrollView, 0.03) -- isPlayShow = false