【关卡新条件】条件显示在按钮上

gaoxin 2021-12-26 18:13:39 +08:00
parent 7476af5fd9
commit f0d9f4828f
1 changed files with 27 additions and 10 deletions

View File

@ -295,13 +295,14 @@ function this.CheckFightOpenRule(fightId)
if PlayerManager.level < mainLevelConfig[this.curOpenFight].LevelLimit then if PlayerManager.level < mainLevelConfig[this.curOpenFight].LevelLimit then
local tip = tostring(mainLevelConfig[this.curOpenFight].LevelLimit .. Language[10056]) local tip = tostring(mainLevelConfig[this.curOpenFight].LevelLimit .. Language[10056])
LogRed(tip .. " 当前:"..PlayerManager.level) LogRed(tip .. " 当前:"..PlayerManager.level)
return false, tip return false, tip, tip
end end
local openRule = mainLevelConfig[fightId].OpenRule local openRule = mainLevelConfig[fightId].OpenRule
if openRule then if openRule then
local states = {} local states = {}
local tips = {} local tips = {}
local btnTxts = {}
for index, rule in ipairs(openRule) do for index, rule in ipairs(openRule) do
if not rule[1] or rule[1] == 0 then if not rule[1] or rule[1] == 0 then
LogRed("当前没有限制条件1") LogRed("当前没有限制条件1")
@ -310,21 +311,24 @@ function this.CheckFightOpenRule(fightId)
local star = FightLevelManager.GetAllChapterStars() local star = FightLevelManager.GetAllChapterStars()
if star < rule[2] then if star < rule[2] then
states[index] = false states[index] = false
tips[index] = string.format("山河社稷图星数达%s", rule[2]) tips[index] = string.format("山河社稷图星数达%s", rule[2])-- 山河社稷图%s星
btnTxts[index] = string.format("山河社稷图%s星", rule[2])
LogRed(tips[index]..", 当前:"..star) LogRed(tips[index]..", 当前:"..star)
end end
elseif rule[1] == 2 then elseif rule[1] == 2 then
local wave = MonsterCampManager.GetMonsterCampCurWave() local wave = MonsterCampManager.GetMonsterCampCurWave()
if wave <= rule[2] then if wave <= rule[2] then
states[index] = false states[index] = false
tips[index] = string.format("心魔试炼通关%s层", rule[2]) tips[index] = string.format("心魔试炼通关%s层", rule[2])-- 心魔试炼通关999层
btnTxts[index] = string.format("心魔试炼通关999层", rule[2])
LogRed(tips[index]..", 当前:"..wave) LogRed(tips[index]..", 当前:"..wave)
end end
elseif rule[1] == 3 then elseif rule[1] == 3 then
local lv = HarmonyManager.GetSingleAdditions(HarmonyAddType.AddLv) local lv = HarmonyManager.GetSingleAdditions(HarmonyAddType.AddLv)
if lv < rule[2] then if lv < rule[2] then
states[index] = false states[index] = false
tips[index] = string.format("鸿蒙阵共鸣等级达%s", rule[2]) tips[index] = string.format("鸿蒙阵共鸣等级达%s", rule[2])-- 鸿蒙阵共鸣%s级
btnTxts[index] = string.format("鸿蒙阵共鸣%s级", rule[2])
LogRed(tips[index]..", 当前:"..lv) LogRed(tips[index]..", 当前:"..lv)
end end
elseif rule[1] == 4 then elseif rule[1] == 4 then
@ -334,13 +338,15 @@ function this.CheckFightOpenRule(fightId)
local equipStarConfig = ConfigManager.GetConfigData(ConfigName.EquipStarsConfig, rule[2]) local equipStarConfig = ConfigManager.GetConfigData(ConfigName.EquipStarsConfig, rule[2])
states[index] = false states[index] = false
tips[index] = string.format("拥有%s个%s%s星装备", rule[3], QualityNameDef[equipStarConfig.Quality], equipStarConfig.Stars) tips[index] = string.format("拥有%s个%s%s星装备", rule[3], QualityNameDef[equipStarConfig.Quality], equipStarConfig.Stars)
btnTxts[index] = string.format("%s个%s%s星装备", rule[3], QualityNameDef[equipStarConfig.Quality], equipStarConfig.Stars)
LogRed(tips[index]..", 当前:"..num) LogRed(tips[index]..", 当前:"..num)
end end
elseif rule[1] == 5 then elseif rule[1] == 5 then
local _, tlv, _ = LikabilityManager.GetTotalHeroLikeLv(-1) local _, tlv, _ = LikabilityManager.GetTotalHeroLikeLv(-1)
if tlv < rule[2] then if tlv < rule[2] then
states[index] = false states[index] = false
tips[index] = string.format("神将总好感度等级达%s", rule[2]) tips[index] = string.format("神将总好感度等级达%s", rule[2]) -- 总好感度%s级
btnTxts[index] = string.format("总好感度%s级", rule[2])
LogRed(tips[index]..", 当前:"..tlv) LogRed(tips[index]..", 当前:"..tlv)
end end
elseif rule[1] == 6 then elseif rule[1] == 6 then
@ -348,7 +354,8 @@ function this.CheckFightOpenRule(fightId)
local xyPassTimes = XiaoYaoManager.GetCurPassTimes() local xyPassTimes = XiaoYaoManager.GetCurPassTimes()
if xyPassTimes < rule[2] then if xyPassTimes < rule[2] then
states[index] = false states[index] = false
tips[index] = string.format("通关逍遥游%s次", rule[2]) tips[index] = string.format("逍遥游通关%s次", rule[2])
btnTxts[index] = string.format("逍遥游通关%s次", rule[2])
LogRed(tips[index]..", 当前:"..xyPassTimes) LogRed(tips[index]..", 当前:"..xyPassTimes)
end end
elseif rule[1] == 7 then elseif rule[1] == 7 then
@ -357,24 +364,33 @@ function this.CheckFightOpenRule(fightId)
local num = #HeroManager.GetAllHeroDatas(c_lv) local num = #HeroManager.GetAllHeroDatas(c_lv)
if num < c_num then if num < c_num then
states[index] = false states[index] = false
tips[index] = string.format("拥有%s个等级%s以上的神将", c_num, c_lv) tips[index] = string.format("拥有%s个等级%s以上的神将", c_num, c_lv)-- %s个%s级神将
btnTxts[index] = string.format("%s个%s级神将", c_num, c_lv)
LogRed(tips[index]..", 当前:"..num) LogRed(tips[index]..", 当前:"..num)
end end
end end
end end
local tip = "" local tip = ""
local btnTxt = ""
local isOk = true local isOk = true
for index, state in pairs(states) do for index, state in pairs(states) do
if not state then if not state then
isOk = false isOk = false
-- 提示文字
if tip ~= "" then if tip ~= "" then
tip = tip..string.format(",且%s", tips[index]) tip = tip..string.format(",且%s", tips[index])
else else
tip = tips[index] tip = tips[index]
end end
-- 按钮显示文字
if btnTxt ~= "" then
btnTxt = tip..string.format(",且%s", btnTxts[index])
else
btnTxt = btnTxts[index]
end
end end
end end
return isOk, tip.."解锁" return isOk, tip.."解锁", btnTxt
end end
LogRed("当前没有限制条件2") LogRed("当前没有限制条件2")
return true return true
@ -396,8 +412,9 @@ function this.GetBtnText()
return limitLevel .. Language[10056] return limitLevel .. Language[10056]
end end
-- --
if not this.CheckFightOpenRule(this.curOpenFight) then local isOk, tip, btnTxt= this.CheckFightOpenRule(this.curOpenFight)
return "条件未达成" if not isOk then
return btnTxt
end end
local offset = 1 local offset = 1