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

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
local tip = tostring(mainLevelConfig[this.curOpenFight].LevelLimit .. Language[10056])
LogRed(tip .. " 当前:"..PlayerManager.level)
return false, tip
return false, tip, tip
end
local openRule = mainLevelConfig[fightId].OpenRule
if openRule then
local states = {}
local tips = {}
local btnTxts = {}
for index, rule in ipairs(openRule) do
if not rule[1] or rule[1] == 0 then
LogRed("当前没有限制条件1")
@ -310,21 +311,24 @@ function this.CheckFightOpenRule(fightId)
local star = FightLevelManager.GetAllChapterStars()
if star < rule[2] then
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)
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])
tips[index] = string.format("心魔试炼通关%s层", rule[2])-- 心魔试炼通关999层
btnTxts[index] = string.format("心魔试炼通关999层", 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])
tips[index] = string.format("鸿蒙阵共鸣等级达%s", rule[2])-- 鸿蒙阵共鸣%s级
btnTxts[index] = string.format("鸿蒙阵共鸣%s级", rule[2])
LogRed(tips[index]..", 当前:"..lv)
end
elseif rule[1] == 4 then
@ -334,13 +338,15 @@ function this.CheckFightOpenRule(fightId)
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)
btnTxts[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])
tips[index] = string.format("神将总好感度等级达%s", rule[2]) -- 总好感度%s级
btnTxts[index] = string.format("总好感度%s级", rule[2])
LogRed(tips[index]..", 当前:"..tlv)
end
elseif rule[1] == 6 then
@ -348,7 +354,8 @@ function this.CheckFightOpenRule(fightId)
local xyPassTimes = XiaoYaoManager.GetCurPassTimes()
if xyPassTimes < rule[2] then
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)
end
elseif rule[1] == 7 then
@ -357,24 +364,33 @@ function this.CheckFightOpenRule(fightId)
local num = #HeroManager.GetAllHeroDatas(c_lv)
if num < c_num then
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)
end
end
end
local tip = ""
local btnTxt = ""
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
-- 按钮显示文字
if btnTxt ~= "" then
btnTxt = tip..string.format(",且%s", btnTxts[index])
else
btnTxt = btnTxts[index]
end
end
end
return isOk, tip.."解锁"
return isOk, tip.."解锁", btnTxt
end
LogRed("当前没有限制条件2")
return true
@ -396,8 +412,9 @@ function this.GetBtnText()
return limitLevel .. Language[10056]
end
--
if not this.CheckFightOpenRule(this.curOpenFight) then
return "条件未达成"
local isOk, tip, btnTxt= this.CheckFightOpenRule(this.curOpenFight)
if not isOk then
return btnTxt
end
local offset = 1