Merge branch 'dev' of git.juzugame.com:b6-client/b6-lua into dev

This commit is contained in:
CloudJ 2023-05-23 18:37:12 +08:00
commit ada108ac82
19 changed files with 496 additions and 99 deletions

View File

@ -77,6 +77,7 @@ BIReport.ITEM_GET_TYPE = {
MALL_DAILY_RESET = "MallDailyReset", MALL_DAILY_RESET = "MallDailyReset",
SUMMON = "Summon", SUMMON = "Summon",
PLAYER_LV_UP = "PlayerLvUp", PLAYER_LV_UP = "PlayerLvUp",
GOLD_PIG = "GoldPig",
} }
BIReport.ADS_CLICK_TYPE = { BIReport.ADS_CLICK_TYPE = {
@ -119,6 +120,7 @@ BIReport.BATTLE_TYPE = {
BIReport.GIFT_TYPE = { BIReport.GIFT_TYPE = {
BOUNTY = "Bounty", BOUNTY = "Bounty",
GOLD_PIG = "GoldPig",
MALL_TREASURE = "MallTreasure", MALL_TREASURE = "MallTreasure",
} }

View File

@ -120,7 +120,7 @@ function DataManager:initWithServerData(data)
self.TutorialData:init(data.guide) self.TutorialData:init(data.guide)
self.MailData:init(data.mail_info) self.MailData:init(data.mail_info)
self.ActivityData:init() self.ActivityData:init()
self.GoldPigData:init(data.pig) self.GoldPigData:init(data.pig, true)
self.BountyData:init(data.bounty) self.BountyData:init(data.bounty)
-- 任务要在BountyData之后初始化依赖BountyData的数据 -- 任务要在BountyData之后初始化依赖BountyData的数据
self.DailyTaskData:init(data.task_daily) self.DailyTaskData:init(data.task_daily)

View File

@ -4,7 +4,7 @@ local BLESSING_GIFT_ID = 30001
PayManager.PURCHARSE_TYPE = { PayManager.PURCHARSE_TYPE = {
ACT_GIFT = 1, ACT_GIFT = 1,
GOLD_PIG = 2, ACT_GOLD_PIG = 2,
CHAPTER_GIFT = 3, CHAPTER_GIFT = 3,
GROW_UP_GIFT = 4, GROW_UP_GIFT = 4,
MALL_TREASURE = 5, MALL_TREASURE = 5,
@ -16,6 +16,7 @@ PayManager.PURCHARSE_ACT_TYPE = {
PayManager.PURCHARSE_TYPE_CONFIG = { PayManager.PURCHARSE_TYPE_CONFIG = {
[PayManager.PURCHARSE_TYPE.ACT_GIFT] = "act_gift", [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.MALL_TREASURE] = "mall_treasure",
} }
@ -23,6 +24,7 @@ PayManager.BI_ITEM_GET_TYPE = {
[PayManager.PURCHARSE_TYPE.ACT_GIFT] = { [PayManager.PURCHARSE_TYPE.ACT_GIFT] = {
[PayManager.PURCHARSE_ACT_TYPE.BOUNTY] = BIReport.ITEM_GET_TYPE.BOUNTY, [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.MALL_TREASURE] = BIReport.ITEM_GET_TYPE.MALL_TREASURE,
} }
@ -30,6 +32,7 @@ PayManager.BI_GIFT_TYPE = {
[PayManager.PURCHARSE_TYPE.ACT_GIFT] = { [PayManager.PURCHARSE_TYPE.ACT_GIFT] = {
[PayManager.PURCHARSE_ACT_TYPE.BOUNTY] = BIReport.GIFT_TYPE.BOUNTY, [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.MALL_TREASURE] = BIReport.GIFT_TYPE.MALL_TREASURE,
} }

View File

@ -15,6 +15,7 @@ function ServerPushManager:initWhenLogin()
self:addServerPushListener(ProtoMsgType.FromMsgEnum.KickOutNtf, UIManager, UIManager.showKickOut) self:addServerPushListener(ProtoMsgType.FromMsgEnum.KickOutNtf, UIManager, UIManager.showKickOut)
self:addServerPushListener(ProtoMsgType.FromMsgEnum.BountyBoughtNtf, ModuleManager.BountyManager, ModuleManager.BountyManager.onBoughtBountyFinish) self:addServerPushListener(ProtoMsgType.FromMsgEnum.BountyBoughtNtf, ModuleManager.BountyManager, ModuleManager.BountyManager.onBoughtBountyFinish)
self:addServerPushListener(ProtoMsgType.FromMsgEnum.NewMailNtf, ModuleManager.MailManager, ModuleManager.MailManager.needUpdateMail) self:addServerPushListener(ProtoMsgType.FromMsgEnum.NewMailNtf, ModuleManager.MailManager, ModuleManager.MailManager.needUpdateMail)
self:addServerPushListener(ProtoMsgType.FromMsgEnum.PigLevelUpNtf, ModuleManager.ActivityManager, ModuleManager.ActivityManager.onBoughtGoldPigFinish)
self:addServerPushListener(ProtoMsgType.FromMsgEnum.MallDailyResetNtf, ModuleManager.ShopManager, ModuleManager.MailManager.onMallDailyReset) self:addServerPushListener(ProtoMsgType.FromMsgEnum.MallDailyResetNtf, ModuleManager.ShopManager, ModuleManager.MailManager.onMallDailyReset)
end end

View File

@ -4,4 +4,14 @@ function ActivityManager:showGoldPigUI()
UIManager:showUI("app/ui/activity/gold_pig/gold_pig_ui") UIManager:showUI("app/ui/activity/gold_pig/gold_pig_ui")
end end
function ActivityManager:buyGoldPig(id)
PayManager:purchasePackage(id, PayManager.PURCHARSE_TYPE.ACT_GOLD_PIG)
end
function ActivityManager:onBoughtGoldPigFinish(result)
if result.status == 0 then
DataManager.GoldPigData:onBought(result.pig)
end
end
return ActivityManager return ActivityManager

View File

@ -124,6 +124,8 @@ BattleConst.UNIT_STATE = {
ASSISTING_ATTACK = 8, -- 协助攻击 ASSISTING_ATTACK = 8, -- 协助攻击
WAIT = 9, -- 等待 WAIT = 9, -- 等待
RECOVER_HP_WAVE = 10, -- 波次之间回血 RECOVER_HP_WAVE = 10, -- 波次之间回血
FROZEN = 11, -- 冻结状态
VERITGO = 12, -- 昏睡
} }
BattleConst.MATCH_DMG_ADDITION_NAME = { BattleConst.MATCH_DMG_ADDITION_NAME = {
@ -177,10 +179,13 @@ BattleConst.SPINE_ANIMATION_NAME = {
ATTACK = "attack01", ATTACK = "attack01",
MOVE = "move", MOVE = "move",
HIT = "suffer", HIT = "suffer",
HIT_2 = "suffer02",
DEAD = "death", DEAD = "death",
BORN = "born", BORN = "born",
OUT = "out", OUT = "out",
BLOCK = "block", BLOCK = "block",
FROZEN = "frozen",
VERTIGO = "vertigo",
} }
BattleConst.EFFECT_TYPE = { BattleConst.EFFECT_TYPE = {

View File

@ -15,6 +15,8 @@ local PASSIVE_EVENT = BattleConst.PASSIVE_EVENT
local HURT_STATE_CRIT = BattleConst.HURT_STATE_CRIT local HURT_STATE_CRIT = BattleConst.HURT_STATE_CRIT
local EFFECT_TYPE = BattleConst.EFFECT_TYPE local EFFECT_TYPE = BattleConst.EFFECT_TYPE
local TIME_FACTOR = BattleConst.TIME_FACTOR local TIME_FACTOR = BattleConst.TIME_FACTOR
local HURT_ANI_NAME_LIST = {SPINE_ANIMATION_NAME.HIT, SPINE_ANIMATION_NAME.HIT_2}
local HURT_ANI_NAME_LIST_COUNT = 2
function BattleUnitComp:ctor() function BattleUnitComp:ctor()
end end
@ -86,7 +88,8 @@ function BattleUnitComp:_initBase()
self.currAttackBlockIndex = 0 -- 多段伤害索引 self.currAttackBlockIndex = 0 -- 多段伤害索引
self.validEffectIdx = {} self.validEffectIdx = {}
self.switchTime = 0 self.switchTime = 0
self.playIdleSubAniDuration = {} self.isPlayingSubAni = false
self.playSubAniDuration = {}
self.attackDurationMap = {} self.attackDurationMap = {}
self.attackKeyFrameTimeMap = {} self.attackKeyFrameTimeMap = {}
self.shieldBuffList = {} self.shieldBuffList = {}
@ -227,6 +230,9 @@ function BattleUnitComp:stopRunAction()
end end
function BattleUnitComp:playAnimation(name, loop, forceRefresh) function BattleUnitComp:playAnimation(name, loop, forceRefresh)
if name == SPINE_ANIMATION_NAME.HIT or name == SPINE_ANIMATION_NAME.BLOCK then
self.isPlayingSubAni = true
end
self.currAnimationName = name self.currAnimationName = name
self.baseObject:playAnimation(name, loop, forceRefresh) self.baseObject:playAnimation(name, loop, forceRefresh)
end end
@ -443,6 +449,15 @@ function BattleUnitComp:removeShield(buffEffect)
end end
function BattleUnitComp:changeState(state) function BattleUnitComp:changeState(state)
-- 进入目标状态
if state == UNIT_STATE.IDLE then -- idle为默认状态其状态下判定特殊状态
if self.unitEntity:getIsFrozen() then -- 有冰冻buff
state = UNIT_STATE.FROZEN
elseif self.unitEntity:getIsLethargy() or self.unitEntity:getIsStun() then
state = UNIT_STATE.VERITGO
end
end
if self.currState == state and not self:repeatCurrState() then if self.currState == state and not self:repeatCurrState() then
return false return false
end end
@ -472,9 +487,14 @@ function BattleUnitComp:changeState(state)
self:exitWaitState() self:exitWaitState()
elseif self.currState == UNIT_STATE.RECOVER_HP_WAVE then elseif self.currState == UNIT_STATE.RECOVER_HP_WAVE then
self:exitRecoverHpWaveState() self:exitRecoverHpWaveState()
elseif self.currState == UNIT_STATE.FROZEN then
self:exitFrozenState()
elseif self.currState == UNIT_STATE.VERITGO then
self:exitVeritgoState()
end end
-- 进入目标状态
self.currState = state self.currState = state
if state == UNIT_STATE.IDLE then if state == UNIT_STATE.IDLE then
self:enterIdleState() self:enterIdleState()
elseif state == UNIT_STATE.NORMAL_ATTACK then elseif state == UNIT_STATE.NORMAL_ATTACK then
@ -495,6 +515,10 @@ function BattleUnitComp:changeState(state)
self:enterWaitState() self:enterWaitState()
elseif state == UNIT_STATE.RECOVER_HP_WAVE then elseif state == UNIT_STATE.RECOVER_HP_WAVE then
self:enterRecoverHpWaveState() self:enterRecoverHpWaveState()
elseif state == UNIT_STATE.FROZEN then
self:enterFrozenState()
elseif state == UNIT_STATE.VERITGO then
self:enterVeritgoState()
end end
return true return true
end end
@ -646,11 +670,11 @@ function BattleUnitComp:enterIdleState()
end end
function BattleUnitComp:updateIdle(dt) function BattleUnitComp:updateIdle(dt)
self:updateIdleSubAni(dt) self:updateIdleSubAni(dt, SPINE_ANIMATION_NAME.IDLE)
end end
function BattleUnitComp:updateIdleSubAni(...) function BattleUnitComp:updateIdleSubAni(...)
if not self.currAnimationName then if not self.currAnimationName or not self.isPlayingSubAni then
return return
end end
if self.currAnimationName == SPINE_ANIMATION_NAME.HIT then if self.currAnimationName == SPINE_ANIMATION_NAME.HIT then
@ -661,28 +685,35 @@ function BattleUnitComp:updateIdleSubAni(...)
end end
function BattleUnitComp:playHurt() function BattleUnitComp:playHurt()
local name = SPINE_ANIMATION_NAME.HIT if self.currState == UNIT_STATE.IDLE or
self.playIdleSubAniTime = 0 self.currState == UNIT_STATE.VERITGO then
if self.playIdleSubAniDuration[name] == nil then local name = HURT_ANI_NAME_LIST[math.random(1, HURT_ANI_NAME_LIST_COUNT)]
self.playIdleSubAniDuration[name] = self:getAnimationDuration(name) self.playSubAniTime = 0
self.curHurtName = name
if self.playSubAniDuration[name] == nil then
self.playSubAniDuration[name] = self:getAnimationDuration(name)
end end
self:playAnimation(name, false, false) self:playAnimation(name, false, false)
end
end end
function BattleUnitComp:updateHurt(dt) function BattleUnitComp:updateHurt(dt, overAniName)
self.playIdleSubAniTime = self.playIdleSubAniTime + dt self.playSubAniTime = self.playSubAniTime + dt
if self.playIdleSubAniTime >= self.playIdleSubAniDuration[SPINE_ANIMATION_NAME.HIT] then if self.playSubAniTime >= self.playSubAniDuration[self.curHurtName or SPINE_ANIMATION_NAME.HIT] then
self:playAnimation(SPINE_ANIMATION_NAME.IDLE, true, false) self:playAnimation(overAniName, true, false)
self.isPlayingSubAni = false
end end
end end
function BattleUnitComp:playBlock() function BattleUnitComp:playBlock()
if self.currState == UNIT_STATE.IDLE then
local name = SPINE_ANIMATION_NAME.BLOCK local name = SPINE_ANIMATION_NAME.BLOCK
self.playIdleSubAniTime = 0 self.playSubAniTime = 0
if self.playIdleSubAniDuration[name] == nil then if self.playSubAniDuration[name] == nil then
self.playIdleSubAniDuration[name] = self:getAnimationDuration(name) self.playSubAniDuration[name] = self:getAnimationDuration(name)
end end
self:playAnimation(name, false, false) self:playAnimation(name, false, false)
end
local direction = BattleConst.EFFECT_TYPE_MOVE_R local direction = BattleConst.EFFECT_TYPE_MOVE_R
local x, y = self.baseObject:fastGetLocalPosition() local x, y = self.baseObject:fastGetLocalPosition()
@ -694,13 +725,36 @@ function BattleUnitComp:playBlock()
end end
function BattleUnitComp:updateBlock(dt) function BattleUnitComp:updateBlock(dt, overAniName)
self.playIdleSubAniTime = self.playIdleSubAniTime + dt self.playSubAniTime = self.playSubAniTime + dt
if self.playIdleSubAniTime >= self.playIdleSubAniDuration[SPINE_ANIMATION_NAME.BLOCK] then if self.playSubAniTime >= self.playSubAniDuration[SPINE_ANIMATION_NAME.BLOCK] then
self:playAnimation(SPINE_ANIMATION_NAME.IDLE, true, false) self:playAnimation(overAniName, true, false)
self.isPlayingSubAni = false
end end
end end
function BattleUnitComp:exitFrozenState()
end
function BattleUnitComp:enterFrozenState()
self:playAnimation(SPINE_ANIMATION_NAME.FROZEN, true, false)
end
function BattleUnitComp:updateFrozen(dt)
self:updateIdleSubAni(dt, SPINE_ANIMATION_NAME.FROZEN)
end
function BattleUnitComp:exitVeritgoState()
end
function BattleUnitComp:enterVeritgoState()
self:playAnimation(SPINE_ANIMATION_NAME.VERTIGO, true, false)
end
function BattleUnitComp:updateVeritgo(dt)
self:updateIdleSubAni(dt, SPINE_ANIMATION_NAME.VERTIGO)
end
function BattleUnitComp:enterRecoverHpWaveState() function BattleUnitComp:enterRecoverHpWaveState()
self.recoverHpCount = BattleConst.RECOVER_HP_COUNT self.recoverHpCount = BattleConst.RECOVER_HP_COUNT
self.recoverHpTime = BattleConst.RECOVER_HP_INTERVAL / 2 self.recoverHpTime = BattleConst.RECOVER_HP_INTERVAL / 2
@ -1482,7 +1536,7 @@ function BattleUnitComp:takeDamageOrCure(atker, num, effectType, effectStatus, d
local hpPercent = self.unitEntity:getHpPercent() local hpPercent = self.unitEntity:getHpPercent()
self.battleController:refreshHp(self.side, hp, hpPercent) self.battleController:refreshHp(self.side, hp, hpPercent)
if atker:getIsCentralizedAttack() then if atker:getIsCentralizedAttack() then
if damage < 0 and self.currState == UNIT_STATE.IDLE then if damage < 0 then
self:playHurt() self:playHurt()
end end
else else
@ -1492,7 +1546,7 @@ function BattleUnitComp:takeDamageOrCure(atker, num, effectType, effectStatus, d
local target = self.battleController:getOtherSideMainUnit(self.side) local target = self.battleController:getOtherSideMainUnit(self.side)
target:checkPassiveEvent(BattleConst.PASSIVE_EVENT.ON_DEAD_BY_BURN, target) target:checkPassiveEvent(BattleConst.PASSIVE_EVENT.ON_DEAD_BY_BURN, target)
end end
elseif damage < 0 and self.currState == UNIT_STATE.IDLE then elseif damage < 0 then
self:playHurt() self:playHurt()
end end
end end
@ -1712,6 +1766,10 @@ function BattleUnitComp:tick(dt)
self:updateWaitState(dt) self:updateWaitState(dt)
elseif self.currState == UNIT_STATE.RECOVER_HP_WAVE then elseif self.currState == UNIT_STATE.RECOVER_HP_WAVE then
self:updateRecoverHpWaveState(dt) self:updateRecoverHpWaveState(dt)
elseif self.currState == UNIT_STATE.FROZEN then
self:updateFrozen(dt)
elseif self.currState == UNIT_STATE.VERITGO then
self:updateVeritgo(dt)
end end
end end

View File

@ -173,6 +173,7 @@ function BattleTeam:onRoundEnd()
end end
self:doBuffWork() self:doBuffWork()
self.comboCount = 0 self.comboCount = 0
self:getMainUnit():changeState(BattleConst.UNIT_STATE.IDLE)
end end
function BattleTeam:addShield(buffEffect) function BattleTeam:addShield(buffEffect)

View File

@ -90,8 +90,8 @@ function ChapterManager:endFightFinish(result)
end end
ModuleManager.BattleManager:showBattleResultUI(newRewards, reqData.combatReport, mysteryBoxIdx) ModuleManager.BattleManager:showBattleResultUI(newRewards, reqData.combatReport, mysteryBoxIdx)
DataManager.ChapterData:fightChapter(reqData.chapter_id, result.max_chapter_id, result.max_wave, reqData.mystery_box_idx) DataManager.ChapterData:fightChapter(reqData.chapter_id, result.max_chapter_id, result.max_wave, reqData.mystery_box_idx)
-- 处理金猪 -- 处理金猪,要在章节更新之后
-- DataManager.GoldPigData:addGoldPigCount() DataManager.GoldPigData:addGoldPigCount()
local newMaxChapter = DataManager.ChapterData:getNewChapterId() local newMaxChapter = DataManager.ChapterData:getNewChapterId()
if maxChapter ~= newMaxChapter then if maxChapter ~= newMaxChapter then

View File

@ -8,32 +8,63 @@ function GoldPigUI:getPrefabPath()
return "assets/prefabs/ui/activity/gold_pig/gold_pig_ui.prefab" return "assets/prefabs/ui/activity/gold_pig/gold_pig_ui.prefab"
end end
function GoldPigUI:ctor()
self.goldPigId = DataManager.GoldPigData:getId()
end
function GoldPigUI:onLoadRootComplete() function GoldPigUI:onLoadRootComplete()
local uiMap = self.root:genAllChildren() local uiMap = self.root:genAllChildren()
uiMap["gold_pig_ui.bg.close_btn"]:addClickListener(function() uiMap["gold_pig_ui.bg.close_btn"]:addClickListener(function()
self:closeUI() self:closeUI()
end) end)
uiMap["gold_pig_ui.bg.title_tx"]:setText("临时文本:超值金猪") uiMap["gold_pig_ui.bg.title_tx"]:setText(I18N:getGlobalText(I18N.GlobalConst.GOLD_PIG_TITLE))
uiMap["gold_pig_ui.bg.desc_tx"]:setText("临时文本:挑战关卡并收集钻石,你就可以获得一笔划算的交易。") uiMap["gold_pig_ui.bg.desc_tx"]:setText(I18N:getGlobalText(I18N.GlobalConst.GOLD_PIG_DESC))
uiMap["gold_pig_ui.bg.value_bg.tx"]:setText("临时文本:300%")
local currGem = DataManager.GoldPigData:getGoldPigGemCount() local levelInfo = DataManager.GoldPigData:getCurrLevelInfo()
local maxGem = DataManager.GoldPigData:getGoldPigGemMaxCount() uiMap["gold_pig_ui.bg.value_bg.tx"]:setText(levelInfo.value .. "%")
local currGem = DataManager.GoldPigData:getCount()
local maxGem = DataManager.GoldPigData:getMaxCount()
local percent = currGem / maxGem
local nowGemTx = uiMap["gold_pig_ui.bg.slider.now_gem_bg.gem_tx"] local nowGemTx = uiMap["gold_pig_ui.bg.slider.now_gem_bg.gem_tx"]
nowGemTx:setText(GFunc.intToString(currGem)) nowGemTx:setText(GFunc.intToString(currGem))
local nowGemImg = uiMap["gold_pig_ui.bg.slider.now_gem_bg.gem_img"] local nowGemImg = uiMap["gold_pig_ui.bg.slider.now_gem_bg.gem_img"]
GFunc.centerImgAndTx(nowGemImg, nowGemTx, 0, -4) GFunc.centerImgAndTx(nowGemImg, nowGemTx, 0, -4)
local maxGemTx = uiMap["gold_pig_ui.bg.slider.max_gem_bg.gem_tx"] local sliderWidth = uiMap["gold_pig_ui.bg.slider"]:getRectWidth()
maxGemTx:setText(GFunc.intToString(maxGem)) uiMap["gold_pig_ui.bg.slider.now_gem_bg"]:setAnchoredPositionX((percent - 0.5) * sliderWidth)
local maxGemImg = uiMap["gold_pig_ui.bg.slider.max_gem_bg.gem_img"]
GFunc.centerImgAndTx(maxGemImg, maxGemTx, 0, -4)
uiMap["gold_pig_ui.bg.slider"]:getComponent(GConst.TYPEOF_UNITY_CLASS.BF_SLIDER).value = currGem / maxGem local initialCount = DataManager.GoldPigData:getInitialCount()
uiMap["gold_pig_ui.bg.begin_text"]:setText(GFunc.intToString(initialCount))
uiMap["gold_pig_ui.bg.end_text"]:setText(GFunc.intToString(maxGem))
uiMap["gold_pig_ui.bg.slider"]:getComponent(GConst.TYPEOF_UNITY_CLASS.BF_SLIDER).value = percent
uiMap["gold_pig_ui.bg.buy_btn"]:addClickListener(function() uiMap["gold_pig_ui.bg.buy_btn"]:addClickListener(function()
ModuleManager.ActivityManager:buyGoldPig(self.goldPigId)
end) end)
local rechargeId = DataManager.GoldPigData:getRechargeId() local rechargeId = DataManager.GoldPigData:getRechargeId()
uiMap["gold_pig_ui.bg.buy_btn.text"]:setText(GFunc.getFormatPrice(rechargeId)) uiMap["gold_pig_ui.bg.buy_btn.text"]:setText(GFunc.getFormatPrice(rechargeId))
self:bind(DataManager.GoldPigData, "boughtFlag", function()
-- 购买后需要关闭界面
if not DataManager.GoldPigData:getIsOpen() then
self:closeUI()
end
end)
self:bind(DataManager.GoldPigData, "dirty", function()
-- 金猪到时间关闭了
if not DataManager.GoldPigData:getIsOpen() then
local params = {
content = I18N:getGlobalText(I18N.GlobalConst.GOLD_PIG_CLOSE_DESC),
boxType = GConst.MESSAGE_BOX_TYPE.MB_OK,
okFunc = function()
self:closeUI()
end
}
GFunc.showMessageBox(params)
end
end)
end end
return GoldPigUI return GoldPigUI

View File

@ -10,6 +10,7 @@ function BattleResultUI:ctor(params)
self.rewards = params.rewards self.rewards = params.rewards
self.combatReport = params.combatReport self.combatReport = params.combatReport
self.mysteryBoxIdx = params.mysteryBoxIdx or 0 self.mysteryBoxIdx = params.mysteryBoxIdx or 0
self.isTryShowGoldPig = false
self.totalDmg = 0 self.totalDmg = 0
if self.combatReport.atkReport then if self.combatReport.atkReport then
for _, info in ipairs(self.combatReport.atkReport) do for _, info in ipairs(self.combatReport.atkReport) do
@ -18,6 +19,12 @@ function BattleResultUI:ctor(params)
end end
end end
function BattleResultUI:onClose()
if self.sliderSequence then
self.sliderSequence:Kill()
end
end
function BattleResultUI:onLoadRootComplete() function BattleResultUI:onLoadRootComplete()
self:_display() self:_display()
self:_addListeners() self:_addListeners()
@ -31,20 +38,28 @@ function BattleResultUI:_display()
self:refreshDefeatNode() self:refreshDefeatNode()
AudioManager:playEffect(AudioManager.EFFECT_ID.BATTLE_DEFEAT) AudioManager:playEffect(AudioManager.EFFECT_ID.BATTLE_DEFEAT)
end end
self:refreshFixedInfo() self:refreshFixedInfo()
self:refreshRewards() self:refreshRewards()
self:refreshUnitInfo() self:refreshUnitInfo()
self:initGoldPig()
end end
function BattleResultUI:_addListeners() function BattleResultUI:_addListeners()
local uiMap = self.root:genAllChildren() local uiMap = self.root:genAllChildren()
uiMap["battle_result_ui.mask_v"]:addClickListener(function() uiMap["battle_result_ui.mask_v"]:addClickListener(function()
if self.isTryShowGoldPig then
ModuleManager.BattleManager:endBattleAndExit() ModuleManager.BattleManager:endBattleAndExit()
else
self:tryShowGoldPig()
end
end) end)
uiMap["battle_result_ui.mask_d"]:addClickListener(function() uiMap["battle_result_ui.mask_d"]:addClickListener(function()
if self.isTryShowGoldPig then
ModuleManager.BattleManager:endBattleAndExit() ModuleManager.BattleManager:endBattleAndExit()
else
self:tryShowGoldPig()
end
end) end)
end end
@ -54,7 +69,7 @@ function BattleResultUI:refreshFixedInfo()
local desc1 = uiMap["battle_result_ui.desc_1"] local desc1 = uiMap["battle_result_ui.desc_1"]
local desc2 = uiMap["battle_result_ui.desc_2"] local desc2 = uiMap["battle_result_ui.desc_2"]
local desc3 = uiMap["battle_result_ui.desc_3"] local desc3 = uiMap["battle_result_ui.desc_3"]
local rewardTitle = uiMap["battle_result_ui.reward_title"] local rewardTitle = uiMap["battle_result_ui.reward_node.reward_title"]
local continue = uiMap["battle_result_ui.continue"] local continue = uiMap["battle_result_ui.continue"]
desc1:setText(I18N:getGlobalText(I18N.GlobalConst.BATTLE_DESC_4)) desc1:setText(I18N:getGlobalText(I18N.GlobalConst.BATTLE_DESC_4))
desc2:setText(self.combatReport.wave) desc2:setText(self.combatReport.wave)
@ -97,7 +112,9 @@ function BattleResultUI:refreshRewards()
end end
local uiMap = self.root:genAllChildren() local uiMap = self.root:genAllChildren()
local scrollRect = uiMap["battle_result_ui.scroll_rect"] self.rewardNode = uiMap["battle_result_ui.reward_node"]
self.rewardNode:setVisible(true)
local scrollRect = uiMap["battle_result_ui.reward_node.scroll_rect"]
self.scrollRectComp = scrollRect:addLuaComponent(GConst.TYPEOF_LUA_CLASS.SCROLL_RECT_BASE) self.scrollRectComp = scrollRect:addLuaComponent(GConst.TYPEOF_LUA_CLASS.SCROLL_RECT_BASE)
self.scrollRectComp:addInitCallback(function() self.scrollRectComp:addInitCallback(function()
return GConst.TYPEOF_LUA_CLASS.REWARD_CELL return GConst.TYPEOF_LUA_CLASS.REWARD_CELL
@ -149,4 +166,57 @@ function BattleResultUI:refreshUnitInfo()
end end
end end
function BattleResultUI:initGoldPig()
local uiMap = self.root:genAllChildren()
self.goldPigRoot = uiMap["battle_result_ui.gold_pig"]
self.goldPigRoot:setVisible(false)
self.goldPigGemTx = uiMap["battle_result_ui.gold_pig.gem_bg.gem_tx"]
self.goldPigGemImg = uiMap["battle_result_ui.gold_pig.gem_bg.gem_img"]
self.goldPigGemSliderComp = uiMap["battle_result_ui.gold_pig.slider_bg.slider"]:getComponent(GConst.TYPEOF_UNITY_CLASS.BF_SLIDER)
self.goldPigGemSliderTx = uiMap["battle_result_ui.gold_pig.slider_bg.text"]
end
function BattleResultUI:tryShowGoldPig()
self.isTryShowGoldPig = true
if not DataManager.GoldPigData:getIsOpen() then
return
end
self.rewardNode:setVisible(false)
self.goldPigRoot:setVisible(true)
local lastGemCount = DataManager.GoldPigData:getLastCount()
local currGemCount = DataManager.GoldPigData:getCount()
local maxGemCount = DataManager.GoldPigData:getMaxCount()
if lastGemCount > currGemCount then
lastGemCount = 0
end
self.goldPigGemTx:setText("+" .. currGemCount - lastGemCount)
GFunc.centerImgAndTx(self.goldPigGemImg, self.goldPigGemTx, 0, -4)
if currGemCount > lastGemCount then
self.sliderSequence = DOTweenManager:createSeqWithIntId()
local curProgress = 0
local remain = currGemCount - lastGemCount
local startPercent = lastGemCount / maxGemCount
local remainPercent = currGemCount / maxGemCount - startPercent
self.goldPigGemSliderComp.value = startPercent
self.goldPigGemSliderTx:setText(lastGemCount .. "/" .. currGemCount)
local tween = DOTweenManager:createDOTweenTo(
function()
return curProgress
end,
function(value)
curProgress = value
self.goldPigGemSliderComp.value = startPercent + remainPercent*curProgress
self.goldPigGemSliderTx:setText(lastGemCount + math.floor(remain*curProgress) .. "/" .. maxGemCount)
end,
1, 1)
self.sliderSequence:Append(tween)
self.sliderSequence:AppendCallback(function()
self.sliderSequence = nil
end)
else -- 相等就不跑动画了
self.goldPigGemSliderComp.value = currGemCount / maxGemCount
self.goldPigGemSliderTx:setText(currGemCount .. "/" .. maxGemCount)
end
end
return BattleResultUI return BattleResultUI

View File

@ -17,10 +17,12 @@ function MailCell:refresh(entity)
local normalNode = uiMap["mail_cell.bg_normal"] local normalNode = uiMap["mail_cell.bg_normal"]
local adNode = uiMap["mail_cell.bg_ad"] local adNode = uiMap["mail_cell.bg_ad"]
local readNode = uiMap["mail_cell.bg_read"] local readNode = uiMap["mail_cell.bg_read"]
local isReadType = false
if entity:getMailType() == GConst.MailConst.MAIL_TYPE.CUSTOM then if entity:getMailType() == GConst.MailConst.MAIL_TYPE.CUSTOM then
normalNode:setVisible(false) normalNode:setVisible(false)
adNode:setVisible(false) adNode:setVisible(false)
readNode:setVisible(true) readNode:setVisible(true)
isReadType = true
elseif entity:getMailType() == GConst.MailConst.MAIL_TYPE.AD then elseif entity:getMailType() == GConst.MailConst.MAIL_TYPE.AD then
normalNode:setVisible(false) normalNode:setVisible(false)
adNode:setVisible(true) adNode:setVisible(true)
@ -33,6 +35,7 @@ function MailCell:refresh(entity)
normalNode:setVisible(false) normalNode:setVisible(false)
adNode:setVisible(false) adNode:setVisible(false)
readNode:setVisible(true) readNode:setVisible(true)
isReadType = true
end end
GFunc.setAdsSprite(uiMap["mail_cell.bg_ad.claim_btn.ad"]) GFunc.setAdsSprite(uiMap["mail_cell.bg_ad.claim_btn.ad"])
uiMap["mail_cell.bg_normal.claim_btn.tx"]:setText(I18N:getGlobalText(I18N.GlobalConst.BTN_CLAIM)) uiMap["mail_cell.bg_normal.claim_btn.tx"]:setText(I18N:getGlobalText(I18N.GlobalConst.BTN_CLAIM))
@ -86,6 +89,18 @@ function MailCell:refresh(entity)
self.rewardCell:getBaseObject():setVisible(false) self.rewardCell:getBaseObject():setVisible(false)
end end
end end
if isReadType then
if showCheck then
uiMap["mail_cell.bg_read"]:setImageGray(true)
uiMap["mail_cell.bg_read.claim_btn"]:setSprite(GConst.ATLAS_PATH.COMMON, "common_btn_grey_3")
elseif not entity:haveReward() and entity:isRead() then
uiMap["mail_cell.bg_read"]:setImageGray(true)
uiMap["mail_cell.bg_read.claim_btn"]:setSprite(GConst.ATLAS_PATH.COMMON, "common_btn_grey_3")
else
uiMap["mail_cell.bg_read"]:setImageGray(false)
uiMap["mail_cell.bg_read.claim_btn"]:setSprite(GConst.ATLAS_PATH.COMMON, "common_btn_green_3")
end
end
end end
return MailCell return MailCell

View File

@ -79,12 +79,21 @@ end
function SideBarBaseCellComp:onClick() function SideBarBaseCellComp:onClick()
end end
function SideBarBaseCellComp:updateTime()
end
-- 常规逻辑 *********************************************************** -- 常规逻辑 ***********************************************************
function SideBarBaseCellComp:init() function SideBarBaseCellComp:init()
local uiMap = self.baseObject:genAllChildren() local uiMap = self.baseObject:genAllChildren()
self.icon = uiMap["side_bar_cell.icon"] self.icon = uiMap["side_bar_cell.icon"]
self.descBg = uiMap["side_bar_cell.desc_bg"]
self.descIcon = uiMap["side_bar_cell.desc_bg.icon"]
self.descTx = uiMap["side_bar_cell.desc_bg.text"]
self.timeBg = uiMap["side_bar_cell.time_bg"]
self.timeTx = uiMap["side_bar_cell.time_bg.text"]
self.descBg:setVisible(false)
self.timeBg:setVisible(false)
self.baseObject:addClickListener(function() self.baseObject:addClickListener(function()
self:onClick() self:onClick()
end) end)
@ -106,10 +115,6 @@ function SideBarBaseCellComp:getCellPath()
return self.cellPath return self.cellPath
end end
function SideBarBaseCellComp:setCellPath(cellPath)
self.cellPath = cellPath
end
function SideBarBaseCellComp:showRedPoint() function SideBarBaseCellComp:showRedPoint()
if self.redPoint then if self.redPoint then
return return
@ -127,4 +132,16 @@ function SideBarBaseCellComp:hideRedPoint()
self.baseObject:removeRedPoint() self.baseObject:removeRedPoint()
end end
function SideBarBaseCellComp:initWithParentUI(parentUI, cellPath, isLeftSide)
self.parentUI = parentUI
self.cellPath = cellPath
self.isLeftSide = isLeftSide
end
function SideBarBaseCellComp:closeBtn()
if self.parentUI then
self.parentUI:closeSideBarBtn(self.isLeftSide)
end
end
return SideBarBaseCellComp return SideBarBaseCellComp

View File

@ -2,7 +2,7 @@ local SideBarBaseCellComp = require "app/ui/main_city/cell/side_bar_base_cell"
local SideBarGoldPigCell = class("SideBarGoldPigCell", SideBarBaseCellComp) local SideBarGoldPigCell = class("SideBarGoldPigCell", SideBarBaseCellComp)
function SideBarGoldPigCell:getIsOpen() function SideBarGoldPigCell:getIsOpen()
return true return DataManager.GoldPigData:getIsOpen()
end end
function SideBarGoldPigCell:getIconRes() function SideBarGoldPigCell:getIconRes()
@ -13,4 +13,63 @@ function SideBarGoldPigCell:onClick()
ModuleManager.ActivityManager:showGoldPigUI() ModuleManager.ActivityManager:showGoldPigUI()
end end
function SideBarGoldPigCell:refresh()
local isFull = DataManager.GoldPigData:getIsFull()
if isFull then
self:showGoldPigDesc()
else
self:hideGoldPigDesc()
end
self:refreshIcon()
end
function SideBarGoldPigCell:showGoldPigDesc()
if self.descBgVisible then
return
end
self.descBgVisible = true
self.descBg:setVisible(true)
self.timeBg:setVisible(true)
local gemEntity = DataManager.BagData.ItemData:getItemById(GConst.ItemConst.ITEM_ID_GEM)
self.descIcon:setSprite(gemEntity:getIconRes())
self.descTx:setText(I18N:getGlobalText(I18N.GlobalConst.SIDE_BAR_FULL))
GFunc.centerImgAndTx(self.descIcon, self.descTx, 0, -3)
local endTime = DataManager.GoldPigData:getEndTime()
local remainTime = endTime - Time:getServerTime()
if remainTime >= 0 then
self.timeTx:setText(GFunc.getTimeStrWithHMS(remainTime))
else
self.timeTx:setText(GConst.EMPTY_STRING)
end
end
function SideBarGoldPigCell:hideGoldPigDesc()
if self.descBgVisible == false then
return
end
self.descBgVisible = false
self.descBg:setVisible(false)
self.timeBg:setVisible(false)
end
function SideBarGoldPigCell:updateTime()
if self:getIsOpen() then
local isFull = DataManager.GoldPigData:getIsFull()
if isFull then
self:showGoldPigDesc()
local endTime = DataManager.GoldPigData:getEndTime()
local remainTime = endTime - Time:getServerTime()
if remainTime >= 0 then
self.timeTx:setText(GFunc.getTimeStrWithHMS(remainTime))
end
else
self:hideGoldPigDesc()
end
else
self:closeBtn()
end
end
return SideBarGoldPigCell return SideBarGoldPigCell

View File

@ -359,7 +359,7 @@ function MainCityUI:refreshLeftBtns()
cell = self:addSideBarCellComp(v) cell = self:addSideBarCellComp(v)
cell:getBaseObject():setParent(self.leftSideBar, false) cell:getBaseObject():setParent(self.leftSideBar, false)
end end
cell:setCellPath(v) cell:initWithParentUI(self, v, true)
table.insert(self.leftBarList, cell) table.insert(self.leftBarList, cell)
end end
end end
@ -421,7 +421,7 @@ function MainCityUI:refreshRightBtns()
cell = self:addSideBarCellComp(v) cell = self:addSideBarCellComp(v)
cell:getBaseObject():setParent(self.rightSideBar, false) cell:getBaseObject():setParent(self.rightSideBar, false)
end end
cell:setCellPath(v) cell:initWithParentUI(self, v, false)
table.insert(self.rightBarList, cell) table.insert(self.rightBarList, cell)
end end
end end
@ -458,6 +458,7 @@ function MainCityUI:clearSideBarList(sideBarList)
local count = #sideBarList local count = #sideBarList
for i = 1, count do for i = 1, count do
local cell = table.remove(sideBarList) local cell = table.remove(sideBarList)
cell:setVisible(false)
self.sideBarCellMap[cell:getCellPath()] = cell self.sideBarCellMap[cell:getCellPath()] = cell
end end
end end
@ -594,6 +595,26 @@ function MainCityUI:updateTime()
self.subComps[self.selectedIndex]:refreshTime() self.subComps[self.selectedIndex]:refreshTime()
end end
end end
self.inSideBarUpdate = true
if self.leftBarList then
for k, v in ipairs(self.leftBarList) do
v:updateTime()
end
end
if self.waitRefreshSideBar then
self:refreshLeftBtns()
self.waitRefreshSideBar = false
end
if self.rightBarList then
for k, v in ipairs(self.rightBarList) do
v:updateTime()
end
end
self.inSideBarUpdate = false
if self.waitRefreshSideBar then
self:refreshRightBtns()
self.waitRefreshSideBar = false
end
end end
function MainCityUI:updateSideBarStatus() function MainCityUI:updateSideBarStatus()
@ -681,6 +702,19 @@ function MainCityUI:setRightSideBarArrowRedPoint(isShow)
end end
end end
function MainCityUI:closeSideBarBtn(isLeft)
if self.inSideBarUpdate then
self.waitRefreshSideBar = true
else
self.waitRefreshSideBar = false
if isLeft then
self:refreshLeftBtns()
else
self:refreshRightBtns()
end
end
end
function MainCityUI:refreshBottomRp() function MainCityUI:refreshBottomRp()
local uiMap = self.root:genAllChildren() local uiMap = self.root:genAllChildren()
local heroRpObj = uiMap["main_ui.bottom_node.icons.ui_spine_obj_2.rp_node"] local heroRpObj = uiMap["main_ui.bottom_node.icons.ui_spine_obj_2.rp_node"]

View File

@ -1,7 +1,5 @@
local PlayerLevelUpUI = class("PlayerLevelUpUI", BaseUI) local PlayerLevelUpUI = class("PlayerLevelUpUI", BaseUI)
local CELL_WIDTH = 114.8
function PlayerLevelUpUI:isFullScreen() function PlayerLevelUpUI:isFullScreen()
return false return false
end end

View File

@ -1,15 +1,86 @@
local GoldPigData = class("GoldPigData", BaseData) local GoldPigData = class("GoldPigData", BaseData)
function GoldPigData:init(data) function GoldPigData:ctor()
self.data.dirty = false
self.data.boughtFlag = false
end
function GoldPigData:clear()
DataManager:unregisterDataCd("GoldPigData")
end
function GoldPigData:init(data, initOnLogin)
data = data or GConst.EMPTY_TABLE data = data or GConst.EMPTY_TABLE
self.data.id = data.id or 0 self.data.id = data.current_id or 0
if self.data.id == 0 then if self.data.id == 0 then
self.data.id = self:getFirstLevelId() self.data.id = self:getFirstLevelId()
end end
self.data.count = data.count or 0 self.data.count = data.add_diamond or 0
self.data.cd = data.cd or 0 self.lastCount = self.data.count
self.data.endTime = data.end_time or 0 self.maxCount = self:getMaxCount()
self.data.fullTime = (data.full_at or 0) // 1000
self.data.buyTime = (data.buy_at or 0) // 1000
self.endTime = 0
self.nextShowTime = 0
DataManager:unregisterDataCd("GoldPigData")
self:checkOpen()
if not initOnLogin then
self:markDirty()
end
end
function GoldPigData:onBought(data)
self:init(data)
self.data.boughtFlag = not self.data.boughtFlag
end
function GoldPigData:markDirty()
self.data.dirty = not self.data.dirty
end
function GoldPigData:checkOpen()
if not ModuleManager:getIsOpen(ModuleManager.MODULE_KEY.GOLD_PIG, true) then
self.data.isOpen = false self.data.isOpen = false
return
end
local initialCount = self:getInitialCount()
if self.data.count <= initialCount then -- 激活后一定大于初始值,否则说明还没开
self.data.isOpen = false
local nextShowTime1 = 0
if self.data.buyTime > 0 then
nextShowTime1 = self.data.buyTime + self:getBoughtCD()
end
local nextShowTime2 = 0
if self.data.fullTime > 0 then
nextShowTime2 = self.data.fullTime + self:getDuration() + self:getTimeOverCD()
end
if nextShowTime1 == 0 then
self.nextShowTime = nextShowTime2
elseif nextShowTime2 == 0 then
self.nextShowTime = nextShowTime1
else
if nextShowTime1 < nextShowTime2 then
self.nextShowTime = nextShowTime1
else
self.nextShowTime = nextShowTime2
end
end
elseif self.data.count >= self.maxCount then -- 满了
self.endTime = self.data.fullTime + self:getDuration()
self.nextShowTime = self.endTime + self:getTimeOverCD()
if Time:getServerTime() >= self.endTime then -- 超过时间该消失了
self.data.isOpen = false
else
self.data.isOpen = true
DataManager:registerDataCd("GoldPigData")
end
else
self.data.isOpen = true
end
end
function GoldPigData:getId()
return self.data.id
end end
function GoldPigData:getIsOpen() function GoldPigData:getIsOpen()
@ -17,28 +88,59 @@ function GoldPigData:getIsOpen()
end end
function GoldPigData:addGoldPigCount() function GoldPigData:addGoldPigCount()
if not self.data.isOpen then if not self.data.isOpen and not self:tryActiveGoldPig() then
self:tryActiveGoldPig()
return return
end end
local info = self:getCurrLevelInfo() local info = self:getCurrLevelInfo()
if info == nil then if info == nil then
return return
end end
if self.data.count >= info.max_diamond then if self.data.count >= info.max_diamond then -- 已经满了
return return
end end
self.lastCount = self.data.count
self.data.count = self.data.count + info.battle_diamond self.data.count = self.data.count + info.battle_diamond
if self.data.count > info.max_diamond then if self.data.count >= info.max_diamond then -- 满了
self.data.count = info.max_diamond self.data.count = info.max_diamond
self.data.fullTime = Time:getServerTime()
self.endTime = self.data.fullTime + self:getDuration()
self.nextShowTime = self.endTime + self:getTimeOverCD()
DataManager:registerDataCd("GoldPigData")
end end
end end
function GoldPigData:getGoldPigGemCount() function GoldPigData:tryActiveGoldPig()
if not ModuleManager:getIsOpen(ModuleManager.MODULE_KEY.GOLD_PIG, true) then
return false
end
if self.nextShowTime > 0 and Time:getServerTime() < self.nextShowTime then
return false
end
self.data.isOpen = true
return true
end
function GoldPigData:getLastCount()
return self.lastCount
end
function GoldPigData:getCount()
return self.data.count return self.data.count
end end
function GoldPigData:getGoldPigGemMaxCount() function GoldPigData:getIsFull()
return self.data.count >= self.maxCount
end
function GoldPigData:getInitialCount()
local info = self:getCurrLevelInfo()
if info == nil then
return 1
end
return info.min_diamond
end
function GoldPigData:getMaxCount()
local info = self:getCurrLevelInfo() local info = self:getCurrLevelInfo()
if info == nil then if info == nil then
return 1 return 1
@ -94,48 +196,31 @@ function GoldPigData:getCurrLevelInfo()
return cfg[self.data.id] return cfg[self.data.id]
end end
function GoldPigData:tryActiveGoldPig() function GoldPigData:levelDown()
if not ModuleManager:getIsOpen(ModuleManager.MODULE_KEY.GOLD_PIG, true) then local levelInfo = self:getCurrLevelInfo()
return self.data.id = levelInfo.before_id
end
if self.data.cd > 0 then local currLevelInfo = self:getCurrLevelInfo()
return self.data.count = currLevelInfo.min_diamond
end self.lastCount = self.data.count
if self.data.endTime >= Time:getServerTime() then self.maxCount = self:getMaxCount()
return
end
self.data.isOpen = true
self.data.endTime = Time:getServerTime() + self:getDuration()
end end
-- 时间到了,消失并降档 function GoldPigData:getEndTime()
function GoldPigData:onTimeOver() return self.endTime
if not self.data.isOpen then
return
end
self.data.isOpen = false
local cfg = self:getCfg()
local info = cfg[self.data.id]
if info == nil then
self.data.id = self:getFirstLevelId()
else
self.data.id = info.before_id or self:getFirstLevelId()
end
self.data.cd = self:getTimeOverCD()
end end
-- 购买后,消失并升档位 function GoldPigData:updateCd()
function GoldPigData:onBought(id)
if not self.data.isOpen then if not self.data.isOpen then
DataManager:unregisterDataCd("GoldPigData")
return return
end end
if self.endTime > 0 and Time:getServerTime() > self.endTime then -- 到时间该消失了
DataManager:unregisterDataCd("GoldPigData")
self:levelDown()
self.data.isOpen = false self.data.isOpen = false
local cfg = self:getCfg() self:markDirty()
local info = cfg[id]
if info then
self.data.id = info.next_id or id
end end
self.data.cd = self:getBoughtCD()
end end
return GoldPigData return GoldPigData

View File

@ -273,6 +273,10 @@ function BattleTeamEntity:removeActiveSkillLimit(name)
self.activeSkillLimit = self.activeSkillLimit - 1 self.activeSkillLimit = self.activeSkillLimit - 1
end end
function BattleTeamEntity:getIsStun()
return self.stunCount > 0
end
function BattleTeamEntity:getIsLethargy() function BattleTeamEntity:getIsLethargy()
return self.lethargyCount > 0 return self.lethargyCount > 0
end end

View File

@ -354,6 +354,10 @@ function BattleUnitEntity:removeActiveSkillLimit(name)
self.team:removeActiveSkillLimit(name) self.team:removeActiveSkillLimit(name)
end end
function BattleUnitEntity:getIsStun()
return self.team:getIsStun()
end
function BattleUnitEntity:getIsLethargy() function BattleUnitEntity:getIsLethargy()
return self.team:getIsLethargy() return self.team:getIsLethargy()
end end