local UIFriendRecommend = UIViewClass() local StartAnimationTime = 0.15 local RecommendFriendPopTime = DataSheetManager.ConstData:GetDataByID("RecommendFriendPopWinTime").IntValue function UIFriendRecommend:OnOpened(context) self.playerId = context.playerId self.recommendType = context.recommendType local emojiKey = CTL.Player.GetSexEmojiKey(context.sex) local name = context.name if emojiKey then name = emojiKey..name end self.txt_Recommend.text = string.FormatByIdsId(Const_IDS["IDS_RecommendFriends_PopWinText"], name) local recommendData = DataSheetManager.RecommendAddFriends:GetDataByID(self.recommendType) UIUtils.SetLabelText(self.txt_Reason, Const_IDS[recommendData.AddWindowText]) self.group_CountDown:ResetAndBeginTimer(false, RecommendFriendPopTime) self.isPlay = false self:StartRepeatFunc(self.OnUpdateFun, StartAnimationTime) end function UIFriendRecommend:OnUpdateFun(deltaTime, timeSinceUpdate) if not self.isPlay then self:PlayUIAnimation("Recommend") self:StopRepeatFunc(self.OnUpdateFun) self:StartRepeatFunc(self.OnUpdateFun, RecommendFriendPopTime - StartAnimationTime) self.isPlay = true else self:CloseView() end end function UIFriendRecommend:OnButtonClicked(comp) if comp == self.btn_Ignore then self:CloseView() elseif comp == self.btn_Agree then MDL.Friend.SendApplyFriend(self.playerId, self.recommendType) self:CloseView() end end return UIFriendRecommend