--[[ 神兽喂养升级界面(八卦图) ]]-- local UIGodBeastLevelUp = UIViewClass() local resonance_info = require 'Proto/resonance_info_pb' function UIGodBeastLevelUp:OnOpened(context) self:RegistSystemEvent(EventID.UI_GodBeastRefresh, self.RefreshPanel) self.config = context.config self:RefreshPanel() self.levelUpBtnLock = false end function UIGodBeastLevelUp:RefreshPanel() self.raiseUpInfo = MDL.GodBeast.GetGodBeastSlotInfo(self.config.ID) self:UpdateInfoView() -- 界面信息 self:UpdatePolygonImg() -- 雷达图 self:UpdateBottomBtnView() -- 底部信息 end function UIGodBeastLevelUp:UpdateInfoView() -- 资质 UIUtils.SetLabel(self.txt_GodBeastTalent, self.config.GodBeastTalent) UIUtils.SetLabel(self.txt_Break, self.config.GodBeastTalent) -- 姓名 CTL.GodBeast.SetGodBeastName(self.lab_BeastName, self.config.ID) -- 修为年限 UIUtils.SetLabel(self.txt_Break, CTL.GodBeast.GetLevelUpYearText(self.raiseUpInfo.raiseLevel)) -- 纳灵 UIUtils.SetLabel(self.txt_ResonanceLv, string.FormatByIdsId(Const_IDS["IDS_Resonance_Level"], MDL.FormationResonance.GetSubResonanceLv(resonance_info.GodBeast_Raise))) -- 修为属性总览 self:UpdateAttrText() end -- 进修属性预览 function UIGodBeastLevelUp:UpdateAttrText() local levelUpData, isSuccess, nextLevelUpData = MDL.GodBeast.GetLastAndCurLevelUpData(self.config.ID) if not isSuccess then UIUtils.SetActive(self.group_AttrInfo.gameObject, false) return end UIUtils.SetActive(self.group_AttrInfo.gameObject, true) local attrTb = nextLevelUpData.Attr_Table for i, v in ipairs(attrTb) do UIUtils.SetLabel(self.group_Attr[i], UTL.Attr.GetAttrText(v.AttrType, v.AttrNum)) end UIUtils.SetLabel(self.txt_LevelUp, string.FormatByIdsId(Const_IDS.IDS_Godbeast_LevelUp14, levelUpData.GodBeastLevel * 100, nextLevelUpData.GodBeastLevel * 100)) end function UIGodBeastLevelUp:UpdateBottomBtnView() local levelUpData, nextIsSuccess, nextLevelUpData = MDL.GodBeast.GetLastAndCurLevelUpData(self.config.ID) UIUtils.SetActive(self.group_LevelUp.gameObject, false) UIUtils.SetActive(self.group_Full.gameObject, true) self.btn_Break:SetRedPoint(MDL.GodBeast.CanRaiseUp(self.config.ID)) if levelUpData.GodBeastAttrID == 0 then -- 当前为当前版本喂养最大级 UIUtils.SetLabelText(self.lab_Max, Const_IDS.IDS_Godbeast_LevelUp7) return end local levelAttrData = DataSheetManager.GodBeastLevelUpAttr:GetDataByID(levelUpData.GodBeastAttrID) self.raiseLevelStage = MDL.GodBeast.GetSlotRaiseStage(self.config.ID) self.isEraLevelUp = self.raiseLevelStage >= levelAttrData.ImproveTimes -- 达到最大修为年限 if nextIsSuccess == false and self.isEraLevelUp then UIUtils.SetLabelText(self.lab_Max, Const_IDS.IDS_Godbeast_LevelUp7) return end if nextIsSuccess and MDL.HeroSelect.GetTeamLevel() < levelUpData.HeroStarLimit then --等级 UIUtils.SetLabel(self.lab_Max, string.FormatByIdsId(Const_IDS.IDS_Godbeast_LevelUp6, CTL.Player.GetNobilityTeamLevelStr(nextLevelUpData.HeroStarLimit))) else UIUtils.SetActive(self.group_LevelUp.gameObject, true) UIUtils.SetActive(self.group_Full.gameObject, false) if self.raiseLevelStage < levelAttrData.ImproveTimes then -- 喂养状态 self.activeItemTb = levelAttrData.Item_Table UIUtils.SetLabelText(self.lab_Break, Const_IDS.IDS_Godbeast_LevelUp1) else -- 进修状态 self.activeItemTb = levelUpData.Item_Table UIUtils.SetLabelText(self.lab_Break, Const_IDS.IDS_Godbeast_LevelUp2) end -- 设置激活道具图标 self.isEnough = true for i, item in ipairs(self.activeItemTb) do local count = MDL.Bag.GetItemCount(item.ItemID) local isItemEnough = count >= item.ItemNum if not isItemEnough then self.isEnough = false end local contentItem = self.group_Item[i] if not contentItem then contentItem = self:InstantiateCollection(self.group_Item, self.Item.gameObject) end UTL.Item.SetItemCell( contentItem, item.ItemID, isItemEnough and UTL.Color.FormatGreenColor(count) .. "/" .. item.ItemNum or UTL.Color.FormatRedColor(count).. "/" .. item.ItemNum) UIUtils.SetActive(contentItem.gameObject, true) end for i = #self.group_Item, #self.activeItemTb + 1, -1 do UIUtils.SetActive(self.group_Item[i].gameObject, false) end -- 喂养进度 UIUtils.SetLabel(self.txt_Num, string.FormatByIdsId(Const_IDS.IDS_Godbeast_LevelUp12, self.raiseLevelStage .. "/".. levelAttrData.ImproveTimes)) self.isLevelUpEffect = self.raiseLevelStage < levelAttrData.ImproveTimes end end function UIGodBeastLevelUp:UpdatePolygonImg() local ratioStr, attrValList = MDL.GodBeast.GetPolygonData(self.config.ID) for i, attrType in ipairs(CTL.GodBeast.POLYGON_TYPE_ORDER) do if attrValList[attrType] > 0 then UIUtils.SetLabel(self.group_PolygonTxt[i], attrValList[attrType]) end end UIUtils.SetPolygonVerticesValue(self.img_polygon, ratioStr) end function UIGodBeastLevelUp:OnLateLevelUp() MDL.GodBeast.GodBeastRaiseReq(self.config.ID) self.levelUpBtnLock = false end function UIGodBeastLevelUp:OnButtonClicked(comp) if comp == self.btn_Break then if MDL.GodBeast.CanRaiseUp(self.config.ID) then local isBig = MDL.GodBeast.IsBigLevelUp(self.config.ID) if isBig then if self.levelUpBtnLock == false then self.levelUpBtnLock = true self.effect_Break:PlayUIEffect() self:StartRepeatFunc(self.OnLateLevelUp, CTL.GodBeast.LATE_EXECUTE_SECOND, 1) end else self.effect_LevelUp:PlayUIEffect() self:OnLateLevelUp() end else CTL.Tips.AddTipsMsg(self.isEraLevelUp and Const_IDS.IDS_Godbeast_LevelUp10 or Const_IDS.IDS_Godbeast_LevelUp11) end elseif comp == self.btn_Resonance then UIManager.OpenView(Const_UI_Lua.UIEnum.UIResonanceInfo, {subResonanceID = resonance_info.GodBeast_Raise, isShowGoto = false}) else for i, v in ipairs(self.group_Item) do if comp == v.event_Click then UTL.ItemTips.ShowCommonTipsById(self.activeItemTb[i].ItemID) break end end end end return UIGodBeastLevelUp