副本
This commit is contained in:
parent
691d3f20bc
commit
4ecf8a87dd
@ -111,12 +111,12 @@ function ConfigManager:preLoadConfig()
|
||||
end
|
||||
handleMonsterGrow("monster_chapter")
|
||||
handleMonsterGrow("monster_daily_challenge")
|
||||
handleMonsterGrow("monster_dungeon_gold")
|
||||
handleMonsterGrow("monster_dungeon_shards")
|
||||
handleMonsterGrow("monster_dungeon_equip")
|
||||
handleMonsterGrow("monster_dungeon_armor")
|
||||
-- handleMonsterGrow("monster_dungeon_gold")
|
||||
-- handleMonsterGrow("monster_dungeon_shards")
|
||||
-- handleMonsterGrow("monster_dungeon_equip")
|
||||
-- handleMonsterGrow("monster_dungeon_armor")
|
||||
handleMonsterGrow("monster_activity")
|
||||
handleMonsterGrow("monster_dungeon_rune")
|
||||
handleMonsterGrow("monster_dungeon")
|
||||
|
||||
self.configs["monster"] = {
|
||||
data = monsterFullData,
|
||||
|
||||
@ -49,6 +49,8 @@ function DataManager:init()
|
||||
self:initManager("ActSprintSummonDataAll", "app/userdata/activity/act_sprint/act_sprint_summon_data_all")
|
||||
-- 特权卡
|
||||
self:initManager("PrivilegeCardData", "app/userdata/privilege_card/privilege_card_data")
|
||||
-- 日常副本
|
||||
self:initManager("DungeonDailyData", "app/userdata/dungeon/dungeon_daily_data")
|
||||
end
|
||||
|
||||
function DataManager:initManager(name, path)
|
||||
@ -179,6 +181,9 @@ function DataManager:initWithServerData(data)
|
||||
self.ActSprintData:init(data.activity_rush_exchange)
|
||||
self.ActSevenDayData:initData(data.seven_day)
|
||||
-- self.ActSprintSummonDataAll:initTaskData(data.activity_score_task, data.activity_task)
|
||||
-- 副本
|
||||
self.DungeonData:init()
|
||||
self.DungeonDailyData:init(data.dungeon)
|
||||
|
||||
-- 商店礼包都初始化完了后检查一下每日红点
|
||||
-- self.ShopData:checkShopDiscountRedPoint()
|
||||
|
||||
@ -107,7 +107,6 @@ ModuleManager.MODULE_KEY = {
|
||||
BEGINNER_GIFT = "new_player_gift", -- 新手礼包
|
||||
MAIL = "mail_open", -- 邮件
|
||||
DUNGEON_SHARDS = "dungeon_shards_open", -- 碎片副本
|
||||
DUNGEON_GOLD = "dungeon_gold_open", -- 金币副本
|
||||
INTRODUCT_GIFT = "introduct_gift", -- 入门礼包
|
||||
ARENA = "arena_open", -- 竞技场
|
||||
ARENA_GIFT = "act_arena_gift", -- 竞技场礼包
|
||||
@ -134,6 +133,8 @@ ModuleManager.MODULE_KEY = {
|
||||
ACT_SEVENDAY_2 = "act_sevenday_2",
|
||||
-- 免广告卡
|
||||
CARD_AD = "card_ad",
|
||||
DUNGEON_GOLD = "dungeon_gold", -- 金币副本
|
||||
DUNGEON_RES = "dungeon_res", -- 材料副本
|
||||
}
|
||||
|
||||
local _moduleMgrs = {}
|
||||
|
||||
@ -484,6 +484,34 @@ local const = {
|
||||
}
|
||||
}
|
||||
},
|
||||
["dungeon_show_reward"]={
|
||||
["reward"]={
|
||||
{
|
||||
["type"]=1,
|
||||
["type_for_nothing"]="Vw==",
|
||||
["id"]=1,
|
||||
["id_for_nothing"]="Vw==",
|
||||
["num"]=2,
|
||||
["num_for_nothing"]="VA=="
|
||||
},
|
||||
{
|
||||
["type"]=1,
|
||||
["type_for_nothing"]="Vw==",
|
||||
["id"]=2,
|
||||
["id_for_nothing"]="VA==",
|
||||
["num"]=1,
|
||||
["num_for_nothing"]="Vw=="
|
||||
},
|
||||
{
|
||||
["type"]=1,
|
||||
["type_for_nothing"]="Vw==",
|
||||
["id"]=12,
|
||||
["id_for_nothing"]="Vwo=",
|
||||
["num"]=1,
|
||||
["num_for_nothing"]="Vw=="
|
||||
}
|
||||
}
|
||||
},
|
||||
["daily_challenge_ads_double_rewards_limit"]={
|
||||
["value"]=2
|
||||
}
|
||||
|
||||
@ -902,6 +902,19 @@ local LocalizationGlobalConst =
|
||||
HERO_DESC_28 = "HERO_DESC_28",
|
||||
HERO_DESC_29 = "HERO_DESC_29",
|
||||
HERO_DESC_30 = "HERO_DESC_30",
|
||||
DUNGEON_TITLE_1 = "DUNGEON_TITLE_1",
|
||||
DUNGEON_TITLE_2 = "DUNGEON_TITLE_2",
|
||||
DUNGEON_TITLE_3 = "DUNGEON_TITLE_3",
|
||||
DUNGEON_HELP_1 = "DUNGEON_HELP_1",
|
||||
DUNGEON_HELP_2 = "DUNGEON_HELP_2",
|
||||
DUNGEON_HELP_3 = "DUNGEON_HELP_3",
|
||||
DUNGEON_DESC_1 = "DUNGEON_DESC_1",
|
||||
DUNGEON_DESC_2 = "DUNGEON_DESC_2",
|
||||
DUNGEON_DESC_3 = "DUNGEON_DESC_3",
|
||||
DUNGEON_DESC_4 = "DUNGEON_DESC_4",
|
||||
CHEAT_1 = "CHEAT_1",
|
||||
BATTLE_DESC_18 = "BATTLE_DESC_18",
|
||||
CHALLENGE_TEAM_10 = "CHALLENGE_TEAM_10",
|
||||
}
|
||||
|
||||
return LocalizationGlobalConst
|
||||
1206
lua/app/config/strings/cn/chapter_dungeon.lua
Normal file
1206
lua/app/config/strings/cn/chapter_dungeon.lua
Normal file
File diff suppressed because it is too large
Load Diff
@ -1,5 +1,5 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 93a0a9d95d4774c49b001c3108e5a61c
|
||||
guid: 3964bac270fcd4c9890caf5a9fdf865e
|
||||
ScriptedImporter:
|
||||
internalIDToNameTable: []
|
||||
externalObjects: {}
|
||||
@ -874,8 +874,6 @@ local localization_global =
|
||||
["PRIVILEGE_CARD_NAME_1"] = "每日福利",
|
||||
["PRIVILEGE_CARD_NAME_2"] = "永久免广告卡",
|
||||
["PRIVILEGE_CARD_NAME_3"] = "月卡",
|
||||
-- ["PRIVILEGE_CARD_NAME_4"] = "终身卡",
|
||||
-- ["PRIVILEGE_CARD_NAME_5"] = "挑战征服卡",
|
||||
["PRIVILEGE_CARD_DESC_1"] = "已累计{0}天",
|
||||
["PRIVILEGE_CARD_DESC_2"] = "永久免广告特权",
|
||||
["PRIVILEGE_CARD_DESC_3"] = "购买后立即获得",
|
||||
@ -883,11 +881,6 @@ local localization_global =
|
||||
["PRIVILEGE_CARD_DESC_5"] = "免费刷新齿轮次数+1",
|
||||
["PRIVILEGE_CARD_DESC_6"] = "解锁快速挂机不限次",
|
||||
["PRIVILEGE_CARD_DESC_7"] = "每天领取大量钻石",
|
||||
-- ["PRIVILEGE_CARD_DESC_8"] = "每天获得巨量钻石",
|
||||
-- ["PRIVILEGE_CARD_DESC_9"] = "立得终身卡头像框",
|
||||
-- ["PRIVILEGE_CARD_DESC_10"] = "体力上限+20",
|
||||
-- ["PRIVILEGE_CARD_DESC_11"] = "{0}挑战次数+{1}",
|
||||
-- ["PRIVILEGE_CARD_DESC_12"] = "购买月卡可解锁3倍速",
|
||||
["STAR_UNLOCK"] = "{0}星解锁",
|
||||
["HERO_DESC_24"] = "升级将提升全体属性",
|
||||
["HERO_DESC_25"] = "属性提升",
|
||||
@ -896,6 +889,15 @@ local localization_global =
|
||||
["HERO_DESC_28"] = "英雄攻击加成",
|
||||
["HERO_DESC_29"] = "当前加成",
|
||||
["HERO_DESC_30"] = "全局增益",
|
||||
["DUNGEON_TITLE_1"] = "试炼之塔",
|
||||
["DUNGEON_HELP_1"] = "<b>试炼之塔</b>\n\n<b>玩法规则:</b>\n\n<b>进度继承:</b> 每次从历史最高层开始挑战。\n<b>随机强化:</b> 怪物初始携带随机效果,每通关 1 层随机提升 1 个效果等级(最多强化 6 次)。\n<b>阵容随机:</b> 每层怪物组合动态变化。\n<b>属性递增:</b> 怪物血量、攻击力随层数提升。\n<b>通关奖励:</b> 每层通关后结算发放水晶、幸运币(用于能力强化)。\n<b>技能选择:</b> 前 10 层每关可选择 2 次技能。",
|
||||
["DUNGEON_DESC_1"] = "今日次数{0}/{1}",
|
||||
["DUNGEON_DESC_2"] = "是否消耗{0}钻石购买",
|
||||
["DUNGEON_DESC_3"] = "扫荡",
|
||||
["DUNGEON_DESC_4"] = "战况",
|
||||
["CHEAT_1"] = "战斗数据异常",
|
||||
["BATTLE_DESC_18"] = "挑战",
|
||||
["CHALLENGE_TEAM_10"] = "通过上一个难度解锁",
|
||||
}
|
||||
|
||||
return localization_global
|
||||
@ -250,6 +250,8 @@ GConst.ATLAS_PATH = {
|
||||
UI_TALENT = "assets/arts/atlas/ui/talent.asset",
|
||||
UI_SUMMON = "assets/arts/atlas/ui/summon.asset",
|
||||
ICON_SUMMON = "assets/arts/atlas/icon/hero_summon.asset",
|
||||
UI_SUPPLY = "assets/arts/atlas/ui/supply.asset",
|
||||
UI_DUNGEON = "assets/arts/atlas/ui/dungeon.asset",
|
||||
}
|
||||
|
||||
GConst.TOUCH_EVENT = {
|
||||
|
||||
@ -6,11 +6,14 @@ function BattleControllerDungeonGold:getBoardConfig()
|
||||
end
|
||||
|
||||
function BattleControllerDungeonGold:getChapterConfig()
|
||||
return ConfigManager:getConfig("chapter_dungeon_gold")
|
||||
return ConfigManager:getConfig("chapter_dungeon")
|
||||
end
|
||||
|
||||
function BattleControllerDungeonGold:getChapterId()
|
||||
return DataManager.DungeonData:getCurFightChapterId()
|
||||
if self._chapterId == nil then
|
||||
self._chapterId = DataManager.DungeonDailyData:getCurrChallengeChapterId()
|
||||
end
|
||||
return self._chapterId
|
||||
end
|
||||
|
||||
function BattleControllerDungeonGold:refreshWave()
|
||||
@ -89,9 +92,10 @@ function BattleControllerDungeonGold:postWaveOver(atkDead, isQuit)
|
||||
|
||||
local duration = self.waveDurationTime
|
||||
local totalTime = self.totalDurationTime
|
||||
local startTimes = DataManager.DungeonData:getTotalCount(ModuleManager.MODULE_KEY.DUNGEON_GOLD, self.chapterId)
|
||||
-- local startTimes = DataManager.DungeonData:getTotalCount(ModuleManager.MODULE_KEY.DUNGEON_GOLD, self.chapterId)
|
||||
local isFirstWin = false
|
||||
if DataManager.DungeonData:getPassedMaxId(ModuleManager.MODULE_KEY.DUNGEON_GOLD) < self.chapterId and self.victory then
|
||||
local maxPassedId = DataManager.DungeonDailyData.GoldData:getMaxPassedId()
|
||||
if maxPassedId < self.chapterId and self.victory then
|
||||
isFirstWin = true
|
||||
end
|
||||
|
||||
@ -101,8 +105,9 @@ function BattleControllerDungeonGold:postWaveOver(atkDead, isQuit)
|
||||
end
|
||||
|
||||
function BattleControllerDungeonGold:postFightStart()
|
||||
local unlockMaxChapter = DataManager.DungeonData:getUnlockMaxId(ModuleManager.MODULE_KEY.DUNGEON_GOLD)
|
||||
BIReport:postFightBegin(GConst.BattleConst.BATTLE_TYPE.DUNGEON_GOLD, self:getWaveIndex(), self.chapterId, unlockMaxChapter, DataManager.DungeonData:getTotalCount(ModuleManager.MODULE_KEY.DUNGEON_GOLD, self.chapterId))
|
||||
-- local startTimes = DataManager.DungeonData:getTotalCount(ModuleManager.MODULE_KEY.DUNGEON_GOLD, self.chapterId)
|
||||
local maxPassedId = DataManager.DungeonDailyData.GoldData:getMaxPassedId()
|
||||
BIReport:postFightBegin(GConst.BattleConst.BATTLE_TYPE.DUNGEON_GOLD, self:getWaveIndex(), self.chapterId, maxPassedId, startTimes)
|
||||
end
|
||||
|
||||
return BattleControllerDungeonGold
|
||||
@ -1,9 +1,60 @@
|
||||
local DungeonConst = {}
|
||||
|
||||
-- 副本类型类型
|
||||
DungeonConst.TYPE = {
|
||||
WEAPON = 1, -- 武器副本
|
||||
ARMOR = 2, -- 防具副本
|
||||
DungeonConst.MODULE_KEY_DUNGEON_DAILY = "dungeon_daily"
|
||||
|
||||
DungeonConst.DUNGEON_DAILY_TYPE = {
|
||||
GOLD = 1,
|
||||
MATERIAL = 2
|
||||
}
|
||||
|
||||
-- 对应dungeon表id
|
||||
DungeonConst.IDS = {
|
||||
[DungeonConst.MODULE_KEY_DUNGEON_DAILY] = 1,
|
||||
}
|
||||
|
||||
-- 标题
|
||||
DungeonConst.STR_TITLE = {
|
||||
[DungeonConst.MODULE_KEY_DUNGEON_DAILY] = I18N.GlobalConst.DUNGEON_TITLE_1,
|
||||
}
|
||||
|
||||
-- 帮助信息
|
||||
DungeonConst.STR_HELP = {
|
||||
[DungeonConst.MODULE_KEY_DUNGEON_DAILY] = I18N.GlobalConst.DUNGEON_HELP_1,
|
||||
}
|
||||
|
||||
-- banner名称
|
||||
DungeonConst.IMG_BANNER = {
|
||||
[DungeonConst.MODULE_KEY_DUNGEON_DAILY] = "supply_banner_1",
|
||||
}
|
||||
|
||||
-- 副本排行榜类型,客户端自定义
|
||||
DungeonConst.RANK_TYPE = {
|
||||
TOWER = 1,
|
||||
WORLD_BOSS = 2,
|
||||
DOOR = 3,
|
||||
PRISON_PHYSICS = 4,
|
||||
PRISON_WIND = 5,
|
||||
PRISON_LIGHT = 6,
|
||||
PRISON_FIRE = 7,
|
||||
PRISON_ELECTRIC = 8,
|
||||
PRISON_ICE = 9,
|
||||
ELITE_CHALLENGE = 10,
|
||||
ELEMENT_DUNGEON = 11,
|
||||
}
|
||||
|
||||
-- 排行榜名称
|
||||
DungeonConst.RANK_NAME = {
|
||||
[DungeonConst.RANK_TYPE.TOWER] = I18N.GlobalConst.DUNGEON_TITLE_1,
|
||||
[DungeonConst.RANK_TYPE.WORLD_BOSS] = I18N.GlobalConst.DUNGEON_TITLE_2,
|
||||
[DungeonConst.RANK_TYPE.DOOR] = I18N.GlobalConst.DUNGEON_TITLE_3,
|
||||
[DungeonConst.RANK_TYPE.PRISON_PHYSICS] = I18N.GlobalConst.PRISON_NAME_1,
|
||||
[DungeonConst.RANK_TYPE.PRISON_WIND] = I18N.GlobalConst.PRISON_NAME_2,
|
||||
[DungeonConst.RANK_TYPE.PRISON_LIGHT] = I18N.GlobalConst.PRISON_NAME_3,
|
||||
[DungeonConst.RANK_TYPE.PRISON_FIRE] = I18N.GlobalConst.PRISON_NAME_4,
|
||||
[DungeonConst.RANK_TYPE.PRISON_ELECTRIC] = I18N.GlobalConst.PRISON_NAME_5,
|
||||
[DungeonConst.RANK_TYPE.PRISON_ICE] = I18N.GlobalConst.PRISON_NAME_6,
|
||||
[DungeonConst.RANK_TYPE.ELITE_CHALLENGE] = I18N.GlobalConst.DUNGEON_TITLE_1,
|
||||
[DungeonConst.RANK_TYPE.ELEMENT_DUNGEON] = I18N.GlobalConst.ELEMENTAL_DUNGEON_TITLE,
|
||||
}
|
||||
|
||||
return DungeonConst
|
||||
@ -1,32 +1,40 @@
|
||||
local DungeonManager = class("DungeonManager", BaseModule)
|
||||
|
||||
--region UI
|
||||
function DungeonManager:showDungeonDaylyMainUI(page)
|
||||
local params = {
|
||||
page = page or GConst.DungeonConst.DUNGEON_DAILY_TYPE.GOLD
|
||||
}
|
||||
UIManager:showUI("app/ui/dungeon/dungeon_daily_main_ui", params)
|
||||
end
|
||||
|
||||
-- function DungeonManager:showRankUI(showPage, rankList, rankSelf)
|
||||
-- local params = {
|
||||
-- showPage = showPage,
|
||||
-- rankList = rankList,
|
||||
-- rankSelf = rankSelf,
|
||||
-- }
|
||||
-- UIManager:showUI("app/ui/rank/rank_ui", params)
|
||||
-- end
|
||||
|
||||
-- function DungeonManager:showRankRewardUI(showModule)
|
||||
-- local params = {
|
||||
-- showModule = showModule,
|
||||
-- }
|
||||
-- UIManager:showUI("app/ui/rank/rank_reward_ui", params)
|
||||
-- end
|
||||
--endregion
|
||||
|
||||
-- 外部接口--------------------------------------------------------------------------
|
||||
|
||||
-- 挑战
|
||||
function DungeonManager:reqChallenge(module, id)
|
||||
if module == ModuleManager.MODULE_KEY.DUNGEON_GOLD then
|
||||
self:reqChallengeGold(id)
|
||||
elseif module == ModuleManager.MODULE_KEY.DUNGEON_SHARDS then
|
||||
self:reqChallengeShards(id)
|
||||
end
|
||||
end
|
||||
|
||||
-- 结算
|
||||
function DungeonManager:reqEndChallenge(module, id)
|
||||
if module == ModuleManager.MODULE_KEY.DUNGEON_GOLD then
|
||||
self:reqEndChallengeGold(id)
|
||||
elseif module == ModuleManager.MODULE_KEY.DUNGEON_SHARDS then
|
||||
self:reqEndChallengeShards(id)
|
||||
end
|
||||
end
|
||||
|
||||
-- 扫荡
|
||||
function DungeonManager:reqSweep(module, id)
|
||||
if module == ModuleManager.MODULE_KEY.DUNGEON_GOLD then
|
||||
self:reqSweepGold(id)
|
||||
elseif module == ModuleManager.MODULE_KEY.DUNGEON_SHARDS then
|
||||
self:reqSweepShards(id)
|
||||
end
|
||||
-- if module == ModuleManager.MODULE_KEY.DUNGEON_GOLD then
|
||||
-- self:reqSweepGold(id)
|
||||
-- elseif module == ModuleManager.MODULE_KEY.DUNGEON_RES then
|
||||
-- self:reqSweepShards(id)
|
||||
-- end
|
||||
end
|
||||
|
||||
-- 内部接口--------------------------------------------------------------------------
|
||||
@ -44,64 +52,96 @@ function DungeonManager:checkDayChange()
|
||||
end
|
||||
|
||||
-- 请求挑战金币副本
|
||||
function DungeonManager:reqChallengeGold(id)
|
||||
local moduleKey = ModuleManager.MODULE_KEY.DUNGEON_GOLD
|
||||
-- 判断次数
|
||||
if DataManager.DungeonData:getRemainTimes(moduleKey) <= 0 then
|
||||
function DungeonManager:onDungeonStartReq(id)
|
||||
local params = {
|
||||
id = id,
|
||||
}
|
||||
local dungeonDailyType = DataManager.DungeonDailyData:getDungeonDailyTypeByChapterId(id)
|
||||
local ticketCount = 0
|
||||
if dungeonDailyType == GConst.DungeonConst.DUNGEON_DAILY_TYPE.GOLD then
|
||||
local remainTimes = DataManager.DungeonDailyData.GoldData:getTodayRemainTimes()
|
||||
ticketCount = DataManager.BagData.ItemData:getItemNumById(GConst.ItemConst.ITEM_ID_DUNGEON_TICKET_1)
|
||||
if remainTimes <= 0 and ticketCount <= 0 then
|
||||
GFunc.showToast(I18N:getGlobalText(I18N.GlobalConst.DAILY_CHALLENGE_DESC_1))
|
||||
return
|
||||
end
|
||||
|
||||
-- 判断体力
|
||||
if not DataManager.DungeonData:isEnoughHp(moduleKey) then
|
||||
GFunc.showItemNotEnough(GConst.ItemConst.ITEM_ID_VIT)
|
||||
ModuleManager.CommerceManager:showBuyVitUI()
|
||||
elseif dungeonDailyType == GConst.DungeonConst.DUNGEON_DAILY_TYPE.MATERIAL then
|
||||
local remainTimes = DataManager.DungeonDailyData.MaterialData:getTodayRemainTimes()
|
||||
ticketCount = DataManager.BagData.ItemData:getItemNumById(GConst.ItemConst.ITEM_ID_DUNGEON_TICKET_2)
|
||||
if remainTimes <= 0 and ticketCount <= 0 then
|
||||
GFunc.showToast(I18N:getGlobalText(I18N.GlobalConst.DAILY_CHALLENGE_DESC_1))
|
||||
return
|
||||
end
|
||||
|
||||
if not DataManager.DungeonData:isCanChallenge(moduleKey) then
|
||||
else
|
||||
return
|
||||
end
|
||||
|
||||
local parmas = {chapter_gold_id = id}
|
||||
self:sendMessage(ProtoMsgType.FromMsgEnum.ChapterGoldChallengeStartReq, parmas, self.respChallengeGold, BIReport.ITEM_GET_TYPE.DUNGEON_GOLD_CHALLENGE)
|
||||
local itemGetType = dungeonDailyType == GConst.DungeonConst.DUNGEON_DAILY_TYPE.GOLD and BIReport.ITEM_GET_TYPE.ENTER_DUNGEON_DAILY_GOLD_BATTLE or BIReport.ITEM_GET_TYPE.ENTER_DUNGEON_DAILY_MATERIAL_BATTLE
|
||||
self:sendMessage(ProtoMsgType.FromMsgEnum.DungeonStartReq, params, self.onDungeonStartRsp, itemGetType)
|
||||
end
|
||||
|
||||
-- 响应挑战金币副本
|
||||
function DungeonManager:respChallengeGold(result)
|
||||
if result.err_code == GConst.ERROR_STR.SUCCESS then
|
||||
DataManager.DungeonData:onFightCountReduce(ModuleManager.MODULE_KEY.DUNGEON_GOLD)
|
||||
DataManager.DungeonData:setCurFightChapterId(result.reqData.chapter_gold_id)
|
||||
ModuleManager.BattleManager:playBattle(GConst.BattleConst.BATTLE_TYPE.DUNGEON_GOLD)
|
||||
EventManager:dispatchEvent(EventManager.CUSTOM_EVENT.DUNGEON_CHALLENGE)
|
||||
function DungeonManager:onDungeonStartRsp(result)
|
||||
if result.err_code ~= GConst.ERROR_STR.SUCCESS then
|
||||
return
|
||||
end
|
||||
DataManager.DungeonDailyData:setCurrChallengeChapterId(result.reqData.id)
|
||||
local dungeonDailyType = DataManager.DungeonDailyData:getDungeonDailyTypeByChapterId(result.reqData.id)
|
||||
ModuleManager.BattleManager:playBattle(GConst.BattleConst.BATTLE_TYPE.DUNGEON_GOLD, nil, function()
|
||||
UIManager:closeAllUI()
|
||||
ModuleManager.MaincityManager:showMainCityUI(GConst.MainCityConst.BOTTOM_PAGE.DUNGEON)
|
||||
ModuleManager.DungeonManager:showDungeonDaylyMainUI(dungeonDailyType)
|
||||
end)
|
||||
-- end, nil, {dungeonType = dungeonDailyType})
|
||||
end
|
||||
|
||||
-- 请求结算金币副本
|
||||
function DungeonManager:reqEndChallengeGold(id, combatReport, taskProgress, totalDamage, remainingHp)
|
||||
local parmas = {
|
||||
function DungeonManager:reqEndChallengeGold(chapterId, combatReport, taskProgress, totalDamage, remainingHp)
|
||||
-- local parmas = {
|
||||
-- win = combatReport.victory,
|
||||
-- total_damage = totalDamage,
|
||||
-- remaining_hp = remainingHp,
|
||||
-- chapter_gold_id = id,
|
||||
-- task_stat = taskProgress,
|
||||
-- combatReport = combatReport,
|
||||
-- }
|
||||
-- self:sendMessage(ProtoMsgType.FromMsgEnum.ChapterGoldChallengeSettlementReq, parmas, self.respEndChallengeGold, BIReport.ITEM_GET_TYPE.DUNGEON_GOLD_END)
|
||||
|
||||
local params = {
|
||||
id = chapterId,
|
||||
win = combatReport.victory,
|
||||
total_damage = totalDamage,
|
||||
remaining_hp = remainingHp,
|
||||
chapter_gold_id = id,
|
||||
cheat = false,
|
||||
task_stat = taskProgress,
|
||||
combatReport = combatReport,
|
||||
}
|
||||
self:sendMessage(ProtoMsgType.FromMsgEnum.ChapterGoldChallengeSettlementReq, parmas, self.respEndChallengeGold, BIReport.ITEM_GET_TYPE.DUNGEON_GOLD_END)
|
||||
local dungeonDailyType = DataManager.DungeonDailyData:getDungeonDailyTypeByChapterId(chapterId)
|
||||
local itemGetType = dungeonDailyType == GConst.DungeonConst.DUNGEON_DAILY_TYPE.GOLD and BIReport.ITEM_GET_TYPE.FINISH_DUNGEON_DAILY_GOLD_BATTLE or BIReport.ITEM_GET_TYPE.FINISH_DUNGEON_DAILY_MATERIAL_BATTLE
|
||||
self:sendMessage(ProtoMsgType.FromMsgEnum.DungeonSettlementReq, params, self.respEndChallengeGold, itemGetType)
|
||||
end
|
||||
|
||||
-- 响应结算金币副本
|
||||
function DungeonManager:respEndChallengeGold(result)
|
||||
if result.err_code == GConst.ERROR_STR.SUCCESS then
|
||||
local passId = DataManager.DungeonData:getPassedMaxId(ModuleManager.MODULE_KEY.DUNGEON_GOLD)
|
||||
DataManager.DungeonData:initDungeonGold(result.gold_challenge)
|
||||
if result.err_code == GConst.ERROR_STR.BATTLE_CHEATER then
|
||||
ModuleManager.BattleManager:exitBattle()
|
||||
local params = {
|
||||
content = I18N:getGlobalText(I18N.GlobalConst.CHEAT_1),
|
||||
boxType = GConst.MESSAGE_BOX_TYPE.MB_OK,
|
||||
okText = I18N:getGlobalText(I18N.GlobalConst.BTN_TEXT_OK),
|
||||
}
|
||||
GFunc.showMessageBox(params)
|
||||
return
|
||||
elseif result.err_code ~= GConst.ERROR_STR.SUCCESS then
|
||||
return
|
||||
end
|
||||
local chapterId = result.reqData.id
|
||||
local victory = result.reqData.win
|
||||
DataManager.DungeonDailyData:onFightDungeonDailyFinish(chapterId, victory)
|
||||
ModuleManager.BattleManager:showBattleResultUI(GConst.BattleConst.BATTLE_TYPE.DUNGEON_GOLD, result.rewards, result.reqData.combatReport)
|
||||
|
||||
if passId ~= DataManager.DungeonData:getPassedMaxId(ModuleManager.MODULE_KEY.DUNGEON_GOLD) then
|
||||
local data = {}
|
||||
data.dungeon_progress = DataManager.DungeonData:getDungeonBIStr()
|
||||
CS.ThinkingAnalytics.ThinkingAnalyticsAPI.UserSet(data)
|
||||
end
|
||||
-- if passId ~= DataManager.DungeonData:getPassedMaxId(ModuleManager.MODULE_KEY.DUNGEON_GOLD) then
|
||||
-- local data = {}
|
||||
-- data.dungeon_progress = DataManager.DungeonData:getDungeonBIStr()
|
||||
-- CS.ThinkingAnalytics.ThinkingAnalyticsAPI.UserSet(data)
|
||||
-- end
|
||||
|
||||
if result.reqData then
|
||||
local taskStat = result.reqData.task_stat
|
||||
@ -112,149 +152,55 @@ function DungeonManager:respEndChallengeGold(result)
|
||||
ModuleManager.TaskManager:addFightTaskProgress(taskStat)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
-- 请求扫荡金币副本
|
||||
function DungeonManager:reqSweepGold(id)
|
||||
local moduleKey = ModuleManager.MODULE_KEY.DUNGEON_GOLD
|
||||
-- 判断次数
|
||||
if DataManager.DungeonData:getRemainTimes(moduleKey) <= 0 then
|
||||
function DungeonManager:sweepDungeonDaily(id)
|
||||
local params = {
|
||||
id = id,
|
||||
}
|
||||
local dungeonDailyType = DataManager.DungeonDailyData:getDungeonDailyTypeByChapterId(id)
|
||||
if dungeonDailyType == GConst.DungeonConst.DUNGEON_DAILY_TYPE.GOLD then
|
||||
local remainTimes = DataManager.DungeonDailyData.GoldData:getTodayRemainTimes()
|
||||
local ticketCount = DataManager.BagData.ItemData:getItemNumById(GConst.ItemConst.DUNGEON_TICKET_1)
|
||||
if remainTimes <= 0 and ticketCount <= 0 then
|
||||
GFunc.showToast(I18N:getGlobalText(I18N.GlobalConst.DAILY_CHALLENGE_DESC_1))
|
||||
return
|
||||
end
|
||||
|
||||
-- 判断体力
|
||||
if not DataManager.DungeonData:isEnoughHp(moduleKey) then
|
||||
GFunc.showItemNotEnough(GConst.ItemConst.ITEM_ID_VIT)
|
||||
ModuleManager.CommerceManager:showBuyVitUI()
|
||||
elseif dungeonDailyType == GConst.DungeonConst.DUNGEON_DAILY_TYPE.MATERIAL then
|
||||
local remainTimes = DataManager.DungeonDailyData.MaterialData:getTodayRemainTimes()
|
||||
local ticketCount = DataManager.BagData.ItemData:getItemNumById(GConst.ItemConst.DUNGEON_TICKET_2)
|
||||
if remainTimes <= 0 and ticketCount <= 0 then
|
||||
GFunc.showToast(I18N:getGlobalText(I18N.GlobalConst.DAILY_CHALLENGE_DESC_1))
|
||||
return
|
||||
end
|
||||
|
||||
if not DataManager.DungeonData:isCanChallenge(moduleKey) then
|
||||
else
|
||||
return
|
||||
end
|
||||
|
||||
local parmas = {
|
||||
chapter_gold_id = id,
|
||||
}
|
||||
self:sendMessage(ProtoMsgType.FromMsgEnum.ChapterGoldChallengeFarmReq, parmas, self.respSweepGold, BIReport.ITEM_GET_TYPE.DUNGEON_GOLD_SWEEP)
|
||||
local itemGetType = dungeonDailyType == GConst.DungeonConst.DUNGEON_DAILY_TYPE.GOLD and BIReport.ITEM_GET_TYPE.SWEEP_DUNGEON_DAILY_GOLD_BATTLE or BIReport.ITEM_GET_TYPE.SWEEP_DUNGEON_DAILY_MATERIAL_BATTLE
|
||||
self:sendMessage(ProtoMsgType.FromMsgEnum.DungeonSweepReq, params, self.onSweepDungeonDailyFinish, itemGetType)
|
||||
end
|
||||
|
||||
-- 响应扫荡金币副本
|
||||
function DungeonManager:respSweepGold(result)
|
||||
if result.err_code == GConst.ERROR_STR.SUCCESS then
|
||||
DataManager.DungeonData:onFightCountReduce(ModuleManager.MODULE_KEY.DUNGEON_GOLD)
|
||||
function DungeonManager:onSweepDungeonDailyFinish(result)
|
||||
if result.err_code ~= GConst.ERROR_STR.SUCCESS then
|
||||
return
|
||||
end
|
||||
if result.rewards then
|
||||
GFunc.showRewardBox(result.rewards)
|
||||
EventManager:dispatchEvent(EventManager.CUSTOM_EVENT.DUNGEON_SWEEP)
|
||||
end
|
||||
DataManager.DungeonDailyData:onSweepDungeonDailyFinish(result.reqData.id)
|
||||
ModuleManager.TaskManager:addTaskProgress(GConst.TaskConst.TASK_TYPE.CHALLENGE_DAILY_NUM_SINGLE, 1)
|
||||
end
|
||||
|
||||
-- 请求挑战碎片副本
|
||||
function DungeonManager:reqChallengeShards(id)
|
||||
local moduleKey = ModuleManager.MODULE_KEY.DUNGEON_SHARDS
|
||||
-- 判断次数
|
||||
if DataManager.DungeonData:getRemainTimes(moduleKey) <= 0 then
|
||||
GFunc.showToast(I18N:getGlobalText(I18N.GlobalConst.DAILY_CHALLENGE_DESC_1))
|
||||
return
|
||||
end
|
||||
|
||||
-- 判断体力
|
||||
if not DataManager.DungeonData:isEnoughHp(moduleKey) then
|
||||
GFunc.showItemNotEnough(GConst.ItemConst.ITEM_ID_VIT)
|
||||
ModuleManager.CommerceManager:showBuyVitUI()
|
||||
return
|
||||
end
|
||||
|
||||
if not DataManager.DungeonData:isCanChallenge(moduleKey) then
|
||||
return
|
||||
end
|
||||
|
||||
local parmas = {chapter_shards_id = id}
|
||||
self:sendMessage(ProtoMsgType.FromMsgEnum.ChapterShardsChallengeStartReq, parmas, self.respChallengeShards, BIReport.ITEM_GET_TYPE.DUNGEON_SHARDS_CHALLENGE)
|
||||
end
|
||||
|
||||
-- 响应挑战碎片副本
|
||||
function DungeonManager:respChallengeShards(result)
|
||||
if result.err_code == GConst.ERROR_STR.SUCCESS then
|
||||
DataManager.DungeonData:onFightCountReduce(ModuleManager.MODULE_KEY.DUNGEON_SHARDS)
|
||||
DataManager.DungeonData:setCurFightChapterId(result.reqData.chapter_shards_id)
|
||||
ModuleManager.BattleManager:playBattle(GConst.BattleConst.BATTLE_TYPE.DUNGEON_SHARDS)
|
||||
EventManager:dispatchEvent(EventManager.CUSTOM_EVENT.DUNGEON_CHALLENGE)
|
||||
end
|
||||
end
|
||||
|
||||
-- 请求结算碎片副本
|
||||
function DungeonManager:reqEndChallengeShards(id, combatReport, taskProgress, totalDamage)
|
||||
local parmas = {
|
||||
win = combatReport.victory,
|
||||
total_damage = totalDamage,
|
||||
chapter_shards_id = id,
|
||||
task_stat = taskProgress,
|
||||
combatReport = combatReport,
|
||||
}
|
||||
self:sendMessage(ProtoMsgType.FromMsgEnum.ChapterShardsChallengeSettlementReq, parmas, self.respEndChallengeShards, BIReport.ITEM_GET_TYPE.DUNGEON_SHARDS_END)
|
||||
end
|
||||
|
||||
-- 响应结算碎片副本
|
||||
function DungeonManager:respEndChallengeShards(result)
|
||||
if result.err_code == GConst.ERROR_STR.SUCCESS then
|
||||
local passId = DataManager.DungeonData:getPassedMaxId(ModuleManager.MODULE_KEY.DUNGEON_SHARDS)
|
||||
DataManager.DungeonData:initDungeonShards(result.shards_challenge)
|
||||
local newRewards = {}
|
||||
GFunc.mergeRewards2(result.rewards, newRewards, true)
|
||||
ModuleManager.BattleManager:showBattleResultUI(GConst.BattleConst.BATTLE_TYPE.DUNGEON_SHARDS, newRewards, result.reqData and result.reqData.combatReport or {}, nil, nil, true)
|
||||
|
||||
if passId ~= DataManager.DungeonData:getPassedMaxId(ModuleManager.MODULE_KEY.DUNGEON_SHARDS) then
|
||||
local data = {}
|
||||
data.dungeon_progress = DataManager.DungeonData:getDungeonBIStr()
|
||||
CS.ThinkingAnalytics.ThinkingAnalyticsAPI.UserSet(data)
|
||||
end
|
||||
|
||||
if result.reqData then
|
||||
local taskStat = result.reqData.task_stat
|
||||
if taskStat then
|
||||
taskStat[GConst.BattleConst.BATTLE_TASK_FIELD.KILL_BOSS] = 0 -- boss不算
|
||||
taskStat[GConst.BattleConst.BATTLE_TASK_FIELD.KILL_NORMAL_MONSTER] = 0 -- 击杀小怪数量不算
|
||||
ModuleManager.TaskManager:addFightTaskProgress(taskStat)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
-- 请求扫荡碎片副本
|
||||
function DungeonManager:reqSweepShards(id)
|
||||
local moduleKey = ModuleManager.MODULE_KEY.DUNGEON_SHARDS
|
||||
-- 判断次数
|
||||
if DataManager.DungeonData:getRemainTimes(moduleKey) <= 0 then
|
||||
GFunc.showToast(I18N:getGlobalText(I18N.GlobalConst.DAILY_CHALLENGE_DESC_1))
|
||||
return
|
||||
end
|
||||
|
||||
-- 判断体力
|
||||
if not DataManager.DungeonData:isEnoughHp(moduleKey) then
|
||||
GFunc.showItemNotEnough(GConst.ItemConst.ITEM_ID_VIT)
|
||||
ModuleManager.CommerceManager:showBuyVitUI()
|
||||
return
|
||||
end
|
||||
|
||||
if not DataManager.DungeonData:isCanChallenge(moduleKey) then
|
||||
return
|
||||
end
|
||||
|
||||
local parmas = {
|
||||
chapter_shards_id = id,
|
||||
}
|
||||
self:sendMessage(ProtoMsgType.FromMsgEnum.ChapterShardsChallengeFarmReq, parmas, self.respSweepShards, BIReport.ITEM_GET_TYPE.DUNGEON_SHARDS_SWEEP)
|
||||
end
|
||||
|
||||
-- 响应扫荡碎片副本
|
||||
function DungeonManager:respSweepShards(result)
|
||||
if result.err_code == GConst.ERROR_STR.SUCCESS then
|
||||
DataManager.DungeonData:onFightCountReduce(ModuleManager.MODULE_KEY.DUNGEON_SHARDS)
|
||||
GFunc.showRewardBox(result.rewards)
|
||||
EventManager:dispatchEvent(EventManager.CUSTOM_EVENT.DUNGEON_SWEEP)
|
||||
end
|
||||
end
|
||||
--region 上报
|
||||
-- 日常副本
|
||||
BIReport.ITEM_GET_TYPE.ENTER_DUNGEON_DAILY_GOLD_BATTLE = "enter_dungeon_daily_gold_battle" -- 进入金币副本
|
||||
BIReport.ITEM_GET_TYPE.FINISH_DUNGEON_DAILY_GOLD_BATTLE = "finish_dungeon_daily_gold_battle" -- 结算金币副本
|
||||
BIReport.ITEM_GET_TYPE.SWEEP_DUNGEON_DAILY_GOLD_BATTLE = "sweep_dungeon_daily_gold_battle" -- 扫荡金币副本
|
||||
BIReport.ITEM_GET_TYPE.ENTER_DUNGEON_DAILY_MATERIAL_BATTLE = "enter_dungeon_daily_material_battle" -- 进入材料副本
|
||||
BIReport.ITEM_GET_TYPE.FINISH_DUNGEON_DAILY_MATERIAL_BATTLE = "finish_dungeon_daily_material_battle" -- 结算材料副本
|
||||
BIReport.ITEM_GET_TYPE.SWEEP_DUNGEON_DAILY_MATERIAL_BATTLE = "sweep_dungeon_daily_material_battle" -- 扫荡材料副本
|
||||
--endregion
|
||||
|
||||
return DungeonManager
|
||||
@ -26,6 +26,8 @@ ItemConst.ITEM_ID_GLOD_WING = 49
|
||||
ItemConst.ITEM_ID_SLIVER_WING = 50
|
||||
ItemConst.ITEM_ID_RUNES = 55
|
||||
ItemConst.ITEM_ID_FULL_MOON = 56
|
||||
ItemConst.ITEM_ID_DUNGEON_TICKET_1 = 1
|
||||
ItemConst.ITEM_ID_DUNGEON_TICKET_2 = 1
|
||||
|
||||
ItemConst.ITEM_TYPE = {
|
||||
RES = 1,
|
||||
|
||||
@ -11,16 +11,11 @@ function HeroCell:init()
|
||||
self.lvTx = uiMap["hero_cell.hero_bg.lv_tx"]
|
||||
-- 个人节点
|
||||
self.selfNode = uiMap["hero_cell.hero_bg.self_node"]
|
||||
self.progressBg = uiMap["hero_cell.hero_bg.self_node.progress_bg"]
|
||||
self.progress = uiMap["hero_cell.hero_bg.self_node.progress_bg.progress"]
|
||||
self.progressTx = uiMap["hero_cell.hero_bg.self_node.progress_bg.progress_tx"]
|
||||
self.unlockTx = uiMap["hero_cell.hero_bg.unlock_tx"]
|
||||
self.fragmenImg = uiMap["hero_cell.hero_bg.self_node.progress_bg.fragment_img"]
|
||||
self.lvUpArrow = uiMap["hero_cell.hero_bg.self_node.effect_node.ui_spine_obj"]
|
||||
self.lvUpArrow = uiMap["hero_cell.hero_bg.self_node.ui_spine_obj"]
|
||||
self.maskImg2 = uiMap["hero_cell.hero_bg.mask_img_2"]
|
||||
-- 他人节点
|
||||
self.otherNode = uiMap["hero_cell.hero_bg.other_node"]
|
||||
self.otherTxName = uiMap["hero_cell.hero_bg.other_node.tx_name"]
|
||||
self.nameTx = uiMap["hero_cell.hero_bg.tx_name"]
|
||||
self.starComp = uiMap["hero_cell.hero_bg.star_cell"]:addLuaComponent(GConst.TYPEOF_LUA_CLASS.STAR_CELL)
|
||||
self.unlockTx:setText(I18N:getGlobalText(I18N.GlobalConst.HERO_DESC_7))
|
||||
|
||||
@ -45,45 +40,30 @@ function HeroCell:refresh(heroEntity, isGray)
|
||||
end)
|
||||
|
||||
self.selfNode:setVisible(true)
|
||||
self.otherNode:setVisible(false)
|
||||
|
||||
local heroInfo = heroEntity:getConfig()
|
||||
self:_refresh(heroInfo, isGray)
|
||||
self:_refresh(heroEntity:getCfgId(), isGray)
|
||||
|
||||
local canLvUp = heroEntity:canLvUp()
|
||||
self.lvUpArrow:setVisible(canLvUp)
|
||||
if canLvUp then
|
||||
self.lvUpArrow:playAnim("animation", true, false)
|
||||
end
|
||||
self.fragmenImg:setVisible(not canLvUp)
|
||||
local needFragmentCount = heroEntity:getLvUpMaterialNum() or 1
|
||||
local fragmentCount = DataManager.BagData.ItemData:getItemNumById(heroEntity:getFragmentId())
|
||||
self.progressTx:setText(fragmentCount .. "/" .. needFragmentCount)
|
||||
if fragmentCount >= needFragmentCount then
|
||||
self.progress:setSprite(GConst.ATLAS_PATH.COMMON, "common_progress_1", nil, self.progress:getComponent(GConst.TYPEOF_UNITY_CLASS.BF_SLIDER))
|
||||
else
|
||||
self.progress:setSprite(GConst.ATLAS_PATH.COMMON, "common_progress_2", nil, self.progress:getComponent(GConst.TYPEOF_UNITY_CLASS.BF_SLIDER))
|
||||
end
|
||||
self.progress:getComponent(GConst.TYPEOF_UNITY_CLASS.BF_SLIDER).value = fragmentCount / needFragmentCount
|
||||
local star = heroEntity:getStar()
|
||||
self.starComp:refresh(star)
|
||||
if heroEntity:isUnlock() then
|
||||
if heroEntity:isActived() then
|
||||
self.lvTx:setText(I18N:getGlobalText(I18N.GlobalConst.HERO_DESC_1, heroEntity:getLv()))
|
||||
self.lvTx:setText(I18N:getGlobalText(I18N.GlobalConst.RUNES_DESC_26, heroEntity:getLv()))
|
||||
self.lvTx:setVisible(true)
|
||||
else
|
||||
self.lvTx:setVisible(false)
|
||||
end
|
||||
self.progressBg:setVisible(not heroEntity:isMaxLv())
|
||||
self.unlockTx:setVisible(false)
|
||||
else
|
||||
self.lvTx:setVisible(false)
|
||||
if canLvUp then
|
||||
self.unlockTx:setVisible(false)
|
||||
self.progressBg:setVisible(true)
|
||||
else
|
||||
self.unlockTx:setVisible(true)
|
||||
self.progressBg:setVisible(false)
|
||||
end
|
||||
end
|
||||
self:refreshRedPoint()
|
||||
@ -132,42 +112,28 @@ function HeroCell:refreshBriefInfo(heroEntity)
|
||||
local id = self.heroEntity:getCfgId()
|
||||
local level = self.heroEntity:getLv()
|
||||
self.selfNode:setVisible(false)
|
||||
self.otherNode:setVisible(true)
|
||||
local star = heroEntity:getStar()
|
||||
self.starComp:refresh(star)
|
||||
self.unlockTx:setVisible(false)
|
||||
|
||||
self:_refresh(ConfigManager:getConfig("hero")[id])
|
||||
|
||||
self.otherTxName:setText(ModuleManager.HeroManager:getHeroName(id))
|
||||
self:_refresh(id)
|
||||
self.lvTx:setText(I18N:getGlobalText(I18N.GlobalConst.HERO_DESC_1, level))
|
||||
end
|
||||
|
||||
function HeroCell:refreshWithCfgId(id, isGray)
|
||||
local heroInfo = ConfigManager:getConfig("hero")[id]
|
||||
self:_refresh(heroInfo, isGray)
|
||||
self:_refresh(id, isGray)
|
||||
|
||||
local lv = heroInfo.begin_lv
|
||||
local lvInfo = ConfigManager:getConfig("hero_level")[lv]
|
||||
local materials = lvInfo["cost_" .. heroInfo.qlt]
|
||||
local fragmentCount = DataManager.BagData.ItemData:getItemNumById(heroInfo.item_id)
|
||||
local needFragmentCount = materials[1] or 1
|
||||
self.progressTx:setText(fragmentCount .. "/" .. needFragmentCount)
|
||||
if fragmentCount >= needFragmentCount then
|
||||
self.progress:setSprite(GConst.ATLAS_PATH.COMMON, "common_progress_1", nil, self.progress:getComponent(GConst.TYPEOF_UNITY_CLASS.BF_SLIDER))
|
||||
else
|
||||
self.progress:setSprite(GConst.ATLAS_PATH.COMMON, "common_progress_2", nil, self.progress:getComponent(GConst.TYPEOF_UNITY_CLASS.BF_SLIDER))
|
||||
end
|
||||
self.progress:getComponent(GConst.TYPEOF_UNITY_CLASS.BF_SLIDER).value = fragmentCount / needFragmentCount
|
||||
self.lvTx:setText(I18N:getGlobalText(I18N.GlobalConst.HERO_DESC_1, lv))
|
||||
self.lvTx:setVisible(true)
|
||||
self.progressBg:setVisible(true)
|
||||
self.unlockTx:setVisible(false)
|
||||
self.lvUpArrow:setVisible(false)
|
||||
self.fragmenImg:setVisible(true)
|
||||
end
|
||||
|
||||
function HeroCell:_refresh(heroInfo, isGray)
|
||||
function HeroCell:_refresh(id, isGray)
|
||||
local heroInfo = ConfigManager:getConfig("hero")[id]
|
||||
self.clickCallback = nil
|
||||
self.maskImg2:setActive(isGray)
|
||||
self.heroBg:setSprite(GConst.ATLAS_PATH.ICON_HERO, GConst.FRAME_QLT[heroInfo.qlt])
|
||||
@ -176,6 +142,7 @@ function HeroCell:_refresh(heroInfo, isGray)
|
||||
self.check:setVisible(false)
|
||||
self:refreshHeroIcon(heroInfo.icon)
|
||||
self:setGray(isGray)
|
||||
self.nameTx:setText(ModuleManager.HeroManager:getHeroName(id))
|
||||
end
|
||||
|
||||
function HeroCell:showCheck(visible)
|
||||
|
||||
@ -264,4 +264,12 @@ function RewardCell:showSelect(show)
|
||||
self.select:setActive(show == true)
|
||||
end
|
||||
|
||||
function RewardCell:setShowFirstTag(show)
|
||||
if self.firstNode == nil or self.txfirst == nil then
|
||||
return
|
||||
end
|
||||
self.firstNode:setVisible(show)
|
||||
self.txfirst:setText(I18N:getGlobalText(I18N.GlobalConst.CHALLENGE_TEAM_7))
|
||||
end
|
||||
|
||||
return RewardCell
|
||||
96
lua/app/ui/dungeon/cell/dungeon_cell.lua
Normal file
96
lua/app/ui/dungeon/cell/dungeon_cell.lua
Normal file
@ -0,0 +1,96 @@
|
||||
local DungeonCell = class("DungeonCell", BaseCell)
|
||||
|
||||
function DungeonCell:init()
|
||||
local uiMap = self:getUIMap()
|
||||
self.contentNode = uiMap["dungeon_cell.content"]
|
||||
self.txTitle = uiMap["dungeon_cell.content.tx_title"]
|
||||
self.infoNode = uiMap["dungeon_cell.content.info"]
|
||||
self.btnHelp = uiMap["dungeon_cell.content.info.btn_help"]
|
||||
self.timesTx = uiMap["dungeon_cell.content.info.tx_time"]
|
||||
self.lockNode = uiMap["dungeon_cell.content.lock"]
|
||||
self.lockTx = uiMap["dungeon_cell.content.lock.text"]
|
||||
self.rewardCells = {}
|
||||
for i = 1, 3 do
|
||||
table.insert(self.rewardCells, uiMap["dungeon_cell.content.info.rewards.reward_cell_" .. i]:addLuaComponent(GConst.TYPEOF_LUA_CLASS.REWARD_CELL))
|
||||
end
|
||||
self.txEmpty = uiMap["dungeon_cell.tx_empty"]
|
||||
-- 敬请期待
|
||||
self.bgComingSoon = uiMap["dungeon_cell.bg_coming_soon"]
|
||||
self.bgComingSoonTx = uiMap["dungeon_cell.bg_coming_soon.text"]
|
||||
self.bgComingSoonTx:setText(I18N:getGlobalText(I18N.GlobalConst.COLLECTION_DESC_8))
|
||||
|
||||
self.btnHelp:addClickListener(function()
|
||||
local params = {
|
||||
desc = I18N:getGlobalText(GConst.DungeonConst.STR_HELP[self.moduleKey])
|
||||
}
|
||||
ModuleManager.TipsManager:showHelpTips(params)
|
||||
end)
|
||||
|
||||
self.baseObject:addClickListener(function()
|
||||
self:onClickGo()
|
||||
end)
|
||||
end
|
||||
|
||||
function DungeonCell:refresh(moduleKey)
|
||||
self.bgComingSoon:setVisible(false)
|
||||
self.contentNode:setVisible(true)
|
||||
self.moduleKey = moduleKey
|
||||
self:getBaseObject():getGameObject().name = self.moduleKey
|
||||
|
||||
self.txTitle:setText(I18N:getGlobalText(GConst.DungeonConst.STR_TITLE[self.moduleKey]))
|
||||
local rewards = DataManager.DungeonData:getShowRewards(self.moduleKey)
|
||||
for i, cell in ipairs(self.rewardCells) do
|
||||
if rewards and rewards[i] then
|
||||
cell:setActive(true)
|
||||
cell:refreshByConfig(rewards[i])
|
||||
cell:hideCountTx()
|
||||
else
|
||||
cell:setActive(false)
|
||||
end
|
||||
end
|
||||
self.baseObject:setSprite(GConst.ATLAS_PATH.UI_SUPPLY, GConst.DungeonConst.IMG_BANNER[self.moduleKey])
|
||||
if DataManager.DungeonData:isOpen(self.moduleKey) then
|
||||
self.infoNode:setVisible(true)
|
||||
self.lockNode:setVisible(false)
|
||||
self.timesTx:setText(GConst.EMPTY_STRING)
|
||||
else
|
||||
self.timesTx:setText(GConst.EMPTY_STRING)
|
||||
self.infoNode:setVisible(false)
|
||||
self.lockNode:setVisible(true)
|
||||
self.lockTx:setText(DataManager.DungeonData:getNotOpenStr(self.moduleKey))
|
||||
end
|
||||
|
||||
if DataManager.DungeonData:hasRedPoint(self.moduleKey) then
|
||||
self.baseObject:addRedPoint(334, 90, 1)
|
||||
else
|
||||
self.baseObject:removeRedPoint()
|
||||
end
|
||||
self.remainTime = nil
|
||||
self:updateTime()
|
||||
end
|
||||
|
||||
function DungeonCell:showComingSoon()
|
||||
self.bgComingSoon:setVisible(true)
|
||||
self.contentNode:setVisible(false)
|
||||
end
|
||||
|
||||
function DungeonCell:onClickGo()
|
||||
if not DataManager.DungeonData:isOpen(self.moduleKey, true) then
|
||||
return
|
||||
end
|
||||
if self.moduleKey == GConst.DungeonConst.MODULE_KEY_DUNGEON_DAILY then
|
||||
ModuleManager.DungeonManager:showDungeonDaylyMainUI()
|
||||
end
|
||||
end
|
||||
|
||||
function DungeonCell:updateTime()
|
||||
if self.moduleKey == GConst.DungeonConst.MODULE_KEY_DUNGEON_DAILY then
|
||||
local remainTime = Time:getTodaySurplusTime()
|
||||
if self.remainTime ~= remainTime then
|
||||
self.remainTime = remainTime
|
||||
self.timesTx:setText(I18N:getGlobalText(I18N.GlobalConst.GIFT_ROUTINE_DESC_9, Time:formatNumTime(remainTime)))
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
return DungeonCell
|
||||
@ -1,5 +1,5 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 44945e5552167a94b9e05a970452fae0
|
||||
guid: f30c87e49a0944efab0cb8b97c491d13
|
||||
ScriptedImporter:
|
||||
internalIDToNameTable: []
|
||||
externalObjects: {}
|
||||
160
lua/app/ui/dungeon/cell/dungeon_gold_cell.lua
Normal file
160
lua/app/ui/dungeon/cell/dungeon_gold_cell.lua
Normal file
@ -0,0 +1,160 @@
|
||||
local DungeonGoldCell = class("DungeonGoldCell", BaseCell)
|
||||
|
||||
function DungeonGoldCell:init()
|
||||
local uiMap = self:getUIMap()
|
||||
|
||||
self.challengeBtn = uiMap["gold_cell.challenge_btn"]
|
||||
self.challengeBtn:addClickListener(function()
|
||||
if self.chapterId then
|
||||
local remainTimes = DataManager.DungeonDailyData.GoldData:getTodayRemainTimes()
|
||||
local ticketCount = DataManager.BagData.ItemData:getItemNumById(GConst.ItemConst.ITEM_ID_DUNGEON_TICKET_1)
|
||||
if remainTimes <= 0 and ticketCount <= 0 then
|
||||
GFunc.showToast(I18N:getGlobalText(I18N.GlobalConst.DAILY_CHALLENGE_DESC_1))
|
||||
return
|
||||
end
|
||||
-- ModuleManager.ChapterManager:showMainBattleEntryUI(ModuleManager.BattleManager.BATTLE_TYPE.DUNGEON,function()
|
||||
-- self:OnClickStrtGame()
|
||||
-- end, self.chapterId, false, GConst.DungeonConst.DUNGEON_DAILY_TYPE.GOLD)
|
||||
self:OnClickStrtGame()
|
||||
end
|
||||
end)
|
||||
self.challengeBtnTx = uiMap["gold_cell.challenge_btn.text"]
|
||||
self.challengeBtnTx:setText(I18N:getGlobalText(I18N.GlobalConst.BATTLE_DESC_18))
|
||||
-- 门票
|
||||
self.challengeBtnItem = uiMap["gold_cell.challenge_btn.item"]
|
||||
self.challengeBtnItemTx = uiMap["gold_cell.challenge_btn.item.text"]
|
||||
self.challengeBtnItemIcon = uiMap["gold_cell.challenge_btn.item.icon"]
|
||||
self.challengeBtnItemNumTx = uiMap["gold_cell.challenge_btn.item.num_tx"]
|
||||
self.challengeBtnItemTx:setText(I18N:getGlobalText(I18N.GlobalConst.BATTLE_DESC_18))
|
||||
self.challengeBtnItemIcon:setSprite(GFunc.getIconRes(GConst.ItemConst.ITEM_ID_DUNGEON_TICKET_1))
|
||||
|
||||
self.sweepBtn = uiMap["gold_cell.sweep_btn"]
|
||||
self.sweepBtn:addClickListener(function()
|
||||
if self.chapterId then
|
||||
ModuleManager.DungeonManager:sweepDungeonDaily(self.chapterId)
|
||||
end
|
||||
end)
|
||||
self.sweepBtnTx = uiMap["gold_cell.sweep_btn.text"]
|
||||
self.sweepBtnTx:setText(I18N:getGlobalText(I18N.GlobalConst.DUNGEON_DESC_3))
|
||||
-- 门票
|
||||
self.sweepBtnItem = uiMap["gold_cell.sweep_btn.item"]
|
||||
self.sweepBtnItemTx = uiMap["gold_cell.sweep_btn.item.text"]
|
||||
self.sweepBtnItemIcon = uiMap["gold_cell.sweep_btn.item.icon"]
|
||||
self.sweepBtnItemNumTx = uiMap["gold_cell.sweep_btn.item.num_tx"]
|
||||
self.sweepBtnItemTx:setText(I18N:getGlobalText(I18N.GlobalConst.DUNGEON_DESC_3))
|
||||
self.sweepBtnItemIcon:setSprite(GFunc.getIconRes(GConst.ItemConst.ITEM_ID_DUNGEON_TICKET_1))
|
||||
|
||||
self.unlockBtn = uiMap["gold_cell.unlock_btn"]
|
||||
self.unlockBtn:addClickListener(function()
|
||||
GFunc.showToast(I18N:getGlobalText(I18N.GlobalConst.CHALLENGE_TEAM_10))
|
||||
end)
|
||||
self.unlockTx = uiMap["gold_cell.unlock_btn.text"]
|
||||
self.unlockTx:setText(I18N:getGlobalText(I18N.GlobalConst.HERO_DESC_7))
|
||||
|
||||
self.stageTx = uiMap["gold_cell.stage_tx"]
|
||||
self.powerTx = uiMap["gold_cell.power_tx"]
|
||||
|
||||
self.scrollrect = uiMap["gold_cell.scrollrect"]
|
||||
self.rewardList = {}
|
||||
end
|
||||
function DungeonGoldCell:OnClickStrtGame()
|
||||
if self.chapterId then
|
||||
ModuleManager.DungeonManager:onDungeonStartReq(self.chapterId)
|
||||
-- ModuleManager.DungeonManager:startDungeonDailyBattle(self.chapterId)
|
||||
end
|
||||
end
|
||||
|
||||
function DungeonGoldCell:refresh(index)
|
||||
local chapterInfo = DataManager.DungeonDailyData.GoldData:getChapterInfo(index)
|
||||
self.chapterId = chapterInfo.id
|
||||
local maxPassedId = DataManager.DungeonDailyData.GoldData:getMaxPassedId()
|
||||
local challengeId = DataManager.DungeonDailyData.GoldData:getChallengeId()
|
||||
local chapterName = DataManager.DungeonDailyData.GoldData:getChapterName(chapterInfo.id)
|
||||
self.stageTx:setText(chapterName)
|
||||
-- local curPower = DataManager.PlayerData:getSelfEntity():getShowPower(ModuleManager.BattleManager.BATTLE_TYPE.DUNGEON)
|
||||
-- local curPower = DataManager.HeroData:getShowPower()
|
||||
-- local chapterPower = chapterInfo.cfg.power
|
||||
-- if curPower >= chapterPower then
|
||||
-- self.powerTx:setText("<color=#0F7411>" .. I18N:getGlobalText(I18N.GlobalConst.RECOMMENDED_POWER, GFunc.getPowerShow(chapterPower)) .. "</color>")
|
||||
-- else
|
||||
-- self.powerTx:setText("<color=#C90D0D>" .. I18N:getGlobalText(I18N.GlobalConst.RECOMMENDED_POWER, GFunc.getPowerShow(chapterPower)) .. "</color>")
|
||||
-- end
|
||||
local rewardsCount = #self.rewardList
|
||||
for i = 1, rewardsCount do
|
||||
table.remove(self.rewardList)
|
||||
end
|
||||
self.firstCount = 0
|
||||
if chapterInfo.id > challengeId then -- 未解锁
|
||||
for k, v in ipairs(chapterInfo.cfg.first_reward) do
|
||||
table.insert(self.rewardList, v)
|
||||
end
|
||||
self.firstCount = #chapterInfo.cfg.first_reward
|
||||
for k, v in ipairs(chapterInfo.cfg.reward) do
|
||||
table.insert(self.rewardList, v)
|
||||
end
|
||||
self.challengeBtn:setActive(false)
|
||||
self.sweepBtn:setActive(false)
|
||||
self.unlockBtn:setActive(true)
|
||||
elseif chapterInfo.id == challengeId and challengeId ~= maxPassedId then -- 正在挑战中
|
||||
for k, v in ipairs(chapterInfo.cfg.first_reward) do
|
||||
table.insert(self.rewardList, v)
|
||||
end
|
||||
self.firstCount = #chapterInfo.cfg.first_reward
|
||||
for k, v in ipairs(chapterInfo.cfg.reward) do
|
||||
table.insert(self.rewardList, v)
|
||||
end
|
||||
self.challengeBtn:setActive(true)
|
||||
self.sweepBtn:setActive(false)
|
||||
self.unlockBtn:setActive(false)
|
||||
else -- 已通关,可以扫荡
|
||||
self.firstCount = 0
|
||||
for k, v in ipairs(chapterInfo.cfg.reward) do
|
||||
table.insert(self.rewardList, v)
|
||||
end
|
||||
self.challengeBtn:setActive(false)
|
||||
self.sweepBtn:setActive(true)
|
||||
self.unlockBtn:setActive(false)
|
||||
end
|
||||
|
||||
if not self.scrollRectComp then
|
||||
self.scrollRectComp = self.scrollrect:addLuaComponent(GConst.TYPEOF_LUA_CLASS.SCROLL_RECT_BASE)
|
||||
self.scrollRectComp:addInitCallback(function()
|
||||
return GConst.TYPEOF_LUA_CLASS.REWARD_CELL
|
||||
end)
|
||||
self.scrollRectComp:addRefreshCallback(function(cellIndex, cell)
|
||||
cell:refreshByConfig(self.rewardList[cellIndex], false, false)
|
||||
cell:setShowFirstTag(cellIndex <= self.firstCount)
|
||||
end)
|
||||
end
|
||||
|
||||
local totalCount = #self.rewardList
|
||||
if self.scrollRectComp:getTotalCount() == nil or self.scrollRectComp:getTotalCount() <= 0 then
|
||||
self.scrollRectComp:refillCells(totalCount)
|
||||
elseif self.scrollRectComp:getTotalCount() ~= totalCount then
|
||||
self.scrollRectComp:clearCells()
|
||||
self.scrollRectComp:refillCells(totalCount)
|
||||
else
|
||||
self.scrollRectComp:updateAllCell()
|
||||
end
|
||||
|
||||
-- 根据道具数量刷新入口按钮
|
||||
local remainTimes = DataManager.DungeonDailyData.GoldData:getTodayRemainTimes()
|
||||
local ticketCount = DataManager.BagData.ItemData:getItemNumById(GConst.ItemConst.ITEM_ID_DUNGEON_TICKET_1)
|
||||
if remainTimes <= 0 and ticketCount > 0 then
|
||||
self.challengeBtnItem:setVisible(true)
|
||||
self.challengeBtnTx:setVisible(false)
|
||||
self.challengeBtnItemNumTx:setText(ticketCount .. "/1")
|
||||
|
||||
self.sweepBtnItem:setVisible(true)
|
||||
self.sweepBtnTx:setVisible(false)
|
||||
self.sweepBtnItemNumTx:setText(ticketCount .. "/1")
|
||||
else
|
||||
self.challengeBtnItem:setVisible(false)
|
||||
self.challengeBtnTx:setVisible(true)
|
||||
|
||||
self.sweepBtnItem:setVisible(false)
|
||||
self.sweepBtnTx:setVisible(true)
|
||||
end
|
||||
end
|
||||
|
||||
return DungeonGoldCell
|
||||
@ -1,5 +1,5 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 5e5040fa8cbe53747ac9daae96856bb9
|
||||
guid: 5bd27958f45054ccc9c67d92901889ba
|
||||
ScriptedImporter:
|
||||
internalIDToNameTable: []
|
||||
externalObjects: {}
|
||||
161
lua/app/ui/dungeon/cell/dungeon_material_cell.lua
Normal file
161
lua/app/ui/dungeon/cell/dungeon_material_cell.lua
Normal file
@ -0,0 +1,161 @@
|
||||
local DungeonMaterialCell = class("DungeonMaterialCell", BaseCell)
|
||||
|
||||
function DungeonMaterialCell:init()
|
||||
local uiMap = self:getUIMap()
|
||||
|
||||
self.challengeBtn = uiMap["material_cell.challenge_btn"]
|
||||
self.challengeBtn:addClickListener(function()
|
||||
if self.chapterId then
|
||||
local remainTimes = DataManager.DungeonDailyData.MaterialData:getTodayRemainTimes()
|
||||
local ticketCount = DataManager.BagData.ItemData:getItemNumById(GConst.ItemConst.ITEM_ID_DUNGEON_TICKET_2)
|
||||
if remainTimes <= 0 and ticketCount <= 0 then
|
||||
GFunc.showToast(I18N:getGlobalText(I18N.GlobalConst.DAILY_CHALLENGE_DESC_1))
|
||||
return
|
||||
end
|
||||
-- ModuleManager.ChapterManager:showMainBattleEntryUI(ModuleManager.BattleManager.BATTLE_TYPE.DUNGEON,function()
|
||||
-- self:OnClickStrtGame()
|
||||
-- end, self.chapterId, false, GConst.DungeonConst.DUNGEON_DAILY_TYPE.MATERIAL)
|
||||
self:OnClickStrtGame()
|
||||
end
|
||||
end)
|
||||
self.challengeBtnTx = uiMap["material_cell.challenge_btn.text"]
|
||||
self.challengeBtnTx:setText(I18N:getGlobalText(I18N.GlobalConst.BATTLE_DESC_18))
|
||||
-- 门票
|
||||
self.challengeBtnItem = uiMap["material_cell.challenge_btn.item"]
|
||||
self.challengeBtnItemTx = uiMap["material_cell.challenge_btn.item.text"]
|
||||
self.challengeBtnItemIcon = uiMap["material_cell.challenge_btn.item.icon"]
|
||||
self.challengeBtnItemNumTx = uiMap["material_cell.challenge_btn.item.num_tx"]
|
||||
self.challengeBtnItemTx:setText(I18N:getGlobalText(I18N.GlobalConst.BATTLE_DESC_18))
|
||||
self.challengeBtnItemIcon:setSprite(GFunc.getIconRes(GConst.ItemConst.ITEM_ID_DUNGEON_TICKET_2))
|
||||
|
||||
self.sweepBtn = uiMap["material_cell.sweep_btn"]
|
||||
self.sweepBtn:addClickListener(function()
|
||||
if self.chapterId then
|
||||
ModuleManager.DungeonManager:sweepDungeonDaily(self.chapterId)
|
||||
end
|
||||
end)
|
||||
self.sweepBtnTx = uiMap["material_cell.sweep_btn.text"]
|
||||
self.sweepBtnTx:setText(I18N:getGlobalText(I18N.GlobalConst.DUNGEON_DESC_3))
|
||||
-- 门票
|
||||
self.sweepBtnItem = uiMap["material_cell.sweep_btn.item"]
|
||||
self.sweepBtnItemTx = uiMap["material_cell.sweep_btn.item.text"]
|
||||
self.sweepBtnItemIcon = uiMap["material_cell.sweep_btn.item.icon"]
|
||||
self.sweepBtnItemNumTx = uiMap["material_cell.sweep_btn.item.num_tx"]
|
||||
self.sweepBtnItemTx:setText(I18N:getGlobalText(I18N.GlobalConst.DUNGEON_DESC_3))
|
||||
self.sweepBtnItemIcon:setSprite(GFunc.getIconRes(GConst.ItemConst.ITEM_ID_DUNGEON_TICKET_2))
|
||||
|
||||
self.unlockBtn = uiMap["material_cell.unlock_btn"]
|
||||
self.unlockBtn:addClickListener(function()
|
||||
GFunc.showToast(I18N:getGlobalText(I18N.GlobalConst.CHALLENGE_TEAM_10))
|
||||
end)
|
||||
self.unlockTx = uiMap["material_cell.unlock_btn.text"]
|
||||
self.unlockTx:setText(I18N:getGlobalText(I18N.GlobalConst.HERO_DESC_7))
|
||||
|
||||
self.stageTx = uiMap["material_cell.stage_tx"]
|
||||
self.powerTx = uiMap["material_cell.power_tx"]
|
||||
|
||||
self.scrollrect = uiMap["material_cell.scrollrect"]
|
||||
self.rewardList = {}
|
||||
end
|
||||
|
||||
function DungeonMaterialCell:OnClickStrtGame()
|
||||
if self.chapterId then
|
||||
ModuleManager.DungeonManager:onDungeonStartReq(self.chapterId)
|
||||
-- ModuleManager.DungeonManager:startDungeonDailyBattle(self.chapterId)
|
||||
end
|
||||
end
|
||||
|
||||
function DungeonMaterialCell:refresh(index)
|
||||
local chapterInfo = DataManager.DungeonDailyData.MaterialData:getChapterInfo(index)
|
||||
self.chapterId = chapterInfo.id
|
||||
local maxPassedId = DataManager.DungeonDailyData.MaterialData:getMaxPassedId()
|
||||
local challengeId = DataManager.DungeonDailyData.MaterialData:getChallengeId()
|
||||
local chapterName = DataManager.DungeonDailyData.MaterialData:getChapterName(chapterInfo.id)
|
||||
self.stageTx:setText(chapterName)
|
||||
-- local curPower = DataManager.PlayerData:getSelfEntity():getShowPower(ModuleManager.BattleManager.BATTLE_TYPE.DUNGEON)
|
||||
-- local curPower = DataManager.HeroData:getShowPower()
|
||||
-- local chapterPower = chapterInfo.cfg.power
|
||||
-- if curPower >= chapterPower then
|
||||
-- self.powerTx:setText("<color=#0F7411>" .. I18N:getGlobalText(I18N.GlobalConst.RECOMMENDED_POWER, GFunc.getPowerShow(chapterPower)) .. "</color>")
|
||||
-- else
|
||||
-- self.powerTx:setText("<color=#C90D0D>" .. I18N:getGlobalText(I18N.GlobalConst.RECOMMENDED_POWER, GFunc.getPowerShow(chapterPower)) .. "</color>")
|
||||
-- end
|
||||
local rewardsCount = #self.rewardList
|
||||
for i = 1, rewardsCount do
|
||||
table.remove(self.rewardList)
|
||||
end
|
||||
self.firstCount = 0
|
||||
if chapterInfo.id > challengeId then -- 未解锁
|
||||
for k, v in ipairs(chapterInfo.cfg.first_reward) do
|
||||
table.insert(self.rewardList, v)
|
||||
end
|
||||
self.firstCount = #chapterInfo.cfg.first_reward
|
||||
for k, v in ipairs(chapterInfo.cfg.reward) do
|
||||
table.insert(self.rewardList, v)
|
||||
end
|
||||
self.challengeBtn:setActive(false)
|
||||
self.sweepBtn:setActive(false)
|
||||
self.unlockBtn:setActive(true)
|
||||
elseif chapterInfo.id == challengeId and challengeId ~= maxPassedId then -- 正在挑战中
|
||||
for k, v in ipairs(chapterInfo.cfg.first_reward) do
|
||||
table.insert(self.rewardList, v)
|
||||
end
|
||||
self.firstCount = #chapterInfo.cfg.first_reward
|
||||
for k, v in ipairs(chapterInfo.cfg.reward) do
|
||||
table.insert(self.rewardList, v)
|
||||
end
|
||||
self.challengeBtn:setActive(true)
|
||||
self.sweepBtn:setActive(false)
|
||||
self.unlockBtn:setActive(false)
|
||||
else -- 已通关,可以扫荡
|
||||
self.firstCount = 0
|
||||
for k, v in ipairs(chapterInfo.cfg.reward) do
|
||||
table.insert(self.rewardList, v)
|
||||
end
|
||||
self.challengeBtn:setActive(false)
|
||||
self.sweepBtn:setActive(true)
|
||||
self.unlockBtn:setActive(false)
|
||||
end
|
||||
|
||||
if not self.scrollRectComp then
|
||||
self.scrollRectComp = self.scrollrect:addLuaComponent(GConst.TYPEOF_LUA_CLASS.SCROLL_RECT_BASE)
|
||||
self.scrollRectComp:addInitCallback(function()
|
||||
return GConst.TYPEOF_LUA_CLASS.REWARD_CELL
|
||||
end)
|
||||
self.scrollRectComp:addRefreshCallback(function(cellIndex, cell)
|
||||
cell:refreshByConfig(self.rewardList[cellIndex], false, false)
|
||||
cell:setShowFirstTag(cellIndex <= self.firstCount)
|
||||
end)
|
||||
end
|
||||
|
||||
local totalCount = #self.rewardList
|
||||
if self.scrollRectComp:getTotalCount() == nil or self.scrollRectComp:getTotalCount() <= 0 then
|
||||
self.scrollRectComp:refillCells(totalCount)
|
||||
elseif self.scrollRectComp:getTotalCount() ~= totalCount then
|
||||
self.scrollRectComp:clearCells()
|
||||
self.scrollRectComp:refillCells(totalCount)
|
||||
else
|
||||
self.scrollRectComp:updateAllCell()
|
||||
end
|
||||
|
||||
-- 根据道具数量刷新入口按钮
|
||||
local remainTimes = DataManager.DungeonDailyData.MaterialData:getTodayRemainTimes()
|
||||
local ticketCount = DataManager.BagData.ItemData:getItemNumById(GConst.ItemConst.ITEM_ID_DUNGEON_TICKET_2)
|
||||
if remainTimes <= 0 and ticketCount > 0 then
|
||||
self.challengeBtnItem:setVisible(true)
|
||||
self.challengeBtnTx:setVisible(false)
|
||||
self.challengeBtnItemNumTx:setText(ticketCount .. "/1")
|
||||
|
||||
self.sweepBtnItem:setVisible(true)
|
||||
self.sweepBtnTx:setVisible(false)
|
||||
self.sweepBtnItemNumTx:setText(ticketCount .. "/1")
|
||||
else
|
||||
self.challengeBtnItem:setVisible(false)
|
||||
self.challengeBtnTx:setVisible(true)
|
||||
|
||||
self.sweepBtnItem:setVisible(false)
|
||||
self.sweepBtnTx:setVisible(true)
|
||||
end
|
||||
end
|
||||
|
||||
return DungeonMaterialCell
|
||||
@ -1,5 +1,5 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 42e0b145611148845b047bd6359e9f4e
|
||||
guid: 648ce5a0b2a4c455db454a2c3f85f76b
|
||||
ScriptedImporter:
|
||||
internalIDToNameTable: []
|
||||
externalObjects: {}
|
||||
@ -1,119 +0,0 @@
|
||||
local DungeonTargetCell = class("DungeonTargetCell", BaseCell)
|
||||
|
||||
function DungeonTargetCell:init()
|
||||
local uiMap = self:getUIMap()
|
||||
|
||||
self.txDesc = uiMap["dungeon_target_cell.tx_desc"]
|
||||
self.btn = uiMap["dungeon_target_cell.right.btn"]
|
||||
self.txBtn = uiMap["dungeon_target_cell.right.btn.tx_btn"]
|
||||
-- 有扫荡次数
|
||||
self.timeObj = uiMap["dungeon_target_cell.time"]
|
||||
self.txTime = uiMap["dungeon_target_cell.time.tx_time"]
|
||||
self.powerObj = uiMap["dungeon_target_cell.right.power"]
|
||||
self.imgPowerIcon = uiMap["dungeon_target_cell.right.power.img_icon"]
|
||||
self.txPowerNum = uiMap["dungeon_target_cell.right.power.tx_num"]
|
||||
end
|
||||
|
||||
function DungeonTargetCell:refresh(targetId, targetNum, getWay, id)
|
||||
self.getWay = getWay or self.getWay
|
||||
self.dungeonId = id or self.dungeonId
|
||||
if targetId and targetNum then
|
||||
self.target = {id = targetId, value = targetNum}
|
||||
end
|
||||
|
||||
if self.getWay == GConst.DungeonConst.TYPE.WEAPON then
|
||||
self:showWeapon()
|
||||
elseif self.getWay == GConst.DungeonConst.TYPE.ARMOR then
|
||||
self:showArmor()
|
||||
end
|
||||
end
|
||||
|
||||
-- 显示武器副本
|
||||
function DungeonTargetCell:showWeapon()
|
||||
local weaponData = DataManager.DungeonData:getDungeonDataByType(ModuleManager.MODULE_KEY.DUNGEON_WEAPON)
|
||||
|
||||
local remainTime = weaponData:getRemianFarmCount()
|
||||
|
||||
self.txDesc:setText(I18N:getGlobalText(I18N.GlobalConst.EQUIP_DESC_19, self.dungeonId))
|
||||
|
||||
if weaponData:canFarmChapter(self.dungeonId) and remainTime > 0 then
|
||||
-- 扫荡
|
||||
self.timeObj:setActive(true)
|
||||
self.powerObj:setActive(true)
|
||||
self.txBtn:setText(I18N:getGlobalText(I18N.GlobalConst.SMASH))
|
||||
self.btn:setSprite(GConst.ATLAS_PATH.COMMON, "common_btn_green_3")
|
||||
self.txTime:setText(remainTime .."/" .. weaponData:getDialyFarmLimit())
|
||||
self.txPowerNum:setText(GFunc.getRewardNum(weaponData:getChallengeHpCost()))
|
||||
GFunc.centerImgAndTx(self.imgPowerIcon, self.txPowerNum, 2)
|
||||
self.btn:setTouchEnable(true)
|
||||
elseif weaponData:canFightChapter(self.dungeonId) then
|
||||
-- 前往
|
||||
self.timeObj:setActive(false)
|
||||
self.powerObj:setActive(false)
|
||||
self.txBtn:setText(I18N:getGlobalText(I18N.GlobalConst.EQUIP_DESC_21))
|
||||
self.btn:setSprite(GConst.ATLAS_PATH.COMMON, "common_btn_blue_3")
|
||||
self.btn:setTouchEnable(true)
|
||||
else
|
||||
-- 未开启
|
||||
self.timeObj:setActive(false)
|
||||
self.powerObj:setActive(false)
|
||||
self.txBtn:setText(I18N:getGlobalText(I18N.GlobalConst.EQUIP_DESC_22))
|
||||
self.btn:setSprite(GConst.ATLAS_PATH.COMMON, "common_btn_grey_3")
|
||||
self.btn:setTouchEnable(false)
|
||||
end
|
||||
self.btn:addClickListener(function()
|
||||
if weaponData:canFarmChapter(self.dungeonId) and remainTime > 0 then
|
||||
ModuleManager.DungeonWeaponManager:reqSweep(self.dungeonId, self.target)
|
||||
else
|
||||
ModuleManager.DungeonWeaponManager:showMainUI()
|
||||
EventManager:dispatchEvent(EventManager.CUSTOM_EVENT.GO_DUNGEON_UI)
|
||||
end
|
||||
end)
|
||||
end
|
||||
|
||||
-- 显示防具副本
|
||||
function DungeonTargetCell:showArmor()
|
||||
local armorData = DataManager.DungeonData:getDungeonDataByType(ModuleManager.MODULE_KEY.DUNGEON_ARMOR)
|
||||
|
||||
local remainTime = armorData:getRemianFarmCount(self.dungeonId)
|
||||
|
||||
local cfg = armorData:getConfig(self.dungeonId)
|
||||
self.txDesc:setText(I18N:getGlobalText(I18N.GlobalConst.EQUIP_DESC_20, cfg.chapter, cfg.stage))
|
||||
|
||||
if armorData:canFarmChapter(self.dungeonId) and remainTime > 0 then
|
||||
-- 扫荡
|
||||
self.timeObj:setActive(true)
|
||||
self.powerObj:setActive(true)
|
||||
self.txBtn:setText(I18N:getGlobalText(I18N.GlobalConst.SMASH))
|
||||
self.btn:setSprite(GConst.ATLAS_PATH.COMMON, "common_btn_green_3")
|
||||
self.txTime:setText(remainTime .."/" .. armorData:getDialyFarmLimit(self.dungeonId))
|
||||
self.txPowerNum:setText(GFunc.getRewardNum(armorData:getChallengeHpCost()))
|
||||
GFunc.centerImgAndTx(self.imgPowerIcon, self.txPowerNum, 2)
|
||||
self.btn:setTouchEnable(true)
|
||||
|
||||
elseif armorData:canFightChapter(self.dungeonId) then
|
||||
-- 前往
|
||||
self.timeObj:setActive(false)
|
||||
self.powerObj:setActive(false)
|
||||
self.txBtn:setText(I18N:getGlobalText(I18N.GlobalConst.EQUIP_DESC_21))
|
||||
self.btn:setSprite(GConst.ATLAS_PATH.COMMON, "common_btn_blue_3")
|
||||
self.btn:setTouchEnable(true)
|
||||
else
|
||||
-- 未开启
|
||||
self.timeObj:setActive(false)
|
||||
self.powerObj:setActive(false)
|
||||
self.txBtn:setText(I18N:getGlobalText(I18N.GlobalConst.EQUIP_DESC_22))
|
||||
self.btn:setSprite(GConst.ATLAS_PATH.COMMON, "common_btn_grey_3")
|
||||
self.btn:setTouchEnable(false)
|
||||
end
|
||||
self.btn:addClickListener(function()
|
||||
if armorData:canFarmChapter(self.dungeonId) and remainTime > 0 then
|
||||
ModuleManager.DungeonArmorManager:reqSweep(self.dungeonId, self.target)
|
||||
else
|
||||
ModuleManager.DungeonArmorManager:showMainUI()
|
||||
EventManager:dispatchEvent(EventManager.CUSTOM_EVENT.GO_DUNGEON_UI)
|
||||
end
|
||||
end)
|
||||
end
|
||||
|
||||
return DungeonTargetCell
|
||||
8
lua/app/ui/dungeon/comp.meta
Normal file
8
lua/app/ui/dungeon/comp.meta
Normal file
@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 95839fad1f0264bf59d31f78317b9e65
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
63
lua/app/ui/dungeon/comp/dungeon_gold_comp.lua
Normal file
63
lua/app/ui/dungeon/comp/dungeon_gold_comp.lua
Normal file
@ -0,0 +1,63 @@
|
||||
local DungeonGoldComp = class("DungeonGoldComp", LuaComponent)
|
||||
|
||||
local DUNGEON_GOLD_CELL = "app/ui/dungeon/cell/dungeon_gold_cell"
|
||||
|
||||
function DungeonGoldComp:init()
|
||||
local uiMap = self:getUIMap()
|
||||
self.scrollrect = uiMap["gold_comp.scrollrect"]
|
||||
self.titleTx = uiMap["gold_comp.title_tx"]
|
||||
self.descTx = uiMap["gold_comp.desc_tx"]
|
||||
self.powerTx = uiMap["gold_comp.img_bg.tx_power"]
|
||||
end
|
||||
|
||||
function DungeonGoldComp:onRefresh(isFirstEnter)
|
||||
self.titleTx:setText(I18N:getGlobalText(I18N.GlobalConst.DUNGEON_TITLE_6))
|
||||
|
||||
local todayMaxTimes = DataManager.DungeonDailyData.GoldData:getTodayMaxTimes()
|
||||
local timesStr = DataManager.DungeonDailyData.GoldData:getTodayRemainTimes() .. "/" .. todayMaxTimes
|
||||
self.descTx:setText(I18N:getGlobalText(I18N.GlobalConst.BUY_VIT_DESC_2, timesStr))
|
||||
-- local curPower = DataManager.PlayerData:getSelfEntity():getShowPower(ModuleManager.BattleManager.BATTLE_TYPE.DUNGEON)
|
||||
-- self.powerTx:setText(GFunc.getPowerShow(curPower))
|
||||
local curPower = DataManager.HeroData:getShowPower()
|
||||
self.powerTx:setText(curPower)
|
||||
if not self.scrollRectComp then
|
||||
self.scrollRectComp = self.scrollrect:addLuaComponent(GConst.TYPEOF_LUA_CLASS.SCROLL_RECT_BASE)
|
||||
self.scrollRectComp:addInitCallback(function()
|
||||
return DUNGEON_GOLD_CELL
|
||||
end)
|
||||
self.scrollRectComp:addRefreshCallback(function(index, cell)
|
||||
cell:refresh(index)
|
||||
end)
|
||||
end
|
||||
local allChaptersInfo = DataManager.DungeonDailyData.GoldData:getLimitChaptersInfo()
|
||||
local count = #allChaptersInfo
|
||||
if self.scrollRectComp:getTotalCount() == nil or self.scrollRectComp:getTotalCount() <= 0 then
|
||||
self.scrollRectComp:refillCells(count)
|
||||
elseif self.scrollRectComp:getTotalCount() ~= count then
|
||||
self.scrollRectComp:clearCells()
|
||||
self.scrollRectComp:refillCells(count)
|
||||
else
|
||||
self.scrollRectComp:updateAllCell()
|
||||
end
|
||||
if isFirstEnter then
|
||||
local findIndex = 0
|
||||
local challengeId = DataManager.DungeonDailyData.GoldData:getChallengeId()
|
||||
local maxPassedId = DataManager.DungeonDailyData.GoldData:getMaxPassedId()
|
||||
if challengeId == maxPassedId then -- 全部通关了
|
||||
self.scrollRectComp:moveToIndex(count)
|
||||
else
|
||||
for k, v in ipairs(allChaptersInfo) do
|
||||
if v.id == challengeId and challengeId ~= maxPassedId then
|
||||
findIndex = k - 1
|
||||
break
|
||||
end
|
||||
end
|
||||
if findIndex < 1 then
|
||||
findIndex = 1
|
||||
end
|
||||
self.scrollRectComp:moveToIndex(findIndex)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
return DungeonGoldComp
|
||||
10
lua/app/ui/dungeon/comp/dungeon_gold_comp.lua.meta
Normal file
10
lua/app/ui/dungeon/comp/dungeon_gold_comp.lua.meta
Normal file
@ -0,0 +1,10 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 2300a94014c104e0997e8d79eb2cfdd1
|
||||
ScriptedImporter:
|
||||
internalIDToNameTable: []
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
script: {fileID: 11500000, guid: 3b8b241bab4a4ac9a22fcce9c64f1242, type: 3}
|
||||
62
lua/app/ui/dungeon/comp/dungeon_material_comp.lua
Normal file
62
lua/app/ui/dungeon/comp/dungeon_material_comp.lua
Normal file
@ -0,0 +1,62 @@
|
||||
local DungeonMaterialComp = class("DungeonMaterialComp", LuaComponent)
|
||||
|
||||
local DUNGEON_MATERIAL_CELL = "app/ui/dungeon/cell/dungeon_material_cell"
|
||||
|
||||
function DungeonMaterialComp:init()
|
||||
local uiMap = self:getUIMap()
|
||||
self.scrollrect = uiMap["material_comp.scrollrect"]
|
||||
self.titleTx = uiMap["material_comp.title_tx"]
|
||||
self.descTx = uiMap["material_comp.desc_tx"]
|
||||
self.powerTx = uiMap["material_comp.img_bg.tx_power"]
|
||||
end
|
||||
|
||||
function DungeonMaterialComp:onRefresh(isFirstEnter)
|
||||
self.titleTx:setText(I18N:getGlobalText(I18N.GlobalConst.DUNGEON_TITLE_7))
|
||||
local todayMaxTimes = DataManager.DungeonDailyData.MaterialData:getTodayMaxTimes()
|
||||
local timesStr = DataManager.DungeonDailyData.MaterialData:getTodayRemainTimes() .. "/" .. todayMaxTimes
|
||||
self.descTx:setText(I18N:getGlobalText(I18N.GlobalConst.BUY_VIT_DESC_2, timesStr))
|
||||
-- local curPower = DataManager.PlayerData:getSelfEntity():getShowPower(ModuleManager.BattleManager.BATTLE_TYPE.DUNGEON)
|
||||
-- self.powerTx:setText(GFunc.getPowerShow(curPower))
|
||||
local curPower = DataManager.HeroData:getShowPower()
|
||||
self.powerTx:setText(curPower)
|
||||
if not self.scrollRectComp then
|
||||
self.scrollRectComp = self.scrollrect:addLuaComponent(GConst.TYPEOF_LUA_CLASS.SCROLL_RECT_BASE)
|
||||
self.scrollRectComp:addInitCallback(function()
|
||||
return DUNGEON_MATERIAL_CELL
|
||||
end)
|
||||
self.scrollRectComp:addRefreshCallback(function(index, cell)
|
||||
cell:refresh(index)
|
||||
end)
|
||||
end
|
||||
local allChaptersInfo = DataManager.DungeonDailyData.MaterialData:getLimitChaptersInfo()
|
||||
local count = #allChaptersInfo
|
||||
if self.scrollRectComp:getTotalCount() == nil or self.scrollRectComp:getTotalCount() <= 0 then
|
||||
self.scrollRectComp:refillCells(count)
|
||||
elseif self.scrollRectComp:getTotalCount() ~= count then
|
||||
self.scrollRectComp:clearCells()
|
||||
self.scrollRectComp:refillCells(count)
|
||||
else
|
||||
self.scrollRectComp:updateAllCell()
|
||||
end
|
||||
if isFirstEnter then
|
||||
local findIndex = 0
|
||||
local challengeId = DataManager.DungeonDailyData.MaterialData:getChallengeId()
|
||||
local maxPassedId = DataManager.DungeonDailyData.MaterialData:getMaxPassedId()
|
||||
if challengeId == maxPassedId then -- 全部通关了
|
||||
self.scrollRectComp:moveToIndex(count)
|
||||
else
|
||||
for k, v in ipairs(allChaptersInfo) do
|
||||
if v.id == challengeId and challengeId ~= maxPassedId then
|
||||
findIndex = k - 1
|
||||
break
|
||||
end
|
||||
end
|
||||
if findIndex < 1 then
|
||||
findIndex = 1
|
||||
end
|
||||
self.scrollRectComp:moveToIndex(findIndex)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
return DungeonMaterialComp
|
||||
10
lua/app/ui/dungeon/comp/dungeon_material_comp.lua.meta
Normal file
10
lua/app/ui/dungeon/comp/dungeon_material_comp.lua.meta
Normal file
@ -0,0 +1,10 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 50c19fb0a117e477190e43a351d23242
|
||||
ScriptedImporter:
|
||||
internalIDToNameTable: []
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
script: {fileID: 11500000, guid: 3b8b241bab4a4ac9a22fcce9c64f1242, type: 3}
|
||||
@ -1,138 +0,0 @@
|
||||
local DungeonBoardCell = class("DungeonBoardCell", BaseCell)
|
||||
|
||||
local HIDE_REWARD_MODULE = {
|
||||
[ModuleManager.MODULE_KEY.DUNGEON_WEAPON] = true,
|
||||
[ModuleManager.MODULE_KEY.DUNGEON_ARMOR] = true,
|
||||
[ModuleManager.MODULE_KEY.RUNES_OPEN] = true,
|
||||
}
|
||||
|
||||
function DungeonBoardCell:init()
|
||||
self.uiMap = self:getUIMap()
|
||||
|
||||
self.txTitle = self.uiMap["dungeon_board_cell.tx_title"]
|
||||
self.countdown = self.uiMap["dungeon_board_cell.countdown"]
|
||||
self.txCountdown = self.uiMap["dungeon_board_cell.countdown.tx_countdown"]
|
||||
self.txOpen = self.uiMap["dungeon_board_cell.tx_open"]
|
||||
self.lock = self.uiMap["dungeon_board_cell.lock"]
|
||||
self.lockIcon = self.uiMap["dungeon_board_cell.lock.desc.icon"]
|
||||
self.lockTxLock = self.uiMap["dungeon_board_cell.lock.desc.tx_lock"]
|
||||
self.lockIconCountdown = self.uiMap["dungeon_board_cell.lock.countdown.icon"]
|
||||
self.lockTxCountdown = self.uiMap["dungeon_board_cell.lock.countdown.tx_countdown"]
|
||||
self.btnStart = self.uiMap["dungeon_board_cell.btn_start"]
|
||||
self.txStart = self.uiMap["dungeon_board_cell.btn_start.tx_btn"]
|
||||
self.txTimes = self.uiMap["dungeon_board_cell.btn_start.tx_times"]
|
||||
self.btnHelp = self.uiMap["dungeon_board_cell.btn_help"]
|
||||
self.itemReward = self.uiMap["dungeon_board_cell.reward_cell"]:addLuaComponent(GConst.TYPEOF_LUA_CLASS.REWARD_CELL)
|
||||
|
||||
self.btnStart:addClickListener(function()
|
||||
DataManager.DungeonData:onClickFight(self.moduleKey)
|
||||
end)
|
||||
self.btnHelp:addClickListener(function()
|
||||
-- 展示提示
|
||||
ModuleManager.TipsManager:showDescTips(DataManager.DungeonData:getRule(self.moduleKey), self.btnHelp)
|
||||
end)
|
||||
end
|
||||
|
||||
function DungeonBoardCell:refresh(moduleKey)
|
||||
self.moduleKey = moduleKey
|
||||
|
||||
self:getGameObject().name = self.moduleKey
|
||||
self:refreshInfo()
|
||||
self:refreshRewards()
|
||||
end
|
||||
|
||||
function DungeonBoardCell:refreshInfo()
|
||||
self.txTitle:setText(DataManager.DungeonData:getTitle(self.moduleKey))
|
||||
self.txOpen:setText("<color=" .. DataManager.DungeonData:getOpenTextColor(self.moduleKey) .. ">" .. DataManager.DungeonData:getOpenTimeDesc(self.moduleKey) .. "</color>")
|
||||
self.baseObject:setTexture(DataManager.DungeonData:getBanner(self.moduleKey))
|
||||
|
||||
if DataManager.DungeonData:isActive(self.moduleKey) then
|
||||
self.btnStart:setVisible(true)
|
||||
self.countdown:setVisible(true)
|
||||
self.lock:setVisible(false)
|
||||
|
||||
-- 红点
|
||||
if DataManager.DungeonData:isCanChallenge(self.moduleKey) then
|
||||
self.btnStart:addRedPoint(110, 40, 0.6)
|
||||
else
|
||||
self.btnStart:removeRedPoint()
|
||||
end
|
||||
|
||||
self.txOpen:setAnchoredPositionY(-110)
|
||||
self.txStart:setText(I18N:getGlobalText(I18N.GlobalConst.START_DESC))
|
||||
if self.moduleKey == ModuleManager.MODULE_KEY.DUNGEON_WEAPON then
|
||||
local weaponData = DataManager.DungeonData:getDungeonDataByType(ModuleManager.MODULE_KEY.DUNGEON_WEAPON)
|
||||
local time = weaponData:getRemianFarmCount()
|
||||
local timeStr = nil
|
||||
if time <= 0 then
|
||||
timeStr = "<color=#FF6464>" .. time .. "</color>"
|
||||
else
|
||||
timeStr = time
|
||||
end
|
||||
self.txTimes:setText(I18N:getGlobalText(I18N.GlobalConst.DUNGEON_WEAPON_DESC_5, timeStr))
|
||||
else
|
||||
local time = DataManager.DungeonData:getRemainTimes(self.moduleKey)
|
||||
local timeStr = nil
|
||||
if time <= 0 then
|
||||
timeStr = "<color=#FF6464>" .. time .. "</color>"
|
||||
else
|
||||
timeStr = time
|
||||
end
|
||||
self.txTimes:setText(I18N:getGlobalText(I18N.GlobalConst.TODAY_REMAIN_TIMES, timeStr))
|
||||
end
|
||||
|
||||
if DataManager.DungeonData:isNotShowLimitCount(self.moduleKey) then
|
||||
self.txTimes:setText(GConst.EMPTY_STRING)
|
||||
end
|
||||
|
||||
self:refreshCountdown(self.txCountdown)
|
||||
else
|
||||
self.btnStart:setVisible(false)
|
||||
self.countdown:setVisible(false)
|
||||
self.lock:setVisible(true)
|
||||
|
||||
self.txOpen:setAnchoredPositionY(-75)
|
||||
self.lockTxLock:setText(I18N:getGlobalText(I18N.GlobalConst.DUNGEON_OPEN))
|
||||
self:refreshCountdown(self.lockTxCountdown)
|
||||
end
|
||||
|
||||
GFunc.centerImgAndTx(self.lockIcon, self.lockTxLock, 10)
|
||||
GFunc.centerImgAndTx(self.lockIconCountdown, self.lockTxCountdown, 10)
|
||||
end
|
||||
|
||||
function DungeonBoardCell:refreshRewards()
|
||||
if HIDE_REWARD_MODULE[self.moduleKey] then
|
||||
self.itemReward:getBaseObject():setActive(false)
|
||||
else
|
||||
self.itemReward:getBaseObject():setActive(true)
|
||||
local id = DataManager.DungeonData:getBoardShowRewardId(self.moduleKey)
|
||||
self.itemReward:refreshItemById(id, 0)
|
||||
end
|
||||
end
|
||||
|
||||
function DungeonBoardCell:refreshCountdown(txCountdown)
|
||||
if self.countdownSid then
|
||||
self:getBaseObject():unscheduleGlobal(self.countdownSid)
|
||||
self.countdownSid = nil
|
||||
end
|
||||
if DataManager.DungeonData:getIsAllTimeOpen(self.moduleKey) then
|
||||
self.countdown:setVisible(false)
|
||||
else
|
||||
self.countdownSid = self:getBaseObject():scheduleGlobal(function()
|
||||
self:updateTime(txCountdown)
|
||||
end, 1)
|
||||
self:updateTime(txCountdown)
|
||||
end
|
||||
end
|
||||
|
||||
function DungeonBoardCell:updateTime(txCountdown)
|
||||
if self.remainTime == nil or self.remainTime < 0 then
|
||||
self.remainTime = DataManager.DungeonData:geNextTime(self.moduleKey)
|
||||
else
|
||||
self.remainTime = self.remainTime - 1
|
||||
end
|
||||
|
||||
txCountdown:setText(GFunc.getTimeStrWithHMS(self.remainTime))
|
||||
end
|
||||
|
||||
return DungeonBoardCell
|
||||
@ -1,60 +1,76 @@
|
||||
local DungeonComp = class("DungeonComp", LuaComponent)
|
||||
|
||||
-- function DungeonComp:getIsOpen()
|
||||
-- return DataManager.DungeonData:isOpenAnyone()
|
||||
-- end
|
||||
|
||||
-- function DungeonComp:getEntranceName()
|
||||
-- return I18N:getGlobalText(I18N.GlobalConst.DUNGEON_BTN)
|
||||
-- end
|
||||
|
||||
-- function DungeonComp:getShowEntranceRedPoint()
|
||||
-- return DataManager.DungeonData:isCanChallengeAnyone()
|
||||
-- end
|
||||
|
||||
-- function DungeonComp:ctor()
|
||||
-- end
|
||||
local CELL = "app/ui/dungeon/cell/dungeon_cell"
|
||||
|
||||
function DungeonComp:init()
|
||||
self.uiMap = self:getBaseObject():genAllChildren()
|
||||
local uiMap = self:getUIMap()
|
||||
self.scrollrect = uiMap["dungeon_comp.content.scrollrect"]
|
||||
|
||||
self.scrollRect = self.uiMap["dungeon_comp.scrollrect"]
|
||||
self.scrollRectComp = self.scrollRect:addLuaComponent(GConst.TYPEOF_LUA_CLASS.SCROLL_RECT_BASE)
|
||||
self.scrollRectComp:addInitCallback(function()
|
||||
return "app/ui/dungeon/dungeon_board_cell"
|
||||
self:bind(DataManager.DungeonDailyData.GoldData, "isDirty", function()
|
||||
self:refresh()
|
||||
end)
|
||||
self.scrollRectComp:addRefreshCallback(function(index, cell)
|
||||
cell:refresh(self.openDungeons[index].module)
|
||||
self:bind(DataManager.DungeonDailyData.MaterialData, "isDirty", function()
|
||||
self:refresh()
|
||||
end)
|
||||
self.scrollRectComp:setTotalCount(0)
|
||||
end
|
||||
|
||||
function DungeonComp:refresh(targetMuduleKey)
|
||||
if EDITOR_MODE then
|
||||
Logger.logHighlight("更新副本显示."..tostring(Time:getTodaySurplusTime()))
|
||||
function DungeonComp:refresh(moduleKey)
|
||||
if not self:getBaseObject():getActiveSelf() then
|
||||
return
|
||||
end
|
||||
self.openDungeons = DataManager.DungeonData:getOpenDungeons()
|
||||
local targetIndex
|
||||
if targetMuduleKey then
|
||||
for index, dungeon in ipairs(self.openDungeons) do
|
||||
if dungeon.module == targetMuduleKey then
|
||||
targetIndex = index
|
||||
break
|
||||
end
|
||||
end
|
||||
end
|
||||
self.scrollRectComp:clearCells()
|
||||
self.scrollRectComp:refillCells(#self.openDungeons, nil, targetIndex)
|
||||
self:checkRankData()
|
||||
|
||||
-- 跨天定时器
|
||||
if self.countdownSid then
|
||||
self:getBaseObject():unscheduleGlobal(self.countdownSid)
|
||||
self.countdownSid = nil
|
||||
self.showList = DataManager.DungeonData:getDungeonList()
|
||||
if self.scrollRect == nil then
|
||||
self.scrollRect = self.scrollrect:addLuaComponent(GConst.TYPEOF_LUA_CLASS.SCROLL_RECT_BASE)
|
||||
self.scrollRect:addInitCallback(function()
|
||||
return CELL
|
||||
end)
|
||||
self.scrollRect:addRefreshCallback(function(index, cell)
|
||||
if self.showList[index] then
|
||||
cell:refresh(self.showList[index])
|
||||
else
|
||||
cell:showComingSoon()
|
||||
end
|
||||
end)
|
||||
end
|
||||
local cellCount = #self.showList
|
||||
if not GFunc.isShenhe() then
|
||||
cellCount = cellCount + 1 -- 最后一个显示敬请期待
|
||||
end
|
||||
if self.scrollRect:getTotalCount() == nil or self.scrollRect:getTotalCount() <= 0 then
|
||||
self.scrollRect:refillCells(cellCount)
|
||||
elseif self.scrollRect:getTotalCount() ~= cellCount then
|
||||
self.scrollRect:clearCells()
|
||||
self.scrollRect:refillCells(cellCount)
|
||||
else
|
||||
self.scrollRect:updateAllCell()
|
||||
end
|
||||
self.countdownSid = self:getBaseObject():scheduleGlobal(function()
|
||||
ModuleManager.DungeonManager:checkDayChange()
|
||||
end, Time:getTodaySurplusTime() + 1)
|
||||
|
||||
local findIdx = moduleKey and table.indexof(self.showList, moduleKey) or 0
|
||||
if moduleKey then
|
||||
self.scrollRect:moveToIndex(findIdx)
|
||||
end
|
||||
end
|
||||
|
||||
function DungeonComp:onCrossDay()
|
||||
self.checkedRank = false
|
||||
end
|
||||
|
||||
function DungeonComp:checkRankData()
|
||||
if self.checkedRank then
|
||||
return
|
||||
end
|
||||
self.checkedRank = true
|
||||
end
|
||||
|
||||
function DungeonComp:updateTime()
|
||||
local list = self.scrollRect:getListCell()
|
||||
if list then
|
||||
for k, v in ipairs(list) do
|
||||
v:updateTime()
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
return DungeonComp
|
||||
134
lua/app/ui/dungeon/dungeon_daily_main_ui.lua
Normal file
134
lua/app/ui/dungeon/dungeon_daily_main_ui.lua
Normal file
@ -0,0 +1,134 @@
|
||||
local DungeonDailyMainUI = class("DungeonDailyMainUI", BaseUI)
|
||||
|
||||
local DUNGEON_GOLD_COMP = "app/ui/dungeon/comp/dungeon_gold_comp"
|
||||
local DUNGEON_MATERIAL_COMP = "app/ui/dungeon/comp/dungeon_material_comp"
|
||||
|
||||
function DungeonDailyMainUI:ctor(params)
|
||||
self.page = params and params.page
|
||||
if self.page == nil then
|
||||
if DataManager.DungeonDailyData.GoldData:isOpen() then
|
||||
self.page = GConst.DungeonConst.DUNGEON_DAILY_TYPE.GOLD
|
||||
elseif DataManager.DungeonDailyData.MaterialData:isOpen() then
|
||||
self.page = GConst.DungeonConst.DUNGEON_DAILY_TYPE.MATERIAL
|
||||
end
|
||||
elseif self.page == GConst.DungeonConst.DUNGEON_DAILY_TYPE.GOLD then
|
||||
if not DataManager.DungeonDailyData.GoldData:isOpen() then
|
||||
self.page = GConst.DungeonConst.DUNGEON_DAILY_TYPE.MATERIAL
|
||||
end
|
||||
elseif self.page == GConst.DungeonConst.DUNGEON_DAILY_TYPE.MATERIAL then
|
||||
if not DataManager.DungeonDailyData.MaterialData:isOpen() then
|
||||
self.page = GConst.DungeonConst.DUNGEON_DAILY_TYPE.GOLD
|
||||
end
|
||||
end
|
||||
self.btns = {}
|
||||
end
|
||||
|
||||
function DungeonDailyMainUI:getPrefabPath()
|
||||
return "assets/prefabs/ui/dungeon/dungeon_daily_main_ui.prefab"
|
||||
end
|
||||
|
||||
function DungeonDailyMainUI:onLoadRootComplete()
|
||||
local uiMap = self.root:genAllChildren()
|
||||
self.closeBtn = uiMap["dungeon_daily_main_ui.bottom.close_btn"]
|
||||
self.closeBtn:addClickListener(function()
|
||||
self:closeUI()
|
||||
end)
|
||||
|
||||
self.dungeonGoldComp = uiMap["dungeon_daily_main_ui.gold_comp"]:addLuaComponent(DUNGEON_GOLD_COMP)
|
||||
self.dungeonMaterialComp = uiMap["dungeon_daily_main_ui.material_comp"]:addLuaComponent(DUNGEON_MATERIAL_COMP)
|
||||
|
||||
self.goldBtn = uiMap["dungeon_daily_main_ui.bottom.gold_btn"]
|
||||
self.goldBtn:addClickListener(function()
|
||||
self:switchPage(GConst.DungeonConst.DUNGEON_DAILY_TYPE.GOLD)
|
||||
end)
|
||||
uiMap["dungeon_daily_main_ui.bottom.gold_btn.text"]:setText(I18N:getGlobalText(I18N.GlobalConst.DUNGEON_TITLE_8))
|
||||
self.materialBtn = uiMap["dungeon_daily_main_ui.bottom.material_btn"]
|
||||
self.materialBtn:addClickListener(function()
|
||||
self:switchPage(GConst.DungeonConst.DUNGEON_DAILY_TYPE.MATERIAL)
|
||||
end)
|
||||
uiMap["dungeon_daily_main_ui.bottom.material_btn.text"]:setText(I18N:getGlobalText(I18N.GlobalConst.DUNGEON_TITLE_9))
|
||||
|
||||
self:_bind()
|
||||
end
|
||||
|
||||
function DungeonDailyMainUI:_bind()
|
||||
self:bind(DataManager.DungeonDailyData.GoldData, "isDirty", function()
|
||||
self:onRefresh()
|
||||
end)
|
||||
self:bind(DataManager.DungeonDailyData.MaterialData, "isDirty", function()
|
||||
self:onRefresh()
|
||||
end)
|
||||
self:bind(DataManager.PrivilegeCardData, "isDirty", function()
|
||||
self:onRefresh()
|
||||
end)
|
||||
end
|
||||
|
||||
function DungeonDailyMainUI:onRefresh()
|
||||
local btnsCount = #self.btns
|
||||
for i = 1, btnsCount do
|
||||
table.remove(self.btns)
|
||||
end
|
||||
if DataManager.DungeonDailyData.MaterialData:isOpen() then
|
||||
self.materialBtn:setActive(true)
|
||||
table.insert(self.btns, self.materialBtn)
|
||||
if DataManager.DungeonDailyData.MaterialData:getIsShowRedPoint() then
|
||||
self.materialBtn:addRedPoint(30, 30, 1)
|
||||
else
|
||||
self.materialBtn:removeRedPoint()
|
||||
end
|
||||
else
|
||||
self.materialBtn:setActive(false)
|
||||
end
|
||||
if DataManager.DungeonDailyData.GoldData:isOpen() then
|
||||
self.goldBtn:setActive(true)
|
||||
table.insert(self.btns, self.goldBtn)
|
||||
if DataManager.DungeonDailyData.GoldData:getIsShowRedPoint() then
|
||||
self.goldBtn:addRedPoint(30, 30, 1)
|
||||
else
|
||||
self.goldBtn:removeRedPoint()
|
||||
end
|
||||
else
|
||||
self.goldBtn:setActive(false)
|
||||
end
|
||||
for k, v in ipairs(self.btns) do
|
||||
v:setAnchoredPositionX(-76 - (k-1)*123)
|
||||
end
|
||||
self:switchPage(self.page)
|
||||
end
|
||||
|
||||
function DungeonDailyMainUI:switchPage(page)
|
||||
self.page = page
|
||||
if self.page == GConst.DungeonConst.DUNGEON_DAILY_TYPE.GOLD then
|
||||
self.dungeonGoldComp:getBaseObject():setActive(true)
|
||||
self.dungeonMaterialComp:getBaseObject():setActive(false)
|
||||
self.goldBtn:setSprite(GConst.ATLAS_PATH.UI_DUNGEON, "dungeon_btn_2_1")
|
||||
self.materialBtn:setSprite(GConst.ATLAS_PATH.UI_DUNGEON, "dungeon_btn_1_2")
|
||||
self:refreshGold()
|
||||
elseif self.page == GConst.DungeonConst.DUNGEON_DAILY_TYPE.MATERIAL then
|
||||
self.dungeonGoldComp:getBaseObject():setActive(false)
|
||||
self.dungeonMaterialComp:getBaseObject():setActive(true)
|
||||
self.goldBtn:setSprite(GConst.ATLAS_PATH.UI_DUNGEON, "dungeon_btn_2_2")
|
||||
self.materialBtn:setSprite(GConst.ATLAS_PATH.UI_DUNGEON, "dungeon_btn_1_1")
|
||||
self:refreshMaterial()
|
||||
end
|
||||
end
|
||||
|
||||
function DungeonDailyMainUI:refreshGold()
|
||||
if self._alreadyEnterGold == nil then
|
||||
self._alreadyEnterGold = true
|
||||
self.dungeonGoldComp:onRefresh(true)
|
||||
else
|
||||
self.dungeonGoldComp:onRefresh()
|
||||
end
|
||||
end
|
||||
|
||||
function DungeonDailyMainUI:refreshMaterial()
|
||||
if self._alreadyEnterMaterial == nil then
|
||||
self._alreadyEnterMaterial = true
|
||||
self.dungeonMaterialComp:onRefresh(true)
|
||||
else
|
||||
self.dungeonMaterialComp:onRefresh(false)
|
||||
end
|
||||
end
|
||||
|
||||
return DungeonDailyMainUI
|
||||
10
lua/app/ui/dungeon/dungeon_daily_main_ui.lua.meta
Normal file
10
lua/app/ui/dungeon/dungeon_daily_main_ui.lua.meta
Normal file
@ -0,0 +1,10 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 7c842c06a8fa0463b8d19320e0264fa0
|
||||
ScriptedImporter:
|
||||
internalIDToNameTable: []
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
script: {fileID: 11500000, guid: 3b8b241bab4a4ac9a22fcce9c64f1242, type: 3}
|
||||
@ -1,182 +0,0 @@
|
||||
local DungeonDifficultyUI = class("DungeonDifficultyUI", BaseUI)
|
||||
|
||||
function DungeonDifficultyUI:isFullScreen()
|
||||
return false
|
||||
end
|
||||
|
||||
function DungeonDifficultyUI:getPrefabPath()
|
||||
return "assets/prefabs/ui/dungeon/dungeon_difficulty_ui.prefab"
|
||||
end
|
||||
|
||||
function DungeonDifficultyUI:ctor(params)
|
||||
self.module = params.module
|
||||
self.curId = DataManager.DungeonData:getUnlockMaxId(self.module)
|
||||
end
|
||||
|
||||
function DungeonDifficultyUI:onCover()
|
||||
end
|
||||
|
||||
function DungeonDifficultyUI:onReshow()
|
||||
end
|
||||
|
||||
function DungeonDifficultyUI:onClose()
|
||||
end
|
||||
|
||||
function DungeonDifficultyUI:onLoadRootComplete()
|
||||
self.uiMap = self.root:genAllChildren()
|
||||
|
||||
self.icon = self.uiMap["dungeon_difficulty_ui.bg.title.icon_title"]
|
||||
self.btnClose = self.uiMap["dungeon_difficulty_ui.bg.close_btn"]
|
||||
self.btnStart = self.uiMap["dungeon_difficulty_ui.bg.btns.btn_start"]
|
||||
self.txStart = self.uiMap["dungeon_difficulty_ui.bg.btns.btn_start.tx_start"]
|
||||
self.txStartCost = self.uiMap["dungeon_difficulty_ui.bg.btns.btn_start.cost.tx_cost"]
|
||||
self.btnSweep = self.uiMap["dungeon_difficulty_ui.bg.btns.btn_sweep"]
|
||||
self.txSweep = self.uiMap["dungeon_difficulty_ui.bg.btns.btn_sweep.tx_sweep"]
|
||||
self.txSweepCost = self.uiMap["dungeon_difficulty_ui.bg.btns.btn_sweep.cost.tx_cost"]
|
||||
self.txTime = self.uiMap["dungeon_difficulty_ui.bg.btns.tx_time"]
|
||||
self.txDifficulty = self.uiMap["dungeon_difficulty_ui.bg.select.chapter.tx_difficulty"]
|
||||
self.txLevel = self.uiMap["dungeon_difficulty_ui.bg.select.chapter.tx_level"]
|
||||
self.arrowLeft = self.uiMap["dungeon_difficulty_ui.bg.select.chapter.arrow_left"]
|
||||
self.arrowRight = self.uiMap["dungeon_difficulty_ui.bg.select.chapter.arrow_right"]
|
||||
self.txTitle = self.uiMap["dungeon_difficulty_ui.bg.title.title_text"]
|
||||
self.buffObj = self.uiMap["dungeon_difficulty_ui.bg.boss_buff"]
|
||||
self.txbuff = self.uiMap["dungeon_difficulty_ui.bg.boss_buff.tx_buff"]
|
||||
self.iconBuff = self.uiMap["dungeon_difficulty_ui.bg.boss_buff.icon_buff"]
|
||||
self.rewardTx = self.uiMap["dungeon_difficulty_ui.bg.reward_desc"]
|
||||
self.rewardFirst = self.uiMap["dungeon_difficulty_ui.bg.rewards.reward_first"]:addLuaComponent(GConst.TYPEOF_LUA_CLASS.REWARD_CELL)
|
||||
self.rewardPass = self.uiMap["dungeon_difficulty_ui.bg.rewards.reward_pass"]:addLuaComponent(GConst.TYPEOF_LUA_CLASS.REWARD_CELL)
|
||||
self.txFrist = self.uiMap["dungeon_difficulty_ui.bg.rewards.reward_first.first.tx_first"]
|
||||
self.Frist = self.uiMap["dungeon_difficulty_ui.bg.rewards.reward_first.first"]
|
||||
self.txLock = self.uiMap["dungeon_difficulty_ui.bg.tx_lock"]
|
||||
self.btnGroup = self.uiMap["dungeon_difficulty_ui.bg.btns"]
|
||||
|
||||
local iconPath = DataManager.DungeonData:getIcon(self.module)
|
||||
self.icon:setSprite(iconPath[1], iconPath[2], function()
|
||||
self.icon:getComponent(GConst.TYPEOF_UNITY_CLASS.UI_IMAGE):SetNativeSize()
|
||||
end)
|
||||
self.txTitle:setText(DataManager.DungeonData:getTitle(self.module))
|
||||
self.txDifficulty:setText(I18N:getGlobalText(I18N.GlobalConst.DUNGEON_STAGE))
|
||||
self.txStart:setText(I18N:getGlobalText(I18N.GlobalConst.START_DESC))
|
||||
self.txSweep:setText(I18N:getGlobalText(I18N.GlobalConst.SMASH))
|
||||
local cost = DataManager.DungeonData:getChallengeHpCost(self.module)
|
||||
self.txStartCost:setText(GFunc.getRewardNum(cost))
|
||||
self.txSweepCost:setText(GFunc.getRewardNum(cost))
|
||||
self.txFrist:setText(I18N:getGlobalText(I18N.GlobalConst.FIRST_PASS))
|
||||
self.rewardTx:setText(I18N:getGlobalText(I18N.GlobalConst.REWARD_DESC))
|
||||
self.txLock:setText(I18N:getGlobalText(I18N.GlobalConst.PASS_REQUIRE))
|
||||
|
||||
-- 背景自适应文本
|
||||
self.txFrist:getComponent(GConst.TYPEOF_UNITY_CLASS.UI_TEXT_MESH_PRO):ForceMeshUpdate()
|
||||
local txW = self.txFrist:getComponent(GConst.TYPEOF_UNITY_CLASS.UI_TEXT_MESH_PRO).renderedWidth
|
||||
self.Frist:setSizeDeltaX(txW + 20)
|
||||
|
||||
self:refreshDifficulty()
|
||||
|
||||
self.btnClose:addClickListener(function()
|
||||
self:closeUI()
|
||||
end)
|
||||
self.btnStart:addClickListener(function()
|
||||
-- 开始挑战
|
||||
ModuleManager.DungeonManager:reqChallenge(self.module, self.curId)
|
||||
end)
|
||||
self.btnSweep:addClickListener(function()
|
||||
-- 开始扫荡
|
||||
ModuleManager.DungeonManager:reqSweep(self.module, self.curId)
|
||||
end)
|
||||
self.arrowLeft:addClickListener(function()
|
||||
if self:isMinId() then
|
||||
return
|
||||
end
|
||||
|
||||
self.curId = self.curId - 1
|
||||
self:refreshDifficulty()
|
||||
end)
|
||||
self.arrowRight:addClickListener(function()
|
||||
if self:isMaxId() then
|
||||
return
|
||||
end
|
||||
|
||||
self.curId = self.curId + 1
|
||||
self:refreshDifficulty()
|
||||
end)
|
||||
|
||||
self:addEventListener(EventManager.CUSTOM_EVENT.DUNGEON_DAY_CHANGE, function()
|
||||
self:closeUI()
|
||||
end)
|
||||
self:addEventListener(EventManager.CUSTOM_EVENT.DUNGEON_CHALLENGE, function()
|
||||
self:closeUI()
|
||||
end)
|
||||
self:addEventListener(EventManager.CUSTOM_EVENT.DUNGEON_SWEEP, function()
|
||||
self:refreshDifficulty()
|
||||
end)
|
||||
end
|
||||
|
||||
function DungeonDifficultyUI:refreshDifficulty()
|
||||
self.btnSweep:setActive(self:isCanSweepId())
|
||||
self.txLevel:setText(tostring(self.curId))
|
||||
|
||||
-- buff
|
||||
local buff = DataManager.DungeonData:getBossBuff(self.module, self.curId)
|
||||
if buff then
|
||||
local cfg = ConfigManager:getConfigWithOtherKey("buff", "name")[buff.type]
|
||||
self.buffObj:setActive(true)
|
||||
self.txbuff:setText(I18N:getGlobalText(I18N.GlobalConst.DUNGEON_DESC))
|
||||
self.iconBuff:setSprite(GConst.ATLAS_PATH.ICON_BUFF, cfg.icon)
|
||||
self.iconBuff:addClickListener(function()
|
||||
ModuleManager.TipsManager:showDescTips(GFunc.getBuffDesc(buff.type, buff.num), self.iconBuff)
|
||||
end)
|
||||
|
||||
GFunc.centerTxAndImg(self.txbuff, self.iconBuff, 5)
|
||||
else
|
||||
self.buffObj:setActive(false)
|
||||
end
|
||||
|
||||
-- 箭头
|
||||
self.txLock:setActive(not self:isCanChallengeId())
|
||||
self.btnGroup:setActive(self:isCanChallengeId())
|
||||
self.arrowRight:setActive(not self:isMaxId())
|
||||
self.arrowLeft:setActive(not self:isMinId())
|
||||
|
||||
-- 奖励
|
||||
local id = DataManager.DungeonData:getBoardShowRewardId(self.module)
|
||||
local firstNum = DataManager.DungeonData:getFirstRewardNum(self.module, self.curId)
|
||||
firstNum = firstNum or 0
|
||||
local passNum = DataManager.DungeonData:getPassRewardNum(self.module, self.curId)
|
||||
passNum = passNum or 0
|
||||
|
||||
self.rewardFirst:refreshItemById(id, firstNum)
|
||||
self.rewardPass:refreshItemById(id, passNum)
|
||||
self.rewardFirst:getBaseObject():setActive((not self:isCanSweepId()) and firstNum)
|
||||
|
||||
-- 次数
|
||||
local time = DataManager.DungeonData:getRemainTimes(self.module)
|
||||
local timeStr = nil
|
||||
if time <= 0 then
|
||||
timeStr = "<color=#FF8181>" .. time .. "</color>"
|
||||
else
|
||||
timeStr = time
|
||||
end
|
||||
self.txTime:setText(I18N:getGlobalText(I18N.GlobalConst.TODAY_REMAIN_TIMES, timeStr))
|
||||
end
|
||||
|
||||
-- 是否是可扫荡关卡
|
||||
function DungeonDifficultyUI:isCanSweepId()
|
||||
return self.curId <= DataManager.DungeonData:getPassedMaxId(self.module)
|
||||
end
|
||||
|
||||
--是否是可挑战关卡
|
||||
function DungeonDifficultyUI:isCanChallengeId()
|
||||
return self.curId <= DataManager.DungeonData:getUnlockMaxId(self.module)
|
||||
end
|
||||
|
||||
-- 是最大副本id
|
||||
function DungeonDifficultyUI:isMaxId()
|
||||
return self.curId == DataManager.DungeonData:getConfigMaxId(self.module)
|
||||
end
|
||||
|
||||
--是最小关卡
|
||||
function DungeonDifficultyUI:isMinId()
|
||||
return self.curId == 1
|
||||
end
|
||||
|
||||
return DungeonDifficultyUI
|
||||
@ -1,163 +0,0 @@
|
||||
local ItemGetUI = class("ItemGetUI", BaseUI)
|
||||
|
||||
local COMMON_MAIN_POSY = 0
|
||||
local COMMON_CLOSE_POSY = 280
|
||||
local GIFT_MAIN_POSY = 220
|
||||
local GIFT_CLOSE_POSY = 140
|
||||
|
||||
function ItemGetUI:isFullScreen()
|
||||
return false
|
||||
end
|
||||
|
||||
function ItemGetUI:getPrefabPath()
|
||||
return "assets/prefabs/ui/dungeon/item_get_ui.prefab"
|
||||
end
|
||||
|
||||
function ItemGetUI:onPressBackspace()
|
||||
self:closeUI()
|
||||
end
|
||||
|
||||
function ItemGetUI:onClose()
|
||||
if self.giftCountdownSid then
|
||||
self.txCountdown:unscheduleGlobal(self.giftCountdownSid)
|
||||
end
|
||||
end
|
||||
|
||||
function ItemGetUI:ctor(parmas)
|
||||
self.equipEntity = DataManager.EquipData:getEquip(parmas.heroId, parmas.part)
|
||||
self.targetId = parmas.id
|
||||
self.targetNum = parmas.value
|
||||
end
|
||||
|
||||
function ItemGetUI:onLoadRootComplete()
|
||||
local uiMap = self.root:genAllChildren()
|
||||
|
||||
self.btnClose = uiMap["item_get_ui.content.btn_close"]
|
||||
-- 主界面
|
||||
self.panelMain = uiMap["item_get_ui.panel_main"]
|
||||
self.txTitle = uiMap["item_get_ui.content.title.tx_title"]
|
||||
self.rewardCell = uiMap["item_get_ui.content.reward_cell"]:addLuaComponent(GConst.TYPEOF_LUA_CLASS.REWARD_CELL)
|
||||
self.txDesc = uiMap["item_get_ui.content.tx_desc"]
|
||||
self.txGet = uiMap["item_get_ui.content.tx_get"]
|
||||
self.scrollRectComp = uiMap["item_get_ui.content.scroll_view"]:addLuaComponent(GConst.TYPEOF_LUA_CLASS.SCROLL_RECT_BASE)
|
||||
-- 礼包界面
|
||||
self.panelGift = uiMap["item_get_ui.panel_gift"]
|
||||
self.txGiftTitle = uiMap["item_get_ui.panel_gift.tx_title"]
|
||||
self.txCountdown = uiMap["item_get_ui.panel_gift.time_node.tx_countdown"]
|
||||
self.btnBuy = uiMap["item_get_ui.panel_gift.buy_btn"]
|
||||
self.txBuy = uiMap["item_get_ui.panel_gift.buy_btn.tx_buy"]
|
||||
self.rewardNodeLayout = uiMap["item_get_ui.panel_gift.item_node"]:getComponent(GConst.TYPEOF_UNITY_CLASS.BF_HORIZONTAL_OR_VERTICAL_LAYOUT)
|
||||
self.rewardCellList = {}
|
||||
for i = 1, 4 do
|
||||
table.insert(self.rewardCellList, CellManager:addCellComp(uiMap["item_get_ui.panel_gift.item_node.pop_reward_cell_" .. i], GConst.TYPEOF_LUA_CLASS.POP_REWARD_CELL))
|
||||
end
|
||||
|
||||
self.scrollRectComp:addInitCallback(function()
|
||||
return "app/ui/dungeon/cell/dungeon_target_cell"
|
||||
end)
|
||||
self.scrollRectComp:addRefreshCallback(function(index, cell)
|
||||
cell:refresh(self.targetId, self.targetNum, self.wayType, self.wayList[index])
|
||||
end)
|
||||
|
||||
self.btnBuy:addClickListener(function()
|
||||
if self.giftId then
|
||||
PayManager:purchasePackage(self.giftId, PayManager.PURCHARSE_TYPE.ACT_GIFT)
|
||||
end
|
||||
end)
|
||||
self.btnClose:addClickListener(function()
|
||||
self:closeUI()
|
||||
end)
|
||||
self:addEventListener(EventManager.CUSTOM_EVENT.GO_DUNGEON_UI, function()
|
||||
self:closeUI()
|
||||
end)
|
||||
self:bind(DataManager.DungeonData:getDungeonDataByType(ModuleManager.MODULE_KEY.DUNGEON_WEAPON), "isDirty", function()
|
||||
self:onRefresh()
|
||||
end)
|
||||
self:bind(DataManager.DungeonData:getDungeonDataByType(ModuleManager.MODULE_KEY.DUNGEON_ARMOR), "isDirty", function()
|
||||
self:onRefresh()
|
||||
end)
|
||||
self:bind(DataManager.EquipData, "isDirty", function()
|
||||
self:onRefresh()
|
||||
end)
|
||||
end
|
||||
|
||||
function ItemGetUI:onRefresh()
|
||||
self.txTitle:setText(I18N:getText("item", self.targetId, "name"))
|
||||
self.txDesc:setText(I18N:getText("item", self.targetId, "desc"))
|
||||
self.txGet:setText(I18N:getGlobalText(I18N.GlobalConst.EQUIP_DESC_23))
|
||||
self.rewardCell:refreshItemById(self.targetId)
|
||||
|
||||
local itemCfg = ConfigManager:getConfig("item")[self.targetId]
|
||||
if itemCfg == nil or itemCfg.get_way_type == nil or itemCfg.get_way == nil or #itemCfg.get_way == 0 then
|
||||
self:closeUI()
|
||||
return
|
||||
end
|
||||
|
||||
self.wayType = itemCfg.get_way_type
|
||||
|
||||
local weaponData
|
||||
if self.wayType == GConst.DungeonConst.TYPE.WEAPON then
|
||||
weaponData = DataManager.DungeonData:getDungeonDataByType(ModuleManager.MODULE_KEY.DUNGEON_WEAPON)
|
||||
elseif self.wayType == GConst.DungeonConst.TYPE.ARMOR then
|
||||
weaponData = DataManager.DungeonData:getDungeonDataByType(ModuleManager.MODULE_KEY.DUNGEON_ARMOR)
|
||||
end
|
||||
local farm = {}
|
||||
local unlock = {}
|
||||
local lock = {}
|
||||
for index, id in ipairs(itemCfg.get_way) do
|
||||
if weaponData:canFarmChapter(id) and weaponData:getRemianFarmCount(id) > 0 then
|
||||
table.insert(farm, id)
|
||||
elseif weaponData:canFightChapter(id) then
|
||||
table.insert(unlock, id)
|
||||
else
|
||||
table.insert(lock, id)
|
||||
end
|
||||
end
|
||||
unlock = table.addArray(farm, unlock)
|
||||
self.wayList = table.addArray(unlock, lock)
|
||||
|
||||
self.scrollRectComp:clearCells()
|
||||
self.scrollRectComp:refillCells(#self.wayList)
|
||||
|
||||
self:checkShowPanelGift()
|
||||
end
|
||||
|
||||
-- 展示礼包界面
|
||||
function ItemGetUI:checkShowPanelGift()
|
||||
self.panelGift:setActive(false)
|
||||
self.panelMain:setAnchoredPositionY(COMMON_MAIN_POSY)
|
||||
self.btnClose:setAnchoredPositionY(COMMON_CLOSE_POSY)
|
||||
|
||||
self.giftId = DataManager.EquipData:getCanShowGiftId(self.equipEntity:getHeroId(), self.equipEntity:getPart())
|
||||
if self.giftId == nil then
|
||||
return
|
||||
end
|
||||
|
||||
self.panelGift:setActive(true)
|
||||
self.panelMain:setAnchoredPositionY(GIFT_MAIN_POSY)
|
||||
self.btnClose:setAnchoredPositionY(GIFT_CLOSE_POSY)
|
||||
|
||||
local gift = DataManager.ShopData:getActGiftConfig()[self.giftId]
|
||||
self.txBuy:setText(GFunc.getFormatPrice(gift.recharge_id))
|
||||
self.txGiftTitle:setText(DataManager.EquipData:getGiftTitle(self.giftId))
|
||||
for i, cell in ipairs(self.rewardCellList) do
|
||||
if gift.reward[i] then
|
||||
cell:setVisible(true, 0.8)
|
||||
cell:refresh(gift.reward[i].id, gift.reward[i].num, true)
|
||||
else
|
||||
cell:setVisible(false, 0.8)
|
||||
end
|
||||
end
|
||||
self.rewardNodeLayout:RefreshLayout()
|
||||
|
||||
-- 倒计时
|
||||
if self.giftCountdownSid then
|
||||
self.txCountdown:unscheduleGlobal(self.giftCountdownSid)
|
||||
end
|
||||
self.txCountdown:setText(GFunc.getTimeStrWithHMS2(DataManager.EquipData:getGiftRemainTime(self.giftId)))
|
||||
self.giftCountdownSid = self.txCountdown:scheduleGlobal(function()
|
||||
self.txCountdown:setText(GFunc.getTimeStrWithHMS2(DataManager.EquipData:getGiftRemainTime(self.giftId)))
|
||||
end, 1)
|
||||
end
|
||||
|
||||
return ItemGetUI
|
||||
@ -1,541 +0,0 @@
|
||||
local DungeonBaseEntity = require "app/userdata/dungeon/dungeon_base_entity"
|
||||
local DungeonArmorEntity = class("DungeonArmorEntity", DungeonBaseEntity)
|
||||
|
||||
local FUND_AD_REWARD_ID = 1
|
||||
|
||||
-- 支线副本数据
|
||||
function DungeonArmorEntity:clear()
|
||||
DataManager:unregisterCrossDayFunc("DungeonArmorEntity")
|
||||
end
|
||||
|
||||
function DungeonArmorEntity:init(data)
|
||||
Logger.logHighlight("-----DungeonArmorEntity------")
|
||||
Logger.printTable(data)
|
||||
self.maxPassedId = data.max_challenge_id or 0
|
||||
self.armorInfo = data.armor_info or {}
|
||||
self.farmCount = data.farm_count or {}
|
||||
self.heroes = data.heroes or {}
|
||||
self.starRewards = data.star_rewards or {}
|
||||
self.fundRewards = data.fund_rewards
|
||||
self.totalChallengeCount = data.total_challenge_count
|
||||
|
||||
self:updateGift(data.gift_info, true)
|
||||
DataManager.FormationData:initDungeonArmor(self.heroes)
|
||||
|
||||
DataManager:registerCrossDayFunc("DungeonArmorEntity", function()
|
||||
self.fundRewards[FUND_AD_REWARD_ID] = false
|
||||
self.farmCount = table.clearOrCreate(self.farmCount)
|
||||
self:setDirty()
|
||||
end)
|
||||
end
|
||||
|
||||
function DungeonArmorEntity:refreshInfoOnSettlement(chapterId, result)
|
||||
if result.max_id > self.maxPassedId then
|
||||
ModuleManager.TaskManager:addTaskProgress(GConst.TaskConst.TASK_TYPE.X_DUNGEON_ARMOR, result.max_id - self.maxPassedId)
|
||||
end
|
||||
self.totalChallengeCount[chapterId] = (self.totalChallengeCount[chapterId] or 0) + 1
|
||||
self.maxPassedId = result.max_id
|
||||
self.armorInfo[chapterId] = result.armor_info
|
||||
self:updateGift(result.gift_info)
|
||||
self:setDirty()
|
||||
end
|
||||
|
||||
function DungeonArmorEntity:refreshInfoOnFarm(chapterId, result)
|
||||
self.farmCount[chapterId] = (self.farmCount[chapterId] or 0) + 1
|
||||
self:updateGift(result.gift_info)
|
||||
self:setDirty()
|
||||
end
|
||||
|
||||
function DungeonArmorEntity:refreshFarmCount(chapterId, count)
|
||||
if not count then
|
||||
return
|
||||
end
|
||||
self.farmCount[chapterId] = count
|
||||
self:setDirty()
|
||||
end
|
||||
|
||||
-- 更新礼包状态
|
||||
function DungeonArmorEntity:updateGift(giftInfo, isInit)
|
||||
DataManager.ShopData:initGift(PayManager.PURCHARSE_ACT_TYPE.ARMOR_GIFT, giftInfo, isInit)
|
||||
end
|
||||
|
||||
function DungeonArmorEntity:setStarReward(starId)
|
||||
self.starRewards[starId] = true
|
||||
self:setDirty()
|
||||
end
|
||||
|
||||
function DungeonArmorEntity:setDirty()
|
||||
self.data.isDirty = not self.data.isDirty
|
||||
end
|
||||
|
||||
function DungeonArmorEntity:getTotalChallengeCount()
|
||||
local count = 0
|
||||
for _, c in pairs(self.totalChallengeCount) do
|
||||
count = count + 1
|
||||
end
|
||||
end
|
||||
|
||||
function DungeonArmorEntity:getTodayChallengeCount()
|
||||
return 0
|
||||
end
|
||||
|
||||
function DungeonArmorEntity:getPassedMaxId()
|
||||
return self.maxPassedId
|
||||
end
|
||||
|
||||
function DungeonArmorEntity:getIsAllTimeOpen()
|
||||
return true
|
||||
end
|
||||
|
||||
function DungeonArmorEntity:getModuleKey()
|
||||
return ModuleManager.MODULE_KEY.DUNGEON_ARMOR
|
||||
end
|
||||
|
||||
function DungeonArmorEntity:getConfig(chapterId)
|
||||
return ConfigManager:getConfig(self:getConfigName())[chapterId]
|
||||
end
|
||||
|
||||
function DungeonArmorEntity:getConfigName()
|
||||
return "chapter_dungeon_armor"
|
||||
end
|
||||
|
||||
function DungeonArmorEntity:getTitleString()
|
||||
return I18N:getGlobalText(I18N.GlobalConst.DUNGEON_ARMOR_DESC_1)
|
||||
end
|
||||
|
||||
function DungeonArmorEntity:getRuleString()
|
||||
return I18N:getGlobalText(I18N.GlobalConst.DUNGEON_ARMOR_DESC_2)
|
||||
end
|
||||
|
||||
function DungeonArmorEntity:getOpenWeekString()
|
||||
return I18N:getGlobalText(I18N.GlobalConst.DUNGEON_ARMOR_DESC_3)
|
||||
end
|
||||
|
||||
function DungeonArmorEntity:getBanner()
|
||||
return "assets/arts/textures/background/dungeon/dungeon_bg_4.png"
|
||||
end
|
||||
|
||||
function DungeonArmorEntity:getOpenTextColor()
|
||||
return "#FFFFFF"
|
||||
end
|
||||
|
||||
function DungeonArmorEntity:getChallengeHpCost()
|
||||
return GFunc.getConstReward("dungeon_armor_limit")
|
||||
end
|
||||
|
||||
function DungeonArmorEntity:isNoTotalLimit()
|
||||
return true
|
||||
end
|
||||
|
||||
function DungeonArmorEntity:isNotShowLimitCount()
|
||||
return true
|
||||
end
|
||||
|
||||
function DungeonArmorEntity:onClickFight()
|
||||
ModuleManager.DungeonArmorManager:showMainUI()
|
||||
end
|
||||
|
||||
function DungeonArmorEntity:getStagePassEnough(chapterId)
|
||||
local config = self:getConfig(chapterId)
|
||||
if not config then
|
||||
return false
|
||||
end
|
||||
|
||||
if config.main_chapter and not DataManager.ChapterData:getChapterPassed(config.main_chapter) then
|
||||
return false, DataManager.ChapterData:getMaxChapterId(), config.main_chapter
|
||||
end
|
||||
|
||||
return true
|
||||
end
|
||||
|
||||
function DungeonArmorEntity:canFightChapter(chapterId)
|
||||
if not chapterId then
|
||||
return false
|
||||
end
|
||||
|
||||
if chapterId <= self.maxPassedId + 1 then
|
||||
if self:getStagePassEnough(chapterId) then
|
||||
return true
|
||||
end
|
||||
end
|
||||
|
||||
return false
|
||||
end
|
||||
|
||||
function DungeonArmorEntity:canFarmChapter(chapterId)
|
||||
if not chapterId then
|
||||
return false
|
||||
end
|
||||
|
||||
if self.maxPassedId >= chapterId then
|
||||
if self:getStarNum(chapterId) >= 3 then
|
||||
return true
|
||||
end
|
||||
end
|
||||
|
||||
return false
|
||||
end
|
||||
|
||||
function DungeonArmorEntity:getDialyFarmLimit(chapterId)
|
||||
local config = self:getConfig(chapterId)
|
||||
if not config then
|
||||
return 0
|
||||
end
|
||||
return config.sweep
|
||||
end
|
||||
|
||||
function DungeonArmorEntity:getFarmCount(chapterId)
|
||||
return self.farmCount[chapterId] or 0
|
||||
end
|
||||
|
||||
function DungeonArmorEntity:getRemianFarmCount(chapterId)
|
||||
local count = self:getDialyFarmLimit(chapterId) - self:getFarmCount(chapterId)
|
||||
if count < 0 then
|
||||
count = 0
|
||||
end
|
||||
return count
|
||||
end
|
||||
|
||||
function DungeonArmorEntity:getStarRewardGot(star)
|
||||
return self.starRewards[star]
|
||||
end
|
||||
|
||||
function DungeonArmorEntity:getStarNum(chapterId)
|
||||
if not self.armorInfo[chapterId] then
|
||||
return 0
|
||||
end
|
||||
return #self.armorInfo[chapterId].stars
|
||||
end
|
||||
|
||||
function DungeonArmorEntity:getAllStarNum()
|
||||
if not self.armorInfo then
|
||||
return 0
|
||||
end
|
||||
local count = 0
|
||||
for id, info in pairs(self.armorInfo) do
|
||||
count = count + #info.stars
|
||||
end
|
||||
return count
|
||||
end
|
||||
|
||||
function DungeonArmorEntity:getMinStarTarget()
|
||||
local count = ConfigManager:getConfigNum("chapter_dungeon_armor_reward")
|
||||
local id
|
||||
local nextTarget
|
||||
|
||||
for i = 1, count do
|
||||
if not self:getStarRewardGot(i) then
|
||||
id = i
|
||||
nextTarget = ConfigManager:getConfig("chapter_dungeon_armor_reward")[id].star
|
||||
break
|
||||
end
|
||||
end
|
||||
|
||||
if not id then -- 全部领完
|
||||
id = count
|
||||
nextTarget = ConfigManager:getConfig("chapter_dungeon_armor_reward")[id].star
|
||||
return id, nextTarget, nextTarget
|
||||
end
|
||||
|
||||
local starNum = self:getAllStarNum()
|
||||
local lastStarNum = 0
|
||||
local lastConfig = ConfigManager:getConfig("chapter_dungeon_armor_reward")[id - 1]
|
||||
if lastConfig then -- 不是第一个
|
||||
lastStarNum = lastConfig.star
|
||||
end
|
||||
local progress = starNum - lastStarNum
|
||||
local totalProgress = nextTarget - lastStarNum
|
||||
return id, progress, totalProgress
|
||||
end
|
||||
|
||||
function DungeonArmorEntity:getStarDone(chapterId, index)
|
||||
if not self.armorInfo[chapterId] then
|
||||
return false
|
||||
end
|
||||
|
||||
local stars = self.armorInfo[chapterId].stars
|
||||
if stars then
|
||||
for _, star in ipairs(stars) do
|
||||
if star == index then
|
||||
return true
|
||||
end
|
||||
end
|
||||
end
|
||||
return false
|
||||
end
|
||||
|
||||
function DungeonArmorEntity:getStarReward(chapterId, index)
|
||||
local config = self:getConfig(chapterId)
|
||||
return config.star_task_reward[index]
|
||||
end
|
||||
|
||||
function DungeonArmorEntity:getStarStarId(chapterId, index)
|
||||
local config = self:getConfig(chapterId)
|
||||
return config.star_task[index - 1]
|
||||
end
|
||||
|
||||
function DungeonArmorEntity:getStarInfo(chapterId)
|
||||
return self.armorInfo[chapterId]
|
||||
end
|
||||
|
||||
function DungeonArmorEntity:setCurFightChapterId(chapterId)
|
||||
self.curFightchapterId = chapterId or 1
|
||||
end
|
||||
|
||||
function DungeonArmorEntity:getCurFightChapterId()
|
||||
return self.curFightchapterId or 1
|
||||
end
|
||||
|
||||
function DungeonArmorEntity:getChapterFightCount(chapterId)
|
||||
return self.totalChallengeCount[chapterId] or 0
|
||||
end
|
||||
|
||||
function DungeonArmorEntity:getTodayRemainLimitCount() -- 这里用作红点显示
|
||||
if self:canClaimStarReward() then
|
||||
return 1
|
||||
end
|
||||
|
||||
return 0
|
||||
end
|
||||
|
||||
function DungeonArmorEntity:canClaimStarReward()
|
||||
local id, progress, totalProgress = self:getMinStarTarget()
|
||||
if self:getStarRewardGot(id) then
|
||||
return false
|
||||
end
|
||||
|
||||
return progress >= totalProgress
|
||||
end
|
||||
|
||||
function DungeonArmorEntity:getMinLowThreeStarId()
|
||||
for id, _ in ipairs(ConfigManager:getConfig(self:getConfigName())) do
|
||||
local starNum = self:getStarNum(id)
|
||||
if starNum < 3 then
|
||||
return id
|
||||
end
|
||||
end
|
||||
|
||||
return self.maxPassedId
|
||||
end
|
||||
|
||||
function DungeonArmorEntity:formatTaskByController(battleBaseController, chapterId)
|
||||
local taskProgress = {}
|
||||
if not battleBaseController then
|
||||
return taskProgress
|
||||
end
|
||||
local pass = self:getPassedMaxId() >= chapterId and 1 or 0
|
||||
local hpp = math.floor(battleBaseController.battleData:getAtkTeam():getHpPercent() * 100 + 0.0001)
|
||||
local bossRoundCount = 0
|
||||
local waveIndex = battleBaseController:getWaveIndex()
|
||||
if waveIndex >= battleBaseController.maxWaveIndex then -- 最后一波
|
||||
bossRoundCount = battleBaseController.waveRoundCount[waveIndex] or 0
|
||||
end
|
||||
local totalRound = 0
|
||||
for wave, round in pairs(battleBaseController.waveRoundCount) do
|
||||
totalRound = totalRound + round
|
||||
end
|
||||
|
||||
local config = ConfigManager:getConfig("task_dungeon_armor")
|
||||
taskProgress = {
|
||||
[0] = pass
|
||||
}
|
||||
if config then
|
||||
for id, info in pairs(config) do
|
||||
if info.type == 1 then
|
||||
taskProgress[id] = hpp
|
||||
elseif info.type == 2 then
|
||||
taskProgress[id] = bossRoundCount
|
||||
elseif info.type == 3 then
|
||||
taskProgress[id] = totalRound
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
return taskProgress
|
||||
end
|
||||
|
||||
function DungeonArmorEntity:getTaskDesc(taskId, progress)
|
||||
local config = ConfigManager:getConfig("task_dungeon_armor")[taskId]
|
||||
if not config then
|
||||
return I18N:getGlobalText(I18N.GlobalConst.DUNGEON_ARMOR_DESC_7)
|
||||
end
|
||||
|
||||
local desc = I18N:getConfig("task_dungeon_armor")[taskId].desc
|
||||
|
||||
progress = progress or 0
|
||||
local taskNum = config.param
|
||||
local over = false
|
||||
if config.type == 1 then -- 特殊处理
|
||||
over = progress >= taskNum
|
||||
progress = progress .. "%"
|
||||
taskNum = taskNum .. "%"
|
||||
elseif config.type == 2 then
|
||||
over = progress <= taskNum
|
||||
elseif config.type == 3 then
|
||||
over = progress <= taskNum
|
||||
end
|
||||
local color = "#FF4949"
|
||||
if over then
|
||||
color = "#49FF49"
|
||||
end
|
||||
local progressStr = string.format("<color=%s>(%s/%s)</color>", color, progress, taskNum)
|
||||
return desc .. progressStr
|
||||
end
|
||||
|
||||
function DungeonArmorEntity:getTaskDescByIndex(chapterId, index, battleBaseController, taskProgress)
|
||||
taskProgress = taskProgress or self:formatTaskByController(battleBaseController, chapterId)
|
||||
|
||||
if not self.taskList then
|
||||
self.taskList = {}
|
||||
end
|
||||
if not self.taskList[chapterId] then
|
||||
self.taskList[chapterId] = GFunc.getTable(self:getConfig(chapterId).star_task)
|
||||
table.insert(self.taskList[chapterId], 1, 0) -- 首位添加默认任务
|
||||
end
|
||||
|
||||
local taskId = self.taskList[chapterId][index]
|
||||
if not taskId then
|
||||
return GConst.EMPTY_STRING
|
||||
end
|
||||
|
||||
local over = self:getStarDone(chapterId, index)
|
||||
return self:getTaskDesc(taskId, taskProgress[taskId]), over
|
||||
end
|
||||
|
||||
-- 获取当前基金奖励所属阶段
|
||||
function DungeonArmorEntity:getCurFundStage()
|
||||
local cfg = ConfigManager:getConfig("dungeon_armor_fund")
|
||||
for id, data in ipairs(cfg) do
|
||||
if id ~= FUND_AD_REWARD_ID and not self:isGotFundReward(id) then
|
||||
return data.stage
|
||||
end
|
||||
end
|
||||
|
||||
return cfg[#cfg].stage
|
||||
end
|
||||
|
||||
-- 基金是否有红点
|
||||
function DungeonArmorEntity:isHasFundRedDot()
|
||||
return self:isCanWatchFundAd() or (self:isBoughtFundStage(self:getCurFundStage()) and self:hasCanGetFundReward())
|
||||
end
|
||||
|
||||
-- 基金阶段是否已购买
|
||||
function DungeonArmorEntity:isBoughtFundStage(stage)
|
||||
if not stage then
|
||||
return false
|
||||
end
|
||||
|
||||
local giftId = self:getFundStageGiftId(stage)
|
||||
|
||||
if not giftId then
|
||||
return false
|
||||
end
|
||||
|
||||
local count = DataManager.ShopData:getGiftBoughtNum(PayManager.PURCHARSE_TYPE.ACT_GIFT, giftId)
|
||||
|
||||
if EDITOR_MODE then
|
||||
Logger.logHighlight("支线基金购买状态:"..giftId.."/"..count)
|
||||
end
|
||||
|
||||
return count > 0
|
||||
end
|
||||
|
||||
-- 获取基金阶段标题
|
||||
function DungeonArmorEntity:getFundStageTitle()
|
||||
local stage = self:getCurFundStage()
|
||||
return I18N:getGlobalText("DUNGEON_ARMOR_FUND_" .. stage)
|
||||
end
|
||||
|
||||
-- 获取基金阶段的礼包id
|
||||
function DungeonArmorEntity:getFundStageGiftId(stage)
|
||||
local giftId
|
||||
for id, data in ipairs(ConfigManager:getConfig("dungeon_armor_fund")) do
|
||||
if data.stage == stage then
|
||||
giftId = data.act_gift
|
||||
break
|
||||
end
|
||||
end
|
||||
return giftId
|
||||
end
|
||||
|
||||
-- 获取基金阶段奖励id列表
|
||||
function DungeonArmorEntity:getFundStageRewardIds(stage)
|
||||
local result = {}
|
||||
|
||||
for id, data in ipairs(ConfigManager:getConfig("dungeon_armor_fund")) do
|
||||
if data.stage == stage then
|
||||
table.insert(result, id)
|
||||
end
|
||||
end
|
||||
return result
|
||||
end
|
||||
|
||||
-- 获取当前基金奖励列表(Sort)
|
||||
function DungeonArmorEntity:getFundRewardIdsSort()
|
||||
local ids = self:getFundStageRewardIds(self:getCurFundStage())
|
||||
|
||||
local unreceived = {}
|
||||
local received = {}
|
||||
|
||||
for index, id in ipairs(ids) do
|
||||
if self:isGotFundReward(id) then
|
||||
table.insert(received, id)
|
||||
else
|
||||
table.insert(unreceived, id)
|
||||
end
|
||||
end
|
||||
table.sort(unreceived, function(a, b) return a < b end)
|
||||
table.sort(received, function(a, b) return a < b end)
|
||||
|
||||
if not self:isGotFundReward(FUND_AD_REWARD_ID) then
|
||||
unreceived = table.addArray(self:getFundStageRewardIds(0), unreceived)
|
||||
end
|
||||
|
||||
return table.addArray(unreceived, received)
|
||||
end
|
||||
|
||||
-- 是否满足基金奖励条件
|
||||
function DungeonArmorEntity:isMeetFundReward(id)
|
||||
if id == FUND_AD_REWARD_ID then
|
||||
return not self:isCanWatchFundAd()
|
||||
end
|
||||
|
||||
local cfg = ConfigManager:getConfig("dungeon_armor_fund")[id]
|
||||
return cfg and self.maxPassedId >= cfg.dungeon_stage
|
||||
end
|
||||
|
||||
-- 是否有可领取的基金奖励
|
||||
function DungeonArmorEntity:hasCanGetFundReward()
|
||||
for index, id in ipairs(self:getFundRewardIdsSort(self:getCurFundStage())) do
|
||||
if self:isMeetFundReward(id) and not self:isGotFundReward(id) then
|
||||
return true
|
||||
end
|
||||
end
|
||||
return false
|
||||
end
|
||||
|
||||
-- 是否已领取基金奖励
|
||||
function DungeonArmorEntity:isGotFundReward(id)
|
||||
return self.fundRewards and self.fundRewards[id]
|
||||
end
|
||||
|
||||
-- 今日是否可以看基金广告
|
||||
function DungeonArmorEntity:isCanWatchFundAd()
|
||||
return not self:isGotFundReward(FUND_AD_REWARD_ID)
|
||||
end
|
||||
|
||||
-- 基金奖励领取成功
|
||||
function DungeonArmorEntity:onGetFundRewardSuccess(id)
|
||||
if not self.fundRewards then
|
||||
self.fundRewards = {}
|
||||
end
|
||||
self.fundRewards[id] = true
|
||||
self:setDirty()
|
||||
end
|
||||
|
||||
-- 基金购买成功
|
||||
function DungeonArmorEntity:onBuyFundSuccess()
|
||||
self:setDirty()
|
||||
end
|
||||
|
||||
return DungeonArmorEntity
|
||||
@ -1,10 +0,0 @@
|
||||
fileFormatVersion: 2
|
||||
guid: e6bcb1d833ae6564dbd1fcd0827e589e
|
||||
ScriptedImporter:
|
||||
internalIDToNameTable: []
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
script: {fileID: 11500000, guid: 3b8b241bab4a4ac9a22fcce9c64f1242, type: 3}
|
||||
@ -1,134 +0,0 @@
|
||||
local DungeonBaseEntity = class("DungeonBaseEntity", BaseData)
|
||||
|
||||
-- 需要继承重写的部分 ***********************************************************
|
||||
|
||||
-- 初始化服务器数据
|
||||
function DungeonBaseEntity:init(data)
|
||||
end
|
||||
|
||||
-- 获取副本模块名,对应ModuleManager.MODULE_KEY
|
||||
function DungeonBaseEntity:getModuleKey()
|
||||
return nil
|
||||
end
|
||||
|
||||
-- 获取副本开启周期(星期几)
|
||||
function DungeonBaseEntity:getOpenWeekCycle()
|
||||
return nil
|
||||
end
|
||||
|
||||
function DungeonBaseEntity:getIsAllTimeOpen()
|
||||
return false
|
||||
end
|
||||
|
||||
function DungeonBaseEntity:getCloseTime()
|
||||
return nil
|
||||
end
|
||||
|
||||
-- 获取副本配置名称
|
||||
function DungeonBaseEntity:getConfigName()
|
||||
return nil
|
||||
end
|
||||
|
||||
-- 获取副本标题文案
|
||||
function DungeonBaseEntity:getTitleString()
|
||||
return nil
|
||||
end
|
||||
|
||||
-- 获取副本规则描述
|
||||
function DungeonBaseEntity:getRuleString()
|
||||
return nil
|
||||
end
|
||||
|
||||
-- 获取副本boss抗性
|
||||
function DungeonBaseEntity:getBossBuff(id)
|
||||
return nil
|
||||
end
|
||||
|
||||
-- 获取开始时间描述
|
||||
function DungeonBaseEntity:getOpenWeekString()
|
||||
return nil
|
||||
end
|
||||
|
||||
-- 获取副本角标图
|
||||
function DungeonBaseEntity:getIcon()
|
||||
return nil
|
||||
end
|
||||
|
||||
-- 获取副本banner图
|
||||
function DungeonBaseEntity:getBanner()
|
||||
return nil
|
||||
end
|
||||
|
||||
-- 获取开启时间文本颜色
|
||||
function DungeonBaseEntity:getOpenTextColor()
|
||||
return nil
|
||||
end
|
||||
|
||||
-- 获取总挑战次数
|
||||
function DungeonBaseEntity:getTotalChallengeCount()
|
||||
return nil
|
||||
end
|
||||
|
||||
-- 获取今日已挑战次数
|
||||
function DungeonBaseEntity:getTodayChallengeCount()
|
||||
return 0
|
||||
end
|
||||
|
||||
-- 获取已通关的最大副本id
|
||||
function DungeonBaseEntity:getPassedMaxId()
|
||||
return nil
|
||||
end
|
||||
|
||||
-- 获取挑战体力消耗
|
||||
function DungeonBaseEntity:getChallengeHpCost()
|
||||
return nil
|
||||
end
|
||||
|
||||
-- 获取每日最大挑战次数
|
||||
function DungeonBaseEntity:getTodayMaxCount()
|
||||
return 1
|
||||
end
|
||||
|
||||
-- 获取看板展示的副本奖励(返回id list)
|
||||
function DungeonBaseEntity:getBoardShowRewardId()
|
||||
return nil
|
||||
end
|
||||
|
||||
-- 获取首通奖励个数
|
||||
function DungeonBaseEntity:getFirstRewardNum()
|
||||
return 0
|
||||
end
|
||||
|
||||
-- 获取通关奖励个数
|
||||
function DungeonBaseEntity:getPassRewardNum()
|
||||
return 0
|
||||
end
|
||||
|
||||
function DungeonBaseEntity:isNoTotalLimit()
|
||||
return false
|
||||
end
|
||||
|
||||
function DungeonBaseEntity:isNotShowLimitCount()
|
||||
return false
|
||||
end
|
||||
|
||||
function DungeonBaseEntity:onClickFight()
|
||||
UIManager:showUI("app/ui/dungeon/dungeon_difficulty_ui", {module = self:getModuleKey()})
|
||||
end
|
||||
|
||||
-- 常规逻辑 *********************************************************************
|
||||
|
||||
-- 获取今日剩余挑战次数
|
||||
function DungeonBaseEntity:getTodayRemainLimitCount()
|
||||
if self:isNoTotalLimit() then
|
||||
return 1
|
||||
end
|
||||
return self:getTodayMaxCount() - self:getTodayChallengeCount()
|
||||
end
|
||||
|
||||
-- 获取副本配置
|
||||
function DungeonBaseEntity:getConfig()
|
||||
return ConfigManager:getConfig(self:getConfigName())
|
||||
end
|
||||
|
||||
return DungeonBaseEntity
|
||||
@ -1,10 +0,0 @@
|
||||
fileFormatVersion: 2
|
||||
guid: e4b0cc0f74106f04ab07ab30b1b724d8
|
||||
ScriptedImporter:
|
||||
internalIDToNameTable: []
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
script: {fileID: 11500000, guid: 3b8b241bab4a4ac9a22fcce9c64f1242, type: 3}
|
||||
94
lua/app/userdata/dungeon/dungeon_daily_data.lua
Normal file
94
lua/app/userdata/dungeon/dungeon_daily_data.lua
Normal file
@ -0,0 +1,94 @@
|
||||
local DungeonDailyData = class("DungeonDailyData", BaseData)
|
||||
|
||||
function DungeonDailyData:ctor()
|
||||
self.data.isDirty = false
|
||||
end
|
||||
|
||||
function DungeonDailyData:setDirty()
|
||||
self.data.isDirty = not self.data.isDirty
|
||||
end
|
||||
|
||||
function DungeonDailyData:init(data)
|
||||
data = data or GConst.EMPTY_TABLE
|
||||
local dungeons = data.dungeons or GConst.EMPTY_TABLE
|
||||
self.GoldData = require("app/userdata/dungeon/dungeon_gold_data"):create()
|
||||
self.GoldData:init(dungeons[GConst.DungeonConst.DUNGEON_DAILY_TYPE.GOLD])
|
||||
self.MaterialData = require("app/userdata/dungeon/dungeon_material_data"):create()
|
||||
self.MaterialData:init(dungeons[GConst.DungeonConst.DUNGEON_DAILY_TYPE.MATERIAL])
|
||||
|
||||
DataManager:registerCrossDayFunc("DungeonDailyData", function()
|
||||
self.GoldData:onCrossDay()
|
||||
self.MaterialData:onCrossDay()
|
||||
end)
|
||||
end
|
||||
|
||||
function DungeonDailyData:isOpen(showToast)
|
||||
return self.GoldData:isOpen(showToast) or self.MaterialData:isOpen(showToast)
|
||||
end
|
||||
|
||||
function DungeonDailyData:getNotShowModuleKey()
|
||||
if not self.GoldData:isOpen() then
|
||||
return self.GoldData:getModuleKey()
|
||||
end
|
||||
if not self.MaterialData:isOpen() then
|
||||
return self.MaterialData:getModuleKey()
|
||||
end
|
||||
return nil
|
||||
end
|
||||
|
||||
function DungeonDailyData:getCurrChallengeChapterId()
|
||||
return self.currChallengeChapterId
|
||||
end
|
||||
|
||||
function DungeonDailyData:setCurrChallengeChapterId(id)
|
||||
self.currChallengeChapterId = id
|
||||
end
|
||||
|
||||
function DungeonDailyData:getDungeonDailyTypeByChapterId(chapterId)
|
||||
local cfg = ConfigManager:getConfig("chapter_dungeon")[chapterId]
|
||||
if cfg then
|
||||
return cfg.type
|
||||
else
|
||||
return 1
|
||||
end
|
||||
end
|
||||
|
||||
function DungeonDailyData:getChapterMaxWave(chapterId)
|
||||
local cfg = ConfigManager:getConfig("chapter_dungeon")[chapterId]
|
||||
if cfg then
|
||||
return #cfg.wave
|
||||
else
|
||||
return 1
|
||||
end
|
||||
end
|
||||
|
||||
function DungeonDailyData:getChapterName(chapterId)
|
||||
return I18N:getConfig("chapter_dungeon")[chapterId].name
|
||||
end
|
||||
|
||||
function DungeonDailyData:onFightDungeonDailyFinish(chapterId, victory)
|
||||
if not victory then
|
||||
return
|
||||
end
|
||||
local dungeonDailyType = self:getDungeonDailyTypeByChapterId(chapterId)
|
||||
if dungeonDailyType == GConst.DungeonConst.DUNGEON_DAILY_TYPE.GOLD then
|
||||
self.GoldData:onFightDungeonDailyFinish(chapterId, victory)
|
||||
elseif dungeonDailyType == GConst.DungeonConst.DUNGEON_DAILY_TYPE.MATERIAL then
|
||||
self.MaterialData:onFightDungeonDailyFinish(chapterId, victory)
|
||||
end
|
||||
end
|
||||
|
||||
function DungeonDailyData:onSweepDungeonDailyFinish(chapterId)
|
||||
local dungeonDailyType = self:getDungeonDailyTypeByChapterId(chapterId)
|
||||
if dungeonDailyType == GConst.DungeonConst.DUNGEON_DAILY_TYPE.GOLD then
|
||||
self.GoldData:onSweepDungeonDailyFinish(chapterId)
|
||||
elseif dungeonDailyType == GConst.DungeonConst.DUNGEON_DAILY_TYPE.MATERIAL then
|
||||
self.MaterialData:onSweepDungeonDailyFinish(chapterId)
|
||||
end
|
||||
end
|
||||
|
||||
function DungeonDailyData:getIsShowRedPoint()
|
||||
return self.GoldData:getIsShowRedPoint() or self.MaterialData:getIsShowRedPoint()
|
||||
end
|
||||
|
||||
return DungeonDailyData
|
||||
10
lua/app/userdata/dungeon/dungeon_daily_data.lua.meta
Normal file
10
lua/app/userdata/dungeon/dungeon_daily_data.lua.meta
Normal file
@ -0,0 +1,10 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 4b2049bc5bdf34d7ea59e0c0ec37e6b1
|
||||
ScriptedImporter:
|
||||
internalIDToNameTable: []
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
script: {fileID: 11500000, guid: 3b8b241bab4a4ac9a22fcce9c64f1242, type: 3}
|
||||
@ -1,515 +1,242 @@
|
||||
local DungeonData = class("DungeonData", BaseData)
|
||||
|
||||
local SORT_ORDER = {
|
||||
[ModuleManager.MODULE_KEY.DUNGEON_GOLD] = 1,
|
||||
[ModuleManager.MODULE_KEY.DUNGEON_SHARDS] = 2,
|
||||
-- [ModuleManager.MODULE_KEY.DUNGEON_WEAPON] = 3,
|
||||
-- [ModuleManager.MODULE_KEY.DUNGEON_ARMOR] = 4,
|
||||
[ModuleManager.MODULE_KEY.RUNES_OPEN] = 5,
|
||||
}
|
||||
|
||||
-- 所有活动副本数据
|
||||
|
||||
function DungeonData:ctor()
|
||||
self.data.isDirty = false
|
||||
end
|
||||
|
||||
function DungeonData:clear()
|
||||
if self.dataDungeons then
|
||||
for _, entity in pairs(self.dataDungeons) do
|
||||
entity:clear()
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
-- 初始化金币副本数据
|
||||
function DungeonData:initDungeonGold(data)
|
||||
if data == nil then
|
||||
return
|
||||
end
|
||||
|
||||
if EDITOR_MODE then
|
||||
Logger.logHighlight("更新金币副本数据")
|
||||
Logger.printTable(data)
|
||||
end
|
||||
|
||||
self:initAllDataClass()
|
||||
self.dataDungeons[ModuleManager.MODULE_KEY.DUNGEON_GOLD]:init(data)
|
||||
self.data.gold = data
|
||||
self:setDirty()
|
||||
end
|
||||
|
||||
-- 初始化碎片副本数据
|
||||
function DungeonData:initDungeonShards(data)
|
||||
if data == nil then
|
||||
return
|
||||
end
|
||||
|
||||
if EDITOR_MODE then
|
||||
Logger.logHighlight("更新碎片副本数据")
|
||||
Logger.printTable(data)
|
||||
end
|
||||
|
||||
self:initAllDataClass()
|
||||
self.dataDungeons[ModuleManager.MODULE_KEY.DUNGEON_SHARDS]:init(data)
|
||||
self.data.shards = data
|
||||
self:setDirty()
|
||||
end
|
||||
|
||||
-- 初始化支线副本数据
|
||||
-- function DungeonData:initDungeonArmor(data)
|
||||
-- if data == nil then
|
||||
-- return
|
||||
-- end
|
||||
|
||||
-- if EDITOR_MODE then
|
||||
-- Logger.logHighlight("更新支线副本数据")
|
||||
-- Logger.printTable(data)
|
||||
-- end
|
||||
|
||||
-- self:initAllDataClass()
|
||||
-- self.dataDungeons[ModuleManager.MODULE_KEY.DUNGEON_ARMOR]:init(data)
|
||||
-- self.data.armor = data
|
||||
-- self:setDirty()
|
||||
-- end
|
||||
|
||||
-- 初始化支线副本数据
|
||||
-- function DungeonData:initDungeonWeapon(data)
|
||||
-- if data == nil then
|
||||
-- return
|
||||
-- end
|
||||
|
||||
-- if EDITOR_MODE then
|
||||
-- Logger.logHighlight("更新武器副本数据")
|
||||
-- Logger.printTable(data)
|
||||
-- end
|
||||
|
||||
-- self:initAllDataClass()
|
||||
-- self.dataDungeons[ModuleManager.MODULE_KEY.DUNGEON_WEAPON]:init(data)
|
||||
-- self.data.weapon = data
|
||||
-- self:setDirty()
|
||||
-- end
|
||||
|
||||
-- 初始化符文副本数据
|
||||
function DungeonData:initDungeonRune(data)
|
||||
if data == nil then
|
||||
return
|
||||
end
|
||||
|
||||
self:initAllDataClass()
|
||||
self.dataDungeons[ModuleManager.MODULE_KEY.RUNES_OPEN]:init(data)
|
||||
self.data.rune = data
|
||||
self:setDirty()
|
||||
end
|
||||
|
||||
|
||||
-- 初始化所有副本数据类
|
||||
function DungeonData:initAllDataClass()
|
||||
if self.dataDungeons == nil then
|
||||
self.dataDungeons = {}
|
||||
self.dataDungeons[ModuleManager.MODULE_KEY.DUNGEON_GOLD] = require "app/userdata/dungeon/dungeon_gold_entity":create()
|
||||
self.dataDungeons[ModuleManager.MODULE_KEY.DUNGEON_SHARDS] = require "app/userdata/dungeon/dungeon_shards_entity":create()
|
||||
-- self.dataDungeons[ModuleManager.MODULE_KEY.DUNGEON_ARMOR] = require "app/userdata/dungeon/dungeon_armor_entity":create()
|
||||
-- self.dataDungeons[ModuleManager.MODULE_KEY.DUNGEON_WEAPON] = require "app/userdata/dungeon/dungeon_weapon_entity":create()
|
||||
self.dataDungeons[ModuleManager.MODULE_KEY.RUNES_OPEN] = require "app/userdata/dungeon/dungeon_rune_entity":create()
|
||||
|
||||
if EDITOR_MODE then
|
||||
Logger.logHighlight("星期".. tostring(Time:getWeekByTimeStamp()))
|
||||
end
|
||||
end
|
||||
|
||||
self.initDay = Time:getBeginningOfServerToday()
|
||||
end
|
||||
|
||||
function DungeonData:getIfCanReset()
|
||||
return self.initDay < Time:getBeginningOfServerToday()
|
||||
end
|
||||
|
||||
-- 跨天处理
|
||||
function DungeonData:onDayChange()
|
||||
self.data.gold.today_challenge_count = 0
|
||||
self.data.shards.today_challenge_count = 0
|
||||
|
||||
if EDITOR_MODE then
|
||||
Logger.logHighlight("星期".. tostring(Time:getWeekByTimeStamp()))
|
||||
end
|
||||
|
||||
self:initDungeonGold(self.data.gold)
|
||||
self:initDungeonShards(self.data.shards)
|
||||
EventManager:dispatchEvent(EventManager.CUSTOM_EVENT.DUNGEON_DAY_CHANGE)
|
||||
end
|
||||
|
||||
-- 客户端处理副本次数+1的情况
|
||||
function DungeonData:onFightCountReduce(moduleKey)
|
||||
if moduleKey == ModuleManager.MODULE_KEY.DUNGEON_GOLD then
|
||||
self.data.gold.today_challenge_count = self.data.gold.today_challenge_count + 1
|
||||
self:initDungeonGold(self.data.gold)
|
||||
elseif moduleKey == ModuleManager.MODULE_KEY.DUNGEON_SHARDS then
|
||||
self.data.shards.today_challenge_count = self.data.shards.today_challenge_count + 1
|
||||
self:initDungeonShards(self.data.shards)
|
||||
end
|
||||
end
|
||||
|
||||
function DungeonData:setDirty()
|
||||
self.data.isDirty = not self.data.isDirty
|
||||
end
|
||||
|
||||
function DungeonData:clear()
|
||||
DataManager:unregisterCrossDayFunc("DungeonData")
|
||||
end
|
||||
|
||||
function DungeonData:init()
|
||||
DataManager:registerCrossDayFunc("DungeonData", function()
|
||||
self:onDayChange()
|
||||
end)
|
||||
end
|
||||
|
||||
-- 跨天处理
|
||||
function DungeonData:onDayChange()
|
||||
self:setDirty()
|
||||
end
|
||||
|
||||
-- 是否开启任意一个副本
|
||||
function DungeonData:isOpenAnyone()
|
||||
for key, value in pairs(self.dataDungeons) do
|
||||
function DungeonData:isOpenAnyone(showToast)
|
||||
local moduleKey = nil
|
||||
for i, key in pairs(self:getDungeonList(false)) do
|
||||
if self:isOpen(key) then
|
||||
return true
|
||||
end
|
||||
if moduleKey == nil then
|
||||
moduleKey = key
|
||||
end
|
||||
end
|
||||
if showToast then
|
||||
if moduleKey == GConst.DungeonConst.MODULE_KEY_DUNGEON_DAILY then
|
||||
moduleKey = DataManager.DungeonDailyData:getNotShowModuleKey()
|
||||
end
|
||||
if moduleKey then
|
||||
GFunc.showToast(ModuleManager:getNotOpenStr(moduleKey))
|
||||
end
|
||||
end
|
||||
return false
|
||||
end
|
||||
|
||||
function DungeonData:getNotOpenStr(moduleKey)
|
||||
if moduleKey == GConst.DungeonConst.MODULE_KEY_DUNGEON_DAILY then
|
||||
moduleKey = DataManager.DungeonDailyData:getNotShowModuleKey()
|
||||
end
|
||||
return ModuleManager:getNotOpenStr(moduleKey)
|
||||
end
|
||||
|
||||
-- 某副本是否已开启
|
||||
function DungeonData:isOpen(moduleKey)
|
||||
if not ModuleManager:getIsOpen(moduleKey, true) then
|
||||
return false
|
||||
end
|
||||
function DungeonData:isOpen(moduleKey, showToast)
|
||||
if moduleKey == GConst.DungeonConst.MODULE_KEY_DUNGEON_DAILY and DataManager.DungeonDailyData:isOpen(showToast) then
|
||||
return true
|
||||
end
|
||||
return false
|
||||
end
|
||||
|
||||
-- 返回已开启的副本
|
||||
function DungeonData:getOpenDungeons()
|
||||
if self.dungeonStage == nil then
|
||||
self.dungeonStage = {}
|
||||
for module, entity in pairs(self.dataDungeons) do
|
||||
local openStage = ConfigManager:getConfig("func_open")[module].stage
|
||||
self.dungeonStage[module] = openStage
|
||||
end
|
||||
table.sort(self.dungeonStage, function(a, b)
|
||||
return a < b
|
||||
end)
|
||||
end
|
||||
function DungeonData:isRankOpen(rankId)
|
||||
-- if rankId == GConst.DungeonConst.RANK_TYPE.TOWER then
|
||||
-- return self:isOpen(ModuleManager.MODULE_KEY.TOWER)
|
||||
-- elseif rankId == GConst.DungeonConst.RANK_TYPE.WORLD_BOSS then
|
||||
-- return self:isOpen(ModuleManager.MODULE_KEY.WORLD_BOSS)
|
||||
-- elseif rankId == GConst.DungeonConst.RANK_TYPE.PRISON_PHYSICS or
|
||||
-- rankId == GConst.DungeonConst.RANK_TYPE.PRISON_WIND or
|
||||
-- rankId == GConst.DungeonConst.RANK_TYPE.PRISON_LIGHT or
|
||||
-- rankId == GConst.DungeonConst.RANK_TYPE.PRISON_FIRE or
|
||||
-- rankId == GConst.DungeonConst.RANK_TYPE.PRISON_ELECTRIC or
|
||||
-- rankId == GConst.DungeonConst.RANK_TYPE.PRISON_ICE then
|
||||
-- return self:isOpen(ModuleManager.MODULE_KEY.PRISON)
|
||||
-- end
|
||||
return false
|
||||
end
|
||||
|
||||
local openDungeons = {}
|
||||
-- 开启且活跃
|
||||
table.foreach(self.dungeonStage, function(module, s)
|
||||
if self:isOpen(module) and self:isActive(module) then
|
||||
local count = self:getRemainTimes(module)
|
||||
if count > 0 then
|
||||
count = 100
|
||||
function DungeonData:getModuleByRankId(id)
|
||||
for moduleKey, moduleRankId in pairs(GConst.DungeonConst.IDS) do
|
||||
if moduleRankId == id then
|
||||
return moduleKey
|
||||
end
|
||||
end
|
||||
return nil
|
||||
end
|
||||
|
||||
-- 是否有红点
|
||||
function DungeonData:hasRedPoint(moduleKey)
|
||||
if moduleKey == nil then
|
||||
for moduleKey, id in pairs(GConst.DungeonConst.IDS) do
|
||||
if self:hasRedPoint(moduleKey) then
|
||||
return true
|
||||
end
|
||||
end
|
||||
elseif moduleKey == GConst.DungeonConst.MODULE_KEY_DUNGEON_DAILY then
|
||||
return DataManager.DungeonDailyData:getIsShowRedPoint()
|
||||
-- elseif moduleKey == ModuleManager.MODULE_KEY.ELITE_CHALLENGE then
|
||||
-- return DataManager.EliteChallengeData:showRedPoint()
|
||||
else
|
||||
count = 200
|
||||
end
|
||||
table.insert(openDungeons, {
|
||||
sort = SORT_ORDER[module] + 1000 + count, -- 系数 + 开启1000 + 剩余次数
|
||||
module = module
|
||||
})
|
||||
end
|
||||
end)
|
||||
-- 开启且不活跃
|
||||
if not GFunc.isShenhe() then
|
||||
table.foreach(self.dungeonStage, function(module, s)
|
||||
if self:isOpen(module) and not self:isActive(module) then
|
||||
table.insert(openDungeons, {
|
||||
sort = SORT_ORDER[module] + 2000, -- 系数 + 未开启2000
|
||||
module = module
|
||||
})
|
||||
end
|
||||
end)
|
||||
end
|
||||
|
||||
table.sort(openDungeons, function(a, b)
|
||||
return a.sort < b.sort
|
||||
end)
|
||||
|
||||
if EDITOR_MODE then
|
||||
Logger.logHighlight("已开启副本:")
|
||||
Logger.printTable(openDungeons)
|
||||
end
|
||||
return openDungeons
|
||||
end
|
||||
|
||||
-- 是否在活动副本时间内
|
||||
function DungeonData:isActive(moduleKey)
|
||||
if not self:isOpen(moduleKey) then
|
||||
return false
|
||||
end
|
||||
-- 有次数
|
||||
if self:getHasTime(moduleKey) > 0 then
|
||||
return true
|
||||
end
|
||||
-- 有奖励
|
||||
if self:canGetReward(moduleKey) then
|
||||
return true
|
||||
end
|
||||
if self:hasAdRp(moduleKey) then
|
||||
return true
|
||||
end
|
||||
end
|
||||
return false
|
||||
end
|
||||
|
||||
-- 判断周期
|
||||
if self:isActiveCycle(moduleKey, Time:getWeekByTimeStamp()) then
|
||||
function DungeonData:getConfig(id)
|
||||
if id then
|
||||
return ConfigManager:getConfig("dungeon")[id]
|
||||
else
|
||||
return ConfigManager:getConfig("dungeon")
|
||||
end
|
||||
end
|
||||
|
||||
-- 获取展示奖励
|
||||
function DungeonData:getShowRewards(moduleKey)
|
||||
if moduleKey == GConst.DungeonConst.MODULE_KEY_DUNGEON_DAILY then
|
||||
return GFunc.getConstCost("dungeon_show_reward", true)
|
||||
-- elseif moduleKey == ModuleManager.MODULE_KEY.TOWER then
|
||||
-- return GFunc.getConstCost("tower_show_reward", true)
|
||||
-- elseif moduleKey == ModuleManager.MODULE_KEY.WORLD_BOSS then
|
||||
-- return GFunc.getConstCost("worldboss_show_reward", true)
|
||||
-- elseif moduleKey == ModuleManager.MODULE_KEY.ELITE_CHALLENGE then
|
||||
-- return GFunc.getConstCost("elite_challenge_reward", true)
|
||||
-- elseif moduleKey == ModuleManager.MODULE_KEY.ELEMENT_DUNGEON then
|
||||
-- return GFunc.getConstCost("element_dungeon_show_reward", true)
|
||||
else
|
||||
return GFunc.getConstCost("dungeon_show_reward", true)
|
||||
end
|
||||
end
|
||||
|
||||
-- 返回副本列表,sort
|
||||
function DungeonData:getDungeonList(checkOpen)
|
||||
local sortDungeons = {}
|
||||
for moduleKey, id in pairs(GConst.DungeonConst.IDS) do
|
||||
if not checkOpen then -- or self:isOpen(moduleKey)
|
||||
local temp = {module = moduleKey, sort = id}
|
||||
table.insert(sortDungeons, temp)
|
||||
end
|
||||
end
|
||||
table.sort(sortDungeons, function(a, b)
|
||||
local isOpenA = self:isOpen(a.module)
|
||||
local isOpenB = self:isOpen(b.module)
|
||||
if isOpenA and isOpenB then
|
||||
return a.sort < b.sort
|
||||
elseif isOpenA ~= isOpenB then
|
||||
if isOpenA then
|
||||
return true
|
||||
else
|
||||
return false
|
||||
end
|
||||
end
|
||||
|
||||
-- 判断是否在活跃周期内
|
||||
function DungeonData:isActiveCycle(moduleKey, checkWeek)
|
||||
if not self.dataDungeons[moduleKey] then
|
||||
return false
|
||||
end
|
||||
|
||||
if self:getIsAllTimeOpen(moduleKey) then
|
||||
return true
|
||||
end
|
||||
|
||||
local closeTime = self.dataDungeons[moduleKey]:getCloseTime()
|
||||
if closeTime and closeTime > 0 then
|
||||
return true
|
||||
end
|
||||
|
||||
for index, week in ipairs(self.dataDungeons[moduleKey]:getOpenWeekCycle()) do
|
||||
if week == checkWeek then
|
||||
return true
|
||||
end
|
||||
end
|
||||
return false
|
||||
end
|
||||
|
||||
-- 是否任意一个副本可以挑战
|
||||
function DungeonData:isCanChallengeAnyone()
|
||||
for key, value in pairs(self.dataDungeons) do
|
||||
if self:isCanChallenge(key) then
|
||||
return true
|
||||
end
|
||||
end
|
||||
return false
|
||||
end
|
||||
|
||||
-- 副本是否可以挑战
|
||||
function DungeonData:isCanChallenge(moduleKey)
|
||||
if not self:isActive(moduleKey) then
|
||||
return false
|
||||
end
|
||||
if not (self:getRemainTimes(moduleKey) > 0) then
|
||||
return false
|
||||
end
|
||||
if not self:isEnoughHp(moduleKey) then
|
||||
return false
|
||||
end
|
||||
return true
|
||||
end
|
||||
|
||||
-- 副本是否可以扫荡
|
||||
function DungeonData:isCanSweep(moduleKey, id)
|
||||
if not self:isActive(moduleKey) then
|
||||
return false
|
||||
end
|
||||
if not (self:getRemainTimes(moduleKey) > 0) then
|
||||
return false
|
||||
end
|
||||
if not self:isEnoughHp(moduleKey) then
|
||||
return false
|
||||
end
|
||||
if not self:getPassedMaxId(moduleKey) >= id then
|
||||
return false
|
||||
end
|
||||
return true
|
||||
end
|
||||
|
||||
-- 获取副本挑战总次数
|
||||
function DungeonData:getTotalCount(moduleKey)
|
||||
return self.dataDungeons[moduleKey]:getTotalChallengeCount()
|
||||
end
|
||||
|
||||
-- 获取副本今日剩余次数
|
||||
function DungeonData:getRemainTimes(moduleKey)
|
||||
if not self:isActive(moduleKey) then
|
||||
return 0
|
||||
end
|
||||
if not self.dataDungeons[moduleKey] then
|
||||
return 0
|
||||
end
|
||||
|
||||
return self.dataDungeons[moduleKey]:getTodayRemainLimitCount()
|
||||
end
|
||||
|
||||
-- 体力是否足够
|
||||
function DungeonData:isEnoughHp(moduleKey)
|
||||
local const = self:getChallengeHpCost(moduleKey)
|
||||
local constNum = 0
|
||||
if const then
|
||||
constNum = GFunc.getRewardNum(const)
|
||||
end
|
||||
return constNum <= DataManager.BagData.ItemData:getVit()
|
||||
end
|
||||
|
||||
-- 获取挑战体力消耗
|
||||
function DungeonData:getChallengeHpCost(moduleKey)
|
||||
if not self:isActive(moduleKey) then
|
||||
return 0
|
||||
end
|
||||
if not self.dataDungeons[moduleKey] then
|
||||
return 0
|
||||
end
|
||||
|
||||
return self.dataDungeons[moduleKey]:getChallengeHpCost()
|
||||
end
|
||||
|
||||
-- 获取副本下个状态改变时间
|
||||
function DungeonData:geNextTime(moduleKey)
|
||||
if self:isActive(moduleKey) then
|
||||
return self:getCloseTime(moduleKey)
|
||||
else
|
||||
return self:getOpenTime(moduleKey)
|
||||
return a.sort < b.sort
|
||||
end
|
||||
end)
|
||||
if EDITOR_MODE then
|
||||
Logger.logHighlight("开启副本:")
|
||||
Logger.printTable(sortDungeons)
|
||||
end
|
||||
|
||||
local moduleNames = {}
|
||||
for i, info in ipairs(sortDungeons) do
|
||||
table.insert(moduleNames, info.module)
|
||||
end
|
||||
|
||||
return moduleNames
|
||||
end
|
||||
|
||||
-- 获取副本开启倒计时
|
||||
function DungeonData:getOpenTime(moduleKey)
|
||||
if not self.dataDungeons[moduleKey] then
|
||||
-- 当前副本次数
|
||||
function DungeonData:getHasTime(moduleKey)
|
||||
-- if moduleKey == ModuleManager.MODULE_KEY.TOWER then
|
||||
-- return DataManager.TowerData:getRemainChallengeCount()
|
||||
-- elseif moduleKey == ModuleManager.MODULE_KEY.WORLD_BOSS then
|
||||
-- return DataManager.WorldBossData:getRemainChallengeCount()
|
||||
-- elseif moduleKey == ModuleManager.MODULE_KEY.DOOR then
|
||||
-- return DataManager.DoorData:getRemainChallengeCount()
|
||||
-- elseif moduleKey == ModuleManager.MODULE_KEY.ELEMENT_DUNGEON then
|
||||
-- return DataManager.ElementData:getTodayRemainTimes()
|
||||
-- end
|
||||
return 0
|
||||
end
|
||||
|
||||
local isClose = true
|
||||
local count = 0
|
||||
while isClose do
|
||||
local checkWeek = Time:getWeekByTimeStamp(Time:getServerTime() + ((count + 1) * 86400))
|
||||
if self:isActiveCycle(moduleKey, checkWeek) then
|
||||
isClose = false
|
||||
else
|
||||
count = count + 1
|
||||
end
|
||||
end
|
||||
|
||||
return Time:getTodaySurplusTime() + (count * 86400)
|
||||
end
|
||||
|
||||
-- 获取副本关闭倒计时
|
||||
function DungeonData:getCloseTime(moduleKey)
|
||||
if not self.dataDungeons[moduleKey] then
|
||||
-- 每日免费次数
|
||||
function DungeonData:getFreeTime(moduleKey)
|
||||
-- if moduleKey == ModuleManager.MODULE_KEY.TOWER then
|
||||
-- return DataManager.TowerData:getDailyFreeTime()
|
||||
-- elseif moduleKey == ModuleManager.MODULE_KEY.WORLD_BOSS then
|
||||
-- return DataManager.WorldBossData:getDailyFreeTime()
|
||||
-- elseif moduleKey == ModuleManager.MODULE_KEY.ELEMENT_DUNGEON then
|
||||
-- return DataManager.ElementData:getTodayMaxTimes()
|
||||
-- end
|
||||
return 0
|
||||
end
|
||||
|
||||
if self:getIsAllTimeOpen(moduleKey) then
|
||||
return 1
|
||||
end
|
||||
|
||||
if self.dataDungeons[moduleKey]:getCloseTime() then
|
||||
return self.dataDungeons[moduleKey]:getCloseTime()
|
||||
end
|
||||
|
||||
local isActive = true
|
||||
local count = 0
|
||||
while isActive do
|
||||
local checkWeek = Time:getWeekByTimeStamp(Time:getServerTime() + ((count + 1) * 86400))
|
||||
if not self:isActiveCycle(moduleKey, checkWeek) then
|
||||
isActive = false
|
||||
else
|
||||
count = count + 1
|
||||
end
|
||||
end
|
||||
|
||||
return Time:getTodaySurplusTime() + (count * 86400)
|
||||
end
|
||||
|
||||
-- 获取看板展示的副本奖励(返回item id list)
|
||||
function DungeonData:getBoardShowRewardId(moduleKey)
|
||||
return self.dataDungeons[moduleKey]:getBoardShowRewardId()
|
||||
function DungeonData:canGetReward(moduleKey)
|
||||
-- if moduleKey == ModuleManager.MODULE_KEY.TOWER then
|
||||
-- return DataManager.TowerData:hasAvailableReward()
|
||||
-- elseif moduleKey == ModuleManager.MODULE_KEY.WORLD_BOSS then
|
||||
-- return DataManager.WorldBossData:hasRankRewardRp()
|
||||
-- elseif moduleKey == ModuleManager.MODULE_KEY.PRISON then
|
||||
-- return DataManager.PrisonData:hasRedPoint()
|
||||
-- elseif moduleKey == ModuleManager.MODULE_KEY.ELEMENT_DUNGEON then
|
||||
-- return DataManager.ElementData:hasRankRewardRp()
|
||||
-- end
|
||||
return false
|
||||
end
|
||||
|
||||
-- 获取展示副本首通奖励个数
|
||||
function DungeonData:getFirstRewardNum(moduleKey, id)
|
||||
-- 通关后,不展示首通奖励
|
||||
return self.dataDungeons[moduleKey]:getFirstRewardNum(id)
|
||||
end
|
||||
|
||||
-- 获取展示副本通关奖励个数
|
||||
function DungeonData:getPassRewardNum(moduleKey, id)
|
||||
return self.dataDungeons[moduleKey]:getPassRewardNum(id)
|
||||
end
|
||||
|
||||
--获取副本已解锁最大id
|
||||
function DungeonData:getUnlockMaxId(moduleKey)
|
||||
local id = self.dataDungeons[moduleKey]:getPassedMaxId() + 1
|
||||
if id > self:getConfigMaxId(moduleKey) then
|
||||
id = id - 1
|
||||
end
|
||||
return id
|
||||
end
|
||||
|
||||
-- 获取副本配置的最高关卡
|
||||
function DungeonData:getConfigMaxId(moduleKey)
|
||||
return #self.dataDungeons[moduleKey]:getConfig()
|
||||
end
|
||||
|
||||
--获取副本已通关的最高关卡id
|
||||
function DungeonData:getPassedMaxId(moduleKey)
|
||||
return self.dataDungeons[moduleKey]:getPassedMaxId()
|
||||
end
|
||||
|
||||
-- 获取副本标题文案
|
||||
function DungeonData:getTitle(moduleKey)
|
||||
return self.dataDungeons[moduleKey]:getTitleString()
|
||||
end
|
||||
|
||||
-- 获取副本规则描述
|
||||
function DungeonData:getRule(moduleKey)
|
||||
return self.dataDungeons[moduleKey]:getRuleString()
|
||||
end
|
||||
|
||||
-- 获取副本当前关卡buff
|
||||
function DungeonData:getBossBuff(moduleKey, id)
|
||||
return self.dataDungeons[moduleKey]:getBossBuff(id)
|
||||
end
|
||||
|
||||
-- 获取副本开启时间描述
|
||||
function DungeonData:getOpenTimeDesc(moduleKey)
|
||||
return self.dataDungeons[moduleKey]:getOpenWeekString()
|
||||
end
|
||||
|
||||
-- 获取副本角标图
|
||||
function DungeonData:getIcon(moduleKey)
|
||||
return self.dataDungeons[moduleKey]:getIcon()
|
||||
end
|
||||
|
||||
-- 获取副本banner图
|
||||
function DungeonData:getBanner(moduleKey)
|
||||
return self.dataDungeons[moduleKey]:getBanner()
|
||||
end
|
||||
|
||||
-- 获取开启时间文本颜色
|
||||
function DungeonData:getOpenTextColor(moduleKey)
|
||||
return self.dataDungeons[moduleKey]:getOpenTextColor()
|
||||
end
|
||||
|
||||
function DungeonData:setCurFightChapterId(chapterId)
|
||||
self.curFightchapterId = chapterId or 1
|
||||
end
|
||||
|
||||
function DungeonData:getCurFightChapterId()
|
||||
return self.curFightchapterId or 1
|
||||
end
|
||||
|
||||
function DungeonData:getIsAllTimeOpen(moduleKey)
|
||||
return self.dataDungeons[moduleKey]:getIsAllTimeOpen()
|
||||
end
|
||||
|
||||
function DungeonData:isNoTotalLimit(moduleKey)
|
||||
return self.dataDungeons[moduleKey]:isNoTotalLimit()
|
||||
end
|
||||
|
||||
function DungeonData:isNotShowLimitCount(moduleKey)
|
||||
return self.dataDungeons[moduleKey]:isNotShowLimitCount()
|
||||
end
|
||||
|
||||
function DungeonData:onClickFight(moduleKey)
|
||||
self.dataDungeons[moduleKey]:onClickFight()
|
||||
end
|
||||
|
||||
function DungeonData:getDungeonDataByType(moduleKey)
|
||||
return self.dataDungeons[moduleKey]
|
||||
-- 有广告红点
|
||||
function DungeonData:hasAdRp(moduleKey)
|
||||
return false
|
||||
end
|
||||
|
||||
function DungeonData:getDungeonBIStr()
|
||||
local str
|
||||
if not self.dataDungeons then
|
||||
return GConst.EMPTY_STRING
|
||||
end
|
||||
for moduleKey, entity in pairs(self.dataDungeons) do
|
||||
if str then
|
||||
str = str .. "|"
|
||||
else
|
||||
str = GConst.EMPTY_STRING
|
||||
end
|
||||
Logger.logHighlight(moduleKey)
|
||||
str = str .. string.gsub(moduleKey, "_open", "") .. ":" .. entity:getPassedMaxId()
|
||||
end
|
||||
-- if not self.dataDungeons then
|
||||
-- return GConst.EMPTY_STRING
|
||||
-- end
|
||||
-- for moduleKey, entity in pairs(self.dataDungeons) do
|
||||
-- if str then
|
||||
-- str = str .. "|"
|
||||
-- else
|
||||
-- str = GConst.EMPTY_STRING
|
||||
-- end
|
||||
-- Logger.logHighlight(moduleKey)
|
||||
-- str = str .. string.gsub(moduleKey, "_open", "") .. ":" .. entity:getPassedMaxId()
|
||||
-- end
|
||||
return str
|
||||
end
|
||||
|
||||
|
||||
168
lua/app/userdata/dungeon/dungeon_gold_data.lua
Normal file
168
lua/app/userdata/dungeon/dungeon_gold_data.lua
Normal file
@ -0,0 +1,168 @@
|
||||
local DungeonGoldData = class("DungeonGoldData", BaseData)
|
||||
|
||||
local FIRST_CHAPTER_ID = 1001
|
||||
|
||||
function DungeonGoldData:ctor()
|
||||
self.data.isDirty = false
|
||||
self.data.maxPassed = 0
|
||||
self.data.times = 0
|
||||
self.data.challengeId = 0
|
||||
end
|
||||
|
||||
function DungeonGoldData:setDirty()
|
||||
self.data.isDirty = not self.data.isDirty
|
||||
end
|
||||
|
||||
function DungeonGoldData:init(data)
|
||||
data = data or GConst.EMPTY_TABLE
|
||||
self.data.maxPassed = data.max_passed or 0 -- 最大通关的副本id
|
||||
self.data.itemTimes = data.item_times or 0 -- 今日道具挑战次数
|
||||
if self.data.maxPassed <= 0 then -- 一关都没打过
|
||||
self.data.challengeId = FIRST_CHAPTER_ID
|
||||
else
|
||||
local info = self:getConfig()[self.data.maxPassed]
|
||||
if info then
|
||||
local nextId = info.next_chapter
|
||||
if nextId then
|
||||
self.data.challengeId = nextId
|
||||
else
|
||||
self.data.challengeId = self.data.maxPassed
|
||||
end
|
||||
else
|
||||
self.data.maxPassed = 0
|
||||
self.data.challengeId = FIRST_CHAPTER_ID
|
||||
end
|
||||
end
|
||||
self.data.times = data.times or 0 -- 今日剩余挑战次数
|
||||
end
|
||||
|
||||
function DungeonGoldData:isOpen(showToast)
|
||||
if not ModuleManager:getIsOpen(ModuleManager.MODULE_KEY.DUNGEON_GOLD, not showToast) then
|
||||
return false
|
||||
end
|
||||
return true
|
||||
end
|
||||
|
||||
function DungeonGoldData:getModuleKey()
|
||||
return ModuleManager.MODULE_KEY.DUNGEON_GOLD
|
||||
end
|
||||
|
||||
function DungeonGoldData:getConfig()
|
||||
if self._chapterCungeonCfg == nil then
|
||||
self._chapterCungeonCfg = ConfigManager:getConfig("chapter_dungeon")
|
||||
end
|
||||
return self._chapterCungeonCfg
|
||||
end
|
||||
|
||||
function DungeonGoldData:getAllChaptersInfo()
|
||||
if self._allChaptersInfo == nil then
|
||||
self._allChaptersInfo = {}
|
||||
local cfg = ConfigManager:getConfig("chapter_dungeon")
|
||||
for k, v in pairs(cfg) do
|
||||
if v.type == 1 then
|
||||
table.insert(self._allChaptersInfo, {
|
||||
id = k,
|
||||
cfg = v
|
||||
})
|
||||
end
|
||||
end
|
||||
table.sort(self._allChaptersInfo, function (a, b)
|
||||
return a.id < b.id
|
||||
end)
|
||||
end
|
||||
return self._allChaptersInfo
|
||||
end
|
||||
|
||||
--只显示已通关 + 目前通关往后的十个
|
||||
function DungeonGoldData:getLimitChaptersInfo()
|
||||
local list = self:getAllChaptersInfo()
|
||||
local limitList = {}
|
||||
for i,v in ipairs(list) do
|
||||
if self.data.maxPassed + 10 >= v.id or i <= 10 then
|
||||
table.insert(limitList, v)
|
||||
end
|
||||
end
|
||||
return limitList
|
||||
end
|
||||
|
||||
function DungeonGoldData:getChapterInfo(index)
|
||||
return self:getAllChaptersInfo()[index]
|
||||
end
|
||||
|
||||
function DungeonGoldData:getMaxPassedId()
|
||||
return self.data.maxPassed
|
||||
end
|
||||
|
||||
function DungeonGoldData:getChallengeId()
|
||||
return self.data.challengeId
|
||||
end
|
||||
|
||||
function DungeonGoldData:getTodayMaxTimes()
|
||||
if self._dungeonGoldTimes == nil then
|
||||
self._dungeonGoldTimes = GFunc.getConstIntValue("dungeon_gold_times")
|
||||
end
|
||||
if DataManager.PrivilegeCardData:getIsChallegeCardActive() then
|
||||
return self._dungeonGoldTimes + self:getPrivilegeCardAddTimes()
|
||||
else
|
||||
return self._dungeonGoldTimes
|
||||
end
|
||||
end
|
||||
|
||||
function DungeonGoldData:getPrivilegeCardAddTimes()
|
||||
if self._privilegeCardAddTimes == nil then
|
||||
self._privilegeCardAddTimes = GFunc.getConstIntValue("card_fight_gold")
|
||||
end
|
||||
return self._privilegeCardAddTimes
|
||||
end
|
||||
|
||||
function DungeonGoldData:getTodayRemainTimes()
|
||||
local maxTimes = self:getTodayMaxTimes()
|
||||
local times = maxTimes - self.data.times
|
||||
if times < 0 then
|
||||
times = 0
|
||||
end
|
||||
return times
|
||||
end
|
||||
|
||||
function DungeonGoldData:getChapterName(chapterId)
|
||||
return I18N:getConfig("chapter_dungeon")[chapterId].name
|
||||
end
|
||||
|
||||
function DungeonGoldData:onFightDungeonDailyFinish(chapterId, victory)
|
||||
if not victory then
|
||||
return
|
||||
end
|
||||
if self.data.maxPassed < chapterId then
|
||||
local info = self:getConfig()[chapterId]
|
||||
if info then
|
||||
self.data.maxPassed = chapterId
|
||||
local nextId = info.next_chapter
|
||||
if nextId then
|
||||
self.data.challengeId = nextId
|
||||
else
|
||||
self.data.challengeId = self.data.maxPassed
|
||||
end
|
||||
end
|
||||
end
|
||||
self.data.times = self.data.times + 1
|
||||
self:setDirty()
|
||||
end
|
||||
|
||||
function DungeonGoldData:onSweepDungeonDailyFinish()
|
||||
self.data.times = self.data.times + 1
|
||||
self:setDirty()
|
||||
end
|
||||
|
||||
function DungeonGoldData:getIsShowRedPoint()
|
||||
if not self:isOpen() then
|
||||
return false
|
||||
end
|
||||
return self:getTodayRemainTimes() > 0
|
||||
end
|
||||
|
||||
function DungeonGoldData:onCrossDay()
|
||||
self.data.times = 0
|
||||
self:setDirty()
|
||||
end
|
||||
|
||||
return DungeonGoldData
|
||||
10
lua/app/userdata/dungeon/dungeon_gold_data.lua.meta
Normal file
10
lua/app/userdata/dungeon/dungeon_gold_data.lua.meta
Normal file
@ -0,0 +1,10 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 744f2c7dc8ba749268195a0ea91428a1
|
||||
ScriptedImporter:
|
||||
internalIDToNameTable: []
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
script: {fileID: 11500000, guid: 3b8b241bab4a4ac9a22fcce9c64f1242, type: 3}
|
||||
@ -1,93 +0,0 @@
|
||||
local DungeonBaseEntity = require "app/userdata/dungeon/dungeon_base_entity"
|
||||
local DungeonGoldEntity = class("DungeonGoldEntity", DungeonBaseEntity)
|
||||
|
||||
-- 金币副本数据
|
||||
|
||||
function DungeonGoldEntity:init(data)
|
||||
if self.maxPassedId then
|
||||
ModuleManager.TaskManager:addTaskProgress(GConst.TaskConst.TASK_TYPE.X_DUNGEON_GOLD, data.max_chapter_gold_id - self.maxPassedId)
|
||||
end
|
||||
self.totalChallengeCount = data.total_challenge_count
|
||||
self.todayChallengeCount = data.today_challenge_count
|
||||
self.maxPassedId = data.max_chapter_gold_id
|
||||
end
|
||||
|
||||
function DungeonGoldEntity:getTotalChallengeCount()
|
||||
return self.totalChallengeCount
|
||||
end
|
||||
|
||||
function DungeonGoldEntity:getTodayChallengeCount()
|
||||
return self.todayChallengeCount
|
||||
end
|
||||
|
||||
function DungeonGoldEntity:getPassedMaxId()
|
||||
return self.maxPassedId
|
||||
end
|
||||
|
||||
function DungeonGoldEntity:getModuleKey()
|
||||
return ModuleManager.MODULE_KEY.DUNGEON_GOLD
|
||||
end
|
||||
|
||||
function DungeonGoldEntity:getOpenWeekCycle()
|
||||
if self.openWeek == nil then
|
||||
self.openWeek = {2,4,6,7}
|
||||
end
|
||||
return self.openWeek
|
||||
end
|
||||
|
||||
function DungeonGoldEntity:getConfigName()
|
||||
return "chapter_dungeon_gold"
|
||||
end
|
||||
|
||||
function DungeonGoldEntity:getTitleString()
|
||||
return I18N:getGlobalText(I18N.GlobalConst.DUNGEON_GOLD_TITLE)
|
||||
end
|
||||
|
||||
function DungeonGoldEntity:getRuleString()
|
||||
return I18N:getGlobalText(I18N.GlobalConst.DUNGEON_GOLD_HELP)
|
||||
end
|
||||
|
||||
function DungeonGoldEntity:getOpenWeekString()
|
||||
return I18N:getGlobalText(I18N.GlobalConst.DUNGEON_GOLD_OPEN)
|
||||
end
|
||||
|
||||
function DungeonGoldEntity:getBossBuff(id)
|
||||
return self:getConfig()[id].effect[1]
|
||||
end
|
||||
|
||||
function DungeonGoldEntity:getIcon()
|
||||
if self.dungeonIcon == nil then
|
||||
self.dungeonIcon = {GConst.ATLAS_PATH.DUNGEON,"dungeon_dec_1"}
|
||||
end
|
||||
return self.dungeonIcon
|
||||
end
|
||||
|
||||
function DungeonGoldEntity:getBanner()
|
||||
return "assets/arts/textures/background/dungeon/dungeon_bg_1.png"
|
||||
end
|
||||
|
||||
function DungeonGoldEntity:getOpenTextColor()
|
||||
return "#FFEDC5"
|
||||
end
|
||||
|
||||
function DungeonGoldEntity:getChallengeHpCost()
|
||||
return GFunc.getConstReward("dungeon_gold_cost")
|
||||
end
|
||||
|
||||
function DungeonGoldEntity:getTodayMaxCount()
|
||||
return GFunc.getConstIntValue("dungeon_gold_limit")
|
||||
end
|
||||
|
||||
function DungeonGoldEntity:getBoardShowRewardId()
|
||||
return 1
|
||||
end
|
||||
|
||||
function DungeonGoldEntity:getFirstRewardNum(id)
|
||||
return GFunc.getRewardNum(ConfigManager:getConfig("chapter_dungeon_gold")[id].first_pass_reward)
|
||||
end
|
||||
|
||||
function DungeonGoldEntity:getPassRewardNum(id)
|
||||
return GFunc.getRewardNum(ConfigManager:getConfig("chapter_dungeon_gold")[id].percent_reward)
|
||||
end
|
||||
|
||||
return DungeonGoldEntity
|
||||
@ -1,10 +0,0 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 792ac3a45b52c5d4c895737413faf6db
|
||||
ScriptedImporter:
|
||||
internalIDToNameTable: []
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
script: {fileID: 11500000, guid: 3b8b241bab4a4ac9a22fcce9c64f1242, type: 3}
|
||||
168
lua/app/userdata/dungeon/dungeon_material_data.lua
Normal file
168
lua/app/userdata/dungeon/dungeon_material_data.lua
Normal file
@ -0,0 +1,168 @@
|
||||
local DungeonMaterialData = class("DungeonMaterialData", BaseData)
|
||||
|
||||
local FIRST_CHAPTER_ID = 2001
|
||||
|
||||
function DungeonMaterialData:ctor()
|
||||
self.data.isDirty = false
|
||||
self.data.maxPassed = 0
|
||||
self.data.times = 0
|
||||
self.data.challengeId = 0
|
||||
end
|
||||
|
||||
function DungeonMaterialData:setDirty()
|
||||
self.data.isDirty = not self.data.isDirty
|
||||
end
|
||||
|
||||
function DungeonMaterialData:init(data)
|
||||
data = data or GConst.EMPTY_TABLE
|
||||
self.data.maxPassed = data.max_passed or 0 -- 最大通关的副本id
|
||||
self.data.itemTimes = data.item_times or 0 -- 今日道具挑战次数
|
||||
if self.data.maxPassed <= 0 then -- 一关都没打过
|
||||
self.data.challengeId = FIRST_CHAPTER_ID
|
||||
else
|
||||
local info = self:getConfig()[self.data.maxPassed]
|
||||
if info then
|
||||
local nextId = info.next_chapter
|
||||
if nextId then
|
||||
self.data.challengeId = nextId
|
||||
else
|
||||
self.data.challengeId = self.data.maxPassed
|
||||
end
|
||||
else
|
||||
self.data.maxPassed = 0
|
||||
self.data.challengeId = FIRST_CHAPTER_ID
|
||||
end
|
||||
end
|
||||
self.data.times = data.times or 0 -- 今日剩余挑战次数
|
||||
end
|
||||
|
||||
function DungeonMaterialData:isOpen(showToast)
|
||||
if not ModuleManager:getIsOpen(ModuleManager.MODULE_KEY.DUNGEON_RES, not showToast) then
|
||||
return false
|
||||
end
|
||||
return true
|
||||
end
|
||||
|
||||
function DungeonMaterialData:getModuleKey()
|
||||
return ModuleManager.MODULE_KEY.DUNGEON_RES
|
||||
end
|
||||
|
||||
function DungeonMaterialData:getConfig()
|
||||
if self._chapterCungeonCfg == nil then
|
||||
self._chapterCungeonCfg = ConfigManager:getConfig("chapter_dungeon")
|
||||
end
|
||||
return self._chapterCungeonCfg
|
||||
end
|
||||
|
||||
function DungeonMaterialData:getAllChaptersInfo()
|
||||
if self._allChaptersInfo == nil then
|
||||
self._allChaptersInfo = {}
|
||||
local cfg = ConfigManager:getConfig("chapter_dungeon")
|
||||
for k, v in pairs(cfg) do
|
||||
if v.type == 2 then
|
||||
table.insert(self._allChaptersInfo, {
|
||||
id = k,
|
||||
cfg = v
|
||||
})
|
||||
end
|
||||
end
|
||||
table.sort(self._allChaptersInfo, function (a, b)
|
||||
return a.id < b.id
|
||||
end)
|
||||
end
|
||||
return self._allChaptersInfo
|
||||
end
|
||||
|
||||
--只显示已通关 + 目前通关往后的十个
|
||||
function DungeonMaterialData:getLimitChaptersInfo()
|
||||
local list = self:getAllChaptersInfo()
|
||||
local limitList = {}
|
||||
for i,v in ipairs(list) do
|
||||
if self.data.maxPassed + 10 >= v.id or i <= 10 then
|
||||
table.insert(limitList, v)
|
||||
end
|
||||
end
|
||||
return limitList
|
||||
end
|
||||
|
||||
function DungeonMaterialData:getChapterInfo(index)
|
||||
return self:getAllChaptersInfo()[index]
|
||||
end
|
||||
|
||||
function DungeonMaterialData:getMaxPassedId()
|
||||
return self.data.maxPassed
|
||||
end
|
||||
|
||||
function DungeonMaterialData:getChallengeId()
|
||||
return self.data.challengeId
|
||||
end
|
||||
|
||||
function DungeonMaterialData:getTodayMaxTimes()
|
||||
if self._dungeonMaterialTimes == nil then
|
||||
self._dungeonMaterialTimes = GFunc.getConstIntValue("dungeon_res_times")
|
||||
end
|
||||
if DataManager.PrivilegeCardData:getIsChallegeCardActive() then
|
||||
return self._dungeonMaterialTimes + self:getPrivilegeCardAddTimes()
|
||||
else
|
||||
return self._dungeonMaterialTimes
|
||||
end
|
||||
end
|
||||
|
||||
function DungeonMaterialData:getPrivilegeCardAddTimes()
|
||||
if self._privilegeCardAddTimes == nil then
|
||||
self._privilegeCardAddTimes = GFunc.getConstIntValue("card_fight_res")
|
||||
end
|
||||
return self._privilegeCardAddTimes
|
||||
end
|
||||
|
||||
function DungeonMaterialData:getTodayRemainTimes()
|
||||
local maxTimes = self:getTodayMaxTimes()
|
||||
local times = maxTimes - self.data.times
|
||||
if times < 0 then
|
||||
times = 0
|
||||
end
|
||||
return times
|
||||
end
|
||||
|
||||
function DungeonMaterialData:getChapterName(chapterId)
|
||||
return I18N:getConfig("chapter_dungeon")[chapterId].name
|
||||
end
|
||||
|
||||
function DungeonMaterialData:onFightDungeonDailyFinish(chapterId, victory)
|
||||
if not victory then
|
||||
return
|
||||
end
|
||||
if self.data.maxPassed < chapterId then
|
||||
local info = self:getConfig()[chapterId]
|
||||
if info then
|
||||
self.data.maxPassed = chapterId
|
||||
local nextId = info.next_chapter
|
||||
if nextId then
|
||||
self.data.challengeId = nextId
|
||||
else
|
||||
self.data.challengeId = self.data.maxPassed
|
||||
end
|
||||
end
|
||||
end
|
||||
self.data.times = self.data.times + 1
|
||||
self:setDirty()
|
||||
end
|
||||
|
||||
function DungeonMaterialData:onSweepDungeonDailyFinish()
|
||||
self.data.times = self.data.times + 1
|
||||
self:setDirty()
|
||||
end
|
||||
|
||||
function DungeonMaterialData:getIsShowRedPoint()
|
||||
if not self:isOpen() then
|
||||
return false
|
||||
end
|
||||
return self:getTodayRemainTimes() > 0
|
||||
end
|
||||
|
||||
function DungeonMaterialData:onCrossDay()
|
||||
self.data.times = 0
|
||||
self:setDirty()
|
||||
end
|
||||
|
||||
return DungeonMaterialData
|
||||
10
lua/app/userdata/dungeon/dungeon_material_data.lua.meta
Normal file
10
lua/app/userdata/dungeon/dungeon_material_data.lua.meta
Normal file
@ -0,0 +1,10 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 1b43f2b5248224a3282f6d61f142a3aa
|
||||
ScriptedImporter:
|
||||
internalIDToNameTable: []
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
script: {fileID: 11500000, guid: 3b8b241bab4a4ac9a22fcce9c64f1242, type: 3}
|
||||
@ -1,308 +0,0 @@
|
||||
local DungeonBaseEntity = require "app/userdata/dungeon/dungeon_base_entity"
|
||||
local DungeonRuneEntity = class("DungeonRuneEntity", DungeonBaseEntity)
|
||||
|
||||
local TASK_TYPE = GConst.DungeonRuneConst.TASK_TYPE
|
||||
|
||||
function DungeonRuneEntity:ctor()
|
||||
self.data.isDirty = false
|
||||
self.maxPassedId = 0
|
||||
self.runeInfo = {}
|
||||
end
|
||||
|
||||
function DungeonRuneEntity:clear()
|
||||
self.data.isDirty = false
|
||||
DataManager:unregisterCrossDayFunc("DungeonRuneEntity")
|
||||
end
|
||||
|
||||
function DungeonRuneEntity:init(data)
|
||||
if EDITOR_MODE then
|
||||
Logger.logHighlight("-----DungeonRuneEntity------")
|
||||
Logger.printTable(data)
|
||||
end
|
||||
|
||||
self.totalChallengeCount = data.total_challenge_count or 0
|
||||
self.fightCountMap = data.stat_counts or {}
|
||||
self.maxPassedId = data.max_challenge_id and (data.max_challenge_id - 1) or 0
|
||||
self.runeInfo = data.turns or {}
|
||||
self.heroes = data.heroes or {}
|
||||
self.buySilverCount = data.buy_silver_count or 0
|
||||
|
||||
DataManager.FormationData:initFormationByType(GConst.BattleConst.FORMATION_TYPE.DUNGEON_RUNE, self.heroes)
|
||||
DataManager:registerCrossDayFunc("DungeonRuneEntity", function()
|
||||
self.buySilverCount = 0
|
||||
self:setDirty()
|
||||
end)
|
||||
end
|
||||
|
||||
function DungeonRuneEntity:setDirty()
|
||||
self.data.isDirty = not self.data.isDirty
|
||||
end
|
||||
|
||||
function DungeonRuneEntity:getModuleKey()
|
||||
return ModuleManager.MODULE_KEY.RUNES_OPEN
|
||||
end
|
||||
|
||||
function DungeonRuneEntity:getConfig(chapterId)
|
||||
return ConfigManager:getConfig(self:getConfigName())[chapterId]
|
||||
end
|
||||
|
||||
function DungeonRuneEntity:getConfigName()
|
||||
return "chapter_dungeon_rune"
|
||||
end
|
||||
|
||||
function DungeonRuneEntity:getTitleString()
|
||||
return I18N:getGlobalText(I18N.GlobalConst.DUNGEON_RUNE_TITLE)
|
||||
end
|
||||
|
||||
function DungeonRuneEntity:getRuleString()
|
||||
return I18N:getGlobalText(I18N.GlobalConst.DUNGEON_RUNE_HELP)
|
||||
end
|
||||
|
||||
function DungeonRuneEntity:getOpenWeekString()
|
||||
return I18N:getGlobalText(I18N.GlobalConst.DUNGEON_RUNE_DESC)
|
||||
end
|
||||
|
||||
function DungeonRuneEntity:getBanner()
|
||||
return "assets/arts/textures/background/dungeon/dungeon_bg_5.png"
|
||||
end
|
||||
|
||||
function DungeonRuneEntity:getOpenTextColor()
|
||||
return "#FFFFFF"
|
||||
end
|
||||
|
||||
function DungeonRuneEntity:isNoTotalLimit()
|
||||
return true
|
||||
end
|
||||
|
||||
function DungeonRuneEntity:isNotShowLimitCount()
|
||||
return true
|
||||
end
|
||||
|
||||
function DungeonRuneEntity:getIsAllTimeOpen()
|
||||
return true
|
||||
end
|
||||
|
||||
function DungeonRuneEntity:onClickFight()
|
||||
ModuleManager.DungeonRuneManager:showMainUI()
|
||||
end
|
||||
|
||||
function DungeonRuneEntity:getTodayRemainLimitCount()
|
||||
return DataManager.BagData.ItemData:getItemNumById(GConst.ItemConst.ITEM_ID_GLOD_WING)
|
||||
end
|
||||
|
||||
function DungeonRuneEntity:getRebirthAddRoundCount()
|
||||
if not self.rebirthAddRoundCount then
|
||||
self.rebirthAddRoundCount = GFunc.getConstIntValue("dungeon_rune_revival")
|
||||
end
|
||||
return self.rebirthAddRoundCount
|
||||
end
|
||||
|
||||
function DungeonRuneEntity:getBattleMaxlv()
|
||||
if not self.battleMaxLv then
|
||||
self.battleMaxLv = GFunc.getConstIntValue("dungeon_rune_lvlimit")
|
||||
end
|
||||
return self.battleMaxLv
|
||||
end
|
||||
|
||||
function DungeonRuneEntity:getBuySliverWingCost()
|
||||
if not self.buySliverWingCost then
|
||||
self.buySliverWingCost = GFunc.getConstReward("dungeon_rune_cost")
|
||||
end
|
||||
return self.buySliverWingCost
|
||||
end
|
||||
|
||||
function DungeonRuneEntity:getPassedMaxId()
|
||||
return self.maxPassedId
|
||||
end
|
||||
|
||||
function DungeonRuneEntity:updatePassedMaxId(maxId)
|
||||
if not maxId then
|
||||
return
|
||||
end
|
||||
self.maxPassedId = math.max(maxId - 1, 1)
|
||||
end
|
||||
|
||||
function DungeonRuneEntity:canSweep(id)
|
||||
if id > self.maxPassedId then
|
||||
return false
|
||||
end
|
||||
if not self:isBossChapter(id) then
|
||||
return false
|
||||
end
|
||||
return DataManager.BagData.ItemData:getItemNumById(GConst.ItemConst.ITEM_ID_SLIVER_WING) > 0
|
||||
end
|
||||
|
||||
function DungeonRuneEntity:canFight(id)
|
||||
if self.maxPassedId + 1 >= id then
|
||||
return true
|
||||
end
|
||||
return false
|
||||
end
|
||||
|
||||
function DungeonRuneEntity:passedChapter(id)
|
||||
return self.maxPassedId >= id
|
||||
end
|
||||
|
||||
function DungeonRuneEntity:curFight(id)
|
||||
return id == self.maxPassedId + 1
|
||||
end
|
||||
|
||||
function DungeonRuneEntity:getChapterPassRound(id)
|
||||
if not self.runeInfo[id] then
|
||||
return 0
|
||||
end
|
||||
return self.runeInfo[id] or 0
|
||||
end
|
||||
|
||||
function DungeonRuneEntity:updatePassRound(id, round)
|
||||
local cur = self.runeInfo[id]
|
||||
if not cur or cur > round then
|
||||
self.runeInfo[id] = round
|
||||
self:tagRoundNew()
|
||||
end
|
||||
end
|
||||
|
||||
function DungeonRuneEntity:tagRoundNew()
|
||||
self.tagNew = true
|
||||
end
|
||||
|
||||
function DungeonRuneEntity:getTagRoundNew()
|
||||
return self.tagNew
|
||||
end
|
||||
|
||||
function DungeonRuneEntity:getChapterRewards(id)
|
||||
return self:getConfig(id).first_reward
|
||||
end
|
||||
|
||||
function DungeonRuneEntity:getChapterSweepRewards(id)
|
||||
return self:getConfig(id).sweep_reward
|
||||
end
|
||||
|
||||
function DungeonRuneEntity:isBossChapter(id)
|
||||
local cfg = self:getConfig(id)
|
||||
return not cfg.monster[2] -- 只有一个怪物的就是boss关卡
|
||||
end
|
||||
|
||||
function DungeonRuneEntity:getChapterCondition(id)
|
||||
local cfg = self:getConfig(id)
|
||||
if not self.cacheChaperCondition then
|
||||
self.cacheChaperCondition = {}
|
||||
end
|
||||
|
||||
if not self.cacheChaperCondition[id] then
|
||||
self.cacheChaperCondition[id] = {}
|
||||
table.insert(self.cacheChaperCondition[id], {0, cfg.round, 0})
|
||||
if cfg.requirement then
|
||||
for _, condition in ipairs(cfg.requirement) do
|
||||
table.insert(self.cacheChaperCondition[id], GFunc.getTable(condition))
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
return self.cacheChaperCondition[id]
|
||||
end
|
||||
|
||||
function DungeonRuneEntity:getConditionIcon(taskInfo)
|
||||
local iconSprite
|
||||
local iconConst = GConst.DungeonRuneConst.TASK_ICON[taskInfo[1]]
|
||||
if type(iconConst) == "table" then
|
||||
iconSprite = iconConst[taskInfo[2]]
|
||||
else
|
||||
iconSprite = iconConst
|
||||
end
|
||||
|
||||
return GConst.ATLAS_PATH.UI_DUNGEON_RUNE, iconSprite
|
||||
end
|
||||
|
||||
function DungeonRuneEntity:getConditionDesc(taskInfo, taskNum)
|
||||
local taskType = taskInfo[1]
|
||||
local taskParams1 = taskInfo[2]
|
||||
local taskParams2 = taskInfo[3]
|
||||
if taskType == TASK_TYPE.PASS_ROUND then
|
||||
if taskNum and taskNum > 0 then
|
||||
taskParams1 = taskNum
|
||||
end
|
||||
return I18N:getGlobalText(I18N.GlobalConst.DUNGEON_RUNE_QUEST_1, taskParams1)
|
||||
elseif taskType == TASK_TYPE.ELIMINATION_ELEMENT then
|
||||
if taskNum and taskNum > 0 then
|
||||
local num = taskParams2 - taskNum
|
||||
if num > 0 then
|
||||
taskParams2 = num
|
||||
end
|
||||
end
|
||||
local desc = ModuleManager.HeroManager:getMatchTypeName(taskParams1, true)
|
||||
return I18N:getGlobalText(I18N.GlobalConst.DUNGEON_RUNE_QUEST_2, taskParams2, desc)
|
||||
elseif taskType == TASK_TYPE.BREAK_GRID_TYPE then
|
||||
if taskNum and taskNum > 0 then
|
||||
local num = taskParams2 - taskNum
|
||||
if num > 0 then
|
||||
taskParams2 = num
|
||||
end
|
||||
end
|
||||
return I18N:getGlobalText(I18N.GlobalConst.DUNGEON_RUNE_QUEST_3, taskParams2)
|
||||
elseif taskType == TASK_TYPE.KILL_MONSTER then
|
||||
if taskNum and taskNum > 0 then
|
||||
local num = taskParams2 - taskNum
|
||||
if num > 0 then
|
||||
taskParams2 = num
|
||||
end
|
||||
end
|
||||
return I18N:getGlobalText(I18N.GlobalConst.DUNGEON_RUNE_QUEST_4, taskParams2)
|
||||
end
|
||||
end
|
||||
|
||||
function DungeonRuneEntity:getChapterMonsterSpine(id)
|
||||
local cfg = self:getConfig(id)
|
||||
local monsterId = cfg.monster[1]
|
||||
local info = ConfigManager:getConfig("monster")[monsterId]
|
||||
return info.model_id, info.model_ui
|
||||
end
|
||||
|
||||
function DungeonRuneEntity:getChapterMonsterI18N(id)
|
||||
local cfg = self:getConfig(id)
|
||||
local monsterId = cfg.monster[1]
|
||||
local info = ConfigManager:getConfig("monster")[monsterId]
|
||||
local monsterBase = info.monster_base
|
||||
return I18N:getConfig("monster_base")[monsterBase]
|
||||
end
|
||||
|
||||
function DungeonRuneEntity:getCurFightChapterId()
|
||||
return self.curFightChapterId or 1
|
||||
end
|
||||
|
||||
function DungeonRuneEntity:setCurFightChapterId(chapterId)
|
||||
self.curFightChapterId = chapterId
|
||||
end
|
||||
|
||||
function DungeonRuneEntity:getChapterFightCount(id)
|
||||
return self.fightCountMap[id] or 0
|
||||
end
|
||||
|
||||
function DungeonRuneEntity:getSliverWingBuyCount()
|
||||
return self.buySilverCount or 0
|
||||
end
|
||||
|
||||
function DungeonRuneEntity:addSliverWingBuyCount(count)
|
||||
self.buySilverCount = self.buySilverCount + count
|
||||
end
|
||||
|
||||
function DungeonRuneEntity:getRemainSliverWingCount()
|
||||
if not self.todayLimitSliverCount then
|
||||
self.todayLimitSliverCount = GFunc.getConstIntValue("dungeon_rune_buylimit")
|
||||
end
|
||||
local count = self.todayLimitSliverCount - self:getSliverWingBuyCount()
|
||||
if count <= 0 then
|
||||
count = 0
|
||||
end
|
||||
return count
|
||||
end
|
||||
|
||||
function DungeonRuneEntity:getBuySliverCost()
|
||||
if not self.todayBuySliverCost then
|
||||
self.todayBuySliverCost = GFunc.getConstReward("dungeon_rune_cost")
|
||||
end
|
||||
|
||||
return self.todayBuySliverCost
|
||||
end
|
||||
|
||||
return DungeonRuneEntity
|
||||
@ -1,10 +0,0 @@
|
||||
fileFormatVersion: 2
|
||||
guid: b4d7cf896fcc1cd4dbe9ac46426cc9f8
|
||||
ScriptedImporter:
|
||||
internalIDToNameTable: []
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
script: {fileID: 11500000, guid: 3b8b241bab4a4ac9a22fcce9c64f1242, type: 3}
|
||||
@ -1,97 +0,0 @@
|
||||
local DungeonBaseEntity = require "app/userdata/dungeon/dungeon_base_entity"
|
||||
local DungeonShardsEntity = class("DungeonShardsEntity", DungeonBaseEntity)
|
||||
|
||||
-- 碎片副本数据
|
||||
|
||||
function DungeonShardsEntity:init(data)
|
||||
if self.maxPassedId then
|
||||
ModuleManager.TaskManager:addTaskProgress(GConst.TaskConst.TASK_TYPE.X_DUNGEON_SHARDS, data.max_chapter_shards_id - self.maxPassedId)
|
||||
end
|
||||
self.totalChallengeCount = data.total_challenge_count
|
||||
self.todayChallengeCount = data.today_challenge_count
|
||||
self.maxPassedId = data.max_chapter_shards_id
|
||||
end
|
||||
|
||||
function DungeonShardsEntity:getTotalChallengeCount()
|
||||
return self.totalChallengeCount
|
||||
end
|
||||
|
||||
function DungeonShardsEntity:getTodayChallengeCount()
|
||||
return self.todayChallengeCount
|
||||
end
|
||||
|
||||
function DungeonShardsEntity:getPassedMaxId()
|
||||
return self.maxPassedId
|
||||
end
|
||||
|
||||
function DungeonShardsEntity:getModuleKey()
|
||||
return ModuleManager.MODULE_KEY.DUNGEON_SHARDS
|
||||
end
|
||||
|
||||
function DungeonShardsEntity:getOpenWeekCycle()
|
||||
if self.openWeek == nil then
|
||||
self.openWeek = {1,3,5,7}
|
||||
end
|
||||
return self.openWeek
|
||||
end
|
||||
|
||||
function DungeonShardsEntity:getConfigName()
|
||||
return "chapter_dungeon_shards"
|
||||
end
|
||||
|
||||
function DungeonShardsEntity:getTitleString()
|
||||
return I18N:getGlobalText(I18N.GlobalConst.DUNGEON_SHARDS_TITLE)
|
||||
end
|
||||
|
||||
function DungeonShardsEntity:getRuleString()
|
||||
return I18N:getGlobalText(I18N.GlobalConst.DUNGEON_SHARDS_HELP)
|
||||
end
|
||||
|
||||
function DungeonShardsEntity:getOpenWeekString()
|
||||
return I18N:getGlobalText(I18N.GlobalConst.DUNGEON_SHARDS_OPEN)
|
||||
end
|
||||
|
||||
function DungeonShardsEntity:getBossBuff(id)
|
||||
return self:getConfig()[id].effect[1]
|
||||
end
|
||||
|
||||
function DungeonShardsEntity:getIcon()
|
||||
if self.dungeonIcon == nil then
|
||||
self.dungeonIcon = {GConst.ATLAS_PATH.DUNGEON,"dungeon_dec_2"}
|
||||
end
|
||||
return self.dungeonIcon
|
||||
end
|
||||
|
||||
function DungeonShardsEntity:getBanner()
|
||||
return "assets/arts/textures/background/dungeon/dungeon_bg_2.png"
|
||||
end
|
||||
|
||||
function DungeonShardsEntity:getOpenTextColor()
|
||||
return "#E4F5FE"
|
||||
end
|
||||
|
||||
function DungeonShardsEntity:getChallengeHpCost()
|
||||
return GFunc.getConstReward("dungeon_shards_cost")
|
||||
end
|
||||
|
||||
function DungeonShardsEntity:getTodayMaxCount()
|
||||
return GFunc.getConstIntValue("dungeon_shards_limit")
|
||||
end
|
||||
|
||||
function DungeonShardsEntity:getBoardShowRewardId()
|
||||
return 20
|
||||
end
|
||||
|
||||
function DungeonShardsEntity:getFirstRewardNum(id)
|
||||
local cfg = ConfigManager:getConfig("chapter_dungeon_shards")[id]
|
||||
return cfg.times_a + cfg.times_b
|
||||
end
|
||||
|
||||
function DungeonShardsEntity:getPassRewardNum(id)
|
||||
local cfg = ConfigManager:getConfig("chapter_dungeon_shards")[id]
|
||||
local pass = cfg.times_d
|
||||
local wave = cfg.times_c * #cfg.monster
|
||||
return pass + wave
|
||||
end
|
||||
|
||||
return DungeonShardsEntity
|
||||
@ -1,10 +0,0 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 915b7ed44e1bfb24fa12a24eeb2813d3
|
||||
ScriptedImporter:
|
||||
internalIDToNameTable: []
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
script: {fileID: 11500000, guid: 3b8b241bab4a4ac9a22fcce9c64f1242, type: 3}
|
||||
@ -1,217 +0,0 @@
|
||||
local DungeonBaseEntity = require "app/userdata/dungeon/dungeon_base_entity"
|
||||
local DungeonWeaponEntity = class("DungeonWeaponEntity", DungeonBaseEntity)
|
||||
|
||||
local GET_PASS_INFO_INTERVAL = 600
|
||||
-- 支线副本数据
|
||||
|
||||
function DungeonWeaponEntity:clear()
|
||||
DataManager:unregisterCrossDayFunc("DungeonWeaponEntity")
|
||||
end
|
||||
|
||||
function DungeonWeaponEntity:init(data)
|
||||
self.maxPassedId = data.max_challenge_id or 0
|
||||
self.farmCount = data.farm_count or 0
|
||||
self.heroes = data.heroes or {}
|
||||
self.totalChallengeCount = data.total_challenge_count or {}
|
||||
self.data.isDirty = not self.data.isDirty
|
||||
|
||||
self:updateGift(data.gift_info, true)
|
||||
DataManager.FormationData:initDungeonWeapon(self.heroes)
|
||||
|
||||
DataManager:registerCrossDayFunc("DungeonWeaponEntity", function()
|
||||
self.farmCount = 0
|
||||
self:setDirty()
|
||||
end)
|
||||
end
|
||||
|
||||
function DungeonWeaponEntity:refreshInfoOnSettlement(chapterId, result)
|
||||
if result.max_id > self.maxPassedId then
|
||||
ModuleManager.TaskManager:addTaskProgress(GConst.TaskConst.TASK_TYPE.X_DUNGEON_WEAPON, result.max_id - self.maxPassedId)
|
||||
end
|
||||
self.totalChallengeCount[chapterId] = (self.totalChallengeCount[chapterId] or 0) + 1
|
||||
self.maxPassedId = result.max_id
|
||||
self:updateGift(result.gift_info)
|
||||
self:setDirty()
|
||||
end
|
||||
|
||||
function DungeonWeaponEntity:refreshInfoOnFarm(result)
|
||||
self.farmCount = self.farmCount + 1
|
||||
self:updateGift(result.gift_info)
|
||||
self:setDirty()
|
||||
end
|
||||
|
||||
-- 更新礼包状态
|
||||
function DungeonWeaponEntity:updateGift(giftInfo, isInit)
|
||||
DataManager.ShopData:initGift(PayManager.PURCHARSE_ACT_TYPE.WEAPON_GIFT, giftInfo, isInit)
|
||||
end
|
||||
|
||||
function DungeonWeaponEntity:setDirty()
|
||||
self.data.isDirty = not self.data.isDirty
|
||||
end
|
||||
|
||||
function DungeonWeaponEntity:getTotalChallengeCount()
|
||||
local count = 0
|
||||
for _, c in pairs(self.totalChallengeCount) do
|
||||
count = count + 1
|
||||
end
|
||||
return count
|
||||
end
|
||||
|
||||
function DungeonWeaponEntity:getTodayChallengeCount()
|
||||
return 0
|
||||
end
|
||||
|
||||
function DungeonWeaponEntity:getPassedMaxId()
|
||||
return self.maxPassedId
|
||||
end
|
||||
|
||||
function DungeonWeaponEntity:getIsAllTimeOpen()
|
||||
return true
|
||||
end
|
||||
|
||||
function DungeonWeaponEntity:getModuleKey()
|
||||
return ModuleManager.MODULE_KEY.DUNGEON_WEAPON
|
||||
end
|
||||
|
||||
function DungeonWeaponEntity:getConfigName()
|
||||
return "chapter_dungeon_equip"
|
||||
end
|
||||
|
||||
function DungeonWeaponEntity:getTitleString()
|
||||
return I18N:getGlobalText(I18N.GlobalConst.DUNGEON_WEAPON_DESC_1)
|
||||
end
|
||||
|
||||
function DungeonWeaponEntity:getRuleString()
|
||||
return I18N:getGlobalText(I18N.GlobalConst.DUNGEON_WEAPON_DESC_2)
|
||||
end
|
||||
|
||||
function DungeonWeaponEntity:getOpenWeekString()
|
||||
return I18N:getGlobalText(I18N.GlobalConst.DUNGEON_WEAPON_DESC_3)
|
||||
end
|
||||
|
||||
function DungeonWeaponEntity:getBanner()
|
||||
return "assets/arts/textures/background/dungeon/dungeon_bg_3.png"
|
||||
end
|
||||
|
||||
function DungeonWeaponEntity:getOpenTextColor()
|
||||
return "#FFEDC5"
|
||||
end
|
||||
|
||||
function DungeonWeaponEntity:getChallengeHpCost()
|
||||
return GFunc.getConstReward("dungeon_armor_limit")
|
||||
end
|
||||
|
||||
function DungeonWeaponEntity:isNoTotalLimit()
|
||||
return true
|
||||
end
|
||||
|
||||
function DungeonWeaponEntity:onClickFight()
|
||||
ModuleManager.DungeonWeaponManager:showMainUI()
|
||||
end
|
||||
|
||||
function DungeonWeaponEntity:getDialyFarmLimit()
|
||||
return GFunc.getConstIntValue("dungeon_equip_limit")
|
||||
end
|
||||
|
||||
function DungeonWeaponEntity:getFarmCount()
|
||||
return self.farmCount
|
||||
end
|
||||
|
||||
function DungeonWeaponEntity:getRemianFarmCount()
|
||||
local count = self:getDialyFarmLimit() - self:getFarmCount()
|
||||
if count < 0 then
|
||||
count = 0
|
||||
end
|
||||
return count
|
||||
end
|
||||
|
||||
function DungeonWeaponEntity:getTodayRemainLimitCount()
|
||||
return self:getRemianFarmCount()
|
||||
end
|
||||
|
||||
function DungeonWeaponEntity:getLevelEnough(chapterId)
|
||||
local config = ConfigManager:getConfig(self:getConfigName())[chapterId]
|
||||
if not config then
|
||||
return false
|
||||
end
|
||||
if config.level > DataManager.PlayerData:getLv() then
|
||||
return false
|
||||
end
|
||||
|
||||
return true
|
||||
end
|
||||
|
||||
function DungeonWeaponEntity:canFightChapter(chapterId)
|
||||
if not chapterId then
|
||||
return false
|
||||
end
|
||||
|
||||
if chapterId <= self.maxPassedId + 1 then
|
||||
if self:getLevelEnough(chapterId) then
|
||||
return true
|
||||
end
|
||||
end
|
||||
|
||||
return false
|
||||
end
|
||||
|
||||
function DungeonWeaponEntity:canFarmChapter(chapterId)
|
||||
if not chapterId then
|
||||
return false
|
||||
end
|
||||
|
||||
return self.maxPassedId >= chapterId
|
||||
end
|
||||
|
||||
function DungeonWeaponEntity:doCachePassInfo(chapterId, info)
|
||||
if not self.cachePassInfo then
|
||||
self.cachePassInfo = {}
|
||||
end
|
||||
if not info then
|
||||
return
|
||||
end
|
||||
if not self.cachePassInfo[chapterId] then
|
||||
self.cachePassInfo[chapterId] = {
|
||||
info = info,
|
||||
getTime = Time:getServerTime()
|
||||
}
|
||||
else
|
||||
self.cachePassInfo[chapterId].info = info
|
||||
self.cachePassInfo[chapterId].getTime = Time:getServerTime()
|
||||
end
|
||||
self:setDirty()
|
||||
end
|
||||
|
||||
function DungeonWeaponEntity:getCachePassInfo(chapterId)
|
||||
if not self.cachePassInfo then
|
||||
self.cachePassInfo = {}
|
||||
end
|
||||
|
||||
if not self.cachePassInfo[chapterId] then
|
||||
return
|
||||
end
|
||||
|
||||
if self.cachePassInfo[chapterId].getTime + GET_PASS_INFO_INTERVAL < Time:getServerTime() then -- 过期
|
||||
return
|
||||
end
|
||||
|
||||
return self.cachePassInfo[chapterId].info
|
||||
end
|
||||
|
||||
function DungeonWeaponEntity:setCurFightChapterId(chapterId)
|
||||
self.curFightchapterId = chapterId or 1
|
||||
end
|
||||
|
||||
function DungeonWeaponEntity:getCurFightChapterId()
|
||||
return self.curFightchapterId or 1
|
||||
end
|
||||
|
||||
function DungeonWeaponEntity:getChapterFightCount(chapterId)
|
||||
return self.totalChallengeCount[chapterId] or 0
|
||||
end
|
||||
|
||||
function DungeonWeaponEntity:getChallengeHpCost()
|
||||
return GFunc.getConstReward("dungeon_equip_cost")
|
||||
end
|
||||
|
||||
return DungeonWeaponEntity
|
||||
@ -1,10 +0,0 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 9514a9828a718a24a9ca66021a56545d
|
||||
ScriptedImporter:
|
||||
internalIDToNameTable: []
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
script: {fileID: 11500000, guid: 3b8b241bab4a4ac9a22fcce9c64f1242, type: 3}
|
||||
Loading…
x
Reference in New Issue
Block a user