Merge remote-tracking branch 'origin/dev' into fang/daily_challenge

# Conflicts:
#	lua/app/common/module_manager.lua
#	lua/app/config/buff_daily_challenge.lua
#	lua/app/config/chapter.lua
#	lua/app/config/hero.lua
#	lua/app/config/localization/localization_global_const.lua
#	lua/app/config/skill.lua
#	lua/app/config/strings/cn/buff.lua
#	lua/app/config/strings/cn/global.lua
This commit is contained in:
Fang 2023-05-29 18:24:33 +08:00
commit 3880dfd3d2
79 changed files with 1200 additions and 478 deletions

View File

@ -84,7 +84,7 @@ BIReport.ITEM_GET_TYPE = {
PLAYER_LV_UP = "PlayerLvUp",
GOLD_PIG = "GoldPig",
BATTLE_SKILL_REFRESH = "BattleSkillRefresh",
LEVEL_FUND = "LevelFund",
GROWTH_FUND = "GrowthFund",
GROW_UP_GIFT = "GrowUpGift", -- 成长礼包
SEVEN_DAY_TASK = "SevenDayTask",
SEVEN_DAY_STEP_REWARD = "SevenDayStepReward",
@ -141,7 +141,7 @@ BIReport.GIFT_TYPE = {
GOLD_PIG = "GoldPig",
MALL_TREASURE = "MallTreasure",
ACT_CHAPTER_STORE = "ActChapterStore",
LEVEL_FUND = "LevelFund",
GROWTH_FUND = "GrowthFund",
GROW_UP_GIFT = "GrowUpGift",
}

View File

@ -21,7 +21,7 @@ function DataManager:init()
self:initManager("TaskData", "app/userdata/task/task_data")
self:initManager("DailyTaskData", "app/userdata/task/daily_task_data")
self:initManager("IdleData", "app/userdata/idle/idle_data")
self:initManager("FundData", "app/userdata/fund/fund_data")
self:initManager("GrowthFundData", "app/userdata/fund/growth_fund_data")
self:initManager("SevenDayData", "app/userdata/activity/seven_day/seven_day_data")
self:initManager("ShopData", "app/userdata/shop/shop_data")
self:initManager("SummonData", "app/userdata/summon/summon_data")
@ -94,7 +94,7 @@ function DataManager:clear()
self.BountyData:clear()
self.DailyTaskData:clear()
self.IdleData:clear()
self.FundData:clear()
self.GrowthFundData:clear()
self.SevenDayData:clear()
self.ShopData:clear()
self.SummonData:clear()
@ -136,10 +136,10 @@ function DataManager:initWithServerData(data)
self.ShopData:initCommonDailyGoldGift(data.mall_idle and data.mall_idle.ad_count) -- 常驻金币礼包
self.ShopData:initGrowUpGift(data.act_grow_up_gift, data.now_ts) -- 成长礼包
self.ShopData:initLevelUpGift(data.act_level_up_gift) -- 助力/金币礼包
self.SummonData:init(data.summon, true)
self.SummonData:init(data.summon, true)
-- 成长基金要在ShopData和PlayerDataBagData还有之后初始化依赖这些数据
if data.fund then
self.FundData:init(data.fund.funds)
self.GrowthFundData:init(data.fund.funds)
end
-- 任务数据最后初始化,依赖其他模块的数据

View File

@ -23,10 +23,12 @@ EventManager.CUSTOM_EVENT = {
SHOW_ELIMINATION_TUTORAIL = "SHOW_ELIMINATION_TUTORAIL",
BOARD_FILL_OVER = "BOARD_FILL_OVER",
LOGIN_REQ_SUCCESS = "LOGIN_REQ_SUCCESS",
DAILY_TASK_ADD_PROGRESS = "DAILY_TASK_ADD_PROGRESS",
DAILY_TASK_COMPLETE = "DAILY_TASK_COMPLETE", -- 每日任务完成
BOSS_ENTER_ANI_OVER = "BOSS_ENTER_ANI_OVER",
TIME_TRIGGERED_NEW_EMAIL = "TIME_TRIGGERED_NEW_EMAIL", -- 邮件到时间请求是否有新邮件
TIME_TRIGGERED_NEW_EMAIL = "TIME_TRIGGERED_NEW_EMAIL", -- 邮件到时间请求是否有新邮件
SKILL_REFRESH_SUCC = "SKILL_REFRESH_SUCC",
GO_SHOP = "GO_SHOP", -- 跳转商店
UPDATE_MAIN_MALL_HEIGHT = "UPDATE_MAIN_MALL_HEIGHT", -- 更新主要商品的高度
-- BORAD_TOUCH_BEGIN = "BORAD_TOUCH_BEGIN",
-- BORAD_TOUCH_OVER = "BORAD_TOUCH_OVER"
}

View File

@ -62,8 +62,9 @@ ModuleManager.MODULE_KEY = {
IDLE_DROP = "idle_drop",
MALL = "mall", -- 商城
MALL_DAILY = "mall_daily", -- 每日商城
FUND = "act_level_gift", -- 成长基金
DAILY_CHALLENGE = "daily_challenge", -- 每日挑战
FUND = "act_level_gift", -- 成长基金
ACT_GIFT_SHOW_OPEN = "act_gift_show_open", -- 弹窗礼包通用开启条件
}
local _moduleMgrs = {}

View File

@ -15,7 +15,7 @@ PayManager.PURCHARSE_ACT_TYPE = {
COIN_GIFT = 2,
BEGINNER_GIFT = 4,
LEVEL_UP_GIFT = 5,
LEVEL_FUND = 6,
GROWTH_FUND = 6,
BOUNTY = 7,
}
@ -33,7 +33,7 @@ PayManager.BI_ITEM_GET_TYPE = {
[PayManager.PURCHARSE_ACT_TYPE.COIN_GIFT] = BIReport.ITEM_GET_TYPE.COIN_GIFT,
[PayManager.PURCHARSE_ACT_TYPE.BEGINNER_GIFT] = BIReport.ITEM_GET_TYPE.BEGINNER_GIFT,
[PayManager.PURCHARSE_ACT_TYPE.LEVEL_UP_GIFT] = BIReport.ITEM_GET_TYPE.LEVEL_UP_GIFT,
[PayManager.PURCHARSE_ACT_TYPE.LEVEL_FUND] = BIReport.ITEM_GET_TYPE.LEVEL_FUND,
[PayManager.PURCHARSE_ACT_TYPE.GROWTH_FUND] = BIReport.ITEM_GET_TYPE.GROWTH_FUND,
[PayManager.PURCHARSE_ACT_TYPE.BOUNTY] = BIReport.ITEM_GET_TYPE.BOUNTY,
},
[PayManager.PURCHARSE_TYPE.ACT_GOLD_PIG] = BIReport.ITEM_GET_TYPE.GOLD_PIG,
@ -48,7 +48,7 @@ PayManager.BI_GIFT_TYPE = {
[PayManager.PURCHARSE_ACT_TYPE.COIN_GIFT] = BIReport.GIFT_TYPE.COIN_GIFT,
[PayManager.PURCHARSE_ACT_TYPE.BEGINNER_GIFT] = BIReport.GIFT_TYPE.BEGINNER_GIFT,
[PayManager.PURCHARSE_ACT_TYPE.LEVEL_UP_GIFT] = BIReport.GIFT_TYPE.LEVEL_UP_GIFT,
[PayManager.PURCHARSE_ACT_TYPE.LEVEL_FUND] = BIReport.GIFT_TYPE.LEVEL_FUND,
[PayManager.PURCHARSE_ACT_TYPE.GROWTH_FUND] = BIReport.GIFT_TYPE.GROWTH_FUND,
[PayManager.PURCHARSE_ACT_TYPE.BOUNTY] = BIReport.GIFT_TYPE.BOUNTY,
},
[PayManager.PURCHARSE_TYPE.ACT_GOLD_PIG] = BIReport.GIFT_TYPE.GOLD_PIG,
@ -103,7 +103,6 @@ function PayManager:getGiftConfigInfo(purchaseType, id)
return
end
local cfg = ConfigManager:getConfig(cfgName)
local cfg = ConfigManager:getConfig(cfgName)
if not cfg or not cfg[id] then
return
end

View File

@ -11,6 +11,7 @@ local GAME_RES_WHITE_LIST = {
GConst.ATLAS_PATH.ICON_ITEM,
GConst.ATLAS_PATH.ICON_HERO,
GConst.ATLAS_PATH.ICON_BUFF,
GConst.ATLAS_PATH.ICON_TASK,
}
---- 预加载游戏资源

View File

@ -266,6 +266,7 @@ GConst.MESSAGE_BOX_TYPE = {
GConst.MESSAGE_BOX_SHOW_TODAY = {
BOUNTY_BUY_LEVEL = 1,
HOT_SELL_BUY = 2,
}
GConst.QUALITY_TYPE =

View File

@ -232,7 +232,8 @@ BattleConst.PASSIVE_EVENT = {
ON_ACTIVE_SKILL_BEFORE = 7, -- 主动技能释放前
ON_DEAD_BY_BURN = 8, -- 有敌人死于灼烧伤害时触发
ON_DEAD_BY_SKILL = 9, -- 有敌人死于技能时触发
ON_DEAD = 10, -- 死亡时
ON_DEAD_WITH_BLEED = 10, -- 死亡时带有流血buff
ON_DEAD = 11, -- 死亡时
}
local BUFF_NAME = {
@ -345,6 +346,7 @@ local ATTR_NAME = {
COUNTER_ATTACK = "counterattack",
SKILL_HURT = "skill_hurt",
DEATH_SUMMON = "death_summon",
BLEED = "bleed",
}
BattleConst.ATTR_NAME = ATTR_NAME

View File

@ -288,10 +288,7 @@ function BattleUnitComp:getKeyFrameTime(skill, blockIndex, animationName)
time = self:getAnimationKeyFrameTime(animationName, blockIndex)
end
end
-- Logger.logHighlight(animationName .. " blockIndex " .. blockIndex)
-- Logger.printTable(blockList)
-- Logger.printTable(self.validEffectIdx)
return time
end
@ -964,9 +961,9 @@ function BattleUnitComp:updateSkillAttack(dt)
end
return
else
self:checkPassiveEvent(PASSIVE_EVENT.ON_ACTIVE_SKILL_BEFORE, self)
self.currActiveSkill:startUse()
self:doNextSkillAttack()
self:checkPassiveEvent(PASSIVE_EVENT.ON_ACTIVE_SKILL_BEFORE, self)
end
else -- 继续普攻
self:doNextNormalAttack()
@ -1587,17 +1584,28 @@ function BattleUnitComp:takeDamageOrCure(atker, num, effectType, effectStatus, d
end
local hpPercent = self.unitEntity:getHpPercent()
self.battleController:refreshHp(self.side, hp, hpPercent)
if not atker:getIsFinalBlock() then
if not atker:getIsFinalBlock() or not self.battleController:getIsLastInstruction() then
if damage < 0 then
self:playHurt()
end
else
if self.unitEntity:getIsDead() then
self:changeState(UNIT_STATE.DEAD)
if damageOrCureType == BattleConst.BUFF_NAME.BURN then
local target = self.battleController:getOtherSideMainUnit(self.side)
target:checkPassiveEvent(BattleConst.PASSIVE_EVENT.ON_DEAD_BY_BURN, target)
local team = self.battleController:getOtherSideTeam(self.side)
team:checkPassiveEvent(BattleConst.PASSIVE_EVENT.ON_DEAD_BY_BURN)
end
if self.unitEntity:getAttrValue(BattleConst.ATTR_NAME.BLEED) > 0 then
local team = self.battleController:getOtherSideTeam(self.side)
team:checkPassiveEvent(BattleConst.PASSIVE_EVENT.ON_DEAD_WITH_BLEED)
end
if self.actionOverCallback then -- 被反击时死亡
self:onAttackOver()
end
self.battleController:resetTimeSpeed()
self:changeState(UNIT_STATE.DEAD)
elseif damage < 0 then
self:playHurt()
end

View File

@ -405,6 +405,14 @@ function BattleController:getOtherSideMainUnit(side)
end
end
function BattleController:getOtherSideTeam(side)
if side == BattleConst.SIDE_ATK then
return self.defTeam
else
return self.atkTeam
end
end
function BattleController:onLoadComplete()
self:handleBuffs()
self:battleStart()
@ -1268,6 +1276,14 @@ function BattleController:exeInstructions(callback)
end
end
function BattleController:getIsLastInstruction()
if not self.instructions or not self.instructions[1] then
return true
end
return false
end
function BattleController:generateBoard(isFirst)
local boardList, _, mysteryBoxIndexMap = self:getInitBoard()
if self.curBoardIndex and self.curBoardIndex >= #boardList then

View File

@ -161,11 +161,11 @@ BattleBuffHandle.removeShield = {
target.unitEntity:addAttr(ATTR_NAME.SHIELD_REBOUND, -20000, false)
target:removeShield(buffEffect)
end,
[BUFF_NAME.SHIELD_REBOUND_400] = function(unitComp, buff, target, buffEffect)
[BUFF_NAME.SHIELD_REBOUND_400] = function(unitComp, target, buff, buffEffect)
target.unitEntity:addAttr(ATTR_NAME.SHIELD_REBOUND, -40000, false)
target:removeShield(buffEffect)
end,
[BUFF_NAME.SHIELD_ICE_REBOUND_400] = function(unitComp, buff, target, buffEffect)
[BUFF_NAME.SHIELD_ICE_REBOUND_400] = function(unitComp, target, buff, buffEffect)
target.unitEntity:addAttr(ATTR_NAME.SHIELD_REBOUND, -40000, false)
target:removeShield(buffEffect)
end,

View File

@ -28,10 +28,12 @@ local function _skillFireTimesOff(buffSender, target, buff, buffEffect)
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%
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%
return 1
end

View File

@ -61,6 +61,10 @@ local function _checkOnDeadBySkill(unitComp, skill, targetComp)
return 1
end
local function _checkOnDeadWithBleed(unitComp, skill, targetComp)
return 1
end
local function _checkOnDead(unitComp, skill, targetComp)
return 1
end
@ -74,6 +78,7 @@ BattlePassive.checkTrigger = {
[PASSIVE_EVENT.ON_ACTIVE_SKILL_BEFORE] = _checkOnActiveSkillBefore,
[PASSIVE_EVENT.ON_DEAD_BY_BURN] = _checkOnDeadByBurn,
[PASSIVE_EVENT.ON_DEAD_BY_SKILL] = _checkOnDeadBySkill,
[PASSIVE_EVENT.ON_DEAD_WITH_BLEED] = _checkOnDeadWithBleed,
[PASSIVE_EVENT.ON_DEAD] = _checkOnDead,
}

View File

@ -21,8 +21,19 @@ local _changeBaseSkill = function(skillId, skillInfo, battleData, battleControll
if not battleData.atkTeam then
return
end
if battleData.atkTeam:getAllMembers()[elementType] then
battleData.atkTeam:getAllMembers()[elementType]:changeSkillId(skillId, newSkillId)
local unitEntity = battleData.atkTeam:getAllMembers()[elementType]
if unitEntity then
unitEntity:changeSkillId(skillId, newSkillId)
Logger.logHighlight("------------")
Logger.printTable(skillEntity:getSkillRoundAdd())
Logger.printTable(skillEntity:getSkillEffecuNumAdd())
for effectType, effect in pairs(skillEntity:getSkillRoundAdd()) do -- 技能回合数
unitEntity:addSkillRound(newSkillId, effect)
end
for effectType, effect in pairs(skillEntity:getSkillEffecuNumAdd()) do -- 技能效果
unitEntity:addSkillParams(newSkillId, effect)
end
end
end
end
@ -135,6 +146,7 @@ local _addSkillEffectParams = function(skillId, skillInfo, battleData, battleCon
local skillEntity = battleData:getSkillEntityByElement(elementType)
if skillEntity then
local skillId = skillEntity:getSkillId()
skillEntity:addSkillEffecuNumAdd(effect)
if not battleData.atkTeam then
return
end
@ -173,6 +185,7 @@ local _addSkillRound = function(skillId, skillInfo, battleData, battleController
local skillEntity = battleData:getSkillEntityByElement(elementType)
if skillEntity then
local skillId = skillEntity:getSkillId()
skillEntity:addSkillRoundAdd(effect)
if not battleData.atkTeam then
return
end

View File

@ -278,13 +278,13 @@ function BattleTeam:addBuff(buffEffect)
else
table.insert(self.buffList, buffEffect)
self:updateBuffState(buffEffect.buff, 1)
if buffEffect.buff:getIcon() then
self.battleController:refreshBuff(self.side, self.buffList)
end
needRecycle = buffEffect
end
if buffEffect.buff:getIcon() then
self.battleController:refreshBuff(self.side, self.buffList)
end
return needRecycle
end
@ -400,6 +400,9 @@ function BattleTeam:doBuffWork()
buffEffect = nil
for i = count, 1, -1 do
buffEffect = self.buffList[i]
if not buffEffect then
break
end
buffEffect.round = buffEffect.round - 1
BattleBuffHandle.doBuffWork(self.mainUnit, buffEffect)
if buffEffect.round <= 0 then

View File

@ -1,11 +1,11 @@
local FundManager = class("FundManager", BaseModule)
function FundManager:showLevelFundUI()
UIManager:showUI("app/ui/fund/level_fund_ui")
UIManager:showUI("app/ui/fund/growth_fund_ui")
end
function FundManager:buyLevelFund(id)
if not DataManager.FundData:getIsOpen() then
if not DataManager.GrowthFundData:getIsOpen() then
return
end
PayManager:purchasePackage(id, PayManager.PURCHARSE_TYPE.ACT_GIFT)
@ -14,15 +14,15 @@ end
function FundManager:claimFundRewards()
local claimRewards = {}
local playerLevel = DataManager.PlayerData:getLv()
local FundData = DataManager.FundData
local levelInfoIds = FundData:getCurrLevelInfoList()
local isBoughtBase = FundData:getIsBoughtBase()
local isBoughtAdvance = FundData:getIsBoughtAdvance()
local freeClaimed = FundData:getFreeClaimedMap()
local baseClaimed = FundData:getBaseClaimedMap()
local advanceClaimed = FundData:getAdvanceClaimedMap()
for _, id in ipairs(levelInfoIds) do
local levelFundInfo = FundData:getLevelFundCfg()[id]
local GrowthFundData = DataManager.GrowthFundData
local gradeInfoIds = GrowthFundData:getCurrGradeInfoList()
local isBoughtBase = GrowthFundData:getIsBoughtBase()
local isBoughtAdvance = GrowthFundData:getIsBoughtAdvance()
local freeClaimed = GrowthFundData:getFreeClaimedMap()
local baseClaimed = GrowthFundData:getBaseClaimedMap()
local advanceClaimed = GrowthFundData:getAdvanceClaimedMap()
for _, id in ipairs(gradeInfoIds) do
local levelFundInfo = GrowthFundData:getLevelFundCfg()[id]
if levelFundInfo then
if playerLevel >= levelFundInfo.level then -- 等级到了
if not freeClaimed[id] then -- 能领但是没有领
@ -66,7 +66,7 @@ function FundManager:onClaimFundRewards(result)
if result.rewards then
GFunc.showRewardBox(result.rewards)
end
DataManager.FundData:onClaimFundRewards(result.id_with_lv)
DataManager.GrowthFundData:onClaimFundRewards(result.id_with_lv)
end
end

View File

@ -26,7 +26,11 @@ MainCityConst.LEFT_SIDE_BARS = {
MainCityConst.RIGHT_SIDE_BARS = {
"app/ui/main_city/cell/side_bar_gold_pig_cell",
"app/ui/main_city/cell/side_bar_level_fund_cell",
"app/ui/main_city/cell/side_bar_growth_fund_cell",
"app/ui/main_city/cell/side_bar_first_recharge_cell",
"app/ui/main_city/cell/side_bar_beginner_gift_cell",
"app/ui/main_city/cell/side_bar_grow_up_gift_1_cell",
"app/ui/main_city/cell/side_bar_grow_up_gift_2_cell",
}
return MainCityConst

View File

@ -1,5 +1,6 @@
local ShopConst = {}
ShopConst.FIRST_RECHARGE_ID = 10102 -- 首充礼包ID
ShopConst.BEGINNER_GIFT_ID = 40102 -- 新手礼包ID
ShopConst.MAIN_UI_POP_TYPE = { -- 当触发弹窗时,相关联的类型礼包也要触发
[PayManager.PURCHARSE_TYPE.ACT_GIFT] = {
@ -9,4 +10,31 @@ ShopConst.MAIN_UI_POP_TYPE = { -- 当触发弹窗时,相关联的类型礼包也
[PayManager.PURCHARSE_TYPE.CHAPTER_GIFT] = true
}
ShopConst.GEM_ICON_NAME = {
[1] = "shop_diamond_1",
[2] = "shop_diamond_1",
[3] = "shop_diamond_2",
[4] = "shop_diamond_3",
[5] = "shop_diamond_4",
[6] = "shop_diamond_5",
[7] = "shop_diamond_6",
[8] = "shop_diamond_7",
[9] = "shop_diamond_8",
[10] = "shop_diamond_8",
[11] = "shop_diamond_8",
[12] = "shop_diamond_8",
[13] = "shop_diamond_8",
[14] = "shop_diamond_8",
[15] = "shop_diamond_8",
[16] = "shop_diamond_8",
[17] = "shop_diamond_8",
[18] = "shop_diamond_8",
[19] = "shop_diamond_8",
}
ShopConst.COIN_ICON_NAME = {
[1] = "shop_species_1",
[2] = "shop_species_2",
[3] = "shop_species_3",
}
return ShopConst

View File

@ -23,8 +23,18 @@ end
-- 触发弹窗礼包
function ShopManager:triggerGiftPopUI(actType, actId)
UIManager:showUI("app/ui/shop/gift_pop_ui", {type = actType, id = actId})
DataManager.ShopData:removePopUpGift(actType, actId)
if ModuleManager:getIsOpen(ModuleManager.MODULE_KEY.ACT_GIFT_SHOW_OPEN, true) then
self:showGiftPopUI(actType, actId, false)
DataManager.ShopData:removePopUpGift(actType, actId)
end
end
function ShopManager:showGiftPopUI(actType, actId, onlySelf)
if actType == PayManager.PURCHARSE_TYPE.ACT_GIFT and actId == GConst.ShopConst.FIRST_RECHARGE_ID then
UIManager:showUI("app/ui/shop/first_recharge_pop_ui")
else
UIManager:showUI("app/ui/shop/gift_pop_ui", {type = actType, id = actId, onlySelf = onlySelf})
end
end
-- 触发金币弹窗礼包
@ -57,11 +67,32 @@ function ShopManager:buyMallDailyGift(id, isAd)
end
end
local responseData = {
rewards = rewards,
costs = costs
}
self:sendMessage(ProtoMsgType.FromMsgEnum.BuyMallDailyReq, params, responseData, self.buyMallDailyGiftFinish, BIReport.ITEM_GET_TYPE.MALL_DAILY)
-- 二次弹窗确认
if costs then
local isCoin = costs.id == GConst.ItemConst.ITEM_ID_GOLD
local params ={
titleTx = I18N:getGlobalText(I18N.GlobalConst.SHOP_DESC_31),
content = isCoin and I18N:getGlobalText(I18N.GlobalConst.SHOP_DESC_32) or I18N:getGlobalText(I18N.GlobalConst.SHOP_DESC_33),
boxType = GConst.MESSAGE_BOX_TYPE.MB_OK_CANCEL,
showToday = GConst.MESSAGE_BOX_SHOW_TODAY.HOT_SELL_BUY,
costId = costs.id,
costNum = costs.num,
okFunc = function()
local responseData = {
rewards = rewards,
costs = costs
}
self:sendMessage(ProtoMsgType.FromMsgEnum.BuyMallDailyReq, params, responseData, self.buyMallDailyGiftFinish, BIReport.ITEM_GET_TYPE.MALL_DAILY)
end,
}
GFunc.showMessageBox(params)
else
local responseData = {
rewards = rewards,
costs = costs
}
self:sendMessage(ProtoMsgType.FromMsgEnum.BuyMallDailyReq, params, responseData, self.buyMallDailyGiftFinish, BIReport.ITEM_GET_TYPE.MALL_DAILY)
end
end
function ShopManager:buyMallDailyGiftFinish(result)
@ -172,8 +203,10 @@ end
-- 推送成长礼包
function ShopManager:onTriggerGrowUpGift(result)
DataManager.ShopData:onTriggerGrowUpGift(result.add_grow_up_gift)
-- 立即触发弹窗
self:triggerGrowUpGiftPopUI(result.add_grow_up_gift.current_grow_up_id)
-- 有2种情况 1.处于英雄升级/解锁界面 立即触发弹窗 2.购买了成长礼包,此时仅标记,在奖励弹窗结束后再弹
if UIManager:getTopUIObj() == UIManager.UI_PATH.HERO_DETAIL_UI then
self:triggerGrowUpGiftPopUI(result.add_grow_up_gift.current_grow_up_id)
end
end
return ShopManager

View File

@ -2,8 +2,10 @@ local TaskManager = class("TaskManager", BaseModule)
local BATTLE_TASK_FIELD = GConst.BattleConst.BATTLE_TASK_FIELD
function TaskManager:init()
self:addEventListener(EventManager.CUSTOM_EVENT.DAILY_TASK_ADD_PROGRESS, function(id, taskId, from, to)
ModuleManager.TaskToastManager:showToast(id, taskId, from, to)
self:addEventListener(EventManager.CUSTOM_EVENT.DAILY_TASK_COMPLETE, function(id, taskId, from, to)
if DataManager.DailyTaskData:getIsOpen() then
ModuleManager.TaskToastManager:showToast(id, taskId, from, to)
end
end)
self:addEventListener(EventManager.CUSTOM_EVENT.UI_SHOW_COMPLETE, function()
ModuleManager.TaskToastManager:checkOnOpenUI()

View File

@ -246,6 +246,8 @@ function NetManager:connect(domain, port, callback, socketName)
GFunc.showMessageBox(params)
end
else
UIManager:hideWaitNet(true)
LocalData:setLastLoginInfo(NetManager.LOGIN_TYPE.TOKEN, pbData.id, pbData.token)
LocalData:setAccountInfo(pbData)
BIReport:updateAccountId(pbData.id)

View File

@ -1920,7 +1920,10 @@ function BattleUI:showTutorialFinger(posIdList)
end
self.showTutorialFingerSeq:AppendCallback(function()
self.battleController:clearGridSequence()
self.tutorialFinger:setAnchoredPositionX(DEFAULT_X)
self:showBoardMask(nil)
end)
self.showTutorialFingerSeq:AppendInterval(1)
self.showTutorialFingerSeq:SetLoops(-1)
end

View File

@ -24,7 +24,6 @@ function BountyMainUI:ctor()
end
function BountyMainUI:onClose()
self:clearAdaptScrollrect()
if self.autoRotateTween then
self.autoRotateTween:Kill()
end
@ -122,6 +121,10 @@ function BountyMainUI:initRewards()
ModuleManager.BountyManager:buyBountyLevel()
end)
self.progressBg = self.uiMap["bounty_main_ui.mid_node.scrollrect.viewport.content.progress_bg"]
self.progressComp = self.uiMap["bounty_main_ui.mid_node.scrollrect.viewport.content.progress_bg.progress"]:getComponent(GConst.TYPEOF_UNITY_CLASS.BF_SLIDER)
self.rewardsMaskBg = self.uiMap["bounty_main_ui.mid_node.scrollrect.viewport.content.mask_img"]
self.scrollrect = self.uiMap["bounty_main_ui.mid_node.scrollrect"]
self.scrollrectViewport = self.uiMap["bounty_main_ui.mid_node.scrollrect.viewport"]
self.rewardsContent = self.uiMap["bounty_main_ui.mid_node.scrollrect.viewport.content"]
@ -129,18 +132,12 @@ function BountyMainUI:initRewards()
self.scrollrectComp:clearCells()
self.scrollrectComp:setTotalCount(0)
self.scrollrectComp:addInitCallback(function()
self.rewardsMaskBg:getTransform():SetAsLastSibling()
self.line:getTransform():SetAsLastSibling()
self.repeatRewardRoot:getTransform():SetAsLastSibling()
return "app/ui/bounty/cell/bounty_cell"
end)
self.scrollrectComp:addRefreshCallback(function(index, cell)
-- TODO 有时候顺序还是不对
if self.refreshIndex then
if index > self.refreshIndex then
cell:getBaseObject():getTransform():SetAsLastSibling()
elseif index < self.refreshIndex then
cell:getBaseObject():getTransform():SetAsFirstSibling()
end
end
self.refreshIndex = index
local totalCount = self.scrollrectComp:getTotalCount()
local isFinalCell = index == totalCount
if not self.disablePreviewReward then
@ -157,29 +154,14 @@ function BountyMainUI:initRewards()
end
end
end
cell:refresh(index, isFinalCell)
local lv = DataManager.BountyData:getLevel()
if index > lv - 1 or index < lv + 1 then
self.line:getTransform():SetAsLastSibling()
end
if not self.adjustRepeatRewardRoot then
self.adjustRepeatRewardRoot = true
local posY = -totalCount*self.cellHeight
self.repeatRewardRoot:setAnchoredPositionY(posY)
end
self.repeatRewardRoot:getTransform():SetAsLastSibling()
cell:refresh(index)
end)
self.cellHeight = self.uiMap["bounty_main_ui.mid_node.scrollrect.viewport.content.cell"]:getRectHeight()
local scrollBottom = 106
local scrollTop = 464
local height = self.root:getRectHeight()
height = height - scrollTop - scrollBottom
local height = self.scrollrect:getRectHeight() - self.scrollrectComp:getTopRecoveryOffset() - self.scrollrectComp:getDownRecoveryOffset()
self.rewardCellNum = math.ceil(height/self.cellHeight)
self:adaptScrollrect()
end
function BountyMainUI:initRepeatReward()
self.adjustRepeatRewardRoot = false
self.repeatRewardRoot = self.uiMap["bounty_main_ui.mid_node.scrollrect.viewport.content.repeat"]
self.uiMap["bounty_main_ui.mid_node.scrollrect.viewport.content.repeat.title_tx"]:setText(I18N:getGlobalText(I18N.GlobalConst.REWARD_BOX_DESC))
self.uiMap["bounty_main_ui.mid_node.scrollrect.viewport.content.repeat.desc_tx"]:setText(I18N:getGlobalText(I18N.GlobalConst.BOUNTY_DESC_3))
@ -202,26 +184,6 @@ function BountyMainUI:initRepeatReward()
end)
end
function BountyMainUI:adaptScrollrect()
if not self.rectDefaultSize then
self.rectDefaultSize = self.scrollrect:getSizeDelta()
end
if not self.viewDefaultSize then
self.viewDefaultSize = self.scrollrectViewport:getSizeDelta()
end
local addH = GFunc.calculateFitSizeY()
self.scrollrect:setSizeDelta(self.rectDefaultSize.x, self.rectDefaultSize.y + addH)
self.scrollrectViewport:setSizeDelta(self.viewDefaultSize.x, self.viewDefaultSize.y + addH)
end
function BountyMainUI:clearAdaptScrollrect()
if not self.rectDefaultSize then
return
end
self.scrollrect:setSizeDelta(self.rectDefaultSize.x, self.rectDefaultSize.y)
self.scrollrectViewport:setSizeDelta(self.viewDefaultSize.x, self.viewDefaultSize.y)
end
function BountyMainUI:bindData()
self:bind(DataManager.BountyData, "dirty", function()
self:onRefresh()
@ -292,14 +254,28 @@ function BountyMainUI:refreshRewards()
self.scrollrectComp:updateAllCell()
self.disablePreviewReward = false
end
local topRecoveryOffset = self.scrollrectComp:getTopRecoveryOffset()
local downRecoveryOffset = self.scrollrectComp:getDownRecoveryOffset()
local cellHeight = self.scrollrectComp:getCellHeight()
if lv >= maxLv then
self.line:setVisible(false)
else
self.line:setVisible(true)
local posY = -lv*self.cellHeight
self.line:setAnchoredPositionY(posY)
self.line:setAnchoredPositionY(-topRecoveryOffset - lv*cellHeight)
end
self.progressBg:setAnchoredPositionY((topRecoveryOffset + downRecoveryOffset)/2 - cellHeight/2)
self.progressBg:setSizeDeltaY(cellHeight*(maxLv - 1))
local percent = (lv - 1) / (maxLv - 1)
if percent < 0 then
percent = 0
end
self.progressComp.value = percent
self.rewardsMaskBg:setAnchoredPositionY(-topRecoveryOffset - lv*cellHeight)
self.rewardsMaskBg:setSizeDeltaY(cellHeight*maxLv + GConst.UI_SCREEN_HEIGHT)
self.repeatRewardRoot:setAnchoredPositionY(downRecoveryOffset)
if DataManager.BountyData:getIfCanClaimRepeatReward() then
self.repeatRewardRoot:addRedPoint(74, 15)
else

View File

@ -9,12 +9,9 @@ function BountyCell:init()
self.bountyRewardCell1 = uiMap["cell.bg.bounty_reward_cell_1"]:addLuaComponent(BOUNTY_REWARD_CELL)
uiMap["cell.bg.bounty_reward_cell_2"]:setAnchoredPositionX(GConst.UI_SCREEN_WIDTH/4)
self.bountyRewardCell2 = uiMap["cell.bg.bounty_reward_cell_2"]:addLuaComponent(BOUNTY_REWARD_CELL)
self.maskImg = uiMap["cell.mask_img"]
self.lvBg = uiMap["cell.bg.lv_bg"]
self.lvTx = uiMap["cell.bg.lv_bg.lv_tx"]
self.progressBg = uiMap["cell.bg.progress_bg"]
self.progressComp = uiMap["cell.bg.progress_bg.progress"]:getComponent(GConst.TYPEOF_UNITY_CLASS.BF_SLIDER)
self.bountyRewardCell1:addClickListener(function()
if self.idx == nil then
return
@ -44,7 +41,7 @@ function BountyCell:init()
end)
end
function BountyCell:refresh(idx, isFinalCell)
function BountyCell:refresh(idx)
self.idx = idx
local bountyInfo = DataManager.BountyData:getSeasonInfoByLevel(idx)
local lv = DataManager.BountyData:getLevel()
@ -56,13 +53,7 @@ function BountyCell:refresh(idx, isFinalCell)
self.bountyRewardCell1:refresh(bountyInfo.reward, false, false, state)
self.bountyRewardCell2:refresh(bountyInfo.reward_pro, true, not isBought, proState)
if lv >= idx then
self.maskImg:setVisible(false)
self.lvBg:setImageGray(false)
if lv == idx then
self.progressComp.value = 0
else
self.progressComp.value = 1
end
if state then -- 已经领过了
self.bountyRewardCell1:hideLight()
else
@ -75,16 +66,9 @@ function BountyCell:refresh(idx, isFinalCell)
end
else
self.lvBg:setImageGray(true)
self.maskImg:setVisible(true)
self.progressComp.value = 0
self.bountyRewardCell1:hideLight()
self.bountyRewardCell2:hideLight()
end
if isFinalCell then
self.progressBg:setVisible(false)
else
self.progressBg:setVisible(true)
end
end
function BountyCell:setVisible(visible)

View File

@ -9,6 +9,8 @@ function BountyRewardCell:init()
self.fragment = uiMap["bounty_reward_cell.fragment"]
self.light = uiMap["bounty_reward_cell.light"]
self.lock = uiMap["bounty_reward_cell.lock"]
self.matchImg = uiMap["bounty_reward_cell.match_img"]
self.sImg = uiMap["bounty_reward_cell.s"]
self:hideLight()
self.baseObject:addClickListener(function()
@ -52,14 +54,21 @@ function BountyRewardCell:_refreshItem(item)
if heroInfo then
self.icon:setLocalScale(0.86, 0.86, 0.86)
self.icon:setSprite(GConst.ATLAS_PATH.ICON_HERO, heroInfo.icon)
self.matchImg:setSprite(GConst.ATLAS_PATH.ICON_HERO, GConst.HeroConst.MATCH_ICON_NAME[heroInfo.position])
self.matchImg:setVisible(true)
self.sImg:setVisible(heroInfo.qlt >= 4)
else
self.icon:setSprite(GConst.ATLAS_PATH.COMMON, "common_alpha")
self.matchImg:setVisible(false)
self.sImg:setVisible(false)
end
self.fragment:setVisible(true)
else
self.icon:setLocalScale(1, 1, 1)
self.icon:setSprite(GConst.ATLAS_PATH.ICON_ITEM, info.icon)
self.fragment:setVisible(false)
self.matchImg:setVisible(false)
self.sImg:setVisible(false)
end
end

View File

@ -42,19 +42,30 @@ function HeroCell:refresh(heroEntity, isGray)
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, heroEntity:getLv()))
if heroEntity:isUnlock() then
self.lvTx:setVisible(true)
if heroEntity:isActived() then
self.lvTx:setText(I18N:getGlobalText(I18N.GlobalConst.HERO_DESC_1, heroEntity:getLv()))
self.lvTx:setVisible(true)
else
self.lvTx:setVisible(false)
end
self.progressBg:setVisible(not heroEntity:isMaxLv())
self.unlockTx:setVisible(false)
if not heroEntity:isActived() then
self.lvTx:setText(I18N:getGlobalText(I18N.GlobalConst.HERO_DESC_11))
end
else
self.lvTx:setVisible(false)
self.progressBg:setVisible(false)
self.unlockTx:setVisible(true)
self.unlockTx:setText(I18N:getGlobalText(I18N.GlobalConst.HERO_DESC_10, heroEntity:getUnlcokChapter()))
if canLvUp then
self.unlockTx:setVisible(false)
self.progressBg:setVisible(true)
else
self.unlockTx:setVisible(true)
self.progressBg:setVisible(false)
local unlcokChapter = heroEntity:getUnlcokChapter()
if unlcokChapter then
self.unlockTx:setText(I18N:getGlobalText(I18N.GlobalConst.HERO_DESC_10, unlcokChapter))
else
self.unlockTx:setText(I18N:getGlobalText(I18N.GlobalConst.HERO_DESC_11))
end
end
end
end

View File

@ -10,6 +10,7 @@ function RewardCell:init()
self.fragment = uiMap["reward_cell.item_bg.fragment"]
self.leftUpIcon = uiMap["reward_cell.item_bg.left_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"]
self:hideFrameAnimation()
self.baseObject:addClickListener(function()
@ -80,9 +81,12 @@ function RewardCell:_refreshItem(info, count)
self.icon:setLocalScale(0.86, 0.86, 0.86)
self.icon:setSprite(GConst.ATLAS_PATH.ICON_HERO, heroInfo.icon)
self.sImg:setVisible(heroInfo.qlt >= 4)
self.matchImg:setVisible(true)
self.matchImg:setSprite(GConst.ATLAS_PATH.ICON_HERO, GConst.HeroConst.MATCH_ICON_NAME[heroInfo.position])
else
self.icon:setSprite(GConst.ATLAS_PATH.COMMON, "common_alpha")
self.sImg:setVisible(false)
self.matchImg:setVisible(false)
end
self.fragment:setVisible(true)
else
@ -90,6 +94,7 @@ function RewardCell:_refreshItem(info, count)
self.icon:setSprite(GConst.ATLAS_PATH.ICON_ITEM, info.icon)
self.fragment:setVisible(false)
self.sImg:setVisible(false)
self.matchImg:setVisible(false)
end
end

View File

@ -1,60 +1,60 @@
local LevelFundCell = class("LevelFundCell", BaseCell)
local GrowthFundCell = class("GrowthFundCell", BaseCell)
local Fund_REWARD_CELL = "app/ui/fund/cell/level_fund_reward_cell"
local Fund_REWARD_CELL = "app/ui/fund/cell/growth_fund_reward_cell"
function LevelFundCell:init()
function GrowthFundCell:init()
local uiMap = self:getUIMap()
local width = GConst.UI_SCREEN_WIDTH
self.fundRewardCell1 = uiMap["level_fund_cell.fund_reward_cell_1"]:addLuaComponent(Fund_REWARD_CELL)
self.fundRewardCell1 = uiMap["growth_fund_cell.fund_reward_cell_1"]:addLuaComponent(Fund_REWARD_CELL)
self.fundRewardCell1:setAnchoredPositionX(-width/3)
self.fundRewardCell1:addClickListener(function()
if self.fundId == nil then
return
end
local iCslaimed = DataManager.FundData:getIsClaimedBase(self.fundId)
local needLevel = DataManager.FundData:getNeedLevel(self.fundId)
local iCslaimed = DataManager.GrowthFundData:getIsClaimedBase(self.fundId)
local needLevel = DataManager.GrowthFundData:getNeedLevel(self.fundId)
local playerLevel = DataManager.PlayerData:getLv()
if not iCslaimed and playerLevel >= needLevel then
ModuleManager.FundManager:claimFundRewards()
else
local freeReward = DataManager.FundData:getFreeFundRewards(self.fundId)
local freeReward = DataManager.GrowthFundData:getFreeFundRewards(self.fundId)
local reward = freeReward and freeReward[1]
if reward then
ModuleManager.TipsManager:showRewardTips(reward.id, reward.type, self.fundRewardCell1:getBaseObject())
end
end
end)
self.fundRewardCell2 = uiMap["level_fund_cell.fund_reward_cell_2"]:addLuaComponent(Fund_REWARD_CELL)
self.fundRewardCell2 = uiMap["growth_fund_cell.fund_reward_cell_2"]:addLuaComponent(Fund_REWARD_CELL)
self.fundRewardCell2:addClickListener(function()
if self.fundId == nil then
return
end
local iCslaimed = DataManager.FundData:getIsClaimedBase(self.fundId)
local needLevel = DataManager.FundData:getNeedLevel(self.fundId)
local iCslaimed = DataManager.GrowthFundData:getIsClaimedBase(self.fundId)
local needLevel = DataManager.GrowthFundData:getNeedLevel(self.fundId)
local playerLevel = DataManager.PlayerData:getLv()
if not iCslaimed and playerLevel >= needLevel and DataManager.FundData:getIsBoughtBase(self.fundId) then
if not iCslaimed and playerLevel >= needLevel and DataManager.GrowthFundData:getIsBoughtBase(self.fundId) then
ModuleManager.FundManager:claimFundRewards()
else
local baseReward = DataManager.FundData:getBaseFundRewards(self.fundId)
local baseReward = DataManager.GrowthFundData:getBaseFundRewards(self.fundId)
local reward = baseReward and baseReward[1]
if reward then
ModuleManager.TipsManager:showRewardTips(reward.id, reward.type, self.fundRewardCell2:getBaseObject())
end
end
end)
self.fundRewardCell3 = uiMap["level_fund_cell.fund_reward_cell_3"]:addLuaComponent(Fund_REWARD_CELL)
self.fundRewardCell3 = uiMap["growth_fund_cell.fund_reward_cell_3"]:addLuaComponent(Fund_REWARD_CELL)
self.fundRewardCell3:addClickListener(function()
if self.fundId == nil then
return
end
local iCslaimed = DataManager.FundData:getIsClaimedAdvance(self.fundId)
local needLevel = DataManager.FundData:getNeedLevel(self.fundId)
local iCslaimed = DataManager.GrowthFundData:getIsClaimedAdvance(self.fundId)
local needLevel = DataManager.GrowthFundData:getNeedLevel(self.fundId)
local playerLevel = DataManager.PlayerData:getLv()
if not iCslaimed and playerLevel >= needLevel and DataManager.FundData:getIsBoughtAdvance(self.fundId) then
if not iCslaimed and playerLevel >= needLevel and DataManager.GrowthFundData:getIsBoughtAdvance(self.fundId) then
ModuleManager.FundManager:claimFundRewards()
else
local advanceReward = DataManager.FundData:getAdvanceFundRewards(self.fundId)
local advanceReward = DataManager.GrowthFundData:getAdvanceFundRewards(self.fundId)
local reward = advanceReward and advanceReward[1]
if reward then
ModuleManager.TipsManager:showRewardTips(reward.id, reward.type, self.fundRewardCell3:getBaseObject())
@ -62,28 +62,28 @@ function LevelFundCell:init()
end
end)
self.fundRewardCell3:setAnchoredPositionX(width/3)
self.levelBg = uiMap["level_fund_cell.lv_bg"]
self.levelBg = uiMap["growth_fund_cell.lv_bg"]
self.levelBg:setAnchoredPositionX(-width/6)
self.levelGrayImg = uiMap["level_fund_cell.lv_bg.gray"]
self.levelTx = uiMap["level_fund_cell.lv_bg.tx"]
self.levelGrayImg = uiMap["growth_fund_cell.lv_bg.gray"]
self.levelTx = uiMap["growth_fund_cell.lv_bg.tx"]
end
function LevelFundCell:refresh(id)
function GrowthFundCell:refresh(id)
self.fundId = id
local FundData = DataManager.FundData
local needLevel = DataManager.FundData:getNeedLevel(id)
local GrowthFundData = DataManager.GrowthFundData
local needLevel = DataManager.GrowthFundData:getNeedLevel(id)
local playerLevel = DataManager.PlayerData:getLv()
local isActive = playerLevel >= needLevel
self.levelGrayImg:setVisible(not isActive)
self.levelTx:setText(GFunc.intToString(needLevel))
local freeReward, baseReward, advanceReward = FundData:getAllStepFundRewards(id)
self.fundRewardCell1:refresh(freeReward[1], isActive and 1 or 0, false, FundData:getIsClaimedFree(id))
self.fundRewardCell2:refresh(baseReward[1], isActive and 2 or 0, not FundData:getIsBoughtBase(id), FundData:getIsClaimedBase(id))
self.fundRewardCell3:refresh(advanceReward[1], isActive and 3 or 0, not FundData:getIsBoughtAdvance(id), FundData:getIsClaimedAdvance(id))
local freeReward, baseReward, advanceReward = GrowthFundData:getAllStepFundRewards(id)
self.fundRewardCell1:refresh(freeReward[1], isActive and 1 or 0, false, GrowthFundData:getIsClaimedFree(id))
self.fundRewardCell2:refresh(baseReward[1], isActive and 2 or 0, not GrowthFundData:getIsBoughtBase(id), GrowthFundData:getIsClaimedBase(id))
self.fundRewardCell3:refresh(advanceReward[1], isActive and 3 or 0, not GrowthFundData:getIsBoughtAdvance(id), GrowthFundData:getIsClaimedAdvance(id))
end
function LevelFundCell:setVisible(visible)
function GrowthFundCell:setVisible(visible)
self.baseObject:setVisible(visible)
end
return LevelFundCell
return GrowthFundCell

View File

@ -1,5 +1,5 @@
fileFormatVersion: 2
guid: 3380bc95e342186458dd56f3cdd4e4f0
guid: 2bc37d625f652654b83c5cedaaa8c2f1
ScriptedImporter:
internalIDToNameTable: []
externalObjects: {}

View File

@ -1,6 +1,6 @@
local LevelFundRewardCell = class("LevelFundRewardCell", BaseCell)
local GrowthFundRewardCell = class("GrowthFundRewardCell", BaseCell)
function LevelFundRewardCell:init()
function GrowthFundRewardCell:init()
local uiMap = self:getUIMap()
self.bg = uiMap["fund_reward_cell.bg"]
self.icon = uiMap["fund_reward_cell.icon"]
@ -18,7 +18,7 @@ function LevelFundRewardCell:init()
end)
end
function LevelFundRewardCell:refresh(reward, step, isLock, showCheck)
function GrowthFundRewardCell:refresh(reward, step, isLock, showCheck)
if step == 0 then
self.bg:setSprite(GConst.ATLAS_PATH.FUND, "fund_bg_5")
elseif step == 1 then
@ -49,7 +49,7 @@ function LevelFundRewardCell:refresh(reward, step, isLock, showCheck)
end
end
function LevelFundRewardCell:_refreshItem(item)
function GrowthFundRewardCell:_refreshItem(item)
local info = ConfigManager:getConfig("item")[item.id]
if info == nil then
return
@ -71,20 +71,20 @@ function LevelFundRewardCell:_refreshItem(item)
end
end
function LevelFundRewardCell:setVisible(visible)
function GrowthFundRewardCell:setVisible(visible)
self.baseObject:setActive(visible)
end
function LevelFundRewardCell:setAnchoredPositionX(x)
function GrowthFundRewardCell:setAnchoredPositionX(x)
self.baseObject:setAnchoredPositionX(x)
end
function LevelFundRewardCell:setTouchEnable(enable)
function GrowthFundRewardCell:setTouchEnable(enable)
self.baseObject:setTouchEnable(enable)
end
function LevelFundRewardCell:addClickListener(callback)
function GrowthFundRewardCell:addClickListener(callback)
self.clickCallback = callback
end
return LevelFundRewardCell
return GrowthFundRewardCell

View File

@ -1,5 +1,5 @@
fileFormatVersion: 2
guid: 7f29b4252c5aeb64abafe246ea6c16e5
guid: 3e3a08bdfecbd8b49ada85fa70fe5c8b
ScriptedImporter:
internalIDToNameTable: []
externalObjects: {}

View File

@ -1,10 +1,10 @@
local LevelFundUI = class("LevelFundUI", BaseUI)
local GrowthFundUI = class("GrowthFundUI", BaseUI)
function LevelFundUI:isFullScreen()
function GrowthFundUI:isFullScreen()
return true
end
function LevelFundUI:getCurrencyParams()
function GrowthFundUI:getCurrencyParams()
if self.currencyParams == nil then
self.currencyParams = {
itemIds = {
@ -18,21 +18,21 @@ function LevelFundUI:getCurrencyParams()
return self.currencyParams
end
function LevelFundUI:getPrefabPath()
return "assets/prefabs/ui/fund/level_fund_ui.prefab"
function GrowthFundUI:getPrefabPath()
return "assets/prefabs/ui/fund/growth_fund_ui.prefab"
end
function LevelFundUI:ctor()
self.fundLevel = DataManager.FundData:getFundLevel()
self:initLevelInfoList()
function GrowthFundUI:ctor()
self.fundGrade = DataManager.GrowthFundData:getFundGrade()
self:initGradeInfoList()
end
function LevelFundUI:initLevelInfoList()
self.levelInfoList = DataManager.FundData:getCurrLevelInfoList()
function GrowthFundUI:initGradeInfoList()
self.gradeInfoList = DataManager.GrowthFundData:getCurrGradeInfoList()
local playerLevel = DataManager.PlayerData:getLv()
local cfg = ConfigManager:getConfig("act_level_fund")
self.inactiveIndex = nil
for k, v in ipairs(self.levelInfoList) do
for k, v in ipairs(self.gradeInfoList) do
if cfg[v] then
if playerLevel < cfg[v].level then
self.inactiveIndex = k
@ -41,20 +41,20 @@ function LevelFundUI:initLevelInfoList()
end
end
if self.inactiveIndex == nil then
self.inactiveIndex = #self.levelInfoList + 1
self.inactiveIndex = #self.gradeInfoList + 1
end
end
function LevelFundUI:onClose()
function GrowthFundUI:onClose()
if self.originTitleBgHeight then
self.uiMap["level_fund_ui.title_img.bg"]:setSizeDeltaY(self.originTitleBgHeight)
self.uiMap["growth_fund_ui.title_img.bg"]:setSizeDeltaY(self.originTitleBgHeight)
end
end
function LevelFundUI:onLoadRootComplete()
function GrowthFundUI:onLoadRootComplete()
self.uiMap = self.root:genAllChildren()
self.uiMap["level_fund_ui.down.close_btn"]:addClickListener(function()
self.uiMap["growth_fund_ui.down.close_btn"]:addClickListener(function()
self:closeUI()
end)
@ -64,77 +64,77 @@ function LevelFundUI:onLoadRootComplete()
self:bindData()
end
function LevelFundUI:initTitle()
self.titleTx = self.uiMap["level_fund_ui.title_img.title_tx"]
self.titleDialogBg = self.uiMap["level_fund_ui.title_img.bg"]
function GrowthFundUI:initTitle()
self.titleTx = self.uiMap["growth_fund_ui.title_img.title_tx"]
self.titleDialogBg = self.uiMap["growth_fund_ui.title_img.bg"]
self.originTitleBgHeight = self.titleDialogBg:fastGetSizeDeltaY()
end
function LevelFundUI:initPayBtns()
function GrowthFundUI:initPayBtns()
local width = GConst.UI_SCREEN_WIDTH
local freeTx = self.uiMap["level_fund_ui.title_bg_2.free_tx"]
local freeTx = self.uiMap["growth_fund_ui.title_bg_2.free_tx"]
freeTx:setText(I18N:getGlobalText(I18N.GlobalConst.STR_FREE))
freeTx:setAnchoredPositionX(-width/3)
self.payBtn1 = self.uiMap["level_fund_ui.title_bg_2.btn_1"]
self.payBtn1 = self.uiMap["growth_fund_ui.title_bg_2.btn_1"]
self.payBtn1:addClickListener(function()
ModuleManager.FundManager:buyLevelFund(DataManager.FundData:getFundBaseId())
ModuleManager.FundManager:buyLevelFund(DataManager.GrowthFundData:getFundBaseId())
end)
self.payBtnTx1 = self.uiMap["level_fund_ui.title_bg_2.btn_1.text"]
self.payBtnTx1 = self.uiMap["growth_fund_ui.title_bg_2.btn_1.text"]
self.payBtn2 = self.uiMap["level_fund_ui.title_bg_2.btn_2"]
self.payBtn2 = self.uiMap["growth_fund_ui.title_bg_2.btn_2"]
self.payBtn2:setAnchoredPositionX(width/3)
self.payBtn2:addClickListener(function()
ModuleManager.FundManager:buyLevelFund(DataManager.FundData:getFundAdvanceId())
ModuleManager.FundManager:buyLevelFund(DataManager.GrowthFundData:getFundAdvanceId())
end)
self.payBtnTx2 = self.uiMap["level_fund_ui.title_bg_2.btn_2.text"]
self.payBtnTx2 = self.uiMap["growth_fund_ui.title_bg_2.btn_2.text"]
end
function LevelFundUI:initRewards()
self.scrollRect = self.uiMap["level_fund_ui.scrollrect"]
function GrowthFundUI:initRewards()
self.scrollRect = self.uiMap["growth_fund_ui.scrollrect"]
self.scrollRectComp = self.scrollRect:addLuaComponent(GConst.TYPEOF_LUA_CLASS.SCROLL_RECT_BASE)
self.scrollRectComp:addInitCallback(function()
return "app/ui/fund/cell/level_fund_cell"
return "app/ui/fund/cell/growth_fund_cell"
end)
self.scrollRectComp:addRefreshCallback(function(index, cell)
cell:refresh(self.levelInfoList[index])
cell:refresh(self.gradeInfoList[index])
end)
self.scrollRectComp:clearCells()
self.scrollRectComp:setTotalCount(0)
self.progressBg = self.uiMap["level_fund_ui.scrollrect.viewport.content.progress_bg"]
self.progressComp = self.uiMap["level_fund_ui.scrollrect.viewport.content.progress_bg.progress"]:getComponent(GConst.TYPEOF_UNITY_CLASS.BF_SLIDER)
self.grayImg = self.uiMap["level_fund_ui.scrollrect.viewport.content.gray_img"]
self.horizontalLine = self.uiMap["level_fund_ui.scrollrect.viewport.content.line_img"]
self.verticalLine1 = self.uiMap["level_fund_ui.scrollrect.viewport.content.vertical_line_1"]
self.verticalLine2 = self.uiMap["level_fund_ui.scrollrect.viewport.content.vertical_line_2"]
self.progressBg = self.uiMap["growth_fund_ui.scrollrect.viewport.content.progress_bg"]
self.progressComp = self.uiMap["growth_fund_ui.scrollrect.viewport.content.progress_bg.progress"]:getComponent(GConst.TYPEOF_UNITY_CLASS.BF_SLIDER)
self.grayImg = self.uiMap["growth_fund_ui.scrollrect.viewport.content.gray_img"]
self.horizontalLine = self.uiMap["growth_fund_ui.scrollrect.viewport.content.line_img"]
self.verticalLine1 = self.uiMap["growth_fund_ui.scrollrect.viewport.content.vertical_line_1"]
self.verticalLine2 = self.uiMap["growth_fund_ui.scrollrect.viewport.content.vertical_line_2"]
end
function LevelFundUI:bindData()
self:bind(DataManager.FundData, "dirty", function()
if self.fundLevel ~= DataManager.FundData:getFundLevel() then
self.fundLevel = DataManager.FundData:getFundLevel()
self:initLevelInfoList()
function GrowthFundUI:bindData()
self:bind(DataManager.GrowthFundData, "dirty", function()
if self.fundGrade ~= DataManager.GrowthFundData:getFundGrade() then
self.fundGrade = DataManager.GrowthFundData:getFundGrade()
self:initGradeInfoList()
end
self:onRefresh()
end)
end
function LevelFundUI:onRefresh()
function GrowthFundUI:onRefresh()
self:refreshTitle()
self:refreshPayBtns()
self:refreshRewards()
end
function LevelFundUI:refreshTitle()
local fundLevel = DataManager.FundData:getFundLevel()
if fundLevel == 1 then
self.uiMap["level_fund_ui.title_img"]:setTexture("assets/arts/textures/background/fund/fund_bg_1.png")
elseif fundLevel == 2 then
self.uiMap["level_fund_ui.title_img"]:setTexture("assets/arts/textures/background/fund/fund_bg_2.png")
function GrowthFundUI:refreshTitle()
local fundGrade = DataManager.GrowthFundData:getFundGrade()
if fundGrade == 1 then
self.uiMap["growth_fund_ui.title_img"]:setTexture("assets/arts/textures/background/fund/fund_bg_1.png")
elseif fundGrade == 2 then
self.uiMap["growth_fund_ui.title_img"]:setTexture("assets/arts/textures/background/fund/fund_bg_2.png")
end
self.titleTx:setText(I18N:getGlobalText(I18N.GlobalConst.LEVEL_FUND_DESC_1, fundLevel))
self.titleTx:setText(I18N:getGlobalText(I18N.GlobalConst.LEVEL_FUND_DESC_1, fundGrade))
local height = self.titleTx:getComponent(GConst.TYPEOF_UNITY_CLASS.UI_TEXT_MESH_PRO).preferredHeight + 58
if height < self.originTitleBgHeight then
height = self.originTitleBgHeight
@ -142,17 +142,17 @@ function LevelFundUI:refreshTitle()
self.titleDialogBg:setSizeDeltaY(height)
end
function LevelFundUI:refreshPayBtns()
if not DataManager.FundData:getIsBoughtBase() then
local rechargeId = DataManager.FundData:getCurrLevelBaseRechargeId()
function GrowthFundUI:refreshPayBtns()
if not DataManager.GrowthFundData:getIsBoughtBase() then
local rechargeId = DataManager.GrowthFundData:getCurrGradeBaseRechargeId()
self.payBtnTx1:setText(GFunc.getFormatPrice(rechargeId))
self.payBtn1:setTouchEnable(true)
else
self.payBtnTx1:setText(I18N:getGlobalText(I18N.GlobalConst.ALREADY_ACTIVE))
self.payBtn1:setTouchEnable(false)
end
if not DataManager.FundData:getIsBoughtAdvance() then
local rechargeId = DataManager.FundData:getCurrLevelAdvanceRechargeId()
if not DataManager.GrowthFundData:getIsBoughtAdvance() then
local rechargeId = DataManager.GrowthFundData:getCurrGradeAdvanceRechargeId()
self.payBtnTx2:setText(GFunc.getFormatPrice(rechargeId))
self.payBtn2:setTouchEnable(true)
else
@ -161,11 +161,11 @@ function LevelFundUI:refreshPayBtns()
end
end
function LevelFundUI:refreshRewards()
local count = #self.levelInfoList
function GrowthFundUI:refreshRewards()
local count = #self.gradeInfoList
if self.scrollRectComp:getTotalCount() <= 0 then
self.scrollRectComp:refillCells(count)
local minIndex = DataManager.FundData:getMinUnclaimedRewardIndex()
local minIndex = DataManager.GrowthFundData:getMinUnclaimedRewardIndex()
if minIndex > 1 then
self.scrollRectComp:moveToIndex(minIndex)
end
@ -200,4 +200,4 @@ function LevelFundUI:refreshRewards()
self.horizontalLine:setAnchoredPositionY(-topRecoveryOffset - (self.inactiveIndex - 1)*cellWidth)
end
return LevelFundUI
return GrowthFundUI

View File

@ -1,5 +1,5 @@
fileFormatVersion: 2
guid: 14a96472379bd3b45a9544e750fa0f10
guid: 5a975799c3c9cc14fafc8e2c8d9cf4a7
ScriptedImporter:
internalIDToNameTable: []
externalObjects: {}

View File

@ -0,0 +1,42 @@
local SideBarBaseCellComp = require "app/ui/main_city/cell/side_bar_base_cell"
local SideBarBeginnerGiftCell = class("SideBarBeginnerGiftCell", SideBarBaseCellComp)
function SideBarBeginnerGiftCell:getIsOpen()
return DataManager.ShopData:getBeginnerGiftShowSideBar()
end
function SideBarBeginnerGiftCell:getIconRes()
return "main_btn_gift_1"
end
function SideBarBeginnerGiftCell:onClick()
ModuleManager.ShopManager:showGiftPopUI(PayManager.PURCHARSE_TYPE.ACT_GIFT, GConst.ShopConst.BEGINNER_GIFT_ID, true)
end
function SideBarBeginnerGiftCell:getIsShowRedPoint()
return false
end
function SideBarBeginnerGiftCell:onRefresh()
self.timeBg:setVisible(true)
self:_refreshTime()
end
function SideBarBeginnerGiftCell:updateTime()
if self:getIsOpen() then
self:_refreshTime()
else
self:closeBtn()
end
end
function SideBarBeginnerGiftCell:_refreshTime()
local remainTime = DataManager.ShopData:getBeginnerGiftSideBarRemainTime()
if remainTime >= 0 then
self.timeTx:setText(GFunc.getTimeStr(remainTime))
else
self.timeTx:setText("00:00:00")
end
end
return SideBarBeginnerGiftCell

View File

@ -1,5 +1,5 @@
fileFormatVersion: 2
guid: b6e1fcafc8ff9f4459edefaa8e079e3e
guid: b43a4c18aa3ff764691d1792e98936e2
ScriptedImporter:
internalIDToNameTable: []
externalObjects: {}

View File

@ -0,0 +1,24 @@
local SideBarBaseCellComp = require "app/ui/main_city/cell/side_bar_base_cell"
local SideBarFirstRechargeCell = class("SideBarFirstRechargeCell", SideBarBaseCellComp)
function SideBarFirstRechargeCell:getIsOpen()
return DataManager.ShopData:getShowFirstRechargeSideBar()
end
function SideBarFirstRechargeCell:getIconRes()
return "main_btn_gift_3"
end
function SideBarFirstRechargeCell:getIsShowRedPoint()
return DataManager.ShopData:showFirstRechargeRp()
end
function SideBarFirstRechargeCell:onClick()
ModuleManager.ShopManager:showGiftPopUI(PayManager.PURCHARSE_TYPE.ACT_GIFT, GConst.ShopConst.FIRST_RECHARGE_ID, true)
end
function SideBarFirstRechargeCell:getIsShowRedPoint()
return false
end
return SideBarFirstRechargeCell

View File

@ -0,0 +1,10 @@
fileFormatVersion: 2
guid: 19280ea11e6e84d4a8e2c067c3127203
ScriptedImporter:
internalIDToNameTable: []
externalObjects: {}
serializedVersion: 2
userData:
assetBundleName:
assetBundleVariant:
script: {fileID: 11500000, guid: 3b8b241bab4a4ac9a22fcce9c64f1242, type: 3}

View File

@ -0,0 +1,57 @@
local SideBarBaseCellComp = require "app/ui/main_city/cell/side_bar_base_cell"
local SideBarGrowUpGift1Cell = class("SideBarGrowUpGift1Cell", SideBarBaseCellComp)
function SideBarGrowUpGift1Cell:getIsOpen()
return #DataManager.ShopData:getValidGrowUpGifts() >= 1
end
function SideBarGrowUpGift1Cell:getIconRes()
return "main_btn_gift_2"
end
function SideBarGrowUpGift1Cell:onClick()
local gift = DataManager.ShopData:getValidGrowUpGifts()[1]
if gift then
ModuleManager.ShopManager:showGiftPopUI(PayManager.PURCHARSE_TYPE.GROW_UP_GIFT, gift.current_grow_up_id, true)
end
end
function SideBarGrowUpGift1Cell:getIsShowRedPoint()
return false
end
function SideBarGrowUpGift1Cell:onRefresh()
self.timeBg:setVisible(true)
self:_refreshTime()
end
function SideBarGrowUpGift1Cell:updateTime()
if self:getIsOpen() then
self:_refreshTime()
else
self:closeBtn()
end
end
function SideBarGrowUpGift1Cell:_refreshTime()
local gift = DataManager.ShopData:getValidGrowUpGifts()[1]
if gift then
local cfgInfo = DataManager.ShopData:getActGrowUpGiftConfig()[gift.current_grow_up_id]
if cfgInfo then
local durationTime = (cfgInfo.limit_time or 0) * 3600
local triggerTime = gift.trigger_at // 1000
local remainTime = triggerTime + durationTime - Time:getServerTime()
if remainTime >= 0 then
self.timeTx:setText(GFunc.getTimeStr(remainTime))
else
self.timeTx:setText("00:00:00")
end
else
self.timeTx:setText("00:00:00")
end
else
self.timeTx:setText("00:00:00")
end
end
return SideBarGrowUpGift1Cell

View File

@ -0,0 +1,10 @@
fileFormatVersion: 2
guid: 297d71f3bc4702a40a96511df082c7ad
ScriptedImporter:
internalIDToNameTable: []
externalObjects: {}
serializedVersion: 2
userData:
assetBundleName:
assetBundleVariant:
script: {fileID: 11500000, guid: 3b8b241bab4a4ac9a22fcce9c64f1242, type: 3}

View File

@ -0,0 +1,57 @@
local SideBarBaseCellComp = require "app/ui/main_city/cell/side_bar_base_cell"
local SideBarGrowUpGift2Cell = class("SideBarGrowUpGift2Cell", SideBarBaseCellComp)
function SideBarGrowUpGift2Cell:getIsOpen()
return #DataManager.ShopData:getValidGrowUpGifts() >= 2
end
function SideBarGrowUpGift2Cell:getIconRes()
return "main_btn_gift_2"
end
function SideBarGrowUpGift2Cell:onClick()
local gift = DataManager.ShopData:getValidGrowUpGifts()[2]
if gift then
ModuleManager.ShopManager:showGiftPopUI(PayManager.PURCHARSE_TYPE.GROW_UP_GIFT, gift.current_grow_up_id, true)
end
end
function SideBarGrowUpGift2Cell:getIsShowRedPoint()
return false
end
function SideBarGrowUpGift2Cell:onRefresh()
self.timeBg:setVisible(true)
self:_refreshTime()
end
function SideBarGrowUpGift2Cell:updateTime()
if self:getIsOpen() then
self:_refreshTime()
else
self:closeBtn()
end
end
function SideBarGrowUpGift2Cell:_refreshTime()
local gift = DataManager.ShopData:getValidGrowUpGifts()[2]
if gift then
local cfgInfo = DataManager.ShopData:getActGrowUpGiftConfig()[gift.current_grow_up_id]
if cfgInfo then
local durationTime = (cfgInfo.limit_time or 0) * 3600
local triggerTime = gift.trigger_at // 1000
local remainTime = triggerTime + durationTime - Time:getServerTime()
if remainTime >= 0 then
self.timeTx:setText(GFunc.getTimeStr(remainTime))
else
self.timeTx:setText("00:00:00")
end
else
self.timeTx:setText("00:00:00")
end
else
self.timeTx:setText("00:00:00")
end
end
return SideBarGrowUpGift2Cell

View File

@ -0,0 +1,10 @@
fileFormatVersion: 2
guid: 2dded7533782f8247b5d11e2eedfdd21
ScriptedImporter:
internalIDToNameTable: []
externalObjects: {}
serializedVersion: 2
userData:
assetBundleName:
assetBundleVariant:
script: {fileID: 11500000, guid: 3b8b241bab4a4ac9a22fcce9c64f1242, type: 3}

View File

@ -0,0 +1,24 @@
local SideBarBaseCellComp = require "app/ui/main_city/cell/side_bar_base_cell"
local SideBarGrowthFundCell = class("SideBarGrowthFundCell", SideBarBaseCellComp)
function SideBarGrowthFundCell:getIsOpen()
return DataManager.GrowthFundData:getIsOpen()
end
function SideBarGrowthFundCell:getIconRes()
return "main_btn_fund"
end
function SideBarGrowthFundCell:onClick()
ModuleManager.FundManager:showLevelFundUI()
end
function SideBarGrowthFundCell:getIsShowRedPoint()
return DataManager.GrowthFundData:getIfCanClaimReward()
end
function SideBarGrowthFundCell:getHasShake()
return true
end
return SideBarGrowthFundCell

View File

@ -0,0 +1,10 @@
fileFormatVersion: 2
guid: 89fd1069c28a504499e23bd0718b4d8a
ScriptedImporter:
internalIDToNameTable: []
externalObjects: {}
serializedVersion: 2
userData:
assetBundleName:
assetBundleVariant:
script: {fileID: 11500000, guid: 3b8b241bab4a4ac9a22fcce9c64f1242, type: 3}

View File

@ -1,24 +0,0 @@
local SideBarBaseCellComp = require "app/ui/main_city/cell/side_bar_base_cell"
local SideBarLevelFundCell = class("SideBarLevelFundCell", SideBarBaseCellComp)
function SideBarLevelFundCell:getIsOpen()
return DataManager.FundData:getIsOpen()
end
function SideBarLevelFundCell:getIconRes()
return "main_btn_fund"
end
function SideBarLevelFundCell:onClick()
ModuleManager.FundManager:showLevelFundUI()
end
function SideBarLevelFundCell:getIsShowRedPoint()
return DataManager.FundData:getIfCanClaimReward()
end
function SideBarLevelFundCell:getHasShake()
return true
end
return SideBarLevelFundCell

View File

@ -2,6 +2,10 @@ local UIPrefabObject = require "app/bf/unity/uiprefab_object"
local MainCityUI = class("MainCityUI", BaseUI)
local SIDE_BAR_BORDER_OFFSET = 12
local SIDE_BAR_INTERVAL = 14
local SIDE_BAR_ARROW_INTERVAL = 20
local BF_UI_HELPER = GConst.TYPEOF_UNITY_CLASS.BF_UI_HELPER
local HERO_COMP = "app/ui/hero/hero_comp"
local MAIN_COMP = "app/ui/main_city/component/main_comp"
@ -126,6 +130,18 @@ function MainCityUI:_addListeners()
-- 引导完成时 检测主界面的弹窗是否要触发
self:checkGift()
end)
self:addEventListener(EventManager.CUSTOM_EVENT.GO_SHOP, function()
if ModuleManager:getIsOpen(ModuleManager.MODULE_KEY.MALL, false) then
if self.selectedIndex == MainCityUI.CLICK_BTN_TYPE[3] then
return
end
BIReport:postHomeBtnCilck(BIReport.CLICK_BTN_TYPE[MainCityUI.CLICK_BTN_TYPE[3]])
self.bottomBtnSpines[3]:playAnimComplete("born", false, false, function()
self.bottomBtnSpines[3]:playAnim("idle", false, false)
end)
self:refreshBottom(3, true)
end
end)
DataManager.MailData:checkNewMail()
end
@ -186,6 +202,7 @@ function MainCityUI:_bind()
self.subComps[self.selectedIndex]:refresh()
end
end
self:refreshBottomRp()
end)
self:bind(DataManager.SummonData, "isDirty", function()
if self.selectedIndex == GConst.MainCityConst.BOTTOM_PAGE.SHOP and self.subComps[self.selectedIndex] then
@ -211,6 +228,11 @@ function MainCityUI:initBottomUI()
for i = 1, 3 do
local cellCom = CellManager:addCellComp(uiMap["main_ui.bottom_node.bottom_btn_cell_" .. i], BOTTOM_BTN_CELL)
cellCom:addClickListener(function()
if i == 3 then -- 商城有开启条件
if not ModuleManager:getIsOpen(ModuleManager.MODULE_KEY.MALL, false) then
return
end
end
if self.selectedIndex == i then
return
end
@ -389,14 +411,14 @@ function MainCityUI:refreshLeftBtns()
return
end
self.leftNode:setAnchoredPositionX(0)
local y = - 2 - self.sideBarHeight/2
local y = -SIDE_BAR_BORDER_OFFSET - self.sideBarHeight/2
if isClose then -- 只显示一个
local first = self.leftBarList[1]
first:setAnchoredPositionY(y)
first:setVisible(true)
first:setActive(true)
first:refresh()
y = y - self.sideBarHeight - 2
y = y - self.sideBarHeight - SIDE_BAR_INTERVAL
for i = 2, #self.leftBarList do
self.leftBarList[i]:setVisible(false)
self.leftBarList[i]:setActive(true)
@ -408,12 +430,14 @@ function MainCityUI:refreshLeftBtns()
v:setVisible(true)
v:setActive(true)
v:refresh()
y = y - self.sideBarHeight - 2
y = y - self.sideBarHeight - SIDE_BAR_INTERVAL
end
end
local arrowHeight = self.leftArrowBtn:getRectHeight()
y = y + self.sideBarHeight/2 - SIDE_BAR_ARROW_INTERVAL - arrowHeight
self.leftSideBar:setSizeDeltaY(-y)
self.leftArrowImg:setLocalScale(1, isClose and -1 or 1, 1)
self.leftArrowBtn:setAnchoredPositionY(self.leftSideBar:fastGetAnchoredPositionY() + y + 20)
self.leftArrowBtn:setAnchoredPositionY(self.leftSideBar:fastGetAnchoredPositionY() + y + arrowHeight/2 + SIDE_BAR_BORDER_OFFSET)
end
function MainCityUI:openOrCloseRightSideBar()
@ -454,14 +478,14 @@ function MainCityUI:refreshRightBtns()
return
end
self.rightNode:setAnchoredPositionX(0)
local y = -2 - self.sideBarHeight/2
local y = -SIDE_BAR_BORDER_OFFSET - self.sideBarHeight/2
if isClose then -- 只显示一个
local first = self.rightBarList[1]
first:setAnchoredPositionY(y)
first:setVisible(true)
first:setActive(true)
first:refresh()
y = y - self.sideBarHeight - 2
y = y - self.sideBarHeight - SIDE_BAR_INTERVAL
for i = 2, #self.rightBarList do
self.rightBarList[i]:setVisible(false)
self.rightBarList[i]:setActive(true)
@ -473,12 +497,14 @@ function MainCityUI:refreshRightBtns()
v:setVisible(true)
v:setActive(true)
v:refresh()
y = y - self.sideBarHeight - 2
y = y - self.sideBarHeight - SIDE_BAR_INTERVAL
end
end
local arrowHeight = self.rightArrowBtn:getRectHeight()
y = y + self.sideBarHeight / 2 - SIDE_BAR_ARROW_INTERVAL - arrowHeight
self.rightSideBar:setSizeDeltaY(-y)
self.rightArrowImg:setLocalScale(1, isClose and -1 or 1, 1)
self.rightArrowBtn:setAnchoredPositionY(self.rightSideBar:fastGetAnchoredPositionY() + y + 20)
self.rightArrowBtn:setAnchoredPositionY(self.rightSideBar:fastGetAnchoredPositionY() + y + arrowHeight/2 + SIDE_BAR_BORDER_OFFSET)
end
function MainCityUI:clearSideBarList(sideBarList)
@ -751,6 +777,12 @@ function MainCityUI:refreshBottomRp()
else
heroRpObj:removeRedPoint()
end
local shopRpObj = uiMap["main_ui.bottom_node.icons.ui_spine_obj_3.rp_node"]
if DataManager.ShopData:getRp() then
shopRpObj:addRedPoint(0, 0, 1)
else
shopRpObj:removeRedPoint()
end
end
function MainCityUI:refreshSettingBtn()
@ -834,6 +866,7 @@ function MainCityUI:checkGift()
-- 先遍历找出符合弹出的类型
local beginnerGiftIds = {}
local levelUpGiftIds = {}
local firstRechargeIds = {}
for _, actId in ipairs(popUpGift) do
local cfgInfo = DataManager.ShopData:getActGiftConfig()[actId]
if cfgInfo then
@ -845,8 +878,17 @@ function MainCityUI:checkGift()
if cfgInfo.type == PayManager.PURCHARSE_ACT_TYPE.LEVEL_UP_GIFT then
table.insert(levelUpGiftIds, actId)
end
-- 首充礼包
if cfgInfo.type == PayManager.PURCHARSE_ACT_TYPE.FIRST_RECHARGE then
table.insert(firstRechargeIds, actId)
end
end
end
-- 首充礼包
if #firstRechargeIds then
ModuleManager.ShopManager:triggerGiftPopUI(PayManager.PURCHARSE_TYPE.ACT_GIFT, firstRechargeIds[1])
return true
end
-- 新手礼包
if #beginnerGiftIds > 0 then
ModuleManager.ShopManager:triggerGiftPopUI(PayManager.PURCHARSE_TYPE.ACT_GIFT, beginnerGiftIds[1])
@ -857,8 +899,6 @@ function MainCityUI:checkGift()
ModuleManager.ShopManager:triggerGiftPopUI(PayManager.PURCHARSE_TYPE.ACT_GIFT, levelUpGiftIds[1])
return true
end
return true
end
-- 特殊的 成长礼包
local popUpGift = DataManager.ShopData:getPopUpGiftByType(PayManager.PURCHARSE_TYPE.GROW_UP_GIFT)

View File

@ -1,12 +1,12 @@
local BoxHeroUI = class("BoxHeroUI", BaseUI)
local TITLE_TEXT = {
[GConst.SummonConst.SUMMON_TYPE.LV_1] = "普通宝箱TD", -- TODOJ
[GConst.SummonConst.SUMMON_TYPE.LV_2] = "精致宝箱TD",
[GConst.SummonConst.SUMMON_TYPE.LV_3] = "珍贵宝箱TD"
[GConst.SummonConst.SUMMON_TYPE.LV_1] = I18N:getGlobalText(I18N.GlobalConst.SHOP_DESC_1), -- 普通宝箱
[GConst.SummonConst.SUMMON_TYPE.LV_2] = I18N:getGlobalText(I18N.GlobalConst.SHOP_DESC_2), -- 精致宝箱
[GConst.SummonConst.SUMMON_TYPE.LV_3] = I18N:getGlobalText(I18N.GlobalConst.SHOP_DESC_3), -- 珍贵宝箱
}
local ICON_NAME = {
[GConst.SummonConst.SUMMON_TYPE.LV_1] = "shop_chest_1", -- TODOJ
[GConst.SummonConst.SUMMON_TYPE.LV_1] = "shop_chest_1",
[GConst.SummonConst.SUMMON_TYPE.LV_2] = "shop_chest_2",
[GConst.SummonConst.SUMMON_TYPE.LV_3] = "shop_chest_3"
}

View File

@ -36,7 +36,7 @@ function BoxLevelUI:onLoadRootComplete()
self.box1Add2ItemCell = CellManager:addCellComp(self.uiMap["box_level_ui.bg.box_1.add_node_2.item_cell"], GConst.TYPEOF_LUA_CLASS.ITEM_CELL)
self.box1Add2Text = self.uiMap["box_level_ui.bg.box_1.add_node_2.text"]
self.box1Desc = self.uiMap["box_level_ui.bg.box_1.none_text"]
self.box1Desc:setText("无额外奖励加成TD") -- TODOJ
self.box1Desc:setText(I18N:getGlobalText(I18N.GlobalConst.SHOP_DESC_4)) -- 无额外奖励加成
self.box2Node = self.uiMap["box_level_ui.bg.box_2"]
self.box2Add1Node = self.uiMap["box_level_ui.bg.box_2.add_node_1"]
@ -46,7 +46,7 @@ function BoxLevelUI:onLoadRootComplete()
self.box2Add2ItemCell = CellManager:addCellComp(self.uiMap["box_level_ui.bg.box_2.add_node_2.item_cell"], GConst.TYPEOF_LUA_CLASS.ITEM_CELL)
self.box2Add2Text = self.uiMap["box_level_ui.bg.box_2.add_node_2.text"]
self.box2Desc = self.uiMap["box_level_ui.bg.box_2.none_text"]
self.box2Desc:setText("无额外奖励加成TD") -- TODOJ
self.box2Desc:setText(I18N:getGlobalText(I18N.GlobalConst.SHOP_DESC_4)) -- 无额外奖励加成
self.box3Node = self.uiMap["box_level_ui.bg.box_3"]
self.box3Add1Node = self.uiMap["box_level_ui.bg.box_3.add_node_1"]
@ -56,10 +56,10 @@ function BoxLevelUI:onLoadRootComplete()
self.box3Add2ItemCell = CellManager:addCellComp(self.uiMap["box_level_ui.bg.box_3.add_node_2.item_cell"], GConst.TYPEOF_LUA_CLASS.ITEM_CELL)
self.box3Add2Text = self.uiMap["box_level_ui.bg.box_3.add_node_2.text"]
self.box3Desc = self.uiMap["box_level_ui.bg.box_3.none_text"]
self.box3Desc:setText("无额外奖励加成TD") -- TODOJ
self.box3Desc:setText(I18N:getGlobalText(I18N.GlobalConst.SHOP_DESC_4)) -- 无额外奖励加成
self.bottomDesc = self.uiMap["box_level_ui.bg.title"]
self.bottomDesc:setText("开宝箱提升等级增加宝箱奖励TD") -- TODOJ
self.bottomDesc:setText(I18N:getGlobalText(I18N.GlobalConst.SHOP_DESC_5)) -- 开宝箱提升等级,增加宝箱奖励
self.leftArrow:addClickListener(function()
self.level = self.level - 1

View File

@ -30,7 +30,7 @@ function BoxLevelUpUI:onLoadRootComplete()
self.box1Add2ItemCell = CellManager:addCellComp(self.uiMap["box_level_up_ui.box_1.add_node_2.item_cell"], GConst.TYPEOF_LUA_CLASS.ITEM_CELL)
self.box1Add2Text = self.uiMap["box_level_up_ui.box_1.add_node_2.text"]
self.box1Desc = self.uiMap["box_level_up_ui.box_1.none_text"]
self.box1Desc:setText("无额外奖励加成TD") -- TODOJ
self.box1Desc:setText(I18N:getGlobalText(I18N.GlobalConst.SHOP_DESC_4)) -- 无额外奖励加成
self.box2Node = self.uiMap["box_level_up_ui.box_2"]
self.box2Add1Node = self.uiMap["box_level_up_ui.box_2.add_node_1"]
@ -40,7 +40,7 @@ function BoxLevelUpUI:onLoadRootComplete()
self.box2Add2ItemCell = CellManager:addCellComp(self.uiMap["box_level_up_ui.box_2.add_node_2.item_cell"], GConst.TYPEOF_LUA_CLASS.ITEM_CELL)
self.box2Add2Text = self.uiMap["box_level_up_ui.box_2.add_node_2.text"]
self.box2Desc = self.uiMap["box_level_up_ui.box_2.none_text"]
self.box2Desc:setText("无额外奖励加成TD") -- TODOJ
self.box2Desc:setText(I18N:getGlobalText(I18N.GlobalConst.SHOP_DESC_4)) -- 无额外奖励加成
self.box3Node = self.uiMap["box_level_up_ui.box_3"]
self.box3Add1Node = self.uiMap["box_level_up_ui.box_3.add_node_1"]
@ -50,7 +50,7 @@ function BoxLevelUpUI:onLoadRootComplete()
self.box3Add2ItemCell = CellManager:addCellComp(self.uiMap["box_level_up_ui.box_3.add_node_2.item_cell"], GConst.TYPEOF_LUA_CLASS.ITEM_CELL)
self.box3Add2Text = self.uiMap["box_level_up_ui.box_3.add_node_2.text"]
self.box3Desc = self.uiMap["box_level_up_ui.box_3.none_text"]
self.box3Desc:setText("无额外奖励加成TD") -- TODOJ
self.box3Desc:setText(I18N:getGlobalText(I18N.GlobalConst.SHOP_DESC_4)) -- 无额外奖励加成
self.closeTx = self.uiMap["box_level_up_ui.close_tx"]
@ -58,9 +58,9 @@ function BoxLevelUpUI:onLoadRootComplete()
end
function BoxLevelUpUI:refresh()
self.titleTx:setText("宝箱等级提升!TD") -- TODOJ
self.titleTx:setText(I18N:getGlobalText(I18N.GlobalConst.SHOP_DESC_6)) -- 宝箱等级提升!
self.lvTx:setText("Lv." .. tostring(self.level))
self.closeTx:setText("点击继续TD") -- TODOJ
self.closeTx:setText(I18N:getGlobalText(I18N.GlobalConst.CLICK_TO_CONTINUE)) -- 点击继续
self.box1Add1Node:setVisible(false)
self.box1Add2Node:setVisible(false)

View File

@ -1,7 +1,7 @@
local BoxOpenUI = class("BoxOpenUI", BaseUI)
local ICON_NAME = {
[GConst.SummonConst.SUMMON_TYPE.LV_1] = "shop_chest_1", -- TODOJ
[GConst.SummonConst.SUMMON_TYPE.LV_1] = "shop_chest_1",
[GConst.SummonConst.SUMMON_TYPE.LV_2] = "shop_chest_2",
[GConst.SummonConst.SUMMON_TYPE.LV_3] = "shop_chest_3"
}
@ -28,7 +28,7 @@ function BoxOpenUI:onLoadRootComplete()
self.btnText = self.uiMap["box_open_ui.open_btn.text"]
self.boxImg:setSprite(GConst.ATLAS_PATH.SHOP, ICON_NAME[self.summonType])
self.btnText:setText("立即打开") -- TODOJ
self.btnText:setText(I18N:getGlobalText(I18N.GlobalConst.SHOP_DESC_7)) -- 立即打开
self.openBtn:addClickListener(function()
ModuleManager.ShopManager:showBoxRewardUI(self.params)

View File

@ -35,7 +35,7 @@ function BoxRewardUI:onLoadRootComplete()
self.uiMap = self.root:genAllChildren()
self.titleTx = self.uiMap["box_reward_ui.title.text"]
self.titleTx:setText("恭喜获得TD") -- TODOJ
self.titleTx:setText(I18N:getGlobalText(I18N.GlobalConst.SHOP_DESC_8)) -- 恭喜获得
self.scrollRectObj = self.uiMap["box_reward_ui.scroll_rect"]
self.scrollRect = self.scrollRectObj:addLuaComponent(GConst.TYPEOF_LUA_CLASS.SCROLL_RECT_BASE)
@ -60,7 +60,7 @@ function BoxRewardUI:onLoadRootComplete()
end
self.closeTx = self.uiMap["box_reward_ui.close_tx"]
self.closeTx:setText("点击关闭TD") -- TODOJ
self.closeTx:setText(I18N:getGlobalText(I18N.GlobalConst.CLICK_CLOSE_DESC))
self.mask = self.uiMap["box_reward_ui.mask"]
self.mask:addClickListener(function()

View File

@ -51,9 +51,9 @@ function BeginnerSellCell:refresh()
self.offImg:setVisible(false)
end
-- 限购
self.limitText:setText("限购1次TD") -- 章节礼包默认限购1次 TODOJ
self.limitText:setText(I18N:getGlobalText(I18N.GlobalConst.SHOP_DESC_18, 1)) -- 限购1次
-- 标题
self.titleText:setText("新手礼包TD") -- TODOJ
self.titleText:setText(I18N:getGlobalText(I18N.GlobalConst.SHOP_DESC_11)) -- 新手礼包
-- 奖励
local rewardList = cfgInfo.reward
local count = rewardList and #rewardList or 0

View File

@ -8,24 +8,24 @@ function BoxSellCell:init()
local uiMap = self.baseObject:genAllChildren()
self.bg = uiMap["box_sell_cell.bg"]
local boxNameTx1 = uiMap["box_sell_cell.bg.box_1.name_tx"]
boxNameTx1:setText("临时文本:普通宝箱")
boxNameTx1:setText(I18N:getGlobalText(I18N.GlobalConst.SHOP_DESC_1)) -- 普通宝箱
local boxDescTx1 = uiMap["box_sell_cell.bg.box_1.desc_tx"]
boxDescTx1:setText("临时文本:必出<color=#5fff57>普通</color>英雄")
boxDescTx1:setText(I18N:getGlobalText(I18N.GlobalConst.SHOP_DESC_24)) -- 必出<color=#5fff57>普通</color>英雄
self.boxBuyBtn1 = uiMap["box_sell_cell.bg.box_1.buy_btn"]
self.boxBuyBtnCoin1 = uiMap["box_sell_cell.bg.box_1.buy_btn.coin"]
self.boxBuyBtnTx1 = uiMap["box_sell_cell.bg.box_1.buy_btn.buy_tx"]
local boxNameTx2 = uiMap["box_sell_cell.bg.box_2.name_tx"]
boxNameTx2:setText("临时文本:精致宝箱")
boxNameTx2:setText(I18N:getGlobalText(I18N.GlobalConst.SHOP_DESC_2)) -- 精致宝箱
local boxDescTx2 = uiMap["box_sell_cell.bg.box_2.desc_tx"]
boxDescTx2:setText("临时文本:必出<color=#8aedff>稀有</color>英雄")
boxDescTx2:setText(I18N:getGlobalText(I18N.GlobalConst.SHOP_DESC_25)) -- 必出<color=#8aedff>稀有</color>英雄
self.boxBuyBtn2 = uiMap["box_sell_cell.bg.box_2.buy_btn"]
self.boxBuyBtnCoin2 = uiMap["box_sell_cell.bg.box_2.buy_btn.coin"]
self.boxBuyBtnTx2 = uiMap["box_sell_cell.bg.box_2.buy_btn.buy_tx"]
self.box3 = uiMap["box_sell_cell.bg.box_3"]
local boxNameTx3 = uiMap["box_sell_cell.bg.box_3.name_tx"]
boxNameTx3:setText("临时文本:珍贵")
boxNameTx3:setText(I18N:getGlobalText(I18N.GlobalConst.SHOP_DESC_3)) -- 珍贵宝箱
local boxDescTx3 = uiMap["box_sell_cell.bg.box_3.desc_tx"]
boxDescTx3:setText("临时文本:必出<color=#ff8af0>史诗</color>英雄")
boxDescTx3:setText(I18N:getGlobalText(I18N.GlobalConst.SHOP_DESC_26)) -- 必出<color=#ff8af0>史诗</color>英雄
self.boxBuyBtn3 = uiMap["box_sell_cell.bg.box_3.buy_btn"]
self.boxBuyBtnCoin3 = uiMap["box_sell_cell.bg.box_3.buy_btn.coin"]
self.boxBuyBtnTx3 = uiMap["box_sell_cell.bg.box_3.buy_btn.buy_tx"]
@ -34,7 +34,7 @@ function BoxSellCell:init()
self.progressTx = uiMap["box_sell_cell.bg.progress_tx"]
self.helpBtn = uiMap["box_sell_cell.bg.help_btn"]
local titleTx = uiMap["box_sell_cell.title_bg.text"]
titleTx:setText("临时文本:宝箱")
titleTx:setText(I18N:getGlobalText(I18N.GlobalConst.SHOP_DESC_27)) -- 宝箱
self.boxBuyBtn1:addClickListener(function()
self:onClickBox(GConst.SummonConst.SUMMON_TYPE.LV_1)
@ -72,12 +72,12 @@ function BoxSellCell:refreshLv()
local lv = DataManager.SummonData:getSummonLevel()
local exp = DataManager.SummonData:getSummonExp()
local maxExp = DataManager.SummonData:getSummonMaxExp()
self.progressLv:setText("Lv." .. tostring(lv)) -- TODOJ
self.progressLv:setText("Lv." .. tostring(lv))
if maxExp and maxExp > 0 then
self.progressTx:setText(tostring(exp) .. "/" .. tostring(maxExp)) -- TODOJ
self.progressTx:setText(tostring(exp) .. "/" .. tostring(maxExp))
self.progressSlider.value = exp / maxExp
else
self.progressTx:setText("MAX") -- TODOJ
self.progressTx:setText(I18N:getGlobalText(I18N.GlobalConst.STR_MAX))
self.progressSlider.value = 1
end
end

View File

@ -67,9 +67,9 @@ function ChapterCell:refresh(idx, cfgInfo, totalCount, arrowCallback)
-- 超值
self.offText:setText(tostring(cfgInfo.value * 100) .. "%")
-- 限购
self.limitText:setText("限购1次TD") -- 章节礼包默认限购1次 TODOJ
self.limitText:setText(I18N:getGlobalText(I18N.GlobalConst.SHOP_DESC_18, 1)) -- 限购1次
-- 标题
self.titleText:setText("" .. tostring(cfgInfo.chapter) .. "章礼包TD") -- TODOJ
self.titleText:setText(I18N:getGlobalText(I18N.GlobalConst.SHOP_DESC_19, tostring(cfgInfo.chapter))) -- 第{0}章礼包
-- 奖励
local rewardList = cfgInfo.reward
local count = rewardList and #rewardList or 0

View File

@ -47,9 +47,9 @@ function CoinSellCell:refresh()
-- 超值
self.offText:setText(tostring(cfgInfo.value) .. "%")
-- 限购
self.limitText:setText("限购" .. tostring(cfgInfo.limit) .. "次TD") -- TODOJ
self.limitText:setText(I18N:getGlobalText(I18N.GlobalConst.SHOP_DESC_18, tostring(cfgInfo.limit))) -- 限购{0}次
-- 标题
self.titleText:setText("金币礼包TD") -- TODOJ
self.titleText:setText(I18N:getGlobalText(I18N.GlobalConst.SHOP_DESC_14))
-- 奖励
local rewardList = cfgInfo.reward
local count = rewardList and #rewardList or 0

View File

@ -17,7 +17,7 @@ function GemCell:init()
self.adText = uiMap["gem_cell.ad.desc"]
self.sellOutText = uiMap["gem_cell.sell_out"]
self.sellOutText:setText("已购买TD") -- TODOJ
self.sellOutText:setText(I18N:getGlobalText(I18N.GlobalConst.SHOP_DESC_20))
end
function GemCell:refresh(id, cfgInfo)
@ -31,6 +31,7 @@ function GemCell:refresh(id, cfgInfo)
local hasDoubleTimes = bought < limit
local leftDoubleTimes = limit - bought
self.icon:setSprite(GConst.ATLAS_PATH.SHOP, GConst.ShopConst.GEM_ICON_NAME[id])
if isFree then -- 免费广告
self.adNode:setVisible(true)
self.priceText:setVisible(false)
@ -39,11 +40,11 @@ function GemCell:refresh(id, cfgInfo)
GFunc.setAdsSprite(self.adImg)
local adLeftCount = adMaxTimes - bought
if adLeftCount > 0 then
self.adText:setText("免费(" .. tostring(adLeftCount) .. ")TD") -- TODOJ
self.adText:setText(I18N:getGlobalText(I18N.GlobalConst.STR_FREE) .. "(" .. tostring(adLeftCount) .. ")") -- 免费(x)
GFunc.centerImgAndTx(self.adImg, self.adText, 5)
self.sellOutText:setVisible(false)
self:getBaseObject():addRedPoint(105, 150, 0.6)
self:getBaseObject():addRedPoint(100, 145, 0.6)
else
self.adNode:setVisible(false)
self.sellOutText:setVisible(true)
@ -56,7 +57,7 @@ function GemCell:refresh(id, cfgInfo)
if hasDoubleTimes then -- 有双倍效果
self.doubleNode:setVisible(true)
self.doubleDesc:setText("剩余次数:" .. tostring(leftDoubleTimes) .. "TD") -- TODOJ
self.doubleDesc:setText(I18N:getGlobalText(I18N.GlobalConst.SHOP_DESC_21, tostring(leftDoubleTimes))) -- 剩余次数:{0}
self.doubleText:setText("+" .. tostring(reward.num * 2))
GFunc.centerImgAndTx(self.doubleImg, self.doubleText, 5)
self.doubleOriginText:setText(reward.num)

View File

@ -3,13 +3,13 @@ local GemSellCell = class("GemSellCell", BaseCell)
function GemSellCell:init()
local uiMap = self.baseObject:genAllChildren()
local titleTx = uiMap["gem_sell_cell.title_bg.text"]
titleTx:setText("临时文本:钻石")
titleTx:setText(ModuleManager.ItemManager:getItemName(GConst.ItemConst.ITEM_ID_GEM))
self.cells = {}
self.cellHeight = 0
local cellHeight = nil
local cfg = ConfigManager:getConfig("mall_treasure")
for i = 1, 19 do -- 正常9个 提审19个 暂未处理提审模式 -- TODOJ
local cfg = DataManager.ShopData:getMallTreasureConfig() -- 审核模式读取另一张表
for i = 1, 19 do -- 正常9个 提审19个
local cell = uiMap["gem_sell_cell.cell_" .. i]
if cellHeight == nil then
local w, h = cell:fastGetSizeDelta()
@ -30,7 +30,7 @@ function GemSellCell:init()
end
function GemSellCell:refresh()
local cfg = ConfigManager:getConfig("mall_treasure")
local cfg = DataManager.ShopData:getMallTreasureConfig()
for k, v in ipairs(self.cells) do
local id = k -- 目前配置表结构如此
v:refresh(id, cfg[id])
@ -49,8 +49,4 @@ function GemSellCell:setVisible(visible)
self.baseObject:setVisible(visible)
end
function GemSellCell:onClickGift(id)
Logger.logHighlight("Click id:%s", id) -- TODOJ
end
return GemSellCell

View File

@ -14,7 +14,7 @@ function GoldCell:init()
self.descText = uiMap["gold_cell.desc"]
self.sellOutText = uiMap["gold_cell.sell_out"]
self.sellOutText:setText("已购买TD") -- TODOJ
self.sellOutText:setText(I18N:getGlobalText(I18N.GlobalConst.SHOP_DESC_20)) -- 已购买
end
function GoldCell:refresh(id, cfgInfo)
@ -23,8 +23,9 @@ function GoldCell:refresh(id, cfgInfo)
local adMaxTimes = cfgInfo.daily or 0
local goldNum = DataManager.ShopData:getCommonDailyCoinNum(idleTime)
self.icon:setSprite(GConst.ATLAS_PATH.SHOP, GConst.ShopConst.COIN_ICON_NAME[id])
local isFree = adMaxTimes > 0
if isFree then -- 免费广告
self.adNode:setVisible(true)
self.costNode:setVisible(false)
@ -33,11 +34,11 @@ function GoldCell:refresh(id, cfgInfo)
local bought = DataManager.ShopData:getCommonDailyCoinAdBuyCount() -- 金币礼包购买次数
local adLeftCount = adMaxTimes - bought
if adLeftCount > 0 then
self.adText:setText("免费(" .. tostring(adLeftCount) .. ")TD") -- TODOJ
self.adText:setText(I18N:getGlobalText(I18N.GlobalConst.STR_FREE) .. "(" .. tostring(adLeftCount) .. ")") -- 免费(x)
GFunc.centerImgAndTx(self.adImg, self.adText, 5)
self.sellOutText:setVisible(false)
self:getBaseObject():addRedPoint(105, 150, 0.6)
self:getBaseObject():addRedPoint(100, 145, 0.6)
else
self.adNode:setVisible(false)
self.sellOutText:setVisible(true)
@ -54,7 +55,7 @@ function GoldCell:refresh(id, cfgInfo)
end
self.nameText:setText(GFunc.num2Str(goldNum))
self.descText:setText("金币礼包:" .. tostring(id) .. "TD") -- TODOJ
self.descText:setText(I18N:getGlobalText(I18N.GlobalConst.SHOP_DESC_14)) -- 金币礼包
self:addClickListener(function()
self:onClickGift(id, isFree)
@ -82,7 +83,16 @@ function GoldCell:onClickGift(id, isAd)
if not GFunc.checkCost(costs.id, costs.num, true) then
return
end
ModuleManager.ShopManager:buyMallIdleCoin(id, isAd)
-- 二次提示
local params = {
content = I18N:getGlobalText(I18N.GlobalConst.SHOP_DESC_33), -- 是否使用钻石刷新每日特惠?
boxType = GConst.MESSAGE_BOX_TYPE.MB_OK_CANCEL,
okText = I18N:getGlobalText(I18N.GlobalConst.BTN_TEXT_OK),
okFunc = function()
ModuleManager.ShopManager:buyMallIdleCoin(id, isAd)
end
}
GFunc.showMessageBox(params)
end
end

View File

@ -3,7 +3,7 @@ local GoldSellCell = class("GoldSellCell", BaseCell)
function GoldSellCell:init()
local uiMap = self.baseObject:genAllChildren()
local titleTx = uiMap["gold_sell_cell.title_bg.text"]
titleTx:setText("临时文本:金币")
titleTx:setText(ModuleManager.ItemManager:getItemName(GConst.ItemConst.ITEM_ID_GOLD))
self.cells = {}
self.cellHeight = 0

View File

@ -46,9 +46,9 @@ function GrowCell:refresh(idx, gift)
-- 超值
self.offText:setText(tostring(cfgInfo.value) .. "%")
-- 限购
self.limitText:setText("限购" .. tostring(cfgInfo.limit) .. "次TD") -- TODOJ
self.limitText:setText(I18N:getGlobalText(I18N.GlobalConst.SHOP_DESC_18, tostring(cfgInfo.limit))) -- 限购{0}次
-- 标题
self.titleText:setText("成长礼包TD") -- TODOJ
self.titleText:setText(I18N:getGlobalText(I18N.GlobalConst.SHOP_DESC_13)) -- 成长礼包
-- 奖励
local rewardList = cfgInfo.reward
local count = rewardList and #rewardList or 0

View File

@ -21,7 +21,7 @@ function HotCell:init()
self.heroNumText = uiMap["hot_cell.hero.num_tx"]
self.sellOutText = uiMap["hot_cell.sell_out"]
self.sellOutText:setText("已购买TD") -- TODOJ
self.sellOutText:setText(I18N:getGlobalText(I18N.GlobalConst.SHOP_DESC_20)) -- 已购买
end
function HotCell:refresh(data)
@ -57,11 +57,11 @@ function HotCell:refresh(data)
GFunc.setAdsSprite(self.adImg)
local adLeftCount = DataManager.ShopData:getMallDailyFirstItemAdMaxCount() - bought
if adLeftCount > 0 then
self.adText:setText("免费(" .. tostring(adLeftCount) .. ")TD") -- TODOJ
self.adText:setText(I18N:getGlobalText(I18N.GlobalConst.STR_FREE) .. "(" .. tostring(adLeftCount) .. ")") -- 免费(x)
GFunc.centerImgAndTx(self.adImg, self.adText, 5)
self.sellOutText:setVisible(false)
self:getBaseObject():addRedPoint(105, 150, 0.6)
self:getBaseObject():addRedPoint(100, 145, 0.6)
else
self.adNode:setVisible(false)
self.sellOutText:setVisible(true)

View File

@ -6,9 +6,9 @@ function HotSellCell:init()
local uiMap = self.baseObject:genAllChildren()
self.cellHeight = self.baseObject:fastGetSizeDeltaY() + 20
uiMap["hot_sell_cell.title_bg.text"]:setText("临时文本:每日特惠")
uiMap["hot_sell_cell.title_bg.text"]:setText(I18N:getGlobalText(I18N.GlobalConst.SHOP_DESC_28)) -- 每日特惠
uiMap["hot_sell_cell.help_btn"]:addClickListener(function()
ModuleManager.TipsManager:showDescTips(I18N:getGlobalText(I18N.GlobalConst.SHOP_DESC_29), uiMap["hot_sell_cell.help_btn"])
end)
self.timeTx = uiMap["hot_sell_cell.time_tx"]
self.cells = {}
@ -30,25 +30,24 @@ end
function HotSellCell:refresh()
local goods = DataManager.ShopData:getMallDailyGoods()
local freeRefreshCount = DataManager.ShopData:getMallDailyAdLeftCount() -- 免费刷新次数
local gemRefreshCount = DataManager.ShopData:getMallDailyDiamondLeftCount() -- 钻石刷新次数
local freeRefreshCount = DataManager.ShopData:getMallDailyAdLeftCount() -- 剩余免费刷新次数
local gemRefreshCount = DataManager.ShopData:getMallDailyDiamondLeftCount() -- 剩余钻石刷新次数
local gemRefreshCost = DataManager.ShopData:getMallDailyDiamondResetCost() -- 钻石刷新消耗
if freeRefreshCount > 0 then
self.refreshBtn:setVisible(true)
self.refreshBtn:setActive(true)
self.refreshAdImg:setVisible(true)
GFunc.setAdsSprite(self.refreshAdImg)
self.refreshGemImg:setVisible(false)
self.refreshText:setText("刷新TD") -- TODOJ
self.refreshBtn:addRedPoint(70, 30, 0.6)
self.refreshText:setText(I18N:getGlobalText(I18N.GlobalConst.STR_REFRESH))
self.refreshBtn:addRedPoint(80, 30, 0.6)
elseif gemRefreshCount > 0 then
self.refreshBtn:setVisible(true)
self.refreshBtn:setActive(true)
self.refreshAdImg:setVisible(false)
self.refreshGemImg:setVisible(true)
self.refreshText:setText(gemRefreshCost)
self.refreshBtn:removeRedPoint()
else
self.refreshBtn:setVisible(false)
self.refreshBtn:setActive(false)
self.refreshBtn:removeRedPoint()
end
@ -68,7 +67,7 @@ function HotSellCell:refreshTime()
if remainTime < 0 then
remainTime = 0
end
self.timeTx:setText("刷新时间TD:" .. GFunc.getTimeStrWithHMS(remainTime)) -- TODOJ
self.timeTx:setText(I18N:getGlobalText(I18N.GlobalConst.SHOP_DESC_22, GFunc.getTimeStrWithHMS(remainTime)))-- 刷新时间:{0}
end
function HotSellCell:getCellHeight()
@ -94,7 +93,16 @@ function HotSellCell:onClickRefresh()
end)
elseif gemRefreshCount > 0 then
if GFunc.checkCost(GConst.ItemConst.ITEM_ID_GEM, gemRefreshCost, true) then
ModuleManager.ShopManager:resetMallDailyGift(2)
-- 二次提示
local params = {
content = I18N:getGlobalText(I18N.GlobalConst.SHOP_DESC_30), -- 是否使用钻石刷新每日特惠?
boxType = GConst.MESSAGE_BOX_TYPE.MB_OK_CANCEL,
okText = I18N:getGlobalText(I18N.GlobalConst.BTN_TEXT_OK),
okFunc = function()
ModuleManager.ShopManager:resetMallDailyGift(2)
end
}
GFunc.showMessageBox(params)
end
end
end

View File

@ -43,9 +43,9 @@ function LevelCell:refresh(idx, cfgInfo, clickCallback)
-- 超值
self.offText:setText(tostring(cfgInfo.value) .. "%")
-- 限购
self.limitText:setText("限购1次TD") -- 默认限购1次 TODOJ
self.limitText:setText(I18N:getGlobalText(I18N.GlobalConst.SHOP_DESC_18, 1)) -- 限购1次
-- 标题
self.titleText:setText(tostring(cfgInfo.parameter) .. "级助力礼包TD") -- TODOJ
self.titleText:setText(I18N:getGlobalText(I18N.GlobalConst.SHOP_DESC_23, tostring(cfgInfo.parameter))) -- {0}级助力礼包
-- 奖励
local rewardList = cfgInfo.reward
local count = rewardList and #rewardList or 0

View File

@ -0,0 +1,107 @@
local FirstRechargePopUI = class("FirstRechargePopUI", BaseUI)
local MAX_ITEM_NUM = 3
function FirstRechargePopUI:ctor()
end
function FirstRechargePopUI:isFullScreen()
return false
end
function FirstRechargePopUI:getPrefabPath()
return "assets/prefabs/ui/shop/first_recharge_pop_ui.prefab"
end
function FirstRechargePopUI:onLoadRootComplete()
self.uiMap = self.root:genAllChildren()
self.uiMap["first_recharge_pop_ui.close_btn"]:addClickListener(function()
self:closeUI()
end)
self.titleTx = self.uiMap["first_recharge_pop_ui.bg.title_bg.title"]
self.titleTx:setText(I18N:getGlobalText(I18N.GlobalConst.SHOP_DESC_34)) -- 首充豪礼
self.itemNodeList = {}
self.itemCellList = {}
self.itemTextList = {}
self.itemHelpList = {}
for i = 1, MAX_ITEM_NUM do
table.insert(self.itemNodeList, self.uiMap["first_recharge_pop_ui.bg.item_" .. i])
table.insert(self.itemCellList, CellManager:addCellComp(self.uiMap["first_recharge_pop_ui.bg.item_".. i .. ".item_cell"], GConst.TYPEOF_LUA_CLASS.ITEM_CELL))
table.insert(self.itemTextList, self.uiMap["first_recharge_pop_ui.bg.item_".. i .. ".num"])
table.insert(self.itemHelpList, self.uiMap["first_recharge_pop_ui.bg.item_" .. i .. ".help"])
end
self.descText = self.uiMap["first_recharge_pop_ui.bg.desc_text"]
self.titleTx:setText(I18N:getGlobalText(I18N.GlobalConst.SHOP_DESC_35)) -- 充值购买任意商品,即可获得如下奖励,仅此一次!
self.funcBtn = self.uiMap["first_recharge_pop_ui.bg.func_btn"]
self.btnJumpText = self.uiMap["first_recharge_pop_ui.bg.func_btn.jump_text"]
self.btnGetText = self.uiMap["first_recharge_pop_ui.bg.func_btn.get_text"]
self.btnIcon = self.uiMap["first_recharge_pop_ui.bg.func_btn.icon"]
self.btnJumpText:setText(I18N:getGlobalText(I18N.GlobalConst.SHOP_DESC_36)) -- 商店
self.btnGetText:setText(I18N:getGlobalText(I18N.GlobalConst.BTN_CLAIM)) -- 领取
self.funcBtn:addClickListener(function()
self:onClickFuncBtn()
end)
self:_bind()
self:refresh()
end
function FirstRechargePopUI:_bind()
self:bind(DataManager.ShopData, "isDirty", function()
self:refresh()
end)
end
function FirstRechargePopUI:refresh()
local cfgInfo = PayManager:getGiftConfigInfo(PayManager.PURCHARSE_TYPE.ACT_GIFT, GConst.ShopConst.FIRST_RECHARGE_ID)
local rewards = cfgInfo.reward or {}
for i = 1, MAX_ITEM_NUM do
if i <= #rewards then
self.itemNodeList[i]:setVisible(true)
self.itemCellList[i]:refreshByCfg(rewards[i].id, 0)
self.itemCellList[i]:setNum("")
self.itemTextList[i]:setText(rewards[i].num)
self.itemCellList[i]:addClickListener(function()
ModuleManager.TipsManager:showItemTips(rewards[i].id, self.itemCellList[i]:getBaseObject())
end)
self.itemHelpList[i]:setVisible(false)
else
self.itemNodeList[i]:setVisible(false)
end
end
-- 对于首充礼包,有跳转商店和领取2个分支
local canGet = DataManager.ShopData:getHasFirstRechargeReward()
if canGet then
self.btnIcon:setVisible(false)
self.btnJumpText:setVisible(false)
self.btnGetText:setVisible(true)
else
local hasGet = DataManager.ShopData:getHasGotFirstRechargeReward()
if hasGet then
self:closeUI()
else
self.btnIcon:setVisible(true)
self.btnJumpText:setVisible(true)
self.btnGetText:setVisible(false)
end
end
end
function FirstRechargePopUI:onClickFuncBtn()
-- 对于首充礼包,有跳转商店和领取2个分支
local canGet = DataManager.ShopData:getHasFirstRechargeReward()
if canGet then
PayManager:purchasePackage(GConst.ShopConst.FIRST_RECHARGE_ID, PayManager.PURCHARSE_TYPE.ACT_GIFT)
else
EventManager:dispatchEvent(EventManager.CUSTOM_EVENT.GO_SHOP)
self:closeUI()
end
end
return FirstRechargePopUI

View File

@ -0,0 +1,10 @@
fileFormatVersion: 2
guid: d1ea4328dc9ac714d8d6e25ef668467e
ScriptedImporter:
internalIDToNameTable: []
externalObjects: {}
serializedVersion: 2
userData:
assetBundleName:
assetBundleVariant:
script: {fileID: 11500000, guid: 3b8b241bab4a4ac9a22fcce9c64f1242, type: 3}

View File

@ -2,21 +2,23 @@ local GiftPopUI = class("GiftPopUI", BaseUI)
local GIFT_BG_NAME = {
[PayManager.PURCHARSE_TYPE.ACT_GIFT] = {
[PayManager.PURCHARSE_ACT_TYPE.BEGINNER_GIFT] = "assets/arts/textures/background/shop/shop_gift_banner_2_1.png", -- TODOJ
[PayManager.PURCHARSE_ACT_TYPE.COIN_GIFT] = "assets/arts/textures/background/shop/shop_gift_banner_5_1.png", -- TODOJ
[PayManager.PURCHARSE_ACT_TYPE.LEVEL_UP_GIFT] = "assets/arts/textures/background/shop/shop_gift_banner_3_1.png", -- TODOJ
[PayManager.PURCHARSE_ACT_TYPE.FIRST_RECHARGE] = "assets/arts/textures/background/shop/shop_gift_banner_1_1.png",
[PayManager.PURCHARSE_ACT_TYPE.BEGINNER_GIFT] = "assets/arts/textures/background/shop/shop_gift_banner_3_1.png",
[PayManager.PURCHARSE_ACT_TYPE.LEVEL_UP_GIFT] = "assets/arts/textures/background/shop/shop_gift_banner_4_1.png",
[PayManager.PURCHARSE_ACT_TYPE.COIN_GIFT] = "assets/arts/textures/background/shop/shop_gift_banner_6_1.png",
},
[PayManager.PURCHARSE_TYPE.CHAPTER_GIFT] = "assets/arts/textures/background/shop/shop_gift_banner_1_1.png", -- TODOJ
[PayManager.PURCHARSE_TYPE.GROW_UP_GIFT] = "assets/arts/textures/background/shop/shop_gift_banner_4_1.png", -- TODOJ
[PayManager.PURCHARSE_TYPE.CHAPTER_GIFT] = "assets/arts/textures/background/shop/shop_gift_banner_2_1.png",
[PayManager.PURCHARSE_TYPE.GROW_UP_GIFT] = "assets/arts/textures/background/shop/shop_gift_banner_5_1.png",
}
local GIFT_TITLE_TEXT = {
[PayManager.PURCHARSE_TYPE.ACT_GIFT] = {
[PayManager.PURCHARSE_ACT_TYPE.BEGINNER_GIFT] = "新手礼包TD", -- TODOJ
[PayManager.PURCHARSE_ACT_TYPE.COIN_GIFT] = "金币礼包TD", -- TODOJ
[PayManager.PURCHARSE_ACT_TYPE.LEVEL_UP_GIFT] = "助力礼包TD", -- TODOJ
[PayManager.PURCHARSE_ACT_TYPE.FIRST_RECHARGE] = I18N:getGlobalText(I18N.GlobalConst.SHOP_DESC_9),
[PayManager.PURCHARSE_ACT_TYPE.BEGINNER_GIFT] = I18N:getGlobalText(I18N.GlobalConst.SHOP_DESC_11),
[PayManager.PURCHARSE_ACT_TYPE.LEVEL_UP_GIFT] = I18N:getGlobalText(I18N.GlobalConst.SHOP_DESC_12),
[PayManager.PURCHARSE_ACT_TYPE.COIN_GIFT] = I18N:getGlobalText(I18N.GlobalConst.SHOP_DESC_14),
},
[PayManager.PURCHARSE_TYPE.CHAPTER_GIFT] = "章节礼包TD", -- TODOJ
[PayManager.PURCHARSE_TYPE.GROW_UP_GIFT] = "成长礼包TD", -- TODOJ
[PayManager.PURCHARSE_TYPE.CHAPTER_GIFT] = I18N:getGlobalText(I18N.GlobalConst.SHOP_DESC_10),
[PayManager.PURCHARSE_TYPE.GROW_UP_GIFT] = I18N:getGlobalText(I18N.GlobalConst.SHOP_DESC_13),
}
local MAX_ITEM_NUM = 4
@ -26,6 +28,7 @@ function GiftPopUI:ctor(params)
self.actType = params.type
self.actId = params.id
self.onlySelf = params.onlySelf -- 有此标记时 关闭直接关闭界面
self.buyCount = DataManager.ShopData:getGiftBoughtNum(self.actType, self.actId) -- 触发时该礼包的购买数量
end
@ -44,7 +47,11 @@ function GiftPopUI:onLoadRootComplete()
self.uiMap = self.root:genAllChildren()
self.uiMap["gift_pop_ui.close_btn"]:addClickListener(function()
self:checkNextPopGiftOrClose()
if self.onlySelf then
self:closeUI()
else
self:checkNextPopGiftOrClose()
end
end)
self.titleTx = self.uiMap["gift_pop_ui.bg.title"]
@ -143,16 +150,69 @@ function GiftPopUI:refresh(needCheck)
self.buyBtnTx:setText(GFunc.getFormatPrice(rechargeId))
end
-- 对于首充礼包,有跳转商店和领取2个分支
if self.actType == PayManager.PURCHARSE_TYPE.ACT_GIFT and self.actId == GConst.ShopConst.FIRST_RECHARGE_ID then
local canGet = DataManager.ShopData:getHasFirstRechargeReward()
if canGet then
self.buyBtnTx:setText(I18N:getGlobalText(I18N.GlobalConst.BTN_CLAIM))
else
local hasGet = DataManager.ShopData:getHasGotFirstRechargeReward()
if hasGet then
self:closeUI()
else
self.buyBtnTx:setText(I18N:getGlobalText(I18N.GlobalConst.SHOP_DESC_15)) -- 前往商店
end
end
end
self:updateTime()
end
function GiftPopUI:updateTime()
-- TODOJ
self.timeNode:setVisible(false)
local hasTime = false
-- 部分礼包有倒计时
if self.actType == PayManager.PURCHARSE_TYPE.ACT_GIFT then
local cfgInfo = DataManager.ShopData:getActGiftConfig()[self.actId]
if cfgInfo then
if cfgInfo and cfgInfo.type == PayManager.PURCHARSE_ACT_TYPE.COIN_GIFT then -- 金币礼包
hasTime = true
local remainTime = 0
local triggerTime = DataManager.ShopData:getCoinGiftTriggerTime()
remainTime = triggerTime + (cfgInfo.limit_time or 0) * 3600 - Time:getServerTime()
if remainTime <= 0 then
remainTime = 0
end
self.timeText:setText(GFunc.getTimeStr(remainTime))
end
end
elseif self.actType == PayManager.PURCHARSE_TYPE.GROW_UP_GIFT then -- 成长礼包
hasTime = true
local remainTime = 0
local cfgInfo = DataManager.ShopData:getActGrowUpGiftConfig()[self.actId]
local gift = DataManager.ShopData:getGrowUpGiftByActId(self.actId)
local triggerTime = (gift and gift.trigger_at or 0) // 1000
remainTime = triggerTime + (cfgInfo.limit_time or 0) * 3600 - Time:getServerTime()
if remainTime <= 0 then
remainTime = 0
end
self.timeText:setText(GFunc.getTimeStr(remainTime))
end
self.timeNode:setVisible(hasTime)
end
function GiftPopUI:onClickGift()
PayManager:purchasePackage(self.actId, self.actType)
-- 对于首充礼包,有跳转商店和领取2个分支
if self.actType == PayManager.PURCHARSE_TYPE.ACT_GIFT and self.actId == GConst.ShopConst.FIRST_RECHARGE_ID then
local canGet = DataManager.ShopData:getHasFirstRechargeReward()
if canGet then
PayManager:purchasePackage(self.actId, self.actType)
else
EventManager:dispatchEvent(EventManager.CUSTOM_EVENT.GO_SHOP)
self:closeUI()
end
else
PayManager:purchasePackage(self.actId, self.actType)
end
end
-- 如果还有需要显示的 则直接刷新而不是关闭本界面

View File

@ -38,10 +38,10 @@ function ShopComp:initTitlePage()
self.subTitleIcon2 = self.uiMap["shop_comp.title_node.btn_cell_2.icon"]
self.subTitleBtn2 = self.uiMap["shop_comp.title_node.btn_cell_2"]
self.subTitleText1:setText("特惠商品TD") -- TODOJ 特惠商品
self.subTitleSelectText1:setText("特惠商品TD") -- TODOJ 特惠商品
self.subTitleText2:setText("主要商品TD") -- TODOJ 主要商品
self.subTitleSelectText2:setText("主要商品TD") -- TODOJ 主要商品
self.subTitleText1:setText(I18N:getGlobalText(I18N.GlobalConst.SHOP_DESC_16)) -- 特惠商品
self.subTitleSelectText1:setText(I18N:getGlobalText(I18N.GlobalConst.SHOP_DESC_16)) -- 特惠商品
self.subTitleText2:setText(I18N:getGlobalText(I18N.GlobalConst.SHOP_DESC_17)) -- 主要商品
self.subTitleSelectText2:setText(I18N:getGlobalText(I18N.GlobalConst.SHOP_DESC_17)) -- 主要商品
self.subTitleBtn1:addClickListener(function()
self:switchPage(PAGE_DISCOUNT)
@ -110,9 +110,6 @@ function ShopComp:initDiscountPage()
self.coinSellCell = self.uiMap["shop_comp.discount.scrollrect.viewport.content.coin_sell_cell"]:addLuaComponent(PAGE_DISCOUNT_COIN_SELL_CELL)
end
function ShopComp:updateMainList()
end
function ShopComp:refresh()
if self.page == PAGE_DISCOUNT then
self.mainNode:setAnchoredPositionX(GConst.NOT_VISIBLE_POS)

View File

@ -37,6 +37,10 @@ function DailyTaskCell:init()
self.lockBg = uiMap["task_cell.lock_bg"]
local lockBtn = uiMap["task_cell.lock_node.lock_btn.btn"]
lockBtn:addClickListener(function()
if DataManager.BountyData:getIsOpen() then
DataManager.BountyData:clearPopBought()
ModuleManager.BountyManager:showBountyMainUI()
end
end)
local lockBtnTx = uiMap["task_cell.lock_node.lock_btn.btn.text"]
lockBtnTx:setText(I18N:getGlobalText(I18N.GlobalConst.STR_UNLOCK))

View File

@ -17,10 +17,10 @@ local function sortTask(taskList)
if completeA then
return a.id < b.id
else -- 没有完成的优先显示战令解锁
if a.bountyLock == b.bountyLock then
if a.lock == b.lock then
return a.id < b.id
else
return a.bountyLock
return b.lock
end
end
else

View File

@ -22,6 +22,7 @@ UIManager.UI_PATH = {
BATTLE_UI = "app/ui/battle/battle_ui",
ROGUE_SKILL_UI = "app/ui/battle/battle_skill_select_ui",
REWARD_BOX = "app/ui/tips/reward_box",
HERO_DETAIL_UI = "app/ui/hero/hero_detail_ui",
}
-- 动画类型

View File

@ -11,6 +11,8 @@ function BattleBoardSkillEntity:ctor(skillId)
self.elementCountEffectEntities = {} -- 根据消除数量获得次数的技能效果 type = 13
self.linkCountMoreEffects = {} -- 链接超过x元素获得一次技能效果 type = 14
self.linkCountPowerEffects = {} -- 链接超过x元素获得倍数技能效果 type = 15
self.skillEffectNumAdd = {} -- 技能效果参数增加 type = 7 用于技能替换时生效
self.skillRoundAdd = {} -- 技能效果回合增加 type = 8 用于技能替换时生效
self.upSkillIdMap = {}
self.getUpSkillKind = 0
@ -446,4 +448,31 @@ function BattleBoardSkillEntity:getLinkCountPowerEffects()
return self.linkCountPowerEffects
end
function BattleBoardSkillEntity:addSkillEffecuNumAdd(effect)
local effectInfo = self.skillEffectNumAdd[effect.type]
if effectInfo then
effectInfo.num = effectInfo.num + effect.num
else
self.skillEffectNumAdd[effect.type] = effect
end
end
function BattleBoardSkillEntity:getSkillEffecuNumAdd()
return self.skillEffectNumAdd
end
function BattleBoardSkillEntity:addSkillRoundAdd(effect)
local effectInfo = self.skillRoundAdd[effect.type]
if effectInfo then
effectInfo.round = effectInfo.round + effect.round
else
self.skillRoundAdd[effect.type] = effect
end
end
function BattleBoardSkillEntity:getSkillRoundAdd()
return self.skillRoundAdd
end
return BattleBoardSkillEntity

View File

@ -115,15 +115,13 @@ function BattleSkillEntity:addSkillEffectParams(effect)
for _, entity in ipairs(self.effectList) do
if entity:getName() == effect.type then
buffEntity = entity
break
buffEntity:setEffectNum(buffEntity:getEffectNum() + effect.num)
end
end
if not buffEntity then
buffEntity = BattleBuffEntity:create()
buffEntity:init(effect, self.owner, self)
table.insert(self.effectList, buffEntity)
else
buffEntity:setEffectNum(buffEntity:getEffectNum() + effect.num)
end
end
@ -132,15 +130,13 @@ function BattleSkillEntity:addSkillEffectRound(effect)
for _, entity in ipairs(self.effectList) do
if entity:getName() == effect.type then
buffEntity = entity
break
buffEntity:setRound(buffEntity:getRound() + effect.round)
end
end
if not buffEntity then
buffEntity = BattleBuffEntity:create()
buffEntity:init(effect, self.owner, self)
table.insert(self.effectList, buffEntity)
else
buffEntity:setRound(buffEntity:getRound() + effect.round)
end
end

View File

@ -335,6 +335,10 @@ function BountyData:markPopBought()
LocalData:setBountyPopTime(self.popBoughtTime)
end
function BountyData:clearPopBought()
self.popBoughtTime = 0
end
function BountyData:getRechargeId(advanced)
local cfg = ConfigManager:getConfig("act_gift")
local id = self:getGiftId(advanced)

View File

@ -1,10 +0,0 @@
fileFormatVersion: 2
guid: d9943057ffc3dd541bfff544d512abee
ScriptedImporter:
internalIDToNameTable: []
externalObjects: {}
serializedVersion: 2
userData:
assetBundleName:
assetBundleVariant:
script: {fileID: 11500000, guid: 3b8b241bab4a4ac9a22fcce9c64f1242, type: 3}

View File

@ -1,16 +1,16 @@
local FundData = class("FundData", BaseData)
local GrowthFundData = class("GrowthFundData", BaseData)
local ACT_GIFT_FUND_BASE_ID_1 = 60202
local ACT_GIFT_FUND_BASE_ID_2 = 60402
local ACT_GIFT_FUND_ADVANCE_ID_1 = 60102
local ACT_GIFT_FUND_ADVANCE_ID_2 = 60302
function FundData:ctor()
function GrowthFundData:ctor()
self.data.dirty = false
self.isClaimAll = false
end
function FundData:init(data)
function GrowthFundData:init(data)
data = data or GConst.EMPTY_TABLE
self.freeClaimed = {}
@ -37,51 +37,51 @@ function FundData:init(data)
self.advanceClaimedCount = self.advanceClaimedCount + 1
end
end
self:initLevelInfo()
self:initFundLevel()
self:initGrowthInfo()
self:initFundGrade()
end
function FundData:initLevelInfo()
if not self.levelInfoMap then
self.levelInfoMap = {}
function GrowthFundData:initGrowthInfo()
if not self.growthInfoMap then
self.growthInfoMap = {}
local cfg = self:getLevelFundCfg()
for id, info in pairs(cfg) do
if not self.levelInfoMap[info.stage] then
self.levelInfoMap[info.stage] = {}
if not self.growthInfoMap[info.stage] then
self.growthInfoMap[info.stage] = {}
end
table.insert(self.levelInfoMap[info.stage], id)
table.insert(self.growthInfoMap[info.stage], id)
end
for level, _ in pairs(self.levelInfoMap) do
table.sort(self.levelInfoMap[level], function(a, b)
for grade, _ in pairs(self.growthInfoMap) do
table.sort(self.growthInfoMap[grade], function(a, b)
return a < b
end)
end
end
end
function FundData:initFundLevel()
local fundLevel = 1
function GrowthFundData:initFundGrade()
local fundGrade = 1
local totalCount = 0
while true do
local levelInfoIds = self.levelInfoMap[fundLevel]
if levelInfoIds == nil then
fundLevel = fundLevel - 1
local growInfoIds = self.growthInfoMap[fundGrade]
if growInfoIds == nil then
fundGrade = fundGrade - 1
break
end
totalCount = totalCount + #levelInfoIds
totalCount = totalCount + #growInfoIds
if self.freeClaimedCount >= totalCount and
self.baseClaimedCount >= totalCount and
self.advanceClaimedCount >= totalCount then
fundLevel = fundLevel + 1
fundGrade = fundGrade + 1
else
break
end
end
if fundLevel < 1 then
fundLevel = 1
if fundGrade < 1 then
fundGrade = 1
end
self.data.fundLevel = fundLevel
if self.data.fundLevel == 2 then
self.data.fundGrade = fundGrade
if self.data.fundGrade == 2 then
self.fundBaseId = ACT_GIFT_FUND_BASE_ID_2
self.fundAdvanceId = ACT_GIFT_FUND_ADVANCE_ID_2
if self.freeClaimedCount >= totalCount and self.baseClaimedCount >= totalCount and self.advanceClaimedCount >= totalCount then
@ -93,58 +93,58 @@ function FundData:initFundLevel()
end
end
function FundData:markDirty()
function GrowthFundData:markDirty()
self.data.dirty = not self.data.dirty
end
function FundData:getIsOpen()
function GrowthFundData:getIsOpen()
if self.isClaimAll then
return false
end
return ModuleManager:getIsOpen(ModuleManager.MODULE_KEY.FUND, true)
end
function FundData:getFundLevel()
return self.data.fundLevel
function GrowthFundData:getFundGrade()
return self.data.fundGrade
end
function FundData:getFundBaseId()
function GrowthFundData:getFundBaseId()
return self.fundBaseId
end
function FundData:getFundAdvanceId()
function GrowthFundData:getFundAdvanceId()
return self.fundAdvanceId
end
function FundData:getCurrLevelBaseRechargeId()
function GrowthFundData:getCurrGradeBaseRechargeId()
local info = self:getActGiftCfg()[self.fundBaseId]
return info.recharge_id
end
function FundData:getCurrLevelAdvanceRechargeId()
function GrowthFundData:getCurrGradeAdvanceRechargeId()
local info = self:getActGiftCfg()[self.fundAdvanceId]
return info.recharge_id
end
function FundData:getActGiftCfg()
function GrowthFundData:getActGiftCfg()
if self.cfg == nil then
self.cfg = ConfigManager:getConfig("act_gift")
end
return self.cfg
end
function FundData:getLevelFundCfg()
function GrowthFundData:getLevelFundCfg()
if self.levelFundCfg == nil then
self.levelFundCfg = ConfigManager:getConfig("act_level_fund")
end
return self.levelFundCfg
end
function FundData:getCurrLevelInfoList()
return self.levelInfoMap[self.data.fundLevel] or GConst.EMPTY_TABLE
function GrowthFundData:getCurrGradeInfoList()
return self.growthInfoMap[self.data.fundGrade] or GConst.EMPTY_TABLE
end
function FundData:getNeedLevel(id)
function GrowthFundData:getNeedLevel(id)
local levelFundInfo = self:getLevelFundCfg()[id]
if levelFundInfo == nil then
return 9999
@ -152,7 +152,7 @@ function FundData:getNeedLevel(id)
return levelFundInfo.level
end
function FundData:getAllStepFundRewards(id)
function GrowthFundData:getAllStepFundRewards(id)
local levelFundInfo = self:getLevelFundCfg()[id]
if levelFundInfo == nil then
return nil, nil, nil
@ -160,7 +160,7 @@ function FundData:getAllStepFundRewards(id)
return levelFundInfo.reward_free, levelFundInfo.reward_small, levelFundInfo.reward
end
function FundData:getFreeFundRewards(id)
function GrowthFundData:getFreeFundRewards(id)
local levelFundInfo = self:getLevelFundCfg()[id]
if levelFundInfo == nil then
return nil
@ -168,7 +168,7 @@ function FundData:getFreeFundRewards(id)
return levelFundInfo.reward_free
end
function FundData:getBaseFundRewards(id)
function GrowthFundData:getBaseFundRewards(id)
local levelFundInfo = self:getLevelFundCfg()[id]
if levelFundInfo == nil then
return nil
@ -176,7 +176,7 @@ function FundData:getBaseFundRewards(id)
return levelFundInfo.reward_small
end
function FundData:getAdvanceFundRewards(id)
function GrowthFundData:getAdvanceFundRewards(id)
local levelFundInfo = self:getLevelFundCfg()[id]
if levelFundInfo == nil then
return nil
@ -184,45 +184,45 @@ function FundData:getAdvanceFundRewards(id)
return levelFundInfo.reward
end
function FundData:getIsBoughtBase()
function GrowthFundData:getIsBoughtBase()
return DataManager.ShopData:getGiftBoughtNum(PayManager.PURCHARSE_TYPE.ACT_GIFT, self.fundBaseId) > 0
end
function FundData:getIsBoughtAdvance()
function GrowthFundData:getIsBoughtAdvance()
return DataManager.ShopData:getGiftBoughtNum(PayManager.PURCHARSE_TYPE.ACT_GIFT, self.fundAdvanceId) > 0
end
function FundData:getFreeClaimedMap()
function GrowthFundData:getFreeClaimedMap()
return self.freeClaimed
end
function FundData:getIsClaimedFree(id)
function GrowthFundData:getIsClaimedFree(id)
return self.freeClaimed[id]
end
function FundData:getBaseClaimedMap()
function GrowthFundData:getBaseClaimedMap()
return self.baseClaimed
end
function FundData:getIsClaimedBase(id)
function GrowthFundData:getIsClaimedBase(id)
return self.baseClaimed[id]
end
function FundData:getAdvanceClaimedMap()
function GrowthFundData:getAdvanceClaimedMap()
return self.advanceClaimed
end
function FundData:getIsClaimedAdvance(id)
function GrowthFundData:getIsClaimedAdvance(id)
return self.advanceClaimed[id]
end
function FundData:getMinUnclaimedRewardIndex()
function GrowthFundData:getMinUnclaimedRewardIndex()
local playerLevel = DataManager.PlayerData:getLv()
local levelInfoIds = self:getCurrLevelInfoList()
local growInfoIds = self:getCurrGradeInfoList()
local minIndex = 0
local isBoughtBase = self:getIsBoughtBase()
local isBoughtAdvance = self:getIsBoughtAdvance()
for k, id in ipairs(levelInfoIds) do
for k, id in ipairs(growInfoIds) do
local levelFundInfo = self:getLevelFundCfg()[id]
if levelFundInfo then
if playerLevel >= levelFundInfo.level then -- 等级到了
@ -251,14 +251,14 @@ function FundData:getMinUnclaimedRewardIndex()
end
-- 是否有未领取的奖励
function FundData:getIfCanClaimReward()
function GrowthFundData:getIfCanClaimReward()
if not self:getIsOpen() then
return false
end
return self:getMinUnclaimedRewardIndex() > 0
end
function FundData:onClaimFundRewards(list)
function GrowthFundData:onClaimFundRewards(list)
if list == nil then
return
end
@ -283,12 +283,12 @@ function FundData:onClaimFundRewards(list)
end
end
end
self:initFundLevel()
self:initFundGrade()
self:markDirty()
end
function FundData:onBoughtFund()
function GrowthFundData:onBoughtFund()
self:markDirty()
end
return FundData
return GrowthFundData

View File

@ -0,0 +1,10 @@
fileFormatVersion: 2
guid: b4b9202b724428843a59d421a713fe4b
ScriptedImporter:
internalIDToNameTable: []
externalObjects: {}
serializedVersion: 2
userData:
assetBundleName:
assetBundleVariant:
script: {fileID: 11500000, guid: 3b8b241bab4a4ac9a22fcce9c64f1242, type: 3}

View File

@ -107,7 +107,7 @@ function HeroEntity:getCfgAtk(lv)
end
function HeroEntity:getUnlcokChapter()
return self.config.unlock_chapter or 0
return self.config.unlock_chapter
end
function HeroEntity:updateAllAttr()
@ -165,10 +165,10 @@ function HeroEntity:isUnlock()
if self:isActived() then
return true
end
if self:getUnlcokChapter() <= DataManager.ChapterData:getMaxChapterId() or self:canLvUp() then
local unlockChapter = self:getUnlcokChapter()
if unlockChapter and unlockChapter <= DataManager.ChapterData:getMaxChapterId() then
return true
end
return false
end

View File

@ -24,6 +24,7 @@ function PlayerData:init(data)
self:resetOnCrossDay()
self:markDirty()
end)
self.createTime = basicInfo.create_at or 0 -- 创角时间
end
function PlayerData:resetOnCrossDay()
@ -135,4 +136,9 @@ function PlayerData:addPayment(rechargeId)
self.data.payAmount = self.data.payAmount + cfg.price
end
-- 获取创角时间
function PlayerData:getCreateTime()
return self.createTime
end
return PlayerData

View File

@ -6,6 +6,7 @@ end
function ShopData:initBase()
self:initActChapterStoreData()
self:initFirstRecharge()
self:initCrossDay()
end
@ -100,8 +101,8 @@ function ShopData:updateGiftInfo(gift)
local cfgName = PayManager.PURCHARSE_TYPE_CONFIG[giftType]
if cfgName then
local cfg = ConfigManager:getConfig(cfgName)
if cfg and cfg[giftId] and cfg[giftId].type == PayManager.PURCHARSE_ACT_TYPE.LEVEL_FUND then
DataManager.FundData:onBoughtFund(giftId)
if cfg and cfg[giftId] and cfg[giftId].type == PayManager.PURCHARSE_ACT_TYPE.GROWTH_FUND then
DataManager.GrowthFundData:onBoughtFund(giftId)
end
end
end
@ -117,9 +118,6 @@ function ShopData:markPopUpGift(actType, actId)
if not self.needPopUpGift[actType] then
self.needPopUpGift[actType] = {}
end
Logger.logHighlight("markPopUpGift -- actType:%s actId:%s",actType, actId)
table.insert(self.needPopUpGift[actType], actId)
end
@ -128,9 +126,6 @@ function ShopData:removePopUpGift(actType, actId)
if self.needPopUpGift[actType] then
for index, id in ipairs(self.needPopUpGift[actType]) do
if id == actId then
Logger.logHighlight("removePopUpGift -- actType:%s actId:%s",actType, actId)
table.remove(self.needPopUpGift[actType], index)
break
end
@ -262,7 +257,7 @@ function ShopData:addMallDailyAdResetCount()
end
function ShopData:getMallDailyAdLeftCount()
return 1 - self.mallDailyAdResetCount -- TODOJ 目前无配置表
return 1 - self.mallDailyAdResetCount -- 目前无配置表
end
function ShopData:getMallDailyDiamondResetCount()
@ -274,7 +269,7 @@ function ShopData:addMallDailyDiamondResetCount()
end
function ShopData:getMallDailyDiamondLeftCount()
return 1 - self.mallDailyDiamondResetCount -- TODOJ 目前无配置表
return 1 - self.mallDailyDiamondResetCount -- 目前无配置表
end
function ShopData:getMallDailyGoods()
@ -282,17 +277,17 @@ function ShopData:getMallDailyGoods()
end
function ShopData:getMallDailyDiamondResetCost()
return 30 -- TODOJ 目前无配置表
return 30 -- 目前无配置表
end
-- 每日特惠 广告商品最大购买次数
function ShopData:getMallDailyFirstItemAdMaxCount()
return 1 -- TODOJ 目前无配置表
return 1 -- 目前无配置表
end
-- 每日特惠 常规商品最大购买次数
function ShopData:getMallDailyGoodsLimitCount()
return 1 -- TODOJ 目前无配置表
return 1 -- 目前无配置表
end
-- 每日特惠 是否开启
@ -356,7 +351,7 @@ end
-- 常驻钻石礼包 **********************************************************************************************
function ShopData:getMallTreasureConfig()
return ConfigManager:getConfig("mall_treasure")
return ConfigManager:getConfig("mall_treasure") -- 审核模式会去读另一张表 TODOJ
end
-- 常驻钻石礼包结束 ----------------------------------------------------------------------------------------------
@ -393,7 +388,7 @@ end
function ShopData:getActChapterStoreCanBuyActIds()
local list = {}
local curChapterId = DataManager.ChapterData:getMaxChapterId()
for id = curChapterId, 1, -1 do
for id = 1, curChapterId do
if not self:getActChapterStoreHasBuy(id) then
table.insert(list, self.actChapterStoreChapterId2IdMap[id])
end
@ -421,6 +416,23 @@ function ShopData:getBeginnerGiftHasBuy()
end
end
-- 新手礼包侧边栏展示时间
function ShopData:getBeginnerGiftSideBarDurationTime()
return 3 * 24 * 3600 -- 目前无配置表
end
-- 未购买且在开服的3天内
function ShopData:getBeginnerGiftShowSideBar()
return not self:getBeginnerGiftHasBuy() and self:getBeginnerGiftSideBarRemainTime() > 0
end
-- 展示在侧边栏的剩余时间
function ShopData:getBeginnerGiftSideBarRemainTime()
local createTime = DataManager.PlayerData:getCreateTime() // 1000
local durationTime = self:getBeginnerGiftSideBarDurationTime()
return createTime + durationTime - Time:getServerTime()
end
-- 新手礼包结束 ----------------------------------------------------------------------------------------------
-- 助力与金币礼包(act_gift) **********************************************************************************************
@ -623,36 +635,69 @@ function ShopData:getGrowUpGifts()
return self.growUpGifts
end
-- 目前允许显示的最多2个礼包
function ShopData:getMaxGrowUpGiftCount()
return 2
end
function ShopData:getGrowUpGiftByActId(actId)
local list = self:getGrowUpGifts()
for _, gift in ipairs(list) do
if gift.current_grow_up_id == actId then
return gift
end
end
end
-- 获取目前时间有效的成长礼包
function ShopData:getValidGrowUpGifts()
local list = {}
for index, gift in ipairs(self:getGrowUpGifts()) do
local cfgInfo = self:getActGrowUpGiftConfig()[gift.current_grow_up_id]
if cfgInfo then
local cd = (cfgInfo.cd or 0) * 3600
local isValid = false
local durationTime = (cfgInfo.limit_time or 0) * 3600
local triggerTime = gift.trigger_at // 1000
local maxDurationTime = triggerTime + durationTime
local maxEndTime = triggerTime + cd
local buyLimit = cfgInfo.limit or 0
-- 是否在有效范围内
local isInDurationTime = Time:getServerTime() < maxDurationTime
if isInDurationTime then
-- 从通用act里找到这个礼包的最后购买时间 如果有且在这个范围内 则这个礼包已经被购买了
local hasBuy = false
-- 从通用act里找到这个礼包 如果有该礼包且购买次数未达到上限,则有效;如果没有该礼包也有效
local actGiftDetailData = self:getActGiftDetailData(PayManager.PURCHARSE_TYPE.GROW_UP_GIFT, gift.current_grow_up_id)
if actGiftDetailData then
local buyCount = actGiftDetailData.buy_count
local latestBuyTime = actGiftDetailData.latest_buy_at // 1000
if latestBuyTime > 0 and triggerTime < latestBuyTime and latestBuyTime < maxEndTime then
hasBuy = true
end
end
if not hasBuy then
table.insert(list, gift)
if buyLimit > 0 then
if buyCount < buyLimit then
isValid = true
end
else
isValid = true
end
else
isValid = true
end
end
if isValid then
table.insert(list, gift)
end
end
end
return list
-- 按照时间排序
table.sort(list, function(a, b)
return a.trigger_at < b.trigger_at
end)
-- 上限2位
local limitList = {}
for i = 1, self:getMaxGrowUpGiftCount() do
if list[i] then
table.insert(limitList, list[i])
end
end
return limitList
end
-- 触发了成长礼包
@ -668,4 +713,75 @@ end
-- 成长礼包结束 ----------------------------------------------------------------------------------------------
-- 首充 **********************************************************************************************
-- 用于标记是否弹窗 要求等级不低于2 未领取该奖励
function ShopData:initFirstRecharge()
local lv = DataManager.PlayerData:getLv()
if lv > 1 and not self:getHasGotFirstRechargeReward() then
self:markPopUpGift(PayManager.PURCHARSE_TYPE.ACT_GIFT, GConst.ShopConst.FIRST_RECHARGE_ID)
end
end
-- 是否有首充奖励 有支付且未领取
function ShopData:getHasFirstRechargeReward()
local pay = DataManager.PlayerData:getTotalPayAmount()
if pay > 0 and not self:getHasGotFirstRechargeReward() then
return true
else
return false
end
end
-- 是否已领取首充奖励
function ShopData:getHasGotFirstRechargeReward()
-- 通用act礼包中是否有已购
local boughtNum = self:getGiftBoughtNum(PayManager.PURCHARSE_TYPE.ACT_GIFT, GConst.ShopConst.FIRST_RECHARGE_ID)
return boughtNum > 0
end
-- 侧边栏是否展示 要求等级不低于2 未领取该奖励
function ShopData:getShowFirstRechargeSideBar()
local lv = DataManager.PlayerData:getLv()
if lv > 1 and not self:getHasGotFirstRechargeReward() then
return true
else
return false
end
end
-- 侧边栏红点
function ShopData:showFirstRechargeRp()
return self:getHasFirstRechargeReward()
end
-- 首充结束 ----------------------------------------------------------------------------------------------
-- 底部栏是否有红点
function ShopData:getRp()
if not ModuleManager:getIsOpen(ModuleManager.MODULE_KEY.MALL) then
return false
end
local isHotOpen = ModuleManager:getIsOpen(ModuleManager.MODULE_KEY.MALL_DAILY)
-- 主要商品 每日特惠广告道具
local hotAdGoods = self:getMallDailyGoods() and self:getMallDailyGoods()[1]
local hotAdGoodsBuyCount = hotAdGoods and hotAdGoods.bought or 0
local hotAdGoodsRp = self:getMallDailyFirstItemAdMaxCount() - hotAdGoodsBuyCount > 0
-- 主要商品 每日特惠刷新
local hotRefreshRp = self:getMallDailyAdLeftCount() > 0
-- 主要商品 钻石广告道具
local gemAdId = 1 -- 约定首位为免费栏位
local cfgInfo = self:getMallTreasureConfig()[gemAdId]
local gemAdMaxTimes = cfgInfo.daily or 0
local gemAdRp = gemAdMaxTimes - DataManager.ShopData:getGiftBoughtNum(PayManager.PURCHARSE_TYPE.MALL_TREASURE, gemAdId) > 0
-- 主要商品 金币广告道具
local coinAdId = 1 -- 约定首位为免费栏位
local cfgInfo = self:getMallGoldConfig()[coinAdId]
local coinAdMaxTimes = cfgInfo.daily or 0
local coinAdRp = coinAdMaxTimes - DataManager.ShopData:getCommonDailyCoinAdBuyCount() > 0
return (isHotOpen and (hotAdGoodsRp or hotRefreshRp)) or gemAdRp or coinAdRp
end
return ShopData

View File

@ -46,24 +46,28 @@ function DailyTaskData:init(data)
type = v.type,
reset = v.reset
}
if not dailyTaskObj.claimed and dailyTaskObj.progress >= dailyTaskObj.needProgress then
dailyTaskObj.redPoint = true
if dailyTaskObj.type == 1 then
dailyRedPoint = dailyRedPoint + 1
else
challengeRedPoint = challengeRedPoint + 1
end
else
dailyTaskObj.redPoint = false
end
if v.bounty then
if self.isUnlockBountyDailyTask then
dailyTaskObj.lock = false
else
dailyTaskObj.lock = true
end
if self.isUnlockBountyDailyTask then
dailyTaskObj.lock = false
else
dailyTaskObj.lock = true
end
else
dailyTaskObj.lock = false
end
if not dailyTaskObj.lock then -- 只有解锁的任务才注册监听任务进度
if dailyTaskObj.lock then
dailyTaskObj.redPoint = false
else
if not dailyTaskObj.claimed and dailyTaskObj.progress >= dailyTaskObj.needProgress then
dailyTaskObj.redPoint = true
if dailyTaskObj.type == 1 then
dailyRedPoint = dailyRedPoint + 1
else
challengeRedPoint = challengeRedPoint + 1
end
else
dailyTaskObj.redPoint = false
end
local list = self.taskTypeMap[taskInfo.type]
if list == nil then
list = {}
@ -130,11 +134,11 @@ function DailyTaskData:refreshDailyTask(task)
dailyTaskObj.type = dailyTaskInfo.type
dailyTaskObj.reset = dailyTaskInfo.reset
local redPoint = false
if not dailyTaskObj.claimed and dailyTaskObj.progress >= dailyTaskObj.needProgress then
if not dailyTaskObj.lock and not dailyTaskObj.claimed and dailyTaskObj.progress >= dailyTaskObj.needProgress then
redPoint = true
end
local originTaskType = originTaskInfo.type
if originTaskType ~= taskInfo.type then -- 任务类型变了
if not dailyTaskObj.lock and originTaskType ~= taskInfo.type then -- 任务类型变了
self:unregisterTask(id, originTaskType)
self:registerTask(dailyTaskObj, taskInfo.type)
end
@ -307,6 +311,9 @@ function DailyTaskData:getIfCanClaimTask(task)
end
function DailyTaskData:addTaskProgress(task, taskType, count)
if task.lock then
return
end
local currProgress = task.progress
if currProgress >= task.needProgress then
return
@ -314,7 +321,7 @@ function DailyTaskData:addTaskProgress(task, taskType, count)
local can = self:getIfCanClaimTask(task)
task.progress = task.progress + count
if not can and self:getIfCanClaimTask(task) then
EventManager:dispatchEvent(EventManager.CUSTOM_EVENT.DAILY_TASK_ADD_PROGRESS, task.id, task.taskId, currProgress, task.needProgress)
EventManager:dispatchEvent(EventManager.CUSTOM_EVENT.DAILY_TASK_COMPLETE, task.id, task.taskId, currProgress, task.needProgress)
if task.type == 1 and task.reset == 1 and taskType ~= GConst.TaskConst.TASK_TYPE.COMPLETED_DALY_TASK then
ModuleManager.TaskManager:addTaskProgress(GConst.TaskConst.TASK_TYPE.COMPLETED_DALY_TASK)
end