local UIHeroLightEffectPanel = UIViewClass() local EventSystem = require('Event/EventSystem') local AttrTypeId = { HP = 1, Atk = 2, Defense = 3, } local LightEffectTypeIDS = { [1] = "IDS_LightEffect_Type1", [2] = "IDS_LightEffect_Type2", [3] = "IDS_LightEffect_Type3", [4] = "IDS_LightEffectPictorial_Set", [5] = "IDS_LightEffect_Type4", } local maxWearLightEffectCount = DataSheetManager.ConstData:GetDataByID("MaxPerLightEffect").IntValue local LvBu_LightEffect_FaXiang_ID = 204001 local TabType = { MDL.LightEffect.LightEffectType.Encircle, MDL.LightEffect.LightEffectType.Foot, MDL.LightEffect.LightEffectType.Backside, MDL.LightEffect.LightEffectType.Suit, MDL.LightEffect.LightEffectType.Atmosphere, } function UIHeroLightEffectPanel:OnOpened(context) self:RegistSystemEvent(EventID.UI_LightEffect_Refresh, self.RefreshLightEffectList) self:RegistSystemEvent(EventID.UI_LightEffect_ResetLightEffect, self.RefreshLightEffect) self.init = false self.curSelectedLightId = context.lightEffectID or 0 -- 当前选中的光效id (lightEffectID 应该不能传套装id) context.lightEffectID = nil self.curSelectedTabIndex = -1 -- 当前选中的TabIndex (默认值为-1,当为-1时,curSelectedLightId>0, 说明有默认选中光效) self.curSelectedLightCellIndex = 0 -- 当前选中的光效cellIndex self.heroId = MDL.HeroSelect.curSelectHeroID self:RefreshLightEffectList() UIUtils.SetActive(self.group_Detail, self.curSelectedLightId ~= 0) UIUtils.SetActive(self.group_Btn, self.curSelectedLightId ~=0) self.lab_BelongToTip:SetText("") end function UIHeroLightEffectPanel:RefreshLightEffectList() self.activateLightEffectInfoDic = MDL.LightEffect.GetHeroActivateLightEffectInfo(self.heroId) self.wearLightEffectInfoDic = MDL.LightEffect.GetHeroWearLightEffectIDDic(self.heroId) self.stateList = {} if self.activateLightEffectInfoDic and next(self.activateLightEffectInfoDic) then for _,lightEffectType in pairs(self.activateLightEffectInfoDic) do for _,lightEffectId in ipairs(lightEffectType) do self.stateList[lightEffectId] = MDL.LightEffect.StateType.Activate for _,wearLightEffectID in pairs(self.wearLightEffectInfoDic) do if wearLightEffectID == lightEffectId then self.stateList[lightEffectId] = MDL.LightEffect.StateType.Wear end end end end end self.sortedEffectList = {} for i, v in DataSheetManager.LightEffect:GetEnumerator() do if next(v.BelongTo) then if table.containValue(v.BelongTo,self.heroId) then if not self.sortedEffectList[v.Type] then self.sortedEffectList[v.Type] = {} end local isWearing = self.wearLightEffectInfoDic and self.wearLightEffectInfoDic[v.Type] == v.ID or false table.insert(self.sortedEffectList[v.Type], {lightEffectCfg = v, heroId = self.heroId, isWearing = isWearing}) end else if not self.sortedEffectList[v.Type] then self.sortedEffectList[v.Type] = {} end local isWearing = self.wearLightEffectInfoDic and self.wearLightEffectInfoDic[v.Type] == v.ID or false table.insert(self.sortedEffectList[v.Type], {lightEffectCfg = v, heroId = self.heroId, isWearing = isWearing}) end end for _, value in pairs(self.sortedEffectList) do table.sort(value, MDL.LightEffect.SortEffectRule) end local effectSuitType = MDL.LightEffect.LightEffectType.Suit for i, v in DataSheetManager.LightEffectSuit:GetEnumerator() do if not self.sortedEffectList[effectSuitType] then self.sortedEffectList[effectSuitType] = {} end local suitData = { isEffectSuit = true, isActivate = MDL.LightEffect.GetHeroLightEffectSuitActivation(self.heroId, v.ID), effectSuitInfo = v, heroId = self.heroId} table.insert(self.sortedEffectList[effectSuitType], suitData) end table.sort(self.sortedEffectList[effectSuitType], MDL.LightEffect.SortEffectSuitRule) self:RefreshLoopEffectData() self.loop_Effect:RefreshCells() self.loop_title:RefreshCells(false) end -- 刷新光效列表数据 function UIHeroLightEffectPanel:RefreshLoopEffectData() if not self.init then self.tabTypeTable = {} self.tabList = {} local index = 0 for i, v in ipairs(TabType) do if self.sortedEffectList[v] then table.insert(self.tabTypeTable, v) self.loop_title:AddData({ids = LightEffectTypeIDS[i], effectType = v, index= i},0) self.tabList[v] = index index = index + 1 end end self.init = true end --当无选中的光效、或在套装页签时,发生数据变化刷新时,选择第一个页签 if self.curSelectedLightId == 0 or self.curSelectedTabIndex == 2 then self.loop_title:SelectIndex(0) return end for effectType, effectList in pairs(self.sortedEffectList) do for index, effect in ipairs(effectList) do if effectType ~= MDL.LightEffect.LightEffectType.Suit then if self.curSelectedLightId == effect.lightEffectCfg.ID then self:LocateEffect(effectType, index) return end end end end end function UIHeroLightEffectPanel:LocateEffect(effectType, index) self.curSelectedTabIndex = self.tabList[effectType] self.curSelectedLightCellIndex = index - 1 self.loop_title:SelectIndex(self.curSelectedTabIndex) end function UIHeroLightEffectPanel:OnClosed() self.curSelectedLightId = 0 EventSystem.Dispatch(EventID.UI_LightEffect_ChangePreviewLightEffect, 0) end function UIHeroLightEffectPanel:RefreshLightEffect() EventSystem.Dispatch(EventID.UI_LightEffect_ChangePreviewLightEffect, 0) end function UIHeroLightEffectPanel:OnCellInit(scrollRect, index, cellTable, data) if scrollRect == self.loop_Effect then if data.isEffectSuit then self:InitSuitCell(cellTable, data) else self:InitLightEffectCell(cellTable, data.lightEffectCfg) end elseif scrollRect == self.loop_title then UIUtils.SetLabelText(cellTable.txt_Title, Const_IDS[data.ids]) local redPoint = CTL.LightEffect.IsShowLightEffectRedPointByType(self.heroId, data.effectType) UIUtils.SetActive(cellTable.img_RedPoint1, redPoint) UIUtils.SetActive(cellTable.img_RedPoint2, redPoint) cellTable.state_icon:SetState(data.index - 1) UIUtils.SetActive(cellTable.group_Selected, self.curSelectedTabIndex == index) UIUtils.SetActive(cellTable.group_Select, self.curSelectedTabIndex ~= index) end end function UIHeroLightEffectPanel:InitSuitCell(cellTable, data) -- 光效套装显示 UIUtils.SetActive(cellTable.group_Item, false) UIUtils.SetActive(cellTable.group_SuitItem, true) UIUtils.SetActive(cellTable.group_Txt_Suit, true) UIUtils.SetActive(cellTable.group_Txt, false) -- 设置套装光效名称描述以及立绘 UIUtils.SetLabelText(cellTable.txt_SuitName, Const_IDS[data.effectSuitInfo.LightEffectSetName]) local leftEffectID = data.effectSuitInfo.LightEffectList[1] local rightEffectID = data.effectSuitInfo.LightEffectList[2] UIUtils.SetActive(cellTable.img_Lock02, not MDL.LightEffect.IsActivateByHeroID_LightEffectID(self.heroId, rightEffectID)) UIUtils.SetActive(cellTable.img_Lock01, not MDL.LightEffect.IsActivateByHeroID_LightEffectID(self.heroId, leftEffectID)) local effectNames = UTL.Item.GetItemColorName(leftEffectID) .. " " .. UTL.Item.GetItemColorName(rightEffectID) UIUtils.SetLabel(cellTable.txt_SuitEffectName, effectNames) UIUtils.SetLabelText(cellTable.txt_EffectDesc, Const_IDS[data.effectSuitInfo.LightEffectSetDesc]) local leftItemCfg = DataSheetManager.ItemData:GetDataByID(leftEffectID) UTL.Color.SetQualityImageByType(cellTable.img_BgFrame01, leftItemCfg.Color, UTL.Color.QualityType.Square) local leftEffectData = DataSheetManager.LightEffect:GetDataByID(leftEffectID) UTL.Item.ItemIconWithoutBg(cellTable.img_EffectIcon01, leftEffectData.Activation) UTL.Item.ItemIconWithoutBg(cellTable.img_EffectIcon02, leftEffectID) local rightItemCfg = DataSheetManager.ItemData:GetDataByID(rightEffectID) UTL.Color.SetQualityImageByType(cellTable.img_BgFrame02, rightItemCfg.Color, UTL.Color.QualityType.Square) local rightEffectData = DataSheetManager.LightEffect:GetDataByID(rightEffectID) if rightEffectData.Activation > 0 then UTL.Item.ItemIconWithoutBg(cellTable.img_EffectIcon02, rightEffectData.Activation) elseif #rightEffectData.ActivationSkin then UTL.Item.ItemIconWithoutBg(cellTable.img_EffectIcon02, rightEffectID) end cellTable.state_Right:SetState(1) UIUtils.SetActive(cellTable.img_RedPoint, false) end function UIHeroLightEffectPanel:InitLightEffectCell(cellTable, data) UIUtils.SetActive(cellTable.group_Item, true) UIUtils.SetActive(cellTable.group_SuitItem, false) UIUtils.SetActive(cellTable.group_Txt_Suit, false) UIUtils.SetActive(cellTable.group_Txt, true) local state = self.stateList[data.ID] and self.stateList[data.ID] or MDL.LightEffect.StateType.Lock local itemCfg = DataSheetManager.ItemData:GetDataByID(data.ID) local itemNameAndDesc = UTL.Item.GetItemDataSpliceByType(data.ID) local colorName = UTL.Color.FormatQualityText(itemNameAndDesc.Name, itemCfg.Color) UIUtils.SetLabel(cellTable.txt_EffectName, colorName) -- 吕布法相特殊处理 local desc = data.ID == MDL.HeroSelect.LvBuFaXiangId and Const_IDS["IDS_LightEffect_ZaiE"] or Const_IDS[itemCfg.Des] UIUtils.SetLabelText(cellTable.txt_EffectDesc, desc) --道具底色 UTL.Color.SetQualityImageByType(cellTable.img_BgFrame, itemCfg.Color, UTL.Color.QualityType.Square) if data.Activation > 0 then UTL.Item.ItemIconWithoutBg(cellTable.img_EffectIcon, data.Activation) -- 特效立绘 elseif #data.ActivationSkin > 0 then --皮肤激活的特效 UTL.Item.ItemIconWithoutBg(cellTable.img_EffectIcon, data.ID) -- 特效立绘 end -- 品质特效 cellTable.effect_LightEffect:StopUIEffect() UTL.Color.PlayQualityEffect(cellTable.effect_LightEffect, data.ID, UTL.Color.EffectType.Item) UIUtils.SetActive(cellTable.img_Lock, state == MDL.LightEffect.StateType.Lock) local state = self.stateList[data.ID] and self.stateList[data.ID] or MDL.LightEffect.StateType.Lock local showRedPoint if MDL.HeroSelect.IsHasHero(self.heroId) then showRedPoint = state == MDL.LightEffect.StateType.Lock and CTL.LightEffect.CheckIsActive(data) else showRedPoint = false end UIUtils.SetActive(cellTable.img_RedPoint, showRedPoint) cellTable.state_Right:SetState(state == MDL.LightEffect.StateType.Wear and 0 or 1) -- 已穿戴 --时装专属外观 UIUtils.SetActive(cellTable.group_Exclusive, table.containValue(data.BelongTo, self.heroId)) if GameAppInfo.IsVietnamPackage() then UIUtils.SetLabelText(cellTable.lab_Exclusive, Const_IDS["IDS_LightEffect_ZhuanShu"]) else if data.AppearanceBelongTo > 0 then UIUtils.SetLabelText(cellTable.lab_Exclusive, Const_IDS["IDS_LightEffect_AppearanceBelongTo"]) else UIUtils.SetLabelText(cellTable.lab_Exclusive, Const_IDS["IDS_LightEffect_ZhuanShu"]) end end if data.time and data.time > 0 and (state == MDL.LightEffect.StateType.Activate or state == MDL.LightEffect.StateType.Wear) then UIUtils.SetLabelText(cellTable.lab_TimeLimit, Const_IDS.IDS_LightEffect_Time_1) UIUtils.SetActive(self.btn_Reset, false) else cellTable.lab_TimeLimit.text = nil end end function UIHeroLightEffectPanel:OnCellSelect(scrollRect, index, cellTable, data) if scrollRect == self.loop_Effect then if data.isEffectSuit then self.curSelectLightEffectData = data --套装信息 self:RefreshSuitInfo() self.curSelectedLightId = data.effectSuitInfo.ID EventSystem.Dispatch(EventID.UI_LightEffect_ChangePreviewLightEffect, data.effectSuitInfo.LightEffectList) else self.curSelectLightEffectData = data.lightEffectCfg if self.curSelectedLightId ~= data.lightEffectCfg.ID then EventSystem.Dispatch(EventID.UI_LightEffect_ChangePreviewLightEffect, data.lightEffectCfg.ID) end self.curSelectedLightId = data.lightEffectCfg.ID --光效信息 self:RefreshLightEffectInfo() EventSystem.Dispatch(EventID.UI_LightEffect_ChangePreviewLightEffect, self.curSelectedLightId) end self.curSelectedLightCellIndex = index elseif scrollRect == self.loop_title then local effectType = self.tabTypeTable[index+1] local effectInfos = self.sortedEffectList[effectType] --多行多列的列表:ReloadAll并定位会有问题,所以此处采用了先Clear再Add if self.loop_Effect.Count > 0 then self.loop_Effect:ClearCells() end for _, value in ipairs(effectInfos) do self.loop_Effect:AddData(value,0) end UIUtils.SetActive(self.group_Detail, false) UIUtils.SetActive(self.group_Btn, false) if self.curSelectedTabIndex ~= index then self.curSelectedTabIndex = index self.curSelectedLightCellIndex = 0 self.loop_Effect:SelectIndex(self.curSelectedLightCellIndex, true) return end self.curSelectedTabIndex = index if self.curSelectedLightId > 0 then if effectType ~= MDL.LightEffect.LightEffectType.Suit then for _, v in ipairs(effectInfos) do if v.lightEffectCfg.ID and v.lightEffectCfg.ID == self.curSelectedLightId then self.loop_Effect:SelectIndex(self.curSelectedLightCellIndex, true) return end end end end end end function UIHeroLightEffectPanel:RefreshLightEffectInfo() UIUtils.SetActive(self.group_Detail, self.curSelectedLightId ~= 0) UIUtils.SetActive(self.group_Btn, self.curSelectedLightId ~=0) self:RefreshLightBasicInfo() self:RefreshBtnStatus() self:RefreshTimeLimit() end function UIHeroLightEffectPanel:RefreshLightBasicInfo() local data = self.curSelectLightEffectData local state = self.stateList[data.ID] and self.stateList[data.ID] or MDL.LightEffect.StateType.Lock if data.Activation > 0 then UIUtils.SetActive(self.group_Info,true) UIUtils.SetActive(self.group_Info02,false) UIUtils.SetActive(self.item.gameObject,true) UIUtils.SetActive(self.group02, false) -- 带技能描述 if data.DevelopEffectID > 0 then local _,desc = CTL.Appearance.GetSpecialBuffDes(data.DevelopEffectID) UIUtils.SetActive(self.lab_Title01,true) UIUtils.SetActive(self.txt_SkillInfoLightEffect,true) UIUtils.SetLabelText(self.lab_Title01, Const_IDS.IDS_LightEffect_Skill_Title) UIUtils.SetLabel(self.txt_SkillInfoLightEffect,desc) else UIUtils.SetActive(self.lab_Title01,false) UIUtils.SetActive(self.txt_SkillInfoLightEffect,false) end -- 激活加成属性 self.state_Attr:SetState(0) for k,v in ipairs(data.Attr_Table) do if v.AttrType == AttrTypeId.HP then UIUtils.SetLabel(self.cell_Hp.txt_Hp1, "+"..v.AttrNum) elseif v.AttrType == AttrTypeId.Atk then UIUtils.SetLabel(self.cell_Atk.txt_Atk1, "+"..v.AttrNum) elseif v.AttrType == AttrTypeId.Defense then UIUtils.SetLabel(self.cell_Defense.txt_Defense1, "+"..v.AttrNum) end end if state == MDL.LightEffect.StateType.Lock then -- 激活道具 local activationCount = 0 if MDL.Bag.GetItemCount(data.Activation) > 0 then activationCount = UTL.Color.FormatGreenColor(MDL.Bag.GetItemCount(data.Activation)).."/"..1 else activationCount = UTL.Color.FormatRedColor(MDL.Bag.GetItemCount(data.Activation)).."/"..1 end UTL.Item.SetItemCell(self.item, data.Activation, activationCount) -- 品质特效 self.item.effect_ItemExtra:StopUIEffect() UTL.Color.PlayQualityEffect(self.item.effect_ItemExtra, data.Activation, UTL.Color.EffectType.Item) end elseif #data.ActivationSkin > 0 then --激活皮肤显示 UIUtils.SetActive(self.group_Info,false) UIUtils.SetActive(self.group_Info02,true) UIUtils.SetActive(self.item.gameObject,false) --技能信息 local _,desc = CTL.Appearance.GetSpecialBuffDes(data.DevelopEffectID) UIUtils.SetLabel(self.txt_SkillInfo,desc) --激活信息 UIUtils.SetLabel(self.txt_ActiveInfo,UIUtils.GetLocalizedTxt(Const_IDS[data.Describe])) end end function UIHeroLightEffectPanel:RefreshBtnStatus() local data = self.curSelectLightEffectData local state = self.stateList[data.ID] and self.stateList[data.ID] or MDL.LightEffect.StateType.Lock local showRedPoint if MDL.HeroSelect.IsHasHero(self.heroId) then showRedPoint = state == MDL.LightEffect.StateType.Lock and CTL.LightEffect.CheckIsActive(data) else showRedPoint = false end self.btn_Active:SetRedPoint(showRedPoint) self.state_Active:SetState(state == MDL.LightEffect.StateType.Lock and 0 or 1) self.state_btn:SetState(state == MDL.LightEffect.StateType.Wear and 1 or 0) if table.containValue(data.BelongTo, self.heroId) then self.state_btn:SetState(state == MDL.LightEffect.StateType.Wear and 3 or 2) else self.state_btn:SetState(state == MDL.LightEffect.StateType.Wear and 1 or 0) end --激活皮肤显示未激活时的UI if #data.ActivationSkin > 0 and data.Activation == 0 then if state == MDL.LightEffect.StateType.Lock then UIUtils.SetActive(self.btn_Active,false) UIUtils.SetActive(self.lab_NotActive,true) UIUtils.SetLabelText(self.lab_NotActive,Const_IDS.IDS_LightEffect_NotActive_Title) else UIUtils.SetActive(self.lab_NotActive,false) end else UIUtils.SetActive(self.lab_NotActive,false) end end --增加限时提示 function UIHeroLightEffectPanel:RefreshTimeLimit() local data = self.curSelectLightEffectData local state = self.stateList[data.ID] and self.stateList[data.ID] or MDL.LightEffect.StateType.Lock if self.curSelectLightEffectData.Time and self.curSelectLightEffectData.Time > 0 and (state == MDL.LightEffect.StateType.Activate or state == MDL.LightEffect.StateType.Wear) then UIUtils.SetActive(self.btn_Reset, false) local endTime = MDL.LightEffect.GetLightEffectEndTime(self.heroId, self.curSelectLightEffectData.ID) local nowTime = UTL.Time.GetServerTimestamp() if endTime > nowTime then self.txt_TimeLimit.text = string.FormatByIdsId(Const_IDS.IDS_HorseAppearance_Period, UTL.Time.FormatTimeForTitle(endTime - UTL.Time.GetServerTimestamp())) UIUtils.SetActive(self.txt_TimeLimit, true) else self.txt_TimeLimit.text = nil end else self.txt_TimeLimit.text = nil end end function UIHeroLightEffectPanel:RefreshSuitInfo() --套装都是永久,默认不显示时限。 UIUtils.SetActive(self.txt_TimeLimit, false) UIUtils.SetActive(self.group_Detail, true) UIUtils.SetActive(self.group_Btn, true) local data = self.curSelectLightEffectData UIUtils.SetActive(self.group_Info02, false) UIUtils.SetActive(self.lab_Title02, true) UIUtils.SetActive(self.group_Info, true) UIUtils.SetActive(self.group02, true) UIUtils.SetActive(self.item.gameObject, false) local leftEffectID = data.effectSuitInfo.LightEffectList[1] local rightEffectID = data.effectSuitInfo.LightEffectList[2] -- 设置激活条件 UIUtils.SetLabel(self.txt_SuitActiveInfo, string.FormatByIdsId(Const_IDS["IDS_LightEffectPictorial_Active3"], UTL.Item.GetItemColorName(leftEffectID), UTL.Item.GetItemColorName(rightEffectID))) -- 设置属性 self.state_Attr:SetState(0) for i, v in ipairs(data.effectSuitInfo.Attr_Table) do if v.AttrType == AttrTypeId.HP then UIUtils.SetLabel(self.cell_Hp.txt_Hp1, "+" .. v.AttrNum) elseif v.AttrType == AttrTypeId.Atk then UIUtils.SetLabel(self.cell_Atk.txt_Atk1, "+" .. v.AttrNum) elseif v.AttrType == AttrTypeId.Defense then UIUtils.SetLabel(self.cell_Defense.txt_Defense1, "+" .. v.AttrNum) end end self.state_Active:SetState(0) UIUtils.SetActive(self.btn_Active, false) UIUtils.SetActive(self.lab_NotActive, true) if data.isActivate then UIUtils.SetLabelText(self.lab_NotActive, Const_IDS.IDS_LightEffectPictorial_Active2) else UIUtils.SetLabelText(self.lab_NotActive, Const_IDS.IDS_LightEffectPictorial_Active1) end UIUtils.SetGray(self.lab_NotActive, data.isActivate) UIUtils.SetActive(self.lab_Title01,false) UIUtils.SetActive(self.txt_SkillInfoLightEffect,false) self.btn_Active:SetRedPoint(false) end function UIHeroLightEffectPanel:OnButtonClicked(comp) if comp == self.btn_ChangeHero then UIManager.OpenView(Const_UI_Lua.UIEnum.UIHeroLightEffectChange) elseif comp == self.item.event_Click then UTL.ItemTips.ShowCommonTipsById(self.curSelectLightEffectData.Activation) else self:OnClickLightEffectBtn(comp) end end function UIHeroLightEffectPanel:OnClickLightEffectBtn(comp) local data = self.curSelectLightEffectData if MDL.HeroSelect.IsHasHero(self.heroId) then if comp == self.btn_Equip then -- 装备 -- 先判断 时装专属光效 是否装备了相应的时装 if table.containValue(data.BelongTo, self.heroId) and data.AppearanceBelongTo > 0 then local info = MDL.Appearance.GetAppearanceDataByHeroID_AppearanceID(self.heroId, data.AppearanceBelongTo, MDL.Appearance.AppearanceType.Hero) if info and info.isActive == false then local appearanceData = MDL.Appearance.GetAppearanceDataByHeroID_AppearanceID(self.heroId, data.AppearanceBelongTo, MDL.Appearance.AppearanceType.Hero) local appearanceName = UIUtils.GetLocalizedTxt(Const_IDS[appearanceData.appearanceConfig.AppearanceName]) local itemCfg = DataSheetManager.ItemData:GetDataByID(data.ID) local colorName = UTL.Color.FormatQualityText(appearanceName, itemCfg.Color) CTL.Tips.AddTipsMsg(string.FormatByIdsId(Const_IDS["IDS_ERRORCODE_449822_InfoCode_FaXiang_UnlockSkin"]),colorName) return end end if self.wearLightEffectInfoDic then -- 同类型可替换 -- 小于最大穿戴数量 if (self.wearLightEffectInfoDic[data.Type] and self.wearLightEffectInfoDic[data.Type] ~= data.ID) or table.getDictCount(self.wearLightEffectInfoDic) < maxWearLightEffectCount then MDL.LightEffect.LightEffectOptRequest(MDL.LightEffect.OptType.PutOn, self.heroId, data.ID) elseif table.getDictCount(self.wearLightEffectInfoDic) >= maxWearLightEffectCount then -- 已经是最大穿戴数量了 CTL.Tips.AddTipsMsg(Const_IDS["IDS_LightEffect_ZhuangBeiShangXian"]) end else -- 还没穿戴光效 MDL.LightEffect.LightEffectOptRequest(MDL.LightEffect.OptType.PutOn, self.heroId, data.ID) end elseif comp == self.btn_Reset then -- 重置 UIManager.OpenView(Const_UI_Lua.UIEnum.UIHeroLightEffectResetPopUp, {lightEffectID = data.ID}) elseif comp == self.btn_PutDown then -- 卸下 MDL.LightEffect.LightEffectOptRequest(MDL.LightEffect.OptType.PutDown, self.heroId, data.ID) elseif comp == self.btn_Active then -- 激活 local state = self.stateList[data.ID] and self.stateList[data.ID] or MDL.LightEffect.StateType.Lock if state == MDL.LightEffect.StateType.Lock then if MDL.Bag.GetItemCount(data.Activation) > 0 then MDL.LightEffect.LightEffectOptRequest(MDL.LightEffect.OptType.Activate, self.heroId, data.ID) else CTL.Tips.AddTipsMsg(string.FormatByIdsId(Const_IDS["IDS_DrawCard_Tip_LackItem"], UTL.Item.GetItemDataSpliceByType(data.Activation).Name)) end end end else CTL.Tips.AddTipsMsg(Const_IDS.IDS_Hero_NotEngouh) end end return UIHeroLightEffectPanel