--- 本脚本用途 :展示通用战斗的一些显示信息 (本脚本中无任何按钮可按) ---这个脚本是对 UIBattleAttackPanel的补充 。防止 UIBattleAttackPanel 被无限加内容,变的很复杂 --- local UIBattleExtraInfoPanel = UIViewClass() local EventSystem = require('Event/EventSystem') local Const_DevelopEffectTipsMaxCount = 4 local Const_HideTimer = 3 -- DevelopEffectTips 持续时间 local Const_WaitDevelopEffectTipsTimer = 0.5 -- 新DevelopEffectTips多久出来 function UIBattleExtraInfoPanel:OnOpened(context) self.developEffectTipsList = {} self:RegistSystemEvent(EventID.UIBattle_DevelopEffect_Tips, self.OnShowDevelopEffectTips) self:StartRepeatFunc(self.OnUpdateFun, 0) self.group_DevelopSkillTips.gameObject:SetActive(false) for i=1,#self.group_DevelopSkillTips do self.group_DevelopSkillTips[i].gameObject:SetActive(false) end end function UIBattleExtraInfoPanel:OnUpdateFun(deltaTime, timeSinceUpdate) self:UpdateDevelopSkillTips(deltaTime, timeSinceUpdate) end ---------------- 系统获取的特殊功能的提示 ↓ ↓ ↓----------- function UIBattleExtraInfoPanel:OnShowDevelopEffectTips(entity, developEffectBuffTipsID) if not entity:IsPlayerSelf() then -- 只要是我上场的主将就能弹出tips return end local configData = DataSheetManager.DevelopEffectBuffTips:GetDataByID(developEffectBuffTipsID) local info = {icon = configData.Icon, ids = configData.Name, timer = Const_HideTimer} table.insert(self.developEffectTipsList, 1, info) if #self.developEffectTipsList > Const_DevelopEffectTipsMaxCount then table.remove(self.developEffectTipsList) end self:RefreshDevelopEffectTips() end function UIBattleExtraInfoPanel:RefreshDevelopEffectTips() local count = #self.developEffectTipsList if count < 1 then return end self.group_DevelopSkillTips.gameObject:SetActive(true) for i = 2, count do self:OnCellInit(self.group_DevelopSkillTips[i],self.developEffectTipsList[i]) end self:PlayFirstDevelopSkillTips() end function UIBattleExtraInfoPanel:PlayFirstDevelopSkillTips() self:OnCellInit(self.group_DevelopSkillTips[1],self.developEffectTipsList[1]) self.group_DevelopSkillTips[1].effect_Trigger:PlayUIEffect() end function UIBattleExtraInfoPanel:OnCellInit(cellTable,data) UIUtils.SetImageByAssetBundle(cellTable.img_SkillIcon, data.icon) UIUtils.SetLabelText(cellTable.txt_SkillName, Const_IDS[data.ids]) cellTable.gameObject:SetActive(true) cellTable.ani_Info:PlayAnim() end function UIBattleExtraInfoPanel:UpdateDevelopSkillTips(deltaTime, timeSinceUpdate) local count = #self.developEffectTipsList if count > 0 then for i = count,1,-1 do local info = self.developEffectTipsList[i] info.timer = info.timer - deltaTime if info.timer <= 0 then table.remove(self.developEffectTipsList) self.group_DevelopSkillTips[i].gameObject:SetActive(false) end end end end ---------------- 系统获取的特殊功能的提示 ↑ ↑ ↑----------- return UIBattleExtraInfoPanel