-- 仇人追踪实时社交小弹窗 local UIRivalRemind = UIViewClass() local MAX_NUM = 99 local EffPath = ConstAssetPathConfig.EffPath -------------------- function UIRivalRemind:OnCreated() self.firstTracking = nil self.hintCount = 0 end function UIRivalRemind:OnOpened(context) self.obj_StateSocial:SetState(0) self:RegistSystemEvent(EventID.UI_Rival_RefreshRemind, self.OnRefreshRemind) self:RegistSystemEvent(EventID.UI_Rival_CloseRemind, self.CloseView) local time = self:UpdateInfo(true) self:StartRepeatFunc(self.OnUpdateFun, time) self.eff_Title:PlayUIEffect(EffPath, -1) end function UIRivalRemind:OnClosed() CTL.Rival.SetRivalRemindCloseState() self.context.parentView:OnSubViewClosed(self.context.dynamicType) end function UIRivalRemind:OnUpdateFun(deltaTime, timeSinceUpdate) self:StopRepeatFunc(self.OnUpdateFun) self:IgnoreAll() end function UIRivalRemind:OnButtonClicked(comp) if comp == self.btn_Confirm then if self.hintCount > 1 then -- 打开动态列表 UIManager.OpenView(Const_UI_Lua.UIEnum.UIDynamicMessages) else if self.firstTracking then -- 只有一个直接前往 MDL.WorldBoss.SendGotoRivalMsg(self.firstTracking.syncBattleSubID, self.firstTracking.syncBattleGRoomID, self.firstTracking.acid) end end self:CloseView() elseif comp == self.btn_Close then self:IgnoreAll() end end -------------------- function UIRivalRemind:OnRefreshRemind() self:StopRepeatFunc(self.OnUpdateFun) local time = self:UpdateInfo(false) self:StartRepeatFunc(self.OnUpdateFun, time) end function UIRivalRemind:UpdateInfo(isInit) local trackingCount = 0 self.firstTracking, trackingCount = MDL.Rival.GetLastRivalTrackingAndAllCount() if (not isInit) and self.firstTracking == nil then self:CloseView() return end UIUtils.SetLabel(self.txt_EnemyName, self.firstTracking.playerName) UIUtils.SetLabel(self.txt_Activity, CTL.Rival.GetRivalTrackingReasonIDS(self.firstTracking.rivalTrackingReason)) CTL.Character.SetPortraitAndFrame(self.UIHeroHeadTempate, self.firstTracking.portraitId, self.firstTracking.frameId, nil, self.firstTracking.acid) local worldBossHelpList = MDL.WorldBoss.GetSeekHelpList() self.hintCount = #worldBossHelpList + trackingCount local offset = self.firstTracking.closeTime - UTL.Time.GetServerTimestamp() if self.hintCount > 1 then UIUtils.SetActive(self.img_Number, true) UIUtils.SetLabel(self.txt_Number, math.min(self.hintCount, MAX_NUM)) self.txt_Confirm:ResetAndBeginCustomTimer(false, offset, 0, UIUtils.GetLocalizedTxt(Const_IDS.IDS_WarChannel_CheckBtn), 1) else UIUtils.SetActive(self.img_Number, false) self.txt_Confirm:ResetAndBeginCustomTimer(false, offset, 0, UIUtils.GetLocalizedTxt(Const_IDS.IDS_WorldBoss_Go), 1) end return offset end function UIRivalRemind:IgnoreAll() MDL.Rival.ClearAllRivalTracking() self:CloseView() end return UIRivalRemind