diff --git a/Assets/ManagedResources/~Lua/Modules/Recruit/SingleRecruitPanel.lua b/Assets/ManagedResources/~Lua/Modules/Recruit/SingleRecruitPanel.lua index 14aa100aab..f4bc8ee4b4 100644 --- a/Assets/ManagedResources/~Lua/Modules/Recruit/SingleRecruitPanel.lua +++ b/Assets/ManagedResources/~Lua/Modules/Recruit/SingleRecruitPanel.lua @@ -28,6 +28,10 @@ local func=nil this.time = Timer.New() this.time2 = Timer.New() this.time3 = Timer.New() +local Sound_Recruit2 +local Sound_Recruit3 +local Sound_Recruit4 + --初始化组件(用于子类重写) function SingleRecruitPanel:InitComponent() this.spLoader = SpriteLoader.New() @@ -150,6 +154,7 @@ function SingleRecruitPanel:BindEvent() UIManager.OpenPanel(UIName.TenRecruitPanel,heroData,type,recruitType) end this.jumpBtnGo:SetActive(false) + this.StopPanelSound() end) --确定按钮 Util.AddClick(self.goBtn,function() @@ -200,7 +205,7 @@ end --界面打开时调用(用于子类重写) function SingleRecruitPanel:OnOpen(...) this.UI_Effect_open:SetActive(true) - SoundManager.PlaySound(SoundConfig.Sound_Recruit4) + Sound_Recruit4 = SoundManager.PlaySound(SoundConfig.Sound_Recruit4) this.UI_Effect_choukaSSR:SetActive(false) this.UI_Effect_choukaSR:SetActive(false) this.UI_Effect_choukaR:SetActive(false) @@ -290,7 +295,7 @@ function SingleRecruitPanel:TenOpenPanel() this.UI_Effect_choukaSR:SetActive(false) this.UI_Effect_choukaR:SetActive(false) this.UI_Effect_appear:SetActive(true) - SoundManager.PlaySound(SoundConfig.Sound_Recruit2) + Sound_Recruit2 = SoundManager.PlaySound(SoundConfig.Sound_Recruit2) end, timeNum) this.time:Start() this.time3 = Timer.New(function () @@ -326,7 +331,7 @@ function SingleRecruitPanel:UpdataPanelData(_heroData) Game.GlobalEvent:DispatchEvent(GameEvent.UI.OnUpdateData, self.uiConfig.id) this.jumpBtnGo:SetActive(false) this.UI_Effect_appear:SetActive(false) - SoundManager.PlaySound(SoundConfig.Sound_Recruit3) + Sound_Recruit3 = SoundManager.PlaySound(SoundConfig.Sound_Recruit3) if heroStaticData and testLiveGO then poolManager:UnLoadLive(GetResourcePath(heroStaticData.Live), testLiveGO) @@ -446,8 +451,22 @@ function SingleRecruitPanel:OnClose() poolManager:UnLoadLive(GetResourcePath(heroStaticData.Live), testLiveGO) end heroStaticData, testLiveGO = nil, nil + this.StopPanelSound() +end +function this.StopPanelSound() + if Sound_Recruit2 then + SoundManager.StopSound(Sound_Recruit2) + Sound_Recruit2 = nil + end + if Sound_Recruit3 then + SoundManager.StopSound(Sound_Recruit3) + Sound_Recruit3 = nil + end + if Sound_Recruit4 then + SoundManager.StopSound(Sound_Recruit4) + Sound_Recruit4 = nil + end end - function SingleRecruitPanel:GetProStr(index) local proStr="" if index==1 then