2021-07-14 11:30:09 +08:00
|
|
|
require("Base/BasePanel")
|
|
|
|
local FightLevelTrialPanel = Inherit(BasePanel)
|
2021-07-14 11:33:33 +08:00
|
|
|
local STATE = {
|
|
|
|
[0] = {Img = "s_slbz_1anniuhuise",text = Language[11948]},
|
|
|
|
[1] = {Img = "s_slbz_1anniuongse",text = Language[11948]},
|
|
|
|
[2] = {Img = "s_slbz_1anniuhuise",text = Language[10101]},
|
|
|
|
}
|
2021-07-14 11:30:09 +08:00
|
|
|
|
|
|
|
--初始化组件(用于子类重写)
|
|
|
|
function FightLevelTrialPanel:InitComponent()
|
2021-07-14 11:33:33 +08:00
|
|
|
self.spLoader = SpriteLoader.New()
|
|
|
|
self.UpView = SubUIManager.Open(SubUIConfig.UpView, self.transform)
|
2021-07-14 11:30:09 +08:00
|
|
|
self.btnBack = Util.GetGameObject(self.gameObject,"BackBtn")
|
2021-07-14 11:33:33 +08:00
|
|
|
self.nextStar = Util.GetGameObject(self.gameObject,"bg/text/num"):GetComponent("Text")
|
|
|
|
self.curStar = Util.GetGameObject(self.gameObject,"goBtn/num"):GetComponent("Text")
|
|
|
|
self.Scroll = Util.GetGameObject(self.gameObject,"Scroll")
|
|
|
|
self.leftTime = Util.GetGameObject(self.gameObject,"LeftTime"):GetComponent("Text")
|
|
|
|
self.itemPre = Util.GetGameObject(self.gameObject,"itemPre")
|
|
|
|
self.goBtn = Util.GetGameObject(self.gameObject,"goBtn")
|
|
|
|
|
|
|
|
self.helpBtn = Util.GetGameObject(self.gameObject, "helpBtn")
|
|
|
|
self.helpPosition = self.helpBtn:GetComponent("RectTransform").localPosition
|
|
|
|
|
|
|
|
local rootHight = self.Scroll.transform.rect.height
|
|
|
|
local width = self.Scroll.transform.rect.width
|
|
|
|
self.ScrollView = SubUIManager.Open(SubUIConfig.ScrollCycleView, self.Scroll.transform,
|
|
|
|
self.itemPre, nil, Vector2.New(width, rootHight), 1, 1, Vector2.New(0, 0))
|
|
|
|
self.ScrollView.moveTween.MomentumAmount = 1
|
|
|
|
self.ScrollView.moveTween.Strength = 2
|
2021-07-14 11:30:09 +08:00
|
|
|
end
|
|
|
|
|
|
|
|
--绑定事件(用于子类重写)
|
|
|
|
function FightLevelTrialPanel:BindEvent()
|
|
|
|
Util.AddClick(self.btnBack, function()
|
|
|
|
self:ClosePanel()
|
|
|
|
end)
|
2021-07-14 11:33:33 +08:00
|
|
|
|
|
|
|
Util.AddClick(self.goBtn, function()
|
|
|
|
UIManager.OpenPanel(UIName.FightLevelChapterPanel)
|
|
|
|
end)
|
|
|
|
|
|
|
|
Util.AddClick(self.helpBtn, function()
|
|
|
|
UIManager.OpenPanel(UIName.HelpPopup, HELP_TYPE.Practice, self.helpPosition.x,self.helpPosition.y)
|
|
|
|
end)
|
2021-07-14 11:30:09 +08:00
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
--添加事件监听(用于子类重写)
|
|
|
|
function FightLevelTrialPanel:AddListener()
|
|
|
|
end
|
|
|
|
|
|
|
|
--移除事件监听(用于子类重写)
|
|
|
|
function FightLevelTrialPanel:RemoveListener()
|
|
|
|
end
|
|
|
|
|
|
|
|
--界面打开时调用(用于子类重写)
|
|
|
|
function FightLevelTrialPanel:OnOpen()
|
|
|
|
end
|
|
|
|
|
|
|
|
--界面打开或者重新打开后,界面刷新时调用(用于子类重写)
|
|
|
|
function FightLevelTrialPanel:OnShow()
|
|
|
|
FightLevelTrialPanel:Refresh()
|
|
|
|
end
|
|
|
|
|
|
|
|
function FightLevelTrialPanel:Refresh()
|
2021-07-14 11:33:33 +08:00
|
|
|
self.actData = CommonActPageManager.GetData(ActivityTypeDef.ShanHeShiLian)
|
2021-07-14 11:30:09 +08:00
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
--界面关闭时调用(用于子类重写)
|
|
|
|
function FightLevelTrialPanel:OnClose()
|
|
|
|
if self.timer then
|
|
|
|
self.timer:Stop()
|
|
|
|
self.timer = nil
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
--界面销毁时调用(用于子类重写)
|
|
|
|
function FightLevelTrialPanel:OnDestroy()
|
|
|
|
if self.timer then
|
|
|
|
self.timer:Stop()
|
|
|
|
self.timer = nil
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
return FightLevelTrialPanel
|