merge
This commit is contained in:
commit
143c5282e0
@ -75,9 +75,13 @@ BIReport.ITEM_GET_TYPE = {
|
||||
MALL_TREASURE = "MallTreasure", -- 常驻钻石礼包
|
||||
MALL_DAILY = "MallDaily", -- 每日特惠
|
||||
MALL_DAILY_RESET = "MallDailyReset",
|
||||
FIRST_RECHARGE = "FirstRecharge",
|
||||
BEGINNER_GIFT = "BeginnerGift",
|
||||
ACT_CHAPTER_STORE = "ActChapterStore", -- 章节礼包
|
||||
SUMMON = "Summon",
|
||||
PLAYER_LV_UP = "PlayerLvUp",
|
||||
GOLD_PIG = "GoldPig",
|
||||
BATTLE_SKILL_REFRESH = "BattleSkillRefresh",
|
||||
}
|
||||
|
||||
BIReport.ADS_CLICK_TYPE = {
|
||||
@ -119,9 +123,12 @@ BIReport.BATTLE_TYPE = {
|
||||
}
|
||||
|
||||
BIReport.GIFT_TYPE = {
|
||||
FIRST_RECHARGE = "FirstRecharge",
|
||||
BEGINNER_GIFT = "BeginnerGift",
|
||||
BOUNTY = "Bounty",
|
||||
GOLD_PIG = "GoldPig",
|
||||
MALL_TREASURE = "MallTreasure",
|
||||
ACT_CHAPTER_STORE = "ActChapterStore",
|
||||
}
|
||||
|
||||
BIReport.COIN_TYPE = {
|
||||
|
||||
@ -128,13 +128,13 @@ function DataManager:initWithServerData(data)
|
||||
self.DailyTaskData:init(data.task_daily)
|
||||
self.IdleData:init(data.idle)
|
||||
-- self.SevenDayData:init(data.SevenDayData)
|
||||
self.ShopData:initCrossDay()
|
||||
self.ShopData:initBase()
|
||||
self.ShopData:initActGift(data.act) -- 礼包购买信息
|
||||
self.ShopData:initMallDaily(data.mall_daily) -- 每日特惠
|
||||
self.ShopData:initCommonDailyGoldGift(data.mall_idle and data.mall_idle.ad_count) -- 常驻金币礼包
|
||||
self.ShopData:initGrowUpGift(data.act_grow_up_gift) -- 成长礼包
|
||||
self.ShopData:initLevelUpGift(data.act_level_up_gift) -- 助力礼包
|
||||
self.SummonData:init(data.summon)
|
||||
self.SummonData:init(data.summon, true)
|
||||
-- 成长基金要在ShopData和PlayerDataBagData还有之后初始化,依赖这些数据
|
||||
self.FundData:init(data.fund)
|
||||
|
||||
|
||||
@ -25,7 +25,8 @@ EventManager.CUSTOM_EVENT = {
|
||||
LOGIN_REQ_SUCCESS = "LOGIN_REQ_SUCCESS",
|
||||
DAILY_TASK_ADD_PROGRESS = "DAILY_TASK_ADD_PROGRESS",
|
||||
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",
|
||||
-- BORAD_TOUCH_BEGIN = "BORAD_TOUCH_BEGIN",
|
||||
-- BORAD_TOUCH_OVER = "BORAD_TOUCH_OVER"
|
||||
}
|
||||
|
||||
@ -11,6 +11,8 @@ PayManager.PURCHARSE_TYPE = {
|
||||
}
|
||||
|
||||
PayManager.PURCHARSE_ACT_TYPE = {
|
||||
FIRST_RECHARGE = 1,
|
||||
BEGINNER_GIFT = 4,
|
||||
BOUNTY = 7,
|
||||
}
|
||||
|
||||
@ -18,22 +20,29 @@ PayManager.PURCHARSE_TYPE_CONFIG = {
|
||||
[PayManager.PURCHARSE_TYPE.ACT_GIFT] = "act_gift",
|
||||
[PayManager.PURCHARSE_TYPE.ACT_GOLD_PIG] = "act_gold_pig",
|
||||
[PayManager.PURCHARSE_TYPE.MALL_TREASURE] = "mall_treasure",
|
||||
[PayManager.PURCHARSE_TYPE.CHAPTER_GIFT] = "act_chapter_store",
|
||||
}
|
||||
|
||||
PayManager.BI_ITEM_GET_TYPE = {
|
||||
[PayManager.PURCHARSE_TYPE.ACT_GIFT] = {
|
||||
[PayManager.PURCHARSE_ACT_TYPE.FIRST_RECHARGE] = BIReport.ITEM_GET_TYPE.FIRST_RECHARGE,
|
||||
[PayManager.PURCHARSE_ACT_TYPE.BEGINNER_GIFT] = BIReport.ITEM_GET_TYPE.BEGINNER_GIFT,
|
||||
[PayManager.PURCHARSE_ACT_TYPE.BOUNTY] = BIReport.ITEM_GET_TYPE.BOUNTY,
|
||||
},
|
||||
[PayManager.PURCHARSE_TYPE.ACT_GOLD_PIG] = BIReport.ITEM_GET_TYPE.GOLD_PIG,
|
||||
[PayManager.PURCHARSE_TYPE.MALL_TREASURE] = BIReport.ITEM_GET_TYPE.MALL_TREASURE,
|
||||
[PayManager.PURCHARSE_TYPE.CHAPTER_GIFT] = BIReport.ITEM_GET_TYPE.ACT_CHAPTER_STORE,
|
||||
}
|
||||
|
||||
PayManager.BI_GIFT_TYPE = {
|
||||
[PayManager.PURCHARSE_TYPE.ACT_GIFT] = {
|
||||
[PayManager.PURCHARSE_ACT_TYPE.FIRST_RECHARGE] = BIReport.GIFT_TYPE.FIRST_RECHARGE,
|
||||
[PayManager.PURCHARSE_ACT_TYPE.BEGINNER_GIFT] = BIReport.GIFT_TYPE.BEGINNER_GIFT,
|
||||
[PayManager.PURCHARSE_ACT_TYPE.BOUNTY] = BIReport.GIFT_TYPE.BOUNTY,
|
||||
},
|
||||
[PayManager.PURCHARSE_TYPE.ACT_GOLD_PIG] = BIReport.GIFT_TYPE.GOLD_PIG,
|
||||
[PayManager.PURCHARSE_TYPE.MALL_TREASURE] = BIReport.GIFT_TYPE.MALL_TREASURE,
|
||||
[PayManager.PURCHARSE_TYPE.CHAPTER_GIFT] = BIReport.GIFT_TYPE.ACT_CHAPTER_STORE,
|
||||
}
|
||||
|
||||
function PayManager:getItemGetType(purchaseType, id)
|
||||
@ -76,6 +85,19 @@ function PayManager:getGiftType(purchaseType, id)
|
||||
end
|
||||
end
|
||||
|
||||
function PayManager:getGiftConfigInfo(purchaseType, id)
|
||||
local cfgName = PayManager.PURCHARSE_TYPE_CONFIG[purchaseType]
|
||||
if not cfgName then
|
||||
return
|
||||
end
|
||||
local cfg = ConfigManager:getConfig(cfgName)
|
||||
local cfg = ConfigManager:getConfig(cfgName)
|
||||
if not cfg or not cfg[id] then
|
||||
return
|
||||
end
|
||||
return cfg[id]
|
||||
end
|
||||
|
||||
function PayManager:purchasePackage(id, purchaseType)
|
||||
local cfgName = PayManager.PURCHARSE_TYPE_CONFIG[purchaseType]
|
||||
if not cfgName then
|
||||
@ -113,7 +135,9 @@ function PayManager:requestRewards(purchaseToken, orderId, originOrderId, giftTy
|
||||
end
|
||||
|
||||
table.foreach(msgData.gift, function(i, gift)
|
||||
local rechargeId = DataManager.ShopData:getShopItemCfg(gift).recharge_id
|
||||
local cfgName = PayManager.PURCHARSE_TYPE_CONFIG[gift.act_type]
|
||||
local cfgInfo = ConfigManager:getConfig(cfgName)[gift.id]
|
||||
local rechargeId = cfgInfo.recharge_id
|
||||
DataManager.PlayerData:addPayment(rechargeId)
|
||||
DataManager.ShopData:updateGiftInfo(gift)
|
||||
end)
|
||||
|
||||
@ -75,6 +75,10 @@ local item = {
|
||||
["name"]="随机碎片",
|
||||
["desc"]="挂机可获得随机碎片,领取后数量和品质将根据关卡提升。"
|
||||
},
|
||||
[12001]={
|
||||
["name"]="红SR-克劳德",
|
||||
["desc"]="凑齐可解锁或升级。"
|
||||
},
|
||||
[13001]={
|
||||
["name"]="红SR-克劳德",
|
||||
["desc"]="凑齐可解锁或升级。"
|
||||
|
||||
@ -399,6 +399,15 @@ if NOT_PUBLISH then
|
||||
Logger.printTable(map)
|
||||
end
|
||||
end
|
||||
|
||||
if Input.GetKeyDown(KeyCode.Q) then
|
||||
-- 标记可弹出新手礼包
|
||||
DataManager.ShopData:markPopUpGiftForBeginnerGift()
|
||||
end
|
||||
if Input.GetKeyDown(KeyCode.W) then
|
||||
-- 章节通关 标记可弹出章节礼包
|
||||
DataManager.ShopData:markPopUpGiftForActChapterStore(4)
|
||||
end
|
||||
end
|
||||
|
||||
Game._releaseOnApplicationFocus = Game.onApplicationFocus
|
||||
|
||||
@ -128,6 +128,11 @@ BattleConst.UNIT_STATE = {
|
||||
VERITGO = 12, -- 昏睡
|
||||
}
|
||||
|
||||
BattleConst.ATTACK_ACTION_STATE = {
|
||||
NORMAL = "normal",
|
||||
COUNTERATTACK = "counterattack",
|
||||
}
|
||||
|
||||
BattleConst.MATCH_DMG_ADDITION_NAME = {
|
||||
[0] = "dmg_addition_none",
|
||||
[1] = "dmg_addition_red",
|
||||
@ -194,7 +199,6 @@ BattleConst.EFFECT_TYPE = {
|
||||
HEAL = 101,
|
||||
HOT = 102,
|
||||
REBOUND = 201, -- 反弹
|
||||
COUNTERATTACK = 301, -- 反击
|
||||
}
|
||||
|
||||
---- 特殊的伤害类型,其余都是buffname
|
||||
@ -287,6 +291,8 @@ local BUFF_NAME = {
|
||||
SKILL_HURT_ADD = "skill_hurt_add",
|
||||
DEATH_SUMMON = "death_summon",
|
||||
LOCK = "lock",
|
||||
SHIELD_REBOUND_400 = "shield_rebound_400",
|
||||
SHIELD_ICE_REBOUND_400 = "shield_ice_rebound_400",
|
||||
}
|
||||
BattleConst.BUFF_NAME = BUFF_NAME
|
||||
|
||||
|
||||
@ -22,6 +22,24 @@ function BattleManager:showBoxOpenUI(rewards, callback)
|
||||
UIManager:showUI("app/ui/battle/battle_box_open_ui", {rewards = rewards, callback = callback})
|
||||
end
|
||||
|
||||
function BattleManager:reqSkillRefresh(isAd)
|
||||
if not isAd then
|
||||
local cost = GFunc.getConstReward("refresh_skill_cost")
|
||||
if not GFunc.checkCost(GFunc.getRewardId(cost), GFunc.getRewardNum(cost), true) then
|
||||
return
|
||||
end
|
||||
end
|
||||
|
||||
self:sendMessage(ProtoMsgType.FromMsgEnum.BattleSkillRefreshReq, {ad = isAd}, {}, self.rspSkillRefresh, BIReport.ITEM_GET_TYPE.BATTLE_SKILL_REFRESH, true)
|
||||
end
|
||||
|
||||
function BattleManager:rspSkillRefresh(result)
|
||||
if result.err_code == GConst.ERROR_STR.SUCCESS then
|
||||
DataManager.BattleData:addRefreshSkillCount(result.reqData.ad)
|
||||
EventManager:dispatchEvent(EventManager.CUSTOM_EVENT.SKILL_REFRESH_SUCC)
|
||||
end
|
||||
end
|
||||
|
||||
function BattleManager:playBattle(battleType, params, returnFunc)
|
||||
params = params or {}
|
||||
if self.battleController then -- 同一时间只能有一场战斗
|
||||
|
||||
@ -230,7 +230,7 @@ function BattleUnitComp:stopRunAction()
|
||||
end
|
||||
|
||||
function BattleUnitComp:playAnimation(name, loop, forceRefresh)
|
||||
if name == SPINE_ANIMATION_NAME.HIT or name == SPINE_ANIMATION_NAME.BLOCK then
|
||||
if name == self.curHurtName or name == SPINE_ANIMATION_NAME.BLOCK then
|
||||
self.isPlayingSubAni = true
|
||||
end
|
||||
self.currAnimationName = name
|
||||
@ -286,10 +286,15 @@ function BattleUnitComp:getIsCentralizedAttack()
|
||||
return self.team:getCentralizedAttack()
|
||||
end
|
||||
|
||||
function BattleUnitComp:beforeAttack(effectType)
|
||||
function BattleUnitComp:getCurAttackActionState()
|
||||
return self.curAttackActionState
|
||||
end
|
||||
|
||||
function BattleUnitComp:beforeAttack(actionState)
|
||||
self.team:setCentralizedAttack(true)
|
||||
self.battleController:setIsPauseHpProgress(true)
|
||||
if effectType == BattleConst.EFFECT_TYPE.DIRECT then
|
||||
self.curAttackActionState = actionState
|
||||
if actionState == BattleConst.ATTACK_ACTION_STATE.NORMAL then
|
||||
self:checkPassiveEvent(PASSIVE_EVENT.ON_UNI_ATTACK_START, self)
|
||||
end
|
||||
end
|
||||
@ -677,7 +682,7 @@ function BattleUnitComp:updateIdleSubAni(...)
|
||||
if not self.currAnimationName or not self.isPlayingSubAni then
|
||||
return
|
||||
end
|
||||
if self.currAnimationName == SPINE_ANIMATION_NAME.HIT then
|
||||
if self.currAnimationName == self.curHurtName then
|
||||
self:updateHurt(...)
|
||||
elseif self.currAnimationName == SPINE_ANIMATION_NAME.BLOCK then
|
||||
self:updateBlock(...)
|
||||
@ -1509,6 +1514,15 @@ function BattleUnitComp:takeDamageOrCure(atker, num, effectType, effectStatus, d
|
||||
self:showEffectNumber(effectColor, direction, damageStr, x, y, delayTime)
|
||||
end
|
||||
end
|
||||
if atker:getCurAttackActionState() == BattleConst.ATTACK_ACTION_STATE.NORMAL then
|
||||
if self.unitEntity:getCounterAttack() > 0 then -- 触发反击
|
||||
local counterattack = self.unitEntity:getCounterAttack()
|
||||
if counterattack > DEFAULT_FACTOR or BattleHelper:random(1, DEFAULT_FACTOR) <= counterattack then -- 通过命中概率
|
||||
self.unitEntity:addCounterAttackCount(1)
|
||||
self.battleController:showCounterAttack(self.unitEntity:getCounterAttackCount(), self.side)
|
||||
end
|
||||
end
|
||||
end
|
||||
if effectType == EFFECT_TYPE.DIRECT then
|
||||
if hp > 0 and self.unitEntity:getShieldRebound() then -- 伤害反弹
|
||||
atker:takeDamageOrCure(self, num*self.unitEntity:getShieldRebound() // DEFAULT_FACTOR, EFFECT_TYPE.REBOUND, 0, BattleConst.BUFF_NAME.SHIELD_REBOUND_200)
|
||||
@ -1522,16 +1536,17 @@ function BattleUnitComp:takeDamageOrCure(atker, num, effectType, effectStatus, d
|
||||
if self.unitEntity:getThorns() > 0 then -- 反伤
|
||||
atker:takeDamageOrCure(self, num*self.unitEntity:getThorns() // DEFAULT_FACTOR, EFFECT_TYPE.REBOUND, 0, BattleConst.BUFF_NAME.THORNS)
|
||||
end
|
||||
if self.unitEntity:getCounterAttack() > 0 then -- 触发反击
|
||||
local counterattack = self.unitEntity:getCounterAttack()
|
||||
if counterattack > DEFAULT_FACTOR or BattleHelper:random(1, DEFAULT_FACTOR) <= counterattack then -- 通过命中概率
|
||||
self.unitEntity:addCounterAttackCount(1)
|
||||
self.battleController:showCounterAttack(self.unitEntity:getCounterAttackCount(), self.side)
|
||||
end
|
||||
end
|
||||
end
|
||||
elseif num > 0 then -- 治疗
|
||||
self:showEffectNumber(BattleConst.EFFECT_COLOR_GREEN, BattleConst.EFFECT_TYPE_BUFF, "+" .. num, x, y, 0)
|
||||
local time = Time:getServerTime()
|
||||
if self.lastHealTime == time then
|
||||
self.lastSameTimeHealCount = self.lastSameTimeHealCount + 1
|
||||
else
|
||||
self.lastHealTime = time
|
||||
self.lastSameTimeHealCount = 0
|
||||
end
|
||||
local delayTime = self.lastSameTimeHealCount * 0.1
|
||||
self:showEffectNumber(BattleConst.EFFECT_COLOR_GREEN, BattleConst.EFFECT_TYPE_BUFF, "+" .. num, x, y, delayTime)
|
||||
end
|
||||
local hpPercent = self.unitEntity:getHpPercent()
|
||||
self.battleController:refreshHp(self.side, hp, hpPercent)
|
||||
|
||||
@ -556,7 +556,7 @@ function BattleController:enterBattleStep()
|
||||
|
||||
local defAction = function()
|
||||
self.roundStep = BattleConst.BATTLE_ROUND_STEP.ON_DEF_STEP
|
||||
self.defTeam:mainUnitUseAllSkills(function()
|
||||
self.defTeam:mainUnitUseAllSkills(BattleConst.ATTACK_ACTION_STATE.NORMAL, function()
|
||||
self:enterNextTeamAction()
|
||||
end)
|
||||
end
|
||||
@ -1206,9 +1206,6 @@ function BattleController:generateInstructions(skillEntity, elementType, lineCou
|
||||
end
|
||||
|
||||
function BattleController:exeInstructions(callback)
|
||||
if EDITOR_MODE then
|
||||
Logger.logHighlight("--------exeInstructions----------")
|
||||
end
|
||||
if not self.instructions or #self.instructions <= 0 then
|
||||
callback()
|
||||
return
|
||||
@ -1624,7 +1621,7 @@ function BattleController:findSkillInfluenceGrids()
|
||||
end
|
||||
end
|
||||
|
||||
function BattleController:getRandomSkillList(getCount, onlyCommonSkill)
|
||||
function BattleController:getRandomSkillList(getCount, onlyCommonSkill, excludeMap)
|
||||
local fixedList = self:getFixedRogueSkill()
|
||||
if fixedList[1] then
|
||||
return table.remove(fixedList, 1)
|
||||
@ -1668,6 +1665,12 @@ function BattleController:getRandomSkillList(getCount, onlyCommonSkill)
|
||||
|
||||
return table.shuffle(result)
|
||||
end
|
||||
|
||||
if excludeMap then
|
||||
for skillId, _ in pairs(excludeMap) do
|
||||
map[skillId] = true
|
||||
end
|
||||
end
|
||||
|
||||
for elementType, list in pairs(skillPool) do
|
||||
if self.battleData:isUnlockedSkillElementType(elementType) then
|
||||
@ -2514,11 +2517,11 @@ local function _assisting(self, instruction, callback)
|
||||
end
|
||||
|
||||
local function _generalAttack(self, instruction, callback)
|
||||
self.atkTeam:useNormalSkill(instruction.skillMatch, instruction.count, #self.instructions == 0, BattleConst.EFFECT_TYPE.DIRECT, callback)
|
||||
self.atkTeam:useNormalSkill(instruction.skillMatch, instruction.count, #self.instructions == 0, BattleConst.EFFECT_TYPE.DIRECT, BattleConst.ATTACK_ACTION_STATE.NORMAL, callback)
|
||||
end
|
||||
|
||||
local function _playSkill(self, instruction, callback)
|
||||
self.atkTeam:useSkill(instruction.skillMatch, instruction.count, #self.instructions == 0, BattleConst.EFFECT_TYPE.DIRECT, callback)
|
||||
self.atkTeam:useSkill(instruction.skillMatch, instruction.count, #self.instructions == 0, BattleConst.EFFECT_TYPE.DIRECT, BattleConst.ATTACK_ACTION_STATE.NORMAL, callback)
|
||||
end
|
||||
|
||||
BattleController._doInstruction = {
|
||||
|
||||
@ -140,6 +140,20 @@ BattleBuffHandle.addShield = {
|
||||
target.unitEntity:addAttr(ATTR_NAME.SHIELD_REBOUND, 20000, false)
|
||||
return shieldNum
|
||||
end,
|
||||
-- 反弹目标伤害的400%,直接写死
|
||||
[BUFF_NAME.SHIELD_REBOUND_400] = function(unitComp, buff, target, buffEffect)
|
||||
local shieldNum = target.unitEntity:getMaxHp() * buff:getEffectNum() // DEFAULT_FACTOR
|
||||
target:addShield(shieldNum, buffEffect)
|
||||
target.unitEntity:addAttr(ATTR_NAME.SHIELD_REBOUND, 40000, false)
|
||||
return shieldNum
|
||||
end,
|
||||
-- 反弹目标伤害的400%,直接写死
|
||||
[BUFF_NAME.SHIELD_ICE_REBOUND_400] = function(unitComp, buff, target, buffEffect)
|
||||
local shieldNum = target.unitEntity:getMaxHp() * buff:getEffectNum() // DEFAULT_FACTOR
|
||||
target:addShield(shieldNum, buffEffect)
|
||||
target.unitEntity:addAttr(ATTR_NAME.SHIELD_REBOUND, 40000, false)
|
||||
return shieldNum
|
||||
end,
|
||||
}
|
||||
|
||||
BattleBuffHandle.removeShield = {
|
||||
@ -147,6 +161,14 @@ 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)
|
||||
target.unitEntity:addAttr(ATTR_NAME.SHIELD_REBOUND, -40000, false)
|
||||
target:removeShield(buffEffect)
|
||||
end,
|
||||
[BUFF_NAME.SHIELD_ICE_REBOUND_400] = function(unitComp, buff, target, buffEffect)
|
||||
target.unitEntity:addAttr(ATTR_NAME.SHIELD_REBOUND, -40000, false)
|
||||
target:removeShield(buffEffect)
|
||||
end,
|
||||
}
|
||||
|
||||
local function _takeEffectShield(unitComp, buff, target, buffEffect)
|
||||
|
||||
@ -58,7 +58,7 @@ function BattleTeam:removeAllUnits()
|
||||
self.mainUnit = nil
|
||||
end
|
||||
|
||||
function BattleTeam:useNormalSkill(matchType, count, isFinalAction, effectType, callback)
|
||||
function BattleTeam:useNormalSkill(matchType, count, isFinalAction, effectType, actionState, callback)
|
||||
self.isFinalAction = isFinalAction
|
||||
local unit = nil
|
||||
if matchType == nil then
|
||||
@ -73,12 +73,12 @@ function BattleTeam:useNormalSkill(matchType, count, isFinalAction, effectType,
|
||||
return callback()
|
||||
end
|
||||
self.mainUnit = unit
|
||||
unit:beforeAttack(effectType)
|
||||
unit:beforeAttack(actionState)
|
||||
unit:resetBeforeAttack()
|
||||
unit:useNormalSkill(count, effectType, callback)
|
||||
end
|
||||
|
||||
function BattleTeam:useSkill(matchType, count, isFinalAction, effectType, callback)
|
||||
function BattleTeam:useSkill(matchType, count, isFinalAction, effectType, actionState, callback)
|
||||
self.isFinalAction = isFinalAction
|
||||
local unit = nil
|
||||
if matchType == nil then
|
||||
@ -94,7 +94,7 @@ function BattleTeam:useSkill(matchType, count, isFinalAction, effectType, callba
|
||||
end
|
||||
local lastMainUnit = self.mainUnit
|
||||
self.mainUnit = unit
|
||||
unit:beforeAttack(effectType)
|
||||
unit:beforeAttack(actionState)
|
||||
unit:resetBeforeAttack()
|
||||
if unit:useSkill(1, count, callback) then
|
||||
if lastMainUnit and lastMainUnit ~= unit then
|
||||
@ -140,7 +140,7 @@ function BattleTeam:useAssistingSkill(assistingList, isFinalAction, callback)
|
||||
end
|
||||
end
|
||||
|
||||
function BattleTeam:mainUnitUseAllSkills(callback)
|
||||
function BattleTeam:mainUnitUseAllSkills(actionState, callback)
|
||||
self.isFinalAction = true
|
||||
if self.mainUnit == nil then
|
||||
return callback()
|
||||
@ -148,7 +148,7 @@ function BattleTeam:mainUnitUseAllSkills(callback)
|
||||
if self.mainUnit:getIsLimit() then
|
||||
return callback()
|
||||
end
|
||||
self.mainUnit:beforeAttack()
|
||||
self.mainUnit:beforeAttack(actionState)
|
||||
self.mainUnit:resetBeforeAttack()
|
||||
self.mainUnit:useAllSkills(callback)
|
||||
end
|
||||
@ -554,11 +554,18 @@ function BattleTeam:onActionOver()
|
||||
self:getMainUnit().unitEntity:clearCounterAttackCount()
|
||||
|
||||
local teamAction = function()
|
||||
self.battleController.roundStep = BattleConst.BATTLE_ROUND_STEP.ON_ATK_STEP
|
||||
self.battleController.curTeam = self.battleController.atkTeam
|
||||
---- 普攻
|
||||
local skillMatch = self:getMainUnit().unitEntity:getMatchType()
|
||||
self:useNormalSkill(skillMatch, counterAttackCount, true, BattleConst.EFFECT_TYPE.COUNTERATTACK, function()
|
||||
local skillMatch
|
||||
if self.side == BattleConst.SIDE_ATK then
|
||||
self.battleController.roundStep = BattleConst.BATTLE_ROUND_STEP.ON_ATK_STEP
|
||||
self.battleController.curTeam = self.battleController.atkTeam
|
||||
skillMatch = self:getMainUnit().unitEntity:getMatchType()
|
||||
else
|
||||
self.battleController.roundStep = BattleConst.BATTLE_ROUND_STEP.ON_DEF_STEP
|
||||
self.battleController.curTeam = self.battleController.defTeam
|
||||
end
|
||||
|
||||
self:useNormalSkill(skillMatch, counterAttackCount, true, BattleConst.EFFECT_TYPE.DIRECT, BattleConst.ATTACK_ACTION_STATE.COUNTERATTACK, function()
|
||||
self.battleController:enterNextTeamAction()
|
||||
end)
|
||||
end
|
||||
|
||||
@ -98,6 +98,13 @@ function ChapterManager:endFightFinish(result)
|
||||
local data = {}
|
||||
data.max_chapter = newMaxChapter
|
||||
CS.ThinkingAnalytics.ThinkingAnalyticsAPI.UserSet(data)
|
||||
|
||||
-- 标记可弹出新手礼包
|
||||
if newMaxChapter == 1 then
|
||||
DataManager.ShopData:markPopUpGiftForBeginnerGift()
|
||||
end
|
||||
-- 章节通关 标记可弹出章节礼包
|
||||
DataManager.ShopData:markPopUpGiftForActChapterStore(newMaxChapter)
|
||||
end
|
||||
|
||||
ModuleManager.TaskManager:addFightTaskProgress(reqData)
|
||||
|
||||
@ -1,16 +1,5 @@
|
||||
local ShopConst = class("ShopConst", BaseModule)
|
||||
|
||||
-- 服务器pb对应的类型
|
||||
ShopConst.GIFT_TYPE = {
|
||||
ACT_GIFT = 1,
|
||||
GOLD_PIG = 2,
|
||||
CHAPTER_GIFT = 3,
|
||||
GROW_UP_GIFT = 4,
|
||||
MALL_TREASURE = 5,
|
||||
}
|
||||
|
||||
ShopConst.ACT_GIFT_ID = {
|
||||
BEGINNER_GIFT = 40102 -- 新手礼包ID
|
||||
}
|
||||
ShopConst.BEGINNER_GIFT_ID = 40102 -- 新手礼包ID
|
||||
|
||||
return ShopConst
|
||||
@ -17,6 +17,16 @@ function ShopManager:showBoxRewardUI(params)
|
||||
UIManager:showUI("app/ui/shop/box_reward_ui", params)
|
||||
end
|
||||
|
||||
function ShopManager:showBoxLevelUpUI(params)
|
||||
UIManager:showUI("app/ui/shop/box_level_up_ui", params)
|
||||
end
|
||||
|
||||
-- 弹窗礼包
|
||||
function ShopManager:showGiftPopUI(params)
|
||||
UIManager:showUI("app/ui/shop/gift_pop_ui", params)
|
||||
end
|
||||
|
||||
|
||||
-- 购买每日特惠商品
|
||||
function ShopManager:buyMallDailyGift(id, isAd)
|
||||
if not DataManager.ShopData:getMallDailyIsOpen() then
|
||||
@ -91,9 +101,6 @@ function ShopManager:mallDailyGiftOverDay()
|
||||
end
|
||||
|
||||
function ShopManager:mallDailyGiftOverDayFinish(result)
|
||||
-- if result.err_code == GConst.ERROR_STR.SUCCESS then
|
||||
-- DataManager.ShopData:initMallDaily(result.mall_daily_info)
|
||||
-- end
|
||||
-- 消息无用 仅为了触发推送
|
||||
end
|
||||
|
||||
@ -103,18 +110,6 @@ function ShopManager:onMallDailyReset(result)
|
||||
end
|
||||
end
|
||||
|
||||
-- 常规钻石
|
||||
function ShopManager:buyMallTreasure(id, isAd)
|
||||
PayManager:purchasePackage(id, PayManager.PURCHARSE_TYPE.MALL_TREASURE)
|
||||
end
|
||||
|
||||
function ShopManager:buyMallTreasureFinish(result)
|
||||
if result.err_code == GConst.ERROR_STR.SUCCESS then
|
||||
GFunc.showRewardBox(result.rewards)
|
||||
-- TODOJ
|
||||
end
|
||||
end
|
||||
|
||||
-- 常规金币
|
||||
function ShopManager:buyMallIdleCoin(id, isAd)
|
||||
local params = {id = id, ad = isAd}
|
||||
|
||||
@ -82,6 +82,8 @@ local ProtoMsgType = {
|
||||
[3440328467] = "PigLevelUpNtf",
|
||||
[3555824176] = "TaskDailyInfoReq",
|
||||
[3555826009] = "TaskDailyInfoRsp",
|
||||
[3597633120] = "BattleSkillRefreshReq",
|
||||
[3597634953] = "BattleSkillRefreshRsp",
|
||||
[3607879254] = "AuthReq",
|
||||
[3607881087] = "AuthRsp",
|
||||
[3624439233] = "NewMailNtf",
|
||||
@ -186,6 +188,8 @@ local ProtoMsgType = {
|
||||
PigLevelUpNtf = 3440328467,
|
||||
TaskDailyInfoReq = 3555824176,
|
||||
TaskDailyInfoRsp = 3555826009,
|
||||
BattleSkillRefreshReq = 3597633120,
|
||||
BattleSkillRefreshRsp = 3597634953,
|
||||
AuthReq = 3607879254,
|
||||
AuthRsp = 3607881087,
|
||||
NewMailNtf = 3624439233,
|
||||
@ -290,6 +294,8 @@ local ProtoMsgType = {
|
||||
PigLevelUpNtf = "PigLevelUpNtf",
|
||||
TaskDailyInfoReq = "TaskDailyInfoReq",
|
||||
TaskDailyInfoRsp = "TaskDailyInfoRsp",
|
||||
BattleSkillRefreshReq = "BattleSkillRefreshReq",
|
||||
BattleSkillRefreshRsp = "BattleSkillRefreshRsp",
|
||||
AuthReq = "AuthReq",
|
||||
AuthRsp = "AuthRsp",
|
||||
NewMailNtf = "NewMailNtf",
|
||||
|
||||
@ -19,7 +19,6 @@ end
|
||||
|
||||
function BattleSkillSelectComp:_display()
|
||||
local uiMap = self:getUIMap()
|
||||
uiMap["battle_select_skill_comp.skill_node.ad_btn.tx"]:setText(I18N:getGlobalText(I18N.GlobalConst.BATTLE_DESC_3))
|
||||
local bg2 = uiMap["battle_select_skill_comp.bg_2"]
|
||||
bg2:setVisible(self.onlyCommonSkill)
|
||||
local bg = uiMap["battle_select_skill_comp.bg_1"]
|
||||
@ -32,6 +31,7 @@ function BattleSkillSelectComp:_display()
|
||||
bg:setVisible(true)
|
||||
end
|
||||
|
||||
self:refreshBtns()
|
||||
self:refreshRogueSkill()
|
||||
end
|
||||
|
||||
@ -43,11 +43,18 @@ function BattleSkillSelectComp:_addListeners()
|
||||
end
|
||||
|
||||
SDKManager:showFullScreenAds(BIReport.ADS_CLICK_TYPE.BATTLE_SKILL_REFRESH, function()
|
||||
self.skillList = ModuleManager.BattleManager.battleController:getRandomSkillList(nil, self.onlyCommonSkill)
|
||||
self:refreshRogueSkill()
|
||||
ModuleManager.BattleManager:reqSkillRefresh(true)
|
||||
end)
|
||||
end)
|
||||
|
||||
uiMap["battle_select_skill_comp.skill_node.diamond_btn"]:addClickListener(function()
|
||||
if not ModuleManager.BattleManager.battleController then
|
||||
return
|
||||
end
|
||||
|
||||
ModuleManager.BattleManager:reqSkillRefresh(false)
|
||||
end)
|
||||
|
||||
self.canvasGroup = uiMap["battle_select_skill_comp.skill_node"]:getComponent(GConst.TYPEOF_UNITY_CLASS.CANVAS_GROUP)
|
||||
self.canvasGroup.alpha = 1
|
||||
self.bg = uiMap["battle_select_skill_comp.bg_1"]
|
||||
@ -62,6 +69,34 @@ function BattleSkillSelectComp:_addListeners()
|
||||
end)
|
||||
end
|
||||
|
||||
function BattleSkillSelectComp:refreshBtns()
|
||||
local uiMap = self:getUIMap()
|
||||
uiMap["battle_select_skill_comp.skill_node.ad_btn.tx"]:setText(I18N:getGlobalText(I18N.GlobalConst.BATTLE_DESC_3))
|
||||
uiMap["battle_select_skill_comp.skill_node.diamond_btn.tx"]:setText(GFunc.getRewardNum(GFunc.getConstReward("refresh_skill_cost")))
|
||||
|
||||
local cfgAdCount = GFunc.getConstIntValue("ad_refresh_skill")
|
||||
local cfgRefreshCount = GFunc.getConstIntValue("diamond_refresh_skill") + cfgAdCount
|
||||
local adCount = DataManager.BattleData:getADRefreshSkillCount()
|
||||
local refreshCount = DataManager.BattleData:getRefreshSkillCount()
|
||||
local showAdBtn = cfgAdCount > adCount
|
||||
uiMap["battle_select_skill_comp.skill_node.ad_btn"]:setActive(showAdBtn)
|
||||
local showBtn = refreshCount < cfgRefreshCount
|
||||
if showAdBtn then
|
||||
showBtn = false
|
||||
end
|
||||
uiMap["battle_select_skill_comp.skill_node.diamond_btn"]:setActive(showBtn)
|
||||
end
|
||||
|
||||
function BattleSkillSelectComp:getNewRandomSkill()
|
||||
self:refreshBtns()
|
||||
local excludeMap = {}
|
||||
for _, id in ipairs(self.skillList) do
|
||||
excludeMap[id] = true
|
||||
end
|
||||
self.skillList = ModuleManager.BattleManager.battleController:getRandomSkillList(nil, self.onlyCommonSkill, excludeMap)
|
||||
self:refreshRogueSkill()
|
||||
end
|
||||
|
||||
function BattleSkillSelectComp:refreshRogueSkill()
|
||||
local uiMap = self:getUIMap()
|
||||
if not self.selectSkillCells then
|
||||
|
||||
@ -79,6 +79,12 @@ function BattleUI:_addListeners()
|
||||
self:addEventListener(EventManager.CUSTOM_EVENT.SHOW_ELIMINATION_TUTORAIL, function(posIdList)
|
||||
self:showTutorialFinger(posIdList)
|
||||
end)
|
||||
|
||||
self:addEventListener(EventManager.CUSTOM_EVENT.SKILL_REFRESH_SUCC, function(posIdList)
|
||||
if self.selectSkillComp then
|
||||
self.selectSkillComp:getNewRandomSkill()
|
||||
end
|
||||
end)
|
||||
end
|
||||
|
||||
function BattleUI:_bind()
|
||||
@ -530,16 +536,24 @@ end
|
||||
function BattleUI:initCounterAttack()
|
||||
self.counterAttackNode = self.uiMap["battle_ui.battle_root.battle_number_node.counter_attack"]
|
||||
self.counterTx = self.uiMap["battle_ui.battle_root.battle_number_node.counter_attack.text_number"]
|
||||
self.counterTxTmp = self.counterTx:getComponent(GConst.TYPEOF_UNITY_CLASS.UI_TEXT_MESH_PRO)
|
||||
self.counterTxbgComp = self.uiMap["battle_ui.battle_root.top_node.counter_attack.bg"]
|
||||
self.counterAttackNode:setVisible(false)
|
||||
end
|
||||
|
||||
function BattleUI:showCounterAttack(count, side)
|
||||
local x = 280
|
||||
local horizontal = 180
|
||||
if side == GConst.BattleConst.SIDE_ATK then
|
||||
x = -280
|
||||
horizontal = 0
|
||||
self.counterTxTmp.alignment = CS.TMPro.TextAlignmentOptions.MidlineLeft
|
||||
else
|
||||
self.counterTxTmp.alignment = CS.TMPro.TextAlignmentOptions.MidlineRight
|
||||
end
|
||||
self.counterTxbgComp:setEulerAngles(0, horizontal, 0)
|
||||
self.counterAttackNode:setAnchoredPositionX(x)
|
||||
self.counterTx:setText(I18N:getGlobalText(I18N.GlobalConst.COUNTER_ATTACK_DESC) .. "+" .. count)
|
||||
self.counterTx:setText(I18N:getGlobalText(I18N.GlobalConst.COUNTER_ATTACK_DESC) .. "x" .. count)
|
||||
self.counterAttackNode:setVisible(true)
|
||||
end
|
||||
|
||||
|
||||
@ -744,27 +744,44 @@ function MainCityUI:checkMainPop()
|
||||
if self:checkTutorial() then
|
||||
return
|
||||
end
|
||||
|
||||
-- 礼包
|
||||
if self:checkGift() then
|
||||
return
|
||||
end
|
||||
end
|
||||
|
||||
-- 检查引导
|
||||
function MainCityUI:checkTutorial()
|
||||
if DataManager.ChapterData:getMaxChapterId() == 1 then
|
||||
if ModuleManager.TutorialManager:checkFuncTutorial(GConst.TutorialConst.PASS_ONE_CHAPTER) then
|
||||
return
|
||||
return true
|
||||
end
|
||||
end
|
||||
|
||||
if DataManager.ChapterData:boxCanGet(2, 1) then
|
||||
if ModuleManager.TutorialManager:checkFuncTutorial(GConst.TutorialConst.TWO_CHAPTER_BOX_CAN_GOT) then
|
||||
return
|
||||
return true
|
||||
end
|
||||
end
|
||||
|
||||
if DataManager.ChapterData:getMaxChapterId() == 2 then
|
||||
if ModuleManager.TutorialManager:checkFuncTutorial(GConst.TutorialConst.PASS_THREE_CHAPTER) then
|
||||
return
|
||||
return true
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
-- 检查礼包
|
||||
function MainCityUI:checkGift()
|
||||
local actType, actId = DataManager.ShopData:getNextPopGiftData()
|
||||
if actType and actId then
|
||||
-- 触发弹窗
|
||||
ModuleManager.ShopManager:showGiftPopUI({type = actType, id = actId})
|
||||
-- 移除
|
||||
DataManager.ShopData:removePopUpGift(actType, actId)
|
||||
return true
|
||||
end
|
||||
end
|
||||
|
||||
return MainCityUI
|
||||
@ -94,7 +94,6 @@ function BoxLevelUI:refresh()
|
||||
self.rightArrow:setSprite(GConst.ATLAS_PATH.COMMON, "common_arrow_2")
|
||||
end
|
||||
|
||||
-- 目前文档没有写要屏蔽3级宝箱 所以暂不处理
|
||||
if not ModuleManager:getIsOpen(ModuleManager.MODULE_KEY.STORE_BOX_3_OPEN, true) then
|
||||
self.box3Node:setVisible(false)
|
||||
self.bg:setSizeDeltaY(BG_WITHOUT_3_BOX_HEIGHT)
|
||||
@ -137,16 +136,25 @@ function BoxLevelUI:refresh()
|
||||
self.box1Add1Node:setVisible(true)
|
||||
self.box1Add1ItemCell:refreshByCfg(reward1[1].id, 0)
|
||||
self.box1Add1ItemCell:setNum("")
|
||||
self.box1Add1ItemCell:addClickListener(function()
|
||||
ModuleManager.TipsManager:showItemTips(reward1[1].id, self.box1Add1ItemCell:getBaseObject())
|
||||
end)
|
||||
self.box1Add1Text:setText("+" .. tostring(reward1[1].num))
|
||||
else
|
||||
self.box1Add1Node:setVisible(true)
|
||||
self.box1Add1ItemCell:refreshByCfg(reward1[1].id, 0)
|
||||
self.box1Add1ItemCell:setNum("")
|
||||
self.box1Add1ItemCell:addClickListener(function()
|
||||
ModuleManager.TipsManager:showItemTips(reward1[1].id, self.box1Add1ItemCell:getBaseObject())
|
||||
end)
|
||||
self.box1Add1Text:setText("+" .. tostring(reward1[1].num))
|
||||
|
||||
self.box1Add2Node:setVisible(true)
|
||||
self.box1Add2ItemCell:refreshByCfg(reward1[2].id, 0)
|
||||
self.box1Add2ItemCell:setNum("")
|
||||
self.box1Add2ItemCell:addClickListener(function()
|
||||
ModuleManager.TipsManager:showItemTips(reward1[2].id, self.box1Add2ItemCell:getBaseObject())
|
||||
end)
|
||||
self.box1Add2Text:setText("+" .. tostring(reward1[2].num))
|
||||
end
|
||||
|
||||
@ -155,16 +163,25 @@ function BoxLevelUI:refresh()
|
||||
self.box2Add1Node:setVisible(true)
|
||||
self.box2Add1ItemCell:refreshByCfg(reward2[1].id, 0)
|
||||
self.box2Add1ItemCell:setNum("")
|
||||
self.box2Add1ItemCell:addClickListener(function()
|
||||
ModuleManager.TipsManager:showItemTips(reward2[1].id, self.box2Add1ItemCell:getBaseObject())
|
||||
end)
|
||||
self.box2Add1Text:setText("+" .. tostring(reward2[1].num))
|
||||
else
|
||||
self.box2Add1Node:setVisible(true)
|
||||
self.box2Add1ItemCell:refreshByCfg(reward2[1].id, 0)
|
||||
self.box2Add1ItemCell:setNum("")
|
||||
self.box2Add1ItemCell:addClickListener(function()
|
||||
ModuleManager.TipsManager:showItemTips(reward2[1].id, self.box2Add1ItemCell:getBaseObject())
|
||||
end)
|
||||
self.box2Add1Text:setText("+" .. tostring(reward2[1].num))
|
||||
|
||||
self.box2Add2Node:setVisible(true)
|
||||
self.box2Add2ItemCell:refreshByCfg(reward2[2].id, 0)
|
||||
self.box2Add2ItemCell:setNum("")
|
||||
self.box2Add2ItemCell:addClickListener(function()
|
||||
ModuleManager.TipsManager:showItemTips(reward2[2].id, self.box2Add2ItemCell:getBaseObject())
|
||||
end)
|
||||
self.box2Add2Text:setText("+" .. tostring(reward2[2].num))
|
||||
end
|
||||
|
||||
@ -173,16 +190,25 @@ function BoxLevelUI:refresh()
|
||||
self.box3Add1Node:setVisible(true)
|
||||
self.box3Add1ItemCell:refreshByCfg(reward3[1].id, 0)
|
||||
self.box3Add1ItemCell:setNum("")
|
||||
self.box3Add1ItemCell:addClickListener(function()
|
||||
ModuleManager.TipsManager:showItemTips(reward3[1].id, self.box3Add1ItemCell:getBaseObject())
|
||||
end)
|
||||
self.box3Add1Text:setText("+" .. tostring(reward3[1].num))
|
||||
else
|
||||
self.box3Add1Node:setVisible(true)
|
||||
self.box3Add1ItemCell:refreshByCfg(reward3[1].id, 0)
|
||||
self.box3Add1ItemCell:setNum("")
|
||||
self.box3Add1ItemCell:addClickListener(function()
|
||||
ModuleManager.TipsManager:showItemTips(reward3[1].id, self.box3Add1ItemCell:getBaseObject())
|
||||
end)
|
||||
self.box3Add1Text:setText("+" .. tostring(reward3[1].num))
|
||||
|
||||
self.box3Add2Node:setVisible(true)
|
||||
self.box3Add2ItemCell:refreshByCfg(reward3[2].id, 0)
|
||||
self.box3Add2ItemCell:setNum("")
|
||||
self.box3Add2ItemCell:addClickListener(function()
|
||||
ModuleManager.TipsManager:showItemTips(reward3[2].id, self.box3Add2ItemCell:getBaseObject())
|
||||
end)
|
||||
self.box3Add2Text:setText("+" .. tostring(reward3[2].num))
|
||||
end
|
||||
end
|
||||
|
||||
163
lua/app/ui/shop/box_level_up_ui.lua
Normal file
163
lua/app/ui/shop/box_level_up_ui.lua
Normal file
@ -0,0 +1,163 @@
|
||||
local BoxLevelUpUI = class("BoxLevelUpUI", BaseUI)
|
||||
|
||||
function BoxLevelUpUI:ctor(params)
|
||||
params = params or {}
|
||||
self.level = params.level or DataManager.SummonData:getSummonLevel()
|
||||
end
|
||||
|
||||
function BoxLevelUpUI:isFullScreen()
|
||||
return true
|
||||
end
|
||||
|
||||
function BoxLevelUpUI:getPrefabPath()
|
||||
return "assets/prefabs/ui/shop/box_level_up_ui.prefab"
|
||||
end
|
||||
|
||||
function BoxLevelUpUI:onLoadRootComplete()
|
||||
self.uiMap = self.root:genAllChildren()
|
||||
self.uiMap["box_level_up_ui.mask"]:addClickListener(function()
|
||||
self:closeUI()
|
||||
end)
|
||||
|
||||
self.titleTx = self.uiMap["box_level_up_ui.title.text"]
|
||||
self.lvTx = self.uiMap["box_level_up_ui.lv_up.text"]
|
||||
|
||||
self.box1Node = self.uiMap["box_level_up_ui.box_1"]
|
||||
self.box1Add1Node = self.uiMap["box_level_up_ui.box_1.add_node_1"]
|
||||
self.box1Add1ItemCell = CellManager:addCellComp(self.uiMap["box_level_up_ui.box_1.add_node_1.item_cell"], GConst.TYPEOF_LUA_CLASS.ITEM_CELL)
|
||||
self.box1Add1Text = self.uiMap["box_level_up_ui.box_1.add_node_1.text"]
|
||||
self.box1Add2Node = self.uiMap["box_level_up_ui.box_1.add_node_2"]
|
||||
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.box2Node = self.uiMap["box_level_up_ui.box_2"]
|
||||
self.box2Add1Node = self.uiMap["box_level_up_ui.box_2.add_node_1"]
|
||||
self.box2Add1ItemCell = CellManager:addCellComp(self.uiMap["box_level_up_ui.box_2.add_node_1.item_cell"], GConst.TYPEOF_LUA_CLASS.ITEM_CELL)
|
||||
self.box2Add1Text = self.uiMap["box_level_up_ui.box_2.add_node_1.text"]
|
||||
self.box2Add2Node = self.uiMap["box_level_up_ui.box_2.add_node_2"]
|
||||
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.box3Node = self.uiMap["box_level_up_ui.box_3"]
|
||||
self.box3Add1Node = self.uiMap["box_level_up_ui.box_3.add_node_1"]
|
||||
self.box3Add1ItemCell = CellManager:addCellComp(self.uiMap["box_level_up_ui.box_3.add_node_1.item_cell"], GConst.TYPEOF_LUA_CLASS.ITEM_CELL)
|
||||
self.box3Add1Text = self.uiMap["box_level_up_ui.box_3.add_node_1.text"]
|
||||
self.box3Add2Node = self.uiMap["box_level_up_ui.box_3.add_node_2"]
|
||||
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.closeTx = self.uiMap["box_level_up_ui.close_tx"]
|
||||
|
||||
self:refresh()
|
||||
end
|
||||
|
||||
function BoxLevelUpUI:refresh()
|
||||
self.titleTx:setText("宝箱等级提升!TD") -- TODOJ
|
||||
self.lvTx:setText("Lv." .. tostring(self.level))
|
||||
self.closeTx:setText("点击继续TD") -- TODOJ
|
||||
|
||||
self.box1Add1Node:setVisible(false)
|
||||
self.box1Add2Node:setVisible(false)
|
||||
self.box1Desc:setVisible(false)
|
||||
|
||||
self.box2Add1Node:setVisible(false)
|
||||
self.box2Add2Node:setVisible(false)
|
||||
self.box2Desc:setVisible(false)
|
||||
|
||||
self.box3Add1Node:setVisible(false)
|
||||
self.box3Add2Node:setVisible(false)
|
||||
self.box3Desc:setVisible(false)
|
||||
|
||||
local reward1 = DataManager.SummonData:getSummonRewardByLv(GConst.SummonConst.SUMMON_TYPE.LV_1, self.level)
|
||||
local reward2 = DataManager.SummonData:getSummonRewardByLv(GConst.SummonConst.SUMMON_TYPE.LV_2, self.level)
|
||||
local reward3 = DataManager.SummonData:getSummonRewardByLv(GConst.SummonConst.SUMMON_TYPE.LV_3, self.level)
|
||||
|
||||
local count = #reward1
|
||||
if count == 1 then
|
||||
self.box1Add1Node:setVisible(true)
|
||||
self.box1Add1ItemCell:refreshByCfg(reward1[1].id, 0)
|
||||
self.box1Add1ItemCell:setNum("")
|
||||
self.box1Add1ItemCell:addClickListener(function()
|
||||
ModuleManager.TipsManager:showItemTips(reward1[1].id, self.box1Add1ItemCell:getBaseObject())
|
||||
end)
|
||||
self.box1Add1Text:setText("+" .. tostring(reward1[1].num))
|
||||
else
|
||||
self.box1Add1Node:setVisible(true)
|
||||
self.box1Add1ItemCell:refreshByCfg(reward1[1].id, 0)
|
||||
self.box1Add1ItemCell:setNum("")
|
||||
self.box1Add1ItemCell:addClickListener(function()
|
||||
ModuleManager.TipsManager:showItemTips(reward1[1].id, self.box1Add1ItemCell:getBaseObject())
|
||||
end)
|
||||
self.box1Add1Text:setText("+" .. tostring(reward1[1].num))
|
||||
|
||||
self.box1Add2Node:setVisible(true)
|
||||
self.box1Add2ItemCell:refreshByCfg(reward1[2].id, 0)
|
||||
self.box1Add2ItemCell:setNum("")
|
||||
self.box1Add2ItemCell:addClickListener(function()
|
||||
ModuleManager.TipsManager:showItemTips(reward1[2].id, self.box1Add2ItemCell:getBaseObject())
|
||||
end)
|
||||
self.box1Add2Text:setText("+" .. tostring(reward1[2].num))
|
||||
end
|
||||
|
||||
local count = #reward2
|
||||
if count == 1 then
|
||||
self.box2Add1Node:setVisible(true)
|
||||
self.box2Add1ItemCell:refreshByCfg(reward2[1].id, 0)
|
||||
self.box2Add1ItemCell:setNum("")
|
||||
self.box2Add1ItemCell:addClickListener(function()
|
||||
ModuleManager.TipsManager:showItemTips(reward2[1].id, self.box2Add1ItemCell:getBaseObject())
|
||||
end)
|
||||
self.box2Add1Text:setText("+" .. tostring(reward2[1].num))
|
||||
else
|
||||
self.box2Add1Node:setVisible(true)
|
||||
self.box2Add1ItemCell:refreshByCfg(reward2[1].id, 0)
|
||||
self.box2Add1ItemCell:setNum("")
|
||||
self.box2Add1ItemCell:addClickListener(function()
|
||||
ModuleManager.TipsManager:showItemTips(reward2[1].id, self.box2Add1ItemCell:getBaseObject())
|
||||
end)
|
||||
self.box2Add1Text:setText("+" .. tostring(reward2[1].num))
|
||||
|
||||
self.box2Add2Node:setVisible(true)
|
||||
self.box2Add2ItemCell:refreshByCfg(reward2[2].id, 0)
|
||||
self.box2Add2ItemCell:setNum("")
|
||||
self.box2Add2ItemCell:addClickListener(function()
|
||||
ModuleManager.TipsManager:showItemTips(reward2[2].id, self.box2Add2ItemCell:getBaseObject())
|
||||
end)
|
||||
self.box2Add2Text:setText("+" .. tostring(reward2[2].num))
|
||||
end
|
||||
|
||||
local count = #reward3
|
||||
if count == 1 then
|
||||
self.box3Add1Node:setVisible(true)
|
||||
self.box3Add1ItemCell:refreshByCfg(reward3[1].id, 0)
|
||||
self.box3Add1ItemCell:setNum("")
|
||||
self.box3Add1ItemCell:addClickListener(function()
|
||||
ModuleManager.TipsManager:showItemTips(reward3[1].id, self.box3Add1ItemCell:getBaseObject())
|
||||
end)
|
||||
self.box3Add1Text:setText("+" .. tostring(reward3[1].num))
|
||||
else
|
||||
self.box3Add1Node:setVisible(true)
|
||||
self.box3Add1ItemCell:refreshByCfg(reward3[1].id, 0)
|
||||
self.box3Add1ItemCell:setNum("")
|
||||
self.box3Add1ItemCell:addClickListener(function()
|
||||
ModuleManager.TipsManager:showItemTips(reward3[1].id, self.box3Add1ItemCell:getBaseObject())
|
||||
end)
|
||||
self.box3Add1Text:setText("+" .. tostring(reward3[1].num))
|
||||
|
||||
self.box3Add2Node:setVisible(true)
|
||||
self.box3Add2ItemCell:refreshByCfg(reward3[2].id, 0)
|
||||
self.box3Add2ItemCell:setNum("")
|
||||
self.box3Add2ItemCell:addClickListener(function()
|
||||
ModuleManager.TipsManager:showItemTips(reward3[2].id, self.box3Add2ItemCell:getBaseObject())
|
||||
end)
|
||||
self.box3Add2Text:setText("+" .. tostring(reward3[2].num))
|
||||
end
|
||||
end
|
||||
|
||||
return BoxLevelUpUI
|
||||
10
lua/app/ui/shop/box_level_up_ui.lua.meta
Normal file
10
lua/app/ui/shop/box_level_up_ui.lua.meta
Normal file
@ -0,0 +1,10 @@
|
||||
fileFormatVersion: 2
|
||||
guid: a0c868370ad4a41428279122b3d5dc49
|
||||
ScriptedImporter:
|
||||
internalIDToNameTable: []
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
script: {fileID: 11500000, guid: 3b8b241bab4a4ac9a22fcce9c64f1242, type: 3}
|
||||
@ -35,6 +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.scrollRectObj = self.uiMap["box_reward_ui.scroll_rect"]
|
||||
self.scrollRect = self.scrollRectObj:addLuaComponent(GConst.TYPEOF_LUA_CLASS.SCROLL_RECT_BASE)
|
||||
@ -60,8 +61,15 @@ function BoxRewardUI:onLoadRootComplete()
|
||||
|
||||
self.closeTx = self.uiMap["box_reward_ui.close_tx"]
|
||||
self.closeTx:setText("点击关闭TD") -- TODOJ
|
||||
self.closeTx:addClickListener(function()
|
||||
|
||||
self.mask = self.uiMap["box_reward_ui.mask"]
|
||||
self.mask:addClickListener(function()
|
||||
self:closeUI()
|
||||
-- 如果宝箱等级提升了 则要弹出宝箱等级提升UI
|
||||
if DataManager.SummonData:checkNeedPopBoxLvUpUI() then
|
||||
DataManager.SummonData:clearNeedPopBoxLvUpUI()
|
||||
ModuleManager.ShopManager:showBoxLevelUpUI()
|
||||
end
|
||||
end)
|
||||
end
|
||||
|
||||
|
||||
@ -39,7 +39,7 @@ function BeginnerSellCell:init()
|
||||
end
|
||||
|
||||
function BeginnerSellCell:refresh()
|
||||
local actGiftId = GConst.ShopConst.ACT_GIFT_ID.BEGINNER_GIFT
|
||||
local actGiftId = GConst.ShopConst.BEGINNER_GIFT_ID
|
||||
local cfgInfo = ConfigManager:getConfig("act_gift")[actGiftId]
|
||||
-- 超值
|
||||
if cfgInfo.value then
|
||||
@ -87,7 +87,7 @@ function BeginnerSellCell:getCellHeight()
|
||||
end
|
||||
|
||||
function BeginnerSellCell:getIsOpen()
|
||||
return true -- TOODJ
|
||||
return not DataManager.ShopData:getBeginnerGiftHasBuy()
|
||||
end
|
||||
|
||||
function BeginnerSellCell:setVisible(visible)
|
||||
@ -95,7 +95,7 @@ function BeginnerSellCell:setVisible(visible)
|
||||
end
|
||||
|
||||
function BeginnerSellCell:onClickGift(id)
|
||||
Logger.logHighlight("Click id:%s", id) -- TODOJ
|
||||
PayManager:purchasePackage(id, PayManager.PURCHARSE_TYPE.ACT_GIFT)
|
||||
end
|
||||
|
||||
return BeginnerSellCell
|
||||
@ -116,6 +116,13 @@ function BoxSellCell:refreshCost()
|
||||
end
|
||||
|
||||
function BoxSellCell:onClickBox(summonType)
|
||||
local costItem, cost = DataManager.SummonData:getSummonCost(summonType)
|
||||
if not GFunc.checkCost(costItem.id, costItem.num, false) then
|
||||
if not GFunc.checkCost(cost.id, cost.num, true) then
|
||||
return
|
||||
end
|
||||
end
|
||||
|
||||
ModuleManager.ShopManager:showBoxHeroUI(summonType)
|
||||
end
|
||||
|
||||
|
||||
@ -39,7 +39,7 @@ function ChapterCell:init()
|
||||
self.timeText = uiMap["gift_cell.bg.time_img.text"]
|
||||
end
|
||||
|
||||
function ChapterCell:refresh(idx, cfgInfo, totalCount, arrowCallback, clickCallback)
|
||||
function ChapterCell:refresh(idx, cfgInfo, totalCount, arrowCallback)
|
||||
-- 箭头
|
||||
local showLeftArrow = true
|
||||
local showRightArrow = true
|
||||
@ -90,15 +90,17 @@ function ChapterCell:refresh(idx, cfgInfo, totalCount, arrowCallback, clickCallb
|
||||
-- 限时(隐藏)
|
||||
self.timeImg:setVisible(false)
|
||||
|
||||
if clickCallback then
|
||||
self:addClickListener(function()
|
||||
clickCallback(idx)
|
||||
end)
|
||||
end
|
||||
self:addClickListener(function()
|
||||
self:onClickGift(cfgInfo.id)
|
||||
end)
|
||||
end
|
||||
|
||||
function ChapterCell:setVisible(visible)
|
||||
self.baseObject:setVisible(visible)
|
||||
end
|
||||
|
||||
function ChapterCell:onClickGift(id)
|
||||
PayManager:purchasePackage(id, PayManager.PURCHARSE_TYPE.CHAPTER_GIFT)
|
||||
end
|
||||
|
||||
return ChapterCell
|
||||
@ -15,9 +15,6 @@ function ChapterSellCell:init()
|
||||
cell:refresh(idx, self.actChapterCfg[idx], #self.actChapterCfg,
|
||||
function (add)
|
||||
self.contentObj:addAnchoredPosition(add*720)
|
||||
end,
|
||||
function(idx)
|
||||
self:onClickGift(self.actChapterCfg[idx].id)
|
||||
end)
|
||||
end
|
||||
end)
|
||||
@ -27,13 +24,12 @@ function ChapterSellCell:init()
|
||||
end
|
||||
|
||||
function ChapterSellCell:refresh()
|
||||
-- 暂无数据部分 测试用 TODOJ
|
||||
local tmpIds = {303, 203, 103} -- {103, 203, 303}
|
||||
local actIdList = DataManager.ShopData:getActChapterStoreCanBuyActIds()
|
||||
self.actChapterCfg = {}
|
||||
local actChapterCfg = ConfigManager:getConfig("act_chapter_store")
|
||||
for i = 1, #tmpIds do
|
||||
local cfgInfo = clone(actChapterCfg[tmpIds[i]])
|
||||
cfgInfo.id = tmpIds[i]
|
||||
local actChapterCfg = DataManager.ShopData:getActChapterStoreConfig()
|
||||
for i = 1, #actIdList do
|
||||
local cfgInfo = clone(actChapterCfg[actIdList[i]])
|
||||
cfgInfo.id = actIdList[i]
|
||||
table.insert(self.actChapterCfg, cfgInfo)
|
||||
end
|
||||
self.scrollRect:refillCells(#self.actChapterCfg)
|
||||
@ -45,15 +41,12 @@ function ChapterSellCell:getCellHeight()
|
||||
end
|
||||
|
||||
function ChapterSellCell:getIsOpen()
|
||||
return true -- TOODJ
|
||||
-- 有可购买的礼包 才打开
|
||||
return #DataManager.ShopData:getActChapterStoreCanBuyActIds() > 0
|
||||
end
|
||||
|
||||
function ChapterSellCell:setVisible(visible)
|
||||
self.baseObject:setVisible(visible)
|
||||
end
|
||||
|
||||
function ChapterSellCell:onClickGift(id)
|
||||
Logger.logHighlight("Click id:%s", id) -- TODOJ
|
||||
end
|
||||
|
||||
return ChapterSellCell
|
||||
@ -25,7 +25,7 @@ function GemCell:refresh(id, cfgInfo)
|
||||
local reward = cfgInfo.reward[1]
|
||||
local limit = cfgInfo.limit or 0
|
||||
local adMaxTimes = cfgInfo.daily or 0
|
||||
local bought = DataManager.ShopData:getGiftBoughtNum(GConst.ShopConst.GIFT_TYPE.MALL_TREASURE, id)
|
||||
local bought = DataManager.ShopData:getGiftBoughtNum(PayManager.PURCHARSE_TYPE.MALL_TREASURE, id)
|
||||
|
||||
local isFree = rechargeId == nil
|
||||
local hasDoubleTimes = bought < limit
|
||||
@ -79,15 +79,15 @@ function GemCell:onClickGift(id, isAd)
|
||||
if isAd then
|
||||
local cfgInfo = DataManager.ShopData:getMallTreasureConfig()[id]
|
||||
local adMaxTimes = cfgInfo.daily or 0
|
||||
local bought = DataManager.ShopData:getGiftBoughtNum(GConst.ShopConst.GIFT_TYPE.MALL_TREASURE, id)
|
||||
local bought = DataManager.ShopData:getGiftBoughtNum(PayManager.PURCHARSE_TYPE.MALL_TREASURE, id)
|
||||
local adLeftCount = adMaxTimes - bought
|
||||
if adLeftCount > 0 then
|
||||
SDKManager:showFullScreenAds(BIReport.ADS_CLICK_TYPE.MALL_TREASURE, function ()
|
||||
ModuleManager.ShopManager:buyMallTreasure(id, isAd)
|
||||
PayManager:purchasePackage(id, PayManager.PURCHARSE_TYPE.MALL_TREASURE)
|
||||
end)
|
||||
end
|
||||
else
|
||||
ModuleManager.ShopManager:buyMallTreasure(id, isAd)
|
||||
PayManager:purchasePackage(id, PayManager.PURCHARSE_TYPE.MALL_TREASURE)
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
166
lua/app/ui/shop/gift_pop_ui.lua
Normal file
166
lua/app/ui/shop/gift_pop_ui.lua
Normal file
@ -0,0 +1,166 @@
|
||||
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_TYPE.CHAPTER_GIFT] = "assets/arts/textures/background/shop/shop_gift_banner_1_1.png", -- TODOJ
|
||||
}
|
||||
local GIFT_TITLE_TEXT = {
|
||||
[PayManager.PURCHARSE_TYPE.ACT_GIFT] = {
|
||||
[PayManager.PURCHARSE_ACT_TYPE.BEGINNER_GIFT] = "新手礼包TD", -- TODOJ
|
||||
},
|
||||
[PayManager.PURCHARSE_TYPE.CHAPTER_GIFT] = "章节礼包TD", -- TODOJ
|
||||
}
|
||||
|
||||
local MAX_ITEM_NUM = 4
|
||||
|
||||
function GiftPopUI:ctor(params)
|
||||
params = params or {}
|
||||
|
||||
self.actType = params.type
|
||||
self.actId = params.id
|
||||
end
|
||||
|
||||
function GiftPopUI:isFullScreen()
|
||||
return false
|
||||
end
|
||||
|
||||
function GiftPopUI:getPrefabPath()
|
||||
return "assets/prefabs/ui/shop/gift_pop_ui.prefab"
|
||||
end
|
||||
|
||||
function GiftPopUI:onLoadRootComplete()
|
||||
if not self.actType or not self.actId then
|
||||
self:closeUI()
|
||||
end
|
||||
|
||||
self.uiMap = self.root:genAllChildren()
|
||||
self.uiMap["gift_pop_ui.close_btn"]:addClickListener(function()
|
||||
self:checkNextPopGiftOrClose()
|
||||
end)
|
||||
|
||||
self.titleTx = self.uiMap["gift_pop_ui.bg.title"]
|
||||
self.banner = self.uiMap["gift_pop_ui.bg.banner"]
|
||||
|
||||
self.offNode = self.uiMap["gift_pop_ui.bg.off_img"]
|
||||
self.offText = self.uiMap["gift_pop_ui.bg.off_img.text"]
|
||||
|
||||
self.itemNodeLayout = self.uiMap["gift_pop_ui.bg.item_node"]:getComponent(GConst.TYPEOF_UNITY_CLASS.BF_HORIZONTAL_OR_VERTICAL_LAYOUT)
|
||||
self.itemNodeList = {}
|
||||
self.itemCellList = {}
|
||||
self.itemTextList = {}
|
||||
self.itemHelpList = {}
|
||||
for i = 1, MAX_ITEM_NUM do
|
||||
table.insert(self.itemNodeList, self.uiMap["gift_pop_ui.bg.item_" .. i])
|
||||
table.insert(self.itemCellList, CellManager:addCellComp(self.uiMap["gift_pop_ui.bg.item_".. i .. ".item_cell"], GConst.TYPEOF_LUA_CLASS.ITEM_CELL))
|
||||
table.insert(self.itemTextList, self.uiMap["gift_pop_ui.bg.item_".. i .. ".num"])
|
||||
table.insert(self.itemHelpList, self.uiMap["gift_pop_ui.bg.item_" .. i .. ".help"])
|
||||
end
|
||||
|
||||
self.timeNode = self.uiMap["gift_pop_ui.bg.time_node"]
|
||||
self.timeText = self.uiMap["gift_pop_ui.bg.time_node.text"]
|
||||
|
||||
self.buyBtn = self.uiMap["gift_pop_ui.bg.buy_btn"]
|
||||
self.buyBtnTx = self.uiMap["gift_pop_ui.bg.buy_btn.text"]
|
||||
self.buyBtnIcon = self.uiMap["gift_pop_ui.bg.buy_btn.icon"]
|
||||
|
||||
self.buyBtn:addClickListener(function()
|
||||
self:onClickGift()
|
||||
end)
|
||||
|
||||
self:_bind()
|
||||
self:scheduleGlobal(function()
|
||||
self:updateTime()
|
||||
end, 1)
|
||||
self:refresh()
|
||||
end
|
||||
|
||||
function GiftPopUI:_bind()
|
||||
self:bind(DataManager.ShopData, "isDirty", function()
|
||||
self:refresh(true)
|
||||
end)
|
||||
end
|
||||
|
||||
function GiftPopUI:refresh(needCheck)
|
||||
if needCheck then
|
||||
-- 如果已经购买过了 则切为下一个或关闭UI 目前都是唯一礼包
|
||||
local bought = DataManager.ShopData:getGiftBoughtNum(self.actType, self.actId)
|
||||
if bought > 0 then
|
||||
self:checkNextPopGiftOrClose()
|
||||
return
|
||||
end
|
||||
end
|
||||
|
||||
if self.actType == PayManager.PURCHARSE_TYPE.ACT_GIFT then
|
||||
local type = PayManager:getGiftConfigInfo(self.actType, self.actId).type
|
||||
self.titleTx:setText(GIFT_TITLE_TEXT[self.actType][type])
|
||||
self.banner:setTexture(GIFT_BG_NAME[self.actType][type])
|
||||
else
|
||||
self.titleTx:setText(GIFT_TITLE_TEXT[self.actType])
|
||||
self.banner:setTexture(GIFT_BG_NAME[self.actType])
|
||||
end
|
||||
|
||||
local cfgInfo = PayManager:getGiftConfigInfo(self.actType, self.actId)
|
||||
if cfgInfo then
|
||||
local off = cfgInfo.value or 0
|
||||
if off < 10 then -- 统一为百分比格式
|
||||
off = off * 100
|
||||
end
|
||||
if off > 0 then
|
||||
self.offNode:setVisible(true)
|
||||
self.offText:setText(tostring(off) .. "%")
|
||||
else
|
||||
self.offNode:setVisible(false)
|
||||
end
|
||||
end
|
||||
|
||||
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
|
||||
self.itemNodeLayout:RefreshLayout()
|
||||
|
||||
local rechargeId = cfgInfo.recharge_id
|
||||
if rechargeId then
|
||||
self.buyBtnTx:setText(GFunc.getFormatPrice(rechargeId))
|
||||
end
|
||||
|
||||
self:updateTime()
|
||||
end
|
||||
|
||||
function GiftPopUI:updateTime()
|
||||
-- TODOJ
|
||||
end
|
||||
|
||||
function GiftPopUI:onClickGift()
|
||||
PayManager:purchasePackage(self.actId, self.actType)
|
||||
end
|
||||
|
||||
function GiftPopUI:checkNextPopGiftOrClose()
|
||||
local actType, actId = DataManager.ShopData:getNextPopGiftData()
|
||||
if actType and actId then
|
||||
-- 更新数据
|
||||
self.actType = actType
|
||||
self.actId = actId
|
||||
|
||||
self:refresh()
|
||||
-- 移除弹窗列表
|
||||
DataManager.ShopData:removePopUpGift(actType, actId)
|
||||
else
|
||||
self:closeUI()
|
||||
end
|
||||
end
|
||||
|
||||
return GiftPopUI
|
||||
10
lua/app/ui/shop/gift_pop_ui.lua.meta
Normal file
10
lua/app/ui/shop/gift_pop_ui.lua.meta
Normal file
@ -0,0 +1,10 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 61eca75f20973c44cb9ede981da0583b
|
||||
ScriptedImporter:
|
||||
internalIDToNameTable: []
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
script: {fileID: 11500000, guid: 3b8b241bab4a4ac9a22fcce9c64f1242, type: 3}
|
||||
@ -27,6 +27,8 @@ function BattleData:init()
|
||||
self.lockElementMap = {}
|
||||
self.data.timeSpeed = 1
|
||||
self.data.lvDirty = false
|
||||
self.adRefreshSkillCount = 0
|
||||
self.refreshSkillCount = 0
|
||||
BattleSkillEntity.sid = 0
|
||||
self.atkTeam = self:initTeam(BattleConst.SIDE_ATK)
|
||||
self.defTeam = self:initTeam(BattleConst.SIDE_DEF)
|
||||
@ -532,6 +534,21 @@ function BattleData:useCommonSelectSkillCount()
|
||||
return true
|
||||
end
|
||||
|
||||
function BattleData:addRefreshSkillCount(isAd)
|
||||
if isAd then
|
||||
self.adRefreshSkillCount = self.adRefreshSkillCount + 1
|
||||
end
|
||||
self.refreshSkillCount = self.refreshSkillCount + 1
|
||||
end
|
||||
|
||||
function BattleData:getRefreshSkillCount()
|
||||
return self.refreshSkillCount
|
||||
end
|
||||
|
||||
function BattleData:getADRefreshSkillCount()
|
||||
return self.adRefreshSkillCount
|
||||
end
|
||||
|
||||
function BattleData:initTeam(side)
|
||||
local data = nil
|
||||
if side == BattleConst.SIDE_ATK then
|
||||
|
||||
@ -4,8 +4,12 @@ function ShopData:ctor()
|
||||
self.data.isDirty = false
|
||||
end
|
||||
|
||||
function ShopData:clear()
|
||||
function ShopData:initBase()
|
||||
self:initActChapterStoreData()
|
||||
self:initCrossDay()
|
||||
end
|
||||
|
||||
function ShopData:clear()
|
||||
DataManager:unregisterCrossDayFunc("ShopData")
|
||||
end
|
||||
|
||||
@ -24,12 +28,10 @@ end
|
||||
|
||||
-- 初始化购买的礼包
|
||||
function ShopData:initActGift(act)
|
||||
|
||||
if EDITOR_MODE then
|
||||
Logger.logHighlight("初始化 initActGift")
|
||||
Logger.printTable(act)
|
||||
end
|
||||
|
||||
act = act or {}
|
||||
local gifts = act.gifts or {}
|
||||
-- 转为map结构
|
||||
@ -93,13 +95,33 @@ function ShopData:updateGiftInfo(gift)
|
||||
self:setDirty()
|
||||
end
|
||||
|
||||
function ShopData:getShopItemCfg(giftData)
|
||||
if giftData.act_type == 1 then -- mall_act
|
||||
return ConfigManager:getConfig("mall_act")[giftData.id]
|
||||
-- 标记一个礼包需要弹出 在条件允许时会弹出
|
||||
function ShopData:markPopUpGift(actType, actId)
|
||||
if not self.needPopUpGift then
|
||||
self.needPopUpGift = {}
|
||||
end
|
||||
if giftData.act_type == 5 then -- mall_treasure
|
||||
return ConfigManager:getConfig("mall_treasure")[giftData.id]
|
||||
if not self.needPopUpGift[actType] then
|
||||
self.needPopUpGift[actType] = {}
|
||||
end
|
||||
table.insert(self.needPopUpGift[actType], actId)
|
||||
end
|
||||
|
||||
function ShopData:removePopUpGift(actType, actId)
|
||||
if self.needPopUpGift then
|
||||
if self.needPopUpGift[actType] then
|
||||
for index, id in ipairs(self.needPopUpGift[actType]) do
|
||||
if id == actId then
|
||||
table.remove(self.needPopUpGift[actType], index)
|
||||
break
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
-- 获取待处理弹出礼包结构 {type:[id1,id2,...]}
|
||||
function ShopData:getPopUpGift()
|
||||
return self.needPopUpGift
|
||||
end
|
||||
|
||||
-- 通用礼包结束 ----------------------------------------------------------------------------------------------
|
||||
@ -226,7 +248,6 @@ function ShopData:getMallGoldConfig()
|
||||
end
|
||||
|
||||
function ShopData:initCommonDailyGoldGift(ad_count)
|
||||
|
||||
if EDITOR_MODE then
|
||||
Logger.logHighlight("初始化 initCommonDailyGoldGift")
|
||||
Logger.printTable(ad_count)
|
||||
@ -246,11 +267,6 @@ end
|
||||
function ShopData:getCommonDailyCoinNum(time)
|
||||
local coinPerHour = DataManager.IdleData:getGoldPerHour() -- TODOJ
|
||||
return coinPerHour * time // 3600
|
||||
|
||||
-- local goldDrop = DataManager.ChapterData:getGoldDrop()
|
||||
-- local idleGoldDropTime = DataManager.IdleData:getIdleGoldDropTime()
|
||||
-- Logger.logHighlight("getCommonDailyCoinNum -- time:%s gold:%s idle:%s", time, goldDrop, idleGoldDropTime)
|
||||
-- return goldDrop * time // idleGoldDropTime
|
||||
end
|
||||
|
||||
function ShopData:getCommonDailyCoinDataById(id)
|
||||
@ -262,11 +278,88 @@ end
|
||||
|
||||
-- 常驻金币礼包结束 ----------------------------------------------------------------------------------------------
|
||||
|
||||
-- 常驻钻石礼包
|
||||
-- 常驻钻石礼包 **********************************************************************************************
|
||||
function ShopData:getMallTreasureConfig()
|
||||
return ConfigManager:getConfig("mall_treasure")
|
||||
end
|
||||
|
||||
-- 常驻钻石礼包结束 ----------------------------------------------------------------------------------------------
|
||||
|
||||
-- 章节礼包 act_chapter_store **********************************************************************************************
|
||||
function ShopData:initActChapterStoreData()
|
||||
if not self.actChapterStoreMap then
|
||||
self.actChapterStoreId2ChapterIdMap = {}
|
||||
self.actChapterStoreChapterId2IdMap = {}
|
||||
local cfg = self:getActChapterStoreConfig()
|
||||
for id, cfgInfo in pairs(cfg) do
|
||||
self.actChapterStoreId2ChapterIdMap[id] = cfgInfo.chapter
|
||||
self.actChapterStoreChapterId2IdMap[cfgInfo.chapter] = id
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
function ShopData:getActChapterStoreConfig()
|
||||
return ConfigManager:getConfig("act_chapter_store")
|
||||
end
|
||||
|
||||
-- 特定章节礼包是否已购买
|
||||
function ShopData:getActChapterStoreHasBuy(chapterId)
|
||||
-- 章节礼包的id-chapterId相互对应map
|
||||
local actId = self.actChapterStoreChapterId2IdMap[chapterId]
|
||||
if self:getGiftBoughtNum(PayManager.PURCHARSE_TYPE.CHAPTER_GIFT, actId) == 0 then
|
||||
return false
|
||||
else
|
||||
return true
|
||||
end
|
||||
end
|
||||
|
||||
-- 根据当前章节,获取可购买的id数组
|
||||
function ShopData:getActChapterStoreCanBuyActIds()
|
||||
local list = {}
|
||||
local curChapterId = DataManager.ChapterData:getMaxChapterId()
|
||||
for id = curChapterId, 1, -1 do
|
||||
if not self:getActChapterStoreHasBuy(id) then
|
||||
table.insert(list, self.actChapterStoreChapterId2IdMap[id])
|
||||
end
|
||||
end
|
||||
return list
|
||||
end
|
||||
|
||||
function ShopData:markPopUpGiftForActChapterStore(chapterId)
|
||||
local actId = self.actChapterStoreChapterId2IdMap[chapterId]
|
||||
self:markPopUpGift(PayManager.PURCHARSE_TYPE.CHAPTER_GIFT, actId)
|
||||
end
|
||||
|
||||
-- 获取下一个需要弹出的礼包数据
|
||||
function ShopData:getNextPopGiftData()
|
||||
local popUpGift = self:getPopUpGift()
|
||||
if popUpGift then
|
||||
for actType, actIdList in pairs(popUpGift) do
|
||||
-- 弹窗顺序待处理 TODOJ
|
||||
for _, actId in ipairs(actIdList) do
|
||||
return actType, actId
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
-- 章节礼包结束 ----------------------------------------------------------------------------------------------
|
||||
|
||||
-- 新手礼包 **********************************************************************************************
|
||||
function ShopData:markPopUpGiftForBeginnerGift()
|
||||
self:markPopUpGift(PayManager.PURCHARSE_TYPE.ACT_GIFT, GConst.ShopConst.BEGINNER_GIFT_ID)
|
||||
end
|
||||
|
||||
function ShopData:getBeginnerGiftHasBuy()
|
||||
if self:getGiftBoughtNum(PayManager.PURCHARSE_TYPE.ACT_GIFT, GConst.ShopConst.BEGINNER_GIFT_ID) == 0 then
|
||||
return false
|
||||
else
|
||||
return true
|
||||
end
|
||||
end
|
||||
|
||||
-- 新手礼包结束 ----------------------------------------------------------------------------------------------
|
||||
|
||||
-- 初始化成长礼包
|
||||
function ShopData:initGrowUpGift(growUpGift)
|
||||
end
|
||||
|
||||
@ -18,16 +18,24 @@ function SummonData:initCrossDay()
|
||||
end)
|
||||
end
|
||||
|
||||
function SummonData:init(summon)
|
||||
function SummonData:init(summon, isInit)
|
||||
if EDITOR_MODE then
|
||||
Logger.logHighlight("召唤初始化")
|
||||
Logger.printTable(summon)
|
||||
end
|
||||
|
||||
local lastLv = self.level
|
||||
|
||||
summon = summon or {}
|
||||
self.level = summon.level or 1
|
||||
self.exp = summon.exp or 0
|
||||
|
||||
if not isInit then
|
||||
if lastLv and lastLv < self.level then
|
||||
self:markNeedPopBoxLvUpUI()
|
||||
end
|
||||
end
|
||||
|
||||
self:setDirty()
|
||||
end
|
||||
|
||||
@ -71,10 +79,11 @@ function SummonData:getSummonRewardByLv(summonType, level)
|
||||
end
|
||||
|
||||
function SummonData:getSummonTotalRewardByLv(summonType, level)
|
||||
|
||||
level = level or self:getSummonLevel()
|
||||
local rewards = {}
|
||||
for i = 1, level do
|
||||
local lvRewards = self:getSummonRewardByLv(summonType)
|
||||
for lv = 1, level do
|
||||
local lvRewards = self:getSummonRewardByLv(summonType, lv)
|
||||
for _, reward in ipairs(lvRewards) do
|
||||
table.insert(rewards, reward)
|
||||
end
|
||||
@ -109,4 +118,17 @@ function SummonData:getLastSummonRewards()
|
||||
return self.summonRewards or {}
|
||||
end
|
||||
|
||||
-- 如果宝箱等级提升了 则标记
|
||||
function SummonData:markNeedPopBoxLvUpUI()
|
||||
self.needPopBoxLvUpUI = true
|
||||
end
|
||||
|
||||
function SummonData:clearNeedPopBoxLvUpUI()
|
||||
self.needPopBoxLvUpUI = false
|
||||
end
|
||||
|
||||
function SummonData:checkNeedPopBoxLvUpUI()
|
||||
return self.needPopBoxLvUpUI
|
||||
end
|
||||
|
||||
return SummonData
|
||||
Loading…
x
Reference in New Issue
Block a user