From 6c259fbf2651d6511017aaba20cac84a70f4b30e Mon Sep 17 00:00:00 2001 From: gaoxin Date: Mon, 13 Dec 2021 15:27:17 +0800 Subject: [PATCH] =?UTF-8?q?=E3=80=90=E5=85=B3=E5=8D=A1=E6=96=B0=E6=9D=A1?= =?UTF-8?q?=E4=BB=B6=E3=80=91=E5=AE=8C=E5=96=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../~Lua/Modules/Equip/EquipManager.lua | 32 +++- .../Modules/Fight/FightPointPassManager.lua | 140 ++++++++++++------ .../~Lua/Modules/XiaoYao/XiaoYaoManager.lua | 10 +- 3 files changed, 138 insertions(+), 44 deletions(-) diff --git a/Assets/ManagedResources/~Lua/Modules/Equip/EquipManager.lua b/Assets/ManagedResources/~Lua/Modules/Equip/EquipManager.lua index 55ce872748..e7c06c81d9 100644 --- a/Assets/ManagedResources/~Lua/Modules/Equip/EquipManager.lua +++ b/Assets/ManagedResources/~Lua/Modules/Equip/EquipManager.lua @@ -21,7 +21,6 @@ end function this.GetHaveEquipDatas() return this.HaveEquipDatas end - --upHeroDid function this.InitUpdateEquipData(id, upHeroDid, isFindHandBook) if not this.equipDatas then @@ -70,6 +69,37 @@ function this.InitUpdateEquipData(id, upHeroDid, isFindHandBook) end end +-- 获取拥有某星级以上的装备数量 +function this.GetLimitStarEquipNum(star) + local allNum = 0 + -- 背包里面的 + local equips = BagManager.GetBagItemDataByItemType(ItemBaseType.Equip) + for _, e in ipairs(equips) do + if e.id and e.num > 0 then + if equipConfig[e.id].Star >= star then + allNum = allNum + e.num + end + end + end + LogRed("4, bag "..allNum) + + -- 身上穿的 + local allHeroDatas = HeroManager.GetAllHeroList() + for _, hero in pairs(allHeroDatas) do + if hero.equipIdList and #hero.equipIdList > 0 then + for i = 1, #hero.equipIdList do + local id = hero.equipIdList[i] + if equipConfig[id].Star >= star then + allNum = allNum + 1 + end + end + end + end + LogRed("4, wear "..allNum) + + return allNum +end + function this.UpdateEquipData(idlist, heroDid) for i = 1, #idlist do this.InitUpdateEquipData(idlist[i], heroDid, false) diff --git a/Assets/ManagedResources/~Lua/Modules/Fight/FightPointPassManager.lua b/Assets/ManagedResources/~Lua/Modules/Fight/FightPointPassManager.lua index 9397f95b80..08912e0ea5 100644 --- a/Assets/ManagedResources/~Lua/Modules/Fight/FightPointPassManager.lua +++ b/Assets/ManagedResources/~Lua/Modules/Fight/FightPointPassManager.lua @@ -259,9 +259,10 @@ function this.IsCanFight(fightId) if this.IsChapterClossState() then -- 以防后端不校验,再来一次 - if PlayerManager.level < mainLevelConfig[this.curOpenFight].LevelLimit then + local isOk, tip = this.CheckFightOpenRule(this.curOpenFight) + if not isOk then Log("等级不足,无法挑战关卡") - return false, tostring(mainLevelConfig[this.curOpenFight].LevelLimit .. Language[10056]) + return false, tip else -- 等级不足未通关时设置一下 if this.curFightState == -1 then this.curFightState = 1 @@ -275,7 +276,7 @@ function this.IsCanFight(fightId) return true, Language[10617] elseif state == FIGHT_POINT_STATE.OPEN_LOW_LEVEL then Log("等级不足,无法挑战关卡") - return false, tostring(mainLevelConfig[this.curOpenFight].LevelLimit .. Language[10056]) + return false, "关卡未满足解锁条件"--tostring(mainLevelConfig[this.curOpenFight].LevelLimit .. Language[10056]) elseif state == FIGHT_POINT_STATE.PASS then -- 最后一关 Log("已经通关") return false, Language[10618] @@ -285,50 +286,101 @@ function this.IsCanFight(fightId) end end - +-- 检测其他关卡条件 function this.CheckFightOpenRule(fightId) - if fightId and mainLevelConfig[fightId] then + if not fightId or not mainLevelConfig[fightId] then return false, "没有这个关卡" end - local openRule = mainLevelConfig[fightId].OpenRule - if not openRule or openRule[1] == 0 then - return true - elseif openRule[1] == 1 then - local star = FightLevelManager.GetAllChapterStars() - if openRule[2] < star then - return false, string.format("山河社稷图星数达%s解锁", star) - end - elseif openRule[1] == 2 then - local wave = MonsterCampManager.GetMonsterCampCurWave() - if openRule[2] <= wave then - return false, string.format("心魔试炼通关%s层解锁", wave) - end - elseif openRule[1] == 3 then - local lv = HarmonyManager.GetSingleAdditions(HarmonyAddType.AddLv) - if openRule[2] <= lv then - return false, string.format("鸿蒙阵共鸣等级达%s解锁", lv) - end - elseif openRule[1] == 4 then - -- 指定星级(运算星级)装备数量(初始可用) - -- local lv = HarmonyManager.GetSingleAdditions(HarmonyAddType.AddLv) - -- if openRule[2] <= lv then - -- return false, string.format("鸿蒙阵共鸣等级达%s解锁", lv) - -- end - elseif openRule[1] == 5 then - local _, tlv, _ = LikabilityManager.GetTotalHeroLikeLv(1) - if openRule[2] <= tlv then - return false, string.format("神将总好感度等级达%s解锁", tlv) - end - elseif openRule[1] == 6 then - -- 逍遥游通关次数 - -- local _, tlv, _ = LikabilityManager.GetTotalHeroLikeLv(1) - - elseif openRule[1] == 6 then - -- 达到指定英雄等级及数量(初始可用) - -- local _, tlv, _ = LikabilityManager.GetTotalHeroLikeLv(1) - + if PlayerManager.level < mainLevelConfig[this.curOpenFight].LevelLimit then + local tip = tostring(mainLevelConfig[this.curOpenFight].LevelLimit .. Language[10056]) + LogRed(tip .. " 当前:"..PlayerManager.level) + return false, tip end + + local openRule = mainLevelConfig[fightId].OpenRule + if openRule then + local states = {} + local tips = {} + for index, rule in ipairs(openRule) do + if not rule[1] or rule[1] == 0 then + LogRed("当前:没有限制条件1") + states[index] = true + elseif rule[1] == 1 then + local star = FightLevelManager.GetAllChapterStars() + if star < rule[2] then + states[index] = false + tips[index] = string.format("山河社稷图星数达%s", rule[2]) + LogRed(tips[index]..", 当前:"..star) + end + elseif rule[1] == 2 then + local wave = MonsterCampManager.GetMonsterCampCurWave() + if wave <= rule[2] then + states[index] = false + tips[index] = string.format("心魔试炼通关%s层", rule[2]) + LogRed(tips[index]..", 当前:"..wave) + end + elseif rule[1] == 3 then + local lv = HarmonyManager.GetSingleAdditions(HarmonyAddType.AddLv) + if lv < rule[2] then + states[index] = false + tips[index] = string.format("鸿蒙阵共鸣等级达%s", rule[2]) + LogRed(tips[index]..", 当前:"..lv) + end + elseif rule[1] == 4 then + -- 指定星级(运算星级)装备数量(初始可用) + LogRed("4, rule[2]"..rule[2]) + LogRed("4, rule[3]"..rule[3]) + local num = EquipManager.GetLimitStarEquipNum(rule[2]) + LogRed("4, 当前:"..num) + if num < rule[3] then + local equipStarConfig = ConfigManager.GetConfigData(ConfigName.EquipStarsConfig, rule[2]) + states[index] = false + tips[index] = string.format("拥有%s个%s%s星装备", rule[3], QualityNameDef[equipStarConfig.Quality], equipStarConfig.Stars) + LogRed(tips[index]..", 当前:"..num) + end + elseif rule[1] == 5 then + local _, tlv, _ = LikabilityManager.GetTotalHeroLikeLv(1) + if tlv < rule[2] then + states[index] = false + tips[index] = string.format("神将总好感度等级达%s", rule[2]) + LogRed(tips[index]..", 当前:"..tlv) + end + elseif rule[1] == 6 then + -- 逍遥游通关次数 + local xyPassTimes = XiaoYaoManager.GetCurPassTimes() + if xyPassTimes < rule[2] then + states[index] = false + tips[index] = string.format("通关逍遥游%s次", rule[2]) + LogRed(tips[index]..", 当前:"..xyPassTimes) + end + elseif rule[1] == 7 then + local c_lv = rule[2] + local c_num = rule[3] + local num = #HeroManager.GetAllHeroDatas(c_lv) + if num < c_num then + states[index] = false + tips[index] = string.format("拥有%s个等级%s以上的神将", c_num, c_lv) + LogRed(tips[index]..", 当前:"..num) + end + end + end + local tip = "" + local isOk = true + for index, state in pairs(states) do + if not state then + isOk = false + if tip ~= "" then + tip = tip..string.format(",且%s", tips[index]) + else + tip = tips[index] + end + end + end + return isOk, tip.."解锁" + end + LogRed("当前:没有限制条件2") + return true end @@ -346,6 +398,10 @@ function this.GetBtnText() if PlayerManager.level < limitLevel then return limitLevel .. Language[10056] end + -- + if not this.CheckFightOpenRule(this.curOpenFight) then + return "条件未达成" + end local offset = 1 offset = mainLevelConfig[this.curOpenFight].Difficulty diff --git a/Assets/ManagedResources/~Lua/Modules/XiaoYao/XiaoYaoManager.lua b/Assets/ManagedResources/~Lua/Modules/XiaoYao/XiaoYaoManager.lua index 25d777c6f2..feb4e7b60b 100644 --- a/Assets/ManagedResources/~Lua/Modules/XiaoYao/XiaoYaoManager.lua +++ b/Assets/ManagedResources/~Lua/Modules/XiaoYao/XiaoYaoManager.lua @@ -14,6 +14,7 @@ this.luckyluckyTurnTableRemainTime = 0 this.isAutoYouli=false --逍遥游自动游历开关 this.first = true +this.finishNum = 0 --打开逍遥游地图列表界面 function this.OpenMapList() this.first = false @@ -37,7 +38,9 @@ function this.GetOpenMapData(func) _data[msg.infos[i].mapId].first=msg.infos[i].first end this.allMapData=_data - + --逍遥游累计通关次数 + this.finishNum = msg.finishNum or 0 + this.CheckRedPoint2() if func then func(_data) @@ -45,6 +48,11 @@ function this.GetOpenMapData(func) end) end +-- 获取逍遥游通关总次数 +function this.GetCurPassTimes() + return this.finishNum +end + -- 判断地图是否首通 function this.IsFirstPass(mapId) if not this.allMapData or not this.allMapData[mapId] or this.allMapData[mapId].first ~= 1 then