diff --git a/lua/app/common/module_manager.lua b/lua/app/common/module_manager.lua
index 60c04739..1743db0b 100644
--- a/lua/app/common/module_manager.lua
+++ b/lua/app/common/module_manager.lua
@@ -89,6 +89,7 @@ setmetatable(ModuleManager, MODULE_METATABLE)
function ModuleManager:init()
ModuleManager.TaskManager:init()
+ ModuleManager.DailyChallengeManager:init()
end
-- 功能是否开启
diff --git a/lua/app/config/recharge.lua b/lua/app/config/recharge.lua
index 964ec9dc..be154893 100644
--- a/lua/app/config/recharge.lua
+++ b/lua/app/config/recharge.lua
@@ -1,6 +1,6 @@
local recharge = {
[1]={
- ["payId"]="com.idle.ko.io.0.99dollar",
+ ["payId"]="com.knight.connect.rpg.0.99dollar",
["price"]=0.99,
["price_cn"]=6,
["same_price"]=1,
@@ -8,7 +8,7 @@ local recharge = {
["score"]=1
},
[2]={
- ["payId"]="com.idle.ko.io.1.99dollar",
+ ["payId"]="com.knight.connect.rpg.1.99dollar",
["price"]=1.99,
["price_cn"]=12,
["same_price"]=2,
@@ -16,7 +16,7 @@ local recharge = {
["score"]=2
},
[3]={
- ["payId"]="com.idle.ko.io.2.99dollar",
+ ["payId"]="com.knight.connect.rpg.2.99dollar",
["price"]=2.99,
["price_cn"]=18,
["same_price"]=3,
@@ -24,7 +24,7 @@ local recharge = {
["score"]=3
},
[4]={
- ["payId"]="com.idle.ko.io.3.99dollar",
+ ["payId"]="com.knight.connect.rpg.3.99dollar",
["price"]=3.99,
["price_cn"]=24,
["same_price"]=4,
@@ -32,7 +32,7 @@ local recharge = {
["score"]=4
},
[5]={
- ["payId"]="com.idle.ko.io.4.99dollar",
+ ["payId"]="com.knight.connect.rpg.4.99dollar",
["price"]=4.99,
["price_cn"]=30,
["same_price"]=5,
@@ -40,7 +40,7 @@ local recharge = {
["score"]=5
},
[6]={
- ["payId"]="com.idle.ko.io.5.99dollar",
+ ["payId"]="com.knight.connect.rpg.5.99dollar",
["price"]=5.99,
["price_cn"]=38,
["same_price"]=6,
@@ -48,7 +48,7 @@ local recharge = {
["score"]=6
},
[7]={
- ["payId"]="com.idle.ko.io.6.99dollar",
+ ["payId"]="com.knight.connect.rpg.6.99dollar",
["price"]=6.99,
["price_cn"]=45,
["same_price"]=7,
@@ -56,7 +56,7 @@ local recharge = {
["score"]=7
},
[8]={
- ["payId"]="com.idle.ko.io.7.99dollar",
+ ["payId"]="com.knight.connect.rpg.7.99dollar",
["price"]=7.99,
["price_cn"]=52,
["same_price"]=8,
@@ -64,7 +64,7 @@ local recharge = {
["score"]=8
},
[9]={
- ["payId"]="com.idle.ko.io.8.99dollar",
+ ["payId"]="com.knight.connect.rpg.8.99dollar",
["price"]=8.99,
["price_cn"]=60,
["same_price"]=9,
@@ -72,7 +72,7 @@ local recharge = {
["score"]=9
},
[10]={
- ["payId"]="com.idle.ko.io.9.99dollar",
+ ["payId"]="com.knight.connect.rpg.9.99dollar",
["price"]=9.99,
["price_cn"]=68,
["same_price"]=10,
@@ -80,7 +80,7 @@ local recharge = {
["score"]=10
},
[11]={
- ["payId"]="com.idle.ko.io.11.99dollar",
+ ["payId"]="com.knight.connect.rpg.11.99dollar",
["price"]=11.99,
["price_cn"]=78,
["same_price"]=12,
@@ -88,7 +88,7 @@ local recharge = {
["score"]=12
},
[12]={
- ["payId"]="com.idle.ko.io.14.99dollar",
+ ["payId"]="com.knight.connect.rpg.14.99dollar",
["price"]=14.99,
["price_cn"]=98,
["same_price"]=15,
@@ -96,7 +96,7 @@ local recharge = {
["score"]=15
},
[13]={
- ["payId"]="com.idle.ko.io.19.99dollar",
+ ["payId"]="com.knight.connect.rpg.19.99dollar",
["price"]=19.99,
["price_cn"]=128,
["same_price"]=20,
@@ -104,7 +104,7 @@ local recharge = {
["score"]=20
},
[14]={
- ["payId"]="com.idle.ko.io.24.99dollar",
+ ["payId"]="com.knight.connect.rpg.24.99dollar",
["price"]=24.99,
["price_cn"]=168,
["same_price"]=25,
@@ -112,7 +112,7 @@ local recharge = {
["score"]=25
},
[15]={
- ["payId"]="com.idle.ko.io.29.99dollar",
+ ["payId"]="com.knight.connect.rpg.29.99dollar",
["price"]=29.99,
["price_cn"]=198,
["same_price"]=30,
@@ -120,7 +120,7 @@ local recharge = {
["score"]=30
},
[16]={
- ["payId"]="com.idle.ko.io.49.99dollar",
+ ["payId"]="com.knight.connect.rpg.49.99dollar",
["price"]=49.99,
["price_cn"]=328,
["same_price"]=50,
@@ -128,7 +128,7 @@ local recharge = {
["score"]=50
},
[17]={
- ["payId"]="com.idle.ko.io.69.99dollar",
+ ["payId"]="com.knight.connect.rpg.69.99dollar",
["price"]=69.99,
["price_cn"]=448,
["same_price"]=70,
@@ -136,7 +136,7 @@ local recharge = {
["score"]=70
},
[18]={
- ["payId"]="com.idle.ko.io.99.99dollar",
+ ["payId"]="com.knight.connect.rpg.99.99dollar",
["price"]=99.99,
["price_cn"]=648,
["same_price"]=100,
@@ -144,7 +144,7 @@ local recharge = {
["score"]=100
},
[19]={
- ["payId"]="com.idle.ko.io.199.99dollar",
+ ["payId"]="com.knight.connect.rpg.199.99dollar",
["price"]=199.99,
["price_cn"]=1298,
["same_price"]=200,
diff --git a/lua/app/config/skill.lua b/lua/app/config/skill.lua
index ee170690..8970563b 100644
--- a/lua/app/config/skill.lua
+++ b/lua/app/config/skill.lua
@@ -1231,11 +1231,11 @@ local skill = {
["skill_type"]=4,
["boardrange"]={
{
- ["type"]=3,
+ ["type"]=1,
["range"]=2
},
{
- ["type"]=4,
+ ["type"]=2,
["range"]=2
}
},
@@ -2623,7 +2623,7 @@ local skill = {
},
{
["type"]="poison",
- ["num"]=5000,
+ ["num"]=2500,
["ratio"]=5000,
["round"]=2
}
@@ -2710,7 +2710,7 @@ local skill = {
},
{
["type"]="poison",
- ["num"]=5000,
+ ["num"]=2500,
["ratio"]=10000,
["round"]=2
}
@@ -2886,7 +2886,7 @@ local skill = {
["effect"]={
{
["type"]="vulnerable",
- ["num"]=3500,
+ ["num"]=2500,
["ratio"]=10000,
["round"]=2
}
@@ -3868,7 +3868,7 @@ local skill = {
["effect"]={
{
["type"]="poison",
- ["num"]=5000,
+ ["num"]=2500,
["ratio"]=1000,
["round"]=2
}
@@ -4011,7 +4011,7 @@ local skill = {
["effect"]={
{
["type"]="poison",
- ["num"]=5000,
+ ["num"]=2500,
["ratio"]=10000,
["round"]=2
}
@@ -4039,7 +4039,7 @@ local skill = {
["effect"]={
{
["type"]="poison",
- ["num"]=10000,
+ ["num"]=5000,
["ratio"]=10000,
["round"]=2
}
@@ -4850,7 +4850,7 @@ local skill = {
},
{
["type"]="poison",
- ["num"]=5000,
+ ["num"]=2500,
["ratio"]=10000,
["round"]=2
}
@@ -5598,9 +5598,9 @@ local skill = {
},
{
["type"]="poison",
- ["num"]=5000,
+ ["num"]=2500,
["ratio"]=10000,
- ["round"]=2
+ ["round"]=3
}
},
["obj"]=2,
@@ -6406,7 +6406,7 @@ local skill = {
},
{
["type"]="poison",
- ["num"]=5000,
+ ["num"]=2500,
["ratio"]=10000,
["round"]=2
}
diff --git a/lua/app/config/skill_rogue.lua b/lua/app/config/skill_rogue.lua
index b66a67fc..d096b950 100644
--- a/lua/app/config/skill_rogue.lua
+++ b/lua/app/config/skill_rogue.lua
@@ -1919,19 +1919,11 @@ local skill_rogue = {
["boardrange"]={
{
["type"]=1,
- ["range"]=1
+ ["range"]=2
},
{
["type"]=2,
- ["range"]=1
- },
- {
- ["type"]=3,
- ["range"]=1
- },
- {
- ["type"]=4,
- ["range"]=1
+ ["range"]=2
}
},
["icon"]="82"
diff --git a/lua/app/config/strings/cn/skill_rogue.lua b/lua/app/config/strings/cn/skill_rogue.lua
index 9e9d7a52..f2a8ebb1 100644
--- a/lua/app/config/strings/cn/skill_rogue.lua
+++ b/lua/app/config/strings/cn/skill_rogue.lua
@@ -357,7 +357,7 @@ local skill_rogue = {
["desc"]="急速治疗使用时本次普攻伤害提升15%。"
},
[3300103]={
- ["desc"]="急速治疗沿+方向可额外消除4格。"
+ ["desc"]="急速治疗纵向可额外消除4格。"
},
[3300104]={
["desc"]="急速治疗额外为团队提供技能伤害提升效果,2回合。"
diff --git a/lua/app/global/global_func.lua b/lua/app/global/global_func.lua
index 22675cbc..c6f42fd2 100644
--- a/lua/app/global/global_func.lua
+++ b/lua/app/global/global_func.lua
@@ -1677,6 +1677,15 @@ function GFunc.recycleTempMap()
end
end
+-- 获取table长度
+function GFunc.getTableLength(table)
+ local length = 0
+ for k, v in pairs(table) do
+ length = length + 1
+ end
+ return length
+end
+
--[[
设置tabLe只速 出现改写会抛出Lua error
用法locaL readOnlyCfg = GFunc.readOnlyTab(cfg) return readOnlyCfg
diff --git a/lua/app/module/battle/battle_const.lua b/lua/app/module/battle/battle_const.lua
index 9829f952..07bbffa5 100644
--- a/lua/app/module/battle/battle_const.lua
+++ b/lua/app/module/battle/battle_const.lua
@@ -763,7 +763,7 @@ BattleConst.BATTLE_TASK_FIELD = {
LINK_COUNT_OVER_6 = "clear_6_combo", -- 6连消个数
LINK_COUNT_OVER_8 = "clear_8_combo", -- 8连消个数
COMBO_OVER_10 = "clear_10_hit", -- 10连击以上次数
- BOARD_SKILL_RELEASE_COUNT = "skills_cast", -- 释放技能次数
+ BOARD_SKILL_RELEASE_COUNT = "skill_cast", -- 释放技能次数
PASS_WAVE = "pass_wave", -- 通关波数
}
diff --git a/lua/app/module/battle/controller/battle_controller_stage.lua b/lua/app/module/battle/controller/battle_controller_stage.lua
index 25aa6f72..292766d8 100644
--- a/lua/app/module/battle/controller/battle_controller_stage.lua
+++ b/lua/app/module/battle/controller/battle_controller_stage.lua
@@ -124,7 +124,7 @@ function BattleControllerStage:getInitBoard()
if config.mystery_box and config.mystery_box_reward then
for i, index in ipairs(config.mystery_box) do
- if not DataManager.ChapterData:getChapterMysteryBoxIsGot(self.chapterId, index) then
+ if not DataManager.ChapterData:getChapterMysteryBoxIsGot(self.chapterId, i) then
self.mysteryBoxIndexMap[index] = config.mystery_box_reward[i]
end
end
diff --git a/lua/app/module/battle/helper/battle_buff_special.lua b/lua/app/module/battle/helper/battle_buff_special.lua
index 29de6c1d..b547b4e0 100644
--- a/lua/app/module/battle/helper/battle_buff_special.lua
+++ b/lua/app/module/battle/helper/battle_buff_special.lua
@@ -29,12 +29,12 @@ end
local function _bleedOn(buffSender, buff, target, buffEffect)
target.unitEntity:addAttr(buff:getName(), buff:getEffectNum(), false)
- return target.unitEntity:addAttr(BattleConst.ATTR_NAME.BE_SUCKED, 1000, false) -- 写死10%
+ return target.unitEntity:addAttr(BattleConst.ATTR_NAME.BE_SUCKED, 500, false) -- 写死5%
end
local function _bleedOff(buffSender, target, buff, buffEffect)
target.unitEntity:addAttr(buff:getName(), -buff:getEffectNum(), false)
- target.unitEntity:addAttr(BattleConst.ATTR_NAME.BE_SUCKED, -1000, false) -- 写死10%
+ target.unitEntity:addAttr(BattleConst.ATTR_NAME.BE_SUCKED, -500, false) -- 写死5%
return 1
end
diff --git a/lua/app/module/battle/team/battle_team.lua b/lua/app/module/battle/team/battle_team.lua
index d599e5ce..89f1c453 100644
--- a/lua/app/module/battle/team/battle_team.lua
+++ b/lua/app/module/battle/team/battle_team.lua
@@ -404,11 +404,15 @@ function BattleTeam:doBuffWork()
break
end
buffEffect.round = buffEffect.round - 1
- BattleBuffHandle.doBuffWork(self.mainUnit, buffEffect)
+ local target = self.mainUnit
+ if buffEffect.target then
+ target = buffEffect.target
+ end
+ BattleBuffHandle.doBuffWork(target, buffEffect)
if buffEffect.round <= 0 then
self:updateBuffState(buffEffect.buff, -1)
table.remove(self.buffList, i)
- BattleBuffHandle.removeBuff(self.mainUnit, buffEffect)
+ BattleBuffHandle.removeBuff(target, buffEffect)
end
end
self.battleController:refreshBuff(self.side, self.buffList)
diff --git a/lua/app/module/chapter/chapter_manager.lua b/lua/app/module/chapter/chapter_manager.lua
index c2d109c6..c15afee3 100644
--- a/lua/app/module/chapter/chapter_manager.lua
+++ b/lua/app/module/chapter/chapter_manager.lua
@@ -50,10 +50,17 @@ function ChapterManager:startFightFinish(result)
end
function ChapterManager:endFight(id, combatReport, gotMysteryBoxIndexs, taskProgress)
+ local cfg = ConfigManager:getConfig("chapter")[id]
local mystery_box_idx = {}
- if gotMysteryBoxIndexs then
- for index, _ in pairs(gotMysteryBoxIndexs) do
- table.insert(mystery_box_idx, index)
+ if gotMysteryBoxIndexs and cfg.mystery_box then
+ local indexMap = {}
+ for index, wave in ipairs(cfg.mystery_box) do
+ indexMap[wave] = index
+ end
+ for boardIndex, _ in pairs(gotMysteryBoxIndexs) do
+ if indexMap[boardIndex] then
+ table.insert(mystery_box_idx, indexMap[boardIndex])
+ end
end
end
local parmas = {
diff --git a/lua/app/module/daily_challenge/daily_challenge_manager.lua b/lua/app/module/daily_challenge/daily_challenge_manager.lua
index 17f5101d..b57c7990 100644
--- a/lua/app/module/daily_challenge/daily_challenge_manager.lua
+++ b/lua/app/module/daily_challenge/daily_challenge_manager.lua
@@ -1,6 +1,14 @@
local DailyChallengeManager = class("DailyChallengeManager", BaseModule)
function DailyChallengeManager:init()
+ self:addEventListener(EventManager.CUSTOM_EVENT.CHANGE_MAIN_CITY_PAGE, function(idx)
+ DataManager.DailyChallengeData:setShowingMainComp(idx == GConst.MainCityConst.BOTTOM_PAGE.MAIN)
+ end)
+ self:addEventListener(EventManager.CUSTOM_EVENT.UI_CLOSE, function(index)
+ if index == UIManager.UI_PATH.MAINCITY_UI then
+ DataManager.DailyChallengeData:setShowingMainComp(false)
+ end
+ end)
end
function DailyChallengeManager:showBattleBuffUI()
@@ -20,9 +28,14 @@ function DailyChallengeManager:checkDayChange()
if not DataManager.DailyChallengeData:getIfCanReset() then
return
end
+ if not DataManager.DailyChallengeData:isShowingMainComp() then
+ return
+ end
-- 跨天了,请求新数据
- self:onResetState()
+ self:performWithDelayGlobal(function()
+ self:onResetState()
+ end, math.random())
end
-- 开始挑战
@@ -91,10 +104,15 @@ function DailyChallengeManager:endChallengeFinish(result)
end
function DailyChallengeManager:onResetState()
+ if DataManager.DailyChallengeData:getIsInReset() then
+ return
+ end
+ DataManager.DailyChallengeData:setInReset(true)
self:sendMessage(ProtoMsgType.FromMsgEnum.ChapterDailyChallengeResetReq, {}, {}, self.rspResetState, BIReport.ITEM_GET_TYPE.DAILY_CHALLENGE_RESET)
end
function DailyChallengeManager:rspResetState(result)
+ DataManager.DailyChallengeData:setInReset(false)
DataManager.DailyChallengeData:init(result.daily_challenge)
end
diff --git a/lua/app/module/maincity/maincity_const.lua b/lua/app/module/maincity/maincity_const.lua
index 7c7afce9..4e6fc491 100644
--- a/lua/app/module/maincity/maincity_const.lua
+++ b/lua/app/module/maincity/maincity_const.lua
@@ -12,7 +12,8 @@ MainCityConst.BOTTOM_ICON = {
MainCityConst.BOTTOM_CLOSE_ICON = {
}
-MainCityConst.BOTTOM_MODULE_KEY = {
+-- main界面模块,序号是模块从左往右的切换顺序,需要是连续的
+MainCityConst.MAIN_MODULE = {
DAILY_CHALLENGE = 1,
CHAPTER = 2,
}
diff --git a/lua/app/ui/battle/battle_result_ui.lua b/lua/app/ui/battle/battle_result_ui.lua
index fa19804e..1c0260b6 100644
--- a/lua/app/ui/battle/battle_result_ui.lua
+++ b/lua/app/ui/battle/battle_result_ui.lua
@@ -125,7 +125,7 @@ function BattleResultUI:refreshRewards()
end)
self.scrollRectComp:addRefreshCallback(function(index, cell)
cell:refresh(self.rewards[index])
- cell:showLeftUpIcon(index <= self.mysteryBoxIdx, GConst.ATLAS_PATH.COMMON, "common_chest_1")
+ cell:showRightUpIcon(index <= self.mysteryBoxIdx, GConst.ATLAS_PATH.COMMON, "common_chest_1")
end)
self.scrollRectComp:setFadeArgs(0.05, 0.3)
self.scrollRectComp:clearCells()
diff --git a/lua/app/ui/common/cell/reward_cell.lua b/lua/app/ui/common/cell/reward_cell.lua
index 83826aaf..f1aa2782 100644
--- a/lua/app/ui/common/cell/reward_cell.lua
+++ b/lua/app/ui/common/cell/reward_cell.lua
@@ -8,7 +8,7 @@ function RewardCell:init()
self.check = uiMap["reward_cell.check"]
self.numTx = uiMap["reward_cell.item_bg.num"]
self.fragment = uiMap["reward_cell.item_bg.fragment"]
- self.leftUpIcon = uiMap["reward_cell.item_bg.left_up_icon"]
+ self.rightUpIcon = uiMap["reward_cell.item_bg.right_up_icon"]
self.sImg = uiMap["reward_cell.item_bg.s"]
self.matchImg = uiMap["reward_cell.item_bg.match_img"]
self.frameAni = uiMap["reward_cell.frame_ani"]
@@ -149,12 +149,12 @@ function RewardCell:hideFrameAnimation()
self.frameAni:setVisible(false)
end
-function RewardCell:showLeftUpIcon(show, atlas, iconName)
- self.leftUpIcon:setVisible(show)
+function RewardCell:showRightUpIcon(show, atlas, iconName)
+ self.rightUpIcon:setVisible(show)
if not show then
return
end
- self.leftUpIcon:setSprite(atlas, iconName)
+ self.rightUpIcon:setSprite(atlas, iconName)
end
return RewardCell
\ No newline at end of file
diff --git a/lua/app/ui/main_city/component/chapter_comp.lua b/lua/app/ui/main_city/component/chapter_comp.lua
index dbeb7425..bce4aee9 100644
--- a/lua/app/ui/main_city/component/chapter_comp.lua
+++ b/lua/app/ui/main_city/component/chapter_comp.lua
@@ -1,4 +1,5 @@
-local ChapterComp = class("ChapterComp", LuaComponent)
+local MainCompBaseCell = require "app/ui/main_city/component/main_comp_base_cell"
+local ChapterComp = class("ChapterComp", MainCompBaseCell)
local CHAPTER_PATH = "assets/arts/textures/background/chapter/%s.png"
local BOX_ICON = {
@@ -6,6 +7,26 @@ local BOX_ICON = {
"common_chest_4"
}
+function ChapterComp:getIsOpen()
+ return true
+end
+
+function ChapterComp:getEntranceName()
+ return "主线章节"
+end
+
+function ChapterComp:getEntranceIcon()
+ return GConst.ATLAS_PATH.COMMON,"common_dec_1"
+end
+
+function ChapterComp:getHpCost()
+ return DataManager.ChapterData:getFightCost()
+end
+
+function ChapterComp:onClickFight()
+ ModuleManager.ChapterManager:startFight()
+end
+
function ChapterComp:init()
self.uiMap = self:getBaseObject():genAllChildren()
self:initChapter()
@@ -150,7 +171,7 @@ function ChapterComp:refreshChapter(force)
end
end
- self.root:refreshFightBtn()
+ self:refreshFightBtn()
end
end
diff --git a/lua/app/ui/main_city/component/daily_challenge_comp.lua b/lua/app/ui/main_city/component/daily_challenge_comp.lua
index 702658d3..60b59bfd 100644
--- a/lua/app/ui/main_city/component/daily_challenge_comp.lua
+++ b/lua/app/ui/main_city/component/daily_challenge_comp.lua
@@ -1,4 +1,33 @@
-local DailyChallengeComp = class("DailyChallengeComp", LuaComponent)
+local MainCompBaseCell = require "app/ui/main_city/component/main_comp_base_cell"
+local DailyChallengeComp = class("DailyChallengeComp", MainCompBaseCell)
+
+function DailyChallengeComp:getIsOpen()
+ return DataManager.DailyChallengeData:isOpen()
+end
+
+function DailyChallengeComp:getEntranceName()
+ return "每日挑战"
+end
+
+function DailyChallengeComp:getEntranceIcon()
+ return GConst.ATLAS_PATH.MAIN,"main_dec_1"
+end
+
+function DailyChallengeComp:getShowEntranceRedPoint()
+ return DataManager.DailyChallengeData:isMeetChallenge()
+end
+
+function DailyChallengeComp:getHpCost()
+ return DataManager.DailyChallengeData:getChallengeHpCost()
+end
+
+function DailyChallengeComp:getTodayRemainCount()
+ return DataManager.DailyChallengeData:getTodayRemainLimitCount()
+end
+
+function DailyChallengeComp:onClickFight()
+ ModuleManager.DailyChallengeManager:startChallenge()
+end
function DailyChallengeComp:ctor()
ModuleManager.DailyChallengeManager:checkDayChange()
diff --git a/lua/app/ui/main_city/component/main_comp.lua b/lua/app/ui/main_city/component/main_comp.lua
index b10980e5..59d1bed1 100644
--- a/lua/app/ui/main_city/component/main_comp.lua
+++ b/lua/app/ui/main_city/component/main_comp.lua
@@ -2,81 +2,44 @@ local MainComp = class("MainComp", LuaComponent)
local CHAPTER_COMP = "app/ui/main_city/component/chapter_comp"
local DAILY_CHALLENGE_COMP = "app/ui/main_city/component/daily_challenge_comp"
-local MODULE_DATA = {
- [1] = {
- ["type"] = GConst.MainCityConst.BOTTOM_MODULE_KEY.DAILY_CHALLENGE,
- ["title"] = "每日挑战",-- 标题
- ["atlas"] = GConst.ATLAS_PATH.MAIN,-- 图集路径
- ["icon"] = "main_dec_1",-- 图片名
- ["numFunc"] = function()-- 挑战按钮显示数值
- return DataManager.DailyChallengeData:getChallengeHpCost()
- end,
- ["clickFunc"] = function()-- 点击回调
- ModuleManager.DailyChallengeManager:startChallenge()
- end,
- ["redDot"] = function()-- 显示红点
- return DataManager.DailyChallengeData:isMeetChallenge()
- end,
- ["fightNum"] = function()-- 显示今日剩余次数
- return DataManager.DailyChallengeData:getTodayRemainLimitCount()
- end,
- ["isClose"] = function()-- 活动开关状态
- return not DataManager.DailyChallengeData:isOpen()
- end,
- },
- [2] = {
- ["type"] = GConst.MainCityConst.BOTTOM_MODULE_KEY.CHAPTER,
- ["title"] = "主线章节",
- ["atlas"] = GConst.ATLAS_PATH.COMMON,
- ["icon"] = "common_dec_1",
- ["numFunc"] = function()
- return DataManager.ChapterData:getFightCost()
- end,
- ["clickFunc"] = function()
- ModuleManager.ChapterManager:startFight()
- end
- }
-}
-
function MainComp:init()
self.uiMap = self:getBaseObject():genAllChildren()
- self.curModuleType = GConst.MainCityConst.BOTTOM_MODULE_KEY.CHAPTER
-
+ self:refreshModule(GConst.MainCityConst.MAIN_MODULE.CHAPTER)
self:initStageFormation()
- self:refreshBtns()
- self:refreshModuleComp()
+
end
-function MainComp:refreshModuleComp()
- if not self.chapterComp then
+function MainComp:refreshModule(selectModule)
+ if not self.moduleMap then
+ self.moduleMap = {}
-- 章节
- local chapterComp = self.uiMap["main_comp.chapter_comp"]
- chapterComp:initPrefabHelper()
- chapterComp:genAllChildren()
- self.chapterComp = chapterComp:addLuaComponent(CHAPTER_COMP)
- self.chapterComp.root = self
- end
-
- if not self.dailyChallengeComp then
+ local chapterComp = self.uiMap["main_comp.chapter_comp"]
+ self.chapterComp = CellManager:addCellComp(chapterComp, CHAPTER_COMP)
+ self.chapterComp:initWithParentUI(self)
+ self.moduleMap[GConst.MainCityConst.MAIN_MODULE.CHAPTER] = self.chapterComp
-- 每日挑战
local dailyChallengeComp = self.uiMap["main_comp.daily_challenge_comp"]
- dailyChallengeComp:initPrefabHelper()
- dailyChallengeComp:genAllChildren()
- dailyChallengeComp:setActive(false)
- self.dailyChallengeComp = dailyChallengeComp:addLuaComponent(DAILY_CHALLENGE_COMP)
- self.dailyChallengeComp.root = self
+ self.dailyChallengeComp = CellManager:addCellComp(dailyChallengeComp, DAILY_CHALLENGE_COMP)
+ self.dailyChallengeComp:initWithParentUI(self)
+ self.moduleMap[GConst.MainCityConst.MAIN_MODULE.DAILY_CHALLENGE] = self.dailyChallengeComp
end
- self.chapterComp:getBaseObject():setActive(false)
- self.dailyChallengeComp:getBaseObject():setActive(false)
- if self.curModuleType == GConst.MainCityConst.BOTTOM_MODULE_KEY.CHAPTER then
- self.chapterComp:getBaseObject():setActive(true)
- EventManager:dispatchEvent(EventManager.CUSTOM_EVENT.GO_CHAPTER)
- elseif self.curModuleType == GConst.MainCityConst.BOTTOM_MODULE_KEY.DAILY_CHALLENGE then
- self.dailyChallengeComp:getBaseObject():setActive(true)
- EventManager:dispatchEvent(EventManager.CUSTOM_EVENT.GO_DAILY_CHALLENGE)
+ if self.curModuleType ~= selectModule then
+ self.curModuleType = selectModule
+ if self.curModuleType == GConst.MainCityConst.MAIN_MODULE.CHAPTER then
+ -- 切换到主线章节
+ EventManager:dispatchEvent(EventManager.CUSTOM_EVENT.GO_CHAPTER)
+ elseif self.curModuleType == GConst.MainCityConst.MAIN_MODULE.DAILY_CHALLENGE then
+ -- 切换到每日挑战
+ EventManager:dispatchEvent(EventManager.CUSTOM_EVENT.GO_DAILY_CHALLENGE)
+ end
end
+
+ for idx, cell in pairs(self.moduleMap) do
+ cell:getBaseObject():setActive(self.curModuleType == idx)
+ end
+ self:refreshBtns()
end
function MainComp:refreshBtns()
@@ -86,54 +49,48 @@ function MainComp:refreshBtns()
end
function MainComp:refreshFightBtn()
- local module = nil
- for type, data in pairs(MODULE_DATA) do
- if self.curModuleType == type then
- module = data
- end
- end
- if not module then
- return
- end
+ local moduleCell = self.moduleMap[self.curModuleType]
self.uiMap["main_comp.fight_btn.desc"]:setText(I18N:getGlobalText(I18N.GlobalConst.START_DESC))
- local cost = module["numFunc"]()
+ local cost = moduleCell:getHpCost()
if cost then
self.uiMap["main_comp.fight_btn.desc_2"]:setText(GFunc.getRewardNum(cost))
else
self.uiMap["main_comp.fight_btn.desc_2"]:setText("0")
end
- self.uiMap["main_comp.fight_btn"]:addClickListener(module["clickFunc"])
+ self.uiMap["main_comp.fight_btn"]:addClickListener(moduleCell.onClickFight)
- if module["fightNum"] ~= nil then
+ local remainCount = moduleCell:getTodayRemainCount()
+ if remainCount >= 0 then
self.uiMap["main_comp.fight_btn.num_tx"]:setActive(true)
- self.uiMap["main_comp.fight_btn.num_tx"]:setText(I18N:getGlobalText(I18N.GlobalConst.TODAY_REMAIN_TIMES, module["fightNum"]()))
+ self.uiMap["main_comp.fight_btn.num_tx"]:setText(I18N:getGlobalText(I18N.GlobalConst.TODAY_REMAIN_TIMES, remainCount))
else
self.uiMap["main_comp.fight_btn.num_tx"]:setActive(false)
end
end
function MainComp:refreshLeftBtn()
- local module = MODULE_DATA[self:getCurLeftModuleIdx()]
local leftBtn = self.uiMap["main_comp.left_btn"]
leftBtn:setActive(false)
- if module == nil then
+
+ local leftIdx = self:getCurLeftModuleIdx()
+ if leftIdx == nil then
return
end
- if module["isClose"] and module["isClose"]() then
+ local moduleCell = self.moduleMap[leftIdx]
+ if not moduleCell:getIsOpen() then
return
end
leftBtn:setActive(true)
- self.uiMap["main_comp.left_btn.desc"]:setText(module["title"])
- self.uiMap["main_comp.left_btn.icon"]:setSprite(module["atlas"],module["icon"])
+ local iconAtlas, iconName = moduleCell:getEntranceIcon()
+ self.uiMap["main_comp.left_btn.desc"]:setText(moduleCell:getEntranceName())
+ self.uiMap["main_comp.left_btn.icon"]:setSprite(iconAtlas, iconName)
leftBtn:addClickListener(function()
- self.curModuleType = module["type"]
- self:refreshBtns()
- self:refreshModuleComp()
+ self:refreshModule(leftIdx)
end)
- if module["redDot"] ~= nil and module["redDot"]() then
+ if moduleCell:getShowEntranceRedPoint() then
leftBtn:addRedPoint(65, 35, 0.6)
else
leftBtn:removeRedPoint()
@@ -141,25 +98,26 @@ function MainComp:refreshLeftBtn()
end
function MainComp:refreshRightBtn()
- local module = MODULE_DATA[self:getCurRightModuleIdx()]
local rightBtn = self.uiMap["main_comp.right_btn"]
rightBtn:setActive(false)
- if module == nil then
+
+ local rightIdx = self:getCurRightModuleIdx()
+ if rightIdx == nil then
return
end
- if module["isClose"] and module["isClose"]() then
+ local moduleCell = self.moduleMap[rightIdx]
+ if not moduleCell:getIsOpen() then
return
end
rightBtn:setActive(true)
- self.uiMap["main_comp.right_btn.desc"]:setText(module["title"])
- self.uiMap["main_comp.right_btn.icon"]:setSprite(module["atlas"],module["icon"])
+ local iconAtlas, iconName = moduleCell:getEntranceIcon()
+ self.uiMap["main_comp.right_btn.desc"]:setText(moduleCell:getEntranceName())
+ self.uiMap["main_comp.right_btn.icon"]:setSprite(iconAtlas, iconName)
rightBtn:addClickListener(function()
- self.curModuleType = module["type"]
- self:refreshBtns()
- self:refreshModuleComp()
+ self:refreshModule(rightIdx)
end)
- if module["redDot"] ~= nil and module["redDot"]() then
+ if moduleCell:getShowEntranceRedPoint() then
rightBtn:addRedPoint(-65, 35, 0.6)
else
rightBtn:removeRedPoint()
@@ -167,27 +125,20 @@ function MainComp:refreshRightBtn()
end
function MainComp:getCurLeftModuleIdx()
- for idx, data in pairs(MODULE_DATA) do
- if self.curModuleType == data["type"] then
- if idx == 1 then
- return nil
- else
- return idx - 1
- end
- end
+ if self.curModuleType == 1 then
+ return nil
end
+
+ return self.curModuleType - 1
end
function MainComp:getCurRightModuleIdx()
- for idx, data in pairs(MODULE_DATA) do
- if self.curModuleType == data["type"] then
- if idx == #MODULE_DATA then
- return nil
- else
- return idx + 1
- end
- end
+ local totalModuleNum = GFunc.getTableLength(GConst.MainCityConst.MAIN_MODULE)
+ if self.curModuleType == totalModuleNum then
+ return nil
end
+
+ return self.curModuleType + 1
end
function MainComp:initStageFormation()
diff --git a/lua/app/ui/main_city/component/main_comp_base_cell.lua b/lua/app/ui/main_city/component/main_comp_base_cell.lua
new file mode 100644
index 00000000..99255a0f
--- /dev/null
+++ b/lua/app/ui/main_city/component/main_comp_base_cell.lua
@@ -0,0 +1,43 @@
+local MainCompBaseCell = class("MainCompBaseCell", BaseCell)
+
+
+-- 需要继承重写的部分 ***********************************************************
+
+function MainCompBaseCell:getIsOpen()
+ return false
+end
+
+function MainCompBaseCell:getEntranceName()
+ return ""
+end
+
+function MainCompBaseCell:getEntranceIcon()
+ return "",""
+end
+
+function MainCompBaseCell:getShowEntranceRedPoint()
+ return false
+end
+
+function MainCompBaseCell:getHpCost()
+ return 0
+end
+
+function MainCompBaseCell:getTodayRemainCount()
+ return -1
+end
+
+function MainCompBaseCell:onClickFight()
+end
+
+-- 常规逻辑 ***********************************************************
+
+function MainCompBaseCell:initWithParentUI(parentUI)
+ self.parentUI = parentUI
+end
+
+function MainCompBaseCell:refreshFightBtn()
+ self.parentUI:refreshFightBtn()
+end
+
+return MainCompBaseCell
\ No newline at end of file
diff --git a/lua/app/ui/main_city/component/main_comp_base_cell.lua.meta b/lua/app/ui/main_city/component/main_comp_base_cell.lua.meta
new file mode 100644
index 00000000..c1870736
--- /dev/null
+++ b/lua/app/ui/main_city/component/main_comp_base_cell.lua.meta
@@ -0,0 +1,10 @@
+fileFormatVersion: 2
+guid: ef1793d1eec0aea4a9c6856933a190a5
+ScriptedImporter:
+ internalIDToNameTable: []
+ externalObjects: {}
+ serializedVersion: 2
+ userData:
+ assetBundleName:
+ assetBundleVariant:
+ script: {fileID: 11500000, guid: 3b8b241bab4a4ac9a22fcce9c64f1242, type: 3}
diff --git a/lua/app/ui/main_city/main_city_ui.lua b/lua/app/ui/main_city/main_city_ui.lua
index 19d9c5c6..9947eacd 100644
--- a/lua/app/ui/main_city/main_city_ui.lua
+++ b/lua/app/ui/main_city/main_city_ui.lua
@@ -311,6 +311,10 @@ function MainCityUI:refreshBottom(selectedIndex, playAnim)
self.selectedIndex = selectedIndex and selectedIndex or MAIN_COMP_INDEX
self:switchComp()
+ if oldIndex ~= selectedIndex then
+ EventManager:dispatchEvent(EventManager.CUSTOM_EVENT.CHANGE_MAIN_CITY_PAGE, self.selectedIndex)
+ end
+
-- 动效
if playAnim and (oldIndex ~= selectedIndex) then
local targetX = self.bottomBtnCells[self.selectedIndex]:getCurLocalPosX()
@@ -599,7 +603,7 @@ end
function MainCityUI:refreshBounty()
local isOpen = DataManager.BountyData:getIsOpen()
- if not isOpen or self.mainComp:getCurModuleType() == GConst.MainCityConst.BOTTOM_MODULE_KEY.DAILY_CHALLENGE then
+ if not isOpen or self.mainComp:getCurModuleType() == GConst.MainCityConst.MAIN_MODULE.DAILY_CHALLENGE then
self.bountyNode:setVisible(false)
return
end
diff --git a/lua/app/userdata/daily_challenge/daily_challenge_data.lua b/lua/app/userdata/daily_challenge/daily_challenge_data.lua
index 965a6f49..121e56a4 100644
--- a/lua/app/userdata/daily_challenge/daily_challenge_data.lua
+++ b/lua/app/userdata/daily_challenge/daily_challenge_data.lua
@@ -10,44 +10,15 @@ function DailyChallengeData:ctor()
end
function DailyChallengeData:init(data)
+ if EDITOR_MODE then
+ Logger.logHighlight("每日挑战 更新数据...")
+ end
data = data or GConst.EMPTY_TABLE
- Logger.logHighlight("每日挑战 更新数据...")
- Logger.printTable(data)
- -- data = data or {}
- -- data = { -- 临时数据
- -- max_wave = 1,
- -- today_fixed_chapter_id = 1,
- -- rand_chapter_daily_id = 1,
- -- tasks = {
- -- {
- -- task_id = 1,
- -- param = 0,
- -- progress = 100,
- -- claimed = true
- -- },
- -- {
- -- task_id = 3,
- -- param = 0,
- -- progress = 100,
- -- claimed = false
- -- },
- -- {
- -- task_id = 7,
- -- param = 12001,
- -- progress = 0,
- -- claimed = false
- -- }
- -- },
- -- buff_id = {1, 11},
- -- totalFightCount = 0,
- -- today_challenge_count = 0,
- -- }
- -- 服务器的初始数据
self.maxWave = data.max_wave or 0
self.fixedChapterId = data.today_fixed_chapter_id or 1
self.chapterDailyId = data.rand_chapter_daily_id or 1
- self.tasks = data.tasks or {}
- self.buffIds = data.buff_id or {}
+ self.tasks = data.tasks or GConst.EMPTY_TABLE
+ self.buffIds = data.buff_id or GConst.EMPTY_TABLE
self.totalFightCount = data.total_challenge_count or 0
self.todayFightCount = data.today_challenge_count or 0
self.initDay = Time:getBeginningOfServerToday()
@@ -62,6 +33,14 @@ function DailyChallengeData:onGetedTaskReward(idx)
end
function DailyChallengeData:clear()
+ self.maxWave = nil
+ self.fixedChapterId = nil
+ self.chapterDailyId = nil
+ self.tasks = nil
+ self.buffIds = nil
+ self.totalFightCount = nil
+ self.todayFightCount = nil
+ self.initDay = nil
end
function DailyChallengeData:isOpen()
@@ -119,14 +98,6 @@ function DailyChallengeData:getMapConfig()
return ConfigManager:getConfig("chapter_daily_challenge")[self:getChapterDailyId()]
end
-function DailyChallengeData:getBuffTips(id)
- return I18N:getGlobalText(I18N.GlobalConst.DAILY_CHALLENGE)
-end
-
-function DailyChallengeData:getTaskTips(id)
- return I18N:getGlobalText(I18N.GlobalConst.DAILY_CHALLENGE)
-end
-
function DailyChallengeData:getTaskCfg()
if self.taskCfg == nil then
self.taskCfg = ConfigManager:getConfig("task_daily_challenge")
@@ -311,11 +282,24 @@ function DailyChallengeData:getTotalFightCount()
return self.totalFightCount
end
-function DailyChallengeData:dealTask(taskProgressInfo)
-end
-
function DailyChallengeData:getIfCanReset()
return self.initDay < Time:getBeginningOfServerToday()
end
+function DailyChallengeData:setShowingMainComp(isShow)
+ self.showing = isShow
+end
+
+function DailyChallengeData:isShowingMainComp()
+ return self.showing
+end
+
+function DailyChallengeData:setInReset(isInReset)
+ self.isInReset = isInReset
+end
+
+function DailyChallengeData:getIsInReset()
+ return self.isInReset
+end
+
return DailyChallengeData
\ No newline at end of file