local UINobilityCommon = UIViewClass() function UINobilityCommon:OnOpened(context) self:RegistSystemEvent(EventID.UI_Nobility_RefreshPanel, self.RefreshMainUI) self:RegistSystemEvent(EventID.UI_Nobility_RefreshStageUp, self.RefreshMainUI) self:RegistSystemEvent(EventID.UI_Nobility_RefreshSecondStageActive,self.RefreshMainUI) -- 界面标题 UIUtils.SetLabelText(self.UITemplateTitlePanel.lab_Title, Const_IDS["IDS_Nobility_PromotionToRank"]) self:RefreshMainUI() end function UINobilityCommon:OnButtonClicked(comp) if comp == self.UITemplateTitlePanel.btn_close then self:CloseView() elseif comp == self.UITemplateTitlePanel.btn_Home then CTL.HomeMain.CloseViewBackHomeMain() elseif comp == self.UITemplateTitlePanel.btn_Info then UIManager.OpenView(Const_UI_Lua.UIEnum.UICommonNoteView, {id = LuaConst.NoteID.Nobility}) end end function UINobilityCommon:OnBackButtonPressed() self:OnButtonClicked(self.UITemplateTitlePanel.btn_close) end function UINobilityCommon:RefreshMainUI() self.currentNobilityID = MDL.Nobility.GetNobilityID() self.currentStage = MDL.Nobility.GetStage() self.currentNobilityConfig = DataSheetManager.Nobility:GetDataByRankID(self.currentNobilityID) self.nextNobilityID = self.currentNobilityID + 1 self.nextNobilityConfig = DataSheetManager.Nobility:GetDataByRankID(self.nextNobilityID) UIUtils.SetImageByAssetBundle(self.img_Character, self.currentNobilityConfig.Background) -- 立绘图片 -- 当前爵位 UIUtils.SetImageByAssetBundle(self.img_current_BigImage, self.currentNobilityConfig.BigIcon) -- 大爵位图片 local levelStr = UTL.Item.GetNobilityByTeamLevel(self.currentNobilityConfig.TeamLevelMax, 2) -- 爵位转换 UIUtils.SetLabel(self.txt_currentLevel, string.FormatByIdsId(Const_IDS.IDS_HeroLevelShow, levelStr)) -- 下个爵位 UIUtils.SetImageByAssetBundle(self.img_next_BigImage, self.nextNobilityConfig.BigIcon) -- 大爵位图片 local nextLevelStr = UTL.Item.GetNobilityByTeamLevel(self.currentNobilityConfig.TeamLevelMax + 1, 2) -- 爵位转换 UIUtils.SetLabel(self.txt_nextLevel, string.FormatByIdsId(Const_IDS.IDS_HeroLevelShow, nextLevelStr)) UIUtils.SetLabel(self.txt_ScordMark_Number, string.format("%s/%s", MDL.Nobility.GetProgress())) UIUtils.SetActive(self.group_ScordMark, self.currentStage ~= 3) if self.currentStage == 0 then self.group_Progress.value = 0.25 self.state:SetState(0) elseif self.currentStage == 1 then self.group_Progress.value = 0.5 self.state:SetState(1) elseif self.currentStage == 2 then self.group_Progress.value = 0.75 self.state:SetState(2) elseif self.currentStage == 3 then self.group_Progress.value = 1 self.state:SetState(2) end for i = 1, #self.group_Points_Light do UIUtils.SetActive(self.group_Points_Light[i].gameObject, i <= self.currentStage + 2) end self:RefreshSubUI() end function UINobilityCommon:RefreshSubUI() if self.currentStage == 0 or self.currentStage == 1 then if self.nobilityContentPicture == nil then self.nobilityContentPicture = self.subView:OpenView(GetViewClass(Const_UI_Lua.UIEnum.UINobilityContentPicture)) end elseif self.currentStage == 2 or self.currentStage == 3 then if self.nobilityContentInfo == nil then self.nobilityContentInfo = self.subView:OpenView(GetViewClass(Const_UI_Lua.UIEnum.UINobilityContentInfo)) if self.nobilityContentPicture ~= nil then self.nobilityContentPicture:CloseView() end end end end return UINobilityCommon