local UIMatchTipPanel = UIViewClass() function UIMatchTipPanel:OnOpened(context) self:RegistSystemEvent(EventID.UI_ActivityNotice_FoldOut, self.OnActivityNoticeFoldOut) self:RegistSystemEvent(EventID.UI_ActivityNotice_FoldIn, self.OnActivityNoticeFoldIn) self:RegistSystemEvent(EventID.UI_Team_TeamTargetChange, self.SetTitleName) self.activityId = context.activityId self._currentTime = 0 local value = UTL.Time.GetServerTimestamp() - MDL.TeamMatch.GetStartMatchingTime() self.curTick = value self.labLocal_MatchTime.text = UTL.Time.FormatTimeSeconds(self.curTick) self:SetTitleName(self.activityId) self:StartRepeatFunc(self.OnUpdateFun, 0) self:SetPushStyle(LuaConst.PushStyleEnum.HIDE) end function UIMatchTipPanel:OnClosed() self:StartRepeatFunc(self.DelayAddTownHome, 1, 1) end function UIMatchTipPanel:DelayAddTownHome() CTL.HomeMain.AddTownHomeDelayFuncNoUI(CTL.TeamMatch.OpenMatchTipPanel, self.activityId) end function UIMatchTipPanel:OnActivityNoticeFoldOut() UIUtils.SetActive(self.Container, false) end function UIMatchTipPanel:OnActivityNoticeFoldIn() UIUtils.SetActive(self.Container, true) end function UIMatchTipPanel:SetTitleName(activityId) self.activityId = activityId if activityId == LuaConst.ActivityType.TVT then UIUtils.SetLabelText(self.labLocal_GameName, Const_IDS["IDS_UI_Word4"]) elseif activityId == LuaConst.ActivityType.TeamDungeon1 or activityId == LuaConst.ActivityType.TeamDungeon2 or activityId == LuaConst.ActivityType.TeamDungeon3 then local dungeonName = CTL.TeamDungeon.GetDungeonDataByActivityID(activityId).DungeonName UIUtils.SetLabelText(self.labLocal_GameName, Const_IDS[dungeonName]) elseif activityId == LuaConst.ActivityType.SyncSolo then UIUtils.SetLabelText(self.labLocal_GameName, Const_IDS["IDS_1v1Sync_Title"]) elseif activityId == LuaConst.ActivityType.SyncFourCountryWar then UIUtils.SetLabelText(self.labLocal_GameName, Const_IDS["IDS_SyncFourCountry_Title"]) end end function UIMatchTipPanel:OnUpdateFun(deltaTime, timeSinceUpdate) --刷新显示匹配图 if self._currentTime <= 1 then self._currentTime = self._currentTime + deltaTime else self.curTick = self.curTick + 1 self.labLocal_MatchTime.text = UTL.Time.FormatTimeSeconds(self.curTick) self._currentTime = 0 end end function UIMatchTipPanel:OnButtonClicked(obj) if obj == self.event_Match then CTL.Team.EnterTeamPlayByTarget(self.activityId) end end return UIMatchTipPanel