Merge branch 'dev' of git.juzugame.com:b6-client/b6-lua into dev
This commit is contained in:
commit
ada108ac82
@ -77,6 +77,7 @@ BIReport.ITEM_GET_TYPE = {
|
||||
MALL_DAILY_RESET = "MallDailyReset",
|
||||
SUMMON = "Summon",
|
||||
PLAYER_LV_UP = "PlayerLvUp",
|
||||
GOLD_PIG = "GoldPig",
|
||||
}
|
||||
|
||||
BIReport.ADS_CLICK_TYPE = {
|
||||
@ -119,6 +120,7 @@ BIReport.BATTLE_TYPE = {
|
||||
|
||||
BIReport.GIFT_TYPE = {
|
||||
BOUNTY = "Bounty",
|
||||
GOLD_PIG = "GoldPig",
|
||||
MALL_TREASURE = "MallTreasure",
|
||||
}
|
||||
|
||||
|
||||
@ -120,7 +120,7 @@ function DataManager:initWithServerData(data)
|
||||
self.TutorialData:init(data.guide)
|
||||
self.MailData:init(data.mail_info)
|
||||
self.ActivityData:init()
|
||||
self.GoldPigData:init(data.pig)
|
||||
self.GoldPigData:init(data.pig, true)
|
||||
self.BountyData:init(data.bounty)
|
||||
-- 任务要在BountyData之后初始化,依赖BountyData的数据
|
||||
self.DailyTaskData:init(data.task_daily)
|
||||
|
||||
@ -4,7 +4,7 @@ local BLESSING_GIFT_ID = 30001
|
||||
|
||||
PayManager.PURCHARSE_TYPE = {
|
||||
ACT_GIFT = 1,
|
||||
GOLD_PIG = 2,
|
||||
ACT_GOLD_PIG = 2,
|
||||
CHAPTER_GIFT = 3,
|
||||
GROW_UP_GIFT = 4,
|
||||
MALL_TREASURE = 5,
|
||||
@ -16,6 +16,7 @@ PayManager.PURCHARSE_ACT_TYPE = {
|
||||
|
||||
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",
|
||||
}
|
||||
|
||||
@ -23,6 +24,7 @@ PayManager.BI_ITEM_GET_TYPE = {
|
||||
[PayManager.PURCHARSE_TYPE.ACT_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,
|
||||
}
|
||||
|
||||
@ -30,6 +32,7 @@ PayManager.BI_GIFT_TYPE = {
|
||||
[PayManager.PURCHARSE_TYPE.ACT_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,
|
||||
}
|
||||
|
||||
|
||||
@ -15,6 +15,7 @@ function ServerPushManager:initWhenLogin()
|
||||
self:addServerPushListener(ProtoMsgType.FromMsgEnum.KickOutNtf, UIManager, UIManager.showKickOut)
|
||||
self:addServerPushListener(ProtoMsgType.FromMsgEnum.BountyBoughtNtf, ModuleManager.BountyManager, ModuleManager.BountyManager.onBoughtBountyFinish)
|
||||
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)
|
||||
end
|
||||
|
||||
|
||||
@ -4,4 +4,14 @@ function ActivityManager:showGoldPigUI()
|
||||
UIManager:showUI("app/ui/activity/gold_pig/gold_pig_ui")
|
||||
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
|
||||
@ -124,6 +124,8 @@ BattleConst.UNIT_STATE = {
|
||||
ASSISTING_ATTACK = 8, -- 协助攻击
|
||||
WAIT = 9, -- 等待
|
||||
RECOVER_HP_WAVE = 10, -- 波次之间回血
|
||||
FROZEN = 11, -- 冻结状态
|
||||
VERITGO = 12, -- 昏睡
|
||||
}
|
||||
|
||||
BattleConst.MATCH_DMG_ADDITION_NAME = {
|
||||
@ -177,10 +179,13 @@ BattleConst.SPINE_ANIMATION_NAME = {
|
||||
ATTACK = "attack01",
|
||||
MOVE = "move",
|
||||
HIT = "suffer",
|
||||
HIT_2 = "suffer02",
|
||||
DEAD = "death",
|
||||
BORN = "born",
|
||||
OUT = "out",
|
||||
BLOCK = "block",
|
||||
FROZEN = "frozen",
|
||||
VERTIGO = "vertigo",
|
||||
}
|
||||
|
||||
BattleConst.EFFECT_TYPE = {
|
||||
|
||||
@ -15,6 +15,8 @@ local PASSIVE_EVENT = BattleConst.PASSIVE_EVENT
|
||||
local HURT_STATE_CRIT = BattleConst.HURT_STATE_CRIT
|
||||
local EFFECT_TYPE = BattleConst.EFFECT_TYPE
|
||||
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()
|
||||
end
|
||||
@ -86,7 +88,8 @@ function BattleUnitComp:_initBase()
|
||||
self.currAttackBlockIndex = 0 -- 多段伤害索引
|
||||
self.validEffectIdx = {}
|
||||
self.switchTime = 0
|
||||
self.playIdleSubAniDuration = {}
|
||||
self.isPlayingSubAni = false
|
||||
self.playSubAniDuration = {}
|
||||
self.attackDurationMap = {}
|
||||
self.attackKeyFrameTimeMap = {}
|
||||
self.shieldBuffList = {}
|
||||
@ -227,6 +230,9 @@ function BattleUnitComp:stopRunAction()
|
||||
end
|
||||
|
||||
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.baseObject:playAnimation(name, loop, forceRefresh)
|
||||
end
|
||||
@ -443,6 +449,15 @@ function BattleUnitComp:removeShield(buffEffect)
|
||||
end
|
||||
|
||||
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
|
||||
return false
|
||||
end
|
||||
@ -472,9 +487,14 @@ function BattleUnitComp:changeState(state)
|
||||
self:exitWaitState()
|
||||
elseif self.currState == UNIT_STATE.RECOVER_HP_WAVE then
|
||||
self:exitRecoverHpWaveState()
|
||||
elseif self.currState == UNIT_STATE.FROZEN then
|
||||
self:exitFrozenState()
|
||||
elseif self.currState == UNIT_STATE.VERITGO then
|
||||
self:exitVeritgoState()
|
||||
end
|
||||
-- 进入目标状态
|
||||
|
||||
self.currState = state
|
||||
|
||||
if state == UNIT_STATE.IDLE then
|
||||
self:enterIdleState()
|
||||
elseif state == UNIT_STATE.NORMAL_ATTACK then
|
||||
@ -495,6 +515,10 @@ function BattleUnitComp:changeState(state)
|
||||
self:enterWaitState()
|
||||
elseif state == UNIT_STATE.RECOVER_HP_WAVE then
|
||||
self:enterRecoverHpWaveState()
|
||||
elseif state == UNIT_STATE.FROZEN then
|
||||
self:enterFrozenState()
|
||||
elseif state == UNIT_STATE.VERITGO then
|
||||
self:enterVeritgoState()
|
||||
end
|
||||
return true
|
||||
end
|
||||
@ -646,11 +670,11 @@ function BattleUnitComp:enterIdleState()
|
||||
end
|
||||
|
||||
function BattleUnitComp:updateIdle(dt)
|
||||
self:updateIdleSubAni(dt)
|
||||
self:updateIdleSubAni(dt, SPINE_ANIMATION_NAME.IDLE)
|
||||
end
|
||||
|
||||
function BattleUnitComp:updateIdleSubAni(...)
|
||||
if not self.currAnimationName then
|
||||
if not self.currAnimationName or not self.isPlayingSubAni then
|
||||
return
|
||||
end
|
||||
if self.currAnimationName == SPINE_ANIMATION_NAME.HIT then
|
||||
@ -661,28 +685,35 @@ function BattleUnitComp:updateIdleSubAni(...)
|
||||
end
|
||||
|
||||
function BattleUnitComp:playHurt()
|
||||
local name = SPINE_ANIMATION_NAME.HIT
|
||||
self.playIdleSubAniTime = 0
|
||||
if self.playIdleSubAniDuration[name] == nil then
|
||||
self.playIdleSubAniDuration[name] = self:getAnimationDuration(name)
|
||||
if self.currState == UNIT_STATE.IDLE or
|
||||
self.currState == UNIT_STATE.VERITGO then
|
||||
local name = HURT_ANI_NAME_LIST[math.random(1, HURT_ANI_NAME_LIST_COUNT)]
|
||||
self.playSubAniTime = 0
|
||||
self.curHurtName = name
|
||||
if self.playSubAniDuration[name] == nil then
|
||||
self.playSubAniDuration[name] = self:getAnimationDuration(name)
|
||||
end
|
||||
self:playAnimation(name, false, false)
|
||||
end
|
||||
self:playAnimation(name, false, false)
|
||||
end
|
||||
|
||||
function BattleUnitComp:updateHurt(dt)
|
||||
self.playIdleSubAniTime = self.playIdleSubAniTime + dt
|
||||
if self.playIdleSubAniTime >= self.playIdleSubAniDuration[SPINE_ANIMATION_NAME.HIT] then
|
||||
self:playAnimation(SPINE_ANIMATION_NAME.IDLE, true, false)
|
||||
function BattleUnitComp:updateHurt(dt, overAniName)
|
||||
self.playSubAniTime = self.playSubAniTime + dt
|
||||
if self.playSubAniTime >= self.playSubAniDuration[self.curHurtName or SPINE_ANIMATION_NAME.HIT] then
|
||||
self:playAnimation(overAniName, true, false)
|
||||
self.isPlayingSubAni = false
|
||||
end
|
||||
end
|
||||
|
||||
function BattleUnitComp:playBlock()
|
||||
local name = SPINE_ANIMATION_NAME.BLOCK
|
||||
self.playIdleSubAniTime = 0
|
||||
if self.playIdleSubAniDuration[name] == nil then
|
||||
self.playIdleSubAniDuration[name] = self:getAnimationDuration(name)
|
||||
if self.currState == UNIT_STATE.IDLE then
|
||||
local name = SPINE_ANIMATION_NAME.BLOCK
|
||||
self.playSubAniTime = 0
|
||||
if self.playSubAniDuration[name] == nil then
|
||||
self.playSubAniDuration[name] = self:getAnimationDuration(name)
|
||||
end
|
||||
self:playAnimation(name, false, false)
|
||||
end
|
||||
self:playAnimation(name, false, false)
|
||||
|
||||
local direction = BattleConst.EFFECT_TYPE_MOVE_R
|
||||
local x, y = self.baseObject:fastGetLocalPosition()
|
||||
@ -694,13 +725,36 @@ function BattleUnitComp:playBlock()
|
||||
end
|
||||
|
||||
|
||||
function BattleUnitComp:updateBlock(dt)
|
||||
self.playIdleSubAniTime = self.playIdleSubAniTime + dt
|
||||
if self.playIdleSubAniTime >= self.playIdleSubAniDuration[SPINE_ANIMATION_NAME.BLOCK] then
|
||||
self:playAnimation(SPINE_ANIMATION_NAME.IDLE, true, false)
|
||||
function BattleUnitComp:updateBlock(dt, overAniName)
|
||||
self.playSubAniTime = self.playSubAniTime + dt
|
||||
if self.playSubAniTime >= self.playSubAniDuration[SPINE_ANIMATION_NAME.BLOCK] then
|
||||
self:playAnimation(overAniName, true, false)
|
||||
self.isPlayingSubAni = false
|
||||
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()
|
||||
self.recoverHpCount = BattleConst.RECOVER_HP_COUNT
|
||||
self.recoverHpTime = BattleConst.RECOVER_HP_INTERVAL / 2
|
||||
@ -1482,7 +1536,7 @@ function BattleUnitComp:takeDamageOrCure(atker, num, effectType, effectStatus, d
|
||||
local hpPercent = self.unitEntity:getHpPercent()
|
||||
self.battleController:refreshHp(self.side, hp, hpPercent)
|
||||
if atker:getIsCentralizedAttack() then
|
||||
if damage < 0 and self.currState == UNIT_STATE.IDLE then
|
||||
if damage < 0 then
|
||||
self:playHurt()
|
||||
end
|
||||
else
|
||||
@ -1492,7 +1546,7 @@ function BattleUnitComp:takeDamageOrCure(atker, num, effectType, effectStatus, d
|
||||
local target = self.battleController:getOtherSideMainUnit(self.side)
|
||||
target:checkPassiveEvent(BattleConst.PASSIVE_EVENT.ON_DEAD_BY_BURN, target)
|
||||
end
|
||||
elseif damage < 0 and self.currState == UNIT_STATE.IDLE then
|
||||
elseif damage < 0 then
|
||||
self:playHurt()
|
||||
end
|
||||
end
|
||||
@ -1712,6 +1766,10 @@ function BattleUnitComp:tick(dt)
|
||||
self:updateWaitState(dt)
|
||||
elseif self.currState == UNIT_STATE.RECOVER_HP_WAVE then
|
||||
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
|
||||
|
||||
|
||||
@ -173,6 +173,7 @@ function BattleTeam:onRoundEnd()
|
||||
end
|
||||
self:doBuffWork()
|
||||
self.comboCount = 0
|
||||
self:getMainUnit():changeState(BattleConst.UNIT_STATE.IDLE)
|
||||
end
|
||||
|
||||
function BattleTeam:addShield(buffEffect)
|
||||
|
||||
@ -90,8 +90,8 @@ function ChapterManager:endFightFinish(result)
|
||||
end
|
||||
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.GoldPigData:addGoldPigCount()
|
||||
-- 处理金猪,要在章节更新之后
|
||||
DataManager.GoldPigData:addGoldPigCount()
|
||||
|
||||
local newMaxChapter = DataManager.ChapterData:getNewChapterId()
|
||||
if maxChapter ~= newMaxChapter then
|
||||
|
||||
@ -8,32 +8,63 @@ function GoldPigUI:getPrefabPath()
|
||||
return "assets/prefabs/ui/activity/gold_pig/gold_pig_ui.prefab"
|
||||
end
|
||||
|
||||
function GoldPigUI:ctor()
|
||||
self.goldPigId = DataManager.GoldPigData:getId()
|
||||
end
|
||||
|
||||
function GoldPigUI:onLoadRootComplete()
|
||||
local uiMap = self.root:genAllChildren()
|
||||
uiMap["gold_pig_ui.bg.close_btn"]:addClickListener(function()
|
||||
self:closeUI()
|
||||
end)
|
||||
|
||||
uiMap["gold_pig_ui.bg.title_tx"]:setText("临时文本:超值金猪")
|
||||
uiMap["gold_pig_ui.bg.desc_tx"]:setText("临时文本:挑战关卡并收集钻石,你就可以获得一笔划算的交易。")
|
||||
uiMap["gold_pig_ui.bg.value_bg.tx"]:setText("临时文本:300%")
|
||||
local currGem = DataManager.GoldPigData:getGoldPigGemCount()
|
||||
local maxGem = DataManager.GoldPigData:getGoldPigGemMaxCount()
|
||||
uiMap["gold_pig_ui.bg.title_tx"]:setText(I18N:getGlobalText(I18N.GlobalConst.GOLD_PIG_TITLE))
|
||||
uiMap["gold_pig_ui.bg.desc_tx"]:setText(I18N:getGlobalText(I18N.GlobalConst.GOLD_PIG_DESC))
|
||||
|
||||
local levelInfo = DataManager.GoldPigData:getCurrLevelInfo()
|
||||
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"]
|
||||
nowGemTx:setText(GFunc.intToString(currGem))
|
||||
local nowGemImg = uiMap["gold_pig_ui.bg.slider.now_gem_bg.gem_img"]
|
||||
GFunc.centerImgAndTx(nowGemImg, nowGemTx, 0, -4)
|
||||
|
||||
local maxGemTx = uiMap["gold_pig_ui.bg.slider.max_gem_bg.gem_tx"]
|
||||
maxGemTx:setText(GFunc.intToString(maxGem))
|
||||
local maxGemImg = uiMap["gold_pig_ui.bg.slider.max_gem_bg.gem_img"]
|
||||
GFunc.centerImgAndTx(maxGemImg, maxGemTx, 0, -4)
|
||||
local sliderWidth = uiMap["gold_pig_ui.bg.slider"]:getRectWidth()
|
||||
uiMap["gold_pig_ui.bg.slider.now_gem_bg"]:setAnchoredPositionX((percent - 0.5) * sliderWidth)
|
||||
|
||||
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()
|
||||
ModuleManager.ActivityManager:buyGoldPig(self.goldPigId)
|
||||
end)
|
||||
local rechargeId = DataManager.GoldPigData:getRechargeId()
|
||||
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
|
||||
|
||||
return GoldPigUI
|
||||
@ -10,6 +10,7 @@ function BattleResultUI:ctor(params)
|
||||
self.rewards = params.rewards
|
||||
self.combatReport = params.combatReport
|
||||
self.mysteryBoxIdx = params.mysteryBoxIdx or 0
|
||||
self.isTryShowGoldPig = false
|
||||
self.totalDmg = 0
|
||||
if self.combatReport.atkReport then
|
||||
for _, info in ipairs(self.combatReport.atkReport) do
|
||||
@ -18,6 +19,12 @@ function BattleResultUI:ctor(params)
|
||||
end
|
||||
end
|
||||
|
||||
function BattleResultUI:onClose()
|
||||
if self.sliderSequence then
|
||||
self.sliderSequence:Kill()
|
||||
end
|
||||
end
|
||||
|
||||
function BattleResultUI:onLoadRootComplete()
|
||||
self:_display()
|
||||
self:_addListeners()
|
||||
@ -31,20 +38,28 @@ function BattleResultUI:_display()
|
||||
self:refreshDefeatNode()
|
||||
AudioManager:playEffect(AudioManager.EFFECT_ID.BATTLE_DEFEAT)
|
||||
end
|
||||
|
||||
self:refreshFixedInfo()
|
||||
self:refreshRewards()
|
||||
self:refreshUnitInfo()
|
||||
self:initGoldPig()
|
||||
end
|
||||
|
||||
function BattleResultUI:_addListeners()
|
||||
local uiMap = self.root:genAllChildren()
|
||||
uiMap["battle_result_ui.mask_v"]:addClickListener(function()
|
||||
ModuleManager.BattleManager:endBattleAndExit()
|
||||
if self.isTryShowGoldPig then
|
||||
ModuleManager.BattleManager:endBattleAndExit()
|
||||
else
|
||||
self:tryShowGoldPig()
|
||||
end
|
||||
end)
|
||||
|
||||
uiMap["battle_result_ui.mask_d"]:addClickListener(function()
|
||||
ModuleManager.BattleManager:endBattleAndExit()
|
||||
if self.isTryShowGoldPig then
|
||||
ModuleManager.BattleManager:endBattleAndExit()
|
||||
else
|
||||
self:tryShowGoldPig()
|
||||
end
|
||||
end)
|
||||
end
|
||||
|
||||
@ -54,7 +69,7 @@ function BattleResultUI:refreshFixedInfo()
|
||||
local desc1 = uiMap["battle_result_ui.desc_1"]
|
||||
local desc2 = uiMap["battle_result_ui.desc_2"]
|
||||
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"]
|
||||
desc1:setText(I18N:getGlobalText(I18N.GlobalConst.BATTLE_DESC_4))
|
||||
desc2:setText(self.combatReport.wave)
|
||||
@ -97,7 +112,9 @@ function BattleResultUI:refreshRewards()
|
||||
end
|
||||
|
||||
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:addInitCallback(function()
|
||||
return GConst.TYPEOF_LUA_CLASS.REWARD_CELL
|
||||
@ -149,4 +166,57 @@ function BattleResultUI:refreshUnitInfo()
|
||||
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
|
||||
@ -17,10 +17,12 @@ function MailCell:refresh(entity)
|
||||
local normalNode = uiMap["mail_cell.bg_normal"]
|
||||
local adNode = uiMap["mail_cell.bg_ad"]
|
||||
local readNode = uiMap["mail_cell.bg_read"]
|
||||
local isReadType = false
|
||||
if entity:getMailType() == GConst.MailConst.MAIL_TYPE.CUSTOM then
|
||||
normalNode:setVisible(false)
|
||||
adNode:setVisible(false)
|
||||
readNode:setVisible(true)
|
||||
isReadType = true
|
||||
elseif entity:getMailType() == GConst.MailConst.MAIL_TYPE.AD then
|
||||
normalNode:setVisible(false)
|
||||
adNode:setVisible(true)
|
||||
@ -33,6 +35,7 @@ function MailCell:refresh(entity)
|
||||
normalNode:setVisible(false)
|
||||
adNode:setVisible(false)
|
||||
readNode:setVisible(true)
|
||||
isReadType = true
|
||||
end
|
||||
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))
|
||||
@ -86,6 +89,18 @@ function MailCell:refresh(entity)
|
||||
self.rewardCell:getBaseObject():setVisible(false)
|
||||
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
|
||||
|
||||
return MailCell
|
||||
@ -79,12 +79,21 @@ end
|
||||
function SideBarBaseCellComp:onClick()
|
||||
end
|
||||
|
||||
function SideBarBaseCellComp:updateTime()
|
||||
end
|
||||
|
||||
-- 常规逻辑 ***********************************************************
|
||||
|
||||
function SideBarBaseCellComp:init()
|
||||
local uiMap = self.baseObject:genAllChildren()
|
||||
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:onClick()
|
||||
end)
|
||||
@ -106,10 +115,6 @@ function SideBarBaseCellComp:getCellPath()
|
||||
return self.cellPath
|
||||
end
|
||||
|
||||
function SideBarBaseCellComp:setCellPath(cellPath)
|
||||
self.cellPath = cellPath
|
||||
end
|
||||
|
||||
function SideBarBaseCellComp:showRedPoint()
|
||||
if self.redPoint then
|
||||
return
|
||||
@ -127,4 +132,16 @@ function SideBarBaseCellComp:hideRedPoint()
|
||||
self.baseObject:removeRedPoint()
|
||||
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
|
||||
@ -2,7 +2,7 @@ local SideBarBaseCellComp = require "app/ui/main_city/cell/side_bar_base_cell"
|
||||
local SideBarGoldPigCell = class("SideBarGoldPigCell", SideBarBaseCellComp)
|
||||
|
||||
function SideBarGoldPigCell:getIsOpen()
|
||||
return true
|
||||
return DataManager.GoldPigData:getIsOpen()
|
||||
end
|
||||
|
||||
function SideBarGoldPigCell:getIconRes()
|
||||
@ -13,4 +13,63 @@ function SideBarGoldPigCell:onClick()
|
||||
ModuleManager.ActivityManager:showGoldPigUI()
|
||||
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
|
||||
@ -359,7 +359,7 @@ function MainCityUI:refreshLeftBtns()
|
||||
cell = self:addSideBarCellComp(v)
|
||||
cell:getBaseObject():setParent(self.leftSideBar, false)
|
||||
end
|
||||
cell:setCellPath(v)
|
||||
cell:initWithParentUI(self, v, true)
|
||||
table.insert(self.leftBarList, cell)
|
||||
end
|
||||
end
|
||||
@ -421,7 +421,7 @@ function MainCityUI:refreshRightBtns()
|
||||
cell = self:addSideBarCellComp(v)
|
||||
cell:getBaseObject():setParent(self.rightSideBar, false)
|
||||
end
|
||||
cell:setCellPath(v)
|
||||
cell:initWithParentUI(self, v, false)
|
||||
table.insert(self.rightBarList, cell)
|
||||
end
|
||||
end
|
||||
@ -458,6 +458,7 @@ function MainCityUI:clearSideBarList(sideBarList)
|
||||
local count = #sideBarList
|
||||
for i = 1, count do
|
||||
local cell = table.remove(sideBarList)
|
||||
cell:setVisible(false)
|
||||
self.sideBarCellMap[cell:getCellPath()] = cell
|
||||
end
|
||||
end
|
||||
@ -594,6 +595,26 @@ function MainCityUI:updateTime()
|
||||
self.subComps[self.selectedIndex]:refreshTime()
|
||||
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
|
||||
|
||||
function MainCityUI:updateSideBarStatus()
|
||||
@ -681,6 +702,19 @@ function MainCityUI:setRightSideBarArrowRedPoint(isShow)
|
||||
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()
|
||||
local uiMap = self.root:genAllChildren()
|
||||
local heroRpObj = uiMap["main_ui.bottom_node.icons.ui_spine_obj_2.rp_node"]
|
||||
|
||||
@ -1,7 +1,5 @@
|
||||
local PlayerLevelUpUI = class("PlayerLevelUpUI", BaseUI)
|
||||
|
||||
local CELL_WIDTH = 114.8
|
||||
|
||||
function PlayerLevelUpUI:isFullScreen()
|
||||
return false
|
||||
end
|
||||
|
||||
@ -1,15 +1,86 @@
|
||||
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
|
||||
self.data.id = data.id or 0
|
||||
self.data.id = data.current_id or 0
|
||||
if self.data.id == 0 then
|
||||
self.data.id = self:getFirstLevelId()
|
||||
end
|
||||
self.data.count = data.count or 0
|
||||
self.data.cd = data.cd or 0
|
||||
self.data.endTime = data.end_time or 0
|
||||
self.data.isOpen = false
|
||||
self.data.count = data.add_diamond or 0
|
||||
self.lastCount = self.data.count
|
||||
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
|
||||
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
|
||||
|
||||
function GoldPigData:getIsOpen()
|
||||
@ -17,28 +88,59 @@ function GoldPigData:getIsOpen()
|
||||
end
|
||||
|
||||
function GoldPigData:addGoldPigCount()
|
||||
if not self.data.isOpen then
|
||||
self:tryActiveGoldPig()
|
||||
if not self.data.isOpen and not self:tryActiveGoldPig() then
|
||||
return
|
||||
end
|
||||
local info = self:getCurrLevelInfo()
|
||||
if info == nil then
|
||||
return
|
||||
end
|
||||
if self.data.count >= info.max_diamond then
|
||||
if self.data.count >= info.max_diamond then -- 已经满了
|
||||
return
|
||||
end
|
||||
self.lastCount = self.data.count
|
||||
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.fullTime = Time:getServerTime()
|
||||
self.endTime = self.data.fullTime + self:getDuration()
|
||||
self.nextShowTime = self.endTime + self:getTimeOverCD()
|
||||
DataManager:registerDataCd("GoldPigData")
|
||||
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
|
||||
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()
|
||||
if info == nil then
|
||||
return 1
|
||||
@ -94,48 +196,31 @@ function GoldPigData:getCurrLevelInfo()
|
||||
return cfg[self.data.id]
|
||||
end
|
||||
|
||||
function GoldPigData:tryActiveGoldPig()
|
||||
if not ModuleManager:getIsOpen(ModuleManager.MODULE_KEY.GOLD_PIG, true) then
|
||||
return
|
||||
end
|
||||
if self.data.cd > 0 then
|
||||
return
|
||||
end
|
||||
if self.data.endTime >= Time:getServerTime() then
|
||||
return
|
||||
end
|
||||
self.data.isOpen = true
|
||||
self.data.endTime = Time:getServerTime() + self:getDuration()
|
||||
function GoldPigData:levelDown()
|
||||
local levelInfo = self:getCurrLevelInfo()
|
||||
self.data.id = levelInfo.before_id
|
||||
|
||||
local currLevelInfo = self:getCurrLevelInfo()
|
||||
self.data.count = currLevelInfo.min_diamond
|
||||
self.lastCount = self.data.count
|
||||
self.maxCount = self:getMaxCount()
|
||||
end
|
||||
|
||||
-- 时间到了,消失并降档
|
||||
function GoldPigData:onTimeOver()
|
||||
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()
|
||||
function GoldPigData:getEndTime()
|
||||
return self.endTime
|
||||
end
|
||||
|
||||
-- 购买后,消失并升档位
|
||||
function GoldPigData:onBought(id)
|
||||
function GoldPigData:updateCd()
|
||||
if not self.data.isOpen then
|
||||
DataManager:unregisterDataCd("GoldPigData")
|
||||
return
|
||||
end
|
||||
self.data.isOpen = false
|
||||
local cfg = self:getCfg()
|
||||
local info = cfg[id]
|
||||
if info then
|
||||
self.data.id = info.next_id or id
|
||||
if self.endTime > 0 and Time:getServerTime() > self.endTime then -- 到时间该消失了
|
||||
DataManager:unregisterDataCd("GoldPigData")
|
||||
self:levelDown()
|
||||
self.data.isOpen = false
|
||||
self:markDirty()
|
||||
end
|
||||
self.data.cd = self:getBoughtCD()
|
||||
end
|
||||
|
||||
return GoldPigData
|
||||
@ -273,6 +273,10 @@ function BattleTeamEntity:removeActiveSkillLimit(name)
|
||||
self.activeSkillLimit = self.activeSkillLimit - 1
|
||||
end
|
||||
|
||||
function BattleTeamEntity:getIsStun()
|
||||
return self.stunCount > 0
|
||||
end
|
||||
|
||||
function BattleTeamEntity:getIsLethargy()
|
||||
return self.lethargyCount > 0
|
||||
end
|
||||
|
||||
@ -354,6 +354,10 @@ function BattleUnitEntity:removeActiveSkillLimit(name)
|
||||
self.team:removeActiveSkillLimit(name)
|
||||
end
|
||||
|
||||
function BattleUnitEntity:getIsStun()
|
||||
return self.team:getIsStun()
|
||||
end
|
||||
|
||||
function BattleUnitEntity:getIsLethargy()
|
||||
return self.team:getIsLethargy()
|
||||
end
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user