local UIPetFormation = require "View/Pet/UIPetFormation" local UIPetShare = UIViewClass(UIPetFormation) local MAX_RUNE_SKILL = 7 function UIPetShare:Init() --隐藏UIPetFormation不用的节点 UIUtils.SetActive(self.group_Left, false) UIUtils.SetActive(self.group_bottom, false) UIUtils.SetActive(self.btn_Rune, false) UIUtils.SetActive(self.btn_Edit, false) UIUtils.SetActive(self.UITemplateTitlePanel.btn_Info, false) UIUtils.SetLabelText(self.UITemplateTitlePanel.lab_Title, Const_IDS.IDS_Pet_PetDetail) end function UIPetShare:OnOpened(context) local shareInfo = context.sharePetInfo local petID = shareInfo.petType local stageID if shareInfo.petQuality == MDL.Pet.PetQuality.Normal then stageID = shareInfo.petVariation else local cfg = DataSheetManager.GodPetStar:GetDataByPetID_PetStar(petID, shareInfo.bigBreak) stageID = cfg.Stage end local petConfig = DataSheetManager.PetData:GetDataByID_Stage(petID, stageID) self.petConfig = petConfig self:ShowBasicInfo(shareInfo, petConfig, nil, shareInfo.talismanSkill, shareInfo.allGS) end function UIPetShare:GetPetTitle(petInfo) local runeSkillLevelSum, aptitudeSum = 0, 0 for i, v in ipairs(petInfo.petAptitude) do aptitudeSum = aptitudeSum + v.aptitudeValue end for i, v in ipairs(petInfo.talismanSkill) do local _, runeCfg = DataSheetManager.PetRuneSkill:TryGetDataByPetRuneID(v) if runeCfg then runeSkillLevelSum = runeSkillLevelSum + runeCfg.RuneLevel else local relationSkillCfg = DataSheetManager.PetRelationSkill:GetDataByRelationSkillID(v) runeSkillLevelSum = runeSkillLevelSum + relationSkillCfg.RuneLevel end end return CTL.Pet.GetTitleContent(petInfo.isLineUp, runeSkillLevelSum, aptitudeSum) end function UIPetShare:GetPetRelationSkill(petInfo) return 0 end function UIPetShare:SetPetSkill(petInfo) MDL.Pet.CombineSkill(petInfo.congenitalSkill, petInfo.childSkill) CTL.Pet.SetTalentSkillGroup(self.cells, petInfo.congenitalSkill) end function UIPetShare:UpdateRuneSkill(skills) local relationSkill = 0 for i, v in ipairs(skills) do local result = DataSheetManager.PetRelationSkill:TryGetDataByRelationSkillID(v) if result then relationSkill = v table.remove(skills, i) break end end for i = 1, MAX_RUNE_SKILL do if skills[i] and skills[i] > 0 then self.runeSkillList[i] = skills[i] else self.runeSkillList[i] = -1 end end --羁绊符文在最后一个位置 if relationSkill > 0 then self.runeSkillList[MAX_RUNE_SKILL] = relationSkill end self.LoopScroll:ReloadAll(self.runeSkillList) end function UIPetShare:GetSkillByIndex(index) return self.context.sharePetInfo.congenitalSkill[index] end function UIPetShare:ShowTalentDesc(index, comp) CTL.Pet.ShowTalentDesc(self.petConfig, self.context.sharePetInfo, index, comp) end function UIPetShare:OnClosed() UIUtils.SetActive(self.UITemplateTitlePanel.btn_Info, true) end return UIPetShare