【逍遥游】优化返回逍遥游界面时重置滚动位置的问题

gaoxin 2020-10-19 14:08:28 +08:00
parent 3b62c91c69
commit 7a540133bd
3 changed files with 39 additions and 11 deletions

View File

@ -14,7 +14,13 @@ this.luckyluckyTurnTableRemainTime = 0
--打开逍遥游地图列表界面
function this.OpenMapList()
Log("点击打开逍遥游地图列表界面")
this.GetOpenMapData(function(_data)
Log("打开逍遥游地图列表界面")
UIManager.OpenPanel(UIName.XiaoYaoYouPanel,_data)
end)
end
function this.GetOpenMapData(func)
NetManager.JourneyGetInfoResponse(function (msg)
local _data={}
Log(#msg.infos)
@ -22,8 +28,9 @@ function this.OpenMapList()
Log("mapId:"..msg.infos[i].mapId..",process:"..msg.infos[i].process)
_data[msg.infos[i].mapId]=msg.infos[i].process
end
Log("打开逍遥游地图列表界面")
UIManager.OpenPanel(UIName.XiaoYaoYouPanel,_data)
if func then
func(_data)
end
end)
end

View File

@ -64,7 +64,7 @@ function this:BindEvent()
end)
Util.AddClick(this.btnBack, function ()
XiaoYaoManager.OpenMapList()
-- XiaoYaoManager.OpenMapList()
self:ClosePanel()
end)
--商店点击

View File

@ -50,6 +50,29 @@ end
function this:OnOpen(data)
--显示资源条
this.UpView:OnOpen({ showType = UpViewOpenType.ShowLeft, panelType = PanelType.MonsterCamp })
-- 界面显示
this.RefreshShow(data)
this.needShowRefresh = false -- show方法中不再需要刷新
-- 滚动到底部
this.ScrollToBottom()
end
function this:OnShow()
-- 判断是否需要自己刷新
if not this.needShowRefresh then
this.needShowRefresh = true
return
end
-- 刷新
XiaoYaoManager.GetOpenMapData(function(data)
this.RefreshShow(data)
end)
end
-- 刷新界面显示
function this.RefreshShow(data)
local _allData={}
local _cruLevel = PlayerManager.level
Log("当前玩家等级:".._cruLevel)
@ -82,11 +105,8 @@ function this:OnOpen(data)
-- this.ScrollView:SetData(_allData, function (index, go)
-- this.SingleDataShow(go, _allData[index])
-- end)
this.ScrollToBottom()
end
--- 滑动到底部
function this.ScrollToBottom()
local cheight = this.content.transform.rect.height
@ -127,6 +147,10 @@ function this.SingleDataShow(btn, go, data, index)
tip.text = "\n\n\n"
tip2.text = ""
local prog=data.progress < 100 and data.progress or 0
-- 在起点时进度为1%但前端显示为0%
if prog == 1 then
prog = 0
end
num.text = string.format("%u\n%%",prog)
else
if data.unlockLevel >= 0 then
@ -141,14 +165,11 @@ function this.SingleDataShow(btn, go, data, index)
end
-- fightIcon.sprite=Util.LoadSprite(data.mapImage)
zi.sprite = Util.LoadSprite(data.ziImage)
local prog=data.progress < 100 and data.progress or 0
-- local prog=data.progress < 100 and data.progress or 0
-- progressObj:SetActive(data.isUnLock)
-- progress.fillAmount=prog/100
-- progressVle.text=string.format("%u/100",prog)
_rewardObj:OnOpen(false, data.passReward, 1)
end
function this:OnShow()
end
function this:OnSortingOrderChange(_cursortingOrder)
cursortingOrder = _cursortingOrder