miduo_client/Assets/ManagedResources/~Lua/Modules/Popup/UnlockCheckpointPopup.lua

114 lines
4.0 KiB
Lua
Raw Normal View History

2021-04-21 13:12:04 +08:00
require("Base/BasePanel")
2020-05-09 13:31:21 +08:00
--解锁关卡弹窗
UnlockCheckpointPopup = Inherit(BasePanel)
local this=UnlockCheckpointPopup
local fightLevelConfig = ConfigManager.GetConfig(ConfigName.MainLevelSettingConfig)
local callBack = nil
local configID
local EffectOrginLayer = 0
local curChapterId = 0
--初始化组件(用于子类重写)
function UnlockCheckpointPopup:InitComponent()
2021-04-21 13:12:04 +08:00
this.spLoader = SpriteLoader.New()
2020-05-09 13:31:21 +08:00
EffectOrginLayer = 0
this.infoText=Util.GetGameObject(self.transform,"UI_effect_UnlockCheckpoint/banzi/InfoText"):GetComponent("Text")
this.checkImage=Util.GetGameObject(self.transform,"UI_effect_UnlockCheckpoint/banzi/Checkpoint/Checkpoint"):GetComponent("Image")
this.checkDiffImage=Util.GetGameObject(self.transform,"UI_effect_UnlockCheckpoint/banzi/Image/nandu"):GetComponent("Image")
this.closeBtn=Util.GetGameObject(self.transform,"CloseBtn")
this.btnGo=Util.GetGameObject(self.transform,"btnGo")
this.effect_qian = Util.GetGameObject(self.transform,"UI_effect_UnlockCheckpoint/effect_qian")
effectAdapte(Util.GetGameObject(this.effect_qian, "ziti mask"))
end
--绑定事件(用于子类重写)
function UnlockCheckpointPopup:BindEvent()
Util.AddClick(this.closeBtn, function()
self:ClosePanel()
2021-06-10 22:59:26 +08:00
if UIManager.IsOpen(UIName.FightPointPassMainPanel) then
UIManager.ClosePanel(UIName.FightPointPassMainPanel)
end
-- 章节解锁时添加对话
StoryManager.EventTrigger(curChapterId, function()
LogGreen("打开挂机界面")
UIManager.OpenPanel(UIName.FightPointPassMainPanel)
2020-05-09 13:31:21 +08:00
end)
end)
Util.AddClick(this.btnGo, function()
self:ClosePanel()
if UIManager.IsOpen(UIName.FightPointPassMainPanel) then
UIManager.ClosePanel(UIName.FightPointPassMainPanel)
end
-- 章节解锁时添加对话
StoryManager.EventTrigger(curChapterId, function()
LogGreen("打开挂机界面")
UIManager.OpenPanel(UIName.FightPointPassMainPanel)
2020-05-09 13:31:21 +08:00
end)
end)
end
--添加事件监听(用于子类重写)
function UnlockCheckpointPopup:AddListener()
end
--移除事件监听(用于子类重写)
function UnlockCheckpointPopup:RemoveListener()
end
--界面打开时调用(用于子类重写)
function UnlockCheckpointPopup:OnOpen(_configID,_callBack)
-- 解锁新章节音效
PlaySoundWithoutClick(SoundConfig.Sound_UnlockLevel)
2020-05-09 13:31:21 +08:00
configID = _configID
callBack = _callBack
local chapterId = math.floor(FightPointPassManager.lastPassFightId / 1000)
curChapterId = fightLevelConfig[chapterId].EventId
end
function UnlockCheckpointPopup:OnSortingOrderChange()
Util.AddParticleSortLayer(this.effect_qian, self.sortingOrder - EffectOrginLayer)
EffectOrginLayer = self.sortingOrder
end
--界面打开或者重新打开后,界面刷新时调用(用于子类重写)
function UnlockCheckpointPopup:OnShow()
local areaId=math.floor(configID/1000)
local diff = configID%10
local LevelSettingConFig = ConfigManager.GetConfigData(ConfigName.MainLevelSettingConfig,areaId)
if LevelSettingConFig then
2021-04-21 13:12:04 +08:00
this.checkImage.sprite = this.spLoader:LoadSprite(LevelSettingConFig.ChapterBg)
2020-05-09 13:31:21 +08:00
this.checkImage:SetNativeSize()
2021-04-21 13:12:04 +08:00
this.checkDiffImage.sprite = this.spLoader:LoadSprite(FightDifficultyStateZiSp[diff])
2021-01-26 17:08:39 +08:00
local str = GetLanguageStrById(LevelSettingConFig.Name).."·"..NumToComplexFont[areaId]
2020-05-09 13:31:21 +08:00
this.infoText.text = str--string.gsub(str,"-","\n-\n")
end
if UIManager.IsOpen(UIName.BattlePanel) then
this.btnGo:SetActive(false)
else
this.btnGo:SetActive(true)
end
end
--界面关闭时调用(用于子类重写)
function UnlockCheckpointPopup:OnClose()
FightManager.isOpenLevelPat = false
if callBack then
callBack()
end
callBack = nil
end
--界面销毁时调用(用于子类重写)
function UnlockCheckpointPopup:OnDestroy()
2021-04-21 13:12:04 +08:00
this.spLoader:Destroy()
2020-05-09 13:31:21 +08:00
end
2020-06-23 18:36:24 +08:00
return UnlockCheckpointPopup