local UIFriendApply = UIViewClass() function UIFriendApply:OnOpened(context) self:RegistSystemEvent(EventID.UI_UpdateFriendInfo, self.UpdateInfo) MDL.Friend.SendRefreshApplyInfos() self:UpdateInfo() end function UIFriendApply:UpdateInfo() UIUtils.SetLabelText(self.UICommonPopUp.txt_Title,Const_IDS["IDS_Friend_ApplicationList"]) local infos = MDL.Friend.GetApplyInfos() logging.log(LTAG.LOG," UpdateInfo ",infos ) self.loop_AddList:ReloadAll(infos) if infos and #infos > 0 then self.obj_state:SetState(1) else self.obj_state:SetState(0) end end function UIFriendApply:OnBackButtonPressed() self:OnButtonClicked(self.UICommonPopUp.btn_Close) end function UIFriendApply:OnCellClicked(scrollRect, index, cellTable, target, data) if target == cellTable.btn_Interact then CTL.PlayerInteract.OpenFriendInteractView(data.acid) elseif target == cellTable.btn_Ignore then MDL.Friend.SendDegreeFriendApply(data.acid) elseif target == cellTable.btn_Accept then MDL.Friend.SendAgreeFriendApply(data.acid) end end function UIFriendApply:OnCellInit(scrollRect, index, cellTable, data) CTL.Character.SetPortraitAndFrame(cellTable.UIHeroHead190, data.portraitId, data.frameId, data.level) UIUtils.SetLabel(cellTable.txt_PlayerName, data.name) UIUtils.SetLabel(cellTable.txt_Guild, data.guildName) CTL.Player.OperateGenderImage(cellTable.image_Gender, data.sex) local recommendData = DataSheetManager.RecommendAddFriends:GetDataByID(data.desEnum > 0 and data.desEnum or 1) UIUtils.SetLabelText(cellTable.txt_Des, Const_IDS[recommendData.FriendIntroText]) local tagData = CTL.Friend.GetPlayerTagData(data) for i, v in ipairs(cellTable.group_Tag) do local data = tagData[i] if data then UIUtils.SetActive(v.gameObject, true) UIUtils.SetLabelText(v.txt_PlayerTag, Const_IDS[data.Name]) UIUtils.SetImageColor(v.bg_PlayerTag, data.FloorColor) else UIUtils.SetActive(v.gameObject, false) end end if data.isCross then UIUtils.SetActive(cellTable.img_ServerBg, true) cellTable.txt_ServerID.text = CTL.CrossServer.GetServerShowStr(data.showServerId) else UIUtils.SetActive(cellTable.img_ServerBg, false) end end function UIFriendApply:OnButtonClicked(comp) if comp == self.btn_IgnoreAll then MDL.Friend.SendDegreeAllFriendApply() elseif comp == self.btn_AcceptAll then local infos = MDL.Friend.GetApplyInfos() if infos and #infos == 1 then --只有单个,执行单个同意的逻辑 local acid = infos[1].acid MDL.Friend.SendAgreeFriendApply(acid) else MDL.Friend.SendAgreeAllFriendApply() end elseif comp == self.UICommonPopUp.btn_Close then self:CloseView() end end return UIFriendApply