2020-09-25 17:02:38 +08:00
|
|
|
|
require("Base/BasePanel")
|
|
|
|
|
|
XiaoYaoYouPanel = Inherit(BasePanel)
|
|
|
|
|
|
local this = XiaoYaoYouPanel
|
|
|
|
|
|
local cursortingOrder
|
|
|
|
|
|
local mainLevelSettingConFig = ConfigManager.GetConfig(ConfigName.MainLevelSettingConfig)
|
|
|
|
|
|
|
|
|
|
|
|
--初始化组件(用于子类重写)
|
|
|
|
|
|
function this:InitComponent()
|
|
|
|
|
|
this.btnBack = Util.GetGameObject(self.gameObject, "btnBack")
|
|
|
|
|
|
this.UpView = SubUIManager.Open(SubUIConfig.UpView, self.gameObject.transform)
|
|
|
|
|
|
this.scrollItem = Util.GetGameObject(self.gameObject, "scrollItem")
|
|
|
|
|
|
this.itemPre = Util.GetGameObject(self.gameObject, "prefab/ItemPre")
|
|
|
|
|
|
local rootHight = this.scrollItem.transform.rect.height
|
|
|
|
|
|
local width = this.scrollItem.transform.rect.width
|
|
|
|
|
|
this.ScrollView = SubUIManager.Open(SubUIConfig.ScrollCycleView, this.scrollItem.transform,
|
|
|
|
|
|
this.itemPre, nil, Vector2.New(width, rootHight), 1, 1, Vector2.New(0, -3))
|
|
|
|
|
|
this.ScrollView.moveTween.MomentumAmount = 1
|
|
|
|
|
|
this.ScrollView.moveTween.Strength = 2
|
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
--绑定事件(用于子类重写)
|
|
|
|
|
|
function this:BindEvent()
|
|
|
|
|
|
Util.AddClick(this.btnBack, function ()
|
|
|
|
|
|
PlayerManager.carbonType = 1
|
|
|
|
|
|
UIManager.OpenPanel(UIName.FightPointPassMainPanel)
|
|
|
|
|
|
self:ClosePanel()
|
|
|
|
|
|
end)
|
|
|
|
|
|
|
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
--添加事件监听(用于子类重写)
|
|
|
|
|
|
function this:AddListener()
|
|
|
|
|
|
|
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
--移除事件监听(用于子类重写)
|
|
|
|
|
|
function this:RemoveListener()
|
|
|
|
|
|
|
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
--界面打开时调用(用于子类重写)
|
|
|
|
|
|
function this:OnOpen(...)
|
|
|
|
|
|
--显示资源条
|
|
|
|
|
|
this.UpView:OnOpen({ showType = UpViewOpenType.ShowLeft, panelType = PanelType.MonsterCamp })
|
|
|
|
|
|
local _allData={}
|
|
|
|
|
|
local _curChapter = FightPointPassManager.GetCurChapterIndex()
|
|
|
|
|
|
Log("当前通关章节:".._curChapter)
|
|
|
|
|
|
for chaptId, config in ConfigPairs(mainLevelSettingConFig) do
|
|
|
|
|
|
local _isUnLock=_curChapter>=chaptId--判断章节是否开启
|
|
|
|
|
|
local _singleData={mapName=config.Name,mapImage=config.ChapterBg,isUnLock=_isUnLock,curProgress=40,allProgress=100,passReward={16,600}}
|
|
|
|
|
|
_allData[chaptId]=_singleData
|
|
|
|
|
|
end
|
|
|
|
|
|
Log("所有章节长度:"..#_allData)
|
|
|
|
|
|
this.ScrollView:SetData(_allData, function (index, go)
|
|
|
|
|
|
this.SingleDataShow(go, _allData[index])
|
|
|
|
|
|
end)
|
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
--刷新每一条的显示数据
|
|
|
|
|
|
function this.SingleDataShow(go, data)
|
|
|
|
|
|
local fightIcon = Util.GetGameObject(go, "fightIcon"):GetComponent("Image")
|
|
|
|
|
|
local reward = Util.GetGameObject(go, "fightIcon/reward")
|
|
|
|
|
|
local name = Util.GetGameObject(go, "fightIcon/name/Text"):GetComponent("Text")
|
|
|
|
|
|
local _rewardObj= SubUIManager.Open(SubUIConfig.ItemView, reward.transform)
|
|
|
|
|
|
local progress=Util.GetGameObject(go,"fightIcon/progress/Image"):GetComponent("Image")
|
|
|
|
|
|
local progressVle=Util.GetGameObject(go,"fightIcon/progress/Text"):GetComponent("Text")
|
|
|
|
|
|
local lock=Util.GetGameObject(go,"fightIcon/lock")
|
|
|
|
|
|
local btn=Util.GetGameObject(go,"btn")
|
|
|
|
|
|
Util.AddOnceClick(btn,function()
|
|
|
|
|
|
Log(string.format("点击了%s地图",data.mapName))
|
|
|
|
|
|
if not data.isUnLock then
|
|
|
|
|
|
PopupTipPanel.ShowTip("地图尚未开启!")
|
|
|
|
|
|
else
|
2020-09-28 16:30:52 +08:00
|
|
|
|
UIManager.OpenPanel(UIName.XiaoYaoMapPanel)
|
2020-09-25 17:02:38 +08:00
|
|
|
|
end
|
|
|
|
|
|
end)
|
|
|
|
|
|
Log("isUnLock值:"..tostring(data.isUnLock))
|
|
|
|
|
|
lock:SetActive(not data.isUnLock)
|
|
|
|
|
|
name.text=data.mapName
|
|
|
|
|
|
fightIcon.sprite=Util.LoadSprite(data.mapImage)
|
|
|
|
|
|
progress.fillAmount=data.curProgress/data.allProgress
|
|
|
|
|
|
progressVle.text=string.format("%u/%u",data.curProgress,data.allProgress)
|
2020-09-28 16:30:52 +08:00
|
|
|
|
_rewardObj:OnOpen(false, data.passReward, 1,false,false,false,cursortingOrder)
|
2020-09-25 17:02:38 +08:00
|
|
|
|
end
|
|
|
|
|
|
function this:OnShow()
|
|
|
|
|
|
|
|
|
|
|
|
end
|
|
|
|
|
|
function this:OnSortingOrderChange(_cursortingOrder)
|
|
|
|
|
|
cursortingOrder = _cursortingOrder
|
|
|
|
|
|
end
|
|
|
|
|
|
--界面关闭时调用(用于子类重写)
|
|
|
|
|
|
function this:OnClose()
|
|
|
|
|
|
|
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
--界面销毁时调用(用于子类重写)
|
|
|
|
|
|
function this:OnDestroy()
|
|
|
|
|
|
|
|
|
|
|
|
end
|
|
|
|
|
|
return XiaoYaoYouPanel
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|