local UIGoldenHeroBossFind = UIViewClass() local UpdateRepeatGapTime = 0.1 local ShowWaitTime = 0.8 local AnimationTime = 0.5 --移动的时间 local AnimationShortTime = 0.4 --移动的时间 local FinishEffectTime = 0.5 local TotalWaitTime = ShowWaitTime + AnimationTime + FinishEffectTime function UIGoldenHeroBossFind:OnOpened(context) if UIManager.IsViewOpened(Const_UI_Lua.UIEnum.UIGoldenHeroBossPurchase) then AnimationTime = AnimationShortTime end CTL.Sound.PlayGameSound("UI_buildarmy") local killerName = context.killerName local heroType = MDL.GoldenHeroMain.GetHeroTypeByActivityId(context.activityId) local bossData = DataSheetManager.GoldHeroSynergyBossData[heroType]:GetDataByID(context.bossConfigId) UIUtils.SetLabelText(self.txt_BossName, Const_IDS[bossData.BossName]) UIUtils.SetLabelText(self.lab_BossFind, Const_IDS.IDS_GoldHeroActivity_SynergyBoss_AppearHint) CTL.GoldenHeroBoss.ShowBossStar(self.group_Star, bossData.BossStar) UIUtils.SetImageByAssetBundle(self.img_Boss, bossData.Picture) self.state_BossFind:SetState(killerName and 1 or 0) if killerName then self.isKill = true self.txt_KillerName.text = killerName self.effect_KillIcon:PlayUIEffect() else self.effect_Title:PlayUIEffect() self:StartRepeatFunc(self.OnUpdate, UpdateRepeatGapTime, -1) end end function UIGoldenHeroBossFind:OnUpdate(deltaTime, timeSinceUpdate) if timeSinceUpdate > TotalWaitTime then self:StopRepeatFunc(self.OnUpdate) self:CloseView() elseif timeSinceUpdate > AnimationTime + ShowWaitTime then if UIManager.IsViewOpened(Const_UI_Lua.UIEnum.UIGoldenHeroBossPurchase) then self:StopRepeatFunc(self.OnUpdate) self:CloseView() else if not self.playEffect then self.effect_AnimFinish:PlayUIEffect() self.playEffect = true end end elseif timeSinceUpdate > ShowWaitTime then if not self.moveAnim then if UIManager.IsViewOpened(Const_UI_Lua.UIEnum.UIGoldenHeroBossPurchase) then self:PlayUIAnimation("AniShortDisappear") self.moveAnim = true else self:PlayMoveAnimation() end end end end function UIGoldenHeroBossFind:PlayMoveAnimation() self.target = CTL.GoldenHeroStory.GetStoryViewBossButtonNode() if self.target == nil then return end local mainTf = self.group_Main.transform local oriParent = mainTf.parent local effectTf = self.effect_AnimFinish.transform local effectOriParent = effectTf.parent self.effect_AnimFinish.transform:SetParent(self.target.transform, false) self.effect_AnimFinish.transform:SetParent(effectOriParent, true) mainTf:SetParent(self.target.transform, false) mainTf:SetParent(oriParent, true) local targetX, targetY = mainTf:GetLocalPosition() mainTf:SetAnchoredPosition(0, 0) self:PlayUIAnimation("AniDisappear") self.moveAnim = self:MoveToPos(mainTf, targetX, targetY, AnimationTime, false) end function UIGoldenHeroBossFind:OnButtonClicked(comp) if comp == self.btn_Bottom and self.isKill then self:CloseView() end end return UIGoldenHeroBossFind