local SoloFight_Controller = {} local private = {} local battleSummaryData = {} local EventSystem = require('Event/EventSystem') function SoloFight_Controller.OnStartup() private.officialPVPGradeID = DataSheetManager.ConstData:GetDataByID("OfficialPVPGradeID").IntValue end function SoloFight_Controller.OnShutdown() end function SoloFight_Controller.AddBattleSummaryData() end function SoloFight_Controller.OpenTimeUpView() if not CTL.Activities.IsOpeningTime(LuaConst.ActivityType.OffLineSoloFight)then CTL.Tips.AddTipsMsg(Const_IDS["IDS_ERRORCODE_1015_InfoCode_Activity_Not_Valid"]) return end if MDL.Purchase.GetAvailablePurchaseTimes(LuaConst.ActivityType.OffLineSoloFight) > 0 then UIManager.OpenView(Const_UI_Lua.UIEnum.UIItemBuyPanel, {type = LuaConst.ActivityType.OffLineSoloFight}) else local desc = MDL.OfficialPosition.GetPurchaseTimesDesc(LuaConst.ActivityType.OffLineSoloFight) if desc then CTL.Tips.AddTipsMsg(desc) else CTL.Tips.AddTipsMsg(Const_IDS.IDS_HeroBiography_NoPayTime) end end end function SoloFight_Controller.OpenSoloFightView() local lineUpHeroCount = MDL.Player.GetLineUpHeroCount() if lineUpHeroCount < 6 then CTL.Tips.AddTipsMsg(Const_IDS["IDS_ERRORCODE_1024_InfoCode_PeopleNotEnough"]) return end local isUnlock, content = CTL.Unlock.JudgeIfSatisfiedUnlockTable(DataSheetManager.FuctionUnlock:GetDataByFucID(MDL.Unlock.FunctionType.SoloFight).Unlock_Table) if isUnlock then UIManager.OpenAndPushAll(Const_UI_Lua.UIEnum.UISoloFightPanel) else CTL.Sound.PlayGameSound("UI_invalid") CTL.Tips.AddTipsMsg(content) end end function SoloFight_Controller.SetBattleSummaryInfo(content) SoloFight_Controller.BattleSummaryInfo = content end function SoloFight_Controller.ShowBattleSummary(msgResp) logging.log(LTAG.LOG, msgResp.Resp.Rewards) if SoloFight_Controller.BattleSummaryInfo then SoloFight_Controller.BattleSummaryInfo.rewards = msgResp.Resp.Rewards end UIManager.OpenView(Const_UI_Lua.UIEnum.UISoloFightBattleOver,SoloFight_Controller.BattleSummaryInfo) end function SoloFight_Controller.CanBattleByRankAndOffline(targetRankIdx, selfRankIdx) -- 如果我的名次比对方名次靠前都可以攻击 if selfRankIdx < targetRankIdx then return true end local info = MDL.OfficialPosition.GetOfficialInfo() local selfOffline = private.officialPVPGradeID if info.CurTitle > 0 then -- 当前有段位时 根据具体段位进行处理 local titleData = DataSheetManager.OfficialPosition:GetDataByID(info.CurTitle) if titleData.GradeID < private.officialPVPGradeID then selfOffline = titleData.GradeID end end local maxRank = 0 for _, v in DataSheetManager.OfflineSoloFightScope:GetEnumerator() do if v.OfficialID == selfOffline then if v.PlayerRank == 0 then maxRank = v.Scope break else if selfRankIdx <= v.PlayerRank then maxRank = v.Scope break end end end end return (selfRankIdx - targetRankIdx) <= maxRank end return SoloFight_Controller