74 lines
2.5 KiB
Lua
74 lines
2.5 KiB
Lua
|
require("Base/BasePanel")
|
|||
|
FightLevelChapterPanel = Inherit(BasePanel)
|
|||
|
local this = FightLevelChapterPanel
|
|||
|
local orginLayer
|
|||
|
--初始化组件(用于子类重写)
|
|||
|
function FightLevelChapterPanel:InitComponent()
|
|||
|
self.btnBack = Util.GetGameObject(self.gameObject, "btnBack")
|
|||
|
self.sortBtn = Util.GetGameObject(self.gameObject, "sortBtn")
|
|||
|
self.helpBtn = Util.GetGameObject(self.gameObject, "rightUp/helpBtn")
|
|||
|
this.starNumText = Util.GetGameObject(self.gameObject, "rightUp/starNumText"):GetComponent("Text")
|
|||
|
|
|||
|
this.prb = Util.GetGameObject(self.gameObject, "middle/prb")
|
|||
|
this.ScrollView = SubUIManager.Open(SubUIConfig.ScrollCycleView, self.gameObject.transform,
|
|||
|
this.prb, nil, Vector2.New(1080, 1920), 1, 1, Vector2.New(0,0))
|
|||
|
this.ScrollView.moveTween.MomentumAmount = 1
|
|||
|
this.ScrollView.moveTween.Strength = 1
|
|||
|
end
|
|||
|
|
|||
|
--绑定事件(用于子类重写)
|
|||
|
function FightLevelChapterPanel:BindEvent()
|
|||
|
|
|||
|
Util.AddClick(self.btnBack, function()
|
|||
|
self:ClosePanel()
|
|||
|
end)
|
|||
|
Util.AddClick(self.helpBtn, function()
|
|||
|
UIManager.OpenPanel(UIName.HelpPopup,HELP_TYPE.Expedition,self.helpPos.x,self.helpPos.y)
|
|||
|
end)
|
|||
|
end
|
|||
|
function FightLevelChapterPanel:OnSortingOrderChange()
|
|||
|
orginLayer = self.sortingOrder
|
|||
|
end
|
|||
|
--界面打开时调用(用于子类重写)
|
|||
|
function FightLevelChapterPanel:OnOpen()
|
|||
|
|
|||
|
-- SoundManager.PlaySound(SoundConfig.Sound_WorldMap)
|
|||
|
end
|
|||
|
|
|||
|
--界面打开或者重新打开后,界面刷新时调用(用于子类重写)
|
|||
|
function FightLevelChapterPanel:OnShow()
|
|||
|
|
|||
|
this.OnShowPanel()
|
|||
|
end
|
|||
|
function this.OnShowPanel()
|
|||
|
|
|||
|
this.starNumText.text = "10"
|
|||
|
|
|||
|
local allData = {}
|
|||
|
this.ScrollView:SetData(allData, function (index, go)
|
|||
|
this.SingleChapterDataShow(go, allData[index])
|
|||
|
end)
|
|||
|
local curIndex = 1
|
|||
|
this.ScrollView:SetShow(curIndex)
|
|||
|
end
|
|||
|
function this.SingleChapterDataShow(go, data)
|
|||
|
|
|||
|
local playerParent = Util.GetGameObject(go, "playerParent")
|
|||
|
local cur = Util.GetGameObject(go, "cur")
|
|||
|
local open = Util.GetGameObject(go, "open")
|
|||
|
local lock = Util.GetGameObject(go, "lock")
|
|||
|
Util.GetGameObject(go, "chapterImage"):GetComponent("Image").sprite = Util.LoadSprite(GetResourcePath(data.Icon))
|
|||
|
Util.GetGameObject(go, "star/starNum"):GetComponent("Text").text = "10/20"
|
|||
|
Util.GetGameObject(go, "chapterName"):GetComponent("Text").text = "10/20"
|
|||
|
|
|||
|
end
|
|||
|
--界面关闭时调用(用于子类重写)
|
|||
|
function FightLevelChapterPanel:OnClose()
|
|||
|
end
|
|||
|
|
|||
|
--界面销毁时调用(用于子类重写)
|
|||
|
function FightLevelChapterPanel:OnDestroy()
|
|||
|
|
|||
|
end
|
|||
|
|
|||
|
return FightLevelChapterPanel
|