local Rival_Controller = {} local private = {} local EventSystem = require('Event/EventSystem') local rival_opt_pb = require("Proto/rival_opt_pb") -- 仇人状态 Rival_Controller.RivalTrackingReason = { [rival_opt_pb.RivalWorldBoss] = Const_IDS.IDS_ActivityName_WorldBoss, -- 世界boss [rival_opt_pb.RivalWarZoneBoss] = Const_IDS.IDS_ActivityName_WarZoneBoss, } function Rival_Controller.OnStartup() private.isRivalRemindOpen = false end -- #region 仇敌追踪 function Rival_Controller.ShowRivalRemind(state) if state then CTL.HomeMain.AddTownHomeDelayFuncNoUI(private.OnRivalRemindNotice) else -- 这个界面复用了通用的 UIDynamicHint 弹窗prefab,目前的关闭接口无法执行,改成派发事件,从界面内部关闭 EventSystem.Dispatch(EventID.UI_Rival_CloseRemind) Rival_Controller.SetRivalRemindCloseState() end end function Rival_Controller.SetRivalRemindCloseState() private.isRivalRemindOpen = false end function private.OnRivalRemindNotice() if private.isRivalRemindOpen then EventSystem.Dispatch(EventID.UI_Rival_RefreshRemind) else if not UIManager.IsViewOpened(Const_UI_Lua.UIEnum.UIDynamicHintParent) then UIManager.OpenView(Const_UI_Lua.UIEnum.UIDynamicHintParent) end EventSystem.Dispatch(EventID.UI_Rival_OpenRemind) private.isRivalRemindOpen = true end end -- #endregion function Rival_Controller.GetRivalTrackingReasonIDS(rivalTrackingReason) return UIUtils.GetLocalizedTxt(Rival_Controller.RivalTrackingReason[rivalTrackingReason]) end function Rival_Controller.GetLocationDescByBattleInfo(battleInfo) local canTracking = false local locationDesc = UIUtils.GetLocalizedTxt(Const_IDS.IDS_Achievement_Share_FriendOnline) local levelInfoData = battleInfo.syncBattleMapID>0 and DataSheetManager.LevelInfoData:GetDataByLevelID(battleInfo.syncBattleMapID) or nil -- LevelInfoData 没有找到对应的关卡直接 返回在线 if not levelInfoData then return locationDesc, canTracking end -- levelInfoData.LevelType 不是世界boss 或者 国家boss 直接返回在线 if levelInfoData.LevelType ~= LuaConst.LevelType.SyncWorldBoss and levelInfoData.LevelType ~= LuaConst.LevelType.SyncWarZoneWorldBoss then return locationDesc, canTracking end -- 自身未解锁 世界boss, 直接返回在线 if levelInfoData.LevelType == LuaConst.LevelType.SyncWorldBoss and (not MDL.Unlock.IsUnlock(MDL.Unlock.FunctionType.WorldBoss)) then return locationDesc, canTracking end -- 自身未解锁 国家boss,直接返回在线 if levelInfoData.LevelType == LuaConst.LevelType.SyncWarZoneWorldBoss and (not MDL.Unlock.IsUnlock(MDL.Unlock.FunctionType.CountryWorldBoss)) then return locationDesc, canTracking end local worldBossConfig = nil for _, config in DataSheetManager.WorldBoss:GetEnumerator() do if config.MissonDataID == battleInfo.syncBattleMapID then worldBossConfig = config break end end if not worldBossConfig then return locationDesc, canTracking end if worldBossConfig.BossType == LuaConst.WorldBossType.WorldBoss then if MDL.WorldBoss.IsPassGuideMission() and not battleInfo.isCross then canTracking = true locationDesc = string.format("%s.%s(%s)", UIUtils.GetLocalizedTxt(Const_IDS.IDS_ActivityName_WorldBoss), UIUtils.GetLocalizedTxt(Const_IDS[worldBossConfig.WordBossName]), CTL.WorldBoss.GetBossLevelStr(worldBossConfig.ShowLevel)) end elseif worldBossConfig.BossType == LuaConst.WorldBossType.WarZoneWorldBoss then canTracking = true locationDesc = string.format("%s.%s(%s)", UIUtils.GetLocalizedTxt(Const_IDS.IDS_ActivityName_WarZoneBoss), UIUtils.GetLocalizedTxt(Const_IDS[worldBossConfig.WordBossName]), CTL.WorldBoss.GetBossLevelStr(worldBossConfig.ShowLevel)) end return locationDesc, canTracking end return Rival_Controller